@segment/action-destinations 3.105.1-alpha.4 → 3.105.1-alpha.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.
- package/dist/destinations/amplitude/emptyObject.d.ts +2 -0
- package/dist/destinations/amplitude/emptyObject.js +7 -0
- package/dist/destinations/amplitude/emptyObject.js.map +1 -0
- package/dist/destinations/amplitude/index.js +3 -1
- package/dist/destinations/amplitude/index.js.map +1 -1
- package/dist/destinations/amplitude/logEventV2/generated-types.d.ts +77 -0
- package/dist/destinations/amplitude/logEventV2/generated-types.js +3 -0
- package/dist/destinations/amplitude/logEventV2/generated-types.js.map +1 -0
- package/dist/destinations/amplitude/logEventV2/index.d.ts +13 -0
- package/dist/destinations/amplitude/logEventV2/index.js +237 -0
- package/dist/destinations/amplitude/logEventV2/index.js.map +1 -0
- package/package.json +4 -4
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
function removeEmptyKeysAndCheckIfEmpty(object) {
|
|
4
|
+
return Object.keys(Object.fromEntries(Object.entries(object ?? {}).filter(([_, v]) => v))).length > 0;
|
|
5
|
+
}
|
|
6
|
+
exports.default = removeEmptyKeysAndCheckIfEmpty;
|
|
7
|
+
//# sourceMappingURL=emptyObject.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emptyObject.js","sourceRoot":"","sources":["../../../src/destinations/amplitude/emptyObject.ts"],"names":[],"mappings":";;AASA,SAAwB,8BAA8B,CACpD,MAAiF;IAEjF,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAA;AACvG,CAAC;AAJD,iDAIC"}
|
|
@@ -10,6 +10,7 @@ const mapUser_1 = __importDefault(require("./mapUser"));
|
|
|
10
10
|
const groupIdentifyUser_1 = __importDefault(require("./groupIdentifyUser"));
|
|
11
11
|
const logPurchase_1 = __importDefault(require("./logPurchase"));
|
|
12
12
|
const regional_endpoints_1 = require("./regional-endpoints");
|
|
13
|
+
const logEventV2_1 = __importDefault(require("./logEventV2"));
|
|
13
14
|
const presets = [
|
|
14
15
|
{
|
|
15
16
|
name: 'Track Calls',
|
|
@@ -120,7 +121,8 @@ const destination = {
|
|
|
120
121
|
identifyUser: identifyUser_1.default,
|
|
121
122
|
mapUser: mapUser_1.default,
|
|
122
123
|
groupIdentifyUser: groupIdentifyUser_1.default,
|
|
123
|
-
logPurchase: logPurchase_1.default
|
|
124
|
+
logPurchase: logPurchase_1.default,
|
|
125
|
+
logEventV2: logEventV2_1.default
|
|
124
126
|
}
|
|
125
127
|
};
|
|
126
128
|
exports.default = destination;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/amplitude/index.ts"],"names":[],"mappings":";;;;;AACA,wDAAqD;AACrD,kEAAyC;AACzC,0DAAiC;AACjC,wDAA+B;AAC/B,4EAAmD;AACnD,gEAAuC;AAEvC,6DAA0D;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/amplitude/index.ts"],"names":[],"mappings":";;;;;AACA,wDAAqD;AACrD,kEAAyC;AACzC,0DAAiC;AACjC,wDAA+B;AAC/B,4EAAmD;AACnD,gEAAuC;AAEvC,6DAA0D;AAE1D,8DAAqC;AAGrC,MAAM,OAAO,GAAqC;IAChD;QACE,IAAI,EAAE,aAAa;QACnB,SAAS,EAAE,+CAA+C;QAC1D,aAAa,EAAE,UAAU;QACzB,OAAO,EAAE,4BAAa,CAAC,kBAAQ,CAAC,MAAM,CAAC;KACxC;IACD;QACE,IAAI,EAAE,uBAAuB;QAC7B,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
@@ -0,0 +1,77 @@
|
|
|
1
|
+
export interface Payload {
|
|
2
|
+
user_id?: string | null;
|
|
3
|
+
device_id?: string;
|
|
4
|
+
event_type: string;
|
|
5
|
+
session_id?: string | number;
|
|
6
|
+
time?: string | number;
|
|
7
|
+
event_properties?: {
|
|
8
|
+
[k: string]: unknown;
|
|
9
|
+
};
|
|
10
|
+
user_properties?: {
|
|
11
|
+
[k: string]: unknown;
|
|
12
|
+
};
|
|
13
|
+
groups?: {
|
|
14
|
+
[k: string]: unknown;
|
|
15
|
+
};
|
|
16
|
+
app_version?: string;
|
|
17
|
+
platform?: string;
|
|
18
|
+
os_name?: string;
|
|
19
|
+
os_version?: string;
|
|
20
|
+
device_brand?: string;
|
|
21
|
+
device_manufacturer?: string;
|
|
22
|
+
device_model?: string;
|
|
23
|
+
carrier?: string;
|
|
24
|
+
country?: string;
|
|
25
|
+
region?: string;
|
|
26
|
+
city?: string;
|
|
27
|
+
dma?: string;
|
|
28
|
+
language?: string;
|
|
29
|
+
price?: number;
|
|
30
|
+
quantity?: number;
|
|
31
|
+
revenue?: number;
|
|
32
|
+
productId?: string;
|
|
33
|
+
revenueType?: string;
|
|
34
|
+
location_lat?: number;
|
|
35
|
+
location_lng?: number;
|
|
36
|
+
ip?: string;
|
|
37
|
+
idfa?: string;
|
|
38
|
+
idfv?: string;
|
|
39
|
+
adid?: string;
|
|
40
|
+
android_id?: string;
|
|
41
|
+
event_id?: number;
|
|
42
|
+
insert_id?: string;
|
|
43
|
+
library?: string;
|
|
44
|
+
products?: {
|
|
45
|
+
price?: number;
|
|
46
|
+
quantity?: number;
|
|
47
|
+
revenue?: number;
|
|
48
|
+
productId?: string;
|
|
49
|
+
revenueType?: string;
|
|
50
|
+
[k: string]: unknown;
|
|
51
|
+
}[];
|
|
52
|
+
setOnce?: {
|
|
53
|
+
initial_referrer?: string;
|
|
54
|
+
initial_utm_source?: string;
|
|
55
|
+
initial_utm_medium?: string;
|
|
56
|
+
initial_utm_campaign?: string;
|
|
57
|
+
initial_utm_term?: string;
|
|
58
|
+
initial_utm_content?: string;
|
|
59
|
+
[k: string]: unknown;
|
|
60
|
+
};
|
|
61
|
+
setAlways?: {
|
|
62
|
+
referrer?: string;
|
|
63
|
+
utm_source?: string;
|
|
64
|
+
utm_medium?: string;
|
|
65
|
+
utm_campaign?: string;
|
|
66
|
+
utm_term?: string;
|
|
67
|
+
utm_content?: string;
|
|
68
|
+
[k: string]: unknown;
|
|
69
|
+
};
|
|
70
|
+
add?: {
|
|
71
|
+
[k: string]: unknown;
|
|
72
|
+
};
|
|
73
|
+
use_batch_endpoint?: boolean;
|
|
74
|
+
userAgent?: string;
|
|
75
|
+
userAgentParsing?: boolean;
|
|
76
|
+
min_id_length?: number | null;
|
|
77
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/amplitude/logEventV2/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ActionDefinition } from '@segment/actions-core';
|
|
2
|
+
import type { Settings } from '../generated-types';
|
|
3
|
+
import type { Payload } from './generated-types';
|
|
4
|
+
export interface AmplitudeEvent extends Omit<Payload, 'products' | 'time' | 'session_id'> {
|
|
5
|
+
library?: string;
|
|
6
|
+
time?: number;
|
|
7
|
+
session_id?: number;
|
|
8
|
+
options?: {
|
|
9
|
+
min_id_length: number;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
declare const action: ActionDefinition<Settings, Payload>;
|
|
13
|
+
export default action;
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
7
|
+
const dayjs_1 = __importDefault(require("dayjs"));
|
|
8
|
+
const emptyObject_1 = __importDefault(require("../emptyObject"));
|
|
9
|
+
const event_schema_1 = require("../event-schema");
|
|
10
|
+
const regional_endpoints_1 = require("../regional-endpoints");
|
|
11
|
+
const user_agent_1 = require("../user-agent");
|
|
12
|
+
const revenueKeys = ['revenue', 'price', 'productId', 'quantity', 'revenueType'];
|
|
13
|
+
const action = {
|
|
14
|
+
title: 'Log Event V2',
|
|
15
|
+
description: 'Send an event to Amplitude',
|
|
16
|
+
fields: {
|
|
17
|
+
...event_schema_1.eventSchema,
|
|
18
|
+
products: {
|
|
19
|
+
label: 'Products',
|
|
20
|
+
description: 'The list of products purchased.',
|
|
21
|
+
type: 'object',
|
|
22
|
+
multiple: true,
|
|
23
|
+
additionalProperties: true,
|
|
24
|
+
properties: {
|
|
25
|
+
price: {
|
|
26
|
+
label: 'Price',
|
|
27
|
+
type: 'number',
|
|
28
|
+
description: 'The price of the item purchased. Required for revenue data if the revenue field is not sent. You can use negative values to indicate refunds.'
|
|
29
|
+
},
|
|
30
|
+
quantity: {
|
|
31
|
+
label: 'Quantity',
|
|
32
|
+
type: 'integer',
|
|
33
|
+
description: 'The quantity of the item purchased. Defaults to 1 if not specified.'
|
|
34
|
+
},
|
|
35
|
+
revenue: {
|
|
36
|
+
label: 'Revenue',
|
|
37
|
+
type: 'number',
|
|
38
|
+
description: 'Revenue = price * quantity. If you send all 3 fields of price, quantity, and revenue, then (price * quantity) will be used as the revenue value. You can use negative values to indicate refunds.'
|
|
39
|
+
},
|
|
40
|
+
productId: {
|
|
41
|
+
label: 'Product ID',
|
|
42
|
+
type: 'string',
|
|
43
|
+
description: 'An identifier for the item purchased. You must send a price and quantity or revenue with this field.'
|
|
44
|
+
},
|
|
45
|
+
revenueType: {
|
|
46
|
+
label: 'Revenue Type',
|
|
47
|
+
type: 'string',
|
|
48
|
+
description: 'The type of revenue for the item purchased. You must send a price and quantity or revenue with this field.'
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
default: {
|
|
52
|
+
'@arrayPath': [
|
|
53
|
+
'$.properties.products',
|
|
54
|
+
{
|
|
55
|
+
price: {
|
|
56
|
+
'@path': 'price'
|
|
57
|
+
},
|
|
58
|
+
revenue: {
|
|
59
|
+
'@path': 'revenue'
|
|
60
|
+
},
|
|
61
|
+
quantity: {
|
|
62
|
+
'@path': 'quantity'
|
|
63
|
+
},
|
|
64
|
+
productId: {
|
|
65
|
+
'@path': 'productId'
|
|
66
|
+
},
|
|
67
|
+
revenueType: {
|
|
68
|
+
'@path': 'revenueType'
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
setOnce: {
|
|
75
|
+
label: 'Set Once',
|
|
76
|
+
description: 'The following fields will be set only once per session when using AJS2 as the source',
|
|
77
|
+
type: 'object',
|
|
78
|
+
additionalProperties: true,
|
|
79
|
+
properties: {
|
|
80
|
+
initial_referrer: {
|
|
81
|
+
label: 'Initial Referrer',
|
|
82
|
+
type: 'string',
|
|
83
|
+
description: 'The referrer of the web request'
|
|
84
|
+
},
|
|
85
|
+
initial_utm_source: {
|
|
86
|
+
label: 'Initial UTM Source',
|
|
87
|
+
type: 'string'
|
|
88
|
+
},
|
|
89
|
+
initial_utm_medium: {
|
|
90
|
+
label: 'Initial UTM Medium',
|
|
91
|
+
type: 'string'
|
|
92
|
+
},
|
|
93
|
+
initial_utm_campaign: {
|
|
94
|
+
label: 'Initial UTM Campaign',
|
|
95
|
+
type: 'string'
|
|
96
|
+
},
|
|
97
|
+
initial_utm_term: {
|
|
98
|
+
label: 'Initial UTM Term',
|
|
99
|
+
type: 'string'
|
|
100
|
+
},
|
|
101
|
+
initial_utm_content: {
|
|
102
|
+
label: 'Initial UTM Content',
|
|
103
|
+
type: 'string'
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
default: {
|
|
107
|
+
initial_referrer: { '@path': '$.context.page.referrer' },
|
|
108
|
+
initial_utm_source: { '@path': '$.context.campaign.source' },
|
|
109
|
+
initial_utm_medium: { '@path': '$.context.campaign.medium' },
|
|
110
|
+
initial_utm_campaign: { '@path': '$.context.campaign.name' },
|
|
111
|
+
initial_utm_term: { '@path': '$.context.campaign.term' },
|
|
112
|
+
initial_utm_content: { '@path': '$.context.campaign.content' }
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
setAlways: {
|
|
116
|
+
label: 'Set Always',
|
|
117
|
+
description: 'The following fields will be set every session when using AJS2 as the source',
|
|
118
|
+
type: 'object',
|
|
119
|
+
additionalProperties: true,
|
|
120
|
+
properties: {
|
|
121
|
+
referrer: {
|
|
122
|
+
label: 'Referrer',
|
|
123
|
+
type: 'string'
|
|
124
|
+
},
|
|
125
|
+
utm_source: {
|
|
126
|
+
label: 'UTM Source',
|
|
127
|
+
type: 'string'
|
|
128
|
+
},
|
|
129
|
+
utm_medium: {
|
|
130
|
+
label: 'UTM Medium',
|
|
131
|
+
type: 'string'
|
|
132
|
+
},
|
|
133
|
+
utm_campaign: {
|
|
134
|
+
label: 'UTM Campaign',
|
|
135
|
+
type: 'string'
|
|
136
|
+
},
|
|
137
|
+
utm_term: {
|
|
138
|
+
label: 'UTM Term',
|
|
139
|
+
type: 'string'
|
|
140
|
+
},
|
|
141
|
+
utm_content: {
|
|
142
|
+
label: 'UTM Content',
|
|
143
|
+
type: 'string'
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
default: {
|
|
147
|
+
referrer: { '@path': '$.context.page.referrer' },
|
|
148
|
+
utm_source: { '@path': '$.context.campaign.source' },
|
|
149
|
+
utm_medium: { '@path': '$.context.campaign.medium' },
|
|
150
|
+
utm_campaign: { '@path': '$.context.campaign.name' },
|
|
151
|
+
utm_term: { '@path': '$.context.campaign.term' },
|
|
152
|
+
utm_content: { '@path': '$.context.campaign.content' }
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
add: {
|
|
156
|
+
label: 'Add',
|
|
157
|
+
description: "Increment a user property by a number with add. If the user property doesn't have a value set yet, it's initialized to 0.",
|
|
158
|
+
type: 'object',
|
|
159
|
+
additionalProperties: true,
|
|
160
|
+
defaultObjectUI: 'keyvalue'
|
|
161
|
+
},
|
|
162
|
+
use_batch_endpoint: {
|
|
163
|
+
label: 'Use Batch Endpoint',
|
|
164
|
+
description: "If true, events are sent to Amplitude's `batch` endpoint rather than their `httpapi` events endpoint. Enabling this setting may help reduce 429s – or throttling errors – from Amplitude. More information about Amplitude's throttling is available in [their docs](https://developers.amplitude.com/docs/batch-event-upload-api#429s-in-depth).",
|
|
165
|
+
type: 'boolean',
|
|
166
|
+
default: false
|
|
167
|
+
},
|
|
168
|
+
userAgent: {
|
|
169
|
+
label: 'User Agent',
|
|
170
|
+
type: 'string',
|
|
171
|
+
description: 'The user agent of the device sending the event.',
|
|
172
|
+
default: {
|
|
173
|
+
'@path': '$.context.userAgent'
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
userAgentParsing: {
|
|
177
|
+
label: 'User Agent Parsing',
|
|
178
|
+
type: 'boolean',
|
|
179
|
+
description: 'Enabling this setting will set the Device manufacturer, Device Model and OS Name properties based on the user agent string provided in the userAgent field',
|
|
180
|
+
default: true
|
|
181
|
+
},
|
|
182
|
+
min_id_length: {
|
|
183
|
+
label: 'Minimum ID Length',
|
|
184
|
+
description: 'Amplitude has a default minimum id length of 5 characters for user_id and device_id fields. This field allows the minimum to be overridden to allow shorter id lengths.',
|
|
185
|
+
allowNull: true,
|
|
186
|
+
type: 'integer'
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
perform: (request, { payload, settings }) => {
|
|
190
|
+
const { time, session_id, userAgent, userAgentParsing, min_id_length, library, setOnce, setAlways, add, ...rest } = actions_core_1.omit(payload, revenueKeys);
|
|
191
|
+
const properties = rest;
|
|
192
|
+
let options;
|
|
193
|
+
if (properties.platform) {
|
|
194
|
+
properties.platform = properties.platform.replace(/ios/i, 'iOS').replace(/android/i, 'Android');
|
|
195
|
+
}
|
|
196
|
+
if (library) {
|
|
197
|
+
if (library === 'analytics.js')
|
|
198
|
+
properties.platform = 'Web';
|
|
199
|
+
}
|
|
200
|
+
if (time && dayjs_1.default.utc(time).isValid()) {
|
|
201
|
+
properties.time = dayjs_1.default.utc(time).valueOf();
|
|
202
|
+
}
|
|
203
|
+
if (session_id && dayjs_1.default.utc(session_id).isValid()) {
|
|
204
|
+
properties.session_id = dayjs_1.default.utc(session_id).valueOf();
|
|
205
|
+
}
|
|
206
|
+
if (min_id_length && min_id_length > 0) {
|
|
207
|
+
options = { min_id_length };
|
|
208
|
+
}
|
|
209
|
+
if (emptyObject_1.default(setOnce)) {
|
|
210
|
+
properties.user_properties = { ...properties.user_properties, $setOnce: setOnce };
|
|
211
|
+
}
|
|
212
|
+
if (emptyObject_1.default(setAlways)) {
|
|
213
|
+
properties.user_properties = { ...properties.user_properties, $set: setAlways };
|
|
214
|
+
}
|
|
215
|
+
if (emptyObject_1.default(add)) {
|
|
216
|
+
properties.user_properties = { ...properties.user_properties, $add: add };
|
|
217
|
+
}
|
|
218
|
+
const events = [
|
|
219
|
+
{
|
|
220
|
+
...(userAgentParsing && user_agent_1.parseUserAgentProperties(userAgent)),
|
|
221
|
+
...actions_core_1.removeUndefined(properties),
|
|
222
|
+
library: 'segment'
|
|
223
|
+
}
|
|
224
|
+
];
|
|
225
|
+
const endpoint = regional_endpoints_1.getEndpointByRegion(payload.use_batch_endpoint ? 'batch' : 'httpapi', settings.endpoint);
|
|
226
|
+
return request(endpoint, {
|
|
227
|
+
method: 'post',
|
|
228
|
+
json: {
|
|
229
|
+
api_key: settings.apiKey,
|
|
230
|
+
events,
|
|
231
|
+
options
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
exports.default = action;
|
|
237
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/amplitude/logEventV2/index.ts"],"names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AED,IAAI,aAAa,IAAI,aAAa,GAAG,CAAC,EAAE;YACtC,OAAO,GAAG,EAAE,aAAa,EAAE,CAAA;SAC5B;QAED,IAAI,qBAA8B,CAAC,OAAO,CAAC,EAAE;YAC3C,UAAU,CAAC,eAAe,GAAG,EAAE,GAAG,UAAU,CAAC,eAAe,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAA;SAClF;QACD,IAAI,qBAA8B,CAAC,SAAS,CAAC,EAAE;YAC7C,UAAU,CAAC,eAAe,GAAG,EAAE,GAAG,UAAU,CAAC,eAAe,EAAE,IAAI,EAAE,SAAS,EAAE,CAAA;SAChF;QACD,IAAI,qBAA8B,CAAC,GAAG,CAAC,EAAE;YACvC,UAAU,CAAC,eAAe,GAAG,EAAE,GAAG,UAAU,CAAC,eAAe,EAAE,IAAI,EAAE,GAAG,EAAE,CAAA;SAC1E;QAED,MAAM,MAAM,GAAqB;YAC/B;gBAEE,GAAG,CAAC,gBAAgB,IAAI,qCAAwB,CAAC,SAAS,CAAC,CAAC;gBAE5D,GAAG,8BAAe,CAAC,UAAU,CAAC;gBAC9B,OAAO,EAAE,SAAS;aACnB;SACF,CAAA;QAED,MAAM,QAAQ,GAAG,wCAAmB,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAA;QAEzG,OAAO,OAAO,CAAC,QAAQ,EAAE;YACvB,MAAM,EAAE,MAAM;YACd,IAAI,EAAE;gBACJ,OAAO,EAAE,QAAQ,CAAC,MAAM;gBACxB,MAAM;gBACN,OAAO;aACR;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@segment/action-destinations",
|
|
3
3
|
"description": "Destination Actions engine and definitions.",
|
|
4
|
-
"version": "3.105.1-alpha.
|
|
4
|
+
"version": "3.105.1-alpha.7",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/segmentio/action-destinations",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@amplitude/ua-parser-js": "^0.7.25",
|
|
40
40
|
"@segment/a1-notation": "^2.1.4",
|
|
41
|
-
"@segment/actions-core": "^3.35.1-
|
|
42
|
-
"@segment/actions-shared": "^1.18.1-alpha.
|
|
41
|
+
"@segment/actions-core": "^3.35.1-alpha.7",
|
|
42
|
+
"@segment/actions-shared": "^1.18.1-alpha.7",
|
|
43
43
|
"cheerio": "^1.0.0-rc.10",
|
|
44
44
|
"dayjs": "^1.10.7",
|
|
45
45
|
"escape-goat": "^3",
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"lcov"
|
|
66
66
|
]
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "d29c45c2914d565266e0bbf188aca1f287c21577"
|
|
69
69
|
}
|