@player-ui/computed-properties-plugin 0.15.3 → 0.15.4--canary.881.37421
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/package.json
CHANGED
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
"types"
|
|
7
7
|
],
|
|
8
8
|
"name": "@player-ui/computed-properties-plugin",
|
|
9
|
-
"version": "0.15.
|
|
9
|
+
"version": "0.15.4--canary.881.37421",
|
|
10
10
|
"main": "dist/cjs/index.cjs",
|
|
11
11
|
"peerDependencies": {
|
|
12
|
-
"@player-ui/player": "0.15.
|
|
12
|
+
"@player-ui/player": "0.15.4--canary.881.37421"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
15
|
"@player-ui/asset-transform-plugin": "workspace:^",
|
|
@@ -20,7 +20,6 @@
|
|
|
20
20
|
},
|
|
21
21
|
"module": "dist/index.legacy-esm.js",
|
|
22
22
|
"types": "types/index.d.ts",
|
|
23
|
-
"bundle": "dist/ComputedPropertiesPlugin.native.js",
|
|
24
23
|
"exports": {
|
|
25
24
|
"./package.json": "./package.json",
|
|
26
25
|
"./dist/index.css": "./dist/index.css",
|
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
function _array_like_to_array(arr, len) {
|
|
3
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
4
|
-
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
5
|
-
return arr2;
|
|
6
|
-
}
|
|
7
|
-
function _array_without_holes(arr) {
|
|
8
|
-
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
9
|
-
}
|
|
10
|
-
function _class_call_check(instance, Constructor) {
|
|
11
|
-
if (!(instance instanceof Constructor)) {
|
|
12
|
-
throw new TypeError("Cannot call a class as a function");
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
function _defineProperties(target, props) {
|
|
16
|
-
for(var i = 0; i < props.length; i++){
|
|
17
|
-
var descriptor = props[i];
|
|
18
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
19
|
-
descriptor.configurable = true;
|
|
20
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
21
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
function _create_class(Constructor, protoProps, staticProps) {
|
|
25
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
26
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
27
|
-
return Constructor;
|
|
28
|
-
}
|
|
29
|
-
function _iterable_to_array(iter) {
|
|
30
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
31
|
-
}
|
|
32
|
-
function _non_iterable_spread() {
|
|
33
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
34
|
-
}
|
|
35
|
-
function _to_consumable_array(arr) {
|
|
36
|
-
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
37
|
-
}
|
|
38
|
-
function _type_of(obj) {
|
|
39
|
-
"@swc/helpers - typeof";
|
|
40
|
-
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
41
|
-
}
|
|
42
|
-
function _unsupported_iterable_to_array(o, minLen) {
|
|
43
|
-
if (!o) return;
|
|
44
|
-
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
45
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
46
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
47
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
48
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
49
|
-
}
|
|
50
|
-
var ComputedPropertiesPlugin = function() {
|
|
51
|
-
var __defProp = Object.defineProperty;
|
|
52
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
53
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
54
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
55
|
-
var __export = function __export(target, all) {
|
|
56
|
-
for(var name in all)__defProp(target, name, {
|
|
57
|
-
get: all[name],
|
|
58
|
-
enumerable: true
|
|
59
|
-
});
|
|
60
|
-
};
|
|
61
|
-
var __copyProps = function __copyProps(to, from, except, desc) {
|
|
62
|
-
if (from && (typeof from === "undefined" ? "undefined" : _type_of(from)) === "object" || typeof from === "function") {
|
|
63
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
64
|
-
try {
|
|
65
|
-
var _loop = function() {
|
|
66
|
-
var key = _step.value;
|
|
67
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
68
|
-
get: function get() {
|
|
69
|
-
return from[key];
|
|
70
|
-
},
|
|
71
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
72
|
-
});
|
|
73
|
-
};
|
|
74
|
-
for(var _iterator = __getOwnPropNames(from)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true)_loop();
|
|
75
|
-
} catch (err) {
|
|
76
|
-
_didIteratorError = true;
|
|
77
|
-
_iteratorError = err;
|
|
78
|
-
} finally{
|
|
79
|
-
try {
|
|
80
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
81
|
-
_iterator.return();
|
|
82
|
-
}
|
|
83
|
-
} finally{
|
|
84
|
-
if (_didIteratorError) {
|
|
85
|
-
throw _iteratorError;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
return to;
|
|
91
|
-
};
|
|
92
|
-
var __toCommonJS = function __toCommonJS(mod) {
|
|
93
|
-
return __copyProps(__defProp({}, "__esModule", {
|
|
94
|
-
value: true
|
|
95
|
-
}), mod);
|
|
96
|
-
};
|
|
97
|
-
// ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/computed-properties/core/src/index.ts
|
|
98
|
-
var src_exports = {};
|
|
99
|
-
__export(src_exports, {
|
|
100
|
-
ComputedPropertiesPlugin: function ComputedPropertiesPlugin1() {
|
|
101
|
-
return ComputedPropertiesPlugin;
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
var ComputedPropertiesPlugin = /*#__PURE__*/ function() {
|
|
105
|
-
function ComputedPropertiesPlugin() {
|
|
106
|
-
_class_call_check(this, ComputedPropertiesPlugin);
|
|
107
|
-
this.name = "ComputedProperties";
|
|
108
|
-
}
|
|
109
|
-
_create_class(ComputedPropertiesPlugin, [
|
|
110
|
-
{
|
|
111
|
-
key: "apply",
|
|
112
|
-
value: function apply(player) {
|
|
113
|
-
var _this = this;
|
|
114
|
-
var schemaController;
|
|
115
|
-
var expressionEvaluator;
|
|
116
|
-
var getExpressionType = function getExpressionType(binding) {
|
|
117
|
-
var dataType = schemaController === null || schemaController === void 0 ? void 0 : schemaController.getType(binding);
|
|
118
|
-
if ((dataType === null || dataType === void 0 ? void 0 : dataType.type) === "Expression") {
|
|
119
|
-
return dataType;
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
var computedPropertyMiddleware = {
|
|
123
|
-
name: this.name,
|
|
124
|
-
get: function get(binding, options, next) {
|
|
125
|
-
var expType = getExpressionType(binding);
|
|
126
|
-
if (expType) {
|
|
127
|
-
var exp = expType.exp;
|
|
128
|
-
var result = exp && (expressionEvaluator === null || expressionEvaluator === void 0 ? void 0 : expressionEvaluator.evaluate(exp, options === null || options === void 0 ? void 0 : options.context));
|
|
129
|
-
return result !== null && result !== void 0 ? result : expType.default;
|
|
130
|
-
}
|
|
131
|
-
return next === null || next === void 0 ? void 0 : next.get(binding, options);
|
|
132
|
-
},
|
|
133
|
-
set: function set(transaction, options, next) {
|
|
134
|
-
var _ref;
|
|
135
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
136
|
-
try {
|
|
137
|
-
for(var _iterator = transaction[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
138
|
-
var setOperation = _step.value;
|
|
139
|
-
if (getExpressionType(setOperation[0])) {
|
|
140
|
-
throw new Error("Invalid 'set' operation on computed property: ".concat(setOperation[0].asString()));
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
} catch (err) {
|
|
144
|
-
_didIteratorError = true;
|
|
145
|
-
_iteratorError = err;
|
|
146
|
-
} finally{
|
|
147
|
-
try {
|
|
148
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
149
|
-
_iterator.return();
|
|
150
|
-
}
|
|
151
|
-
} finally{
|
|
152
|
-
if (_didIteratorError) {
|
|
153
|
-
throw _iteratorError;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
return (_ref = next === null || next === void 0 ? void 0 : next.set(transaction, options)) !== null && _ref !== void 0 ? _ref : [];
|
|
158
|
-
},
|
|
159
|
-
delete: function _delete(binding, options, next) {
|
|
160
|
-
if (getExpressionType(binding)) {
|
|
161
|
-
throw new Error("Invalid 'delete' operation on computed property: ".concat(binding.asString()));
|
|
162
|
-
}
|
|
163
|
-
return next === null || next === void 0 ? void 0 : next.delete(binding, options);
|
|
164
|
-
}
|
|
165
|
-
};
|
|
166
|
-
player.hooks.dataController.tap(this.name, function(dataController) {
|
|
167
|
-
dataController.hooks.resolveDataStages.tap(_this.name, function(dataPipeline) {
|
|
168
|
-
return _to_consumable_array(dataPipeline).concat([
|
|
169
|
-
computedPropertyMiddleware
|
|
170
|
-
]);
|
|
171
|
-
});
|
|
172
|
-
});
|
|
173
|
-
player.hooks.schema.tap(this.name, function(schema) {
|
|
174
|
-
schemaController = schema;
|
|
175
|
-
});
|
|
176
|
-
player.hooks.expressionEvaluator.tap(this.name, function(evaluator) {
|
|
177
|
-
expressionEvaluator = evaluator;
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
]);
|
|
182
|
-
return ComputedPropertiesPlugin;
|
|
183
|
-
}();
|
|
184
|
-
return __toCommonJS(src_exports);
|
|
185
|
-
}();
|
|
186
|
-
//# sourceMappingURL=index.global.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2532/execroot/_main/bazel-out/k8-fastbuild/bin/plugins/computed-properties/core/dist/index.global.js","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/computed-properties/core/src/index.ts"],"names":["ComputedPropertiesPlugin","__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toCommonJS","mod","value","src_exports","apply","player","schemaController","expressionEvaluator","getExpressionType","binding","dataType","getType","type","computedPropertyMiddleware","options","next","expType","exp","result","evaluate","context","default","set","transaction","setOperation","Error","asString","delete","hooks","dataController","tap","resolveDataStages","dataPipeline","schema","evaluator"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAIA,2BAA2B,AAAC;IAC9B,IAAIC,YAAYC,OAAOC,cAAc;IACrC,IAAIC,mBAAmBF,OAAOG,wBAAwB;IACtD,IAAIC,oBAAoBJ,OAAOK,mBAAmB;IAClD,IAAIC,eAAeN,OAAOO,SAAS,CAACC,cAAc;IAClD,IAAIC,WAAW,kBAACC,QAAQC;QACtB,IAAK,IAAIC,QAAQD,IACfZ,UAAUW,QAAQE,MAAM;YAAEC,KAAKF,GAAG,CAACC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rD;oBACF;oBAEAR,OAAOuB,KAAA,CAAMK,MAAA,CAAOH,GAAA,CAAI,IAAA,CAAKxC,IAAA,EAAM,SAAC2C;wBAClC3B,mBAAmB2B;oBACrB;oBAEA5B,OAAOuB,KAAA,CAAMrB,mBAAA,CAAoBuB,GAAA,CAAI,IAAA,CAAKxC,IAAA,EAAM,SAAC4C;wBAC/C3B,sBAAsB2B;oBACxB;gBACF;;;;;IDZA,OAAOlC,aAAaG;AACtB","sourcesContent":["\"use strict\";\nvar ComputedPropertiesPlugin = (() => {\n var __defProp = Object.defineProperty;\n var __getOwnPropDesc = Object.getOwnPropertyDescriptor;\n var __getOwnPropNames = Object.getOwnPropertyNames;\n var __hasOwnProp = Object.prototype.hasOwnProperty;\n var __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n };\n var __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n };\n var __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\n\n // ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/computed-properties/core/src/index.ts\n var src_exports = {};\n __export(src_exports, {\n ComputedPropertiesPlugin: () => ComputedPropertiesPlugin\n });\n var ComputedPropertiesPlugin = class {\n constructor() {\n this.name = \"ComputedProperties\";\n }\n apply(player) {\n let schemaController;\n let expressionEvaluator;\n const getExpressionType = (binding) => {\n const dataType = schemaController?.getType(binding);\n if (dataType?.type === \"Expression\") {\n return dataType;\n }\n };\n const computedPropertyMiddleware = {\n name: this.name,\n get(binding, options, next) {\n const expType = getExpressionType(binding);\n if (expType) {\n const { exp } = expType;\n const result = exp && expressionEvaluator?.evaluate(exp, options?.context);\n return result ?? expType.default;\n }\n return next?.get(binding, options);\n },\n set(transaction, options, next) {\n for (const setOperation of transaction) {\n if (getExpressionType(setOperation[0])) {\n throw new Error(\n `Invalid 'set' operation on computed property: ${setOperation[0].asString()}`\n );\n }\n }\n return next?.set(transaction, options) ?? [];\n },\n delete(binding, options, next) {\n if (getExpressionType(binding)) {\n throw new Error(\n `Invalid 'delete' operation on computed property: ${binding.asString()}`\n );\n }\n return next?.delete(binding, options);\n }\n };\n player.hooks.dataController.tap(this.name, (dataController) => {\n dataController.hooks.resolveDataStages.tap(this.name, (dataPipeline) => {\n return [...dataPipeline, computedPropertyMiddleware];\n });\n });\n player.hooks.schema.tap(this.name, (schema) => {\n schemaController = schema;\n });\n player.hooks.expressionEvaluator.tap(this.name, (evaluator) => {\n expressionEvaluator = evaluator;\n });\n }\n };\n return __toCommonJS(src_exports);\n})();\n","import type {\n Player,\n PlayerPlugin,\n ExpressionEvaluator,\n Schema,\n Expression,\n DataModelMiddleware,\n Updates,\n SchemaController,\n BindingInstance,\n} from \"@player-ui/player\";\n\nexport interface ExpressionDataType extends Schema.DataType<\"Expression\"> {\n /** The expression to evaluate to compute the value of this node */\n exp?: Expression;\n}\n\n/**\n * A player plugin to manage beacon events.\n * It automatically keeps track of the current user's view, and adds additional metaData to each beacon event.\n */\nexport class ComputedPropertiesPlugin implements PlayerPlugin {\n name = \"ComputedProperties\";\n\n apply(player: Player) {\n // Inject a middleware into the data-model to intercept any calls to an expression type in the schema\n // Calls to `set` throw an error. Calls to `get` compute the value and return if or default\n\n let schemaController: SchemaController | undefined;\n let expressionEvaluator: ExpressionEvaluator | undefined;\n\n /** Look up the data-type of the binding, and check for an Expression type */\n const getExpressionType = (\n binding: BindingInstance,\n ): ExpressionDataType | undefined => {\n // Check to see if the data-type of the binding is an `Expression`\n const dataType = schemaController?.getType(binding);\n\n if (dataType?.type === \"Expression\") {\n return dataType as ExpressionDataType;\n }\n };\n\n const computedPropertyMiddleware: DataModelMiddleware = {\n name: this.name,\n get(binding, options, next) {\n const expType = getExpressionType(binding);\n\n if (expType) {\n const { exp } = expType;\n const result =\n exp && expressionEvaluator?.evaluate(exp, options?.context);\n\n return result ?? expType.default;\n }\n\n return next?.get(binding, options);\n },\n set(transaction, options, next): Updates {\n for (const setOperation of transaction) {\n if (getExpressionType(setOperation[0])) {\n throw new Error(\n `Invalid 'set' operation on computed property: ${setOperation[0].asString()}`,\n );\n }\n }\n\n return next?.set(transaction, options) ?? [];\n },\n delete(binding, options, next) {\n if (getExpressionType(binding)) {\n throw new Error(\n `Invalid 'delete' operation on computed property: ${binding.asString()}`,\n );\n }\n\n return next?.delete(binding, options);\n },\n };\n\n player.hooks.dataController.tap(this.name, (dataController) => {\n dataController.hooks.resolveDataStages.tap(this.name, (dataPipeline) => {\n return [...dataPipeline, computedPropertyMiddleware];\n });\n });\n\n player.hooks.schema.tap(this.name, (schema) => {\n schemaController = schema;\n });\n\n player.hooks.expressionEvaluator.tap(this.name, (evaluator) => {\n expressionEvaluator = evaluator;\n });\n }\n}\n"]}
|