@patrickdk77/script-defuse 0.0.0-stage → 0.1.0
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 +21 -0
- package/README.md +187 -2
- package/dist/analyze.d.ts +22 -0
- package/dist/analyze.js +770 -0
- package/dist/api.d.ts +82 -0
- package/dist/api.js +698 -0
- package/dist/engine.d.ts +12 -0
- package/dist/engine.js +18 -0
- package/dist/findings.d.ts +19 -0
- package/dist/findings.js +79 -0
- package/dist/formcalc.d.ts +10 -0
- package/dist/formcalc.js +792 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +32 -0
- package/dist/index.mjs +3 -0
- package/dist/plugins.d.ts +28 -0
- package/dist/plugins.js +29 -0
- package/dist/score.d.ts +17 -0
- package/dist/score.js +51 -0
- package/dist/types.d.ts +130 -0
- package/dist/types.js +70 -0
- package/package.json +84 -4
package/dist/api.d.ts
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { ScriptCategory as C, ScriptDetail as D } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* What a value is, as far as the rules need to know. Host kinds are the viewer's objects; the rest are plain data,
|
|
4
|
+
* which can reach nothing outside the script.
|
|
5
|
+
*/
|
|
6
|
+
export type Kind = 'doc' | 'field' | 'fields' | 'event' | 'app' | 'util' | 'color' | 'console' | 'constant' | 'math' | 'builtin' | 'xmldata' | 'xfa' | 'xfahost' | 'xfalayout' | 'xfaevent' | 'node' | 'number' | 'string' | 'data' | 'unknown';
|
|
7
|
+
export declare const HOST_KINDS: ReadonlySet<Kind>;
|
|
8
|
+
/** A member of a host object: allowed, giving a value of `kind`, or a finding. */
|
|
9
|
+
export type Member = {
|
|
10
|
+
kind: Kind;
|
|
11
|
+
write?: boolean;
|
|
12
|
+
} | {
|
|
13
|
+
finding: [C, D];
|
|
14
|
+
};
|
|
15
|
+
/** The document: `this`, and what an unqualified name falls back to in a viewer. */
|
|
16
|
+
export declare const DOC: ReadonlyMap<string, Member>;
|
|
17
|
+
/**
|
|
18
|
+
* Every member Acrobat's Doc object has, form or not. A script that sets one of these on the document, or assigns to
|
|
19
|
+
* it as a bare name, sets the document's own property; any other name it sets is a global of its own.
|
|
20
|
+
*/
|
|
21
|
+
export declare const DOC_ALL: ReadonlySet<string>;
|
|
22
|
+
/**
|
|
23
|
+
* A form field, from getField, event.target or event.source: Acrobat's whole Field object. Since every member it has
|
|
24
|
+
* is here, any other name on a field is one the form set itself, such as event.target.oldVal.
|
|
25
|
+
*/
|
|
26
|
+
export declare const FIELD: ReadonlyMap<string, Member>;
|
|
27
|
+
/** `event`, the object a field or document script runs for. */
|
|
28
|
+
export declare const EVENT: ReadonlyMap<string, Member>;
|
|
29
|
+
/** `app`, the viewer. Message boxes and version checks only. */
|
|
30
|
+
export declare const APP: ReadonlyMap<string, Member>;
|
|
31
|
+
/** `util`: formatting and parsing text, numbers and dates. */
|
|
32
|
+
export declare const UTIL: ReadonlyMap<string, Member>;
|
|
33
|
+
export declare const COLOR: ReadonlyMap<string, Member>;
|
|
34
|
+
export declare const CONSOLE: ReadonlyMap<string, Member>;
|
|
35
|
+
/** `XMLData`, which parses XML text a form holds and queries it. Its parse is checked for entities on its own. */
|
|
36
|
+
export declare const XMLDATA: ReadonlyMap<string, Member>;
|
|
37
|
+
/** Namespaces of constants a form script reads, such as display.hidden. Any member of them is a constant. */
|
|
38
|
+
export declare const CONSTANT_ROOTS: ReadonlySet<string>;
|
|
39
|
+
/** Acrobat's AForm helpers, which format, check and calculate fields. */
|
|
40
|
+
export declare const AFORM: ReadonlySet<string>;
|
|
41
|
+
/** Global functions and namespaces of the language itself that compute on data. */
|
|
42
|
+
export declare const BUILTIN_FUNCTIONS: ReadonlyMap<string, Kind>;
|
|
43
|
+
/** Namespaces whose members are pure computation, apart from the ones named in BUILTIN_DENY. */
|
|
44
|
+
export declare const BUILTIN_NAMESPACES: ReadonlySet<string>;
|
|
45
|
+
/** Members of those namespaces that hide text or reach the machinery behind objects. */
|
|
46
|
+
export declare const BUILTIN_DENY: ReadonlyMap<string, Member>;
|
|
47
|
+
/** Global names that are themselves a finding, wherever they appear. */
|
|
48
|
+
export declare const DENIED_GLOBALS: ReadonlyMap<string, Member>;
|
|
49
|
+
/** Member names that reach the language machinery on any value. */
|
|
50
|
+
export declare const MACHINERY: ReadonlySet<string>;
|
|
51
|
+
/**
|
|
52
|
+
* Member names a viewer object has that are not form computation. A plain value, such as a function's parameter,
|
|
53
|
+
* might hold a viewer object, so one of these names on it gets the finding the object would have.
|
|
54
|
+
*/
|
|
55
|
+
export declare const HOST_DENY: ReadonlyMap<string, Member>;
|
|
56
|
+
/**
|
|
57
|
+
* `xfa`, the root of an XFA form's object model. Its models are trees of form nodes, apart from the host, the
|
|
58
|
+
* layout and the event, and the connections, sources and signatures that reach outside the form.
|
|
59
|
+
*/
|
|
60
|
+
export declare const XFA_ROOT: ReadonlyMap<string, Member>;
|
|
61
|
+
/** `xfa.host`, the viewer as an XFA form sees it. Message boxes, focus, pages and version checks. */
|
|
62
|
+
export declare const XFA_HOST: ReadonlyMap<string, Member>;
|
|
63
|
+
/** `xfa.layout`: where nodes fall on pages. */
|
|
64
|
+
export declare const XFA_LAYOUT: ReadonlyMap<string, Member>;
|
|
65
|
+
/**
|
|
66
|
+
* `event` in an XFA script, and `xfa.event`: the XFA event's members and those of Acrobat's event object. Its target
|
|
67
|
+
* is the Acrobat document.
|
|
68
|
+
*/
|
|
69
|
+
export declare const XFA_EVENT: ReadonlyMap<string, Member>;
|
|
70
|
+
/** Members of a form node that hold its value, rather than another node. Any other member is a node. */
|
|
71
|
+
export declare const NODE_VALUES: ReadonlyMap<string, Kind>;
|
|
72
|
+
/**
|
|
73
|
+
* Members of form nodes, and of XFA's host and connections reached through a node, that leave the form or run what
|
|
74
|
+
* the form did not carry. A node can be any object of the model, so any of these names on one is a finding.
|
|
75
|
+
*/
|
|
76
|
+
export declare const NODE_DENY: ReadonlyMap<string, Member>;
|
|
77
|
+
/** Node types a script may not create: they would carry script, actions or content from outside the form. */
|
|
78
|
+
export declare const CODE_NODES: ReadonlySet<string>;
|
|
79
|
+
/** Attributes of a node that name something outside the form. */
|
|
80
|
+
export declare const URL_ATTRIBUTES: ReadonlySet<string>;
|
|
81
|
+
/** Roots of the SOM in an XFA script, written with `$`. `!` is the datasets model. */
|
|
82
|
+
export declare const SOM_ROOTS: ReadonlyMap<string, Kind | Member>;
|