@nocobase/plugin-flow-engine 2.0.0-alpha.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/LICENSE +661 -0
- package/README.md +29 -0
- package/build.config.ts +22 -0
- package/client.d.ts +2 -0
- package/client.js +1 -0
- package/dist/client/index.d.ts +15 -0
- package/dist/client/index.js +10 -0
- package/dist/externalVersion.js +21 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +48 -0
- package/dist/locale/en-US.json +61 -0
- package/dist/locale/index.d.ts +141 -0
- package/dist/locale/index.js +79 -0
- package/dist/locale/zh-CN.json +61 -0
- package/dist/node_modules/ses/LICENSE +201 -0
- package/dist/node_modules/ses/LICENSE-aura +16 -0
- package/dist/node_modules/ses/LICENSE-caja +13 -0
- package/dist/node_modules/ses/LICENSE-corejs +19 -0
- package/dist/node_modules/ses/LICENSE-v8 +9 -0
- package/dist/node_modules/ses/assert-shim.js +1 -0
- package/dist/node_modules/ses/compartment-shim.js +1 -0
- package/dist/node_modules/ses/console-shim.js +1 -0
- package/dist/node_modules/ses/dist/lockdown.cjs +13912 -0
- package/dist/node_modules/ses/dist/lockdown.umd.js +13912 -0
- package/dist/node_modules/ses/dist/lockdown.umd.min.js +1 -0
- package/dist/node_modules/ses/dist/ses-hermes.cjs +13912 -0
- package/dist/node_modules/ses/dist/ses.cjs +1 -0
- package/dist/node_modules/ses/dist/ses.umd.js +13912 -0
- package/dist/node_modules/ses/dist/ses.umd.min.js +1 -0
- package/dist/node_modules/ses/dist/types.d.cts +606 -0
- package/dist/node_modules/ses/index.js +18 -0
- package/dist/node_modules/ses/lockdown-shim.js +1 -0
- package/dist/node_modules/ses/lockdown.js +1 -0
- package/dist/node_modules/ses/package.json +1 -0
- package/dist/node_modules/ses/src/assert-shim.js +4 -0
- package/dist/node_modules/ses/src/assert-sloppy-mode.js +11 -0
- package/dist/node_modules/ses/src/cauterize-property.js +69 -0
- package/dist/node_modules/ses/src/commons.js +425 -0
- package/dist/node_modules/ses/src/compartment-evaluate.js +93 -0
- package/dist/node_modules/ses/src/compartment-shim.js +22 -0
- package/dist/node_modules/ses/src/compartment.js +477 -0
- package/dist/node_modules/ses/src/console-shim.js +50 -0
- package/dist/node_modules/ses/src/enable-property-overrides.js +211 -0
- package/dist/node_modules/ses/src/enablements.js +244 -0
- package/dist/node_modules/ses/src/error/assert.js +584 -0
- package/dist/node_modules/ses/src/error/console.js +541 -0
- package/dist/node_modules/ses/src/error/fatal-assert.js +54 -0
- package/dist/node_modules/ses/src/error/internal-types.js +98 -0
- package/dist/node_modules/ses/src/error/note-log-args.js +77 -0
- package/dist/node_modules/ses/src/error/stringify-utils.js +195 -0
- package/dist/node_modules/ses/src/error/tame-console.js +197 -0
- package/dist/node_modules/ses/src/error/tame-error-constructor.js +284 -0
- package/dist/node_modules/ses/src/error/tame-v8-error-constructor.js +386 -0
- package/dist/node_modules/ses/src/error/types.js +59 -0
- package/dist/node_modules/ses/src/error/unhandled-rejection.js +122 -0
- package/dist/node_modules/ses/src/eval-scope.js +89 -0
- package/dist/node_modules/ses/src/get-anonymous-intrinsics.js +181 -0
- package/dist/node_modules/ses/src/get-source-url.js +50 -0
- package/dist/node_modules/ses/src/global-object.js +175 -0
- package/dist/node_modules/ses/src/intrinsics.js +192 -0
- package/dist/node_modules/ses/src/lockdown-shim.js +37 -0
- package/dist/node_modules/ses/src/lockdown.js +558 -0
- package/dist/node_modules/ses/src/make-eval-function.js +28 -0
- package/dist/node_modules/ses/src/make-evaluate.js +110 -0
- package/dist/node_modules/ses/src/make-function-constructor.js +79 -0
- package/dist/node_modules/ses/src/make-hardener.js +275 -0
- package/dist/node_modules/ses/src/make-safe-evaluator.js +112 -0
- package/dist/node_modules/ses/src/module-instance.js +497 -0
- package/dist/node_modules/ses/src/module-link.js +159 -0
- package/dist/node_modules/ses/src/module-load.js +719 -0
- package/dist/node_modules/ses/src/module-proxy.js +200 -0
- package/dist/node_modules/ses/src/permits-intrinsics.js +291 -0
- package/dist/node_modules/ses/src/permits.js +1761 -0
- package/dist/node_modules/ses/src/reporting-types.d.ts +13 -0
- package/dist/node_modules/ses/src/reporting.js +105 -0
- package/dist/node_modules/ses/src/scope-constants.js +180 -0
- package/dist/node_modules/ses/src/shim-arraybuffer-transfer.js +85 -0
- package/dist/node_modules/ses/src/sloppy-globals-scope-terminator.js +61 -0
- package/dist/node_modules/ses/src/strict-scope-terminator.js +99 -0
- package/dist/node_modules/ses/src/tame-date-constructor.js +127 -0
- package/dist/node_modules/ses/src/tame-domains.js +41 -0
- package/dist/node_modules/ses/src/tame-faux-data-properties.js +210 -0
- package/dist/node_modules/ses/src/tame-function-constructors.js +140 -0
- package/dist/node_modules/ses/src/tame-function-tostring.js +50 -0
- package/dist/node_modules/ses/src/tame-harden.js +29 -0
- package/dist/node_modules/ses/src/tame-locale-methods.js +78 -0
- package/dist/node_modules/ses/src/tame-math-object.js +41 -0
- package/dist/node_modules/ses/src/tame-module-source.js +51 -0
- package/dist/node_modules/ses/src/tame-regenerator-runtime.js +29 -0
- package/dist/node_modules/ses/src/tame-regexp-constructor.js +65 -0
- package/dist/node_modules/ses/src/tame-symbol-constructor.js +64 -0
- package/dist/node_modules/ses/src/transforms.js +267 -0
- package/dist/node_modules/ses/tools.js +25 -0
- package/dist/node_modules/ses/types.d.ts +606 -0
- package/dist/server/actions/ui-schema-action.d.ts +27 -0
- package/dist/server/actions/ui-schema-action.js +118 -0
- package/dist/server/collections/flowModelTreePath.d.ts +11 -0
- package/dist/server/collections/flowModelTreePath.js +74 -0
- package/dist/server/collections/flowModels.d.ts +11 -0
- package/dist/server/collections/flowModels.js +57 -0
- package/dist/server/collections/flowsql.d.ts +10 -0
- package/dist/server/collections/flowsql.js +51 -0
- package/dist/server/dao/ui_schema_node_dao.d.ts +26 -0
- package/dist/server/dao/ui_schema_node_dao.js +24 -0
- package/dist/server/helper.d.ts +8 -0
- package/dist/server/helper.js +9 -0
- package/dist/server/index.d.ts +9 -0
- package/dist/server/index.js +42 -0
- package/dist/server/model.d.ts +12 -0
- package/dist/server/model.js +38 -0
- package/dist/server/plugin.d.ts +26 -0
- package/dist/server/plugin.js +270 -0
- package/dist/server/repository.d.ts +116 -0
- package/dist/server/repository.js +1209 -0
- package/dist/server/server.d.ts +16 -0
- package/dist/server/server.js +198 -0
- package/dist/server/template/contexts.d.ts +73 -0
- package/dist/server/template/contexts.js +233 -0
- package/dist/server/template/resolver.d.ts +30 -0
- package/dist/server/template/resolver.js +225 -0
- package/dist/server/variables/registry.d.ts +42 -0
- package/dist/server/variables/registry.js +299 -0
- package/package.json +28 -0
- package/server.d.ts +2 -0
- package/server.js +1 -0
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
// Adapted from SES/Caja
|
|
2
|
+
// Copyright (C) 2011 Google Inc.
|
|
3
|
+
|
|
4
|
+
// @ts-check
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
Set,
|
|
8
|
+
String,
|
|
9
|
+
TypeError,
|
|
10
|
+
arrayForEach,
|
|
11
|
+
defineProperty,
|
|
12
|
+
getOwnPropertyDescriptor,
|
|
13
|
+
getOwnPropertyDescriptors,
|
|
14
|
+
isPrimitive,
|
|
15
|
+
hasOwn,
|
|
16
|
+
ownKeys,
|
|
17
|
+
setHas,
|
|
18
|
+
} from './commons.js';
|
|
19
|
+
|
|
20
|
+
import {
|
|
21
|
+
minEnablements,
|
|
22
|
+
moderateEnablements,
|
|
23
|
+
severeEnablements,
|
|
24
|
+
} from './enablements.js';
|
|
25
|
+
|
|
26
|
+
/** @import {Reporter} from './reporting-types.js' */
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* For a special set of properties defined in the `enablement` list,
|
|
30
|
+
* `enablePropertyOverrides` ensures that the effect of freezing does not
|
|
31
|
+
* suppress the ability to override these properties on derived objects by
|
|
32
|
+
* simple assignment.
|
|
33
|
+
*
|
|
34
|
+
* Because of lack of sufficient foresight at the time, ES5 unfortunately
|
|
35
|
+
* specified that a simple assignment to a non-existent property must fail if
|
|
36
|
+
* it would override an non-writable data property of the same name in the
|
|
37
|
+
* shadow of the prototype chain. In retrospect, this was a mistake, the
|
|
38
|
+
* so-called "override mistake". But it is now too late and we must live with
|
|
39
|
+
* the consequences.
|
|
40
|
+
*
|
|
41
|
+
* As a result, simply freezing an object to make it tamper proof has the
|
|
42
|
+
* unfortunate side effect of breaking previously correct code that is
|
|
43
|
+
* considered to have followed JS best practices, if this previous code used
|
|
44
|
+
* assignment to override.
|
|
45
|
+
*
|
|
46
|
+
* For the enabled properties, `enablePropertyOverrides` effectively shims what
|
|
47
|
+
* the assignment behavior would have been in the absence of the override
|
|
48
|
+
* mistake. However, the shim produces an imperfect emulation. It shims the
|
|
49
|
+
* behavior by turning these data properties into accessor properties, where
|
|
50
|
+
* the accessor's getter and setter provide the desired behavior. For
|
|
51
|
+
* non-reflective operations, the illusion is perfect. However, reflective
|
|
52
|
+
* operations like `getOwnPropertyDescriptor` see the descriptor of an accessor
|
|
53
|
+
* property rather than the descriptor of a data property. At the time of this
|
|
54
|
+
* writing, this is the best we know how to do.
|
|
55
|
+
*
|
|
56
|
+
* To the getter of the accessor we add a property named
|
|
57
|
+
* `'originalValue'` whose value is, as it says, the value that the
|
|
58
|
+
* data property had before being converted to an accessor property. We add
|
|
59
|
+
* this extra property to the getter for two reason:
|
|
60
|
+
*
|
|
61
|
+
* The harden algorithm walks the own properties reflectively, i.e., with
|
|
62
|
+
* `getOwnPropertyDescriptor` semantics, rather than `[[Get]]` semantics. When
|
|
63
|
+
* it sees an accessor property, it does not invoke the getter. Rather, it
|
|
64
|
+
* proceeds to walk both the getter and setter as part of its transitive
|
|
65
|
+
* traversal. Without this extra property, `enablePropertyOverrides` would have
|
|
66
|
+
* hidden the original data property value from `harden`, which would be bad.
|
|
67
|
+
* Instead, by exposing that value in an own data property on the getter,
|
|
68
|
+
* `harden` finds and walks it anyway.
|
|
69
|
+
*
|
|
70
|
+
* We enable a form of cooperative emulation, giving reflective code an
|
|
71
|
+
* opportunity to cooperate in upholding the illusion. When such cooperative
|
|
72
|
+
* reflective code sees an accessor property, where the accessor's getter
|
|
73
|
+
* has an `originalValue` property, it knows that the getter is
|
|
74
|
+
* alleging that it is the result of the `enablePropertyOverrides` conversion
|
|
75
|
+
* pattern, so it can decide to cooperatively "pretend" that it sees a data
|
|
76
|
+
* property with that value.
|
|
77
|
+
*
|
|
78
|
+
* @param {Record<string, any>} intrinsics
|
|
79
|
+
* @param {'min' | 'moderate' | 'severe'} overrideTaming
|
|
80
|
+
* @param {Reporter} reporter
|
|
81
|
+
* @param {Iterable<string | symbol>} [overrideDebug]
|
|
82
|
+
*/
|
|
83
|
+
export default function enablePropertyOverrides(
|
|
84
|
+
intrinsics,
|
|
85
|
+
overrideTaming,
|
|
86
|
+
{ warn },
|
|
87
|
+
overrideDebug = [],
|
|
88
|
+
) {
|
|
89
|
+
const debugProperties = new Set(overrideDebug);
|
|
90
|
+
function enable(path, obj, prop, desc) {
|
|
91
|
+
if ('value' in desc && desc.configurable) {
|
|
92
|
+
const { value } = desc;
|
|
93
|
+
|
|
94
|
+
const isDebug = setHas(debugProperties, prop);
|
|
95
|
+
|
|
96
|
+
// We use concise method syntax to be `this` sensitive, but still
|
|
97
|
+
// omit a prototype property or [[Construct]] behavior.
|
|
98
|
+
// @ts-expect-error We know there is an accessor descriptor there
|
|
99
|
+
const { get: getter, set: setter } = getOwnPropertyDescriptor(
|
|
100
|
+
{
|
|
101
|
+
get [prop]() {
|
|
102
|
+
return value;
|
|
103
|
+
},
|
|
104
|
+
set [prop](newValue) {
|
|
105
|
+
if (obj === this) {
|
|
106
|
+
throw TypeError(
|
|
107
|
+
`Cannot assign to read only property '${String(
|
|
108
|
+
prop,
|
|
109
|
+
)}' of '${path}'`,
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
if (hasOwn(this, prop)) {
|
|
113
|
+
this[prop] = newValue;
|
|
114
|
+
} else {
|
|
115
|
+
if (isDebug) {
|
|
116
|
+
warn(TypeError(`Override property ${prop}`));
|
|
117
|
+
}
|
|
118
|
+
defineProperty(this, prop, {
|
|
119
|
+
value: newValue,
|
|
120
|
+
writable: true,
|
|
121
|
+
enumerable: true,
|
|
122
|
+
configurable: true,
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
prop,
|
|
128
|
+
);
|
|
129
|
+
|
|
130
|
+
defineProperty(getter, 'originalValue', {
|
|
131
|
+
value,
|
|
132
|
+
writable: false,
|
|
133
|
+
enumerable: false,
|
|
134
|
+
configurable: false,
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
defineProperty(obj, prop, {
|
|
138
|
+
get: getter,
|
|
139
|
+
set: setter,
|
|
140
|
+
enumerable: desc.enumerable,
|
|
141
|
+
configurable: desc.configurable,
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function enableProperty(path, obj, prop) {
|
|
147
|
+
const desc = getOwnPropertyDescriptor(obj, prop);
|
|
148
|
+
if (!desc) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
enable(path, obj, prop, desc);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function enableAllProperties(path, obj) {
|
|
155
|
+
const descs = getOwnPropertyDescriptors(obj);
|
|
156
|
+
if (!descs) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
// TypeScript does not allow symbols to be used as indexes because it
|
|
160
|
+
// cannot recokon types of symbolized properties.
|
|
161
|
+
arrayForEach(ownKeys(descs), prop => enable(path, obj, prop, descs[prop]));
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function enableProperties(path, obj, plan) {
|
|
165
|
+
for (const prop of ownKeys(plan)) {
|
|
166
|
+
const desc = getOwnPropertyDescriptor(obj, prop);
|
|
167
|
+
if (!desc || desc.get || desc.set) {
|
|
168
|
+
// No not a value property, nothing to do.
|
|
169
|
+
// eslint-disable-next-line no-continue
|
|
170
|
+
continue;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// In case `prop` is a symbol, we first coerce it with `String`,
|
|
174
|
+
// purely for diagnostic purposes.
|
|
175
|
+
const subPath = `${path}.${String(prop)}`;
|
|
176
|
+
const subPlan = plan[prop];
|
|
177
|
+
|
|
178
|
+
if (subPlan === true) {
|
|
179
|
+
enableProperty(subPath, obj, prop);
|
|
180
|
+
} else if (subPlan === '*') {
|
|
181
|
+
enableAllProperties(subPath, desc.value);
|
|
182
|
+
} else if (!isPrimitive(subPlan)) {
|
|
183
|
+
enableProperties(subPath, desc.value, subPlan);
|
|
184
|
+
} else {
|
|
185
|
+
throw TypeError(`Unexpected override enablement plan ${subPath}`);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
let plan;
|
|
191
|
+
switch (overrideTaming) {
|
|
192
|
+
case 'min': {
|
|
193
|
+
plan = minEnablements;
|
|
194
|
+
break;
|
|
195
|
+
}
|
|
196
|
+
case 'moderate': {
|
|
197
|
+
plan = moderateEnablements;
|
|
198
|
+
break;
|
|
199
|
+
}
|
|
200
|
+
case 'severe': {
|
|
201
|
+
plan = severeEnablements;
|
|
202
|
+
break;
|
|
203
|
+
}
|
|
204
|
+
default: {
|
|
205
|
+
throw TypeError(`unrecognized overrideTaming ${overrideTaming}`);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// Do the repair.
|
|
210
|
+
enableProperties('root', intrinsics, plan);
|
|
211
|
+
}
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import { toStringTagSymbol, iteratorSymbol } from './commons.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Exports {@code enablements}, a recursively defined
|
|
5
|
+
* JSON record defining the optimum set of intrinsics properties
|
|
6
|
+
* that need to be "repaired" before hardening is applied on
|
|
7
|
+
* enviromments subject to the override mistake.
|
|
8
|
+
*
|
|
9
|
+
* @author JF Paradis
|
|
10
|
+
* @author Mark S. Miller
|
|
11
|
+
*
|
|
12
|
+
* @module
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* <p>Because "repairing" replaces data properties with accessors, every
|
|
17
|
+
* time a repaired property is accessed, the associated getter is invoked,
|
|
18
|
+
* which degrades the runtime performance of all code executing in the
|
|
19
|
+
* repaired enviromment, compared to the non-repaired case. In order
|
|
20
|
+
* to maintain performance, we only repair the properties of objects
|
|
21
|
+
* for which hardening causes a breakage of their normal intended usage.
|
|
22
|
+
*
|
|
23
|
+
* There are three unwanted cases:
|
|
24
|
+
* <ul>
|
|
25
|
+
* <li>Overriding properties on objects typically used as records,
|
|
26
|
+
* namely {@code "Object"} and {@code "Array"}. In the case of arrays,
|
|
27
|
+
* the situation is unintentional, a given program might not be aware
|
|
28
|
+
* that non-numerical properties are stored on the underlying object
|
|
29
|
+
* instance, not on the array. When an object is typically used as a
|
|
30
|
+
* map, we repair all of its prototype properties.
|
|
31
|
+
* <li>Overriding properties on objects that provide defaults on their
|
|
32
|
+
* prototype and that programs typically set using an assignment, such as
|
|
33
|
+
* {@code "Error.prototype.message"} and {@code "Function.prototype.name"}
|
|
34
|
+
* (both default to "").
|
|
35
|
+
* <li>Setting-up a prototype chain, where a constructor is set to extend
|
|
36
|
+
* another one. This is typically set by assignment, for example
|
|
37
|
+
* {@code "Child.prototype.constructor = Child"}, instead of invoking
|
|
38
|
+
* Object.defineProperty();
|
|
39
|
+
*
|
|
40
|
+
* <p>Each JSON record enumerates the disposition of the properties on
|
|
41
|
+
* some corresponding intrinsic object.
|
|
42
|
+
*
|
|
43
|
+
* <p>For each such record, the values associated with its property
|
|
44
|
+
* names can be:
|
|
45
|
+
* <ul>
|
|
46
|
+
* <li>true, in which case this property is simply repaired. The
|
|
47
|
+
* value associated with that property is not traversed. For
|
|
48
|
+
* example, {@code "Function.prototype.name"} leads to true,
|
|
49
|
+
* meaning that the {@code "name"} property of {@code
|
|
50
|
+
* "Function.prototype"} should be repaired (which is needed
|
|
51
|
+
* when inheriting from @code{Function} and setting the subclass's
|
|
52
|
+
* {@code "prototype.name"} property). If the property is
|
|
53
|
+
* already an accessor property, it is not repaired (because
|
|
54
|
+
* accessors are not subject to the override mistake).
|
|
55
|
+
* <li>"*", in which case this property is not repaired but the
|
|
56
|
+
* value associated with that property are traversed and repaired.
|
|
57
|
+
* <li>Another record, in which case this property is not repaired
|
|
58
|
+
* and that next record represents the disposition of the object
|
|
59
|
+
* which is its value. For example,{@code "FunctionPrototype"}
|
|
60
|
+
* leads to another record explaining which properties {@code
|
|
61
|
+
* Function.prototype} need to be repaired.
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Minimal enablements when all the code is modern and known not to
|
|
66
|
+
* step into the override mistake, except for the following pervasive
|
|
67
|
+
* cases.
|
|
68
|
+
*/
|
|
69
|
+
export const minEnablements = {
|
|
70
|
+
'%ObjectPrototype%': {
|
|
71
|
+
toString: true,
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
'%FunctionPrototype%': {
|
|
75
|
+
toString: true, // set by "rollup"
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
'%ErrorPrototype%': {
|
|
79
|
+
name: true, // set by "precond", "ava", "node-fetch"
|
|
80
|
+
},
|
|
81
|
+
'%IteratorPrototype%': {
|
|
82
|
+
toString: true,
|
|
83
|
+
// https://github.com/tc39/proposal-iterator-helpers
|
|
84
|
+
constructor: true,
|
|
85
|
+
// https://github.com/tc39/proposal-iterator-helpers
|
|
86
|
+
[toStringTagSymbol]: true,
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Moderate enablements are usually good enough for legacy compat.
|
|
92
|
+
*/
|
|
93
|
+
export const moderateEnablements = {
|
|
94
|
+
'%ObjectPrototype%': {
|
|
95
|
+
toString: true,
|
|
96
|
+
valueOf: true,
|
|
97
|
+
},
|
|
98
|
+
|
|
99
|
+
'%ArrayPrototype%': {
|
|
100
|
+
toString: true,
|
|
101
|
+
push: true, // set by "Google Analytics"
|
|
102
|
+
concat: true, // set by mobx generated code (old TS compiler?)
|
|
103
|
+
[iteratorSymbol]: true, // set by mobx generated code (old TS compiler?)
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
// Function.prototype has no 'prototype' property to enable.
|
|
107
|
+
// Function instances have their own 'name' and 'length' properties
|
|
108
|
+
// which are configurable and non-writable. Thus, they are already
|
|
109
|
+
// non-assignable anyway.
|
|
110
|
+
'%FunctionPrototype%': {
|
|
111
|
+
constructor: true, // set by "regenerator-runtime"
|
|
112
|
+
bind: true, // set by "underscore", "express"
|
|
113
|
+
toString: true, // set by "rollup"
|
|
114
|
+
},
|
|
115
|
+
|
|
116
|
+
'%ErrorPrototype%': {
|
|
117
|
+
constructor: true, // set by "fast-json-patch", "node-fetch"
|
|
118
|
+
message: true,
|
|
119
|
+
name: true, // set by "precond", "ava", "node-fetch", "node 14"
|
|
120
|
+
toString: true, // set by "bluebird"
|
|
121
|
+
},
|
|
122
|
+
|
|
123
|
+
'%TypeErrorPrototype%': {
|
|
124
|
+
constructor: true, // set by "readable-stream"
|
|
125
|
+
message: true, // set by "tape"
|
|
126
|
+
name: true, // set by "readable-stream", "node 14"
|
|
127
|
+
},
|
|
128
|
+
|
|
129
|
+
'%SyntaxErrorPrototype%': {
|
|
130
|
+
message: true, // to match TypeErrorPrototype.message
|
|
131
|
+
name: true, // set by "node 14"
|
|
132
|
+
},
|
|
133
|
+
|
|
134
|
+
'%RangeErrorPrototype%': {
|
|
135
|
+
message: true, // to match TypeErrorPrototype.message
|
|
136
|
+
name: true, // set by "node 14"
|
|
137
|
+
},
|
|
138
|
+
|
|
139
|
+
'%URIErrorPrototype%': {
|
|
140
|
+
message: true, // to match TypeErrorPrototype.message
|
|
141
|
+
name: true, // set by "node 14"
|
|
142
|
+
},
|
|
143
|
+
|
|
144
|
+
'%EvalErrorPrototype%': {
|
|
145
|
+
message: true, // to match TypeErrorPrototype.message
|
|
146
|
+
name: true, // set by "node 14"
|
|
147
|
+
},
|
|
148
|
+
|
|
149
|
+
'%ReferenceErrorPrototype%': {
|
|
150
|
+
message: true, // to match TypeErrorPrototype.message
|
|
151
|
+
name: true, // set by "node 14"
|
|
152
|
+
},
|
|
153
|
+
|
|
154
|
+
// https://github.com/endojs/endo/issues/550
|
|
155
|
+
'%AggregateErrorPrototype%': {
|
|
156
|
+
message: true, // to match TypeErrorPrototype.message
|
|
157
|
+
name: true, // set by "node 14"?
|
|
158
|
+
},
|
|
159
|
+
|
|
160
|
+
'%PromisePrototype%': {
|
|
161
|
+
constructor: true, // set by "core-js"
|
|
162
|
+
},
|
|
163
|
+
|
|
164
|
+
'%TypedArrayPrototype%': '*', // set by https://github.com/feross/buffer
|
|
165
|
+
|
|
166
|
+
'%Generator%': {
|
|
167
|
+
constructor: true,
|
|
168
|
+
name: true,
|
|
169
|
+
toString: true,
|
|
170
|
+
},
|
|
171
|
+
|
|
172
|
+
'%IteratorPrototype%': {
|
|
173
|
+
toString: true,
|
|
174
|
+
// https://github.com/tc39/proposal-iterator-helpers
|
|
175
|
+
constructor: true,
|
|
176
|
+
// https://github.com/tc39/proposal-iterator-helpers
|
|
177
|
+
[toStringTagSymbol]: true,
|
|
178
|
+
},
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* The 'severe' enablement are needed because of issues tracked at
|
|
183
|
+
* https://github.com/endojs/endo/issues/576
|
|
184
|
+
*
|
|
185
|
+
* They are like the `moderate` enablements except for the entries below.
|
|
186
|
+
*/
|
|
187
|
+
export const severeEnablements = {
|
|
188
|
+
...moderateEnablements,
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Rollup (as used at least by vega) and webpack
|
|
192
|
+
* (as used at least by regenerator) both turn exports into assignments
|
|
193
|
+
* to a big `exports` object that inherits directly from
|
|
194
|
+
* `Object.prototype`. Some of the exported names we've seen include
|
|
195
|
+
* `hasOwnProperty`, `constructor`, and `toString`. But the strategy used
|
|
196
|
+
* by rollup and webpack potentionally turns any exported name
|
|
197
|
+
* into an assignment rejected by the override mistake. That's why
|
|
198
|
+
* the `severe` enablements takes the extreme step of enabling
|
|
199
|
+
* everything on `Object.prototype`.
|
|
200
|
+
*
|
|
201
|
+
* In addition, code doing inheritance manually will often override
|
|
202
|
+
* the `constructor` property on the new prototype by assignment. We've
|
|
203
|
+
* seen this several times.
|
|
204
|
+
*
|
|
205
|
+
* The cost of enabling all these is that they create a miserable debugging
|
|
206
|
+
* experience specifically on Node.
|
|
207
|
+
* https://github.com/Agoric/agoric-sdk/issues/2324
|
|
208
|
+
* explains how it confused the Node console.
|
|
209
|
+
*
|
|
210
|
+
* (TODO Reexamine the vscode situation. I think it may have improved
|
|
211
|
+
* since the following paragraph was written.)
|
|
212
|
+
*
|
|
213
|
+
* The vscode debugger's object inspector shows the own data properties of
|
|
214
|
+
* an object, which is typically what you want, but also shows both getter
|
|
215
|
+
* and setter for every accessor property whether inherited or own.
|
|
216
|
+
* With the `'*'` setting here, all the properties inherited from
|
|
217
|
+
* `Object.prototype` are accessors, creating an unusable display as seen
|
|
218
|
+
* at As explained at
|
|
219
|
+
* https://github.com/endojs/endo/blob/master/packages/ses/docs/lockdown.md#overridetaming-options
|
|
220
|
+
* Open the triangles at the bottom of that section.
|
|
221
|
+
*/
|
|
222
|
+
'%ObjectPrototype%': '*',
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* The widely used Buffer defined at https://github.com/feross/buffer
|
|
226
|
+
* on initialization, manually creates the equivalent of a subclass of
|
|
227
|
+
* `TypedArray`, which it then initializes by assignment. These assignments
|
|
228
|
+
* include enough of the `TypeArray` methods that here, the `severe`
|
|
229
|
+
* enablements just enable them all.
|
|
230
|
+
*/
|
|
231
|
+
'%TypedArrayPrototype%': '*',
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Needed to work with Immer before https://github.com/immerjs/immer/pull/914
|
|
235
|
+
* is accepted.
|
|
236
|
+
*/
|
|
237
|
+
'%MapPrototype%': '*',
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Needed to work with Immer before https://github.com/immerjs/immer/pull/914
|
|
241
|
+
* is accepted.
|
|
242
|
+
*/
|
|
243
|
+
'%SetPrototype%': '*',
|
|
244
|
+
};
|