@erxes/api-shared 3.3.2 → 3.3.3-next.2
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/core-modules/dist/erxes-api-shared-core-modules.cjs.dev.js +5 -1
- package/core-modules/dist/erxes-api-shared-core-modules.cjs.prod.js +5 -1
- package/core-modules/dist/erxes-api-shared-core-modules.esm.js +2 -2
- package/dist/declarations/src/core-modules/automations/constants.d.ts +6 -0
- package/dist/declarations/src/core-modules/automations/constants.d.ts.map +1 -1
- package/dist/declarations/src/core-modules/automations/outputResolvers.d.ts +29 -0
- package/dist/declarations/src/core-modules/automations/outputResolvers.d.ts.map +1 -1
- package/dist/declarations/src/core-modules/automations/types.d.ts +40 -1
- package/dist/declarations/src/core-modules/automations/types.d.ts.map +1 -1
- package/dist/declarations/src/core-modules/automations/utils.d.ts +2 -1
- package/dist/declarations/src/core-modules/automations/utils.d.ts.map +1 -1
- package/dist/declarations/src/core-modules/notifications/definitions/emailAddresses.d.ts +6 -0
- package/dist/declarations/src/core-modules/notifications/definitions/emailAddresses.d.ts.map +1 -1
- package/dist/declarations/src/core-modules/notifications/definitions/notificationSettings.d.ts +4 -0
- package/dist/declarations/src/core-modules/notifications/definitions/notificationSettings.d.ts.map +1 -1
- package/dist/declarations/src/core-modules/notifications/utils.d.ts +1 -0
- package/dist/declarations/src/core-modules/notifications/utils.d.ts.map +1 -1
- package/dist/{start-plugin-6687b329.cjs.dev.js → start-plugin-2c3dcde9.cjs.dev.js} +412 -290
- package/dist/{start-plugin-2b3e89f5.esm.js → start-plugin-322626b5.esm.js} +409 -291
- package/dist/{start-plugin-46baacee.cjs.prod.js → start-plugin-882163d1.cjs.prod.js} +412 -290
- package/package.json +1 -1
- package/src/core-modules/automations/constants.ts +26 -0
- package/src/core-modules/automations/outputResolvers.ts +8 -0
- package/src/core-modules/automations/types.ts +54 -1
- package/src/core-modules/automations/utils.ts +31 -2
- package/src/core-modules/notifications/definitions/emailAddresses.ts +15 -0
- package/src/core-modules/notifications/definitions/notificationSettings.ts +2 -0
- package/src/core-modules/notifications/utils.ts +38 -3
- package/utils/dist/erxes-api-shared-utils.cjs.dev.js +1 -1
- package/utils/dist/erxes-api-shared-utils.cjs.prod.js +1 -1
- package/utils/dist/erxes-api-shared-utils.esm.js +2 -2
|
@@ -5273,6 +5273,67 @@ var parsePropertyColumnKey = function parsePropertyColumnKey(columnKey) {
|
|
|
5273
5273
|
};
|
|
5274
5274
|
};
|
|
5275
5275
|
|
|
5276
|
+
/**
|
|
5277
|
+
* A value an action reads from whatever started the run. The action names
|
|
5278
|
+
* what it needs; it never learns which record supplied it.
|
|
5279
|
+
*/
|
|
5280
|
+
|
|
5281
|
+
/**
|
|
5282
|
+
* Per action type, which of the trigger's own output keys fills each of that
|
|
5283
|
+
* action's inputs. Declared by the trigger's plugin, so no one maps by hand.
|
|
5284
|
+
*/
|
|
5285
|
+
|
|
5286
|
+
// Set by the action author, not the end user: 'ignore' lets the flow continue
|
|
5287
|
+
// while the work is queued, 'standby' pauses until the result is back.
|
|
5288
|
+
|
|
5289
|
+
// Returned by the owning plugin instead of a result: it queued the work and
|
|
5290
|
+
// tells the engine whether the flow may carry on without it.
|
|
5291
|
+
|
|
5292
|
+
var AUTOMATION_ACTION_CONTRIBUTIONS = {
|
|
5293
|
+
// Acts on a record a sibling branch remembered: the agent picks which one.
|
|
5294
|
+
REMEMBERED_RECORD_CHOICE: 'rememberedRecordChoice'
|
|
5295
|
+
};
|
|
5296
|
+
|
|
5297
|
+
/**
|
|
5298
|
+
* A step of a built-in template.
|
|
5299
|
+
*
|
|
5300
|
+
* Addressed by `order` rather than by id: ids are generated per automation, so
|
|
5301
|
+
* a template that hardcoded them could never be installed twice. Installing
|
|
5302
|
+
* maps every order to a fresh id and rewrites the connections with it.
|
|
5303
|
+
*/
|
|
5304
|
+
|
|
5305
|
+
/**
|
|
5306
|
+
* Something the tenant must already have before a template can work — a bot, a
|
|
5307
|
+
* pipeline stage, an integration. The value is chosen once, while installing,
|
|
5308
|
+
* by a component the owning plugin provides: only that plugin knows what
|
|
5309
|
+
* counts as a valid candidate and how to list them.
|
|
5310
|
+
*/
|
|
5311
|
+
|
|
5312
|
+
var EXECUTE_WAIT_TYPES = /*#__PURE__*/function (EXECUTE_WAIT_TYPES) {
|
|
5313
|
+
EXECUTE_WAIT_TYPES["DELAY"] = "delay";
|
|
5314
|
+
EXECUTE_WAIT_TYPES["IS_IN_SEGMENT"] = "isInSegment";
|
|
5315
|
+
EXECUTE_WAIT_TYPES["CHECK_OBJECT"] = "checkObject";
|
|
5316
|
+
EXECUTE_WAIT_TYPES["WEBHOOK"] = "webhook";
|
|
5317
|
+
return EXECUTE_WAIT_TYPES;
|
|
5318
|
+
}({});
|
|
5319
|
+
var TAutomationProducers = /*#__PURE__*/function (TAutomationProducers) {
|
|
5320
|
+
TAutomationProducers["RECEIVE_ACTIONS"] = "receiveActions";
|
|
5321
|
+
TAutomationProducers["RESOLVE_OUTPUT_PATHS"] = "resolveOutputPaths";
|
|
5322
|
+
TAutomationProducers["CHECK_CUSTOM_TRIGGER"] = "checkCustomTrigger";
|
|
5323
|
+
TAutomationProducers["FIND_OBJECT"] = "findObject";
|
|
5324
|
+
TAutomationProducers["SET_PROPERTIES"] = "setProperties";
|
|
5325
|
+
TAutomationProducers["GENERATE_AI_CONTEXT"] = "generateAiContext";
|
|
5326
|
+
TAutomationProducers["LOAD_AI_KNOWLEDGE_DOCUMENT_BATCH"] = "loadAiKnowledgeDocumentBatch";
|
|
5327
|
+
TAutomationProducers["LOOKUP_AI_TOOL"] = "lookupAiTool";
|
|
5328
|
+
return TAutomationProducers;
|
|
5329
|
+
}({});
|
|
5330
|
+
var TAutomationActionFolks = /*#__PURE__*/function (TAutomationActionFolks) {
|
|
5331
|
+
TAutomationActionFolks["DEFAULT"] = "default";
|
|
5332
|
+
TAutomationActionFolks["SUCCESS"] = "success";
|
|
5333
|
+
TAutomationActionFolks["ERROR"] = "error";
|
|
5334
|
+
return TAutomationActionFolks;
|
|
5335
|
+
}({});
|
|
5336
|
+
|
|
5276
5337
|
var AUTOMATION_PROPERTY_OPERATORS = {
|
|
5277
5338
|
SET: 'set',
|
|
5278
5339
|
CLEAR: 'clear',
|
|
@@ -5377,6 +5438,19 @@ var AUTOMATION_CORE_ACTION_DEFERRED = _defineProperty({}, AUTOMATION_CORE_ACTION
|
|
|
5377
5438
|
mode: 'standby',
|
|
5378
5439
|
timeoutMinutes: 3
|
|
5379
5440
|
});
|
|
5441
|
+
|
|
5442
|
+
/**
|
|
5443
|
+
* Core actions have no plugin constants either, so how they combine with the
|
|
5444
|
+
* actions around them is declared here.
|
|
5445
|
+
*/
|
|
5446
|
+
var AUTOMATION_CORE_ACTION_PLACEMENTS = _defineProperty(_defineProperty({}, AUTOMATION_CORE_ACTIONS.AI_AGENT, {
|
|
5447
|
+
accepts: [AUTOMATION_ACTION_CONTRIBUTIONS.REMEMBERED_RECORD_CHOICE]
|
|
5448
|
+
}), AUTOMATION_CORE_ACTIONS.SET_PROPERTY, {
|
|
5449
|
+
addsToPrevious: [{
|
|
5450
|
+
actionType: AUTOMATION_CORE_ACTIONS.AI_AGENT,
|
|
5451
|
+
kind: AUTOMATION_ACTION_CONTRIBUTIONS.REMEMBERED_RECORD_CHOICE
|
|
5452
|
+
}]
|
|
5453
|
+
});
|
|
5380
5454
|
var AUTOMATION_DEFERRED_TIMEOUT = {
|
|
5381
5455
|
DEFAULT_MINUTES: 10,
|
|
5382
5456
|
MAX_MINUTES: 60
|
|
@@ -6316,62 +6390,6 @@ var resolveRecordReferenceValue = /*#__PURE__*/function () {
|
|
|
6316
6390
|
};
|
|
6317
6391
|
}();
|
|
6318
6392
|
|
|
6319
|
-
/**
|
|
6320
|
-
* A value an action reads from whatever started the run. The action names
|
|
6321
|
-
* what it needs; it never learns which record supplied it.
|
|
6322
|
-
*/
|
|
6323
|
-
|
|
6324
|
-
/**
|
|
6325
|
-
* Per action type, which of the trigger's own output keys fills each of that
|
|
6326
|
-
* action's inputs. Declared by the trigger's plugin, so no one maps by hand.
|
|
6327
|
-
*/
|
|
6328
|
-
|
|
6329
|
-
// Set by the action author, not the end user: 'ignore' lets the flow continue
|
|
6330
|
-
// while the work is queued, 'standby' pauses until the result is back.
|
|
6331
|
-
|
|
6332
|
-
// Returned by the owning plugin instead of a result: it queued the work and
|
|
6333
|
-
// tells the engine whether the flow may carry on without it.
|
|
6334
|
-
|
|
6335
|
-
/**
|
|
6336
|
-
* A step of a built-in template.
|
|
6337
|
-
*
|
|
6338
|
-
* Addressed by `order` rather than by id: ids are generated per automation, so
|
|
6339
|
-
* a template that hardcoded them could never be installed twice. Installing
|
|
6340
|
-
* maps every order to a fresh id and rewrites the connections with it.
|
|
6341
|
-
*/
|
|
6342
|
-
|
|
6343
|
-
/**
|
|
6344
|
-
* Something the tenant must already have before a template can work — a bot, a
|
|
6345
|
-
* pipeline stage, an integration. The value is chosen once, while installing,
|
|
6346
|
-
* by a component the owning plugin provides: only that plugin knows what
|
|
6347
|
-
* counts as a valid candidate and how to list them.
|
|
6348
|
-
*/
|
|
6349
|
-
|
|
6350
|
-
var EXECUTE_WAIT_TYPES = /*#__PURE__*/function (EXECUTE_WAIT_TYPES) {
|
|
6351
|
-
EXECUTE_WAIT_TYPES["DELAY"] = "delay";
|
|
6352
|
-
EXECUTE_WAIT_TYPES["IS_IN_SEGMENT"] = "isInSegment";
|
|
6353
|
-
EXECUTE_WAIT_TYPES["CHECK_OBJECT"] = "checkObject";
|
|
6354
|
-
EXECUTE_WAIT_TYPES["WEBHOOK"] = "webhook";
|
|
6355
|
-
return EXECUTE_WAIT_TYPES;
|
|
6356
|
-
}({});
|
|
6357
|
-
var TAutomationProducers = /*#__PURE__*/function (TAutomationProducers) {
|
|
6358
|
-
TAutomationProducers["RECEIVE_ACTIONS"] = "receiveActions";
|
|
6359
|
-
TAutomationProducers["RESOLVE_OUTPUT_PATHS"] = "resolveOutputPaths";
|
|
6360
|
-
TAutomationProducers["CHECK_CUSTOM_TRIGGER"] = "checkCustomTrigger";
|
|
6361
|
-
TAutomationProducers["FIND_OBJECT"] = "findObject";
|
|
6362
|
-
TAutomationProducers["SET_PROPERTIES"] = "setProperties";
|
|
6363
|
-
TAutomationProducers["GENERATE_AI_CONTEXT"] = "generateAiContext";
|
|
6364
|
-
TAutomationProducers["LOAD_AI_KNOWLEDGE_DOCUMENT_BATCH"] = "loadAiKnowledgeDocumentBatch";
|
|
6365
|
-
TAutomationProducers["LOOKUP_AI_TOOL"] = "lookupAiTool";
|
|
6366
|
-
return TAutomationProducers;
|
|
6367
|
-
}({});
|
|
6368
|
-
var TAutomationActionFolks = /*#__PURE__*/function (TAutomationActionFolks) {
|
|
6369
|
-
TAutomationActionFolks["DEFAULT"] = "default";
|
|
6370
|
-
TAutomationActionFolks["SUCCESS"] = "success";
|
|
6371
|
-
TAutomationActionFolks["ERROR"] = "error";
|
|
6372
|
-
return TAutomationActionFolks;
|
|
6373
|
-
}({});
|
|
6374
|
-
|
|
6375
6393
|
var splitType = function splitType(type) {
|
|
6376
6394
|
return type.replace(/\./g, ':').split(':');
|
|
6377
6395
|
};
|
|
@@ -7201,91 +7219,70 @@ var findAutomationNodeConstant = /*#__PURE__*/function () {
|
|
|
7201
7219
|
return _ref15.apply(this, arguments);
|
|
7202
7220
|
};
|
|
7203
7221
|
}();
|
|
7204
|
-
|
|
7205
|
-
|
|
7206
|
-
|
|
7222
|
+
|
|
7223
|
+
/** The action's own declaration from its plugin, e.g. isTargetSource. */
|
|
7224
|
+
var getAutomationActionConstant = /*#__PURE__*/function () {
|
|
7225
|
+
var _ref16 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(actionType) {
|
|
7207
7226
|
return _regeneratorRuntime().wrap(function _callee8$(_context9) {
|
|
7208
7227
|
while (1) switch (_context9.prev = _context9.next) {
|
|
7209
7228
|
case 0:
|
|
7210
7229
|
_context9.next = 2;
|
|
7211
|
-
return findAutomationNodeConstant(
|
|
7230
|
+
return findAutomationNodeConstant(actionType, ['actions']);
|
|
7212
7231
|
case 2:
|
|
7213
|
-
_context9.
|
|
7214
|
-
|
|
7215
|
-
if (_context9.t0) {
|
|
7216
|
-
_context9.next = 6;
|
|
7217
|
-
break;
|
|
7218
|
-
}
|
|
7219
|
-
_context9.t0 = _yield$findAutomation === void 0;
|
|
7220
|
-
case 6:
|
|
7221
|
-
if (!_context9.t0) {
|
|
7222
|
-
_context9.next = 10;
|
|
7223
|
-
break;
|
|
7224
|
-
}
|
|
7225
|
-
_context9.t2 = void 0;
|
|
7226
|
-
_context9.next = 11;
|
|
7227
|
-
break;
|
|
7228
|
-
case 10:
|
|
7229
|
-
_context9.t2 = _yield$findAutomation.output;
|
|
7230
|
-
case 11:
|
|
7231
|
-
return _context9.abrupt("return", _context9.t2);
|
|
7232
|
-
case 12:
|
|
7232
|
+
return _context9.abrupt("return", _context9.sent);
|
|
7233
|
+
case 3:
|
|
7233
7234
|
case "end":
|
|
7234
7235
|
return _context9.stop();
|
|
7235
7236
|
}
|
|
7236
7237
|
}, _callee8);
|
|
7237
7238
|
}));
|
|
7238
|
-
return function
|
|
7239
|
+
return function getAutomationActionConstant(_x0) {
|
|
7239
7240
|
return _ref16.apply(this, arguments);
|
|
7240
7241
|
};
|
|
7241
7242
|
}();
|
|
7242
|
-
|
|
7243
|
-
|
|
7244
|
-
var
|
|
7245
|
-
var _ref17 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(triggerType) {
|
|
7246
|
-
var _yield$findAutomation2;
|
|
7243
|
+
var getAutomationOutputDefinition = /*#__PURE__*/function () {
|
|
7244
|
+
var _ref17 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(nodeType) {
|
|
7245
|
+
var _yield$findAutomation;
|
|
7247
7246
|
return _regeneratorRuntime().wrap(function _callee9$(_context0) {
|
|
7248
7247
|
while (1) switch (_context0.prev = _context0.next) {
|
|
7249
7248
|
case 0:
|
|
7250
|
-
_context0.
|
|
7251
|
-
|
|
7252
|
-
|
|
7253
|
-
|
|
7254
|
-
_context0.
|
|
7255
|
-
|
|
7256
|
-
|
|
7257
|
-
_context0.next = 7;
|
|
7249
|
+
_context0.next = 2;
|
|
7250
|
+
return findAutomationNodeConstant(nodeType, ['triggers', 'actions', 'findObjectTargets']);
|
|
7251
|
+
case 2:
|
|
7252
|
+
_context0.t1 = _yield$findAutomation = _context0.sent;
|
|
7253
|
+
_context0.t0 = _context0.t1 === null;
|
|
7254
|
+
if (_context0.t0) {
|
|
7255
|
+
_context0.next = 6;
|
|
7258
7256
|
break;
|
|
7259
7257
|
}
|
|
7260
|
-
_context0.
|
|
7261
|
-
case
|
|
7262
|
-
if (!_context0.
|
|
7263
|
-
_context0.next =
|
|
7258
|
+
_context0.t0 = _yield$findAutomation === void 0;
|
|
7259
|
+
case 6:
|
|
7260
|
+
if (!_context0.t0) {
|
|
7261
|
+
_context0.next = 10;
|
|
7264
7262
|
break;
|
|
7265
7263
|
}
|
|
7266
|
-
_context0.
|
|
7267
|
-
_context0.next =
|
|
7264
|
+
_context0.t2 = void 0;
|
|
7265
|
+
_context0.next = 11;
|
|
7268
7266
|
break;
|
|
7267
|
+
case 10:
|
|
7268
|
+
_context0.t2 = _yield$findAutomation.output;
|
|
7269
7269
|
case 11:
|
|
7270
|
-
_context0.
|
|
7270
|
+
return _context0.abrupt("return", _context0.t2);
|
|
7271
7271
|
case 12:
|
|
7272
|
-
_context0.t4 = _context0.t3;
|
|
7273
|
-
return _context0.abrupt("return", (0, _context0.t0)(_context0.t4));
|
|
7274
|
-
case 14:
|
|
7275
7272
|
case "end":
|
|
7276
7273
|
return _context0.stop();
|
|
7277
7274
|
}
|
|
7278
7275
|
}, _callee9);
|
|
7279
7276
|
}));
|
|
7280
|
-
return function
|
|
7277
|
+
return function getAutomationOutputDefinition(_x1) {
|
|
7281
7278
|
return _ref17.apply(this, arguments);
|
|
7282
7279
|
};
|
|
7283
7280
|
}();
|
|
7284
7281
|
|
|
7285
|
-
/** Whether the trigger's own plugin
|
|
7286
|
-
var
|
|
7282
|
+
/** Whether the trigger's own plugin lets an automation re-run on every event. */
|
|
7283
|
+
var isReEnrollableTrigger = /*#__PURE__*/function () {
|
|
7287
7284
|
var _ref18 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee0(triggerType) {
|
|
7288
|
-
var _yield$
|
|
7285
|
+
var _yield$findAutomation2;
|
|
7289
7286
|
return _regeneratorRuntime().wrap(function _callee0$(_context1) {
|
|
7290
7287
|
while (1) switch (_context1.prev = _context1.next) {
|
|
7291
7288
|
case 0:
|
|
@@ -7293,13 +7290,13 @@ var isReEnrollingTrigger = /*#__PURE__*/function () {
|
|
|
7293
7290
|
_context1.next = 3;
|
|
7294
7291
|
return findAutomationNodeConstant(triggerType, ['triggers']);
|
|
7295
7292
|
case 3:
|
|
7296
|
-
_context1.t2 = _yield$
|
|
7293
|
+
_context1.t2 = _yield$findAutomation2 = _context1.sent;
|
|
7297
7294
|
_context1.t1 = _context1.t2 === null;
|
|
7298
7295
|
if (_context1.t1) {
|
|
7299
7296
|
_context1.next = 7;
|
|
7300
7297
|
break;
|
|
7301
7298
|
}
|
|
7302
|
-
_context1.t1 = _yield$
|
|
7299
|
+
_context1.t1 = _yield$findAutomation2 === void 0;
|
|
7303
7300
|
case 7:
|
|
7304
7301
|
if (!_context1.t1) {
|
|
7305
7302
|
_context1.next = 11;
|
|
@@ -7309,7 +7306,7 @@ var isReEnrollingTrigger = /*#__PURE__*/function () {
|
|
|
7309
7306
|
_context1.next = 12;
|
|
7310
7307
|
break;
|
|
7311
7308
|
case 11:
|
|
7312
|
-
_context1.t3 = _yield$
|
|
7309
|
+
_context1.t3 = _yield$findAutomation2.reEnrollable;
|
|
7313
7310
|
case 12:
|
|
7314
7311
|
_context1.t4 = _context1.t3;
|
|
7315
7312
|
return _context1.abrupt("return", (0, _context1.t0)(_context1.t4));
|
|
@@ -7319,36 +7316,78 @@ var isReEnrollingTrigger = /*#__PURE__*/function () {
|
|
|
7319
7316
|
}
|
|
7320
7317
|
}, _callee0);
|
|
7321
7318
|
}));
|
|
7322
|
-
return function
|
|
7319
|
+
return function isReEnrollableTrigger(_x10) {
|
|
7323
7320
|
return _ref18.apply(this, arguments);
|
|
7324
7321
|
};
|
|
7325
7322
|
}();
|
|
7326
7323
|
|
|
7324
|
+
/** Whether the trigger's own plugin declared every event a new run. */
|
|
7325
|
+
var isReEnrollingTrigger = /*#__PURE__*/function () {
|
|
7326
|
+
var _ref19 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee1(triggerType) {
|
|
7327
|
+
var _yield$findAutomation3;
|
|
7328
|
+
return _regeneratorRuntime().wrap(function _callee1$(_context10) {
|
|
7329
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
7330
|
+
case 0:
|
|
7331
|
+
_context10.t0 = Boolean;
|
|
7332
|
+
_context10.next = 3;
|
|
7333
|
+
return findAutomationNodeConstant(triggerType, ['triggers']);
|
|
7334
|
+
case 3:
|
|
7335
|
+
_context10.t2 = _yield$findAutomation3 = _context10.sent;
|
|
7336
|
+
_context10.t1 = _context10.t2 === null;
|
|
7337
|
+
if (_context10.t1) {
|
|
7338
|
+
_context10.next = 7;
|
|
7339
|
+
break;
|
|
7340
|
+
}
|
|
7341
|
+
_context10.t1 = _yield$findAutomation3 === void 0;
|
|
7342
|
+
case 7:
|
|
7343
|
+
if (!_context10.t1) {
|
|
7344
|
+
_context10.next = 11;
|
|
7345
|
+
break;
|
|
7346
|
+
}
|
|
7347
|
+
_context10.t3 = void 0;
|
|
7348
|
+
_context10.next = 12;
|
|
7349
|
+
break;
|
|
7350
|
+
case 11:
|
|
7351
|
+
_context10.t3 = _yield$findAutomation3.reEnrollment;
|
|
7352
|
+
case 12:
|
|
7353
|
+
_context10.t4 = _context10.t3;
|
|
7354
|
+
return _context10.abrupt("return", (0, _context10.t0)(_context10.t4));
|
|
7355
|
+
case 14:
|
|
7356
|
+
case "end":
|
|
7357
|
+
return _context10.stop();
|
|
7358
|
+
}
|
|
7359
|
+
}, _callee1);
|
|
7360
|
+
}));
|
|
7361
|
+
return function isReEnrollingTrigger(_x11) {
|
|
7362
|
+
return _ref19.apply(this, arguments);
|
|
7363
|
+
};
|
|
7364
|
+
}();
|
|
7365
|
+
|
|
7327
7366
|
/**
|
|
7328
7367
|
* Fills an action's inputs from the trigger that started the run, through the
|
|
7329
7368
|
* mapping the trigger's own plugin declared. Nothing is returned when the
|
|
7330
7369
|
* trigger declares no mapping for that action.
|
|
7331
7370
|
*/
|
|
7332
7371
|
var resolveAutomationActionInputs = /*#__PURE__*/function () {
|
|
7333
|
-
var
|
|
7372
|
+
var _ref21 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(_ref20) {
|
|
7334
7373
|
var _trigger$actionInputs;
|
|
7335
7374
|
var subdomain, triggerType, actionType, target, trigger, mapping, resolved;
|
|
7336
|
-
return _regeneratorRuntime().wrap(function
|
|
7337
|
-
while (1) switch (
|
|
7375
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context11) {
|
|
7376
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
7338
7377
|
case 0:
|
|
7339
|
-
subdomain =
|
|
7340
|
-
|
|
7378
|
+
subdomain = _ref20.subdomain, triggerType = _ref20.triggerType, actionType = _ref20.actionType, target = _ref20.target;
|
|
7379
|
+
_context11.next = 3;
|
|
7341
7380
|
return findAutomationNodeConstant(triggerType, ['triggers']);
|
|
7342
7381
|
case 3:
|
|
7343
|
-
trigger =
|
|
7382
|
+
trigger = _context11.sent;
|
|
7344
7383
|
mapping = trigger === null || trigger === void 0 || (_trigger$actionInputs = trigger.actionInputs) === null || _trigger$actionInputs === void 0 ? void 0 : _trigger$actionInputs[actionType];
|
|
7345
7384
|
if (!(!mapping || !Object.keys(mapping).length)) {
|
|
7346
|
-
|
|
7385
|
+
_context11.next = 7;
|
|
7347
7386
|
break;
|
|
7348
7387
|
}
|
|
7349
|
-
return
|
|
7388
|
+
return _context11.abrupt("return", undefined);
|
|
7350
7389
|
case 7:
|
|
7351
|
-
|
|
7390
|
+
_context11.next = 9;
|
|
7352
7391
|
return resolveOutputPathsByNodeType({
|
|
7353
7392
|
subdomain: subdomain,
|
|
7354
7393
|
nodeType: triggerType,
|
|
@@ -7356,21 +7395,21 @@ var resolveAutomationActionInputs = /*#__PURE__*/function () {
|
|
|
7356
7395
|
paths: _toConsumableArray(new Set(Object.values(mapping)))
|
|
7357
7396
|
});
|
|
7358
7397
|
case 9:
|
|
7359
|
-
resolved =
|
|
7360
|
-
return
|
|
7361
|
-
var
|
|
7362
|
-
inputKey =
|
|
7363
|
-
outputKey =
|
|
7398
|
+
resolved = _context11.sent;
|
|
7399
|
+
return _context11.abrupt("return", Object.fromEntries(Object.entries(mapping).map(function (_ref22) {
|
|
7400
|
+
var _ref23 = _slicedToArray(_ref22, 2),
|
|
7401
|
+
inputKey = _ref23[0],
|
|
7402
|
+
outputKey = _ref23[1];
|
|
7364
7403
|
return [inputKey, resolved === null || resolved === void 0 ? void 0 : resolved[outputKey]];
|
|
7365
7404
|
})));
|
|
7366
7405
|
case 11:
|
|
7367
7406
|
case "end":
|
|
7368
|
-
return
|
|
7407
|
+
return _context11.stop();
|
|
7369
7408
|
}
|
|
7370
|
-
},
|
|
7409
|
+
}, _callee10);
|
|
7371
7410
|
}));
|
|
7372
|
-
return function resolveAutomationActionInputs(
|
|
7373
|
-
return
|
|
7411
|
+
return function resolveAutomationActionInputs(_x12) {
|
|
7412
|
+
return _ref21.apply(this, arguments);
|
|
7374
7413
|
};
|
|
7375
7414
|
}();
|
|
7376
7415
|
var hasMatchingResolverKey = function hasMatchingResolverKey(definition, paths) {
|
|
@@ -7382,36 +7421,36 @@ var hasMatchingResolverKey = function hasMatchingResolverKey(definition, paths)
|
|
|
7382
7421
|
});
|
|
7383
7422
|
};
|
|
7384
7423
|
var resolveOutputPathsByNodeType = /*#__PURE__*/function () {
|
|
7385
|
-
var
|
|
7424
|
+
var _ref25 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(_ref24) {
|
|
7386
7425
|
var subdomain, nodeType, source, paths, defaultValue, runtimeOutputs, _splitType3, _splitType4, pluginName, runtimeDefinition, definition;
|
|
7387
|
-
return _regeneratorRuntime().wrap(function
|
|
7388
|
-
while (1) switch (
|
|
7426
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context12) {
|
|
7427
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
7389
7428
|
case 0:
|
|
7390
|
-
subdomain =
|
|
7429
|
+
subdomain = _ref24.subdomain, nodeType = _ref24.nodeType, source = _ref24.source, paths = _ref24.paths, defaultValue = _ref24.defaultValue, runtimeOutputs = _ref24.runtimeOutputs;
|
|
7391
7430
|
_splitType3 = splitType(nodeType || ''), _splitType4 = _slicedToArray(_splitType3, 1), pluginName = _splitType4[0];
|
|
7392
7431
|
runtimeDefinition = runtimeOutputs === null || runtimeOutputs === void 0 ? void 0 : runtimeOutputs[nodeType];
|
|
7393
|
-
|
|
7394
|
-
if (
|
|
7395
|
-
|
|
7432
|
+
_context12.t0 = runtimeDefinition;
|
|
7433
|
+
if (_context12.t0) {
|
|
7434
|
+
_context12.next = 8;
|
|
7396
7435
|
break;
|
|
7397
7436
|
}
|
|
7398
|
-
|
|
7437
|
+
_context12.next = 7;
|
|
7399
7438
|
return getAutomationOutputDefinition(nodeType);
|
|
7400
7439
|
case 7:
|
|
7401
|
-
|
|
7440
|
+
_context12.t0 = _context12.sent;
|
|
7402
7441
|
case 8:
|
|
7403
|
-
definition =
|
|
7442
|
+
definition = _context12.t0;
|
|
7404
7443
|
if (definition) {
|
|
7405
|
-
|
|
7444
|
+
_context12.next = 11;
|
|
7406
7445
|
break;
|
|
7407
7446
|
}
|
|
7408
|
-
return
|
|
7447
|
+
return _context12.abrupt("return", resolveDirectOutputValues(source, paths, defaultValue));
|
|
7409
7448
|
case 11:
|
|
7410
7449
|
if (!runtimeDefinition) {
|
|
7411
|
-
|
|
7450
|
+
_context12.next = 13;
|
|
7412
7451
|
break;
|
|
7413
7452
|
}
|
|
7414
|
-
return
|
|
7453
|
+
return _context12.abrupt("return", resolveOutputPathsFromDefinition({
|
|
7415
7454
|
definition: runtimeDefinition,
|
|
7416
7455
|
subdomain: subdomain,
|
|
7417
7456
|
source: source,
|
|
@@ -7420,10 +7459,10 @@ var resolveOutputPathsByNodeType = /*#__PURE__*/function () {
|
|
|
7420
7459
|
}));
|
|
7421
7460
|
case 13:
|
|
7422
7461
|
if (!(pluginName && hasMatchingResolverKey(definition, paths))) {
|
|
7423
|
-
|
|
7462
|
+
_context12.next = 15;
|
|
7424
7463
|
break;
|
|
7425
7464
|
}
|
|
7426
|
-
return
|
|
7465
|
+
return _context12.abrupt("return", sendCoreModuleProducer({
|
|
7427
7466
|
subdomain: subdomain,
|
|
7428
7467
|
moduleName: 'automations',
|
|
7429
7468
|
pluginName: pluginName,
|
|
@@ -7437,7 +7476,7 @@ var resolveOutputPathsByNodeType = /*#__PURE__*/function () {
|
|
|
7437
7476
|
defaultValue: resolveDirectOutputValues(source, paths, defaultValue)
|
|
7438
7477
|
}));
|
|
7439
7478
|
case 15:
|
|
7440
|
-
return
|
|
7479
|
+
return _context12.abrupt("return", resolveOutputPathsFromDefinition({
|
|
7441
7480
|
definition: definition,
|
|
7442
7481
|
subdomain: subdomain,
|
|
7443
7482
|
source: source,
|
|
@@ -7446,32 +7485,32 @@ var resolveOutputPathsByNodeType = /*#__PURE__*/function () {
|
|
|
7446
7485
|
}));
|
|
7447
7486
|
case 16:
|
|
7448
7487
|
case "end":
|
|
7449
|
-
return
|
|
7488
|
+
return _context12.stop();
|
|
7450
7489
|
}
|
|
7451
|
-
},
|
|
7490
|
+
}, _callee11);
|
|
7452
7491
|
}));
|
|
7453
|
-
return function resolveOutputPathsByNodeType(
|
|
7454
|
-
return
|
|
7492
|
+
return function resolveOutputPathsByNodeType(_x13) {
|
|
7493
|
+
return _ref25.apply(this, arguments);
|
|
7455
7494
|
};
|
|
7456
7495
|
}();
|
|
7457
7496
|
var resolveOutputGroups = /*#__PURE__*/function () {
|
|
7458
|
-
var
|
|
7497
|
+
var _ref27 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12(_ref26) {
|
|
7459
7498
|
var subdomain, groups, defaultValue, runtimeOutputs, resolvedByToken, _iterator5, _step5, group, resolvedValues, _i5, _Object$entries2, _Object$entries2$_i, path, value;
|
|
7460
|
-
return _regeneratorRuntime().wrap(function
|
|
7461
|
-
while (1) switch (
|
|
7499
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context13) {
|
|
7500
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
7462
7501
|
case 0:
|
|
7463
|
-
subdomain =
|
|
7502
|
+
subdomain = _ref26.subdomain, groups = _ref26.groups, defaultValue = _ref26.defaultValue, runtimeOutputs = _ref26.runtimeOutputs;
|
|
7464
7503
|
resolvedByToken = {};
|
|
7465
7504
|
_iterator5 = _createForOfIteratorHelper(groups);
|
|
7466
|
-
|
|
7505
|
+
_context13.prev = 3;
|
|
7467
7506
|
_iterator5.s();
|
|
7468
7507
|
case 5:
|
|
7469
7508
|
if ((_step5 = _iterator5.n()).done) {
|
|
7470
|
-
|
|
7509
|
+
_context13.next = 13;
|
|
7471
7510
|
break;
|
|
7472
7511
|
}
|
|
7473
7512
|
group = _step5.value;
|
|
7474
|
-
|
|
7513
|
+
_context13.next = 9;
|
|
7475
7514
|
return resolveOutputPathsByNodeType({
|
|
7476
7515
|
subdomain: subdomain,
|
|
7477
7516
|
nodeType: group.nodeType,
|
|
@@ -7481,44 +7520,44 @@ var resolveOutputGroups = /*#__PURE__*/function () {
|
|
|
7481
7520
|
runtimeOutputs: runtimeOutputs
|
|
7482
7521
|
});
|
|
7483
7522
|
case 9:
|
|
7484
|
-
resolvedValues =
|
|
7523
|
+
resolvedValues = _context13.sent;
|
|
7485
7524
|
for (_i5 = 0, _Object$entries2 = Object.entries(resolvedValues || {}); _i5 < _Object$entries2.length; _i5++) {
|
|
7486
7525
|
_Object$entries2$_i = _slicedToArray(_Object$entries2[_i5], 2), path = _Object$entries2$_i[0], value = _Object$entries2$_i[1];
|
|
7487
7526
|
resolvedByToken["".concat(group.groupKey, ".").concat(path)] = value;
|
|
7488
7527
|
}
|
|
7489
7528
|
case 11:
|
|
7490
|
-
|
|
7529
|
+
_context13.next = 5;
|
|
7491
7530
|
break;
|
|
7492
7531
|
case 13:
|
|
7493
|
-
|
|
7532
|
+
_context13.next = 18;
|
|
7494
7533
|
break;
|
|
7495
7534
|
case 15:
|
|
7496
|
-
|
|
7497
|
-
|
|
7498
|
-
_iterator5.e(
|
|
7535
|
+
_context13.prev = 15;
|
|
7536
|
+
_context13.t0 = _context13["catch"](3);
|
|
7537
|
+
_iterator5.e(_context13.t0);
|
|
7499
7538
|
case 18:
|
|
7500
|
-
|
|
7539
|
+
_context13.prev = 18;
|
|
7501
7540
|
_iterator5.f();
|
|
7502
|
-
return
|
|
7541
|
+
return _context13.finish(18);
|
|
7503
7542
|
case 21:
|
|
7504
|
-
return
|
|
7543
|
+
return _context13.abrupt("return", resolvedByToken);
|
|
7505
7544
|
case 22:
|
|
7506
7545
|
case "end":
|
|
7507
|
-
return
|
|
7546
|
+
return _context13.stop();
|
|
7508
7547
|
}
|
|
7509
|
-
},
|
|
7548
|
+
}, _callee12, null, [[3, 15, 18, 21]]);
|
|
7510
7549
|
}));
|
|
7511
|
-
return function resolveOutputGroups(
|
|
7512
|
-
return
|
|
7550
|
+
return function resolveOutputGroups(_x14) {
|
|
7551
|
+
return _ref27.apply(this, arguments);
|
|
7513
7552
|
};
|
|
7514
7553
|
}();
|
|
7515
7554
|
|
|
7516
7555
|
// {{ token }} -> resolved raw value (object/number/string), or undefined
|
|
7517
7556
|
var resolveCurlyPlaceholderToken = function resolveCurlyPlaceholderToken(token, resolvedByToken) {
|
|
7518
|
-
var
|
|
7557
|
+
var _ref28;
|
|
7519
7558
|
var trimmedToken = token.trim();
|
|
7520
7559
|
var staticValue = resolveStaticOutputPlaceholder(trimmedToken);
|
|
7521
|
-
return (
|
|
7560
|
+
return (_ref28 = staticValue !== null && staticValue !== void 0 ? staticValue : resolvedByToken[trimmedToken]) !== null && _ref28 !== void 0 ? _ref28 : resolvedByToken["trigger.".concat(trimmedToken)];
|
|
7522
7561
|
};
|
|
7523
7562
|
|
|
7524
7563
|
// Replace all {{ }} placeholders in a string.
|
|
@@ -7566,28 +7605,28 @@ var _replaceOutputPlaceholdersInValue = function replaceOutputPlaceholdersInValu
|
|
|
7566
7605
|
});
|
|
7567
7606
|
}
|
|
7568
7607
|
if (value && _typeof(value) === 'object') {
|
|
7569
|
-
return Object.fromEntries(Object.entries(value).map(function (
|
|
7570
|
-
var
|
|
7571
|
-
key =
|
|
7572
|
-
item =
|
|
7608
|
+
return Object.fromEntries(Object.entries(value).map(function (_ref29) {
|
|
7609
|
+
var _ref30 = _slicedToArray(_ref29, 2),
|
|
7610
|
+
key = _ref30[0],
|
|
7611
|
+
item = _ref30[1];
|
|
7573
7612
|
return [key, _replaceOutputPlaceholdersInValue(item, resolvedByToken, defaultValue, keepUnresolvedPlaceholders)];
|
|
7574
7613
|
}));
|
|
7575
7614
|
}
|
|
7576
7615
|
return value;
|
|
7577
7616
|
};
|
|
7578
7617
|
var replaceOutputPlaceholders = /*#__PURE__*/function () {
|
|
7579
|
-
var
|
|
7580
|
-
var subdomain, execution, values, defaultValue, runtimeOutputs,
|
|
7581
|
-
return _regeneratorRuntime().wrap(function
|
|
7582
|
-
while (1) switch (
|
|
7618
|
+
var _ref32 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(_ref31) {
|
|
7619
|
+
var subdomain, execution, values, defaultValue, runtimeOutputs, _ref31$keepUnresolved, keepUnresolvedPlaceholders, tokensByValueKey, resolvedByToken;
|
|
7620
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context14) {
|
|
7621
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
7583
7622
|
case 0:
|
|
7584
|
-
subdomain =
|
|
7623
|
+
subdomain = _ref31.subdomain, execution = _ref31.execution, values = _ref31.values, defaultValue = _ref31.defaultValue, runtimeOutputs = _ref31.runtimeOutputs, _ref31$keepUnresolved = _ref31.keepUnresolvedPlaceholders, keepUnresolvedPlaceholders = _ref31$keepUnresolved === void 0 ? true : _ref31$keepUnresolved;
|
|
7585
7624
|
tokensByValueKey = getOutputPlaceholderTokensByValueKey(values);
|
|
7586
7625
|
if (!Object.keys(tokensByValueKey).length) {
|
|
7587
|
-
|
|
7626
|
+
_context14.next = 8;
|
|
7588
7627
|
break;
|
|
7589
7628
|
}
|
|
7590
|
-
|
|
7629
|
+
_context14.next = 5;
|
|
7591
7630
|
return resolveOutputGroups({
|
|
7592
7631
|
subdomain: subdomain,
|
|
7593
7632
|
groups: buildOutputResolveGroups({
|
|
@@ -7598,34 +7637,34 @@ var replaceOutputPlaceholders = /*#__PURE__*/function () {
|
|
|
7598
7637
|
runtimeOutputs: runtimeOutputs
|
|
7599
7638
|
});
|
|
7600
7639
|
case 5:
|
|
7601
|
-
|
|
7602
|
-
|
|
7640
|
+
_context14.t0 = _context14.sent;
|
|
7641
|
+
_context14.next = 9;
|
|
7603
7642
|
break;
|
|
7604
7643
|
case 8:
|
|
7605
|
-
|
|
7644
|
+
_context14.t0 = {};
|
|
7606
7645
|
case 9:
|
|
7607
|
-
resolvedByToken =
|
|
7608
|
-
return
|
|
7609
|
-
var
|
|
7610
|
-
key =
|
|
7611
|
-
value =
|
|
7646
|
+
resolvedByToken = _context14.t0;
|
|
7647
|
+
return _context14.abrupt("return", Object.entries(values).reduce(function (acc, _ref33) {
|
|
7648
|
+
var _ref34 = _slicedToArray(_ref33, 2),
|
|
7649
|
+
key = _ref34[0],
|
|
7650
|
+
value = _ref34[1];
|
|
7612
7651
|
acc[key] = _replaceOutputPlaceholdersInValue(value, resolvedByToken, defaultValue, keepUnresolvedPlaceholders);
|
|
7613
7652
|
return acc;
|
|
7614
7653
|
}, {}));
|
|
7615
7654
|
case 11:
|
|
7616
7655
|
case "end":
|
|
7617
|
-
return
|
|
7656
|
+
return _context14.stop();
|
|
7618
7657
|
}
|
|
7619
|
-
},
|
|
7658
|
+
}, _callee13);
|
|
7620
7659
|
}));
|
|
7621
|
-
return function replaceOutputPlaceholders(
|
|
7622
|
-
return
|
|
7660
|
+
return function replaceOutputPlaceholders(_x15) {
|
|
7661
|
+
return _ref32.apply(this, arguments);
|
|
7623
7662
|
};
|
|
7624
7663
|
}();
|
|
7625
|
-
var getAutomationNodeType = function getAutomationNodeType(
|
|
7626
|
-
var pluginName =
|
|
7627
|
-
node =
|
|
7628
|
-
kind =
|
|
7664
|
+
var getAutomationNodeType = function getAutomationNodeType(_ref35) {
|
|
7665
|
+
var pluginName = _ref35.pluginName,
|
|
7666
|
+
node = _ref35.node,
|
|
7667
|
+
kind = _ref35.kind;
|
|
7629
7668
|
if (node.type) {
|
|
7630
7669
|
return node.type;
|
|
7631
7670
|
}
|
|
@@ -8660,17 +8699,34 @@ var getAutomationBaseType = function getAutomationBaseType(type) {
|
|
|
8660
8699
|
var normalizedCollectionName = collectionName && collectionName.endsWith('s') ? collectionName : pluralFormation(collectionName || '');
|
|
8661
8700
|
return collectionName ? "".concat(pluginName, ":").concat(moduleName, ".").concat(normalizedCollectionName) : "".concat(pluginName, ":").concat(moduleName);
|
|
8662
8701
|
};
|
|
8702
|
+
|
|
8703
|
+
// The record an earlier action produced or found: Create returns targetId,
|
|
8704
|
+
// Find object returns objectId and the object itself.
|
|
8705
|
+
var getTargetActionRecord = function getTargetActionRecord(execution, targetActionId) {
|
|
8706
|
+
var _find, _ref23, _result$objectId;
|
|
8707
|
+
var result = (_find = (execution.actions || []).find(function (_ref22) {
|
|
8708
|
+
var actionId = _ref22.actionId;
|
|
8709
|
+
return actionId === targetActionId;
|
|
8710
|
+
})) === null || _find === void 0 ? void 0 : _find.result;
|
|
8711
|
+
var object = result !== null && result !== void 0 && result.object && _typeof(result.object) === 'object' ? result.object : {};
|
|
8712
|
+
var id = (_ref23 = (_result$objectId = result === null || result === void 0 ? void 0 : result.objectId) !== null && _result$objectId !== void 0 ? _result$objectId : result === null || result === void 0 ? void 0 : result.targetId) !== null && _ref23 !== void 0 ? _ref23 : object._id;
|
|
8713
|
+
return {
|
|
8714
|
+
id: id == null ? '' : String(id),
|
|
8715
|
+
object: object
|
|
8716
|
+
};
|
|
8717
|
+
};
|
|
8663
8718
|
var getSetPropertySelector = /*#__PURE__*/function () {
|
|
8664
|
-
var
|
|
8665
|
-
var subdomain, module, execution, targetType, relation, targetPath, target, targetId, _getValueByPath, found, value, rawValue, ids,
|
|
8719
|
+
var _ref25 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee0(_ref24) {
|
|
8720
|
+
var subdomain, module, execution, targetType, relation, targetPath, targetActionId, actionRecord, target, targetId, _getValueByPath, found, value, rawValue, ids, _ref26, contentType, relatedContentType, relationIds;
|
|
8666
8721
|
return _regeneratorRuntime().wrap(function _callee0$(_context0) {
|
|
8667
8722
|
while (1) switch (_context0.prev = _context0.next) {
|
|
8668
8723
|
case 0:
|
|
8669
|
-
subdomain =
|
|
8670
|
-
|
|
8671
|
-
|
|
8724
|
+
subdomain = _ref24.subdomain, module = _ref24.module, execution = _ref24.execution, targetType = _ref24.targetType, relation = _ref24.relation, targetPath = _ref24.targetPath, targetActionId = _ref24.targetActionId;
|
|
8725
|
+
actionRecord = targetActionId ? getTargetActionRecord(execution, targetActionId) : undefined;
|
|
8726
|
+
target = actionRecord ? actionRecord.object : execution.target || {};
|
|
8727
|
+
targetId = actionRecord ? actionRecord.id : String(execution.targetId || target._id || '');
|
|
8672
8728
|
if (!targetPath) {
|
|
8673
|
-
_context0.next =
|
|
8729
|
+
_context0.next = 9;
|
|
8674
8730
|
break;
|
|
8675
8731
|
}
|
|
8676
8732
|
_getValueByPath = getValueByPath(target, targetPath), found = _getValueByPath.found, value = _getValueByPath.value;
|
|
@@ -8683,9 +8739,9 @@ var getSetPropertySelector = /*#__PURE__*/function () {
|
|
|
8683
8739
|
$in: Array.from(new Set(ids))
|
|
8684
8740
|
}
|
|
8685
8741
|
});
|
|
8686
|
-
case
|
|
8742
|
+
case 9:
|
|
8687
8743
|
if (targetId) {
|
|
8688
|
-
_context0.next =
|
|
8744
|
+
_context0.next = 11;
|
|
8689
8745
|
break;
|
|
8690
8746
|
}
|
|
8691
8747
|
return _context0.abrupt("return", {
|
|
@@ -8693,18 +8749,18 @@ var getSetPropertySelector = /*#__PURE__*/function () {
|
|
|
8693
8749
|
$in: []
|
|
8694
8750
|
}
|
|
8695
8751
|
});
|
|
8696
|
-
case
|
|
8752
|
+
case 11:
|
|
8697
8753
|
if (!(!relation && getAutomationBaseType(module) === getAutomationBaseType(targetType))) {
|
|
8698
|
-
_context0.next =
|
|
8754
|
+
_context0.next = 13;
|
|
8699
8755
|
break;
|
|
8700
8756
|
}
|
|
8701
8757
|
return _context0.abrupt("return", {
|
|
8702
8758
|
_id: targetId
|
|
8703
8759
|
});
|
|
8704
|
-
case
|
|
8705
|
-
|
|
8760
|
+
case 13:
|
|
8761
|
+
_ref26 = relation || {}, contentType = _ref26.contentType, relatedContentType = _ref26.relatedContentType;
|
|
8706
8762
|
if (!(!contentType || !relatedContentType)) {
|
|
8707
|
-
_context0.next =
|
|
8763
|
+
_context0.next = 16;
|
|
8708
8764
|
break;
|
|
8709
8765
|
}
|
|
8710
8766
|
return _context0.abrupt("return", {
|
|
@@ -8712,8 +8768,8 @@ var getSetPropertySelector = /*#__PURE__*/function () {
|
|
|
8712
8768
|
$in: []
|
|
8713
8769
|
}
|
|
8714
8770
|
});
|
|
8715
|
-
case
|
|
8716
|
-
_context0.next =
|
|
8771
|
+
case 16:
|
|
8772
|
+
_context0.next = 18;
|
|
8717
8773
|
return sendTRPCMessage({
|
|
8718
8774
|
subdomain: subdomain,
|
|
8719
8775
|
pluginName: 'core',
|
|
@@ -8726,30 +8782,30 @@ var getSetPropertySelector = /*#__PURE__*/function () {
|
|
|
8726
8782
|
},
|
|
8727
8783
|
defaultValue: []
|
|
8728
8784
|
});
|
|
8729
|
-
case
|
|
8785
|
+
case 18:
|
|
8730
8786
|
relationIds = _context0.sent;
|
|
8731
8787
|
return _context0.abrupt("return", {
|
|
8732
8788
|
_id: {
|
|
8733
8789
|
$in: Array.from(new Set((relationIds || []).filter(Boolean)))
|
|
8734
8790
|
}
|
|
8735
8791
|
});
|
|
8736
|
-
case
|
|
8792
|
+
case 20:
|
|
8737
8793
|
case "end":
|
|
8738
8794
|
return _context0.stop();
|
|
8739
8795
|
}
|
|
8740
8796
|
}, _callee0);
|
|
8741
8797
|
}));
|
|
8742
8798
|
return function getSetPropertySelector(_x0) {
|
|
8743
|
-
return
|
|
8799
|
+
return _ref25.apply(this, arguments);
|
|
8744
8800
|
};
|
|
8745
8801
|
}();
|
|
8746
8802
|
var setProperty = /*#__PURE__*/function () {
|
|
8747
|
-
var
|
|
8748
|
-
var subdomain, module, rules, execution, setPropertyTarget,
|
|
8803
|
+
var _ref28 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee1(_ref27) {
|
|
8804
|
+
var subdomain, module, rules, execution, setPropertyTarget, _ref27$relatedItems, relatedItems, selector, fetchItems, update, updateRecord, needsCurrentValue, baseSelector, _yield$buildSetProper, modifier, _changes, updateResult, count, items, _yield$buildSetProper2, _changes2, updatedCount, changes, _iterator4, _step4, relatedItem, ruleUpdate, _modifier, itemSelector, _updateResult, itemCount;
|
|
8749
8805
|
return _regeneratorRuntime().wrap(function _callee1$(_context1) {
|
|
8750
8806
|
while (1) switch (_context1.prev = _context1.next) {
|
|
8751
8807
|
case 0:
|
|
8752
|
-
subdomain =
|
|
8808
|
+
subdomain = _ref27.subdomain, module = _ref27.module, rules = _ref27.rules, execution = _ref27.execution, setPropertyTarget = _ref27.setPropertyTarget, _ref27$relatedItems = _ref27.relatedItems, relatedItems = _ref27$relatedItems === void 0 ? [] : _ref27$relatedItems, selector = _ref27.selector, fetchItems = _ref27.fetchItems, update = _ref27.update;
|
|
8753
8809
|
updateRecord = getSetPropertyUpdate({
|
|
8754
8810
|
subdomain: subdomain,
|
|
8755
8811
|
module: module,
|
|
@@ -8918,7 +8974,7 @@ var setProperty = /*#__PURE__*/function () {
|
|
|
8918
8974
|
}, _callee1, null, [[12, 20], [40, 69, 72, 75], [52, 61]]);
|
|
8919
8975
|
}));
|
|
8920
8976
|
return function setProperty(_x1) {
|
|
8921
|
-
return
|
|
8977
|
+
return _ref28.apply(this, arguments);
|
|
8922
8978
|
};
|
|
8923
8979
|
}();
|
|
8924
8980
|
var getContentType = function getContentType(type) {
|
|
@@ -11157,6 +11213,7 @@ var segmentJoinChanges = /*#__PURE__*/function () {
|
|
|
11157
11213
|
};
|
|
11158
11214
|
}();
|
|
11159
11215
|
|
|
11216
|
+
var EMAIL_SCREEN_REASONS = ['syntax', 'no_mx', 'disposable', 'random'];
|
|
11160
11217
|
var EMAIL_LANES = ['proven', 'unknown', 'suppressed'];
|
|
11161
11218
|
var emailAddressSchema = new mongoose.Schema({
|
|
11162
11219
|
email: {
|
|
@@ -11188,6 +11245,10 @@ var emailAddressSchema = new mongoose.Schema({
|
|
|
11188
11245
|
type: String,
|
|
11189
11246
|
"enum": ['hard_bounce', 'complaint', 'unsubscribe', 'screened', 'manual']
|
|
11190
11247
|
},
|
|
11248
|
+
screenReason: {
|
|
11249
|
+
type: String,
|
|
11250
|
+
"enum": EMAIL_SCREEN_REASONS
|
|
11251
|
+
},
|
|
11191
11252
|
suppressedBy: {
|
|
11192
11253
|
type: String
|
|
11193
11254
|
},
|
|
@@ -11555,6 +11616,10 @@ var notifcationEventSchema = new mongoose.Schema({
|
|
|
11555
11616
|
channels: {
|
|
11556
11617
|
type: [String],
|
|
11557
11618
|
"default": []
|
|
11619
|
+
},
|
|
11620
|
+
mutedChannels: {
|
|
11621
|
+
type: [String],
|
|
11622
|
+
"default": []
|
|
11558
11623
|
}
|
|
11559
11624
|
}, {
|
|
11560
11625
|
_id: false
|
|
@@ -11810,19 +11875,19 @@ var sendNotification = /*#__PURE__*/function () {
|
|
|
11810
11875
|
var sendNotificationChannels = /*#__PURE__*/function () {
|
|
11811
11876
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(subdomain, notification) {
|
|
11812
11877
|
var _recipientIds$email;
|
|
11813
|
-
var _ref3, eventName, userIds, contentType, fromUserId, _contentType$split, _contentType$split2, _contentType$split2$, pluginName, _contentType$split2$2, moduleName, userNotificationSettings, recipientIds, _iterator, _step,
|
|
11814
|
-
return _regeneratorRuntime().wrap(function _callee2$(
|
|
11815
|
-
while (1) switch (
|
|
11878
|
+
var _ref3, eventName, userIds, contentType, contentTypeId, fromUserId, title, message, _contentType$split, _contentType$split2, _contentType$split2$, pluginName, _contentType$split2$2, moduleName, userNotificationSettings, recipientIds, _iterator, _step, _loop, _ret;
|
|
11879
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context3) {
|
|
11880
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
11816
11881
|
case 0:
|
|
11817
|
-
_ref3 = notification || {}, eventName = _ref3.notificationType, userIds = _ref3.userIds, contentType = _ref3.contentType, fromUserId = _ref3.fromUserId;
|
|
11882
|
+
_ref3 = notification || {}, eventName = _ref3.notificationType, userIds = _ref3.userIds, contentType = _ref3.contentType, contentTypeId = _ref3.contentTypeId, fromUserId = _ref3.fromUserId, title = _ref3.title, message = _ref3.message;
|
|
11818
11883
|
if (contentType) {
|
|
11819
|
-
|
|
11884
|
+
_context3.next = 3;
|
|
11820
11885
|
break;
|
|
11821
11886
|
}
|
|
11822
|
-
return
|
|
11887
|
+
return _context3.abrupt("return");
|
|
11823
11888
|
case 3:
|
|
11824
11889
|
_contentType$split = contentType.split(':'), _contentType$split2 = _slicedToArray(_contentType$split, 2), _contentType$split2$ = _contentType$split2[0], pluginName = _contentType$split2$ === void 0 ? '' : _contentType$split2$, _contentType$split2$2 = _contentType$split2[1], moduleName = _contentType$split2$2 === void 0 ? '' : _contentType$split2$2;
|
|
11825
|
-
|
|
11890
|
+
_context3.next = 6;
|
|
11826
11891
|
return sendTRPCMessage({
|
|
11827
11892
|
subdomain: subdomain,
|
|
11828
11893
|
pluginName: 'core',
|
|
@@ -11835,88 +11900,141 @@ var sendNotificationChannels = /*#__PURE__*/function () {
|
|
|
11835
11900
|
defaultValue: []
|
|
11836
11901
|
});
|
|
11837
11902
|
case 6:
|
|
11838
|
-
userNotificationSettings =
|
|
11903
|
+
userNotificationSettings = _context3.sent;
|
|
11839
11904
|
recipientIds = {
|
|
11840
|
-
email: []
|
|
11905
|
+
email: [],
|
|
11906
|
+
mobile: []
|
|
11841
11907
|
};
|
|
11842
11908
|
_iterator = _createForOfIteratorHelper(userNotificationSettings);
|
|
11843
|
-
|
|
11909
|
+
_context3.prev = 9;
|
|
11910
|
+
_loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop() {
|
|
11911
|
+
var _events$pluginName, _events, _events$pluginName2;
|
|
11912
|
+
var userNotificationSetting, _ref4, userId, events, eventSetting, mutedChannels, channels;
|
|
11913
|
+
return _regeneratorRuntime().wrap(function _loop$(_context2) {
|
|
11914
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
11915
|
+
case 0:
|
|
11916
|
+
userNotificationSetting = _step.value;
|
|
11917
|
+
_ref4 = userNotificationSetting || {}, userId = _ref4.userId, events = _ref4.events;
|
|
11918
|
+
if (!(fromUserId && userId === fromUserId)) {
|
|
11919
|
+
_context2.next = 4;
|
|
11920
|
+
break;
|
|
11921
|
+
}
|
|
11922
|
+
return _context2.abrupt("return", 0);
|
|
11923
|
+
case 4:
|
|
11924
|
+
if (userIds.includes(userId)) {
|
|
11925
|
+
_context2.next = 6;
|
|
11926
|
+
break;
|
|
11927
|
+
}
|
|
11928
|
+
return _context2.abrupt("return", 0);
|
|
11929
|
+
case 6:
|
|
11930
|
+
if (events !== null && events !== void 0 && (_events$pluginName = events[pluginName]) !== null && _events$pluginName !== void 0 && _events$pluginName.enabled) {
|
|
11931
|
+
_context2.next = 8;
|
|
11932
|
+
break;
|
|
11933
|
+
}
|
|
11934
|
+
return _context2.abrupt("return", 0);
|
|
11935
|
+
case 8:
|
|
11936
|
+
if (events !== null && events !== void 0 && (_events = events["".concat(pluginName, ":").concat(moduleName)]) !== null && _events !== void 0 && _events.enabled) {
|
|
11937
|
+
_context2.next = 10;
|
|
11938
|
+
break;
|
|
11939
|
+
}
|
|
11940
|
+
return _context2.abrupt("return", 0);
|
|
11941
|
+
case 10:
|
|
11942
|
+
eventSetting = events === null || events === void 0 ? void 0 : events["".concat(pluginName, ":").concat(moduleName, ":").concat(eventName)];
|
|
11943
|
+
if (eventSetting !== null && eventSetting !== void 0 && eventSetting.enabled) {
|
|
11944
|
+
_context2.next = 13;
|
|
11945
|
+
break;
|
|
11946
|
+
}
|
|
11947
|
+
return _context2.abrupt("return", 0);
|
|
11948
|
+
case 13:
|
|
11949
|
+
mutedChannels = eventSetting.mutedChannels || [];
|
|
11950
|
+
channels = ((events === null || events === void 0 || (_events$pluginName2 = events[pluginName]) === null || _events$pluginName2 === void 0 ? void 0 : _events$pluginName2.channels) || []).filter(function (channel) {
|
|
11951
|
+
return !mutedChannels.includes(channel);
|
|
11952
|
+
});
|
|
11953
|
+
if (channels.length) {
|
|
11954
|
+
_context2.next = 17;
|
|
11955
|
+
break;
|
|
11956
|
+
}
|
|
11957
|
+
return _context2.abrupt("return", 0);
|
|
11958
|
+
case 17:
|
|
11959
|
+
if (channels.includes('email')) {
|
|
11960
|
+
recipientIds['email'].push(userId);
|
|
11961
|
+
}
|
|
11962
|
+
if (channels.includes('mobile')) {
|
|
11963
|
+
recipientIds['mobile'].push(userId);
|
|
11964
|
+
}
|
|
11965
|
+
case 19:
|
|
11966
|
+
case "end":
|
|
11967
|
+
return _context2.stop();
|
|
11968
|
+
}
|
|
11969
|
+
}, _loop);
|
|
11970
|
+
});
|
|
11844
11971
|
_iterator.s();
|
|
11845
|
-
case
|
|
11972
|
+
case 12:
|
|
11846
11973
|
if ((_step = _iterator.n()).done) {
|
|
11847
|
-
|
|
11848
|
-
break;
|
|
11849
|
-
}
|
|
11850
|
-
userNotificationSetting = _step.value;
|
|
11851
|
-
_ref4 = userNotificationSetting || {}, userId = _ref4.userId, events = _ref4.events;
|
|
11852
|
-
if (!(fromUserId && userId === fromUserId)) {
|
|
11853
|
-
_context2.next = 16;
|
|
11854
|
-
break;
|
|
11855
|
-
}
|
|
11856
|
-
return _context2.abrupt("continue", 28);
|
|
11857
|
-
case 16:
|
|
11858
|
-
if (userIds.includes(userId)) {
|
|
11859
|
-
_context2.next = 18;
|
|
11860
|
-
break;
|
|
11861
|
-
}
|
|
11862
|
-
return _context2.abrupt("continue", 28);
|
|
11863
|
-
case 18:
|
|
11864
|
-
if (events !== null && events !== void 0 && (_events$pluginName = events[pluginName]) !== null && _events$pluginName !== void 0 && _events$pluginName.enabled) {
|
|
11865
|
-
_context2.next = 20;
|
|
11866
|
-
break;
|
|
11867
|
-
}
|
|
11868
|
-
return _context2.abrupt("continue", 28);
|
|
11869
|
-
case 20:
|
|
11870
|
-
if (events !== null && events !== void 0 && (_events = events["".concat(pluginName, ":").concat(moduleName)]) !== null && _events !== void 0 && _events.enabled) {
|
|
11871
|
-
_context2.next = 22;
|
|
11974
|
+
_context3.next = 19;
|
|
11872
11975
|
break;
|
|
11873
11976
|
}
|
|
11874
|
-
return
|
|
11875
|
-
case
|
|
11876
|
-
|
|
11877
|
-
|
|
11977
|
+
return _context3.delegateYield(_loop(), "t0", 14);
|
|
11978
|
+
case 14:
|
|
11979
|
+
_ret = _context3.t0;
|
|
11980
|
+
if (!(_ret === 0)) {
|
|
11981
|
+
_context3.next = 17;
|
|
11878
11982
|
break;
|
|
11879
11983
|
}
|
|
11880
|
-
return
|
|
11984
|
+
return _context3.abrupt("continue", 17);
|
|
11985
|
+
case 17:
|
|
11986
|
+
_context3.next = 12;
|
|
11987
|
+
break;
|
|
11988
|
+
case 19:
|
|
11989
|
+
_context3.next = 24;
|
|
11990
|
+
break;
|
|
11991
|
+
case 21:
|
|
11992
|
+
_context3.prev = 21;
|
|
11993
|
+
_context3.t1 = _context3["catch"](9);
|
|
11994
|
+
_iterator.e(_context3.t1);
|
|
11881
11995
|
case 24:
|
|
11882
|
-
|
|
11883
|
-
|
|
11884
|
-
|
|
11885
|
-
break;
|
|
11886
|
-
}
|
|
11887
|
-
return _context2.abrupt("continue", 28);
|
|
11996
|
+
_context3.prev = 24;
|
|
11997
|
+
_iterator.f();
|
|
11998
|
+
return _context3.finish(24);
|
|
11888
11999
|
case 27:
|
|
11889
|
-
if (
|
|
11890
|
-
|
|
12000
|
+
if (!recipientIds['mobile'].length) {
|
|
12001
|
+
_context3.next = 30;
|
|
12002
|
+
break;
|
|
11891
12003
|
}
|
|
11892
|
-
|
|
11893
|
-
|
|
11894
|
-
|
|
12004
|
+
_context3.next = 30;
|
|
12005
|
+
return sendTRPCMessage({
|
|
12006
|
+
subdomain: subdomain,
|
|
12007
|
+
pluginName: 'core',
|
|
12008
|
+
method: 'mutation',
|
|
12009
|
+
module: 'notifications',
|
|
12010
|
+
action: 'sendMobileNotification',
|
|
12011
|
+
input: {
|
|
12012
|
+
receivers: recipientIds['mobile'],
|
|
12013
|
+
title: title,
|
|
12014
|
+
body: message,
|
|
12015
|
+
// FCM data values must be strings
|
|
12016
|
+
data: {
|
|
12017
|
+
contentType: contentType,
|
|
12018
|
+
contentTypeId: String(contentTypeId !== null && contentTypeId !== void 0 ? contentTypeId : ''),
|
|
12019
|
+
notificationType: eventName !== null && eventName !== void 0 ? eventName : ''
|
|
12020
|
+
}
|
|
12021
|
+
},
|
|
12022
|
+
defaultValue: null
|
|
12023
|
+
});
|
|
11895
12024
|
case 30:
|
|
11896
|
-
_context2.next = 35;
|
|
11897
|
-
break;
|
|
11898
|
-
case 32:
|
|
11899
|
-
_context2.prev = 32;
|
|
11900
|
-
_context2.t0 = _context2["catch"](9);
|
|
11901
|
-
_iterator.e(_context2.t0);
|
|
11902
|
-
case 35:
|
|
11903
|
-
_context2.prev = 35;
|
|
11904
|
-
_iterator.f();
|
|
11905
|
-
return _context2.finish(35);
|
|
11906
|
-
case 38:
|
|
11907
12025
|
if (!((_recipientIds$email = recipientIds['email']) !== null && _recipientIds$email !== void 0 && _recipientIds$email.length)) {
|
|
11908
|
-
|
|
12026
|
+
_context3.next = 33;
|
|
11909
12027
|
break;
|
|
11910
12028
|
}
|
|
11911
|
-
|
|
12029
|
+
_context3.next = 33;
|
|
11912
12030
|
return sendNotificationEmail(subdomain, _objectSpread2(_objectSpread2({}, notification), {}, {
|
|
11913
12031
|
userIds: recipientIds['email']
|
|
11914
12032
|
}));
|
|
11915
|
-
case
|
|
12033
|
+
case 33:
|
|
11916
12034
|
case "end":
|
|
11917
|
-
return
|
|
12035
|
+
return _context3.stop();
|
|
11918
12036
|
}
|
|
11919
|
-
}, _callee2, null, [[9,
|
|
12037
|
+
}, _callee2, null, [[9, 21, 24, 27]]);
|
|
11920
12038
|
}));
|
|
11921
12039
|
return function sendNotificationChannels(_x3, _x4) {
|
|
11922
12040
|
return _ref2.apply(this, arguments);
|
|
@@ -23135,8 +23253,10 @@ exports.APPROVAL_NOTIFICATION_ACTIONS = APPROVAL_NOTIFICATION_ACTIONS;
|
|
|
23135
23253
|
exports.APPROVAL_NOTIFICATION_CONTENT_TYPE = APPROVAL_NOTIFICATION_CONTENT_TYPE;
|
|
23136
23254
|
exports.APPROVAL_REQUEST_KINDS = APPROVAL_REQUEST_KINDS;
|
|
23137
23255
|
exports.APPROVAL_REQUEST_STATUSES = APPROVAL_REQUEST_STATUSES;
|
|
23256
|
+
exports.AUTOMATION_ACTION_CONTRIBUTIONS = AUTOMATION_ACTION_CONTRIBUTIONS;
|
|
23138
23257
|
exports.AUTOMATION_CORE_ACTIONS = AUTOMATION_CORE_ACTIONS;
|
|
23139
23258
|
exports.AUTOMATION_CORE_ACTION_DEFERRED = AUTOMATION_CORE_ACTION_DEFERRED;
|
|
23259
|
+
exports.AUTOMATION_CORE_ACTION_PLACEMENTS = AUTOMATION_CORE_ACTION_PLACEMENTS;
|
|
23140
23260
|
exports.AUTOMATION_CORE_TRIGGER_TYPES = AUTOMATION_CORE_TRIGGER_TYPES;
|
|
23141
23261
|
exports.AUTOMATION_DEFERRED_TIMEOUT = AUTOMATION_DEFERRED_TIMEOUT;
|
|
23142
23262
|
exports.AUTOMATION_EMAIL_RECIPIENTS_TYPES = AUTOMATION_EMAIL_RECIPIENTS_TYPES;
|
|
@@ -23170,6 +23290,7 @@ exports.DEFAULT_SEX_CHOICES = DEFAULT_SEX_CHOICES;
|
|
|
23170
23290
|
exports.DEFAULT_SOCIAL_LINKS = DEFAULT_SOCIAL_LINKS;
|
|
23171
23291
|
exports.EMAIL_LANES = EMAIL_LANES;
|
|
23172
23292
|
exports.EMAIL_RAMP_ID = EMAIL_RAMP_ID;
|
|
23293
|
+
exports.EMAIL_SCREEN_REASONS = EMAIL_SCREEN_REASONS;
|
|
23173
23294
|
exports.EXECUTE_WAIT_TYPES = EXECUTE_WAIT_TYPES;
|
|
23174
23295
|
exports.EXPECTED_ERROR_NAME = EXPECTED_ERROR_NAME;
|
|
23175
23296
|
exports.EvaluateFieldsInput = EvaluateFieldsInput;
|
|
@@ -23360,6 +23481,7 @@ exports.generateEventHandlersFromRequest = generateEventHandlersFromRequest;
|
|
|
23360
23481
|
exports.generateRequestProcess = generateRequestProcess;
|
|
23361
23482
|
exports.getActivePlugins = getActivePlugins;
|
|
23362
23483
|
exports.getAgentToolMaxResponseBytes = getAgentToolMaxResponseBytes;
|
|
23484
|
+
exports.getAutomationActionConstant = getAutomationActionConstant;
|
|
23363
23485
|
exports.getAutomationNodeType = getAutomationNodeType;
|
|
23364
23486
|
exports.getAvailablePlugins = getAvailablePlugins;
|
|
23365
23487
|
exports.getContentType = getContentType;
|