avo 3.0.0-beta.1 → 3.1.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.
Files changed (3) hide show
  1. package/Avo.js +784 -1045
  2. package/cli.js +99 -18
  3. package/package.json +1 -1
package/Avo.js CHANGED
@@ -1,1170 +1,909 @@
1
- // Generated by Avo VERSION 92.16.0. You should never have to make changes to this file.
1
+ // Generated by Avo VERSION 108.28.0. You should never have to make changes to this file.
2
2
  // If you find yourself in the situation where you have to edit the file please contact us at hi@avo.app.
3
3
  // If you encounter a git conflict in this file run `avo pull` and it will be resolved automatically.
4
+ /* tslint:disable */
4
5
  /* eslint-disable */
5
-
6
- var __AVO_DEV__ = false;
7
- var __AVO_NOOP__ = false;
8
- var __AVO_LOGGER__ = null;
9
- var __AVO_ENV__ = null;
10
- var __REPORT_FAILURE_AS__ = null;
11
- var __STRICT__ = null;
12
- const avoInspectorApiKey = "3UWtteG9HenZ825cYoYr";
13
- var __INSPECTOR__ = null;
14
-
15
- var array_difference, AvoAssert, InternalAvoLogger;
16
- array_difference = function array_difference(a1, a2) {
17
- var result = [];
18
- for (var i = 0; i < a1.length; i++) {
19
- if (a2.indexOf(a1[i]) === -1) {
20
- result.push(a1[i]);
21
- }
6
+ export var AvoEnv;
7
+ (function (AvoEnv) {
8
+ AvoEnv["Prod"] = "prod";
9
+ AvoEnv["Dev"] = "dev";
10
+ })(AvoEnv = AvoEnv || (AvoEnv = {}));
11
+ let __AVO_ENV__ = null;
12
+ // @ts-ignore
13
+ let __AVO_NOOP__ = false;
14
+ // @ts-ignore
15
+ let __AVO_LOGGER__ = null;
16
+ // @ts-ignore
17
+ let __STRICT__ = null;
18
+ // @ts-ignore
19
+ let __REPORT_FAILURE_AS__ = null;
20
+ export const avoInspectorApiKey = "3UWtteG9HenZ825cYoYr";
21
+ let __INSPECTOR__ = null;
22
+ // @ts-ignore
23
+ if (typeof Object.assign !== 'function') {
24
+ // Must be writable: true, enumerable: false, configurable: true
25
+ Object.defineProperty(Object, "assign", {
26
+ value: function assign(target, _varArgs) {
27
+ if (target == null) { // TypeError if undefined or null
28
+ throw new TypeError('Cannot convert undefined or null to object');
29
+ }
30
+ let to = Object(target);
31
+ for (let index = 1; index < arguments.length; index++) {
32
+ let nextSource = arguments[index];
33
+ if (nextSource != null) { // Skip over if undefined or null
34
+ for (let nextKey in nextSource) {
35
+ // Avoid bugs when hasOwnProperty is shadowed
36
+ if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
37
+ to[nextKey] = nextSource[nextKey];
38
+ }
39
+ }
40
+ }
41
+ }
42
+ return to;
43
+ },
44
+ writable: true,
45
+ configurable: true
46
+ });
47
+ }
48
+ let InternalAvoLogger = {
49
+ logEventSent: function logEventSent(eventName, eventProperties, userProperties) {
50
+ const message = "Event Sent:" + eventName + "Event Props:" + JSON.stringify(eventProperties) + "User Props:" + JSON.stringify(userProperties);
51
+ if (__AVO_LOGGER__ && __AVO_LOGGER__.logDebug && __AVO_LOGGER__.logDebug(__AVO_ENV__, message)) {
52
+ return;
53
+ }
54
+ typeof console !== 'undefined' && console.log("[avo] Event Sent:", eventName, "Event Props:", eventProperties, "User Props:", userProperties);
55
+ },
56
+ log: function log(message) {
57
+ if (__AVO_LOGGER__ && __AVO_LOGGER__.logDebug && __AVO_LOGGER__.logDebug(__AVO_ENV__, message)) {
58
+ return;
59
+ }
60
+ typeof console !== 'undefined' && console.log("[avo] " + message);
61
+ },
62
+ warn: function warn(message) {
63
+ if (__AVO_LOGGER__ && __AVO_LOGGER__.logWarn && __AVO_LOGGER__.logWarn(__AVO_ENV__, message)) {
64
+ return;
65
+ }
66
+ typeof console !== 'undefined' && console.warn("[avo] " + message);
67
+ },
68
+ error: function error(message, error) {
69
+ if (__AVO_LOGGER__ && __AVO_LOGGER__.logError && __AVO_LOGGER__.logError(__AVO_ENV__, message + error)) {
70
+ return;
71
+ }
72
+ typeof console !== 'undefined' && console.error("[avo] " + message, error);
73
+ }
74
+ };
75
+ // @ts-ignore
76
+ let array_difference;
77
+ // @ts-ignore
78
+ let AvoAssert;
79
+ array_difference = function array_difference(a1, a2) {
80
+ let result = [];
81
+ for (let i = 0; i < a1.length; i++) {
82
+ if (a2.indexOf(a1[i]) === -1) {
83
+ result.push(a1[i]);
84
+ }
22
85
  }
23
86
  return result;
24
- }
25
-
26
- AvoAssert = {
87
+ };
88
+ AvoAssert = {
27
89
  assertObject: function assertObject(propertyId, propName, obj) {
28
- if (typeof obj !== 'object') {
29
- var message = propName +
30
- ' should be of type object but you provided type ' +
31
- typeof obj +
32
- ' with value ' +
33
- JSON.stringify(obj);
34
- return [{tag: 'expectedObjectType', propertyId: propertyId, message: message, actualType: typeof obj}];
35
- } else {
36
- return [];
37
- }
90
+ if (typeof obj !== 'object') {
91
+ let message = propName +
92
+ ' should be of type object but you provided type ' +
93
+ typeof obj +
94
+ ' with value ' +
95
+ JSON.stringify(obj);
96
+ return [{ tag: 'expectedObjectType', propertyId, message, actualType: typeof obj }];
97
+ }
98
+ else {
99
+ return [];
100
+ }
38
101
  },
39
-
40
102
  assertString: function assertString(propertyId, propName, str) {
41
- if (typeof str !== 'string') {
42
- var message = propName +
43
- ' should be of type string but you provided type ' +
44
- typeof str +
45
- ' with value ' +
46
- JSON.stringify(str);
47
- return [{tag: 'expectedStringType', propertyId: propertyId, message: message, actualType: typeof str}];
48
- } else {
49
- return [];
50
- }
103
+ if (typeof str !== 'string') {
104
+ let message = propName +
105
+ ' should be of type string but you provided type ' +
106
+ typeof str +
107
+ ' with value ' +
108
+ JSON.stringify(str);
109
+ return [{ tag: 'expectedStringType', propertyId, message, actualType: typeof str }];
110
+ }
111
+ else {
112
+ return [];
113
+ }
51
114
  },
52
-
53
115
  assertInt: function assertInt(propertyId, propName, int) {
54
- if (typeof int === 'number' && int !== Math.round(int)) {
55
- var message = propName +
56
- ' should be of type int but you provided type float with value ' +
57
- JSON.stringify(int);
58
- return [{tag: 'expectedIntType', propertyId: propertyId, actualType: 'float'}];
59
- } else if (typeof int !== 'number') {
60
- var message = propName +
61
- ' should be of type int but you provided type ' +
62
- typeof int +
63
- ' with value ' +
64
- JSON.stringify(int);
65
- return [{tag: 'expectedIntType', propertyId: propertyId, message: message, actualType: typeof int}];
66
- } else {
67
- return [];
68
- }
116
+ if (typeof int === 'number' && int !== Math.round(int)) {
117
+ let message = propName +
118
+ ' should be of type int but you provided type float with value ' +
119
+ JSON.stringify(int);
120
+ return [{ tag: 'expectedIntType', propertyId, message, actualType: 'float' }];
121
+ }
122
+ else if (typeof int !== 'number') {
123
+ let message = propName +
124
+ ' should be of type int but you provided type ' +
125
+ typeof int +
126
+ ' with value ' +
127
+ JSON.stringify(int);
128
+ return [{ tag: 'expectedIntType', propertyId, message, actualType: typeof int }];
129
+ }
130
+ else {
131
+ return [];
132
+ }
69
133
  },
70
-
71
134
  assertLong: function assertLong(propertyId, propName, long) {
72
- if (typeof long === 'number' && long !== Math.round(long)) {
73
- var message = propName +
74
- ' should be of type long but you provided type float with value ' +
75
- JSON.stringify(long);
76
- return [{tag: 'expectedLongType', propertyId: propertyId, actualType: 'float'}];
77
- } else if (typeof long !== 'number') {
78
- var message = propName +
79
- ' should be of type long but you provided type ' +
80
- typeof long +
81
- ' with value ' +
82
- JSON.stringify(long);
83
- return [{tag: 'expectedLongType', propertyId: propertyId, message: message, actualType: typeof long}];
84
- } else {
85
- return [];
86
- }
135
+ if (typeof long === 'number' && long !== Math.round(long)) {
136
+ let message = propName +
137
+ ' should be of type long but you provided type float with value ' +
138
+ JSON.stringify(long);
139
+ return [{ tag: 'expectedLongType', propertyId, message, actualType: 'float' }];
140
+ }
141
+ else if (typeof long !== 'number') {
142
+ let message = propName +
143
+ ' should be of type long but you provided type ' +
144
+ typeof long +
145
+ ' with value ' +
146
+ JSON.stringify(long);
147
+ return [{ tag: 'expectedLongType', propertyId, message, actualType: typeof long }];
148
+ }
149
+ else {
150
+ return [];
151
+ }
87
152
  },
88
-
89
153
  assertFloat: function assertFloat(propertyId, propName, float) {
90
- if (typeof float !== 'number') {
91
- var message = propName +
92
- ' should be of type float but you provided type ' +
93
- typeof float +
94
- ' with value ' +
95
- JSON.stringify(float);
96
- return [{tag: 'expectedFloatType', propertyId: propertyId, message: message, actualType: typeof float}];
97
- } else {
98
- return [];
99
- }
154
+ if (typeof float !== 'number') {
155
+ let message = propName +
156
+ ' should be of type float but you provided type ' +
157
+ typeof float +
158
+ ' with value ' +
159
+ JSON.stringify(float);
160
+ return [{ tag: 'expectedFloatType', propertyId, message, actualType: typeof float }];
161
+ }
162
+ else {
163
+ return [];
164
+ }
100
165
  },
101
-
102
166
  assertBool: function assertBool(propertyId, propName, bool) {
103
- if (typeof bool !== 'boolean') {
104
- var message = propName +
105
- ' should be of type boolean but you provided type ' +
106
- typeof bool +
107
- ' with value ' +
108
- JSON.stringify(bool);
109
- return [{tag: 'expectedBoolType', propertyId: propertyId, message: message, actualType: typeof bool}];
110
- } else {
111
- return [];
112
- }
167
+ if (typeof bool !== 'boolean') {
168
+ let message = propName +
169
+ ' should be of type boolean but you provided type ' +
170
+ typeof bool +
171
+ ' with value ' +
172
+ JSON.stringify(bool);
173
+ return [{ tag: 'expectedBoolType', propertyId, message, actualType: typeof bool }];
174
+ }
175
+ else {
176
+ return [];
177
+ }
113
178
  },
114
-
115
179
  assertMax: function assertMax(propertyId, propName, max, value) {
116
- if (value > max) {
117
- var message = propName +
118
- ' has a maximum value of ' +
119
- max +
120
- ' but you provided the value ' +
121
- JSON.stringify(value);
122
- return [{tag: 'expectedMax', propertyId: propertyId, message: message}];
123
- } else {
124
- return [];
125
- }
180
+ if (value > max) {
181
+ let message = propName +
182
+ ' has a maximum value of ' +
183
+ max +
184
+ ' but you provided the value ' +
185
+ JSON.stringify(value);
186
+ return [{ tag: 'expectedMax', propertyId, message }];
187
+ }
188
+ else {
189
+ return [];
190
+ }
126
191
  },
127
-
128
192
  assertMin: function assertMin(propertyId, propName, min, value) {
129
- if (value < min) {
130
- var message = propName +
131
- ' has a minimum value of ' +
132
- min +
133
- ' but you provided the value ' +
134
- JSON.stringify(value);
135
- return [{tag: 'expectedMin', propertyId: propertyId, message: message}];
136
- } else {
137
- return [];
138
- }
193
+ if (value < min) {
194
+ let message = propName +
195
+ ' has a minimum value of ' +
196
+ min +
197
+ ' but you provided the value ' +
198
+ JSON.stringify(value);
199
+ return [{ tag: 'expectedMin', propertyId, message }];
200
+ }
201
+ else {
202
+ return [];
203
+ }
139
204
  },
140
-
141
205
  assertList: function assertList(propertyId, propName, value) {
142
- if (!Array.isArray(value)) {
143
- var message = propName + ' should be of type list but you provided type ' + typeof value;
144
- return [{tag: 'expectedList', propertyId: propertyId, message: message, actualType: typeof value}];
145
- } else {
146
- return [];
147
- }
206
+ if (!Array.isArray(value)) {
207
+ let message = propName + ' should be of type list but you provided type ' + typeof value;
208
+ return [{ tag: 'expectedList', propertyId, message }];
209
+ }
210
+ else {
211
+ return [];
212
+ }
148
213
  },
149
-
150
214
  assertNoAdditionalProperties: function assertNoAdditionalProperties(eventName, input, spec) {
151
- var additionalKeys = array_difference(input, spec);
152
- if (additionalKeys.length) {
153
- var message = "Additional properties when sending event " + eventName + ": " + JSON.stringify(additionalKeys);
154
- return [{tag: 'expectedNoAdditionalProperties', additionalProperties: additionalKeys, message: message}];
155
- } else {
156
- return [];
157
- }
215
+ let additionalKeys = array_difference(input, spec);
216
+ if (additionalKeys.length) {
217
+ let message = "Additional properties when sending event " + eventName + ": " + JSON.stringify(additionalKeys);
218
+ return [{ tag: 'expectedNoAdditionalProperties', additionalProperties: additionalKeys, message: message }];
219
+ }
220
+ else {
221
+ return [];
222
+ }
158
223
  },
159
-
160
224
  assertNoAdditionalUserProperties: function assertNoAdditionalProperties(eventName, input, spec) {
161
- var additionalKeys = array_difference(input, spec);
162
- if (additionalKeys.length) {
163
- var message = "Additional user properties when sending event " + eventName + ": " + JSON.stringify(additionalKeys);
164
- return [{tag: 'expectedNoAdditionalUserProperties', additionalProperties: additionalKeys, message: message}];
165
- } else {
166
- return [];
167
- }
168
- }
169
- };
170
-
171
- InternalAvoLogger = {
172
- logEventSent: function logEventSent(eventName, eventProperties, userProperties, groupProperties) {
173
- const message = "Event Sent:" + eventName + "Event Props:" + JSON.stringify(eventProperties) + "User Props:" + JSON.stringify(userProperties) + "Group Props:" + JSON.stringify(groupProperties);
174
-
175
- if (__AVO_LOGGER__ && __AVO_LOGGER__.logDebug && __AVO_LOGGER__.logDebug(__AVO_ENV__, message)) {
176
- return
177
- }
178
- typeof console !== 'undefined' && console.log("[avo] Event Sent:", eventName, "Event Props:", eventProperties, "User Props:", userProperties, "Group Props:", groupProperties);
179
- },
180
-
181
- log: function log(message) {
182
- if (__AVO_LOGGER__ && __AVO_LOGGER__.logDebug && __AVO_LOGGER__.logDebug(__AVO_ENV__, message)) {
183
- return
184
- }
185
- typeof console !== 'undefined' && console.log("[avo] " + message);
186
- },
187
-
188
- warn: function warn(message) {
189
- if (__AVO_LOGGER__ && __AVO_LOGGER__.logWarn && __AVO_LOGGER__.logWarn(__AVO_ENV__, message)) {
190
- return
191
- }
192
- typeof console !== 'undefined' && console.warn("[avo] " + message);
225
+ let additionalKeys = array_difference(input, spec);
226
+ if (additionalKeys.length) {
227
+ let message = "Additional user properties when sending event " + eventName + ": " + JSON.stringify(additionalKeys);
228
+ return [{ tag: 'expectedNoAdditionalUserProperties', additionalProperties: additionalKeys, message: message }];
229
+ }
230
+ else {
231
+ return [];
232
+ }
193
233
  },
194
-
195
- error: function error(message, error) {
196
- if (__AVO_LOGGER__ && __AVO_LOGGER__.logError && __AVO_LOGGER__.logError(__AVO_ENV__, message + error)) {
197
- return
198
- }
199
- typeof console !== 'undefined' && console.error("[avo] " + message, error);
200
- }
201
- };
202
-
203
- var _avo_invoke, _avo_invoke_meta;
204
- var _avo_sampling_rate = 1.0;
234
+ };
235
+ let _avo_invoke;
236
+ let _avo_invoke_meta;
237
+ let _avo_sampling_rate = 1.0;
205
238
  function _avo_invoke_payload(body) {
206
- if (_avo_sampling_rate > 0) {
207
- if (Math.random() < _avo_sampling_rate) {
208
- const data = JSON.stringify(body);
209
- var options = {
210
- hostname: 'api.avo.app',
211
- port: 443,
212
- path: '/i',
213
- method: 'POST',
214
- headers: {
215
- 'Content-Type': 'application/json',
216
- 'Content-Length': Buffer.byteLength(data)
239
+ // @ts-ignore
240
+ if (_avo_sampling_rate > 0) {
241
+ // @ts-ignore
242
+ if (Math.random() < _avo_sampling_rate) {
243
+ // @ts-ignore
244
+ const data = JSON.stringify(body);
245
+ let options = {
246
+ hostname: 'api.avo.app',
247
+ port: 443,
248
+ path: '/i',
249
+ method: 'POST',
250
+ headers: {
251
+ 'Content-Type': 'application/json',
252
+ 'Content-Length': Buffer.byteLength(data)
253
+ }
254
+ };
255
+ let req = require('https').request(options, (res) => {
256
+ const chunks = [];
257
+ res.on('data', (data) => chunks.push(data));
258
+ res.on('end', () => {
259
+ try {
260
+ // @ts-ignore
261
+ const data = JSON.parse(Buffer.concat(chunks).toString());
262
+ // @ts-ignore
263
+ _avo_sampling_rate = data.sa;
264
+ }
265
+ catch (e) { }
266
+ });
267
+ });
268
+ req.write(data);
269
+ // @ts-ignore
270
+ req.on('error', () => { });
271
+ req.end();
217
272
  }
218
- };
219
- var req = require('https').request(options, (res) => {
220
- const chunks = [];
221
- res.on('data', (data) => chunks.push(data));
222
- res.on('end', () => {
223
- try {
224
- const data = JSON.parse(Buffer.concat(chunks));
225
- _avo_sampling_rate = data.sa;
226
- } catch(e) {}
227
- });
228
- });
229
- req.write(data);
230
- req.on('error', () => { });
231
- req.end();
232
273
  }
233
- }
234
274
  }
235
-
236
275
  _avo_invoke = function _avo_invoke(env, eventId, hash, messages, origin) {
237
- try {
238
- _avo_invoke_payload({
239
- "ac": "0PwMjPaMtkOkKQpGoQev",
240
- "br": "master",
241
- "en": env,
242
- "ev": eventId,
243
- "ha": hash,
244
- "sc": "fwtXqAc0fCLy7b7oGW40",
245
- "se": (new Date()).toISOString(),
246
- "so": "xOUFa-ew2",
247
- "va": messages.length === 0,
248
- "me": messages,
249
- "or": origin
250
- });
251
- } catch (e) { if (env !== 'prod') { throw e; } else { InternalAvoLogger.error("", e); } }
252
- }
253
-
276
+ try {
277
+ _avo_invoke_payload({
278
+ "ac": "7Lk2c1ODN76gJr4AFEIk",
279
+ "br": "qsHHWtDYF",
280
+ "en": env,
281
+ "ev": eventId,
282
+ "ha": hash,
283
+ "sc": "fwtXqAc0fCLy7b7oGW40",
284
+ "se": (new Date()).toISOString(),
285
+ "so": "xOUFa-ew2",
286
+ "va": messages.length === 0,
287
+ "me": messages,
288
+ "or": origin
289
+ });
290
+ }
291
+ catch (e) {
292
+ if (env !== AvoEnv.Prod) {
293
+ throw e;
294
+ }
295
+ else {
296
+ InternalAvoLogger.error("", e);
297
+ }
298
+ }
299
+ };
254
300
  _avo_invoke_meta = function _avo_invoke_meta(env, type, messages, origin) {
255
- try {
256
- _avo_invoke_payload({
257
- "ac": "0PwMjPaMtkOkKQpGoQev",
258
- "br": "master",
259
- "en": env,
260
- "ty": type,
261
- "sc": "fwtXqAc0fCLy7b7oGW40",
262
- "se": (new Date()).toISOString(),
263
- "so": "xOUFa-ew2",
264
- "va": messages.length === 0,
265
- "me": messages,
266
- "or": origin
267
- });
268
- } catch (e) { if (env !== 'prod') { throw e; } else { InternalAvoLogger.error("", e); } }
269
- }
270
-
271
-
272
- var SignInError = {
273
- UNKNOWN: "Unknown",
274
- WRONG_PASSWORD: "Wrong Password",
275
- USER_NOT_FOUND: "User Not Found",
276
- USER_DISABLED: "User Disabled",
277
- INVALID_EMAIL: "Invalid Email",
301
+ try {
302
+ _avo_invoke_payload({
303
+ "ac": "7Lk2c1ODN76gJr4AFEIk",
304
+ "br": "qsHHWtDYF",
305
+ "en": env,
306
+ "ty": type,
307
+ "sc": "fwtXqAc0fCLy7b7oGW40",
308
+ "se": (new Date()).toISOString(),
309
+ "so": "xOUFa-ew2",
310
+ "va": messages.length === 0,
311
+ "me": messages,
312
+ "or": origin
313
+ });
314
+ }
315
+ catch (e) {
316
+ if (env !== AvoEnv.Prod) {
317
+ throw e;
318
+ }
319
+ else {
320
+ InternalAvoLogger.error("", e);
321
+ }
322
+ }
278
323
  };
279
-
280
- var Client = {
281
- CLOUD_FUNCTIONS: "Cloud Functions",
282
- WEB: "Web",
283
- LANDING_PAGE: "Landing Page",
284
- CLI: "Cli",
285
- WEB_DEBUGGER: "Web Debugger",
286
- ANDROID_DEBUGGER: "Android Debugger",
287
- IOS_DEBUGGER: "Ios Debugger",
288
- REACT_NATIVE_DEBUGGER_IOS: "React Native Debugger (ios)",
289
- REACT_NATIVE_DEBUGGER_ANDROID: "React Native Debugger (android)",
290
- DOCS: "Docs",
291
- PUBLISHING_WORKER: "Publishing Worker",
324
+ export const SignInError = {
325
+ 'UNKNOWN': 'Unknown',
326
+ 'WRONG_PASSWORD': 'Wrong Password',
327
+ 'USER_NOT_FOUND': 'User Not Found',
328
+ 'USER_DISABLED': 'User Disabled',
329
+ 'INVALID_EMAIL': 'Invalid Email',
292
330
  };
293
-
294
- var AuthenticationMethod = {
295
- GOOGLE: "Google",
296
- EMAIL: "Email",
297
- SSO: "SSO",
331
+ export const Client = {
332
+ 'CLOUD_FUNCTIONS': 'Cloud Functions',
333
+ 'WEB': 'Web',
334
+ 'LANDING_PAGE': 'Landing Page',
335
+ 'CLI': 'Cli',
336
+ 'WEB_DEBUGGER': 'Web Debugger',
337
+ 'ANDROID_DEBUGGER': 'Android Debugger',
338
+ 'IOS_DEBUGGER': 'Ios Debugger',
339
+ 'REACT_NATIVE_DEBUGGER_IOS': 'React Native Debugger (ios)',
340
+ 'REACT_NATIVE_DEBUGGER_ANDROID': 'React Native Debugger (android)',
341
+ 'DOCS': 'Docs',
342
+ 'PUBLISHING_WORKER': 'Publishing Worker',
298
343
  };
299
-
300
- var CliAction = {
301
- LOGIN: "Login",
302
- LOGOUT: "Logout",
303
- PULL: "Pull",
304
- CHECKOUT: "Checkout",
305
- INIT: "Init",
306
- STATUS: "Status",
307
- BRANCH: "Branch",
308
- EDIT: "Edit",
309
- WHOAMI: "Whoami",
310
- SOURCE: "Source",
311
- SOURCE_ADD: "Source Add",
312
- SOURCE_REMOVE: "Source Remove",
313
- MERGE: "Merge",
314
- CONFLICT: "Conflict",
344
+ export const AuthenticationMethod = {
345
+ 'GOOGLE': 'Google',
346
+ 'EMAIL': 'Email',
347
+ 'SSO': 'SSO',
348
+ 'CLI': 'CLI',
315
349
  };
316
-
317
- function assertSignInError(signInError, label_) {
318
- var messages = [];
319
- messages = messages.concat(AvoAssert.assertString("106d4596-7330-49f3-93d8-487c92f877d3", label_ ? "Sign In Error" + ": " + label_ : "Sign In Error", signInError));
320
- if ("Unknown" !== signInError && "Wrong Password" !== signInError &&
321
- "User Not Found" !== signInError &&
322
- "User Disabled" !== signInError && "Invalid Email" !== signInError) {
323
- var message = (label_ ? "Sign In Error" + ": " + label_ : "Sign In Error") + " should match one of the following values [ Unknown | Wrong Password | User Not Found | User Disabled | Invalid Email ] but you provided the value " + signInError
324
- messages = messages.concat([{tag: 'expectedStringMatch', propertyId: "106d4596-7330-49f3-93d8-487c92f877d3", message: message}]);
325
- }
326
- return messages;
327
- }
328
-
329
- function assertVersion(version, label_) {
330
- var messages = [];
331
- messages = messages.concat(AvoAssert.assertString("2fad5bf3-7782-49a2-acc2-825daf823095", label_ ? "Version" + ": " + label_ : "Version", version));
332
- return messages;
333
- }
334
-
335
- function assertSchemaId(schemaId, label_) {
336
- var messages = [];
337
- messages = messages.concat(AvoAssert.assertString("40958e87-d69a-4d5a-98f8-b36922466787", label_ ? "Schema Id" + ": " + label_ : "Schema Id", schemaId));
338
- return messages;
339
- }
340
-
341
- function assertOptionalEmailInput(emailInput, label_) {
342
- var messages = [];
343
- if (emailInput !== undefined && emailInput !== null) {
344
- messages = messages.concat(AvoAssert.assertString("439349b2-72cb-4ac1-81d9-1c4aa89da524", label_ ? "Email Input" + ": " + label_ : "Email Input", emailInput));
345
- }
346
- return messages;
347
- }
348
-
349
- function assertEmail(email, label_) {
350
- var messages = [];
351
- messages = messages.concat(AvoAssert.assertString("92588d93-5307-4fa2-be00-be0821596abe", label_ ? "Email" + ": " + label_ : "Email", email));
352
- return messages;
353
- }
354
-
355
- function assertClient(client, label_) {
356
- var messages = [];
357
- messages = messages.concat(AvoAssert.assertString("9e5c4ff5-d5f6-4e82-b061-d5fa02755aae", label_ ? "Client" + ": " + label_ : "Client", client));
358
- if ("Cloud Functions" !== client && "Web" !== client &&
359
- "Landing Page" !== client && "Cli" !== client &&
360
- "Web Debugger" !== client && "Android Debugger" !== client &&
361
- "Ios Debugger" !== client &&
362
- "React Native Debugger (ios)" !== client &&
363
- "React Native Debugger (android)" !== client && "Docs" !== client &&
364
- "Publishing Worker" !== client) {
365
- var message = (label_ ? "Client" + ": " + label_ : "Client") + " should match one of the following values [ Cloud Functions | Web | Landing Page | Cli | Web Debugger | Android Debugger | Ios Debugger | React Native Debugger (ios) | React Native Debugger (android) | Docs | Publishing Worker ] but you provided the value " + client
366
- messages = messages.concat([{tag: 'expectedStringMatch', propertyId: "9e5c4ff5-d5f6-4e82-b061-d5fa02755aae", message: message}]);
367
- }
368
- return messages;
369
- }
370
-
371
- function assertBranchName(branchName, label_) {
372
- var messages = [];
373
- messages = messages.concat(AvoAssert.assertString("9xcXzuN-3", label_ ? "Branch Name" + ": " + label_ : "Branch Name", branchName));
374
- return messages;
375
- }
376
-
377
- function assertCliInvokedByCi(cliInvokedByCi, label_) {
378
- var messages = [];
379
- messages = messages.concat(AvoAssert.assertBool("IyaXHTG7C", label_ ? "Cli Invoked by Ci" + ": " + label_ : "Cli Invoked by Ci", cliInvokedByCi));
380
- return messages;
381
- }
382
-
383
- function assertAuthenticationMethod(authenticationMethod, label_) {
384
- var messages = [];
385
- messages = messages.concat(AvoAssert.assertString("R9pE83vdh", label_ ? "Authentication Method" + ": " + label_ : "Authentication Method", authenticationMethod));
386
- if ("Google" !== authenticationMethod &&
387
- "Email" !== authenticationMethod && "SSO" !== authenticationMethod) {
388
- var message = (label_ ? "Authentication Method" + ": " + label_ : "Authentication Method") + " should match one of the following values [ Google | Email | SSO ] but you provided the value " + authenticationMethod
389
- messages = messages.concat([{tag: 'expectedStringMatch', propertyId: "R9pE83vdh", message: message}]);
390
- }
391
- return messages;
392
- }
393
-
394
- function assertCliAction(cliAction, label_) {
395
- var messages = [];
396
- messages = messages.concat(AvoAssert.assertString("YRq1Pt0ey", label_ ? "Cli Action" + ": " + label_ : "Cli Action", cliAction));
397
- if ("Login" !== cliAction && "Logout" !== cliAction &&
398
- "Pull" !== cliAction && "Checkout" !== cliAction &&
399
- "Init" !== cliAction && "Status" !== cliAction &&
400
- "Branch" !== cliAction && "Edit" !== cliAction &&
401
- "Whoami" !== cliAction && "Source" !== cliAction &&
402
- "Source Add" !== cliAction && "Source Remove" !== cliAction &&
403
- "Merge" !== cliAction && "Conflict" !== cliAction) {
404
- var message = (label_ ? "Cli Action" + ": " + label_ : "Cli Action") + " should match one of the following values [ Login | Logout | Pull | Checkout | Init | Status | Branch | Edit | Whoami | Source | Source Add | Source Remove | Merge | Conflict ] but you provided the value " + cliAction
405
- messages = messages.concat([{tag: 'expectedStringMatch', propertyId: "YRq1Pt0ey", message: message}]);
406
- }
407
- return messages;
408
- }
409
-
410
- function assertOptionalSchemaName(schemaName, label_) {
411
- var messages = [];
412
- if (schemaName !== undefined && schemaName !== null) {
413
- messages = messages.concat(AvoAssert.assertString("a49af1dc-3166-45db-a906-86179135854b", label_ ? "Schema Name" + ": " + label_ : "Schema Name", schemaName));
414
- }
415
- return messages;
416
- }
417
-
418
- function _assertUserId_(userId_, label_) {
419
- var messages = [];
420
- messages = messages.concat(AvoAssert.assertString("avo-enriched-server-user-id", label_ ? "User Id" + ": " + label_ : "User Id", userId_));
421
- return messages;
422
- }
423
-
424
- function assertUserId_(userId_, label_) {
425
- var messages = [];
426
- messages = messages.concat(AvoAssert.assertString("avo-enriched-type-user-id", label_ ? "User Id" + ": " + label_ : "User Id", userId_));
427
- return messages;
428
- }
429
-
430
- function assertBranchId(branchId, label_) {
431
- var messages = [];
432
- messages = messages.concat(AvoAssert.assertString("tlrUtYcti", label_ ? "Branch Id" + ": " + label_ : "Branch Id", branchId));
433
- return messages;
434
- }
435
-
436
- function assertOptionalForce(force, label_) {
437
- var messages = [];
438
- if (force !== undefined && force !== null) {
439
- messages = messages.concat(AvoAssert.assertBool("xSnIO4dt8", label_ ? "Force" + ": " + label_ : "Force", force));
440
- }
441
- return messages;
442
- }
443
-
444
- function setAvoLogger(avoLogger) {
445
- __AVO_LOGGER__ = avoLogger;
446
- }
447
-
448
- var sysClient;
449
- var sysVersion;
450
-
451
- function setSystemProperties(properties) {
452
- if (properties.client !== null && properties.client !== undefined) {
453
- sysClient = properties.client;
454
- assertClient(sysClient);
455
- }
456
- if (properties.version !== null && properties.version !== undefined) {
457
- sysVersion = properties.version;
458
- assertVersion(sysVersion);
459
- }
460
- }
461
-
462
- function setSystemProperties_(properties) {
463
- if (properties.client !== null && properties.client !== undefined) {
464
- sysClient = properties.client;
465
- assertClient(sysClient);
466
- }
467
- if (properties.version !== null && properties.version !== undefined) {
468
- sysVersion = properties.version;
469
- assertVersion(sysVersion);
470
- }
471
- }
472
-
473
-
474
- var CustomNodeJS;
475
- function setup_(options, systemProperties, CustomNodeJSDestination,
476
- destinationOptions) {
477
- if (options.validateProperties === true) {
478
- __AVO_DEV__ = true;
479
- }
480
-
481
- setSystemProperties_(systemProperties);
482
-
483
- destinationOptions = destinationOptions || {};
484
-
485
- if (!__AVO_NOOP__) {
486
- if (options.useProductionKey) {
487
- } else {
350
+ export const CliAction = {
351
+ 'LOGIN': 'Login',
352
+ 'LOGOUT': 'Logout',
353
+ 'PULL': 'Pull',
354
+ 'CHECKOUT': 'Checkout',
355
+ 'INIT': 'Init',
356
+ 'STATUS': 'Status',
357
+ 'BRANCH': 'Branch',
358
+ 'EDIT': 'Edit',
359
+ 'WHOAMI': 'Whoami',
360
+ 'SOURCE': 'Source',
361
+ 'SOURCE_ADD': 'Source Add',
362
+ 'SOURCE_REMOVE': 'Source Remove',
363
+ 'MERGE': 'Merge',
364
+ 'CONFLICT': 'Conflict',
365
+ };
366
+ let sysClient;
367
+ let sysVersion;
368
+ export function setSystemProperties(properties) {
369
+ if (properties.client !== null && properties.client !== undefined) {
370
+ sysClient = properties.client;
488
371
  }
489
-
490
- CustomNodeJS = CustomNodeJSDestination;
491
- CustomNodeJS.make(options.useProductionKey);
492
- if (__AVO_DEV__) {
493
- // debug console in Avo
494
- _avo_invoke_meta(__AVO_ENV__, 'setup', [], 'setup');
372
+ if (properties.version !== null && properties.version !== undefined) {
373
+ sysVersion = properties.version;
495
374
  }
496
- }
497
375
  }
498
-
499
- function initAvo(options, systemProperties, destinationOptions,
500
- CustomNodeJSDestination) {
501
- if (__AVO_ENV__ !== null) {
502
- return;
503
- }
504
- __AVO_ENV__ = options.env.toLowerCase();
505
- if (options.avoLogger !== undefined) {
506
- __AVO_LOGGER__ = options.avoLogger;
507
- }
508
- if (options.noop === true) {
509
- __AVO_NOOP__ = true;
510
- }
511
- if (__AVO_NOOP__ && __AVO_ENV__ == 'prod') {
512
- InternalAvoLogger.warn("****************************************************");
513
- InternalAvoLogger.warn("WARNING Avo cannot be initialized in noop mode in production:");
514
- InternalAvoLogger.warn("- Overwriting configuration with noop=false.");
515
- InternalAvoLogger.warn("- Please reach out if you want to be able to run Avo in production mode with noop=true");
516
- InternalAvoLogger.warn("****************************************************");
517
- __AVO_NOOP__ = false;
518
- }
519
- if (__AVO_NOOP__) {
520
- InternalAvoLogger.log("****************************************************");
521
- InternalAvoLogger.log("Avo is now initialized in noop mode. This means:");
522
- InternalAvoLogger.log("- No events will be sent");
523
- InternalAvoLogger.log("- No network requests are made");
524
- InternalAvoLogger.log("****************************************************");
525
- }
526
- if (options.strict !== undefined) {
527
- __STRICT__ = options.strict !== false;
528
- }
529
- if (options.reportFailureAs !== undefined) {
530
- __REPORT_FAILURE_AS__ = options.reportFailureAs;
531
- }
532
- if (!__AVO_NOOP__ && options.inspector !== undefined) {
533
- __INSPECTOR__ = options.inspector;
534
- } else if (__AVO_ENV__ !== 'prod') {
535
- InternalAvoLogger.warn("Avo Inspector not provided in initAvo() call");
536
- }
537
- if (__AVO_ENV__ !== 'prod') {
538
- __AVO_DEV__ = true;
539
- }
540
-
541
- setSystemProperties(systemProperties);
542
-
543
- destinationOptions = destinationOptions || {};
544
-
545
- if (!__AVO_NOOP__) {
546
- if (__AVO_ENV__ === 'prod') {
376
+ let CustomNodeJS;
377
+ export function initAvo(options, systemProperties, destinationOptions, CustomNodeJSDestination) {
378
+ if (__AVO_ENV__ !== null) {
379
+ return;
380
+ }
381
+ __AVO_ENV__ = options.env;
382
+ if (options.avoLogger !== undefined) {
383
+ __AVO_LOGGER__ = options.avoLogger;
547
384
  }
548
- if (__AVO_ENV__ === 'dev') {
385
+ if (options.noop === true) {
386
+ __AVO_NOOP__ = true;
549
387
  }
550
-
551
- CustomNodeJS = CustomNodeJSDestination;
552
- if (__AVO_ENV__ === 'prod') {
553
- CustomNodeJS.make && CustomNodeJS.make(__AVO_ENV__, "2");
554
- } else if (__AVO_ENV__ === 'dev') {
555
- CustomNodeJS.make && CustomNodeJS.make(__AVO_ENV__, "1");
556
- } else {
557
- console[__REPORT_FAILURE_AS__ || 'error']("[avo] No staging key is set for Custom Node JS. Head to destination settings in Avo to set a staging key.");
558
- CustomNodeJS.make && CustomNodeJS.make(__AVO_ENV__, "");
388
+ if (__AVO_NOOP__ && __AVO_ENV__ == AvoEnv.Prod) {
389
+ InternalAvoLogger.warn("[avo] ****************************************************");
390
+ InternalAvoLogger.warn("[avo] WARNING Avo cannot be initialized in noop mode in production:");
391
+ InternalAvoLogger.warn("[avo] - Overwriting configuration with noop=false.");
392
+ InternalAvoLogger.warn("[avo] - Please reach out if you want to be able to run Avo in production mode with noop=true");
393
+ InternalAvoLogger.warn("[avo] ****************************************************");
394
+ __AVO_NOOP__ = false;
559
395
  }
560
- if (__AVO_DEV__) {
561
- // debug console in Avo
562
- _avo_invoke_meta(__AVO_ENV__, 'init', [], 'init');
396
+ if (__AVO_NOOP__) {
397
+ InternalAvoLogger.log("[avo] ****************************************************");
398
+ InternalAvoLogger.log("[avo] Avo is now initialized in noop mode. This means:");
399
+ InternalAvoLogger.log("[avo] - No events will be sent");
400
+ InternalAvoLogger.log("[avo] - No network requests are made");
401
+ InternalAvoLogger.log("[avo] ****************************************************");
402
+ }
403
+ if (options.strict !== undefined) {
404
+ __STRICT__ = options.strict !== false;
405
+ }
406
+ if (options.reportFailureAs !== undefined) {
407
+ __REPORT_FAILURE_AS__ = options.reportFailureAs;
408
+ }
409
+ if (!__AVO_NOOP__ && options.inspector !== undefined) {
410
+ __INSPECTOR__ = options.inspector;
411
+ }
412
+ else if (__AVO_ENV__ !== 'prod') {
413
+ InternalAvoLogger.warn("[avo] Avo Inspector not provided in initAvo() call");
414
+ }
415
+ setSystemProperties(systemProperties);
416
+ destinationOptions = destinationOptions || {};
417
+ if (!__AVO_NOOP__) {
418
+ if (__AVO_ENV__ === AvoEnv.Prod) {
419
+ }
420
+ if (__AVO_ENV__ === AvoEnv.Dev) {
421
+ }
422
+ CustomNodeJS = CustomNodeJSDestination;
423
+ if (__AVO_ENV__ === 'prod') {
424
+ CustomNodeJS && CustomNodeJS.make && CustomNodeJS.make(__AVO_ENV__, "2");
425
+ }
426
+ else if (__AVO_ENV__ === 'dev') {
427
+ CustomNodeJS && CustomNodeJS.make && CustomNodeJS.make(__AVO_ENV__, "1");
428
+ }
429
+ else {
430
+ console[__REPORT_FAILURE_AS__ || 'error']("[avo] No staging key is set for Custom Node JS. Head to destination settings in Avo to set a staging key.");
431
+ CustomNodeJS && CustomNodeJS.make && CustomNodeJS.make(__AVO_ENV__, null);
432
+ }
433
+ if (__AVO_ENV__ === AvoEnv.Dev) {
434
+ // debug console in Avo
435
+ _avo_invoke_meta(__AVO_ENV__, 'init', [], 'init');
436
+ }
563
437
  }
564
- }
565
438
  }
566
-
439
+ export function setAvoLogger(avoLogger) {
440
+ __AVO_LOGGER__ = avoLogger;
441
+ }
567
442
  /**
568
443
  * Signed In: Sent when user successfully signs in or when we successfully authenticate a user.
569
444
  *
570
- * @param {object} properties - the properties associatied with this event
571
- * @param {string} properties.userId_ - The value used to identify the user. Make sure it's a unique sequence of characters used to identify the user.
572
- * @param {string} properties.email - The user's email
573
- * @param {string} properties.authenticationMethod - Type of authentication method used by user logging in or signing up
445
+ * @param properties the properties associatied with this event
446
+ * @param properties.userId_: The value used to identify the user. Make sure it's a unique sequence of characters used to identify the user.
447
+ * @param properties.email: The user's email
448
+ * @param properties.authenticationMethod: Type of authentication method used by user logging in or signing up
574
449
  *
575
- * @see {@link https://www.avo.app/schemas/fwtXqAc0fCLy7b7oGW40/events/54e92613-090c-4f0b-afeb-ed720eff3422}
450
+ * @see {@link https://www.avo.app/schemas/fwtXqAc0fCLy7b7oGW40/branches/qsHHWtDYF/events/54e92613-090c-4f0b-afeb-ed720eff3422}
576
451
  */
577
452
  export function signedIn(properties) {
578
- properties = properties || {};
579
- if (__AVO_DEV__) {
580
453
  // assert properties
581
- var messages = [];
582
- messages = messages.concat(assertUserId_(properties.userId_));
583
- messages = messages.concat(assertEmail(properties.email));
584
- messages = messages.concat(assertAuthenticationMethod(properties.authenticationMethod));
585
- messages = messages.concat(assertClient(sysClient));
586
- messages = messages.concat(assertVersion(sysVersion));
587
- messages = messages.concat(AvoAssert.assertNoAdditionalProperties("Signed In", Object.keys(properties), [
588
- "userId_",
589
- "email",
590
- "authenticationMethod"
591
- ]));
592
- // debug console in Avo
454
+ if (__AVO_ENV__ !== AvoEnv.Prod) {
455
+ let messages = [];
456
+ // debug console in Avo
457
+ if (!__AVO_NOOP__) {
458
+ _avo_invoke(__AVO_ENV__, "54e92613-090c-4f0b-afeb-ed720eff3422", "a1718f3b64ff5fb6ebf7227dac25c5ab3f8c0cfecf4cc395076adfab2326fcae", messages.map(m => Object.assign({}, { tag: m.tag, propertyId: m.propertyId, additionalProperties: m.additionalProperties, actualType: m.actualType })), 'event');
459
+ }
460
+ InternalAvoLogger.logEventSent("Signed In", {
461
+ "Authentication Method": properties.authenticationMethod,
462
+ "Client": sysClient,
463
+ "Version": sysVersion,
464
+ }, {
465
+ "Email": properties.email,
466
+ });
467
+ }
468
+ // @ts-ignore
469
+ let eventPropertiesCustomNodeJS = {};
470
+ eventPropertiesCustomNodeJS["Authentication Method"] = properties.authenticationMethod;
471
+ eventPropertiesCustomNodeJS["Client"] = sysClient;
472
+ eventPropertiesCustomNodeJS["Version"] = sysVersion;
473
+ // @ts-ignore
474
+ let userPropertiesCustomNodeJS = {};
475
+ userPropertiesCustomNodeJS["Email"] = properties.email;
593
476
  if (!__AVO_NOOP__) {
594
- _avo_invoke(__AVO_ENV__, "54e92613-090c-4f0b-afeb-ed720eff3422", "2fec10106ad560f43f307ffdc820e3bd7a474585f9c62ee39961730c35694cb1", messages.map(function(m) { return Object.assign({}, {tag: m.tag, propertyId: m.propertyId, additionalProperties: m.additionalProperties, actualType: m.actualType}); }), 'event');
477
+ return Promise.all([
478
+ // report to Avo Inspector
479
+ __INSPECTOR__ != null
480
+ // @ts-ignore
481
+ ? __INSPECTOR__._avoFunctionTrackSchemaFromEvent("Signed In", {
482
+ "Authentication Method": properties.authenticationMethod,
483
+ "Client": sysClient,
484
+ "Version": sysVersion,
485
+ }, "54e92613-090c-4f0b-afeb-ed720eff3422", "a1718f3b64ff5fb6ebf7227dac25c5ab3f8c0cfecf4cc395076adfab2326fcae")
486
+ : Promise.resolve(),
487
+ // destination CustomNodeJS
488
+ CustomNodeJS.setUserProperties(properties.userId_, Object.assign({}, userPropertiesCustomNodeJS)),
489
+ CustomNodeJS.logEvent(properties.userId_, "Signed In", Object.assign({}, eventPropertiesCustomNodeJS)),
490
+ ]);
595
491
  }
596
-
597
- InternalAvoLogger.logEventSent("Signed In", {
598
- "Authentication Method": properties.authenticationMethod,
599
- "Client": sysClient,
600
- "Version": sysVersion,
601
- }, {
602
- "Email": properties.email,
603
- }, {});
604
- if (__AVO_DEV__ && (__STRICT__ === null || __STRICT__)) {
605
- // throw exception if messages is not empty
606
- if (messages.length !== 0) {
607
- throw new Error("Error sending event 'Signed In': " + messages[0].message)
608
- }
609
- } else {
610
- messages.forEach(function(m) {
611
- console[__REPORT_FAILURE_AS__ || 'error']("[avo] " + m.message);
612
- });
492
+ else {
493
+ // do nothing
494
+ return new Promise((resolve) => { resolve(null); });
613
495
  }
614
- }
615
-
616
- if (!__AVO_NOOP__) {
617
- return Promise.all([
618
- // report to Avo Inspector
619
- __INSPECTOR__ != null ? __INSPECTOR__._avoFunctionTrackSchemaFromEvent("Signed In", {
620
- "Authentication Method": properties.authenticationMethod,
621
- "Client": sysClient,
622
- "Version": sysVersion,
623
- }, "54e92613-090c-4f0b-afeb-ed720eff3422", "2fec10106ad560f43f307ffdc820e3bd7a474585f9c62ee39961730c35694cb1")
624
- : Promise.resolve(),
625
- // destination CustomNodeJS
626
- CustomNodeJS.setUserProperties(properties.userId_, {
627
- "Email": properties.email,
628
- }),
629
- CustomNodeJS.logEvent(properties.userId_, "Signed In", {
630
- "Authentication Method": properties.authenticationMethod,
631
- "Client": sysClient,
632
- "Version": sysVersion,
633
- }),
634
- ]);
635
- } else {
636
- // do nothing
637
- return new Promise((resolve) => { resolve(null); });
638
- }
639
496
  }
640
-
641
497
  /**
642
498
  * Sign In Failed: Sent when sign in request fails.
643
499
  *
644
- * @param {object} properties - the properties associatied with this event
645
- * @param {string} properties.userId_ - User Id is required for server sources.
646
- * @param {string} properties.signInError - no description
647
- * @param {string} properties.emailInput - The email address that is put into the email input on the landing page
500
+ * @param properties the properties associatied with this event
501
+ * @param properties.userId_: User Id is required for server sources.
502
+ * @param properties.signInError: no description
503
+ * @param properties.emailInput: The email address that is put into the email input on the landing page
648
504
  *
649
- * @see {@link https://www.avo.app/schemas/fwtXqAc0fCLy7b7oGW40/events/7aa64217-bb89-44f5-9a68-f3bc0255a864}
505
+ * @see {@link https://www.avo.app/schemas/fwtXqAc0fCLy7b7oGW40/branches/qsHHWtDYF/events/7aa64217-bb89-44f5-9a68-f3bc0255a864}
650
506
  */
651
507
  export function signInFailed(properties) {
652
- properties = properties || {};
653
- if (__AVO_DEV__) {
654
508
  // assert properties
655
- var messages = [];
656
- messages = messages.concat(assertUserId_(properties.userId_));
657
- messages = messages.concat(assertSignInError(properties.signInError));
658
- messages = messages.concat(assertOptionalEmailInput(properties.emailInput));
659
- messages = messages.concat(assertClient(sysClient));
660
- messages = messages.concat(assertVersion(sysVersion));
661
- messages = messages.concat(AvoAssert.assertNoAdditionalProperties("Sign In Failed", Object.keys(properties), [
662
- "userId_",
663
- "signInError",
664
- "emailInput"
665
- ]));
666
- // debug console in Avo
509
+ if (__AVO_ENV__ !== AvoEnv.Prod) {
510
+ let messages = [];
511
+ // debug console in Avo
512
+ if (!__AVO_NOOP__) {
513
+ _avo_invoke(__AVO_ENV__, "7aa64217-bb89-44f5-9a68-f3bc0255a864", "ddc8c1ee0b5dbe58efd0d44d6d4dd8c2bc61bf1d64c7c8f74ea1f50d5b24b2ed", messages.map(m => Object.assign({}, { tag: m.tag, propertyId: m.propertyId, additionalProperties: m.additionalProperties, actualType: m.actualType })), 'event');
514
+ }
515
+ InternalAvoLogger.logEventSent("Sign In Failed", {
516
+ "Sign In Error": properties.signInError,
517
+ "Email Input": properties.emailInput,
518
+ "Client": sysClient,
519
+ "Version": sysVersion,
520
+ }, {});
521
+ }
522
+ // @ts-ignore
523
+ let eventProperties = {};
524
+ eventProperties["Sign In Error"] = properties.signInError;
525
+ if (properties.emailInput !== undefined && properties.emailInput !== null) {
526
+ eventProperties["Email Input"] = properties.emailInput;
527
+ }
528
+ eventProperties["Client"] = sysClient;
529
+ eventProperties["Version"] = sysVersion;
530
+ // @ts-ignore
531
+ let userProperties = {};
667
532
  if (!__AVO_NOOP__) {
668
- _avo_invoke(__AVO_ENV__, "7aa64217-bb89-44f5-9a68-f3bc0255a864", "ddc8c1ee0b5dbe58efd0d44d6d4dd8c2bc61bf1d64c7c8f74ea1f50d5b24b2ed", messages.map(function(m) { return Object.assign({}, {tag: m.tag, propertyId: m.propertyId, additionalProperties: m.additionalProperties, actualType: m.actualType}); }), 'event');
533
+ return Promise.all([
534
+ // report to Avo Inspector
535
+ __INSPECTOR__ != null
536
+ // @ts-ignore
537
+ ? __INSPECTOR__._avoFunctionTrackSchemaFromEvent("Sign In Failed", {
538
+ "Sign In Error": properties.signInError,
539
+ "Email Input": properties.emailInput,
540
+ "Client": sysClient,
541
+ "Version": sysVersion,
542
+ }, "7aa64217-bb89-44f5-9a68-f3bc0255a864", "ddc8c1ee0b5dbe58efd0d44d6d4dd8c2bc61bf1d64c7c8f74ea1f50d5b24b2ed")
543
+ : Promise.resolve(),
544
+ // destination CustomNodeJS
545
+ CustomNodeJS.logEvent(properties.userId_, "Sign In Failed", Object.assign({}, eventProperties)),
546
+ ]);
669
547
  }
670
-
671
- InternalAvoLogger.logEventSent("Sign In Failed", {
672
- "Sign In Error": properties.signInError,
673
- "Email Input": properties.emailInput,
674
- "Client": sysClient,
675
- "Version": sysVersion,
676
- }, {}, {});
677
- if (__AVO_DEV__ && (__STRICT__ === null || __STRICT__)) {
678
- // throw exception if messages is not empty
679
- if (messages.length !== 0) {
680
- throw new Error("Error sending event 'Sign In Failed': " + messages[0].message)
681
- }
682
- } else {
683
- messages.forEach(function(m) {
684
- console[__REPORT_FAILURE_AS__ || 'error']("[avo] " + m.message);
685
- });
548
+ else {
549
+ // do nothing
550
+ return new Promise((resolve) => { resolve(null); });
686
551
  }
687
- }
688
-
689
- if (!__AVO_NOOP__) {
690
- return Promise.all([
691
- // report to Avo Inspector
692
- __INSPECTOR__ != null ? __INSPECTOR__._avoFunctionTrackSchemaFromEvent("Sign In Failed", {
693
- "Sign In Error": properties.signInError,
694
- "Email Input": properties.emailInput,
695
- "Client": sysClient,
696
- "Version": sysVersion,
697
- }, "7aa64217-bb89-44f5-9a68-f3bc0255a864", "ddc8c1ee0b5dbe58efd0d44d6d4dd8c2bc61bf1d64c7c8f74ea1f50d5b24b2ed")
698
- : Promise.resolve(),
699
- // destination CustomNodeJS
700
- CustomNodeJS.logEvent(properties.userId_, "Sign In Failed", {
701
- "Sign In Error": properties.signInError,
702
- "Email Input": properties.emailInput,
703
- "Client": sysClient,
704
- "Version": sysVersion,
705
- }),
706
- ]);
707
- } else {
708
- // do nothing
709
- return new Promise((resolve) => { resolve(null); });
710
- }
711
552
  }
712
-
713
553
  /**
714
554
  * Cli Invoked: Sent when any action is made in the CLI.
715
555
  *
716
- * @param {object} properties - the properties associatied with this event
717
- * @param {string} properties.userId_ - User Id is required for server sources.
718
- * @param {string} properties.cliAction - no description
719
- * @param {string} properties.schemaId - The ID of the schema that this event is related to.
720
- * @param {bool} properties.cliInvokedByCi - True iff process.env.CI is set.
721
- * @param {string} properties.branchId - The ID of the branch that this event is related to.
722
- * @param {string} properties.branchName - The name of the branch that this event is related to.
723
- * @param {string} properties.schemaName - Name of the schema that this event is related to.
724
- * @param {bool} properties.force - Whether the command was called with --force parameter
556
+ * @param properties the properties associatied with this event
557
+ * @param properties.userId_: User Id is required for server sources.
558
+ * @param properties.cliAction: no description
559
+ * @param properties.schemaId: The ID of the schema that this event is related to.
560
+ * @param properties.cliInvokedByCi: True iff process.env.CI is set.
561
+ * @param properties.branchId: The ID of the branch that this event is related to.
562
+ * @param properties.branchName: The name of the branch that this event is related to.
563
+ * @param properties.schemaName: Name of the schema that this event is related to.
564
+ * @param properties.force: Whether the command was called with --force parameter
565
+ * @param properties.forceFeatures: The features overrides provided to the cli pull
725
566
  *
726
- * @see {@link https://www.avo.app/schemas/fwtXqAc0fCLy7b7oGW40/events/qqpIQEK11}
567
+ * @see {@link https://www.avo.app/schemas/fwtXqAc0fCLy7b7oGW40/branches/qsHHWtDYF/events/qqpIQEK11}
727
568
  */
728
569
  export function cliInvoked(properties) {
729
- properties = properties || {};
730
- if (__AVO_DEV__) {
731
570
  // assert properties
732
- var messages = [];
733
- messages = messages.concat(assertUserId_(properties.userId_));
734
- messages = messages.concat(assertCliAction(properties.cliAction));
735
- messages = messages.concat(assertSchemaId(properties.schemaId));
736
- messages = messages.concat(assertCliInvokedByCi(properties.cliInvokedByCi));
737
- messages = messages.concat(assertBranchId(properties.branchId));
738
- messages = messages.concat(assertBranchName(properties.branchName));
739
- messages = messages.concat(assertOptionalSchemaName(properties.schemaName));
740
- messages = messages.concat(assertOptionalForce(properties.force));
741
- messages = messages.concat(assertClient(sysClient));
742
- messages = messages.concat(assertVersion(sysVersion));
743
- messages = messages.concat(AvoAssert.assertNoAdditionalProperties("Cli Invoked", Object.keys(properties), [
744
- "userId_",
745
- "cliAction",
746
- "schemaId",
747
- "cliInvokedByCi",
748
- "branchId",
749
- "branchName",
750
- "schemaName",
751
- "force"
752
- ]));
753
- // debug console in Avo
571
+ if (__AVO_ENV__ !== AvoEnv.Prod) {
572
+ let messages = [];
573
+ // debug console in Avo
574
+ if (!__AVO_NOOP__) {
575
+ _avo_invoke(__AVO_ENV__, "qqpIQEK11", "f424cee5a989c90c69502a11d76705f3b6bc0d3311322c59f5f42ef13269ab2e", messages.map(m => Object.assign({}, { tag: m.tag, propertyId: m.propertyId, additionalProperties: m.additionalProperties, actualType: m.actualType })), 'event');
576
+ }
577
+ InternalAvoLogger.logEventSent("Cli Invoked", {
578
+ "Cli Action": properties.cliAction,
579
+ "Schema Id": properties.schemaId,
580
+ "Cli Invoked by Ci": properties.cliInvokedByCi,
581
+ "Branch Id": properties.branchId,
582
+ "Branch Name": properties.branchName,
583
+ "Schema Name": properties.schemaName,
584
+ "Force": properties.force,
585
+ "Force Features": properties.forceFeatures,
586
+ "Client": sysClient,
587
+ "Version": sysVersion,
588
+ }, {});
589
+ }
590
+ // @ts-ignore
591
+ let eventProperties = {};
592
+ eventProperties["Cli Action"] = properties.cliAction;
593
+ eventProperties["Schema Id"] = properties.schemaId;
594
+ eventProperties["Cli Invoked by Ci"] = properties.cliInvokedByCi;
595
+ eventProperties["Branch Id"] = properties.branchId;
596
+ eventProperties["Branch Name"] = properties.branchName;
597
+ if (properties.schemaName !== undefined && properties.schemaName !== null) {
598
+ eventProperties["Schema Name"] = properties.schemaName;
599
+ }
600
+ if (properties.force !== undefined && properties.force !== null) {
601
+ eventProperties["Force"] = properties.force;
602
+ }
603
+ if (properties.forceFeatures !== undefined && properties.forceFeatures !== null) {
604
+ eventProperties["Force Features"] = properties.forceFeatures;
605
+ }
606
+ eventProperties["Client"] = sysClient;
607
+ eventProperties["Version"] = sysVersion;
608
+ // @ts-ignore
609
+ let userProperties = {};
754
610
  if (!__AVO_NOOP__) {
755
- _avo_invoke(__AVO_ENV__, "qqpIQEK11", "2c085b5b559ba4f21772aefcc05d8169572edea6375b711f3cb6a547445ffb2c", messages.map(function(m) { return Object.assign({}, {tag: m.tag, propertyId: m.propertyId, additionalProperties: m.additionalProperties, actualType: m.actualType}); }), 'event');
611
+ return Promise.all([
612
+ // report to Avo Inspector
613
+ __INSPECTOR__ != null
614
+ // @ts-ignore
615
+ ? __INSPECTOR__._avoFunctionTrackSchemaFromEvent("Cli Invoked", {
616
+ "Cli Action": properties.cliAction,
617
+ "Schema Id": properties.schemaId,
618
+ "Cli Invoked by Ci": properties.cliInvokedByCi,
619
+ "Branch Id": properties.branchId,
620
+ "Branch Name": properties.branchName,
621
+ "Schema Name": properties.schemaName,
622
+ "Force": properties.force,
623
+ "Force Features": properties.forceFeatures,
624
+ "Client": sysClient,
625
+ "Version": sysVersion,
626
+ }, "qqpIQEK11", "f424cee5a989c90c69502a11d76705f3b6bc0d3311322c59f5f42ef13269ab2e")
627
+ : Promise.resolve(),
628
+ // destination CustomNodeJS
629
+ CustomNodeJS.logEvent(properties.userId_, "Cli Invoked", Object.assign({}, eventProperties)),
630
+ ]);
756
631
  }
757
-
758
- InternalAvoLogger.logEventSent("Cli Invoked", {
759
- "Cli Action": properties.cliAction,
760
- "Schema Id": properties.schemaId,
761
- "Cli Invoked by Ci": properties.cliInvokedByCi,
762
- "Branch Id": properties.branchId,
763
- "Branch Name": properties.branchName,
764
- "Schema Name": properties.schemaName,
765
- "Force": properties.force,
766
- "Client": sysClient,
767
- "Version": sysVersion,
768
- }, {}, {});
769
- if (__AVO_DEV__ && (__STRICT__ === null || __STRICT__)) {
770
- // throw exception if messages is not empty
771
- if (messages.length !== 0) {
772
- throw new Error("Error sending event 'Cli Invoked': " + messages[0].message)
773
- }
774
- } else {
775
- messages.forEach(function(m) {
776
- console[__REPORT_FAILURE_AS__ || 'error']("[avo] " + m.message);
777
- });
632
+ else {
633
+ // do nothing
634
+ return new Promise((resolve) => { resolve(null); });
778
635
  }
779
- }
780
-
781
- if (!__AVO_NOOP__) {
782
- return Promise.all([
783
- // report to Avo Inspector
784
- __INSPECTOR__ != null ? __INSPECTOR__._avoFunctionTrackSchemaFromEvent("Cli Invoked", {
785
- "Cli Action": properties.cliAction,
786
- "Schema Id": properties.schemaId,
787
- "Cli Invoked by Ci": properties.cliInvokedByCi,
788
- "Branch Id": properties.branchId,
789
- "Branch Name": properties.branchName,
790
- "Schema Name": properties.schemaName,
791
- "Force": properties.force,
792
- "Client": sysClient,
793
- "Version": sysVersion,
794
- }, "qqpIQEK11", "2c085b5b559ba4f21772aefcc05d8169572edea6375b711f3cb6a547445ffb2c")
795
- : Promise.resolve(),
796
- // destination CustomNodeJS
797
- CustomNodeJS.logEvent(properties.userId_, "Cli Invoked", {
798
- "Cli Action": properties.cliAction,
799
- "Schema Id": properties.schemaId,
800
- "Cli Invoked by Ci": properties.cliInvokedByCi,
801
- "Branch Id": properties.branchId,
802
- "Branch Name": properties.branchName,
803
- "Schema Name": properties.schemaName,
804
- "Force": properties.force,
805
- "Client": sysClient,
806
- "Version": sysVersion,
807
- }),
808
- ]);
809
- } else {
810
- // do nothing
811
- return new Promise((resolve) => { resolve(null); });
812
- }
813
636
  }
814
-
815
637
  /**
816
638
  * Cli Installed: Event sent when the CLI is successfully installed
817
639
  *
818
- * @param {object} properties - the properties associatied with this event
819
- * @param {string} properties.userId_ - User Id is required for server sources.
820
- * @param {bool} properties.cliInvokedByCi - True iff process.env.CI is set.
640
+ * @param properties the properties associatied with this event
641
+ * @param properties.userId_: User Id is required for server sources.
642
+ * @param properties.cliInvokedByCi: True iff process.env.CI is set.
821
643
  *
822
- * @see {@link https://www.avo.app/schemas/fwtXqAc0fCLy7b7oGW40/events/JCwfVYXTS}
644
+ * @see {@link https://www.avo.app/schemas/fwtXqAc0fCLy7b7oGW40/branches/qsHHWtDYF/events/JCwfVYXTS}
823
645
  */
824
646
  export function cliInstalled(properties) {
825
- properties = properties || {};
826
- if (__AVO_DEV__) {
827
647
  // assert properties
828
- var messages = [];
829
- messages = messages.concat(assertUserId_(properties.userId_));
830
- messages = messages.concat(assertCliInvokedByCi(properties.cliInvokedByCi));
831
- messages = messages.concat(assertClient(sysClient));
832
- messages = messages.concat(assertVersion(sysVersion));
833
- messages = messages.concat(AvoAssert.assertNoAdditionalProperties("Cli Installed", Object.keys(properties), [
834
- "userId_",
835
- "cliInvokedByCi"
836
- ]));
837
- // debug console in Avo
648
+ if (__AVO_ENV__ !== AvoEnv.Prod) {
649
+ let messages = [];
650
+ // debug console in Avo
651
+ if (!__AVO_NOOP__) {
652
+ _avo_invoke(__AVO_ENV__, "JCwfVYXTS", "588b1f5190686099b083ad56d3fa443fd2f4c5558878d09a1ef5818f0c731f50", messages.map(m => Object.assign({}, { tag: m.tag, propertyId: m.propertyId, additionalProperties: m.additionalProperties, actualType: m.actualType })), 'event');
653
+ }
654
+ InternalAvoLogger.logEventSent("Cli Installed", {
655
+ "Cli Invoked by Ci": properties.cliInvokedByCi,
656
+ "Client": sysClient,
657
+ "Version": sysVersion,
658
+ }, {});
659
+ }
660
+ // @ts-ignore
661
+ let eventProperties = {};
662
+ eventProperties["Cli Invoked by Ci"] = properties.cliInvokedByCi;
663
+ eventProperties["Client"] = sysClient;
664
+ eventProperties["Version"] = sysVersion;
665
+ // @ts-ignore
666
+ let userProperties = {};
838
667
  if (!__AVO_NOOP__) {
839
- _avo_invoke(__AVO_ENV__, "JCwfVYXTS", "588b1f5190686099b083ad56d3fa443fd2f4c5558878d09a1ef5818f0c731f50", messages.map(function(m) { return Object.assign({}, {tag: m.tag, propertyId: m.propertyId, additionalProperties: m.additionalProperties, actualType: m.actualType}); }), 'event');
668
+ return Promise.all([
669
+ // report to Avo Inspector
670
+ __INSPECTOR__ != null
671
+ // @ts-ignore
672
+ ? __INSPECTOR__._avoFunctionTrackSchemaFromEvent("Cli Installed", {
673
+ "Cli Invoked by Ci": properties.cliInvokedByCi,
674
+ "Client": sysClient,
675
+ "Version": sysVersion,
676
+ }, "JCwfVYXTS", "588b1f5190686099b083ad56d3fa443fd2f4c5558878d09a1ef5818f0c731f50")
677
+ : Promise.resolve(),
678
+ // destination CustomNodeJS
679
+ CustomNodeJS.logEvent(properties.userId_, "Cli Installed", Object.assign({}, eventProperties)),
680
+ ]);
840
681
  }
841
-
842
- InternalAvoLogger.logEventSent("Cli Installed", {
843
- "Cli Invoked by Ci": properties.cliInvokedByCi,
844
- "Client": sysClient,
845
- "Version": sysVersion,
846
- }, {}, {});
847
- if (__AVO_DEV__ && (__STRICT__ === null || __STRICT__)) {
848
- // throw exception if messages is not empty
849
- if (messages.length !== 0) {
850
- throw new Error("Error sending event 'Cli Installed': " + messages[0].message)
851
- }
852
- } else {
853
- messages.forEach(function(m) {
854
- console[__REPORT_FAILURE_AS__ || 'error']("[avo] " + m.message);
855
- });
682
+ else {
683
+ // do nothing
684
+ return new Promise((resolve) => { resolve(null); });
856
685
  }
857
- }
858
-
859
- if (!__AVO_NOOP__) {
860
- return Promise.all([
861
- // report to Avo Inspector
862
- __INSPECTOR__ != null ? __INSPECTOR__._avoFunctionTrackSchemaFromEvent("Cli Installed", {
863
- "Cli Invoked by Ci": properties.cliInvokedByCi,
864
- "Client": sysClient,
865
- "Version": sysVersion,
866
- }, "JCwfVYXTS", "588b1f5190686099b083ad56d3fa443fd2f4c5558878d09a1ef5818f0c731f50")
867
- : Promise.resolve(),
868
- // destination CustomNodeJS
869
- CustomNodeJS.logEvent(properties.userId_, "Cli Installed", {
870
- "Cli Invoked by Ci": properties.cliInvokedByCi,
871
- "Client": sysClient,
872
- "Version": sysVersion,
873
- }),
874
- ]);
875
- } else {
876
- // do nothing
877
- return new Promise((resolve) => { resolve(null); });
878
- }
879
686
  }
880
-
881
687
  /**
882
688
  * Cli Conflict Resolve Attempted: No description
883
689
  *
884
- * @param {object} properties - the properties associatied with this event
885
- * @param {string} properties.userId_ - User Id is required for server sources.
886
- * @param {bool} properties.cliInvokedByCi - True iff process.env.CI is set.
887
- * @param {string} properties.schemaId - The ID of the schema that this event is related to.
888
- * @param {string} properties.branchId - The ID of the branch that this event is related to.
889
- * @param {string} properties.branchName - The name of the branch that this event is related to.
890
- * @param {string} properties.schemaName - Name of the schema that this event is related to.
690
+ * @param properties the properties associatied with this event
691
+ * @param properties.userId_: User Id is required for server sources.
692
+ * @param properties.cliInvokedByCi: True iff process.env.CI is set.
693
+ * @param properties.schemaId: The ID of the schema that this event is related to.
694
+ * @param properties.branchId: The ID of the branch that this event is related to.
695
+ * @param properties.branchName: The name of the branch that this event is related to.
696
+ * @param properties.schemaName: Name of the schema that this event is related to.
891
697
  *
892
- * @see {@link https://www.avo.app/schemas/fwtXqAc0fCLy7b7oGW40/events/Un5dTEMQYy}
698
+ * @see {@link https://www.avo.app/schemas/fwtXqAc0fCLy7b7oGW40/branches/qsHHWtDYF/events/Un5dTEMQYy}
893
699
  */
894
700
  export function cliConflictResolveAttempted(properties) {
895
- properties = properties || {};
896
- if (__AVO_DEV__) {
897
701
  // assert properties
898
- var messages = [];
899
- messages = messages.concat(assertUserId_(properties.userId_));
900
- messages = messages.concat(assertCliInvokedByCi(properties.cliInvokedByCi));
901
- messages = messages.concat(assertSchemaId(properties.schemaId));
902
- messages = messages.concat(assertBranchId(properties.branchId));
903
- messages = messages.concat(assertBranchName(properties.branchName));
904
- messages = messages.concat(assertOptionalSchemaName(properties.schemaName));
905
- messages = messages.concat(assertClient(sysClient));
906
- messages = messages.concat(assertVersion(sysVersion));
907
- messages = messages.concat(AvoAssert.assertNoAdditionalProperties("Cli Conflict Resolve Attempted", Object.keys(properties), [
908
- "userId_",
909
- "cliInvokedByCi",
910
- "schemaId",
911
- "branchId",
912
- "branchName",
913
- "schemaName"
914
- ]));
915
- // debug console in Avo
702
+ if (__AVO_ENV__ !== AvoEnv.Prod) {
703
+ let messages = [];
704
+ // debug console in Avo
705
+ if (!__AVO_NOOP__) {
706
+ _avo_invoke(__AVO_ENV__, "Un5dTEMQYy", "c867f79479ce7c82d8c80d34ae1847e346f03cf8e742cf5706a2f18142f692a7", messages.map(m => Object.assign({}, { tag: m.tag, propertyId: m.propertyId, additionalProperties: m.additionalProperties, actualType: m.actualType })), 'event');
707
+ }
708
+ InternalAvoLogger.logEventSent("Cli Conflict Resolve Attempted", {
709
+ "Cli Invoked by Ci": properties.cliInvokedByCi,
710
+ "Schema Id": properties.schemaId,
711
+ "Branch Id": properties.branchId,
712
+ "Branch Name": properties.branchName,
713
+ "Schema Name": properties.schemaName,
714
+ "Client": sysClient,
715
+ "Version": sysVersion,
716
+ }, {});
717
+ }
718
+ // @ts-ignore
719
+ let eventProperties = {};
720
+ eventProperties["Cli Invoked by Ci"] = properties.cliInvokedByCi;
721
+ eventProperties["Schema Id"] = properties.schemaId;
722
+ eventProperties["Branch Id"] = properties.branchId;
723
+ eventProperties["Branch Name"] = properties.branchName;
724
+ if (properties.schemaName !== undefined && properties.schemaName !== null) {
725
+ eventProperties["Schema Name"] = properties.schemaName;
726
+ }
727
+ eventProperties["Client"] = sysClient;
728
+ eventProperties["Version"] = sysVersion;
729
+ // @ts-ignore
730
+ let userProperties = {};
916
731
  if (!__AVO_NOOP__) {
917
- _avo_invoke(__AVO_ENV__, "Un5dTEMQYy", "7404977817fc78c9c765838ebf115d8d684453662663c3947b3ebbc15154a3f7", messages.map(function(m) { return Object.assign({}, {tag: m.tag, propertyId: m.propertyId, additionalProperties: m.additionalProperties, actualType: m.actualType}); }), 'event');
732
+ return Promise.all([
733
+ // report to Avo Inspector
734
+ __INSPECTOR__ != null
735
+ // @ts-ignore
736
+ ? __INSPECTOR__._avoFunctionTrackSchemaFromEvent("Cli Conflict Resolve Attempted", {
737
+ "Cli Invoked by Ci": properties.cliInvokedByCi,
738
+ "Schema Id": properties.schemaId,
739
+ "Branch Id": properties.branchId,
740
+ "Branch Name": properties.branchName,
741
+ "Schema Name": properties.schemaName,
742
+ "Client": sysClient,
743
+ "Version": sysVersion,
744
+ }, "Un5dTEMQYy", "c867f79479ce7c82d8c80d34ae1847e346f03cf8e742cf5706a2f18142f692a7")
745
+ : Promise.resolve(),
746
+ // destination CustomNodeJS
747
+ CustomNodeJS.logEvent(properties.userId_, "Cli Conflict Resolve Attempted", Object.assign({}, eventProperties)),
748
+ ]);
918
749
  }
919
-
920
- InternalAvoLogger.logEventSent("Cli Conflict Resolve Attempted", {
921
- "Cli Invoked by Ci": properties.cliInvokedByCi,
922
- "Schema Id": properties.schemaId,
923
- "Branch Id": properties.branchId,
924
- "Branch Name": properties.branchName,
925
- "Schema Name": properties.schemaName,
926
- "Client": sysClient,
927
- "Version": sysVersion,
928
- }, {}, {});
929
- if (__AVO_DEV__ && (__STRICT__ === null || __STRICT__)) {
930
- // throw exception if messages is not empty
931
- if (messages.length !== 0) {
932
- throw new Error("Error sending event 'Cli Conflict Resolve Attempted': " + messages[0].message)
933
- }
934
- } else {
935
- messages.forEach(function(m) {
936
- console[__REPORT_FAILURE_AS__ || 'error']("[avo] " + m.message);
937
- });
750
+ else {
751
+ // do nothing
752
+ return new Promise((resolve) => { resolve(null); });
938
753
  }
939
- }
940
-
941
- if (!__AVO_NOOP__) {
942
- return Promise.all([
943
- // report to Avo Inspector
944
- __INSPECTOR__ != null ? __INSPECTOR__._avoFunctionTrackSchemaFromEvent("Cli Conflict Resolve Attempted", {
945
- "Cli Invoked by Ci": properties.cliInvokedByCi,
946
- "Schema Id": properties.schemaId,
947
- "Branch Id": properties.branchId,
948
- "Branch Name": properties.branchName,
949
- "Schema Name": properties.schemaName,
950
- "Client": sysClient,
951
- "Version": sysVersion,
952
- }, "Un5dTEMQYy", "7404977817fc78c9c765838ebf115d8d684453662663c3947b3ebbc15154a3f7")
953
- : Promise.resolve(),
954
- // destination CustomNodeJS
955
- CustomNodeJS.logEvent(properties.userId_, "Cli Conflict Resolve Attempted", {
956
- "Cli Invoked by Ci": properties.cliInvokedByCi,
957
- "Schema Id": properties.schemaId,
958
- "Branch Id": properties.branchId,
959
- "Branch Name": properties.branchName,
960
- "Schema Name": properties.schemaName,
961
- "Client": sysClient,
962
- "Version": sysVersion,
963
- }),
964
- ]);
965
- } else {
966
- // do nothing
967
- return new Promise((resolve) => { resolve(null); });
968
- }
969
754
  }
970
-
971
755
  /**
972
756
  * Cli Conflict Resolve Failed: No description
973
757
  *
974
- * @param {object} properties - the properties associatied with this event
975
- * @param {string} properties.userId_ - User Id is required for server sources.
976
- * @param {bool} properties.cliInvokedByCi - True iff process.env.CI is set.
977
- * @param {string} properties.schemaId - The ID of the schema that this event is related to.
978
- * @param {string} properties.schemaName - Name of the schema that this event is related to.
979
- * @param {string} properties.branchId - The ID of the branch that this event is related to.
980
- * @param {string} properties.branchName - The name of the branch that this event is related to.
758
+ * @param properties the properties associatied with this event
759
+ * @param properties.userId_: User Id is required for server sources.
760
+ * @param properties.cliInvokedByCi: True iff process.env.CI is set.
761
+ * @param properties.schemaId: The ID of the schema that this event is related to.
762
+ * @param properties.schemaName: Name of the schema that this event is related to.
763
+ * @param properties.branchId: The ID of the branch that this event is related to.
764
+ * @param properties.branchName: The name of the branch that this event is related to.
981
765
  *
982
- * @see {@link https://www.avo.app/schemas/fwtXqAc0fCLy7b7oGW40/events/4ZhoijIA2U}
766
+ * @see {@link https://www.avo.app/schemas/fwtXqAc0fCLy7b7oGW40/branches/qsHHWtDYF/events/4ZhoijIA2U}
983
767
  */
984
768
  export function cliConflictResolveFailed(properties) {
985
- properties = properties || {};
986
- if (__AVO_DEV__) {
987
769
  // assert properties
988
- var messages = [];
989
- messages = messages.concat(assertUserId_(properties.userId_));
990
- messages = messages.concat(assertCliInvokedByCi(properties.cliInvokedByCi));
991
- messages = messages.concat(assertSchemaId(properties.schemaId));
992
- messages = messages.concat(assertOptionalSchemaName(properties.schemaName));
993
- messages = messages.concat(assertBranchId(properties.branchId));
994
- messages = messages.concat(assertBranchName(properties.branchName));
995
- messages = messages.concat(assertClient(sysClient));
996
- messages = messages.concat(assertVersion(sysVersion));
997
- messages = messages.concat(AvoAssert.assertNoAdditionalProperties("Cli Conflict Resolve Failed", Object.keys(properties), [
998
- "userId_",
999
- "cliInvokedByCi",
1000
- "schemaId",
1001
- "schemaName",
1002
- "branchId",
1003
- "branchName"
1004
- ]));
1005
- // debug console in Avo
770
+ if (__AVO_ENV__ !== AvoEnv.Prod) {
771
+ let messages = [];
772
+ // debug console in Avo
773
+ if (!__AVO_NOOP__) {
774
+ _avo_invoke(__AVO_ENV__, "4ZhoijIA2U", "403808c3d3db8ed1d0a2298ac0c684fa8fcdc16c816f7bd878f136647aff8c00", messages.map(m => Object.assign({}, { tag: m.tag, propertyId: m.propertyId, additionalProperties: m.additionalProperties, actualType: m.actualType })), 'event');
775
+ }
776
+ InternalAvoLogger.logEventSent("Cli Conflict Resolve Failed", {
777
+ "Cli Invoked by Ci": properties.cliInvokedByCi,
778
+ "Schema Id": properties.schemaId,
779
+ "Schema Name": properties.schemaName,
780
+ "Branch Id": properties.branchId,
781
+ "Branch Name": properties.branchName,
782
+ "Client": sysClient,
783
+ "Version": sysVersion,
784
+ }, {});
785
+ }
786
+ // @ts-ignore
787
+ let eventProperties = {};
788
+ eventProperties["Cli Invoked by Ci"] = properties.cliInvokedByCi;
789
+ eventProperties["Schema Id"] = properties.schemaId;
790
+ if (properties.schemaName !== undefined && properties.schemaName !== null) {
791
+ eventProperties["Schema Name"] = properties.schemaName;
792
+ }
793
+ eventProperties["Branch Id"] = properties.branchId;
794
+ eventProperties["Branch Name"] = properties.branchName;
795
+ eventProperties["Client"] = sysClient;
796
+ eventProperties["Version"] = sysVersion;
797
+ // @ts-ignore
798
+ let userProperties = {};
1006
799
  if (!__AVO_NOOP__) {
1007
- _avo_invoke(__AVO_ENV__, "4ZhoijIA2U", "67b876f2a00dbd0b854836a8adfca0084118e427ce3332a428dbfc563dab8bc0", messages.map(function(m) { return Object.assign({}, {tag: m.tag, propertyId: m.propertyId, additionalProperties: m.additionalProperties, actualType: m.actualType}); }), 'event');
800
+ return Promise.all([
801
+ // report to Avo Inspector
802
+ __INSPECTOR__ != null
803
+ // @ts-ignore
804
+ ? __INSPECTOR__._avoFunctionTrackSchemaFromEvent("Cli Conflict Resolve Failed", {
805
+ "Cli Invoked by Ci": properties.cliInvokedByCi,
806
+ "Schema Id": properties.schemaId,
807
+ "Schema Name": properties.schemaName,
808
+ "Branch Id": properties.branchId,
809
+ "Branch Name": properties.branchName,
810
+ "Client": sysClient,
811
+ "Version": sysVersion,
812
+ }, "4ZhoijIA2U", "403808c3d3db8ed1d0a2298ac0c684fa8fcdc16c816f7bd878f136647aff8c00")
813
+ : Promise.resolve(),
814
+ // destination CustomNodeJS
815
+ CustomNodeJS.logEvent(properties.userId_, "Cli Conflict Resolve Failed", Object.assign({}, eventProperties)),
816
+ ]);
1008
817
  }
1009
-
1010
- InternalAvoLogger.logEventSent("Cli Conflict Resolve Failed", {
1011
- "Cli Invoked by Ci": properties.cliInvokedByCi,
1012
- "Schema Id": properties.schemaId,
1013
- "Schema Name": properties.schemaName,
1014
- "Branch Id": properties.branchId,
1015
- "Branch Name": properties.branchName,
1016
- "Client": sysClient,
1017
- "Version": sysVersion,
1018
- }, {}, {});
1019
- if (__AVO_DEV__ && (__STRICT__ === null || __STRICT__)) {
1020
- // throw exception if messages is not empty
1021
- if (messages.length !== 0) {
1022
- throw new Error("Error sending event 'Cli Conflict Resolve Failed': " + messages[0].message)
1023
- }
1024
- } else {
1025
- messages.forEach(function(m) {
1026
- console[__REPORT_FAILURE_AS__ || 'error']("[avo] " + m.message);
1027
- });
818
+ else {
819
+ // do nothing
820
+ return new Promise((resolve) => { resolve(null); });
1028
821
  }
1029
- }
1030
-
1031
- if (!__AVO_NOOP__) {
1032
- return Promise.all([
1033
- // report to Avo Inspector
1034
- __INSPECTOR__ != null ? __INSPECTOR__._avoFunctionTrackSchemaFromEvent("Cli Conflict Resolve Failed", {
1035
- "Cli Invoked by Ci": properties.cliInvokedByCi,
1036
- "Schema Id": properties.schemaId,
1037
- "Schema Name": properties.schemaName,
1038
- "Branch Id": properties.branchId,
1039
- "Branch Name": properties.branchName,
1040
- "Client": sysClient,
1041
- "Version": sysVersion,
1042
- }, "4ZhoijIA2U", "67b876f2a00dbd0b854836a8adfca0084118e427ce3332a428dbfc563dab8bc0")
1043
- : Promise.resolve(),
1044
- // destination CustomNodeJS
1045
- CustomNodeJS.logEvent(properties.userId_, "Cli Conflict Resolve Failed", {
1046
- "Cli Invoked by Ci": properties.cliInvokedByCi,
1047
- "Schema Id": properties.schemaId,
1048
- "Schema Name": properties.schemaName,
1049
- "Branch Id": properties.branchId,
1050
- "Branch Name": properties.branchName,
1051
- "Client": sysClient,
1052
- "Version": sysVersion,
1053
- }),
1054
- ]);
1055
- } else {
1056
- // do nothing
1057
- return new Promise((resolve) => { resolve(null); });
1058
- }
1059
822
  }
1060
-
1061
823
  /**
1062
824
  * Cli Conflict Resolve Succeeded: No description
1063
825
  *
1064
- * @param {object} properties - the properties associatied with this event
1065
- * @param {string} properties.userId_ - User Id is required for server sources.
1066
- * @param {bool} properties.cliInvokedByCi - True iff process.env.CI is set.
1067
- * @param {string} properties.schemaId - The ID of the schema that this event is related to.
1068
- * @param {string} properties.schemaName - Name of the schema that this event is related to.
1069
- * @param {string} properties.branchId - The ID of the branch that this event is related to.
1070
- * @param {string} properties.branchName - The name of the branch that this event is related to.
826
+ * @param properties the properties associatied with this event
827
+ * @param properties.userId_: User Id is required for server sources.
828
+ * @param properties.cliInvokedByCi: True iff process.env.CI is set.
829
+ * @param properties.schemaId: The ID of the schema that this event is related to.
830
+ * @param properties.schemaName: Name of the schema that this event is related to.
831
+ * @param properties.branchId: The ID of the branch that this event is related to.
832
+ * @param properties.branchName: The name of the branch that this event is related to.
1071
833
  *
1072
- * @see {@link https://www.avo.app/schemas/fwtXqAc0fCLy7b7oGW40/events/yj_554q43i}
834
+ * @see {@link https://www.avo.app/schemas/fwtXqAc0fCLy7b7oGW40/branches/qsHHWtDYF/events/yj_554q43i}
1073
835
  */
1074
836
  export function cliConflictResolveSucceeded(properties) {
1075
- properties = properties || {};
1076
- if (__AVO_DEV__) {
1077
837
  // assert properties
1078
- var messages = [];
1079
- messages = messages.concat(assertUserId_(properties.userId_));
1080
- messages = messages.concat(assertCliInvokedByCi(properties.cliInvokedByCi));
1081
- messages = messages.concat(assertSchemaId(properties.schemaId));
1082
- messages = messages.concat(assertOptionalSchemaName(properties.schemaName));
1083
- messages = messages.concat(assertBranchId(properties.branchId));
1084
- messages = messages.concat(assertBranchName(properties.branchName));
1085
- messages = messages.concat(assertClient(sysClient));
1086
- messages = messages.concat(assertVersion(sysVersion));
1087
- messages = messages.concat(AvoAssert.assertNoAdditionalProperties("Cli Conflict Resolve Succeeded", Object.keys(properties), [
1088
- "userId_",
1089
- "cliInvokedByCi",
1090
- "schemaId",
1091
- "schemaName",
1092
- "branchId",
1093
- "branchName"
1094
- ]));
1095
- // debug console in Avo
838
+ if (__AVO_ENV__ !== AvoEnv.Prod) {
839
+ let messages = [];
840
+ // debug console in Avo
841
+ if (!__AVO_NOOP__) {
842
+ _avo_invoke(__AVO_ENV__, "yj_554q43i", "a4a180d66deeb76b91d67098746764905c5b37c201019c26da254a8358110f9f", messages.map(m => Object.assign({}, { tag: m.tag, propertyId: m.propertyId, additionalProperties: m.additionalProperties, actualType: m.actualType })), 'event');
843
+ }
844
+ InternalAvoLogger.logEventSent("Cli Conflict Resolve Succeeded", {
845
+ "Cli Invoked by Ci": properties.cliInvokedByCi,
846
+ "Schema Id": properties.schemaId,
847
+ "Schema Name": properties.schemaName,
848
+ "Branch Id": properties.branchId,
849
+ "Branch Name": properties.branchName,
850
+ "Client": sysClient,
851
+ "Version": sysVersion,
852
+ }, {});
853
+ }
854
+ // @ts-ignore
855
+ let eventProperties = {};
856
+ eventProperties["Cli Invoked by Ci"] = properties.cliInvokedByCi;
857
+ eventProperties["Schema Id"] = properties.schemaId;
858
+ if (properties.schemaName !== undefined && properties.schemaName !== null) {
859
+ eventProperties["Schema Name"] = properties.schemaName;
860
+ }
861
+ eventProperties["Branch Id"] = properties.branchId;
862
+ eventProperties["Branch Name"] = properties.branchName;
863
+ eventProperties["Client"] = sysClient;
864
+ eventProperties["Version"] = sysVersion;
865
+ // @ts-ignore
866
+ let userProperties = {};
1096
867
  if (!__AVO_NOOP__) {
1097
- _avo_invoke(__AVO_ENV__, "yj_554q43i", "15ed68a02ce2178bd8be746d338dcec50f4e325069f03df6e5c164376fcb9c1f", messages.map(function(m) { return Object.assign({}, {tag: m.tag, propertyId: m.propertyId, additionalProperties: m.additionalProperties, actualType: m.actualType}); }), 'event');
868
+ return Promise.all([
869
+ // report to Avo Inspector
870
+ __INSPECTOR__ != null
871
+ // @ts-ignore
872
+ ? __INSPECTOR__._avoFunctionTrackSchemaFromEvent("Cli Conflict Resolve Succeeded", {
873
+ "Cli Invoked by Ci": properties.cliInvokedByCi,
874
+ "Schema Id": properties.schemaId,
875
+ "Schema Name": properties.schemaName,
876
+ "Branch Id": properties.branchId,
877
+ "Branch Name": properties.branchName,
878
+ "Client": sysClient,
879
+ "Version": sysVersion,
880
+ }, "yj_554q43i", "a4a180d66deeb76b91d67098746764905c5b37c201019c26da254a8358110f9f")
881
+ : Promise.resolve(),
882
+ // destination CustomNodeJS
883
+ CustomNodeJS.logEvent(properties.userId_, "Cli Conflict Resolve Succeeded", Object.assign({}, eventProperties)),
884
+ ]);
1098
885
  }
1099
-
1100
- InternalAvoLogger.logEventSent("Cli Conflict Resolve Succeeded", {
1101
- "Cli Invoked by Ci": properties.cliInvokedByCi,
1102
- "Schema Id": properties.schemaId,
1103
- "Schema Name": properties.schemaName,
1104
- "Branch Id": properties.branchId,
1105
- "Branch Name": properties.branchName,
1106
- "Client": sysClient,
1107
- "Version": sysVersion,
1108
- }, {}, {});
1109
- if (__AVO_DEV__ && (__STRICT__ === null || __STRICT__)) {
1110
- // throw exception if messages is not empty
1111
- if (messages.length !== 0) {
1112
- throw new Error("Error sending event 'Cli Conflict Resolve Succeeded': " + messages[0].message)
1113
- }
1114
- } else {
1115
- messages.forEach(function(m) {
1116
- console[__REPORT_FAILURE_AS__ || 'error']("[avo] " + m.message);
1117
- });
886
+ else {
887
+ // do nothing
888
+ return new Promise((resolve) => { resolve(null); });
1118
889
  }
1119
- }
1120
-
1121
- if (!__AVO_NOOP__) {
1122
- return Promise.all([
1123
- // report to Avo Inspector
1124
- __INSPECTOR__ != null ? __INSPECTOR__._avoFunctionTrackSchemaFromEvent("Cli Conflict Resolve Succeeded", {
1125
- "Cli Invoked by Ci": properties.cliInvokedByCi,
1126
- "Schema Id": properties.schemaId,
1127
- "Schema Name": properties.schemaName,
1128
- "Branch Id": properties.branchId,
1129
- "Branch Name": properties.branchName,
1130
- "Client": sysClient,
1131
- "Version": sysVersion,
1132
- }, "yj_554q43i", "15ed68a02ce2178bd8be746d338dcec50f4e325069f03df6e5c164376fcb9c1f")
1133
- : Promise.resolve(),
1134
- // destination CustomNodeJS
1135
- CustomNodeJS.logEvent(properties.userId_, "Cli Conflict Resolve Succeeded", {
1136
- "Cli Invoked by Ci": properties.cliInvokedByCi,
1137
- "Schema Id": properties.schemaId,
1138
- "Schema Name": properties.schemaName,
1139
- "Branch Id": properties.branchId,
1140
- "Branch Name": properties.branchName,
1141
- "Client": sysClient,
1142
- "Version": sysVersion,
1143
- }),
1144
- ]);
1145
- } else {
1146
- // do nothing
1147
- return new Promise((resolve) => { resolve(null); });
1148
- }
1149
890
  }
1150
-
1151
891
  export default {
1152
- setAvoLogger: setAvoLogger,
1153
- SignInError: SignInError,
1154
- Client: Client,
1155
- AuthenticationMethod: AuthenticationMethod,
1156
- CliAction: CliAction,
1157
- signedIn: signedIn,
1158
- signInFailed: signInFailed,
1159
- cliInvoked: cliInvoked,
1160
- cliInstalled: cliInstalled,
1161
- cliConflictResolveAttempted: cliConflictResolveAttempted,
1162
- cliConflictResolveFailed: cliConflictResolveFailed,
1163
- cliConflictResolveSucceeded: cliConflictResolveSucceeded,
1164
- setSystemProperties: setSystemProperties,
1165
- initAvo: initAvo,
1166
- avoInspectorApiKey: avoInspectorApiKey,
1167
- }
1168
-
892
+ AvoEnv,
893
+ initAvo,
894
+ setSystemProperties,
895
+ avoInspectorApiKey,
896
+ SignInError,
897
+ Client,
898
+ AuthenticationMethod,
899
+ CliAction,
900
+ signedIn,
901
+ signInFailed,
902
+ cliInvoked,
903
+ cliInstalled,
904
+ cliConflictResolveAttempted,
905
+ cliConflictResolveFailed,
906
+ cliConflictResolveSucceeded,
907
+ };
1169
908
  // AVOMODULEMAP:"Avo"
1170
909
  // AVOEVENTMAP:["signedIn","signInFailed","cliInvoked","cliInstalled","cliConflictResolveAttempted","cliConflictResolveFailed","cliConflictResolveSucceeded"]