tamedevil 0.0.0-0.1 → 0.0.0-0.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.
- package/CHANGELOG.md +13 -0
- package/README.md +65 -24
- package/dist/index.d.ts +96 -31
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +187 -56
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# tamedevil
|
|
2
2
|
|
|
3
|
+
## 0.0.0-0.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`4ca7fce12`](undefined) - Make runnable in the browser for playground
|
|
8
|
+
|
|
9
|
+
## 0.0.0-0.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`9b296ba54`](undefined) - More secure, more compatible, and lots of fixes
|
|
14
|
+
across the monorepo
|
|
15
|
+
|
|
3
16
|
## 0.0.0-0.1
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -89,16 +89,12 @@ typically the only thing you need to import.
|
|
|
89
89
|
|
|
90
90
|
For ESM, import `te`:
|
|
91
91
|
|
|
92
|
-
<!-- skip-example -->
|
|
93
|
-
|
|
94
92
|
```js
|
|
95
93
|
import { te } from "tamedevil";
|
|
96
94
|
```
|
|
97
95
|
|
|
98
96
|
Or for CommonJS, `require` it:
|
|
99
97
|
|
|
100
|
-
<!-- skip-example -->
|
|
101
|
-
|
|
102
98
|
```js
|
|
103
99
|
const { te } = require("tamedevil");
|
|
104
100
|
```
|
|
@@ -122,15 +118,13 @@ const toEval = te`\
|
|
|
122
118
|
|
|
123
119
|
const plan = te.run(toEval);
|
|
124
120
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
*/
|
|
121
|
+
assert.strictEqual(
|
|
122
|
+
plan.toString(),
|
|
123
|
+
`function plan($record) {
|
|
124
|
+
const $records = source.find("some string here");
|
|
125
|
+
return connection($records);
|
|
126
|
+
}`,
|
|
127
|
+
);
|
|
134
128
|
```
|
|
135
129
|
|
|
136
130
|
## API
|
|
@@ -143,13 +137,13 @@ embedded expressions. If a non `te` expression is passed in, e.g.:
|
|
|
143
137
|
<!-- skip-example -->
|
|
144
138
|
|
|
145
139
|
```js
|
|
146
|
-
te`return 2 + ${1}`;
|
|
140
|
+
te`return 2 + ${1}`; // WILL THROW AN ERROR
|
|
147
141
|
```
|
|
148
142
|
|
|
149
143
|
then an error will be thrown. This prevents code injection, as all values must
|
|
150
144
|
go through an allowed API.
|
|
151
145
|
|
|
152
|
-
### `te.ref(val)` (alias: te.reference)
|
|
146
|
+
### `te.ref(val, name?)` (alias: te.reference)
|
|
153
147
|
|
|
154
148
|
Tells `te` to pass the given value by reference into the scope of the function
|
|
155
149
|
via a closure, and returns an identifier that can be used to reference it. Note:
|
|
@@ -162,13 +156,44 @@ debug, e.g.:
|
|
|
162
156
|
const source = new Source(/* ... */);
|
|
163
157
|
const spec = "some string here";
|
|
164
158
|
|
|
165
|
-
const
|
|
159
|
+
const plan = te.run`\
|
|
166
160
|
const source = ${te.ref(source)};
|
|
167
161
|
return function plan($record) {
|
|
168
162
|
const $records = source.find(${te.lit(spec)});
|
|
169
163
|
return connection($records);
|
|
170
164
|
}
|
|
171
165
|
`;
|
|
166
|
+
|
|
167
|
+
assert.strictEqual(
|
|
168
|
+
plan.toString(),
|
|
169
|
+
`function plan($record) {
|
|
170
|
+
const $records = source.find("some string here");
|
|
171
|
+
return connection($records);
|
|
172
|
+
}`,
|
|
173
|
+
);
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
If you want to force a particular identifier to be used, you can pass the
|
|
177
|
+
`name`, but then it's up to you to ensure that no conflicts take place:
|
|
178
|
+
|
|
179
|
+
```js
|
|
180
|
+
const source = new Source(/* ... */);
|
|
181
|
+
const spec = "some string here";
|
|
182
|
+
|
|
183
|
+
const plan = te.run`\
|
|
184
|
+
return function plan($record) {
|
|
185
|
+
const $records = ${te.ref(source, "source")}.find(${te.lit(spec)});
|
|
186
|
+
return connection($records);
|
|
187
|
+
}
|
|
188
|
+
`;
|
|
189
|
+
|
|
190
|
+
assert.strictEqual(
|
|
191
|
+
plan.toString(),
|
|
192
|
+
`function plan($record) {
|
|
193
|
+
const $records = source.find("some string here");
|
|
194
|
+
return connection($records);
|
|
195
|
+
}`,
|
|
196
|
+
);
|
|
172
197
|
```
|
|
173
198
|
|
|
174
199
|
### `te.lit(val)` (alias: te.literal)
|
|
@@ -188,12 +213,16 @@ const key1 = "one";
|
|
|
188
213
|
// fine for `Object.create(null)`
|
|
189
214
|
const key2 = "__proto__";
|
|
190
215
|
|
|
191
|
-
const
|
|
216
|
+
const obj = te.run`\
|
|
192
217
|
const obj = Object.create(null);
|
|
193
218
|
obj[${te.lit(key1)}] = 1;
|
|
194
|
-
obj[${te.lit(key2)}] = {str: true};
|
|
219
|
+
obj[${te.lit(key2)}] = { str: true };
|
|
195
220
|
return obj;
|
|
196
221
|
`;
|
|
222
|
+
|
|
223
|
+
assert.equal(typeof obj, "object");
|
|
224
|
+
assert.equal(obj.one, 1);
|
|
225
|
+
assert.deepEqual(obj.__proto__, { str: true });
|
|
197
226
|
```
|
|
198
227
|
|
|
199
228
|
### `te.substring(str, stringType)`
|
|
@@ -205,7 +234,13 @@ argument should be `"`, `'` or `` ` `` depending on what type of string you're
|
|
|
205
234
|
embedding into. Example:
|
|
206
235
|
|
|
207
236
|
```js
|
|
208
|
-
|
|
237
|
+
// Some untrusted user input, could have anything in it
|
|
238
|
+
const untrusted = "'\"` \\'\\\"\\` ${process.exit(1)}";
|
|
239
|
+
|
|
240
|
+
// Safely insert the untrusted input into a string
|
|
241
|
+
const code = te.run`return "abc${te.substring(untrusted, '"')}123";`;
|
|
242
|
+
|
|
243
|
+
assert.strictEqual(code, "abc'\"` \\'\\\"\\` ${process.exit(1)}123");
|
|
209
244
|
```
|
|
210
245
|
|
|
211
246
|
### `te.join(arrayOfFragments, delimiter)`
|
|
@@ -216,8 +251,9 @@ Joins an array of `te` values using the delimiter (a plain string); e.g.
|
|
|
216
251
|
const keysAndValues = ["a", "b", "c", "d"].map(
|
|
217
252
|
(n, i) => te`${te.dangerousKey(n)}: ${te.literal(i)}`,
|
|
218
253
|
);
|
|
219
|
-
const obj = te`{ ${te.join(keysAndValues, ", ")} }`;
|
|
220
|
-
|
|
254
|
+
const obj = te.run`return { ${te.join(keysAndValues, ", ")} }`;
|
|
255
|
+
|
|
256
|
+
assert.deepEqual(obj, { a: 0, b: 1, c: 2, d: 3 });
|
|
221
257
|
```
|
|
222
258
|
|
|
223
259
|
### `te.identifier(name)`
|
|
@@ -266,7 +302,7 @@ symbol or number) of the preceding expression; will return code like `.foo` or
|
|
|
266
302
|
As with `te.get` except using optional chaining - the expression will be `?.foo`
|
|
267
303
|
or `?.["foo"]` as appropriate.
|
|
268
304
|
|
|
269
|
-
### `te.set(key, hasNullPrototype)`
|
|
305
|
+
### `te.set(key, hasNullPrototype?)`
|
|
270
306
|
|
|
271
307
|
As with `te.get`, except since it's for setting a key we'll perform checks to
|
|
272
308
|
ensure you're not writing to unsafe keys (such as `__proto__`) unless you
|
|
@@ -299,7 +335,8 @@ Evaluates the TE fragment and returns the result.
|
|
|
299
335
|
```js
|
|
300
336
|
const fragment = te`return 1 + 2`;
|
|
301
337
|
const result = te.run(fragment);
|
|
302
|
-
|
|
338
|
+
|
|
339
|
+
assert.equal(result, 3);
|
|
303
340
|
```
|
|
304
341
|
|
|
305
342
|
### `te.compile(fragment)`
|
|
@@ -311,5 +348,9 @@ for debugging, or tests.
|
|
|
311
348
|
```js
|
|
312
349
|
const fragment = te`return ${te.ref(1)} + ${te.ref(2)}`;
|
|
313
350
|
const result = te.compile(fragment);
|
|
314
|
-
|
|
351
|
+
|
|
352
|
+
assert.deepEqual(result, {
|
|
353
|
+
string: `return _$$_ref_1 + _$$_ref_2`,
|
|
354
|
+
refs: { _$$_ref_1: 1, _$$_ref_2: 2 },
|
|
355
|
+
});
|
|
315
356
|
```
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { reservedWords } from "./reservedWords.js";
|
|
2
1
|
/**
|
|
3
2
|
* This is the secret to our safety; since this is a symbol it cannot be faked
|
|
4
3
|
* in a JSON payload and it cannot be constructed with a new Symbol (even with
|
|
5
4
|
* the same argument), so external data cannot make itself trusted.
|
|
5
|
+
*
|
|
6
|
+
* @internal
|
|
6
7
|
*/
|
|
7
8
|
declare const $$type: unique symbol;
|
|
8
9
|
/**
|
|
@@ -21,7 +22,13 @@ export interface TERefNode {
|
|
|
21
22
|
readonly [$$type]: "REF";
|
|
22
23
|
/** value */
|
|
23
24
|
readonly v: any;
|
|
25
|
+
/** name */
|
|
26
|
+
readonly n: string | undefined;
|
|
24
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Represents a temporary variable that will be created, primarily useful for
|
|
30
|
+
* inline wrangling of data where statements are not available.
|
|
31
|
+
*/
|
|
25
32
|
export interface TETemporaryVariableNode {
|
|
26
33
|
readonly [$$type]: "VARIABLE";
|
|
27
34
|
/** symbol */
|
|
@@ -44,14 +51,17 @@ export interface TEQuery {
|
|
|
44
51
|
readonly n: ReadonlyArray<TENode>;
|
|
45
52
|
}
|
|
46
53
|
/**
|
|
47
|
-
*
|
|
48
|
-
*
|
|
54
|
+
* A tamedevil node or fragment, ready to be combined into a larger fragment or
|
|
55
|
+
* evaluated directly. To evaluate, feed this node into `te.run()`.
|
|
49
56
|
*/
|
|
50
57
|
export declare type TE = TENode | TEQuery;
|
|
58
|
+
/**
|
|
59
|
+
* Returns true if the given node is a TE node, false otherwise.
|
|
60
|
+
*/
|
|
51
61
|
declare function isTE(node: unknown): node is TE;
|
|
52
62
|
/**
|
|
53
|
-
* Accepts an te`...` expression and compiles it out to
|
|
54
|
-
*
|
|
63
|
+
* Accepts an te`...` expression and compiles it out to the function body
|
|
64
|
+
* `string` and the `refs` that need to be passed via the closure.
|
|
55
65
|
*/
|
|
56
66
|
declare function compile(fragment: TE): {
|
|
57
67
|
string: string;
|
|
@@ -60,29 +70,45 @@ declare function compile(fragment: TE): {
|
|
|
60
70
|
};
|
|
61
71
|
};
|
|
62
72
|
/**
|
|
63
|
-
* Creates a TE
|
|
64
|
-
*
|
|
65
|
-
*
|
|
73
|
+
* Creates a TE node for a raw code string. Just plain ol‘ raw code - EXTREMELY
|
|
74
|
+
* DANGEROUS.
|
|
75
|
+
*
|
|
76
|
+
* This method is dangerous because it involves no escaping, so proceed with
|
|
77
|
+
* caution!
|
|
78
|
+
*
|
|
79
|
+
* It's very very rarely warranted to use this - there is likely a safer way of
|
|
66
80
|
* achieving your goal. DO NOT USE THIS WITH UNTRUSTED INPUT!
|
|
67
81
|
*/
|
|
68
82
|
declare function raw(text: string): TE;
|
|
69
83
|
/**
|
|
70
|
-
* Creates a TE
|
|
71
|
-
*
|
|
84
|
+
* Creates a TE node for an arbitrary JS object that will be made available
|
|
85
|
+
* (via a closure) to the final code that will be executed. This value is not
|
|
86
|
+
* serialized or similar, it is passed by reference.
|
|
72
87
|
*/
|
|
73
|
-
declare function ref(val: any): TE;
|
|
88
|
+
declare function ref(val: any, name?: string): TE;
|
|
74
89
|
declare const undefinedNode: TERawNode;
|
|
90
|
+
/**
|
|
91
|
+
* Similar to `JSON.stringify(string)`, but faster. Bizarrely this seems to be
|
|
92
|
+
* faster than the regexp approach
|
|
93
|
+
*/
|
|
75
94
|
export declare function stringifyString(value: string): string;
|
|
95
|
+
/**
|
|
96
|
+
* Equivalent to JSON.stringify, but typically faster.
|
|
97
|
+
*/
|
|
76
98
|
export declare const toJSON: (value: any) => string;
|
|
77
99
|
/**
|
|
78
|
-
* If the value is simple will
|
|
79
|
-
* to `te.ref`.
|
|
100
|
+
* If the value is simple this will stringify it and inject it directly into
|
|
101
|
+
* the code to be evaluated, otherwise will defer to `te.ref`.
|
|
80
102
|
*/
|
|
81
103
|
declare function lit(val: any): TE;
|
|
82
104
|
/**
|
|
83
105
|
* If you're building a string and you want to inject untrusted content into it
|
|
84
|
-
* without opening yourself to code injection attacks
|
|
85
|
-
* you.
|
|
106
|
+
* without opening yourself to code injection attacks nor doing awkward string
|
|
107
|
+
* concatenation, this is the method for you. It's essential that you pass the
|
|
108
|
+
* correct type of string that you're embedding into via the `stringType`
|
|
109
|
+
* parameter.
|
|
110
|
+
*
|
|
111
|
+
* Example:
|
|
86
112
|
*
|
|
87
113
|
* ```js
|
|
88
114
|
* const code = te`const str = "abc${te.substring(untrusted, '"')}123";`
|
|
@@ -94,42 +120,53 @@ declare function substring(text: string, stringType: "'" | '"' | "`"): TE;
|
|
|
94
120
|
*/
|
|
95
121
|
declare function subcomment(content: string | number | null | undefined): TERawNode;
|
|
96
122
|
/**
|
|
97
|
-
*
|
|
123
|
+
* Returns true if the given key is safe to set as the key of a POJO (without a
|
|
124
|
+
* null prototype), false otherwise.
|
|
98
125
|
*/
|
|
99
126
|
export declare const isSafeObjectPropertyName: (key: string | symbol | number) => boolean;
|
|
100
127
|
/**
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
* Doesn't allow it to start with two underscores.
|
|
128
|
+
* Asserts that the given `name` is allowed to be used as an identifier
|
|
129
|
+
* (variable name, function name, etc); and if so it returns a TE node
|
|
130
|
+
* representing this identifier. If disallowed, will throw an error.
|
|
105
131
|
*/
|
|
106
|
-
export declare const canRepresentAsIdentifier: (key: string | symbol | number) => key is string | number;
|
|
107
132
|
declare function identifier(name: string): TERawNode;
|
|
108
133
|
/**
|
|
134
|
+
* Checks that the given `key` is not explicitly disallowed as a key on a POJO and returns a TE node representing it. If disallowed, an error will be thrown. Useful for building easy to read objects:
|
|
135
|
+
*
|
|
136
|
+
* ```js
|
|
137
|
+
* const obj = te.run`return { ${te.identifier("frogs")}: "frogs" }`;
|
|
138
|
+
* ```
|
|
139
|
+
*
|
|
109
140
|
* IMPORTANT: It's strongly recommended that instead of defining an object via
|
|
110
141
|
* `const obj = { ${te.dangerousKey(untrustedKey)}: value }` you instead use
|
|
111
142
|
* `const obj = Object.create(null);` and then set the properties on the resulting
|
|
112
|
-
* object via `${obj}
|
|
113
|
-
* **prototype polution** since properties like `__proto__` are
|
|
114
|
-
* null-prototype objects, whereas they can cause havok in
|
|
143
|
+
* object via `${obj}${te.set(untrustedKey, true)} = value;` - this prevents
|
|
144
|
+
* attacks such as **prototype polution** since properties like `__proto__` are
|
|
145
|
+
* not special on null-prototype objects, whereas they can cause havok in
|
|
146
|
+
* regular `{}` objects (POJOs).
|
|
115
147
|
*/
|
|
116
148
|
declare function dangerousKey(key: string | symbol | number): TE;
|
|
117
149
|
/**
|
|
118
150
|
* Accesses the key of an object either via `.` or `[]` as appropriate;
|
|
119
151
|
* `obj${te.get(key)}` would become `obj.foo` or `obj["1foo"]` as
|
|
120
152
|
* appropriate.
|
|
153
|
+
*
|
|
154
|
+
* DO NOT USE THIS FOR ASSIGNMENT!
|
|
121
155
|
*/
|
|
122
156
|
declare function get(key: string | symbol | number): TE;
|
|
123
157
|
/**
|
|
124
158
|
* Accesses the key of an object via optional-chaining:
|
|
125
159
|
* `obj${te.optionalGet(key)}` would become `obj?.foo` or `obj?.["1foo"]` as
|
|
126
160
|
* appropriate.
|
|
161
|
+
*
|
|
162
|
+
* DO NOT USE THIS FOR ASSIGNMENT!
|
|
127
163
|
*/
|
|
128
164
|
declare function optionalGet(key: string | symbol | number): TE;
|
|
129
165
|
/**
|
|
130
|
-
*
|
|
131
|
-
* `obj${te.set(key)}` would become `obj.foo` or
|
|
132
|
-
* appropriate.
|
|
166
|
+
* Access to the key of an object either via `.` or `[]` as appropriate ready
|
|
167
|
+
* for being assigned to; `obj${te.set(key)}` would become `obj.foo` or
|
|
168
|
+
* `obj["1foo"]` as appropriate. Note this is different to `get` because it
|
|
169
|
+
* performs additional checks.
|
|
133
170
|
*
|
|
134
171
|
* If the object you're setting properties on has a `null` prototype
|
|
135
172
|
* (`Object.create(null)`) then you can set `hasNullPrototype` to true and all
|
|
@@ -141,26 +178,55 @@ declare function set(key: string | symbol | number, hasNullPrototype?: boolean):
|
|
|
141
178
|
* @experimental
|
|
142
179
|
*/
|
|
143
180
|
declare function tempVar(symbol?: symbol): TE;
|
|
181
|
+
/**
|
|
182
|
+
* @experimental
|
|
183
|
+
*/
|
|
144
184
|
declare function tmp(obj: TE, callback: (tmp: TE) => TE): TE;
|
|
185
|
+
/**
|
|
186
|
+
* Evaluates the given TE fragment, and returns the result. Note that the
|
|
187
|
+
* fragment must contain a `return` statement for the result to not be
|
|
188
|
+
* undefined.
|
|
189
|
+
*/
|
|
145
190
|
declare function run<TResult>(fragment: TE): TResult;
|
|
146
191
|
declare function run<TResult>(strings: TemplateStringsArray, ...values: TE[]): TResult;
|
|
147
192
|
/**
|
|
148
193
|
* Join some TE items together, optionally separated by a string. Useful when
|
|
149
|
-
* dealing with lists of TE
|
|
150
|
-
*
|
|
194
|
+
* dealing with lists of TE nodes, for example a dynamic list of object
|
|
195
|
+
* properties.
|
|
151
196
|
*/
|
|
152
197
|
declare function join(items: Array<TE>, separator?: string): TE;
|
|
153
198
|
/**
|
|
199
|
+
* Indicates that the given fragment should be indented when output in debug
|
|
200
|
+
* mode. (Has no effect in production mode.)
|
|
201
|
+
*
|
|
154
202
|
* WARNING: all lines will be indented, without any parsing, so if there are
|
|
155
203
|
* template literals that contain newlines, spaces will be added inside these
|
|
156
204
|
* too.
|
|
157
205
|
*/
|
|
158
206
|
declare function indent(fragment: TE): TE;
|
|
159
207
|
declare function indent(strings: TemplateStringsArray, ...values: Array<TE>): TE;
|
|
208
|
+
/**
|
|
209
|
+
* If the given condition is true, the fragment will be wrapped with an indent
|
|
210
|
+
* node, otherwise it will be returned verbatim.
|
|
211
|
+
*/
|
|
160
212
|
declare function indentIf(condition: boolean, fragment: TE): TE;
|
|
213
|
+
/**
|
|
214
|
+
* Makes safe identifiers
|
|
215
|
+
*
|
|
216
|
+
* @experimental
|
|
217
|
+
* @internal
|
|
218
|
+
*/
|
|
219
|
+
export declare class Idents {
|
|
220
|
+
idents: Set<string>;
|
|
221
|
+
/**
|
|
222
|
+
* Don't allow using these identifiers (presumably because they're already in use).
|
|
223
|
+
*/
|
|
224
|
+
forbid(identifiers: string[]): void;
|
|
225
|
+
makeSafeIdentifier(str: string): string;
|
|
226
|
+
}
|
|
161
227
|
declare const te: TamedEvil;
|
|
162
228
|
export default te;
|
|
163
|
-
export { compile, dangerousKey, run as eval, get, identifier, isTE, join, lit, lit as literal, optionalGet,
|
|
229
|
+
export { compile, dangerousKey, run as eval, get, identifier, isTE, join, lit, lit as literal, optionalGet, raw, ref, run, set, subcomment, substring, te, tempVar, tmp, undefinedNode as undefined, };
|
|
164
230
|
export interface TamedEvil {
|
|
165
231
|
(strings: TemplateStringsArray, ...values: Array<TE>): TE;
|
|
166
232
|
te: TamedEvil;
|
|
@@ -192,7 +258,6 @@ export interface TamedEvil {
|
|
|
192
258
|
undefined: TE;
|
|
193
259
|
blank: TE;
|
|
194
260
|
isTE: typeof isTE;
|
|
195
|
-
reservedWords: typeof reservedWords;
|
|
196
261
|
raw: typeof raw;
|
|
197
262
|
}
|
|
198
263
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA4BA;;;;;;GAMG;AACH,QAAA,MAAM,MAAM,eAA2B,CAAC;AAExC;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC;IACzB,WAAW;IACX,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH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IAAI,EAAE,OAAO,IAAI,CAAC;IAClB,GAAG,EAAE,OAAO,GAAG,CAAC;CACjB"}
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.undefined = exports.tmp = exports.tempVar = exports.te = exports.substring = exports.subcomment = exports.set = exports.run = exports.ref = exports.raw = exports.optionalGet = exports.literal = exports.lit = exports.join = exports.isTE = exports.identifier = exports.get = exports.eval = exports.dangerousKey = exports.compile = exports.Idents = exports.isSafeObjectPropertyName = exports.toJSON = exports.stringifyString = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const lru_1 = tslib_1.__importDefault(require("@graphile/lru"));
|
|
6
6
|
const reservedWords_js_1 = require("./reservedWords.js");
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* For compatibility with graphile-export
|
|
9
|
+
*/
|
|
8
10
|
function exportAs(thing, exportName) {
|
|
9
11
|
const existingExport = thing.$$export;
|
|
10
12
|
if (existingExport) {
|
|
@@ -19,11 +21,13 @@ function exportAs(thing, exportName) {
|
|
|
19
21
|
}
|
|
20
22
|
return thing;
|
|
21
23
|
}
|
|
22
|
-
const isDev = process.env.GRAPHILE_ENV === "development";
|
|
24
|
+
const isDev = typeof process !== "undefined" && process.env.GRAPHILE_ENV === "development";
|
|
23
25
|
/**
|
|
24
26
|
* This is the secret to our safety; since this is a symbol it cannot be faked
|
|
25
27
|
* in a JSON payload and it cannot be constructed with a new Symbol (even with
|
|
26
28
|
* the same argument), so external data cannot make itself trusted.
|
|
29
|
+
*
|
|
30
|
+
* @internal
|
|
27
31
|
*/
|
|
28
32
|
const $$type = Symbol("tamedevil-type");
|
|
29
33
|
/**
|
|
@@ -34,7 +38,15 @@ const $$type = Symbol("tamedevil-type");
|
|
|
34
38
|
* amount of memory to consume for this.
|
|
35
39
|
*/
|
|
36
40
|
const CACHE_RAW_NODES = new lru_1.default({ maxLength: 10000 });
|
|
41
|
+
const CACHE_MAX_ENTRY_LENGTH = 50;
|
|
37
42
|
function makeRawNode(text, exportName) {
|
|
43
|
+
// Don't use the cache for longer texts
|
|
44
|
+
if (text.length > CACHE_MAX_ENTRY_LENGTH && exportName === undefined) {
|
|
45
|
+
return Object.freeze({
|
|
46
|
+
[$$type]: "RAW",
|
|
47
|
+
t: text,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
38
50
|
const n = CACHE_RAW_NODES.get(text);
|
|
39
51
|
if (n) {
|
|
40
52
|
return n;
|
|
@@ -54,30 +66,37 @@ function makeRawNode(text, exportName) {
|
|
|
54
66
|
return newNode;
|
|
55
67
|
}
|
|
56
68
|
// Simple function to help V8 optimize it.
|
|
57
|
-
function makeRefNode(rawValue) {
|
|
69
|
+
function makeRefNode(rawValue, name) {
|
|
58
70
|
return Object.freeze({
|
|
59
71
|
[$$type]: "REF",
|
|
60
72
|
v: rawValue,
|
|
73
|
+
n: name,
|
|
61
74
|
});
|
|
62
75
|
}
|
|
76
|
+
// Simple function to help V8 optimize it.
|
|
63
77
|
function makeTemporaryVariableNode(symbol) {
|
|
64
78
|
return Object.freeze({
|
|
65
79
|
[$$type]: "VARIABLE",
|
|
66
80
|
s: symbol,
|
|
67
81
|
});
|
|
68
82
|
}
|
|
83
|
+
// Simple function to help V8 optimize it.
|
|
69
84
|
function makeIndentNode(content) {
|
|
70
85
|
return Object.freeze({
|
|
71
86
|
[$$type]: "INDENT",
|
|
72
87
|
c: content[$$type] === "QUERY" ? content : makeQueryNode([content]),
|
|
73
88
|
});
|
|
74
89
|
}
|
|
90
|
+
// Simple function to help V8 optimize it.
|
|
75
91
|
function makeQueryNode(nodes) {
|
|
76
92
|
return Object.freeze({
|
|
77
93
|
[$$type]: "QUERY",
|
|
78
94
|
n: nodes,
|
|
79
95
|
});
|
|
80
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* Returns true if the given node is a TE node, false otherwise.
|
|
99
|
+
*/
|
|
81
100
|
function isTE(node) {
|
|
82
101
|
return (typeof node === "object" &&
|
|
83
102
|
node !== null &&
|
|
@@ -91,8 +110,8 @@ function enforceValidNode(node, where) {
|
|
|
91
110
|
throw new Error(`[tamedevil] Invalid expression. Expected an TE item${where ? ` at ${where}` : ""} but received '${String(node)}'. This may mean that there is an issue in the TE expression where a dynamic value was not escaped via 'te.ref(...)', an embedded string wasn't wrapped with 'te.string(...)', or a TE expression was added without using the \`te\` tagged template literal.`);
|
|
92
111
|
}
|
|
93
112
|
/**
|
|
94
|
-
* Accepts an te`...` expression and compiles it out to
|
|
95
|
-
*
|
|
113
|
+
* Accepts an te`...` expression and compiles it out to the function body
|
|
114
|
+
* `string` and the `refs` that need to be passed via the closure.
|
|
96
115
|
*/
|
|
97
116
|
function compile(fragment) {
|
|
98
117
|
/**
|
|
@@ -103,7 +122,7 @@ function compile(fragment) {
|
|
|
103
122
|
const refs = Object.create(null);
|
|
104
123
|
let refCount = 0;
|
|
105
124
|
const refMap = new Map();
|
|
106
|
-
const makeRef = (value) => {
|
|
125
|
+
const makeRef = (value, suggestedName) => {
|
|
107
126
|
const existingIdentifier = refMap.get(value);
|
|
108
127
|
if (existingIdentifier) {
|
|
109
128
|
return existingIdentifier;
|
|
@@ -113,7 +132,7 @@ function compile(fragment) {
|
|
|
113
132
|
if (refCount > 65535) {
|
|
114
133
|
throw new Error("[tamedevil] This TE statement would contain too many placeholders; tamedevil supports at most 65535 placeholders. To solve this, consider passing multiple values in using a single array or object.");
|
|
115
134
|
}
|
|
116
|
-
const identifier = `_$$_ref_${refCount}`;
|
|
135
|
+
const identifier = suggestedName ?? `_$$_ref_${refCount}`;
|
|
117
136
|
refMap.set(value, identifier);
|
|
118
137
|
refs[identifier] = value;
|
|
119
138
|
return identifier;
|
|
@@ -129,9 +148,10 @@ function compile(fragment) {
|
|
|
129
148
|
varMap.set(sym, varName);
|
|
130
149
|
return varName;
|
|
131
150
|
};
|
|
151
|
+
const variables = [];
|
|
132
152
|
function print(untrustedInput, indent = 0) {
|
|
133
153
|
/**
|
|
134
|
-
* Join this to generate the TE
|
|
154
|
+
* Join this to generate the TE string
|
|
135
155
|
*/
|
|
136
156
|
const teFragments = [];
|
|
137
157
|
const trustedInput = enforceValidNode(untrustedInput, ``);
|
|
@@ -147,13 +167,16 @@ function compile(fragment) {
|
|
|
147
167
|
// No need to add blank raw text!
|
|
148
168
|
break;
|
|
149
169
|
}
|
|
150
|
-
// IMPORTANT: this **must not** mangle primitives. Fortunately they're single line so it should be fine.
|
|
170
|
+
// IMPORTANT: this **must not** mangle primitives. Fortunately they're all single line so it should be fine.
|
|
151
171
|
teFragments.push(isDev ? item.t.replace(/\n/g, "\n" + " ".repeat(indent)) : item.t);
|
|
152
172
|
break;
|
|
153
173
|
}
|
|
154
174
|
case "REF": {
|
|
155
|
-
const identifier = makeRef(item.v);
|
|
175
|
+
const identifier = makeRef(item.v, item.n);
|
|
156
176
|
teFragments.push(identifier);
|
|
177
|
+
if (item.n != null && identifier !== item.n) {
|
|
178
|
+
variables.push(`const ${item.n} = ${identifier};`);
|
|
179
|
+
}
|
|
157
180
|
break;
|
|
158
181
|
}
|
|
159
182
|
case "VARIABLE": {
|
|
@@ -182,7 +205,6 @@ function compile(fragment) {
|
|
|
182
205
|
return teFragments.join("");
|
|
183
206
|
}
|
|
184
207
|
let str = print(fragment);
|
|
185
|
-
const variables = [];
|
|
186
208
|
for (const varName of varMap.values()) {
|
|
187
209
|
variables.push(`let ${varName};`);
|
|
188
210
|
}
|
|
@@ -199,12 +221,17 @@ exports.compile = compile;
|
|
|
199
221
|
// LRU not necessary
|
|
200
222
|
const CACHE_SIMPLE_FRAGMENTS = new Map();
|
|
201
223
|
/**
|
|
202
|
-
* A template string tag that creates a `TE` query out of some strings and
|
|
203
|
-
* some values. Use this to
|
|
204
|
-
* injection.
|
|
224
|
+
* A template string tag function that creates a `TE` query out of some strings and
|
|
225
|
+
* some TE values. Use this to prepare all dynamically executed code code
|
|
226
|
+
* injection attacks.
|
|
205
227
|
*
|
|
206
|
-
* Note that
|
|
207
|
-
*
|
|
228
|
+
* Note that this function enforces that every passed placeholder is a TE node,
|
|
229
|
+
* preventing potentially untrusted raw text from being injected into the code
|
|
230
|
+
* to be evaluated, thereby seriously reducing the risk of code injection
|
|
231
|
+
* attacks. Care must still be taken in the building and management of these
|
|
232
|
+
* code strings, however, since no parsing takes place - so it is up to the
|
|
233
|
+
* coder to use the right TE helper in the right positions in the constructed
|
|
234
|
+
* code.
|
|
208
235
|
*/
|
|
209
236
|
const teBase = function te(strings, ...values) {
|
|
210
237
|
if (!Array.isArray(strings) || !strings.raw) {
|
|
@@ -226,19 +253,19 @@ const teBase = function te(strings, ...values) {
|
|
|
226
253
|
}
|
|
227
254
|
// Special case te`${...}` - just return the node directly
|
|
228
255
|
if (stringsLength === 2 && strings[0] === "" && strings[1] === "") {
|
|
229
|
-
return values[0];
|
|
256
|
+
return enforceValidNode(values[0]);
|
|
230
257
|
}
|
|
231
258
|
const items = [];
|
|
232
259
|
let currentText = "";
|
|
233
|
-
|
|
260
|
+
const finalStringIndex = stringsLength - 1;
|
|
261
|
+
for (let i = 0; i < stringsLength; i++) {
|
|
234
262
|
const text = strings[i];
|
|
235
263
|
if (typeof text !== "string") {
|
|
236
264
|
throw new Error("[tamedevil] te must be invoked as a template literal, not a function call.");
|
|
237
265
|
}
|
|
238
266
|
currentText += text;
|
|
239
|
-
if (i <
|
|
240
|
-
const
|
|
241
|
-
const valid = enforceValidNode(rawVal, `template literal placeholder ${i}`);
|
|
267
|
+
if (i < finalStringIndex) {
|
|
268
|
+
const valid = enforceValidNode(values[i], `template literal placeholder ${i}`);
|
|
242
269
|
if (valid[$$type] === "RAW") {
|
|
243
270
|
currentText += valid.t;
|
|
244
271
|
}
|
|
@@ -275,10 +302,15 @@ const teBase = function te(strings, ...values) {
|
|
|
275
302
|
return items.length === 1 ? items[0] : makeQueryNode(items);
|
|
276
303
|
};
|
|
277
304
|
let rawWarningOutput = false;
|
|
305
|
+
// FIXME: should we just straight up remove this method?
|
|
278
306
|
/**
|
|
279
|
-
* Creates a TE
|
|
280
|
-
*
|
|
281
|
-
*
|
|
307
|
+
* Creates a TE node for a raw code string. Just plain ol‘ raw code - EXTREMELY
|
|
308
|
+
* DANGEROUS.
|
|
309
|
+
*
|
|
310
|
+
* This method is dangerous because it involves no escaping, so proceed with
|
|
311
|
+
* caution!
|
|
312
|
+
*
|
|
313
|
+
* It's very very rarely warranted to use this - there is likely a safer way of
|
|
282
314
|
* achieving your goal. DO NOT USE THIS WITH UNTRUSTED INPUT!
|
|
283
315
|
*/
|
|
284
316
|
function raw(text) {
|
|
@@ -288,7 +320,7 @@ function raw(text) {
|
|
|
288
320
|
throw new Error("te.raw first invoked here");
|
|
289
321
|
}
|
|
290
322
|
catch (e) {
|
|
291
|
-
console.warn(`[tamedevil] WARNING: you're using the te.raw escape hatch, usage of this API is rarely required and is highly discouraged. Please be sure this is what you intend. ${e.stack}`);
|
|
323
|
+
console.warn(`[tamedevil] WARNING: you're using the te.raw escape hatch, usage of this API is rarely required and is highly discouraged due to the potential security ramifications. Please be sure this is what you intend. ${e.stack}`);
|
|
292
324
|
}
|
|
293
325
|
}
|
|
294
326
|
if (typeof text !== "string") {
|
|
@@ -298,11 +330,20 @@ function raw(text) {
|
|
|
298
330
|
}
|
|
299
331
|
exports.raw = raw;
|
|
300
332
|
/**
|
|
301
|
-
* Creates a TE
|
|
302
|
-
*
|
|
333
|
+
* Creates a TE node for an arbitrary JS object that will be made available
|
|
334
|
+
* (via a closure) to the final code that will be executed. This value is not
|
|
335
|
+
* serialized or similar, it is passed by reference.
|
|
303
336
|
*/
|
|
304
|
-
function ref(val) {
|
|
305
|
-
|
|
337
|
+
function ref(val, name) {
|
|
338
|
+
if (name != null) {
|
|
339
|
+
if (!isValidVariableName(name)) {
|
|
340
|
+
throw new Error(`Invalid variable name '${name}'`);
|
|
341
|
+
}
|
|
342
|
+
return makeRefNode(val, name);
|
|
343
|
+
}
|
|
344
|
+
else {
|
|
345
|
+
return makeRefNode(val);
|
|
346
|
+
}
|
|
306
347
|
}
|
|
307
348
|
exports.ref = ref;
|
|
308
349
|
const blankNode = makeRawNode(``, "blank");
|
|
@@ -329,7 +370,10 @@ exports.undefined = undefinedNode;
|
|
|
329
370
|
const MAX_SHORT_STRING_LENGTH = 200; // TODO: what should this be?
|
|
330
371
|
const BACKSLASH_CODE = "\\".charCodeAt(0);
|
|
331
372
|
const QUOTE_CODE = '"'.charCodeAt(0);
|
|
332
|
-
|
|
373
|
+
/**
|
|
374
|
+
* Similar to `JSON.stringify(string)`, but faster. Bizarrely this seems to be
|
|
375
|
+
* faster than the regexp approach
|
|
376
|
+
*/
|
|
333
377
|
function stringifyString(value) {
|
|
334
378
|
const l = value.length;
|
|
335
379
|
if (l > MAX_SHORT_STRING_LENGTH) {
|
|
@@ -352,6 +396,9 @@ function stringifyString(value) {
|
|
|
352
396
|
exports.stringifyString = stringifyString;
|
|
353
397
|
// TODO: more optimal stringifier
|
|
354
398
|
// TODO: rename to jsonStringify?
|
|
399
|
+
/**
|
|
400
|
+
* Equivalent to JSON.stringify, but typically faster.
|
|
401
|
+
*/
|
|
355
402
|
const toJSON = (value) => {
|
|
356
403
|
if (value == null)
|
|
357
404
|
return "null";
|
|
@@ -369,8 +416,8 @@ const toJSON = (value) => {
|
|
|
369
416
|
};
|
|
370
417
|
exports.toJSON = toJSON;
|
|
371
418
|
/**
|
|
372
|
-
* If the value is simple will
|
|
373
|
-
* to `te.ref`.
|
|
419
|
+
* If the value is simple this will stringify it and inject it directly into
|
|
420
|
+
* the code to be evaluated, otherwise will defer to `te.ref`.
|
|
374
421
|
*/
|
|
375
422
|
function lit(val) {
|
|
376
423
|
if (val === undefined) {
|
|
@@ -399,14 +446,21 @@ exports.lit = lit;
|
|
|
399
446
|
exports.literal = lit;
|
|
400
447
|
/**
|
|
401
448
|
* If you're building a string and you want to inject untrusted content into it
|
|
402
|
-
* without opening yourself to code injection attacks
|
|
403
|
-
* you.
|
|
449
|
+
* without opening yourself to code injection attacks nor doing awkward string
|
|
450
|
+
* concatenation, this is the method for you. It's essential that you pass the
|
|
451
|
+
* correct type of string that you're embedding into via the `stringType`
|
|
452
|
+
* parameter.
|
|
453
|
+
*
|
|
454
|
+
* Example:
|
|
404
455
|
*
|
|
405
456
|
* ```js
|
|
406
457
|
* const code = te`const str = "abc${te.substring(untrusted, '"')}123";`
|
|
407
458
|
* ```
|
|
408
459
|
*/
|
|
409
460
|
function substring(text, stringType) {
|
|
461
|
+
if (typeof text !== "string" || typeof stringType !== "string") {
|
|
462
|
+
throw new Error(`Invalid call to te.substring`);
|
|
463
|
+
}
|
|
410
464
|
// Quick scan to see if it's safe to use verbatim
|
|
411
465
|
const l = text.length;
|
|
412
466
|
if (l < MAX_SHORT_STRING_LENGTH) {
|
|
@@ -438,7 +492,7 @@ function substring(text, stringType) {
|
|
|
438
492
|
? inner // "" strings already escapes
|
|
439
493
|
: stringType === "'"
|
|
440
494
|
? inner.replace(/'/g, "\\'") // '' strings need `'` escaped too (`\` has already been escaped)
|
|
441
|
-
: inner.replace(/[`$]/g, "\\$&"); // `` strings need both '`' and `$` to be escaped
|
|
495
|
+
: inner.replace(/[`$]/g, "\\$&"); // `` strings need both '`' and `$` to be escaped (`\` has already been escaped)
|
|
442
496
|
// Finally return a raw node
|
|
443
497
|
return makeRawNode(escaped);
|
|
444
498
|
}
|
|
@@ -450,12 +504,17 @@ function subcomment(content) {
|
|
|
450
504
|
return makeRawNode(String(content).replace(/\*\//g, "* /"));
|
|
451
505
|
}
|
|
452
506
|
exports.subcomment = subcomment;
|
|
507
|
+
/**
|
|
508
|
+
* Values that cannot safely be used as the keys on a POJO (`{}`) due to
|
|
509
|
+
* security or similar concerns. For example `__proto__` is disallowed.
|
|
510
|
+
*/
|
|
453
511
|
const disallowedKeys = [
|
|
454
512
|
...Object.getOwnPropertyNames(Object.prototype),
|
|
455
513
|
...Object.getOwnPropertySymbols(Object.prototype),
|
|
456
514
|
];
|
|
457
515
|
/**
|
|
458
|
-
*
|
|
516
|
+
* Returns true if the given key is safe to set as the key of a POJO (without a
|
|
517
|
+
* null prototype), false otherwise.
|
|
459
518
|
*/
|
|
460
519
|
const isSafeObjectPropertyName = (key) => (typeof key === "number" ||
|
|
461
520
|
typeof key === "symbol" ||
|
|
@@ -464,15 +523,20 @@ const isSafeObjectPropertyName = (key) => (typeof key === "number" ||
|
|
|
464
523
|
!disallowedKeys.includes(key);
|
|
465
524
|
exports.isSafeObjectPropertyName = isSafeObjectPropertyName;
|
|
466
525
|
/**
|
|
467
|
-
*
|
|
526
|
+
* Returns true if you can use the given key as the key to a POJO without
|
|
527
|
+
* requiring quote marks or square braces.
|
|
468
528
|
*
|
|
469
529
|
* @remarks
|
|
470
530
|
* Doesn't allow it to start with two underscores.
|
|
471
531
|
*/
|
|
472
|
-
const
|
|
532
|
+
const canBeObjectKeyWithoutQuotes = (key) => Number.isFinite(key) ||
|
|
473
533
|
(typeof key === "string" &&
|
|
474
534
|
(key === "_" || /^(?:[a-z$]|_[a-z0-9$])[a-z0-9_$]*$/i.test(key)));
|
|
475
|
-
|
|
535
|
+
/**
|
|
536
|
+
* If this returns true then the given `name` is allowed to be a variable name
|
|
537
|
+
* in JavaScript. If it returns false then it may or may not be safe to use it
|
|
538
|
+
* as a variable name.
|
|
539
|
+
*/
|
|
476
540
|
function isValidVariableName(name) {
|
|
477
541
|
if (reservedWords_js_1.reservedWords.has(name)) {
|
|
478
542
|
return false;
|
|
@@ -482,8 +546,13 @@ function isValidVariableName(name) {
|
|
|
482
546
|
}
|
|
483
547
|
return true;
|
|
484
548
|
}
|
|
549
|
+
/**
|
|
550
|
+
* Asserts that the given `name` is allowed to be used as an identifier
|
|
551
|
+
* (variable name, function name, etc); and if so it returns a TE node
|
|
552
|
+
* representing this identifier. If disallowed, will throw an error.
|
|
553
|
+
*/
|
|
485
554
|
function identifier(name) {
|
|
486
|
-
if (!isValidVariableName(name)) {
|
|
555
|
+
if (typeof name !== "string" || !isValidVariableName(name)) {
|
|
487
556
|
throw new Error(`Invalid identifier name '${name}'`);
|
|
488
557
|
}
|
|
489
558
|
return makeRawNode(name);
|
|
@@ -491,16 +560,23 @@ function identifier(name) {
|
|
|
491
560
|
exports.identifier = identifier;
|
|
492
561
|
// TODO: rename to `ensureSafeKey` or `safeKeyOrThrow` or something?
|
|
493
562
|
/**
|
|
563
|
+
* Checks that the given `key` is not explicitly disallowed as a key on a POJO and returns a TE node representing it. If disallowed, an error will be thrown. Useful for building easy to read objects:
|
|
564
|
+
*
|
|
565
|
+
* ```js
|
|
566
|
+
* const obj = te.run`return { ${te.identifier("frogs")}: "frogs" }`;
|
|
567
|
+
* ```
|
|
568
|
+
*
|
|
494
569
|
* IMPORTANT: It's strongly recommended that instead of defining an object via
|
|
495
570
|
* `const obj = { ${te.dangerousKey(untrustedKey)}: value }` you instead use
|
|
496
571
|
* `const obj = Object.create(null);` and then set the properties on the resulting
|
|
497
|
-
* object via `${obj}
|
|
498
|
-
* **prototype polution** since properties like `__proto__` are
|
|
499
|
-
* null-prototype objects, whereas they can cause havok in
|
|
572
|
+
* object via `${obj}${te.set(untrustedKey, true)} = value;` - this prevents
|
|
573
|
+
* attacks such as **prototype polution** since properties like `__proto__` are
|
|
574
|
+
* not special on null-prototype objects, whereas they can cause havok in
|
|
575
|
+
* regular `{}` objects (POJOs).
|
|
500
576
|
*/
|
|
501
577
|
function dangerousKey(key) {
|
|
502
578
|
if ((0, exports.isSafeObjectPropertyName)(key)) {
|
|
503
|
-
if ((
|
|
579
|
+
if (canBeObjectKeyWithoutQuotes(key)) {
|
|
504
580
|
return makeRawNode(String(key));
|
|
505
581
|
}
|
|
506
582
|
else {
|
|
@@ -520,6 +596,8 @@ function canAccessViaDot(str) {
|
|
|
520
596
|
* Accesses the key of an object either via `.` or `[]` as appropriate;
|
|
521
597
|
* `obj${te.get(key)}` would become `obj.foo` or `obj["1foo"]` as
|
|
522
598
|
* appropriate.
|
|
599
|
+
*
|
|
600
|
+
* DO NOT USE THIS FOR ASSIGNMENT!
|
|
523
601
|
*/
|
|
524
602
|
function get(key) {
|
|
525
603
|
return typeof key === "string" && canAccessViaDot(key)
|
|
@@ -533,6 +611,8 @@ exports.get = get;
|
|
|
533
611
|
* Accesses the key of an object via optional-chaining:
|
|
534
612
|
* `obj${te.optionalGet(key)}` would become `obj?.foo` or `obj?.["1foo"]` as
|
|
535
613
|
* appropriate.
|
|
614
|
+
*
|
|
615
|
+
* DO NOT USE THIS FOR ASSIGNMENT!
|
|
536
616
|
*/
|
|
537
617
|
function optionalGet(key) {
|
|
538
618
|
return typeof key === "string" && canAccessViaDot(key)
|
|
@@ -544,9 +624,10 @@ function optionalGet(key) {
|
|
|
544
624
|
exports.optionalGet = optionalGet;
|
|
545
625
|
// TODO: rename this. 'leftSet'? 'leftAccess'? 'safeAccess'?
|
|
546
626
|
/**
|
|
547
|
-
*
|
|
548
|
-
* `obj${te.set(key)}` would become `obj.foo` or
|
|
549
|
-
* appropriate.
|
|
627
|
+
* Access to the key of an object either via `.` or `[]` as appropriate ready
|
|
628
|
+
* for being assigned to; `obj${te.set(key)}` would become `obj.foo` or
|
|
629
|
+
* `obj["1foo"]` as appropriate. Note this is different to `get` because it
|
|
630
|
+
* performs additional checks.
|
|
550
631
|
*
|
|
551
632
|
* If the object you're setting properties on has a `null` prototype
|
|
552
633
|
* (`Object.create(null)`) then you can set `hasNullPrototype` to true and all
|
|
@@ -568,12 +649,21 @@ exports.set = set;
|
|
|
568
649
|
* @experimental
|
|
569
650
|
*/
|
|
570
651
|
function tempVar(symbol = Symbol()) {
|
|
652
|
+
if (typeof symbol !== "symbol") {
|
|
653
|
+
throw new Error(`Invalid call to te.tempVar`);
|
|
654
|
+
}
|
|
571
655
|
return makeTemporaryVariableNode(symbol);
|
|
572
656
|
}
|
|
573
657
|
exports.tempVar = tempVar;
|
|
658
|
+
/**
|
|
659
|
+
* @experimental
|
|
660
|
+
*/
|
|
574
661
|
function tmp(obj, callback) {
|
|
662
|
+
const trustedObj = enforceValidNode(obj);
|
|
663
|
+
// ENHANCEMENT: we should be able to reuse these tempvars between tmp calls
|
|
664
|
+
// that aren't nested (or are nested at the same level).
|
|
575
665
|
const varName = te.tempVar();
|
|
576
|
-
return te `(${varName} = ${
|
|
666
|
+
return te `(${varName} = ${trustedObj}, ${callback(varName)})`;
|
|
577
667
|
}
|
|
578
668
|
exports.tmp = tmp;
|
|
579
669
|
function run(fragmentOrStrings, ...values) {
|
|
@@ -583,7 +673,7 @@ function run(fragmentOrStrings, ...values) {
|
|
|
583
673
|
if (values.length > 0) {
|
|
584
674
|
throw new Error("Invalid call to `te.run`");
|
|
585
675
|
}
|
|
586
|
-
const fragment = fragmentOrStrings;
|
|
676
|
+
const fragment = enforceValidNode(fragmentOrStrings);
|
|
587
677
|
const compiled = compile(fragment);
|
|
588
678
|
const argNames = Object.keys(compiled.refs);
|
|
589
679
|
const argValues = Object.values(compiled.refs);
|
|
@@ -607,8 +697,8 @@ function newFunction(...args) {
|
|
|
607
697
|
}
|
|
608
698
|
/**
|
|
609
699
|
* Join some TE items together, optionally separated by a string. Useful when
|
|
610
|
-
* dealing with lists of TE
|
|
611
|
-
*
|
|
700
|
+
* dealing with lists of TE nodes, for example a dynamic list of object
|
|
701
|
+
* properties.
|
|
612
702
|
*/
|
|
613
703
|
function join(items, separator = "") {
|
|
614
704
|
if (!Array.isArray(items)) {
|
|
@@ -631,8 +721,8 @@ function join(items, separator = "") {
|
|
|
631
721
|
const currentItems = [];
|
|
632
722
|
for (let i = 0, l = items.length; i < l; i++) {
|
|
633
723
|
const rawNode = items[i];
|
|
634
|
-
const addSeparator = i > 0 && hasSeparator;
|
|
635
724
|
const node = enforceValidNode(rawNode, `join item ${i}`);
|
|
725
|
+
const addSeparator = i > 0 && hasSeparator;
|
|
636
726
|
if (addSeparator) {
|
|
637
727
|
currentText += separator;
|
|
638
728
|
}
|
|
@@ -670,21 +760,63 @@ function join(items, separator = "") {
|
|
|
670
760
|
: makeQueryNode(currentItems);
|
|
671
761
|
}
|
|
672
762
|
exports.join = join;
|
|
763
|
+
/** @internal */
|
|
673
764
|
function expandQueryNodes(node) {
|
|
674
765
|
return node.n;
|
|
675
766
|
}
|
|
676
767
|
function indent(fragmentOrStrings, ...values) {
|
|
677
768
|
const fragment = "raw" in fragmentOrStrings
|
|
678
769
|
? te(fragmentOrStrings, ...values)
|
|
679
|
-
: fragmentOrStrings;
|
|
770
|
+
: enforceValidNode(fragmentOrStrings);
|
|
680
771
|
if (!isDev) {
|
|
681
772
|
return fragment;
|
|
682
773
|
}
|
|
683
774
|
return makeIndentNode(fragment);
|
|
684
775
|
}
|
|
776
|
+
/**
|
|
777
|
+
* If the given condition is true, the fragment will be wrapped with an indent
|
|
778
|
+
* node, otherwise it will be returned verbatim.
|
|
779
|
+
*/
|
|
685
780
|
function indentIf(condition, fragment) {
|
|
686
|
-
|
|
781
|
+
const trusted = enforceValidNode(fragment);
|
|
782
|
+
return isDev && condition ? makeIndentNode(trusted) : trusted;
|
|
783
|
+
}
|
|
784
|
+
/**
|
|
785
|
+
* Makes safe identifiers
|
|
786
|
+
*
|
|
787
|
+
* @experimental
|
|
788
|
+
* @internal
|
|
789
|
+
*/
|
|
790
|
+
class Idents {
|
|
791
|
+
// Initialized with forbidden words
|
|
792
|
+
idents = new Set(reservedWords_js_1.reservedWords);
|
|
793
|
+
/**
|
|
794
|
+
* Don't allow using these identifiers (presumably because they're already in use).
|
|
795
|
+
*/
|
|
796
|
+
forbid(identifiers) {
|
|
797
|
+
for (const identifier in identifiers) {
|
|
798
|
+
this.idents.add(identifier);
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
makeSafeIdentifier(str) {
|
|
802
|
+
const { idents } = this;
|
|
803
|
+
const safe = str.replace(/[^a-zA-Z0-9_$]+/g, "").replace(/_+/, "_");
|
|
804
|
+
let ident = undefined;
|
|
805
|
+
for (let i = 1; i < 10000; i++) {
|
|
806
|
+
const val = safe + (i > 1 ? String(i) : "");
|
|
807
|
+
if (!idents.has(val)) {
|
|
808
|
+
ident = val;
|
|
809
|
+
break;
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
if (!ident) {
|
|
813
|
+
throw new Error("Too many identifiers!");
|
|
814
|
+
}
|
|
815
|
+
idents.add(ident);
|
|
816
|
+
return ident;
|
|
817
|
+
}
|
|
687
818
|
}
|
|
819
|
+
exports.Idents = Idents;
|
|
688
820
|
const te = teBase;
|
|
689
821
|
exports.te = te;
|
|
690
822
|
exports.default = te;
|
|
@@ -712,7 +844,6 @@ const attributes = {
|
|
|
712
844
|
undefined: undefinedNode,
|
|
713
845
|
blank: blankNode,
|
|
714
846
|
isTE,
|
|
715
|
-
reservedWords: reservedWords_js_1.reservedWords,
|
|
716
847
|
raw,
|
|
717
848
|
};
|
|
718
849
|
Object.entries(attributes).forEach(([exportName, value]) => {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,gEAAgC;AAEhC,yDAAmD;AAu1BjD,8FAv1BO,gCAAa,OAu1BP;AAn1Bf,SAAS,QAAQ,CAAI,KAAQ,EAAE,UAAkB;IAC/C,MAAM,cAAc,GAAI,KAAa,CAAC,QAAQ,CAAC;IAC/C,IAAI,cAAc,EAAE;QAClB,IAAI,cAAc,CAAC,UAAU,KAAK,UAAU,EAAE;YAC5C,MAAM,IAAI,KAAK,CACb,wDAAwD,cAAc,CAAC,UAAU,UAAU,UAAU,GAAG,CACzG,CAAC;SACH;KACF;SAAM;QACL,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,UAAU,EAAE;YACvC,KAAK,EAAE,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE;SAC/C,CAAC,CAAC;KACJ;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,KAAK,aAAa,CAAC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