@player-ui/async-node-plugin 1.1.0-next.1 → 1.1.0-next.3
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.
|
@@ -4674,6 +4674,12 @@ var AsyncNodePlugin = function() {
|
|
|
4674
4674
|
this.shadowModelPaths = removeBindingAndChildrenFromMap(this.shadowModelPaths, binding);
|
|
4675
4675
|
return next === null || next === void 0 ? void 0 : next.delete(binding, options);
|
|
4676
4676
|
}
|
|
4677
|
+
},
|
|
4678
|
+
{
|
|
4679
|
+
/** Clears any invalid values staged in the shadow model */ key: "reset",
|
|
4680
|
+
value: function reset() {
|
|
4681
|
+
this.shadowModelPaths.clear();
|
|
4682
|
+
}
|
|
4677
4683
|
}
|
|
4678
4684
|
]);
|
|
4679
4685
|
return ValidationMiddleware;
|
|
@@ -5540,6 +5546,47 @@ var AsyncNodePlugin = function() {
|
|
|
5540
5546
|
/** Return the middleware for the data-model to stop propagation of invalid data */ key: "getDataMiddleware",
|
|
5541
5547
|
value: function getDataMiddleware() {
|
|
5542
5548
|
var _this = this;
|
|
5549
|
+
var validationMiddleware = new ValidationMiddleware(function(binding) {
|
|
5550
|
+
var _strongValidation_get;
|
|
5551
|
+
if (!_this.options) {
|
|
5552
|
+
return;
|
|
5553
|
+
}
|
|
5554
|
+
_this.updateValidationsForBinding(binding, "change", _this.options);
|
|
5555
|
+
var strongValidation = _this.getValidationForBinding(binding);
|
|
5556
|
+
if ((strongValidation === null || strongValidation === void 0 ? void 0 : (_strongValidation_get = strongValidation.get()) === null || _strongValidation_get === void 0 ? void 0 : _strongValidation_get.severity) === "error") {
|
|
5557
|
+
return strongValidation.get();
|
|
5558
|
+
}
|
|
5559
|
+
var newInvalidBindings = /* @__PURE__ */ new Set();
|
|
5560
|
+
_this.validations.forEach(function(weakValidation, strongBinding) {
|
|
5561
|
+
var _weakValidation_get;
|
|
5562
|
+
if (caresAboutDataChanges(/* @__PURE__ */ new Set([
|
|
5563
|
+
binding
|
|
5564
|
+
]), weakValidation.weakBindings) && (weakValidation === null || weakValidation === void 0 ? void 0 : (_weakValidation_get = weakValidation.get()) === null || _weakValidation_get === void 0 ? void 0 : _weakValidation_get.severity) === "error") {
|
|
5565
|
+
weakValidation === null || weakValidation === void 0 ? void 0 : weakValidation.weakBindings.forEach(function(weakBinding) {
|
|
5566
|
+
if (weakBinding === strongBinding) {
|
|
5567
|
+
newInvalidBindings.add({
|
|
5568
|
+
binding: weakBinding,
|
|
5569
|
+
isStrong: true
|
|
5570
|
+
});
|
|
5571
|
+
} else {
|
|
5572
|
+
newInvalidBindings.add({
|
|
5573
|
+
binding: weakBinding,
|
|
5574
|
+
isStrong: false
|
|
5575
|
+
});
|
|
5576
|
+
}
|
|
5577
|
+
});
|
|
5578
|
+
}
|
|
5579
|
+
});
|
|
5580
|
+
if (newInvalidBindings.size > 0) {
|
|
5581
|
+
return newInvalidBindings;
|
|
5582
|
+
}
|
|
5583
|
+
}, {
|
|
5584
|
+
logger: new ProxyLogger(function() {
|
|
5585
|
+
var _this_options;
|
|
5586
|
+
return (_this_options = _this.options) === null || _this_options === void 0 ? void 0 : _this_options.logger;
|
|
5587
|
+
})
|
|
5588
|
+
});
|
|
5589
|
+
this.validationMiddleware = validationMiddleware;
|
|
5543
5590
|
return [
|
|
5544
5591
|
{
|
|
5545
5592
|
set: function(transaction, options, next) {
|
|
@@ -5554,46 +5601,7 @@ var AsyncNodePlugin = function() {
|
|
|
5554
5601
|
return next === null || next === void 0 ? void 0 : next.delete(binding, options);
|
|
5555
5602
|
}
|
|
5556
5603
|
},
|
|
5557
|
-
|
|
5558
|
-
var _strongValidation_get;
|
|
5559
|
-
if (!_this.options) {
|
|
5560
|
-
return;
|
|
5561
|
-
}
|
|
5562
|
-
_this.updateValidationsForBinding(binding, "change", _this.options);
|
|
5563
|
-
var strongValidation = _this.getValidationForBinding(binding);
|
|
5564
|
-
if ((strongValidation === null || strongValidation === void 0 ? void 0 : (_strongValidation_get = strongValidation.get()) === null || _strongValidation_get === void 0 ? void 0 : _strongValidation_get.severity) === "error") {
|
|
5565
|
-
return strongValidation.get();
|
|
5566
|
-
}
|
|
5567
|
-
var newInvalidBindings = /* @__PURE__ */ new Set();
|
|
5568
|
-
_this.validations.forEach(function(weakValidation, strongBinding) {
|
|
5569
|
-
var _weakValidation_get;
|
|
5570
|
-
if (caresAboutDataChanges(/* @__PURE__ */ new Set([
|
|
5571
|
-
binding
|
|
5572
|
-
]), weakValidation.weakBindings) && (weakValidation === null || weakValidation === void 0 ? void 0 : (_weakValidation_get = weakValidation.get()) === null || _weakValidation_get === void 0 ? void 0 : _weakValidation_get.severity) === "error") {
|
|
5573
|
-
weakValidation === null || weakValidation === void 0 ? void 0 : weakValidation.weakBindings.forEach(function(weakBinding) {
|
|
5574
|
-
if (weakBinding === strongBinding) {
|
|
5575
|
-
newInvalidBindings.add({
|
|
5576
|
-
binding: weakBinding,
|
|
5577
|
-
isStrong: true
|
|
5578
|
-
});
|
|
5579
|
-
} else {
|
|
5580
|
-
newInvalidBindings.add({
|
|
5581
|
-
binding: weakBinding,
|
|
5582
|
-
isStrong: false
|
|
5583
|
-
});
|
|
5584
|
-
}
|
|
5585
|
-
});
|
|
5586
|
-
}
|
|
5587
|
-
});
|
|
5588
|
-
if (newInvalidBindings.size > 0) {
|
|
5589
|
-
return newInvalidBindings;
|
|
5590
|
-
}
|
|
5591
|
-
}, {
|
|
5592
|
-
logger: new ProxyLogger(function() {
|
|
5593
|
-
var _this_options;
|
|
5594
|
-
return (_this_options = _this.options) === null || _this_options === void 0 ? void 0 : _this_options.logger;
|
|
5595
|
-
})
|
|
5596
|
-
})
|
|
5604
|
+
validationMiddleware
|
|
5597
5605
|
];
|
|
5598
5606
|
}
|
|
5599
5607
|
},
|
|
@@ -5629,15 +5637,17 @@ var AsyncNodePlugin = function() {
|
|
|
5629
5637
|
{
|
|
5630
5638
|
key: "reset",
|
|
5631
5639
|
value: function reset() {
|
|
5640
|
+
var _this_validationMiddleware;
|
|
5632
5641
|
this.validations.clear();
|
|
5633
5642
|
this.tracker = void 0;
|
|
5643
|
+
(_this_validationMiddleware = this.validationMiddleware) === null || _this_validationMiddleware === void 0 ? void 0 : _this_validationMiddleware.reset();
|
|
5634
5644
|
}
|
|
5635
5645
|
},
|
|
5636
5646
|
{
|
|
5637
5647
|
key: "onView",
|
|
5638
5648
|
value: function onView(view) {
|
|
5639
5649
|
var _this = this;
|
|
5640
|
-
this.
|
|
5650
|
+
this.reset();
|
|
5641
5651
|
if (!this.options) {
|
|
5642
5652
|
return;
|
|
5643
5653
|
}
|
|
@@ -8062,8 +8072,8 @@ var AsyncNodePlugin = function() {
|
|
|
8062
8072
|
ref: Symbol("not-started"),
|
|
8063
8073
|
status: "not-started"
|
|
8064
8074
|
};
|
|
8065
|
-
var PLAYER_VERSION = true ? "1.1.0-next.
|
|
8066
|
-
var COMMIT = true ? "
|
|
8075
|
+
var PLAYER_VERSION = true ? "1.1.0-next.3" : "unknown";
|
|
8076
|
+
var COMMIT = true ? "234b74972b29ff0fa11655411dc3cd9d8a98de2a" : "unknown";
|
|
8067
8077
|
var _Player = /*#__PURE__*/ function() {
|
|
8068
8078
|
function _Player2(config) {
|
|
8069
8079
|
var _this = this;
|
|
@@ -8085,7 +8095,8 @@ var AsyncNodePlugin = function() {
|
|
|
8085
8095
|
state: new SyncHook(),
|
|
8086
8096
|
onStart: new SyncHook(),
|
|
8087
8097
|
onEnd: new SyncHook(),
|
|
8088
|
-
resolveFlowContent: new SyncWaterfallHook()
|
|
8098
|
+
resolveFlowContent: new SyncWaterfallHook(),
|
|
8099
|
+
transformContent: new SyncBailHook()
|
|
8089
8100
|
};
|
|
8090
8101
|
if (config === null || config === void 0 ? void 0 : config.logger) {
|
|
8091
8102
|
this.logger.addHandler(config.logger);
|
|
@@ -8099,6 +8110,9 @@ var AsyncNodePlugin = function() {
|
|
|
8099
8110
|
(_this_config_plugins = this.config.plugins) === null || _this_config_plugins === void 0 ? void 0 : _this_config_plugins.forEach(function(plugin) {
|
|
8100
8111
|
plugin.apply(_this);
|
|
8101
8112
|
});
|
|
8113
|
+
this.hooks.transformContent.tap("player", function(payload, meta) {
|
|
8114
|
+
return meta.format === "player" ? payload : void 0;
|
|
8115
|
+
});
|
|
8102
8116
|
}
|
|
8103
8117
|
_create_class(_Player2, [
|
|
8104
8118
|
{
|
|
@@ -8405,14 +8419,22 @@ var AsyncNodePlugin = function() {
|
|
|
8405
8419
|
},
|
|
8406
8420
|
{
|
|
8407
8421
|
key: "start",
|
|
8408
|
-
value: function start(payload) {
|
|
8422
|
+
value: function start(payload, options) {
|
|
8409
8423
|
return _async_to_generator(function() {
|
|
8410
|
-
var _this,
|
|
8424
|
+
var _this, _options_format, meta, flow, _flow_id, ref, maybeUpdateState, _this_setupFlow, state, start, endProps, _tmp, error, errorState;
|
|
8411
8425
|
return _ts_generator(this, function(_state) {
|
|
8412
8426
|
switch(_state.label){
|
|
8413
8427
|
case 0:
|
|
8414
8428
|
_this = this;
|
|
8415
|
-
|
|
8429
|
+
meta = {
|
|
8430
|
+
format: (_options_format = options === null || options === void 0 ? void 0 : options.format) !== null && _options_format !== void 0 ? _options_format : "player",
|
|
8431
|
+
version: options === null || options === void 0 ? void 0 : options.version
|
|
8432
|
+
};
|
|
8433
|
+
flow = this.hooks.transformContent.call(payload, meta);
|
|
8434
|
+
if (!flow) {
|
|
8435
|
+
throw new Error('Player.start received content with format "'.concat(meta.format, '" that no plugin transformed into a Flow.'));
|
|
8436
|
+
}
|
|
8437
|
+
ref = Symbol((_flow_id = flow.id) !== null && _flow_id !== void 0 ? _flow_id : "payload");
|
|
8416
8438
|
maybeUpdateState = function(newState) {
|
|
8417
8439
|
if (_this.state.ref !== ref) {
|
|
8418
8440
|
_this.logger.warn("Received update for a flow that's not the current one");
|
|
@@ -8433,7 +8455,7 @@ var AsyncNodePlugin = function() {
|
|
|
8433
8455
|
,
|
|
8434
8456
|
4
|
|
8435
8457
|
]);
|
|
8436
|
-
_this_setupFlow = this.setupFlow(
|
|
8458
|
+
_this_setupFlow = this.setupFlow(flow), state = _this_setupFlow.state, start = _this_setupFlow.start;
|
|
8437
8459
|
this.setState(_object_spread({
|
|
8438
8460
|
ref: ref
|
|
8439
8461
|
}, state));
|
|
@@ -8468,7 +8490,7 @@ var AsyncNodePlugin = function() {
|
|
|
8468
8490
|
errorState = {
|
|
8469
8491
|
status: "error",
|
|
8470
8492
|
ref: ref,
|
|
8471
|
-
flow:
|
|
8493
|
+
flow: flow,
|
|
8472
8494
|
error: error
|
|
8473
8495
|
};
|
|
8474
8496
|
maybeUpdateState(errorState);
|