@parallax-rn/protocol 0.0.0-stage → 0.1.0-beta.11
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 +72 -0
- package/README.md +34 -2
- package/contract.snapshot.json +1142 -0
- package/dist/contract.d.ts +517 -0
- package/dist/contract.js +264 -0
- package/dist/errors.d.ts +6 -0
- package/dist/errors.js +37 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +63 -0
- package/dist/metro-requests.d.ts +2 -0
- package/dist/metro-requests.js +15 -0
- package/dist/names.d.ts +5 -0
- package/dist/names.js +9 -0
- package/dist/registration.d.ts +3 -0
- package/dist/registration.js +24 -0
- package/dist/rules.d.ts +43 -0
- package/dist/rules.js +159 -0
- package/dist/schema.d.ts +85 -0
- package/dist/schema.js +167 -0
- package/dist/source-id.d.ts +7 -0
- package/dist/source-id.js +25 -0
- package/dist/sources.d.ts +9 -0
- package/dist/sources.js +22 -0
- package/dist/version.d.ts +17 -0
- package/dist/version.js +30 -0
- package/package.json +20 -4
package/dist/contract.js
ADDED
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseErrorShape = exports.parseSourceData = exports.parseSourceTable = exports.parseCommandResult = exports.parseCommandCall = exports.parseCommandList = exports.parsePushBatch = exports.parseDrainResult = exports.parseDrainRequest = exports.parseHandshake = exports.SDK_API = exports.schemas = exports.sourceTableT = exports.sourceRowT = exports.errorShapeT = exports.commandResultT = exports.commandCallT = exports.commandListT = exports.commandInfoT = exports.pushBatchT = exports.drainResultT = exports.drainRequestT = exports.handshakeT = exports.navigationEntryT = exports.stateEntryT = exports.networkEntryT = exports.sourceEntryT = exports.bufferStateT = exports.errorEntryT = exports.logEntryT = exports.logLevelT = exports.protocolVersionT = void 0;
|
|
4
|
+
exports.sourceDataType = sourceDataType;
|
|
5
|
+
exports.parseJson = parseJson;
|
|
6
|
+
exports.describeContract = describeContract;
|
|
7
|
+
exports.contractSnapshotText = contractSnapshotText;
|
|
8
|
+
exports.planContractSnapshotUpdate = planContractSnapshotUpdate;
|
|
9
|
+
// The data contract between the app (SDK and build plugin) and the server. Every wire shape is defined once as a
|
|
10
|
+
// schema (schema.ts): the TypeScript type, the validator and the canonical description in the contract snapshot
|
|
11
|
+
// all come from the same definition. Changing anything here changes the snapshot, which requires a version bump.
|
|
12
|
+
const errors_js_1 = require("./errors.js");
|
|
13
|
+
const names_js_1 = require("./names.js");
|
|
14
|
+
const schema_js_1 = require("./schema.js");
|
|
15
|
+
const source_id_js_1 = require("./source-id.js");
|
|
16
|
+
const sources_js_1 = require("./sources.js");
|
|
17
|
+
const version_js_1 = require("./version.js");
|
|
18
|
+
const seq = schema_js_1.t.int(1);
|
|
19
|
+
exports.protocolVersionT = schema_js_1.t.tuple([schema_js_1.t.int(0), schema_js_1.t.int(0)]);
|
|
20
|
+
// ---- ring buffers ---------------------------------------------------------------------------------------------
|
|
21
|
+
exports.logLevelT = schema_js_1.t.enumOf(['debug', 'log', 'info', 'warn', 'error']);
|
|
22
|
+
/** `truncated` is true when the SDK cut the message to its per-entry size cap. */
|
|
23
|
+
exports.logEntryT = schema_js_1.t.object({ seq, time: schema_js_1.t.number(), level: exports.logLevelT, message: schema_js_1.t.string(), truncated: schema_js_1.t.boolean() }, ['truncated']);
|
|
24
|
+
/** `truncated` is true when the SDK cut the message or the stack to its per-entry size cap. */
|
|
25
|
+
exports.errorEntryT = schema_js_1.t.object({ seq, time: schema_js_1.t.number(), message: schema_js_1.t.string(), name: schema_js_1.t.string(), stack: schema_js_1.t.string(), fatal: schema_js_1.t.boolean(), truncated: schema_js_1.t.boolean() }, ['name', 'stack', 'truncated']);
|
|
26
|
+
/** `last` is 0 until the first entry; `first` is the oldest retained seq (last + 1 when empty); `dropped` counts evictions since the context started. */
|
|
27
|
+
exports.bufferStateT = schema_js_1.t.object({ first: schema_js_1.t.int(0), last: schema_js_1.t.int(0), dropped: schema_js_1.t.int(0) });
|
|
28
|
+
/**
|
|
29
|
+
* One entry of a namespaced data source (protocol 0.5): `seq` is per source and per context like the logs', `data` is the source's own payload.
|
|
30
|
+
* The SDK redacts secrets before it sends anything; the core redacts again before it stores (a source's own rule).
|
|
31
|
+
*/
|
|
32
|
+
exports.sourceEntryT = schema_js_1.t.object({ seq, time: schema_js_1.t.number(), data: schema_js_1.t.unknown() });
|
|
33
|
+
// ---- typed `data` of the built-in kinds of source (protocol 0.6, plan 0013) -----------------------------------------
|
|
34
|
+
// `sourceEntryT.data` stays `unknown` on the wire (a newer SDK may carry kinds this build does not know); for the kinds below `parseSourceData` checks it, and the core
|
|
35
|
+
// drops and counts an entry that does not match. Every field after `via` is optional so that a producer sends only what it has.
|
|
36
|
+
/** One finished or failed request of the `network` source (a request still in flight is not an entry). Times are epoch milliseconds; headers are as captured (the agent paths scrub them). */
|
|
37
|
+
exports.networkEntryT = schema_js_1.t.object({
|
|
38
|
+
/** The request's id as its producer knows it (the debugger's `requestId`, the SDK's counter). */
|
|
39
|
+
id: schema_js_1.t.string(),
|
|
40
|
+
method: schema_js_1.t.string(),
|
|
41
|
+
url: schema_js_1.t.string(),
|
|
42
|
+
startedAt: schema_js_1.t.number(),
|
|
43
|
+
/** Who captured it: the debugger's Network domain or the SDK's XHR wrapper. */
|
|
44
|
+
via: schema_js_1.t.enumOf(['cdp', 'sdk']),
|
|
45
|
+
/** Absent when the request failed before a response. */
|
|
46
|
+
status: schema_js_1.t.int(0),
|
|
47
|
+
statusText: schema_js_1.t.string(),
|
|
48
|
+
mimeType: schema_js_1.t.string(),
|
|
49
|
+
durationMs: schema_js_1.t.number(),
|
|
50
|
+
requestHeaders: schema_js_1.t.record(schema_js_1.t.string()),
|
|
51
|
+
responseHeaders: schema_js_1.t.record(schema_js_1.t.string()),
|
|
52
|
+
requestBody: schema_js_1.t.string(),
|
|
53
|
+
requestBodyBytes: schema_js_1.t.int(0),
|
|
54
|
+
responseBody: schema_js_1.t.string(),
|
|
55
|
+
responseBodyBytes: schema_js_1.t.int(0),
|
|
56
|
+
/** `kept`: `responseBody` is the text; `not_fetched`: it can be asked for; `unavailable`: the app no longer holds it; `binary`: only its type and size are known; `cut`: `responseBody` is the start. */
|
|
57
|
+
responseBodyState: schema_js_1.t.enumOf(['kept', 'not_fetched', 'unavailable', 'binary', 'cut']),
|
|
58
|
+
encodedBytes: schema_js_1.t.int(0),
|
|
59
|
+
failed: schema_js_1.t.boolean(),
|
|
60
|
+
errorText: schema_js_1.t.string(),
|
|
61
|
+
canceled: schema_js_1.t.boolean(),
|
|
62
|
+
/** The call-site stack text of the request (symbolicated on demand). */
|
|
63
|
+
initiator: schema_js_1.t.string(),
|
|
64
|
+
/** The id of the request this one is the redirect of. */
|
|
65
|
+
redirectedFrom: schema_js_1.t.string(),
|
|
66
|
+
}, ['status', 'statusText', 'mimeType', 'durationMs', 'requestHeaders', 'responseHeaders', 'requestBody', 'requestBodyBytes', 'responseBody', 'responseBodyBytes', 'responseBodyState', 'encodedBytes', 'failed', 'errorText', 'canceled', 'initiator', 'redirectedFrom']);
|
|
67
|
+
/** One snapshot of an app store (`state:<name>`: Redux, Zustand, any `getState`/`subscribe` object) or of a TanStack Query client (`query:<name>`). `state` is the capped, masked value. */
|
|
68
|
+
exports.stateEntryT = schema_js_1.t.object({ kind: schema_js_1.t.enumOf(['snapshot', 'query']), state: schema_js_1.t.unknown(), changedKeys: schema_js_1.t.array(schema_js_1.t.string()), action: schema_js_1.t.string(), truncated: schema_js_1.t.boolean() }, ['changedKeys', 'action', 'truncated']);
|
|
69
|
+
/** One state of the app's navigation container (`navigation`): the focused route, its params, the path when there is one, the route names from the root, the nested state (capped), and who read it: `adapter` (the SDK's `registerNavigation`, with history) or `generic` (the injected fiber read, a snapshot). */
|
|
70
|
+
exports.navigationEntryT = schema_js_1.t.object({ kind: schema_js_1.t.enumOf(['state']), route: schema_js_1.t.string(), params: schema_js_1.t.unknown(), path: schema_js_1.t.string(), stack: schema_js_1.t.array(schema_js_1.t.string()), rootState: schema_js_1.t.unknown(), producer: schema_js_1.t.enumOf(['adapter', 'generic']) }, ['params', 'path', 'rootState', 'producer']);
|
|
71
|
+
// ---- SDK API (every method takes zero or one JSON string and returns a JSON string, because binding payloads must be strings) ----
|
|
72
|
+
exports.handshakeT = schema_js_1.t.object({
|
|
73
|
+
protocol: exports.protocolVersionT,
|
|
74
|
+
/** Version of the `@parallax-rn/sdk` package, for diagnostics only. */
|
|
75
|
+
sdk: schema_js_1.t.string(),
|
|
76
|
+
/** Changes whenever the JS context is recreated (reload, native restart); the server uses it to detect history resets. */
|
|
77
|
+
contextId: schema_js_1.t.string(),
|
|
78
|
+
startedAt: schema_js_1.t.number(),
|
|
79
|
+
buffers: schema_js_1.t.object({ logs: exports.bufferStateT, errors: exports.bufferStateT }),
|
|
80
|
+
/** Protocol 0.5: the namespaced data sources the app has, by name (see `sources.ts`), each with its buffer. Absent in 0.4 and older. */
|
|
81
|
+
sources: schema_js_1.t.record(exports.bufferStateT),
|
|
82
|
+
}, ['sources']);
|
|
83
|
+
/** Cursors are the last seq the caller has seen (0 = from the start). */
|
|
84
|
+
/** Protocol 0.5: `sources` carries a cursor per source the caller wants (absent: none asked for). */
|
|
85
|
+
exports.drainRequestT = schema_js_1.t.object({ logs: schema_js_1.t.int(0), errors: schema_js_1.t.int(0), limit: schema_js_1.t.int(1), sources: schema_js_1.t.record(schema_js_1.t.int(0)) }, ['limit', 'sources']);
|
|
86
|
+
const logsDrainT = schema_js_1.t.object({ entries: schema_js_1.t.array(exports.logEntryT), next: schema_js_1.t.int(0), dropped: schema_js_1.t.int(0) });
|
|
87
|
+
const errorsDrainT = schema_js_1.t.object({ entries: schema_js_1.t.array(exports.errorEntryT), next: schema_js_1.t.int(0), dropped: schema_js_1.t.int(0) });
|
|
88
|
+
/** `next` is the highest seq returned (or the request cursor when nothing was returned); `dropped` counts entries evicted before they could be returned. */
|
|
89
|
+
const sourceDrainT = schema_js_1.t.object({ entries: schema_js_1.t.array(exports.sourceEntryT), next: schema_js_1.t.int(0), dropped: schema_js_1.t.int(0) });
|
|
90
|
+
exports.drainResultT = schema_js_1.t.object({ contextId: schema_js_1.t.string(), logs: logsDrainT, errors: errorsDrainT, sources: schema_js_1.t.record(sourceDrainT) }, ['sources']);
|
|
91
|
+
/** The payload of one push through the binding. Continuity is judged by seq against the caller's cursor; a gap triggers a drain. */
|
|
92
|
+
exports.pushBatchT = schema_js_1.t.object({ contextId: schema_js_1.t.string(), logs: schema_js_1.t.array(exports.logEntryT), errors: schema_js_1.t.array(exports.errorEntryT), sources: schema_js_1.t.record(schema_js_1.t.array(exports.sourceEntryT)) }, ['sources']);
|
|
93
|
+
/** `argsHint` is a short human-readable description of the arguments the command accepts, for example `{ id: string }`; omitted when it takes none. */
|
|
94
|
+
exports.commandInfoT = schema_js_1.t.object({ name: schema_js_1.t.string(), description: schema_js_1.t.string(), argsHint: schema_js_1.t.string() }, ['description', 'argsHint']);
|
|
95
|
+
exports.commandListT = schema_js_1.t.array(exports.commandInfoT);
|
|
96
|
+
exports.commandCallT = schema_js_1.t.object({ name: schema_js_1.t.string(), args: schema_js_1.t.unknown() }, ['args']);
|
|
97
|
+
exports.commandResultT = schema_js_1.t.union([
|
|
98
|
+
schema_js_1.t.object({ ok: schema_js_1.t.literal(true), value: schema_js_1.t.unknown() }),
|
|
99
|
+
schema_js_1.t.object({
|
|
100
|
+
ok: schema_js_1.t.literal(false),
|
|
101
|
+
error: schema_js_1.t.object({ code: schema_js_1.t.enumOf(['command_not_found', 'command_failed']), message: schema_js_1.t.string() }),
|
|
102
|
+
}),
|
|
103
|
+
]);
|
|
104
|
+
// ---- errors surfaced to agents -----------------------------------------------------------------------------------
|
|
105
|
+
exports.errorShapeT = schema_js_1.t.object({ code: schema_js_1.t.enumOf(errors_js_1.ERROR_CODES), message: schema_js_1.t.string(), hint: schema_js_1.t.string() }, ['hint']);
|
|
106
|
+
// ---- source tables written by the build plugin ---------------------------------------------------------------------
|
|
107
|
+
/**
|
|
108
|
+
* One JSX element, in this order: element number in the file (n), line, column (1-based, at the `<`), tag name,
|
|
109
|
+
* enclosing component name, its declaration line, its declaration column, whether a testID was injected
|
|
110
|
+
* (see injectedTestId), the user's own testID (a literal, or a pattern with `*` for dynamic parts) and the module
|
|
111
|
+
* specifier the tag was imported from. Extra trailing items are ignored by readers.
|
|
112
|
+
*/
|
|
113
|
+
exports.sourceRowT = schema_js_1.t.tuple([
|
|
114
|
+
schema_js_1.t.int(0),
|
|
115
|
+
schema_js_1.t.int(1),
|
|
116
|
+
schema_js_1.t.int(1),
|
|
117
|
+
schema_js_1.t.string(),
|
|
118
|
+
schema_js_1.t.union([schema_js_1.t.string(), schema_js_1.t.null()]),
|
|
119
|
+
schema_js_1.t.union([schema_js_1.t.int(1), schema_js_1.t.null()]),
|
|
120
|
+
schema_js_1.t.union([schema_js_1.t.int(1), schema_js_1.t.null()]),
|
|
121
|
+
schema_js_1.t.boolean(),
|
|
122
|
+
schema_js_1.t.union([schema_js_1.t.string(), schema_js_1.t.null()]),
|
|
123
|
+
schema_js_1.t.union([schema_js_1.t.string(), schema_js_1.t.null()]),
|
|
124
|
+
]);
|
|
125
|
+
exports.sourceTableT = schema_js_1.t.object({
|
|
126
|
+
/** The protocol version this table was written for. */
|
|
127
|
+
p: exports.protocolVersionT,
|
|
128
|
+
file: schema_js_1.t.relativePath(),
|
|
129
|
+
/** Whether the plugin was configured to inject testIDs for this build. */
|
|
130
|
+
injected: schema_js_1.t.boolean(),
|
|
131
|
+
/**
|
|
132
|
+
* The version of `@parallax-rn/babel-plugin` that wrote the table. A reader compares it with the installed plugin: Metro's transform cache
|
|
133
|
+
* does not notice a plugin update, so tables from an older version are stale (they point at wrong lines) until the cache is reset.
|
|
134
|
+
*/
|
|
135
|
+
plugin: schema_js_1.t.string(),
|
|
136
|
+
/**
|
|
137
|
+
* The plugin's `root` option relative to the directory Babel ran in (`""` when they are the same, `"../.."` for a monorepo root two levels up).
|
|
138
|
+
* `file` is relative to that root, so a reader finds the file at `<project root>/<root>/<file>`. Never absolute: the table ships in the bundle.
|
|
139
|
+
*/
|
|
140
|
+
root: schema_js_1.t.string(),
|
|
141
|
+
/** Components declared in the file: name, line, column. */
|
|
142
|
+
comps: schema_js_1.t.array(schema_js_1.t.tuple([schema_js_1.t.string(), schema_js_1.t.int(1), schema_js_1.t.int(1)])),
|
|
143
|
+
els: schema_js_1.t.array(exports.sourceRowT),
|
|
144
|
+
}, ['plugin', 'root']);
|
|
145
|
+
exports.schemas = {
|
|
146
|
+
protocolVersion: exports.protocolVersionT,
|
|
147
|
+
logEntry: exports.logEntryT,
|
|
148
|
+
errorEntry: exports.errorEntryT,
|
|
149
|
+
bufferState: exports.bufferStateT,
|
|
150
|
+
sourceEntry: exports.sourceEntryT,
|
|
151
|
+
networkEntry: exports.networkEntryT,
|
|
152
|
+
stateEntry: exports.stateEntryT,
|
|
153
|
+
navigationEntry: exports.navigationEntryT,
|
|
154
|
+
handshake: exports.handshakeT,
|
|
155
|
+
drainRequest: exports.drainRequestT,
|
|
156
|
+
drainResult: exports.drainResultT,
|
|
157
|
+
pushBatch: exports.pushBatchT,
|
|
158
|
+
commandInfo: exports.commandInfoT,
|
|
159
|
+
commandCall: exports.commandCallT,
|
|
160
|
+
commandResult: exports.commandResultT,
|
|
161
|
+
errorShape: exports.errorShapeT,
|
|
162
|
+
sourceRow: exports.sourceRowT,
|
|
163
|
+
sourceTable: exports.sourceTableT,
|
|
164
|
+
};
|
|
165
|
+
/** The SDK methods and the schema each takes and returns (null: none). */
|
|
166
|
+
exports.SDK_API = {
|
|
167
|
+
handshake: { input: null, output: 'handshake', async: false },
|
|
168
|
+
drain: { input: 'drainRequest', output: 'drainResult', async: false },
|
|
169
|
+
commands: { input: null, output: 'commandInfo[]', async: false },
|
|
170
|
+
call: { input: 'commandCall', output: 'commandResult', async: true },
|
|
171
|
+
};
|
|
172
|
+
// ---- parsers (the server drops invalid messages and counts them) ----------------------------------------------
|
|
173
|
+
const parseHandshake = (value) => (0, schema_js_1.parse)(exports.handshakeT, value);
|
|
174
|
+
exports.parseHandshake = parseHandshake;
|
|
175
|
+
const parseDrainRequest = (value) => (0, schema_js_1.parse)(exports.drainRequestT, value);
|
|
176
|
+
exports.parseDrainRequest = parseDrainRequest;
|
|
177
|
+
const parseDrainResult = (value) => (0, schema_js_1.parse)(exports.drainResultT, value);
|
|
178
|
+
exports.parseDrainResult = parseDrainResult;
|
|
179
|
+
const parsePushBatch = (value) => (0, schema_js_1.parse)(exports.pushBatchT, value);
|
|
180
|
+
exports.parsePushBatch = parsePushBatch;
|
|
181
|
+
const parseCommandList = (value) => (0, schema_js_1.parse)(exports.commandListT, value);
|
|
182
|
+
exports.parseCommandList = parseCommandList;
|
|
183
|
+
const parseCommandCall = (value) => (0, schema_js_1.parse)(exports.commandCallT, value);
|
|
184
|
+
exports.parseCommandCall = parseCommandCall;
|
|
185
|
+
const parseCommandResult = (value) => (0, schema_js_1.parse)(exports.commandResultT, value);
|
|
186
|
+
exports.parseCommandResult = parseCommandResult;
|
|
187
|
+
const parseSourceTable = (value) => (0, schema_js_1.parse)(exports.sourceTableT, value);
|
|
188
|
+
exports.parseSourceTable = parseSourceTable;
|
|
189
|
+
/** The typed schema for the `data` of a source, by name: `network`, `navigation`, and `state:*` / `query:*`; null for a kind this build has no schema for. */
|
|
190
|
+
function sourceDataType(name) {
|
|
191
|
+
const kind = (0, sources_js_1.sourceKind)(name);
|
|
192
|
+
return kind === 'network' ? exports.networkEntryT : kind === 'navigation' ? exports.navigationEntryT : kind === 'state' || kind === 'query' ? exports.stateEntryT : null;
|
|
193
|
+
}
|
|
194
|
+
/** Checks one entry's `data` against its source's schema (a source without one passes). */
|
|
195
|
+
const parseSourceData = (name, value) => {
|
|
196
|
+
const type = sourceDataType(name);
|
|
197
|
+
return type === null ? { ok: true, value } : (0, schema_js_1.parse)(type, value);
|
|
198
|
+
};
|
|
199
|
+
exports.parseSourceData = parseSourceData;
|
|
200
|
+
const parseErrorShape = (value) => (0, schema_js_1.parse)(exports.errorShapeT, value);
|
|
201
|
+
exports.parseErrorShape = parseErrorShape;
|
|
202
|
+
/** Parses JSON text first; returns an error result instead of throwing. */
|
|
203
|
+
function parseJson(type, text) {
|
|
204
|
+
let value;
|
|
205
|
+
try {
|
|
206
|
+
value = JSON.parse(text);
|
|
207
|
+
}
|
|
208
|
+
catch (error) {
|
|
209
|
+
return { ok: false, error: `invalid JSON: ${error instanceof Error ? error.message : String(error)}` };
|
|
210
|
+
}
|
|
211
|
+
return (0, schema_js_1.parse)(type, value);
|
|
212
|
+
}
|
|
213
|
+
/** The canonical description of the whole contract; the snapshot test compares it with the committed snapshot. */
|
|
214
|
+
function describeContract() {
|
|
215
|
+
const described = {};
|
|
216
|
+
for (const name of Object.keys(exports.schemas))
|
|
217
|
+
described[name] = exports.schemas[name].schema;
|
|
218
|
+
return {
|
|
219
|
+
protocol: version_js_1.PROTOCOL_VERSION,
|
|
220
|
+
globalName: names_js_1.GLOBAL_NAME,
|
|
221
|
+
pushBindingName: names_js_1.PUSH_BINDING_NAME,
|
|
222
|
+
injectedIdPrefix: source_id_js_1.INJECTED_ID_PREFIX,
|
|
223
|
+
builtInSources: sources_js_1.BUILT_IN_SOURCES,
|
|
224
|
+
sourceNamePattern: sources_js_1.SOURCE_NAME_PATTERN,
|
|
225
|
+
errorCodes: errors_js_1.ERROR_CODES,
|
|
226
|
+
warningCodes: errors_js_1.WARNING_CODES,
|
|
227
|
+
sdkApi: exports.SDK_API,
|
|
228
|
+
commandListItem: exports.commandInfoT.schema,
|
|
229
|
+
schemas: described,
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
function contractSnapshotText() {
|
|
233
|
+
return (0, schema_js_1.canonicalJson)(describeContract()) + '\n';
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Decides what to do with the committed contract snapshot. A changed contract may only be recorded together with a
|
|
237
|
+
* changed protocol version, so a change cannot slip in without a deliberate version decision (decision 0012).
|
|
238
|
+
*/
|
|
239
|
+
function planContractSnapshotUpdate(existing, next, options = {}) {
|
|
240
|
+
if (existing === null)
|
|
241
|
+
return { action: 'write', reason: 'no snapshot yet' };
|
|
242
|
+
if (existing === next)
|
|
243
|
+
return { action: 'unchanged', reason: 'the contract matches the snapshot' };
|
|
244
|
+
let before;
|
|
245
|
+
let after;
|
|
246
|
+
try {
|
|
247
|
+
before = JSON.parse(existing).protocol;
|
|
248
|
+
after = JSON.parse(next).protocol;
|
|
249
|
+
}
|
|
250
|
+
catch {
|
|
251
|
+
return { action: 'write', reason: 'the existing snapshot is not valid JSON' };
|
|
252
|
+
}
|
|
253
|
+
if (JSON.stringify(before) === JSON.stringify(after)) {
|
|
254
|
+
if (options.allowUnchangedVersion === true) {
|
|
255
|
+
return { action: 'write', reason: `the contract changed under the unchanged protocol version ${JSON.stringify(after)}; explicitly allowed (call it out in the commit message)` };
|
|
256
|
+
}
|
|
257
|
+
return {
|
|
258
|
+
action: 'refuse',
|
|
259
|
+
reason: `the contract changed but PROTOCOL_VERSION is still ${JSON.stringify(after)}. Bump it in version.ts ` +
|
|
260
|
+
'(minor for additive changes, major for removing, renaming or changing the meaning of anything), rebuild and run again.',
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
return { action: 'write', reason: `the contract changed together with the protocol version (${JSON.stringify(before)} -> ${JSON.stringify(after)})` };
|
|
264
|
+
}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const ERROR_CODES: readonly ['metro_unreachable', 'no_app_target', 'rn_unsupported', 'reconnecting', 'app_reloading', 'vm_paused', 'timeout', 'tree_unavailable', 'sdk_missing', 'sdk_not_ready', 'command_not_found', 'command_failed', 'invalid_input', 'no_simulator', 'device_not_booted', 'axe_missing', 'element_not_found', 'app_not_frontmost', 'denied_by_user', 'core_unavailable', 'core_version_mismatch'];
|
|
2
|
+
export type ErrorCode = (typeof ERROR_CODES)[number];
|
|
3
|
+
export declare const WARNING_CODES: readonly ['protocol_mismatch', 'invalid_messages_dropped'];
|
|
4
|
+
export type WarningCode = (typeof WARNING_CODES)[number];
|
|
5
|
+
export declare function isErrorCode(value: unknown): value is ErrorCode;
|
|
6
|
+
//# sourceMappingURL=errors.d.ts.map
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Stable error and warning codes shared by the tool layer, the connection layer and the SDK. Part of the contract:
|
|
3
|
+
// adding a code is a minor change, removing or renaming one is a major change.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.WARNING_CODES = exports.ERROR_CODES = void 0;
|
|
6
|
+
exports.isErrorCode = isErrorCode;
|
|
7
|
+
exports.ERROR_CODES = [
|
|
8
|
+
'metro_unreachable',
|
|
9
|
+
'no_app_target',
|
|
10
|
+
'rn_unsupported',
|
|
11
|
+
'reconnecting',
|
|
12
|
+
// A call was interrupted by a reload of the app: agents treat it as "retry", not as a failure.
|
|
13
|
+
'app_reloading',
|
|
14
|
+
'vm_paused',
|
|
15
|
+
'timeout',
|
|
16
|
+
'tree_unavailable',
|
|
17
|
+
'sdk_missing',
|
|
18
|
+
'sdk_not_ready',
|
|
19
|
+
'command_not_found',
|
|
20
|
+
'command_failed',
|
|
21
|
+
'invalid_input',
|
|
22
|
+
'no_simulator',
|
|
23
|
+
'device_not_booted',
|
|
24
|
+
'axe_missing',
|
|
25
|
+
'element_not_found',
|
|
26
|
+
'app_not_frontmost',
|
|
27
|
+
// The core (decision 0016): the user declined an action in the app. Agents must not retry it unless the user asks.
|
|
28
|
+
'denied_by_user',
|
|
29
|
+
// The core did not answer, or went away while a call was in flight (the outcome of a call that was already sent is unknown).
|
|
30
|
+
'core_unavailable',
|
|
31
|
+
// The core and the shim speak protocols that are too far apart; the message names both sides and which one to update.
|
|
32
|
+
'core_version_mismatch',
|
|
33
|
+
];
|
|
34
|
+
exports.WARNING_CODES = ['protocol_mismatch', 'invalid_messages_dropped'];
|
|
35
|
+
function isErrorCode(value) {
|
|
36
|
+
return typeof value === 'string' && exports.ERROR_CODES.indexOf(value) !== -1;
|
|
37
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { GLOBAL_NAME, PUSH_BINDING_NAME } from './names.js';
|
|
2
|
+
export { PROTOCOL_VERSION, compareProtocol, formatProtocol } from './version.js';
|
|
3
|
+
export type { ProtocolCheck, ProtocolRelation, ProtocolVersion } from './version.js';
|
|
4
|
+
export { ERROR_CODES, WARNING_CODES, isErrorCode } from './errors.js';
|
|
5
|
+
export type { ErrorCode, WarningCode } from './errors.js';
|
|
6
|
+
export { INJECTED_ID_PREFIX, injectedTestId, parseInjectedTestId } from './source-id.js';
|
|
7
|
+
export { isRelativePath, parse } from './schema.js';
|
|
8
|
+
export type { Infer, Result, Schema, Typed } from './schema.js';
|
|
9
|
+
export { registrationSource } from './registration.js';
|
|
10
|
+
export { BUILT_IN_SOURCES, SOURCE_NAME_PATTERN, isSourceName, sourceKind } from './sources.js';
|
|
11
|
+
export { SDK_API, contractSnapshotText, describeContract, parseCommandCall, parseCommandList, parseCommandResult, parseDrainRequest, parseDrainResult, parseErrorShape, parseHandshake, parseJson, parsePushBatch, parseSourceData, parseSourceTable, sourceDataType, planContractSnapshotUpdate, schemas, } from './contract.js';
|
|
12
|
+
export type { BufferState, CommandCall, CommandInfo, CommandResult, DrainRequest, DrainResult, ErrorEntry, ErrorShape, Handshake, LogEntry, LogLevel, NavigationEntry, NetworkEntry, ParallaxGlobal, PushBatch, SdkApi, SourceEntry, StateEntry, SourceRow, SourceTable, } from './contract.js';
|
|
13
|
+
export { isMetroRequest } from './metro-requests.js';
|
|
14
|
+
export { NEW_REJECTION, OLD_REJECTION, REDACTED_TEXT, REJECTION_NAME, SECRET_KEY, isSecretKey, keyWords, looksRandom, scrubField, scrubLine, scrubText, unhandledRejectionOf } from './rules.js';
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.unhandledRejectionOf = exports.scrubText = exports.scrubLine = exports.scrubField = exports.looksRandom = exports.keyWords = exports.isSecretKey = exports.SECRET_KEY = exports.REJECTION_NAME = exports.REDACTED_TEXT = exports.OLD_REJECTION = exports.NEW_REJECTION = exports.isMetroRequest = exports.schemas = exports.planContractSnapshotUpdate = exports.sourceDataType = exports.parseSourceTable = exports.parseSourceData = exports.parsePushBatch = exports.parseJson = exports.parseHandshake = exports.parseErrorShape = exports.parseDrainResult = exports.parseDrainRequest = exports.parseCommandResult = exports.parseCommandList = exports.parseCommandCall = exports.describeContract = exports.contractSnapshotText = exports.SDK_API = exports.sourceKind = exports.isSourceName = exports.SOURCE_NAME_PATTERN = exports.BUILT_IN_SOURCES = exports.registrationSource = exports.parse = exports.isRelativePath = exports.parseInjectedTestId = exports.injectedTestId = exports.INJECTED_ID_PREFIX = exports.isErrorCode = exports.WARNING_CODES = exports.ERROR_CODES = exports.formatProtocol = exports.compareProtocol = exports.PROTOCOL_VERSION = exports.PUSH_BINDING_NAME = exports.GLOBAL_NAME = void 0;
|
|
4
|
+
// Public surface of @parallax-rn/protocol: pure data, validators and rules. No dependencies and no side effects
|
|
5
|
+
// (decision 0007).
|
|
6
|
+
var names_js_1 = require("./names.js");
|
|
7
|
+
Object.defineProperty(exports, "GLOBAL_NAME", { enumerable: true, get: function () { return names_js_1.GLOBAL_NAME; } });
|
|
8
|
+
Object.defineProperty(exports, "PUSH_BINDING_NAME", { enumerable: true, get: function () { return names_js_1.PUSH_BINDING_NAME; } });
|
|
9
|
+
var version_js_1 = require("./version.js");
|
|
10
|
+
Object.defineProperty(exports, "PROTOCOL_VERSION", { enumerable: true, get: function () { return version_js_1.PROTOCOL_VERSION; } });
|
|
11
|
+
Object.defineProperty(exports, "compareProtocol", { enumerable: true, get: function () { return version_js_1.compareProtocol; } });
|
|
12
|
+
Object.defineProperty(exports, "formatProtocol", { enumerable: true, get: function () { return version_js_1.formatProtocol; } });
|
|
13
|
+
var errors_js_1 = require("./errors.js");
|
|
14
|
+
Object.defineProperty(exports, "ERROR_CODES", { enumerable: true, get: function () { return errors_js_1.ERROR_CODES; } });
|
|
15
|
+
Object.defineProperty(exports, "WARNING_CODES", { enumerable: true, get: function () { return errors_js_1.WARNING_CODES; } });
|
|
16
|
+
Object.defineProperty(exports, "isErrorCode", { enumerable: true, get: function () { return errors_js_1.isErrorCode; } });
|
|
17
|
+
var source_id_js_1 = require("./source-id.js");
|
|
18
|
+
Object.defineProperty(exports, "INJECTED_ID_PREFIX", { enumerable: true, get: function () { return source_id_js_1.INJECTED_ID_PREFIX; } });
|
|
19
|
+
Object.defineProperty(exports, "injectedTestId", { enumerable: true, get: function () { return source_id_js_1.injectedTestId; } });
|
|
20
|
+
Object.defineProperty(exports, "parseInjectedTestId", { enumerable: true, get: function () { return source_id_js_1.parseInjectedTestId; } });
|
|
21
|
+
var schema_js_1 = require("./schema.js");
|
|
22
|
+
Object.defineProperty(exports, "isRelativePath", { enumerable: true, get: function () { return schema_js_1.isRelativePath; } });
|
|
23
|
+
Object.defineProperty(exports, "parse", { enumerable: true, get: function () { return schema_js_1.parse; } });
|
|
24
|
+
var registration_js_1 = require("./registration.js");
|
|
25
|
+
Object.defineProperty(exports, "registrationSource", { enumerable: true, get: function () { return registration_js_1.registrationSource; } });
|
|
26
|
+
var sources_js_1 = require("./sources.js");
|
|
27
|
+
Object.defineProperty(exports, "BUILT_IN_SOURCES", { enumerable: true, get: function () { return sources_js_1.BUILT_IN_SOURCES; } });
|
|
28
|
+
Object.defineProperty(exports, "SOURCE_NAME_PATTERN", { enumerable: true, get: function () { return sources_js_1.SOURCE_NAME_PATTERN; } });
|
|
29
|
+
Object.defineProperty(exports, "isSourceName", { enumerable: true, get: function () { return sources_js_1.isSourceName; } });
|
|
30
|
+
Object.defineProperty(exports, "sourceKind", { enumerable: true, get: function () { return sources_js_1.sourceKind; } });
|
|
31
|
+
var contract_js_1 = require("./contract.js");
|
|
32
|
+
Object.defineProperty(exports, "SDK_API", { enumerable: true, get: function () { return contract_js_1.SDK_API; } });
|
|
33
|
+
Object.defineProperty(exports, "contractSnapshotText", { enumerable: true, get: function () { return contract_js_1.contractSnapshotText; } });
|
|
34
|
+
Object.defineProperty(exports, "describeContract", { enumerable: true, get: function () { return contract_js_1.describeContract; } });
|
|
35
|
+
Object.defineProperty(exports, "parseCommandCall", { enumerable: true, get: function () { return contract_js_1.parseCommandCall; } });
|
|
36
|
+
Object.defineProperty(exports, "parseCommandList", { enumerable: true, get: function () { return contract_js_1.parseCommandList; } });
|
|
37
|
+
Object.defineProperty(exports, "parseCommandResult", { enumerable: true, get: function () { return contract_js_1.parseCommandResult; } });
|
|
38
|
+
Object.defineProperty(exports, "parseDrainRequest", { enumerable: true, get: function () { return contract_js_1.parseDrainRequest; } });
|
|
39
|
+
Object.defineProperty(exports, "parseDrainResult", { enumerable: true, get: function () { return contract_js_1.parseDrainResult; } });
|
|
40
|
+
Object.defineProperty(exports, "parseErrorShape", { enumerable: true, get: function () { return contract_js_1.parseErrorShape; } });
|
|
41
|
+
Object.defineProperty(exports, "parseHandshake", { enumerable: true, get: function () { return contract_js_1.parseHandshake; } });
|
|
42
|
+
Object.defineProperty(exports, "parseJson", { enumerable: true, get: function () { return contract_js_1.parseJson; } });
|
|
43
|
+
Object.defineProperty(exports, "parsePushBatch", { enumerable: true, get: function () { return contract_js_1.parsePushBatch; } });
|
|
44
|
+
Object.defineProperty(exports, "parseSourceData", { enumerable: true, get: function () { return contract_js_1.parseSourceData; } });
|
|
45
|
+
Object.defineProperty(exports, "parseSourceTable", { enumerable: true, get: function () { return contract_js_1.parseSourceTable; } });
|
|
46
|
+
Object.defineProperty(exports, "sourceDataType", { enumerable: true, get: function () { return contract_js_1.sourceDataType; } });
|
|
47
|
+
Object.defineProperty(exports, "planContractSnapshotUpdate", { enumerable: true, get: function () { return contract_js_1.planContractSnapshotUpdate; } });
|
|
48
|
+
Object.defineProperty(exports, "schemas", { enumerable: true, get: function () { return contract_js_1.schemas; } });
|
|
49
|
+
var metro_requests_js_1 = require("./metro-requests.js");
|
|
50
|
+
Object.defineProperty(exports, "isMetroRequest", { enumerable: true, get: function () { return metro_requests_js_1.isMetroRequest; } });
|
|
51
|
+
var rules_js_1 = require("./rules.js");
|
|
52
|
+
Object.defineProperty(exports, "NEW_REJECTION", { enumerable: true, get: function () { return rules_js_1.NEW_REJECTION; } });
|
|
53
|
+
Object.defineProperty(exports, "OLD_REJECTION", { enumerable: true, get: function () { return rules_js_1.OLD_REJECTION; } });
|
|
54
|
+
Object.defineProperty(exports, "REDACTED_TEXT", { enumerable: true, get: function () { return rules_js_1.REDACTED_TEXT; } });
|
|
55
|
+
Object.defineProperty(exports, "REJECTION_NAME", { enumerable: true, get: function () { return rules_js_1.REJECTION_NAME; } });
|
|
56
|
+
Object.defineProperty(exports, "SECRET_KEY", { enumerable: true, get: function () { return rules_js_1.SECRET_KEY; } });
|
|
57
|
+
Object.defineProperty(exports, "isSecretKey", { enumerable: true, get: function () { return rules_js_1.isSecretKey; } });
|
|
58
|
+
Object.defineProperty(exports, "keyWords", { enumerable: true, get: function () { return rules_js_1.keyWords; } });
|
|
59
|
+
Object.defineProperty(exports, "looksRandom", { enumerable: true, get: function () { return rules_js_1.looksRandom; } });
|
|
60
|
+
Object.defineProperty(exports, "scrubField", { enumerable: true, get: function () { return rules_js_1.scrubField; } });
|
|
61
|
+
Object.defineProperty(exports, "scrubLine", { enumerable: true, get: function () { return rules_js_1.scrubLine; } });
|
|
62
|
+
Object.defineProperty(exports, "scrubText", { enumerable: true, get: function () { return rules_js_1.scrubText; } });
|
|
63
|
+
Object.defineProperty(exports, "unhandledRejectionOf", { enumerable: true, get: function () { return rules_js_1.unhandledRejectionOf; } });
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isMetroRequest = isMetroRequest;
|
|
4
|
+
// Requests the app makes to its own Metro (LogBox's `POST /symbolicate`, the bundle, the dev server's `/logs`): noise in the Network tab and for an agent (spike 0026). Pure.
|
|
5
|
+
// ponytail: a guess by path on a loopback or private-network host, because the entry does not name Metro's origin; a dev backend on localhost that serves one of these paths is
|
|
6
|
+
// hidden by mistake until the filter that shows Metro's requests is on. Compare with Metro's own origin when the core hands it to the window.
|
|
7
|
+
const LOCAL_HOST = /^(localhost|127\.\d+\.\d+\.\d+|\[::1\]|10\.\d+\.\d+\.\d+|192\.168\.\d+\.\d+|172\.(1[6-9]|2\d|3[01])\.\d+\.\d+|10\.0\.2\.2|[^.]+\.local)$/i;
|
|
8
|
+
const METRO_PATH = /^\/(symbolicate|logs|open-stack-frame|open-url|message|hot|reload|inspector(\/|$)|debugger-frontend(\/|$))|\.(bundle|map|assets)$/i;
|
|
9
|
+
function isMetroRequest(url) {
|
|
10
|
+
var _a;
|
|
11
|
+
const match = /^[a-z][a-z0-9+.-]*:\/\/([^/?#:]*|\[[^\]]*\])(?::\d+)?(\/[^?#]*)?/i.exec(url);
|
|
12
|
+
if (!match || !LOCAL_HOST.test(match[1]))
|
|
13
|
+
return false;
|
|
14
|
+
return METRO_PATH.test((_a = match[2]) !== null && _a !== void 0 ? _a : '/');
|
|
15
|
+
}
|
package/dist/names.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** The container for everything the app exposes: `sources` (build plugin) and `sdk` (SDK). Field names are only ever added. */
|
|
2
|
+
export declare const GLOBAL_NAME = "__PARALLAX_RN__";
|
|
3
|
+
/** The name of the CDP binding (`Runtime.addBinding`) used for push (decision 0010). */
|
|
4
|
+
export declare const PUSH_BINDING_NAME = "__PARALLAX_RN_PUSH__";
|
|
5
|
+
//# sourceMappingURL=names.d.ts.map
|
package/dist/names.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Names of the globals the app exposes to Parallax (decision 0012).
|
|
3
|
+
// They carry the npm scope because "parallax" alone is a common word in React Native libraries.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.PUSH_BINDING_NAME = exports.GLOBAL_NAME = void 0;
|
|
6
|
+
/** The container for everything the app exposes: `sources` (build plugin) and `sdk` (SDK). Field names are only ever added. */
|
|
7
|
+
exports.GLOBAL_NAME = '__PARALLAX_RN__';
|
|
8
|
+
/** The name of the CDP binding (`Runtime.addBinding`) used for push (decision 0010). */
|
|
9
|
+
exports.PUSH_BINDING_NAME = '__PARALLAX_RN_PUSH__';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registrationSource = registrationSource;
|
|
4
|
+
// The code the build plugin emits into each module to register its source table. It must parse as ES2015 and must not
|
|
5
|
+
// rely on any later syntax, because emitted nodes may not be transformed by the preset (decision 0012). It is guarded by
|
|
6
|
+
// `__DEV__` so nothing registers at runtime if the plugin ran by mistake (decision 0009).
|
|
7
|
+
const names_js_1 = require("./names.js");
|
|
8
|
+
const LINE_SEPARATOR = String.fromCharCode(0x2028);
|
|
9
|
+
const PARAGRAPH_SEPARATOR = String.fromCharCode(0x2029);
|
|
10
|
+
/** JSON is valid JavaScript except that the line and paragraph separators are not allowed inside string literals before ES2019. */
|
|
11
|
+
function toLiteral(value) {
|
|
12
|
+
return JSON.stringify(value)
|
|
13
|
+
.split(LINE_SEPARATOR)
|
|
14
|
+
.join('\\u2028')
|
|
15
|
+
.split(PARAGRAPH_SEPARATOR)
|
|
16
|
+
.join('\\u2029');
|
|
17
|
+
}
|
|
18
|
+
function registrationSource(table) {
|
|
19
|
+
return ('if (typeof __DEV__ !== "undefined" && __DEV__) { (function () { ' +
|
|
20
|
+
`var c = globalThis.${names_js_1.GLOBAL_NAME} = globalThis.${names_js_1.GLOBAL_NAME} || {}; ` +
|
|
21
|
+
'c.sources = c.sources || {}; ' +
|
|
22
|
+
`c.sources[${toLiteral(table.file)}] = ${toLiteral(table)}; ` +
|
|
23
|
+
'})(); }');
|
|
24
|
+
}
|
package/dist/rules.d.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { LogLevel } from './contract.js';
|
|
2
|
+
/** What replaces a secret value in structured data and free text. */
|
|
3
|
+
export declare const REDACTED_TEXT = "[redacted]";
|
|
4
|
+
/** Substring test on a key (`authToken`, `x-api-key`): cheap and wide. The core's `redactSecrets` uses it on object keys. */
|
|
5
|
+
export declare const SECRET_KEY: RegExp;
|
|
6
|
+
/** The words of a key (camelCase, snake_case and kebab-case parts), lower-cased. */
|
|
7
|
+
export declare function keyWords(key: string): string[];
|
|
8
|
+
/**
|
|
9
|
+
* Word-based test (the picker's rule): `authorName`, `passenger` and `hotkey` are not secrets, `userAuthToken`, `api_key`, `sessionId` and `pin` are. A bare `key` is a
|
|
10
|
+
* secret only beside a word that says what kind of key it is.
|
|
11
|
+
*/
|
|
12
|
+
export declare function isSecretKey(key: string): boolean;
|
|
13
|
+
/** A value that looks like a credential: 20 or more characters of one word (no spaces) with letters and digits mixed, or a JWT, or a long hex or base64 run. */
|
|
14
|
+
export declare function looksRandom(value: string): boolean;
|
|
15
|
+
/** Every credential-shaped thing of the rules above, and EVERY run of 40 or more base64-alphabet characters. For text that is not a log line: a card, a header, a body. A cheap guard, not a promise. */
|
|
16
|
+
export declare function scrubText(text: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* The scrub for a console line (plan 0013, Q9): the rules of `scrubText`, but a long run goes only when it looks like a secret. Log lines are full of file paths and filler, and
|
|
19
|
+
* `scrubText` turns a path under the home folder (`<home>/app/src/features/Home`) into `[redacted]` (and the root a Metro error names with it). A run with `+` or `=` is a secret (never in a path); a run
|
|
20
|
+
* without `/` is when it mixes digits and letters; in a run with `/` (a path or a URL) each part is judged alone and goes only when it is 32 or more characters of digits, upper
|
|
21
|
+
* and lower case.
|
|
22
|
+
*/
|
|
23
|
+
export declare function scrubLine(text: string): string;
|
|
24
|
+
/**
|
|
25
|
+
* The scrub for an approval card's one field (a file path or a command): `scrubText`, except that a run with `/` and no `+` or `=` (a path) is judged part by part, so
|
|
26
|
+
* `<home>/ParallaxFixtures/fx-e086/src/CompatScreen.tsx` stays readable. Stricter than `scrubLine`: a part goes at 20 characters of digits, upper and lower case, and a run
|
|
27
|
+
* without `/` goes whole, as in `scrubText`.
|
|
28
|
+
*/
|
|
29
|
+
export declare function scrubField(text: string): string;
|
|
30
|
+
export declare const REJECTION_NAME = "UnhandledPromiseRejection";
|
|
31
|
+
export declare const NEW_REJECTION: RegExp;
|
|
32
|
+
export declare const OLD_REJECTION: RegExp;
|
|
33
|
+
/**
|
|
34
|
+
* An unhandled promise rejection as the app reports it to the console (plan 0006, step 3): React Native does NOT send it through the global error handler, so the console
|
|
35
|
+
* line is the only place it shows. `args` are the console call's arguments as the app has them (objects) or as a debugger describes them. Returns the error to record
|
|
36
|
+
* (named so that the Errors tab and `app_errors` can tell it), or null for any other console call.
|
|
37
|
+
*/
|
|
38
|
+
export declare function unhandledRejectionOf(level: LogLevel, args: readonly unknown[]): {
|
|
39
|
+
name: string;
|
|
40
|
+
message: string;
|
|
41
|
+
stack?: string;
|
|
42
|
+
} | null;
|
|
43
|
+
//# sourceMappingURL=rules.d.ts.map
|