@haystackeditor/cli 0.15.26 → 0.15.28
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/README.md +52 -23
- package/dist/assets/hooks/agent-context/detect.ts +7 -7
- package/dist/assets/hooks/agent-context/parsers/claude.ts +1 -1
- package/dist/assets/hooks/package-lock.json +598 -0
- package/dist/assets/hooks/scripts/commit-msg.sh +1 -3
- package/dist/assets/hooks/scripts/post-commit.sh +1 -3
- package/dist/assets/hooks/scripts/pre-push.sh +1 -4
- package/dist/assets/hooks/scripts/prepare-commit-msg.sh +1 -2
- package/dist/assets/skills/map-cloud-verifier-universe/SKILL.md +2051 -0
- package/dist/assets/skills/map-cloud-verifier-universe/agents/openai.yaml +4 -0
- package/dist/assets/skills/map-cloud-verifier-universe/references/output-contract.md +3411 -0
- package/dist/assets/telemetry/browser-runtime.js +1469 -0
- package/dist/assets/telemetry/runtime.cjs +1503 -0
- package/dist/commands/cloud-verifier-behaviors.d.ts +27 -0
- package/dist/commands/cloud-verifier-behaviors.js +218 -0
- package/dist/commands/cloud-verifier-data-store-census.d.ts +47 -0
- package/dist/commands/cloud-verifier-data-store-census.js +539 -0
- package/dist/commands/cloud-verifier-data-store-drift.d.ts +42 -0
- package/dist/commands/cloud-verifier-data-store-drift.js +158 -0
- package/dist/commands/cloud-verifier-identity-census.d.ts +88 -0
- package/dist/commands/cloud-verifier-identity-census.js +4057 -0
- package/dist/commands/cloud-verifier-materialization.d.ts +16 -0
- package/dist/commands/cloud-verifier-materialization.js +704 -0
- package/dist/commands/cloud-verifier-pascal-selector-census.d.ts +29 -0
- package/dist/commands/cloud-verifier-pascal-selector-census.js +1382 -0
- package/dist/commands/cloud-verifier-python-manifest-selector-census.d.ts +27 -0
- package/dist/commands/cloud-verifier-python-manifest-selector-census.js +2015 -0
- package/dist/commands/cloud-verifier-specialized-operational-census.d.ts +51 -0
- package/dist/commands/cloud-verifier-specialized-operational-census.js +11432 -0
- package/dist/commands/cloud-verifier-universe.d.ts +31 -0
- package/dist/commands/cloud-verifier-universe.js +10178 -0
- package/dist/commands/design-verify.d.ts +31 -0
- package/dist/commands/design-verify.js +285 -0
- package/dist/commands/hooks.d.ts +1 -5
- package/dist/commands/hooks.js +12 -114
- package/dist/commands/install-session-hooks.d.ts +2 -2
- package/dist/commands/install-session-hooks.js +71 -21
- package/dist/commands/mcp.js +1 -34
- package/dist/commands/pr.js +2 -7
- package/dist/commands/prepare-universe-review.d.ts +115 -0
- package/dist/commands/prepare-universe-review.js +1092 -0
- package/dist/commands/production-source-deny-policy.d.ts +15 -0
- package/dist/commands/production-source-deny-policy.js +100 -0
- package/dist/commands/scaffold-provisional-universe.d.ts +468 -0
- package/dist/commands/scaffold-provisional-universe.js +808 -0
- package/dist/commands/schema-cmd.js +32 -0
- package/dist/commands/setup.d.ts +1 -2
- package/dist/commands/setup.js +18 -272
- package/dist/commands/skills.d.ts +2 -2
- package/dist/commands/skills.js +415 -47
- package/dist/commands/submit.js +1 -2
- package/dist/commands/telemetry.d.ts +53 -0
- package/dist/commands/telemetry.js +832 -0
- package/dist/commands/verify-hosted.d.ts +13 -0
- package/dist/commands/verify-hosted.js +49 -1
- package/dist/commands/verify-precompute.d.ts +19 -0
- package/dist/commands/verify-precompute.js +328 -0
- package/dist/index.js +168 -47
- package/dist/schema.d.ts +1 -2
- package/dist/schema.js +1 -2
- package/dist/triage/prompts.d.ts +0 -7
- package/dist/triage/prompts.js +0 -145
- package/dist/triage/runner.js +10 -28
- package/dist/triage/types.d.ts +1 -8
- package/dist/types.d.ts +8 -8
- package/dist/types.js +1 -1
- package/dist/utils/design-verifier-api.d.ts +200 -0
- package/dist/utils/design-verifier-api.js +271 -0
- package/dist/utils/design-verifier-result.d.ts +57 -0
- package/dist/utils/design-verifier-result.js +345 -0
- package/dist/utils/git.d.ts +5 -1
- package/dist/utils/git.js +19 -9
- package/dist/utils/github-api.js +11 -14
- package/dist/utils/haystack-api.d.ts +2 -0
- package/dist/utils/haystack-api.js +10 -3
- package/dist/utils/hooks.d.ts +1 -15
- package/dist/utils/hooks.js +3 -128
- package/dist/utils/telemetry.d.ts +2 -0
- package/dist/utils/telemetry.js +81 -8
- package/package.json +8 -2
- package/schemas/cloud-verifier.v1.json +69 -3
- package/schemas/{pr.v2.json → pr.v3.json} +3 -12
- package/dist/commands/traces.d.ts +0 -48
- package/dist/commands/traces.js +0 -92
- package/dist/triage/traces.d.ts +0 -20
- package/dist/triage/traces.js +0 -311
- package/schemas/traces.v1.json +0 -53
|
@@ -0,0 +1,1469 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Dependency-free browser half of Haystack's experimental web/Node behavior
|
|
3
|
+
* atlas. A build transform supplies an exact manifest; this runtime records
|
|
4
|
+
* only manifest-approved enumerated outcomes and propagates a random trace ID
|
|
5
|
+
* to same-origin requests. It never reads DOM text, request bodies, headers,
|
|
6
|
+
* cookies, storage values, or arbitrary object properties.
|
|
7
|
+
*/
|
|
8
|
+
var __haystackWebAtlasModuleApi = (function installHaystackWebAtlas(host) {
|
|
9
|
+
'use strict';
|
|
10
|
+
|
|
11
|
+
// Never invoke an application-owned accessor merely by checking our optional
|
|
12
|
+
// namespace. Only a plain own data property can represent an earlier install.
|
|
13
|
+
try {
|
|
14
|
+
var existingDescriptor = Object.getOwnPropertyDescriptor(host, '__haystackWebAtlas');
|
|
15
|
+
if (existingDescriptor) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
} catch (_) { return null; }
|
|
19
|
+
|
|
20
|
+
var MAX_EVENTS = 128;
|
|
21
|
+
var MAX_RUNTIME_SITE_MAPPINGS = 256;
|
|
22
|
+
var MAX_ACTION_SEGMENTS_PER_PAGE = 256;
|
|
23
|
+
var MAX_ACTION_SEGMENT_BYTES_PER_PAGE = 1024 * 1024;
|
|
24
|
+
var MAX_FALLBACK_DELIVERIES_IN_FLIGHT = 2;
|
|
25
|
+
var TRACE_HEADER = 'x-haystack-trace-id';
|
|
26
|
+
var ACTION_HEADER = 'x-haystack-action-id';
|
|
27
|
+
var COHORT_HEADER = 'x-haystack-cohort';
|
|
28
|
+
var PARENT_EVENT_HEADER = 'x-haystack-parent-event-id';
|
|
29
|
+
var REQUEST_SITE_HEADER = 'x-haystack-request-site-id';
|
|
30
|
+
var nativeFunctionToString = Function.prototype.toString;
|
|
31
|
+
var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
32
|
+
var nativeGetOwnPropertyDescriptors = Object.getOwnPropertyDescriptors;
|
|
33
|
+
var nativeGetPrototypeOf = Object.getPrototypeOf;
|
|
34
|
+
var nativeObjectCreate = Object.create;
|
|
35
|
+
var nativeDefineProperties = Object.defineProperties;
|
|
36
|
+
var nativeDefineProperty = Object.defineProperty;
|
|
37
|
+
var nativeObjectPrototype = Object.prototype;
|
|
38
|
+
var nativeObjectKeys = Object.keys;
|
|
39
|
+
var nativeHasOwnProperty = Object.prototype.hasOwnProperty;
|
|
40
|
+
var nativeReflectApply = Reflect.apply.bind(Reflect);
|
|
41
|
+
var nativeReflectConstruct = Reflect.construct.bind(Reflect);
|
|
42
|
+
function safeHostData(name) {
|
|
43
|
+
try {
|
|
44
|
+
var descriptor = nativeGetOwnPropertyDescriptor(host, name);
|
|
45
|
+
return descriptor && nativeReflectApply(nativeHasOwnProperty, descriptor, ['value'])
|
|
46
|
+
? descriptor.value
|
|
47
|
+
: undefined;
|
|
48
|
+
} catch (_) { return undefined; }
|
|
49
|
+
}
|
|
50
|
+
var nativeFetchFunction = safeHostData('fetch');
|
|
51
|
+
nativeFetchFunction = typeof nativeFetchFunction === 'function' ? nativeFetchFunction : null;
|
|
52
|
+
var nativeFetch = nativeFetchFunction ? function () {
|
|
53
|
+
return nativeReflectApply(nativeFetchFunction, host, arguments);
|
|
54
|
+
} : null;
|
|
55
|
+
var initialFetchLooksNative = false;
|
|
56
|
+
try {
|
|
57
|
+
initialFetchLooksNative = !!nativeFetchFunction &&
|
|
58
|
+
nativeReflectApply(nativeFunctionToString, nativeFetchFunction, []).indexOf('[native code]') !== -1;
|
|
59
|
+
} catch (_) { initialFetchLooksNative = false; }
|
|
60
|
+
var nativeRandomValues = null;
|
|
61
|
+
var nativeStringify = JSON.stringify.bind(JSON);
|
|
62
|
+
var nativeBeacon = null;
|
|
63
|
+
var nativeAddEventListener = null;
|
|
64
|
+
var hostSetTimeout = safeHostData('setTimeout');
|
|
65
|
+
var nativeSetTimeout = nativeLooking(hostSetTimeout) ? function () {
|
|
66
|
+
return nativeReflectApply(hostSetTimeout, host, arguments);
|
|
67
|
+
} : null;
|
|
68
|
+
var hostPromise = safeHostData('Promise');
|
|
69
|
+
var promisePrototype = nativeLooking(hostPromise) ? safeNativeMember(hostPromise, 'prototype') : null;
|
|
70
|
+
var promiseThen = promisePrototype ? safeNativeMember(promisePrototype, 'then') : null;
|
|
71
|
+
var nativePromiseThen = nativeLooking(promiseThen) ? promiseThen : null;
|
|
72
|
+
var promiseReject = nativeLooking(hostPromise) ? safeNativeMember(hostPromise, 'reject') : null;
|
|
73
|
+
var nativePromiseReject = nativeLooking(promiseReject) ? promiseReject : null;
|
|
74
|
+
var nativeLocationHref = null;
|
|
75
|
+
var nativeLocationOrigin = null;
|
|
76
|
+
var nativeUrlConstructor = null;
|
|
77
|
+
var nativeUrlCanParse = null;
|
|
78
|
+
var nativeRequestConstructor = null;
|
|
79
|
+
var nativeHeadersConstructor = null;
|
|
80
|
+
var nativeUrlHrefGetter = null;
|
|
81
|
+
var nativeRequestHeadersGetter = null;
|
|
82
|
+
var nativeHeadersHas = null;
|
|
83
|
+
var nativeHeadersGet = null;
|
|
84
|
+
var nativeHeadersSet = null;
|
|
85
|
+
var nativeResponseHeadersGetter = null;
|
|
86
|
+
var nativeResponseOkGetter = null;
|
|
87
|
+
var platformCapabilitiesAcquired = false;
|
|
88
|
+
var pagehideInstalled = false;
|
|
89
|
+
var nativeArrayIsArray = Array.isArray;
|
|
90
|
+
var active = null;
|
|
91
|
+
var directProbeContext = null;
|
|
92
|
+
var overlapQuarantine = false;
|
|
93
|
+
var recorderDisabled = false;
|
|
94
|
+
var actionSegmentsAttempted = 0;
|
|
95
|
+
var actionSegmentBytesAttempted = 0;
|
|
96
|
+
var fallbackDeliveriesInFlight = 0;
|
|
97
|
+
var fallbackDeliveryUnavailable = false;
|
|
98
|
+
var runtimeActions = Object.create(null);
|
|
99
|
+
var runtimeSites = Object.create(null);
|
|
100
|
+
var assignedCohort = null;
|
|
101
|
+
var assignedCohortCount = null;
|
|
102
|
+
var configuredManifest = null;
|
|
103
|
+
var configuredEndpoint = null;
|
|
104
|
+
var configuredCohort = null;
|
|
105
|
+
var configuredPlatformFetch = false;
|
|
106
|
+
var fixedOutcomes = Object.freeze({
|
|
107
|
+
started: true, received: true, sent: true, success: true, error: true,
|
|
108
|
+
'network:error': true, 'boolean:true': true, 'boolean:false': true,
|
|
109
|
+
'http:2xx': true, 'http:3xx': true, 'http:4xx': true, 'http:5xx': true,
|
|
110
|
+
'shape:null': true, 'shape:undefined': true, 'shape:boolean': true,
|
|
111
|
+
'shape:number': true, 'shape:string': true, 'shape:array': true,
|
|
112
|
+
'shape:object': true, 'shape:uninspectable': true,
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
function failOpen() {
|
|
116
|
+
// Deliberately silent in the page. Delivery/coverage omissions are carried
|
|
117
|
+
// in successful records; recorder failures must never affect the app.
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function omit(context) {
|
|
121
|
+
if (!context || context.saturated) return;
|
|
122
|
+
context.omittedEvents++;
|
|
123
|
+
// Omission accounting is telemetry work too. Once its bounded budget is
|
|
124
|
+
// exhausted, all later probes in this action become lossy pass-throughs.
|
|
125
|
+
if (context.omittedEvents >= MAX_EVENTS) context.saturated = true;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function saturate(context) {
|
|
129
|
+
if (!context || context.saturated) return;
|
|
130
|
+
omit(context);
|
|
131
|
+
context.saturated = true;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function admitProbe(context) {
|
|
135
|
+
if (!context || context.saturated) return false;
|
|
136
|
+
if (!overlapQuarantine || directProbeContext === context) return true;
|
|
137
|
+
// JavaScript does not expose a portable async-context owner. After one
|
|
138
|
+
// genuine overlap, a token-only late probe could belong to either root.
|
|
139
|
+
// Keep exact action boundaries and captured continuations, but disclose at
|
|
140
|
+
// most one omitted ambiguous probe per later action instead of guessing.
|
|
141
|
+
if (!context.quarantineProbeOmitted) {
|
|
142
|
+
context.quarantineProbeOmitted = true;
|
|
143
|
+
omit(context);
|
|
144
|
+
}
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function ownDataValue(name) {
|
|
149
|
+
return safeHostData(name);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function nativeLooking(value) {
|
|
153
|
+
try {
|
|
154
|
+
return typeof value === 'function' &&
|
|
155
|
+
nativeReflectApply(nativeFunctionToString, value, []).indexOf('[native code]') !== -1;
|
|
156
|
+
} catch (_) { return false; }
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function safePlatformValue(name) {
|
|
160
|
+
try {
|
|
161
|
+
var cursor = host;
|
|
162
|
+
for (var depth = 0; cursor && depth < 12; depth++) {
|
|
163
|
+
var descriptor = nativeGetOwnPropertyDescriptor(cursor, name);
|
|
164
|
+
if (descriptor) {
|
|
165
|
+
if (nativeReflectApply(nativeHasOwnProperty, descriptor, ['value'])) return descriptor.value;
|
|
166
|
+
if (!nativeLooking(descriptor.get)) return undefined;
|
|
167
|
+
return nativeReflectApply(descriptor.get, host, []);
|
|
168
|
+
}
|
|
169
|
+
cursor = nativeGetPrototypeOf(cursor);
|
|
170
|
+
}
|
|
171
|
+
} catch (_) { return undefined; }
|
|
172
|
+
return undefined;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function safePlatformAccessorValue(name) {
|
|
176
|
+
try {
|
|
177
|
+
var cursor = host;
|
|
178
|
+
for (var depth = 0; cursor && depth < 12; depth++) {
|
|
179
|
+
var descriptor = nativeGetOwnPropertyDescriptor(cursor, name);
|
|
180
|
+
if (descriptor) {
|
|
181
|
+
if (nativeReflectApply(nativeHasOwnProperty, descriptor, ['value']) || !nativeLooking(descriptor.get)) return undefined;
|
|
182
|
+
return nativeReflectApply(descriptor.get, host, []);
|
|
183
|
+
}
|
|
184
|
+
cursor = nativeGetPrototypeOf(cursor);
|
|
185
|
+
}
|
|
186
|
+
} catch (_) { return undefined; }
|
|
187
|
+
return undefined;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function safeNativeMember(receiver, name) {
|
|
191
|
+
try {
|
|
192
|
+
var cursor = receiver;
|
|
193
|
+
for (var depth = 0; cursor && depth < 12; depth++) {
|
|
194
|
+
var descriptor = nativeGetOwnPropertyDescriptor(cursor, name);
|
|
195
|
+
if (descriptor) {
|
|
196
|
+
if (nativeReflectApply(nativeHasOwnProperty, descriptor, ['value'])) return descriptor.value;
|
|
197
|
+
if (!nativeLooking(descriptor.get)) return undefined;
|
|
198
|
+
return nativeReflectApply(descriptor.get, receiver, []);
|
|
199
|
+
}
|
|
200
|
+
cursor = nativeGetPrototypeOf(cursor);
|
|
201
|
+
}
|
|
202
|
+
} catch (_) { return undefined; }
|
|
203
|
+
return undefined;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
function safeNativeDescriptor(receiver, name) {
|
|
207
|
+
try {
|
|
208
|
+
var cursor = receiver;
|
|
209
|
+
for (var depth = 0; cursor && depth < 12; depth++) {
|
|
210
|
+
var descriptor = nativeGetOwnPropertyDescriptor(cursor, name);
|
|
211
|
+
if (descriptor) {
|
|
212
|
+
if (nativeReflectApply(nativeHasOwnProperty, descriptor, ['value'])) {
|
|
213
|
+
return nativeLooking(descriptor.value) ? { value: descriptor.value } : null;
|
|
214
|
+
}
|
|
215
|
+
return nativeLooking(descriptor.get) ? { get: descriptor.get } : null;
|
|
216
|
+
}
|
|
217
|
+
cursor = nativeGetPrototypeOf(cursor);
|
|
218
|
+
}
|
|
219
|
+
} catch (_) { return null; }
|
|
220
|
+
return null;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
function safeContractPrototypeMethod(receiver, name) {
|
|
224
|
+
try {
|
|
225
|
+
var cursor = nativeGetPrototypeOf(receiver);
|
|
226
|
+
for (var depth = 0; cursor && depth < 12; depth++) {
|
|
227
|
+
var descriptor = nativeGetOwnPropertyDescriptor(cursor, name);
|
|
228
|
+
if (descriptor) {
|
|
229
|
+
return nativeReflectApply(nativeHasOwnProperty, descriptor, ['value']) &&
|
|
230
|
+
typeof descriptor.value === 'function' ? descriptor.value : null;
|
|
231
|
+
}
|
|
232
|
+
cursor = nativeGetPrototypeOf(cursor);
|
|
233
|
+
}
|
|
234
|
+
} catch (_) { return null; }
|
|
235
|
+
return null;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
function acquirePlatformCapabilities() {
|
|
239
|
+
if (platformCapabilitiesAcquired) return;
|
|
240
|
+
platformCapabilitiesAcquired = true;
|
|
241
|
+
var cryptoValue = safePlatformAccessorValue('crypto');
|
|
242
|
+
var randomValues = cryptoValue && safeNativeMember(cryptoValue, 'getRandomValues');
|
|
243
|
+
if (nativeLooking(randomValues)) {
|
|
244
|
+
nativeRandomValues = function (value) { return nativeReflectApply(randomValues, cryptoValue, [value]); };
|
|
245
|
+
}
|
|
246
|
+
var navigatorValue = safePlatformAccessorValue('navigator');
|
|
247
|
+
var beacon = navigatorValue && safeNativeMember(navigatorValue, 'sendBeacon');
|
|
248
|
+
if (nativeLooking(beacon)) {
|
|
249
|
+
nativeBeacon = function () { return nativeReflectApply(beacon, navigatorValue, arguments); };
|
|
250
|
+
}
|
|
251
|
+
var addEventListener = safePlatformValue('addEventListener');
|
|
252
|
+
if (nativeLooking(addEventListener)) {
|
|
253
|
+
nativeAddEventListener = function () { return nativeReflectApply(addEventListener, host, arguments); };
|
|
254
|
+
}
|
|
255
|
+
var locationValue = safePlatformAccessorValue('location');
|
|
256
|
+
try {
|
|
257
|
+
var href = locationValue && safeNativeMember(locationValue, 'href');
|
|
258
|
+
var origin = locationValue && safeNativeMember(locationValue, 'origin');
|
|
259
|
+
nativeLocationHref = typeof href === 'string' ? href : null;
|
|
260
|
+
nativeLocationOrigin = typeof origin === 'string' ? origin : null;
|
|
261
|
+
} catch (_) { nativeLocationHref = null; nativeLocationOrigin = null; }
|
|
262
|
+
var urlConstructor = safePlatformValue('URL');
|
|
263
|
+
var requestConstructor = safePlatformValue('Request');
|
|
264
|
+
var headersConstructor = safePlatformValue('Headers');
|
|
265
|
+
var responseConstructor = safePlatformValue('Response');
|
|
266
|
+
nativeUrlConstructor = nativeLooking(urlConstructor) ? urlConstructor : null;
|
|
267
|
+
nativeRequestConstructor = nativeLooking(requestConstructor) ? requestConstructor : null;
|
|
268
|
+
nativeHeadersConstructor = nativeLooking(headersConstructor) ? headersConstructor : null;
|
|
269
|
+
var urlPrototype = nativeUrlConstructor && safeNativeMember(nativeUrlConstructor, 'prototype');
|
|
270
|
+
var urlCanParse = nativeUrlConstructor && safeNativeMember(nativeUrlConstructor, 'canParse');
|
|
271
|
+
var requestPrototype = nativeRequestConstructor && safeNativeMember(nativeRequestConstructor, 'prototype');
|
|
272
|
+
var headersPrototype = nativeHeadersConstructor && safeNativeMember(nativeHeadersConstructor, 'prototype');
|
|
273
|
+
var responsePrototype = nativeLooking(responseConstructor) && safeNativeMember(responseConstructor, 'prototype');
|
|
274
|
+
var urlHref = urlPrototype && safeNativeDescriptor(urlPrototype, 'href');
|
|
275
|
+
var requestHeaders = requestPrototype && safeNativeDescriptor(requestPrototype, 'headers');
|
|
276
|
+
var headersHas = headersPrototype && safeNativeDescriptor(headersPrototype, 'has');
|
|
277
|
+
var headersGet = headersPrototype && safeNativeDescriptor(headersPrototype, 'get');
|
|
278
|
+
var headersSet = headersPrototype && safeNativeDescriptor(headersPrototype, 'set');
|
|
279
|
+
var responseHeaders = responsePrototype && safeNativeDescriptor(responsePrototype, 'headers');
|
|
280
|
+
var responseOk = responsePrototype && safeNativeDescriptor(responsePrototype, 'ok');
|
|
281
|
+
nativeUrlHrefGetter = urlHref && urlHref.get || null;
|
|
282
|
+
nativeUrlCanParse = nativeLooking(urlCanParse) ? urlCanParse : null;
|
|
283
|
+
nativeRequestHeadersGetter = requestHeaders && requestHeaders.get || null;
|
|
284
|
+
nativeHeadersHas = headersHas && headersHas.value || null;
|
|
285
|
+
nativeHeadersGet = headersGet && headersGet.value || null;
|
|
286
|
+
nativeHeadersSet = headersSet && headersSet.value || null;
|
|
287
|
+
nativeResponseHeadersGetter = responseHeaders && responseHeaders.get || null;
|
|
288
|
+
nativeResponseOkGetter = responseOk && responseOk.get || null;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
function configure(config) {
|
|
292
|
+
try {
|
|
293
|
+
if (!config || !config.manifest || config.manifest.schemaVersion !== 'haystack-web-node-atlas-manifest-v1' ||
|
|
294
|
+
typeof config.endpoint !== 'string' || config.endpoint.length === 0) return false;
|
|
295
|
+
if (configuredManifest) return configuredManifest === config.manifest;
|
|
296
|
+
configuredManifest = config.manifest;
|
|
297
|
+
configuredEndpoint = config.endpoint;
|
|
298
|
+
configuredCohort = Number.isInteger(config.cohort) ? config.cohort : null;
|
|
299
|
+
configuredPlatformFetch = config.allowPlatformFetch === true;
|
|
300
|
+
if (config.allowPlatformCapabilities === true) acquirePlatformCapabilities();
|
|
301
|
+
if (!pagehideInstalled && nativeAddEventListener && nativeSetTimeout) {
|
|
302
|
+
nativeAddEventListener('pagehide', function () { try { endAction(); } catch (_) { failOpen(); } });
|
|
303
|
+
pagehideInstalled = true;
|
|
304
|
+
}
|
|
305
|
+
return true;
|
|
306
|
+
} catch (_) { return false; }
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
function trustedOutcome(value) {
|
|
310
|
+
if (typeof value !== 'string') return false;
|
|
311
|
+
if (fixedOutcomes[value] === true) return true;
|
|
312
|
+
if (value.slice(0, 8) !== 'variant:') return false;
|
|
313
|
+
var index = Number(value.slice(8));
|
|
314
|
+
return Number.isInteger(index) && index >= 0 && index < 32 && value === 'variant:' + index;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
function randomTraceId() {
|
|
318
|
+
if (!nativeRandomValues) return null;
|
|
319
|
+
for (var attempt = 0; attempt < 2; attempt++) {
|
|
320
|
+
var bytes = new Uint8Array(16);
|
|
321
|
+
nativeRandomValues(bytes);
|
|
322
|
+
var value = '';
|
|
323
|
+
for (var index = 0; index < bytes.length; index++) value += bytes[index].toString(16).padStart(2, '0');
|
|
324
|
+
if (value !== '00000000000000000000000000000000') return value;
|
|
325
|
+
}
|
|
326
|
+
return null;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
function traceparent(traceId) {
|
|
330
|
+
var spanId = traceId.slice(16);
|
|
331
|
+
if (spanId === '0000000000000000') spanId = traceId.slice(0, 16);
|
|
332
|
+
return '00-' + traceId + '-' + spanId + '-01';
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
function safeNodeResponseId(traceId, requestEventId, candidate) {
|
|
336
|
+
try {
|
|
337
|
+
var requestOrdinal = Number(requestEventId.slice(-4));
|
|
338
|
+
var prefix = 'node-' + traceId + '-';
|
|
339
|
+
if (!Number.isInteger(requestOrdinal) || requestOrdinal < 1 || requestOrdinal > MAX_EVENTS ||
|
|
340
|
+
typeof candidate !== 'string' || candidate.slice(0, prefix.length) !== prefix) return null;
|
|
341
|
+
var ordinalText = candidate.slice(prefix.length);
|
|
342
|
+
if (!/^[0-9]{4,5}$/.test(ordinalText)) return null;
|
|
343
|
+
var ordinal = Number(ordinalText);
|
|
344
|
+
var base = requestOrdinal * MAX_EVENTS;
|
|
345
|
+
return ordinal > base && ordinal <= base + MAX_EVENTS && candidate === prefix + String(ordinal).padStart(4, '0')
|
|
346
|
+
? candidate
|
|
347
|
+
: null;
|
|
348
|
+
} catch (_) { return null; }
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
function manifest() {
|
|
352
|
+
var value = configuredManifest || ownDataValue('__HAYSTACK_WEB_ATLAS_MANIFEST__');
|
|
353
|
+
return value && value.schemaVersion === 'haystack-web-node-atlas-manifest-v1' ? value : null;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
function platformFetchCorrelationAllowed() {
|
|
357
|
+
return configuredPlatformFetch || ownDataValue('__HAYSTACK_WEB_ATLAS_ALLOW_PLATFORM_FETCH__') === true;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
function actionFor(actionId) {
|
|
361
|
+
if (runtimeActions[actionId]) return runtimeActions[actionId];
|
|
362
|
+
var value = manifest();
|
|
363
|
+
if (!value || !Array.isArray(value.actions)) return null;
|
|
364
|
+
for (var index = 0; index < value.actions.length; index++) {
|
|
365
|
+
if (value.actions[index] && value.actions[index].actionId === actionId) return value.actions[index];
|
|
366
|
+
}
|
|
367
|
+
return null;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
function siteFor(siteId) {
|
|
371
|
+
if (runtimeSites[siteId]) return runtimeSites[siteId];
|
|
372
|
+
var value = manifest();
|
|
373
|
+
if (!value || !Array.isArray(value.sites)) return null;
|
|
374
|
+
for (var index = 0; index < value.sites.length; index++) {
|
|
375
|
+
if (value.sites[index] && value.sites[index].siteId === siteId) return value.sites[index];
|
|
376
|
+
}
|
|
377
|
+
return null;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
function outcomesForKind(kind) {
|
|
381
|
+
if (kind === 'action-start') return ['started'];
|
|
382
|
+
if (kind === 'input-shape' || kind === 'output-shape') return [
|
|
383
|
+
'shape:null', 'shape:undefined', 'shape:boolean', 'shape:number',
|
|
384
|
+
'shape:string', 'shape:array', 'shape:object', 'shape:uninspectable',
|
|
385
|
+
];
|
|
386
|
+
if (kind === 'condition') return ['boolean:false', 'boolean:true'];
|
|
387
|
+
if (kind === 'request') return ['sent'];
|
|
388
|
+
if (kind === 'response') return ['success', 'error', 'network:error'];
|
|
389
|
+
return [];
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
function runtimeSite(config, siteId, kind) {
|
|
393
|
+
if (typeof siteId !== 'string' || !/^site-[0-9a-f]{24}$/.test(siteId)) return null;
|
|
394
|
+
var outcomes = outcomesForKind(kind);
|
|
395
|
+
if (outcomes.length === 0) return null;
|
|
396
|
+
return {
|
|
397
|
+
siteId: siteId,
|
|
398
|
+
actionId: config.actionId,
|
|
399
|
+
surface: 'browser',
|
|
400
|
+
kind: kind,
|
|
401
|
+
allowedOutcomes: outcomes,
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
function registerAction(config) {
|
|
406
|
+
try {
|
|
407
|
+
if (nativeArrayIsArray(config)) {
|
|
408
|
+
if (config.length !== 7) return false;
|
|
409
|
+
var compactConditions = Object.create(null);
|
|
410
|
+
var compactFetches = Object.create(null);
|
|
411
|
+
var conditionPairs = config[5];
|
|
412
|
+
var fetchPairs = config[6];
|
|
413
|
+
if (!nativeArrayIsArray(conditionPairs) || !nativeArrayIsArray(fetchPairs) ||
|
|
414
|
+
conditionPairs.length > MAX_RUNTIME_SITE_MAPPINGS ||
|
|
415
|
+
fetchPairs.length > MAX_RUNTIME_SITE_MAPPINGS) return false;
|
|
416
|
+
for (var compactConditionIndex = 0; compactConditionIndex < conditionPairs.length; compactConditionIndex++) {
|
|
417
|
+
var conditionPair = conditionPairs[compactConditionIndex];
|
|
418
|
+
if (!nativeArrayIsArray(conditionPair) || conditionPair.length !== 2 ||
|
|
419
|
+
typeof conditionPair[0] !== 'string' || !/^c-[0-9a-f]{16}$/.test(conditionPair[0]) ||
|
|
420
|
+
compactConditions[conditionPair[0]] !== undefined) return false;
|
|
421
|
+
compactConditions[conditionPair[0]] = conditionPair[1];
|
|
422
|
+
}
|
|
423
|
+
for (var compactFetchIndex = 0; compactFetchIndex < fetchPairs.length; compactFetchIndex++) {
|
|
424
|
+
var fetchPair = fetchPairs[compactFetchIndex];
|
|
425
|
+
if (!nativeArrayIsArray(fetchPair) || fetchPair.length !== 3 ||
|
|
426
|
+
typeof fetchPair[0] !== 'string' || !/^f-[0-9a-f]{16}$/.test(fetchPair[0]) ||
|
|
427
|
+
(fetchPair[2] !== null && (typeof fetchPair[2] !== 'string' || !/^site-[0-9a-f]{24}$/.test(fetchPair[2]))) ||
|
|
428
|
+
compactFetches[fetchPair[0]] !== undefined) return false;
|
|
429
|
+
compactFetches[fetchPair[0]] = { requestSiteId: fetchPair[1], responseSiteId: fetchPair[2] };
|
|
430
|
+
}
|
|
431
|
+
config = {
|
|
432
|
+
actionId: config[0], cohortIndex: config[1], actionSiteId: config[2],
|
|
433
|
+
inputSiteId: config[3], outputSiteId: config[4],
|
|
434
|
+
conditionSites: compactConditions, fetchSites: compactFetches,
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
if (!config || typeof config.actionId !== 'string' || !/^action-[0-9a-f]{24}$/.test(config.actionId) ||
|
|
438
|
+
!Number.isInteger(config.cohortIndex) || !config.conditionSites || !config.fetchSites) return false;
|
|
439
|
+
var configured = manifest();
|
|
440
|
+
if (!configured || !Number.isInteger(configured.cohortCount) ||
|
|
441
|
+
config.cohortIndex < 0 || config.cohortIndex >= configured.cohortCount ||
|
|
442
|
+
(configured.samplingMode === 'session' && config.cohortIndex !== configured.selectedSessionCohort)) return false;
|
|
443
|
+
if (runtimeActions[config.actionId]) return nativeStringify(runtimeActions[config.actionId]) === nativeStringify(config);
|
|
444
|
+
var pendingSites = [];
|
|
445
|
+
pendingSites.push([config.actionSiteId, 'action-start']);
|
|
446
|
+
pendingSites.push([config.inputSiteId, 'input-shape']);
|
|
447
|
+
pendingSites.push([config.outputSiteId, 'output-shape']);
|
|
448
|
+
var conditionTokens = Object.keys(config.conditionSites);
|
|
449
|
+
for (var conditionIndex = 0; conditionIndex < conditionTokens.length; conditionIndex++) {
|
|
450
|
+
pendingSites.push([config.conditionSites[conditionTokens[conditionIndex]], 'condition']);
|
|
451
|
+
}
|
|
452
|
+
var fetchTokens = Object.keys(config.fetchSites);
|
|
453
|
+
for (var fetchIndex = 0; fetchIndex < fetchTokens.length; fetchIndex++) {
|
|
454
|
+
var fetchSites = config.fetchSites[fetchTokens[fetchIndex]];
|
|
455
|
+
if (!fetchSites) return false;
|
|
456
|
+
pendingSites.push([fetchSites.requestSiteId, 'request']);
|
|
457
|
+
if (fetchSites.responseSiteId !== null) pendingSites.push([fetchSites.responseSiteId, 'response']);
|
|
458
|
+
}
|
|
459
|
+
var preparedSites = [];
|
|
460
|
+
var preparedIds = Object.create(null);
|
|
461
|
+
for (var siteIndex = 0; siteIndex < pendingSites.length; siteIndex++) {
|
|
462
|
+
var siteId = pendingSites[siteIndex][0];
|
|
463
|
+
var prepared = runtimeSite(config, siteId, pendingSites[siteIndex][1]);
|
|
464
|
+
if (!prepared || runtimeSites[siteId] || preparedIds[siteId]) return false;
|
|
465
|
+
preparedIds[siteId] = true;
|
|
466
|
+
preparedSites.push(prepared);
|
|
467
|
+
}
|
|
468
|
+
for (var commitIndex = 0; commitIndex < preparedSites.length; commitIndex++) {
|
|
469
|
+
runtimeSites[preparedSites[commitIndex].siteId] = preparedSites[commitIndex];
|
|
470
|
+
}
|
|
471
|
+
runtimeActions[config.actionId] = config;
|
|
472
|
+
return true;
|
|
473
|
+
} catch (_) {
|
|
474
|
+
failOpen();
|
|
475
|
+
return false;
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
function sessionCohort(cohortCount) {
|
|
480
|
+
if (assignedCohort !== null && assignedCohortCount === cohortCount) return assignedCohort;
|
|
481
|
+
var override = configuredCohort === null ? ownDataValue('__HAYSTACK_WEB_ATLAS_COHORT__') : configuredCohort;
|
|
482
|
+
if (Number.isInteger(override) && override >= 0 && override < cohortCount) {
|
|
483
|
+
assignedCohort = override;
|
|
484
|
+
assignedCohortCount = cohortCount;
|
|
485
|
+
return assignedCohort;
|
|
486
|
+
}
|
|
487
|
+
if (!nativeRandomValues) return -1;
|
|
488
|
+
var value = new Uint32Array(1);
|
|
489
|
+
nativeRandomValues(value);
|
|
490
|
+
assignedCohort = value[0] % cohortCount;
|
|
491
|
+
assignedCohortCount = cohortCount;
|
|
492
|
+
return assignedCohort;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
function emit(siteId, kind, outcome, parentEventId) {
|
|
496
|
+
try {
|
|
497
|
+
if (!active || active.saturated) return null;
|
|
498
|
+
if (kind === 'condition' && active.conditionEvents >= active.conditionEventLimit) {
|
|
499
|
+
if (!active.conditionBudgetOmitted) {
|
|
500
|
+
active.conditionBudgetOmitted = true;
|
|
501
|
+
omit(active);
|
|
502
|
+
}
|
|
503
|
+
return null;
|
|
504
|
+
}
|
|
505
|
+
var site = siteFor(siteId);
|
|
506
|
+
if (!site || site.actionId !== active.actionId || site.surface !== 'browser' ||
|
|
507
|
+
site.kind !== kind || !Array.isArray(site.allowedOutcomes) ||
|
|
508
|
+
site.allowedOutcomes.indexOf(outcome) === -1 || !trustedOutcome(outcome)) {
|
|
509
|
+
omit(active);
|
|
510
|
+
return null;
|
|
511
|
+
}
|
|
512
|
+
if (active.events.length >= MAX_EVENTS) {
|
|
513
|
+
// The event buffer is the observation budget. Do not repeatedly
|
|
514
|
+
// validate and count the unobserved tail of a hot customer loop.
|
|
515
|
+
saturate(active);
|
|
516
|
+
return null;
|
|
517
|
+
}
|
|
518
|
+
var eventId = 'browser-' + active.traceId + '-' + String(active.events.length + 1).padStart(4, '0');
|
|
519
|
+
var event = {
|
|
520
|
+
eventId: eventId,
|
|
521
|
+
parentEventId: parentEventId === undefined ? active.parentEventId : parentEventId,
|
|
522
|
+
siteId: siteId,
|
|
523
|
+
kind: kind,
|
|
524
|
+
outcome: outcome,
|
|
525
|
+
ordinal: active.events.length + 1,
|
|
526
|
+
};
|
|
527
|
+
active.events.push(event);
|
|
528
|
+
if (kind === 'condition') active.conditionEvents++;
|
|
529
|
+
active.parentEventId = eventId;
|
|
530
|
+
return eventId;
|
|
531
|
+
} catch (_) {
|
|
532
|
+
failOpen();
|
|
533
|
+
return null;
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
function shapeOutcome(value) {
|
|
538
|
+
try {
|
|
539
|
+
if (value === null) return 'shape:null';
|
|
540
|
+
if (value === undefined) return 'shape:undefined';
|
|
541
|
+
// Array.isArray is normally trap-free, but a revoked Proxy throws. Shape
|
|
542
|
+
// classification is telemetry work and must therefore be total.
|
|
543
|
+
if (nativeArrayIsArray(value)) return 'shape:array';
|
|
544
|
+
var kind = typeof value;
|
|
545
|
+
if (kind === 'boolean' || kind === 'number' || kind === 'string') return 'shape:' + kind;
|
|
546
|
+
if (kind === 'object') return 'shape:object';
|
|
547
|
+
} catch (_) { failOpen(); }
|
|
548
|
+
return 'shape:uninspectable';
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
function invokeApplicationFetch(fetchImplementation, input, init, hasInit) {
|
|
552
|
+
// The compiler only rewrites bare `fetch(...)` calls. Calling the captured
|
|
553
|
+
// function as a local preserves their strict-mode `this === undefined`.
|
|
554
|
+
// Preserve argument count too: wrappers can distinguish fetch(url) from
|
|
555
|
+
// fetch(url, undefined).
|
|
556
|
+
return hasInit ? fetchImplementation(input, init) : fetchImplementation(input);
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
function scheduleFinish(context) {
|
|
560
|
+
if (!context || context !== active || !context.rootReturned || context.pendingFetches !== 0 || context.finishScheduled) return;
|
|
561
|
+
context.finishScheduled = true;
|
|
562
|
+
var finish = function () {
|
|
563
|
+
context.finishScheduled = false;
|
|
564
|
+
if (context === active && context.rootReturned && context.pendingFetches === 0) endAction();
|
|
565
|
+
};
|
|
566
|
+
if (nativeSetTimeout) nativeSetTimeout(finish, 0);
|
|
567
|
+
else finish();
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
function correlatedFetch(fetchImplementation, input, init, explicitSites, applicationHasInit) {
|
|
571
|
+
var hasInit = typeof applicationHasInit === 'boolean' ? applicationHasInit : arguments.length >= 3;
|
|
572
|
+
var applicationFetch = typeof fetchImplementation === 'function'
|
|
573
|
+
? fetchImplementation
|
|
574
|
+
: nativeFetch;
|
|
575
|
+
if (!applicationFetch) throw new TypeError('fetch is not available');
|
|
576
|
+
var context = active;
|
|
577
|
+
if (!context) return invokeApplicationFetch(applicationFetch, input, init, hasInit);
|
|
578
|
+
if (!admitProbe(context)) return invokeApplicationFetch(applicationFetch, input, init, hasInit);
|
|
579
|
+
if (context.saturated) return invokeApplicationFetch(applicationFetch, input, init, hasInit);
|
|
580
|
+
// Adding correlation headers necessarily converts a string into Request.
|
|
581
|
+
// That is invisible to the platform fetch but observable to an application
|
|
582
|
+
// wrapper. Never alter a later-installed/customer fetch wrapper.
|
|
583
|
+
if (!platformFetchCorrelationAllowed() || !initialFetchLooksNative || fetchImplementation !== nativeFetchFunction) {
|
|
584
|
+
omit(context);
|
|
585
|
+
return invokeApplicationFetch(applicationFetch, input, init, hasInit);
|
|
586
|
+
}
|
|
587
|
+
var fetchInput = input;
|
|
588
|
+
var fetchInit = init;
|
|
589
|
+
var normalizedRequest = null;
|
|
590
|
+
var requestParent = null;
|
|
591
|
+
var requestSiteId = explicitSites && explicitSites.requestSiteId || context.requestSiteId;
|
|
592
|
+
var responseSiteId = explicitSites && explicitSites.responseSiteId || context.responseSiteId;
|
|
593
|
+
try {
|
|
594
|
+
// A user-defined URL-like object can have stateful coercion. Inspecting
|
|
595
|
+
// it would perform application work twice, so leave it completely alone
|
|
596
|
+
// and disclose the missing continuation instead. Objects include Request
|
|
597
|
+
// and URL here: avoiding `instanceof` also avoids Proxy prototype traps.
|
|
598
|
+
if (typeof input !== 'string') {
|
|
599
|
+
omit(context);
|
|
600
|
+
return invokeApplicationFetch(applicationFetch, input, init, hasInit);
|
|
601
|
+
}
|
|
602
|
+
if (!nativeLocationHref || !nativeLocationOrigin || !nativeUrlConstructor ||
|
|
603
|
+
!nativeUrlCanParse || !nativeRequestConstructor || !nativeHeadersConstructor || !nativeUrlHrefGetter ||
|
|
604
|
+
!nativeRequestHeadersGetter || !nativeHeadersHas || !nativeHeadersGet || !nativeHeadersSet ||
|
|
605
|
+
!nativeResponseHeadersGetter || !nativeResponseOkGetter || !nativePromiseReject) {
|
|
606
|
+
omit(context);
|
|
607
|
+
return invokeApplicationFetch(applicationFetch, input, init, hasInit);
|
|
608
|
+
}
|
|
609
|
+
if (!nativeReflectApply(nativeUrlCanParse, nativeUrlConstructor, [input, nativeLocationHref])) {
|
|
610
|
+
omit(context);
|
|
611
|
+
return invokeApplicationFetch(applicationFetch, input, init, hasInit);
|
|
612
|
+
}
|
|
613
|
+
var urlValue = nativeReflectConstruct(nativeUrlConstructor, [input, nativeLocationHref]);
|
|
614
|
+
var inputUrl = nativeReflectApply(nativeUrlHrefGetter, urlValue, []);
|
|
615
|
+
if (inputUrl.indexOf(nativeLocationOrigin + '/') === 0) {
|
|
616
|
+
var request = nativeReflectConstruct(nativeRequestConstructor, [input, init]);
|
|
617
|
+
normalizedRequest = request;
|
|
618
|
+
// From this point on the application RequestInit has been consumed
|
|
619
|
+
// exactly once. Any fail-open fetch uses this normalized Request and
|
|
620
|
+
// never re-reads customer dictionary fields.
|
|
621
|
+
fetchInput = request;
|
|
622
|
+
fetchInit = undefined;
|
|
623
|
+
hasInit = false;
|
|
624
|
+
var requestHeaders = nativeReflectApply(nativeRequestHeadersGetter, request, []);
|
|
625
|
+
var headers = nativeReflectConstruct(nativeHeadersConstructor, [requestHeaders]);
|
|
626
|
+
var reservedHeaders = [TRACE_HEADER, ACTION_HEADER, COHORT_HEADER, PARENT_EVENT_HEADER, REQUEST_SITE_HEADER, 'traceparent'];
|
|
627
|
+
var hasReservedHeader = false;
|
|
628
|
+
for (var headerIndex = 0; headerIndex < reservedHeaders.length; headerIndex++) {
|
|
629
|
+
if (nativeReflectApply(nativeHeadersHas, headers, [reservedHeaders[headerIndex]])) { hasReservedHeader = true; break; }
|
|
630
|
+
}
|
|
631
|
+
if (hasReservedHeader) {
|
|
632
|
+
// Existing application/distributed-tracing headers win. The already
|
|
633
|
+
// constructed native Request preserves their exact platform
|
|
634
|
+
// semantics without evaluating the original init twice.
|
|
635
|
+
omit(context);
|
|
636
|
+
fetchInput = request;
|
|
637
|
+
fetchInit = undefined;
|
|
638
|
+
} else {
|
|
639
|
+
requestParent = emit(requestSiteId, 'request', 'sent', context.inputEventId || undefined);
|
|
640
|
+
}
|
|
641
|
+
if (!requestParent) {
|
|
642
|
+
// Either a reserved header prevented correlation or event capacity was
|
|
643
|
+
// exhausted. Invoke the native fetch without adding any header.
|
|
644
|
+
fetchInput = request;
|
|
645
|
+
fetchInit = undefined;
|
|
646
|
+
} else {
|
|
647
|
+
nativeReflectApply(nativeHeadersSet, headers, [TRACE_HEADER, context.traceId]);
|
|
648
|
+
nativeReflectApply(nativeHeadersSet, headers, [ACTION_HEADER, context.actionId]);
|
|
649
|
+
nativeReflectApply(nativeHeadersSet, headers, [COHORT_HEADER, '' + context.cohortIndex]);
|
|
650
|
+
if (requestParent) nativeReflectApply(nativeHeadersSet, headers, [PARENT_EVENT_HEADER, requestParent]);
|
|
651
|
+
if (requestParent) nativeReflectApply(nativeHeadersSet, headers, [REQUEST_SITE_HEADER, requestSiteId]);
|
|
652
|
+
nativeReflectApply(nativeHeadersSet, headers, ['traceparent', traceparent(context.traceId)]);
|
|
653
|
+
fetchInput = nativeReflectConstruct(nativeRequestConstructor, [request, { headers: headers }]);
|
|
654
|
+
fetchInit = undefined;
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
} catch (error) {
|
|
658
|
+
failOpen();
|
|
659
|
+
omit(context);
|
|
660
|
+
if (normalizedRequest) {
|
|
661
|
+
// Request conversion already completed. A later telemetry-only failure
|
|
662
|
+
// must still perform the application fetch exactly once.
|
|
663
|
+
return invokeApplicationFetch(applicationFetch, normalizedRequest, undefined, false);
|
|
664
|
+
}
|
|
665
|
+
// Native fetch reports request-conversion failures asynchronously. Do
|
|
666
|
+
// the same without retrying the original init and invoking its getters a
|
|
667
|
+
// second time.
|
|
668
|
+
return nativeReflectApply(nativePromiseReject, hostPromise, [error]);
|
|
669
|
+
}
|
|
670
|
+
// This is the application operation. It must happen exactly once and is
|
|
671
|
+
// deliberately outside telemetry's catch boundary: a synchronous throw or
|
|
672
|
+
// rejected promise keeps the application's original semantics.
|
|
673
|
+
var result = invokeApplicationFetch(applicationFetch, fetchInput, fetchInit, hasInit);
|
|
674
|
+
if (!requestParent) return result;
|
|
675
|
+
if (!nativePromiseThen || result === null ||
|
|
676
|
+
(typeof result !== 'object' && typeof result !== 'function')) {
|
|
677
|
+
omit(context);
|
|
678
|
+
scheduleFinish(context);
|
|
679
|
+
return result;
|
|
680
|
+
}
|
|
681
|
+
context.pendingFetches++;
|
|
682
|
+
try {
|
|
683
|
+
nativeReflectApply(nativePromiseThen, result, [function (response) {
|
|
684
|
+
context.pendingFetches--;
|
|
685
|
+
if (context === active) {
|
|
686
|
+
if (context.saturated) {
|
|
687
|
+
scheduleFinish(context);
|
|
688
|
+
return;
|
|
689
|
+
}
|
|
690
|
+
try {
|
|
691
|
+
var responseHeaders = nativeReflectApply(nativeResponseHeadersGetter, response, []);
|
|
692
|
+
var serverParent = nativeReflectApply(nativeHeadersHas, responseHeaders, [PARENT_EVENT_HEADER])
|
|
693
|
+
? nativeReflectApply(nativeHeadersGet, responseHeaders, [PARENT_EVENT_HEADER])
|
|
694
|
+
: null;
|
|
695
|
+
var safeServerParent = safeNodeResponseId(context.traceId, requestParent, serverParent);
|
|
696
|
+
if (serverParent !== null && safeServerParent === null) {
|
|
697
|
+
omit(context);
|
|
698
|
+
serverParent = null;
|
|
699
|
+
} else {
|
|
700
|
+
serverParent = safeServerParent;
|
|
701
|
+
}
|
|
702
|
+
emit(
|
|
703
|
+
responseSiteId,
|
|
704
|
+
'response',
|
|
705
|
+
nativeReflectApply(nativeResponseOkGetter, response, []) ? 'success' : 'error',
|
|
706
|
+
serverParent || requestParent,
|
|
707
|
+
);
|
|
708
|
+
} catch (_) {
|
|
709
|
+
omit(context);
|
|
710
|
+
failOpen();
|
|
711
|
+
}
|
|
712
|
+
scheduleFinish(context);
|
|
713
|
+
}
|
|
714
|
+
}, function (error) {
|
|
715
|
+
context.pendingFetches--;
|
|
716
|
+
if (context === active) {
|
|
717
|
+
try { emit(responseSiteId, 'response', 'network:error', requestParent); } catch (_) { failOpen(); }
|
|
718
|
+
scheduleFinish(context);
|
|
719
|
+
}
|
|
720
|
+
// Preserve an unhandled rejection signal for ignored application fetch
|
|
721
|
+
// Promises. It is carried by this observer child rather than the exact
|
|
722
|
+
// original Promise identity.
|
|
723
|
+
throw error;
|
|
724
|
+
}]);
|
|
725
|
+
} catch (_) {
|
|
726
|
+
context.pendingFetches--;
|
|
727
|
+
omit(context);
|
|
728
|
+
scheduleFinish(context);
|
|
729
|
+
failOpen();
|
|
730
|
+
}
|
|
731
|
+
// Observation must not replace the application's Promise or call a
|
|
732
|
+
// customer-overridden `.then` method.
|
|
733
|
+
return result;
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
function axiosOmission(state) {
|
|
737
|
+
if (!state.omissionRecorded) {
|
|
738
|
+
state.omissionRecorded = true;
|
|
739
|
+
omit(state.context);
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
function cloneAxiosConfig(config) {
|
|
744
|
+
if (config === undefined || config === null) return {};
|
|
745
|
+
if (typeof config !== 'object' || nativeArrayIsArray(config)) return null;
|
|
746
|
+
if (nativeGetPrototypeOf(config) !== nativeObjectPrototype) return null;
|
|
747
|
+
var clone = {};
|
|
748
|
+
var keys = nativeObjectKeys(config);
|
|
749
|
+
for (var index = 0; index < keys.length; index++) {
|
|
750
|
+
var key = keys[index];
|
|
751
|
+
var descriptor = nativeGetOwnPropertyDescriptor(config, key);
|
|
752
|
+
if (!descriptor || !nativeReflectApply(nativeHasOwnProperty, descriptor, ['value'])) return null;
|
|
753
|
+
Object.defineProperty(clone, key, {
|
|
754
|
+
configurable: true, enumerable: true, writable: true, value: descriptor.value,
|
|
755
|
+
});
|
|
756
|
+
}
|
|
757
|
+
return clone;
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
function axiosTransformList(owner, config) {
|
|
761
|
+
var descriptor = nativeGetOwnPropertyDescriptor(config, 'transformRequest');
|
|
762
|
+
var configured;
|
|
763
|
+
if (descriptor) {
|
|
764
|
+
if (!nativeReflectApply(nativeHasOwnProperty, descriptor, ['value'])) return null;
|
|
765
|
+
configured = descriptor.value;
|
|
766
|
+
} else {
|
|
767
|
+
var defaultsDescriptor = owner && nativeGetOwnPropertyDescriptor(owner, 'defaults');
|
|
768
|
+
if (!defaultsDescriptor || !nativeReflectApply(nativeHasOwnProperty, defaultsDescriptor, ['value']) ||
|
|
769
|
+
!defaultsDescriptor.value) return null;
|
|
770
|
+
var transformDescriptor = nativeGetOwnPropertyDescriptor(defaultsDescriptor.value, 'transformRequest');
|
|
771
|
+
if (!transformDescriptor || !nativeReflectApply(nativeHasOwnProperty, transformDescriptor, ['value'])) return null;
|
|
772
|
+
configured = transformDescriptor.value;
|
|
773
|
+
}
|
|
774
|
+
if (typeof configured === 'function') return [configured];
|
|
775
|
+
if (nativeArrayIsArray(configured)) {
|
|
776
|
+
var copy = [];
|
|
777
|
+
for (var index = 0; index < configured.length; index++) {
|
|
778
|
+
if (typeof configured[index] !== 'function') return null;
|
|
779
|
+
copy[index] = configured[index];
|
|
780
|
+
}
|
|
781
|
+
return copy;
|
|
782
|
+
}
|
|
783
|
+
if (configured === undefined || configured === null) return [];
|
|
784
|
+
return null;
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
function axiosResponseHeader(headers, name) {
|
|
788
|
+
if (!headers) return null;
|
|
789
|
+
var get = headers.get;
|
|
790
|
+
if (typeof get !== 'function') return null;
|
|
791
|
+
var value = nativeReflectApply(get, headers, [name]);
|
|
792
|
+
return typeof value === 'string' ? value : null;
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
function observeAxiosResult(result, state) {
|
|
796
|
+
if (!nativePromiseThen || result === null ||
|
|
797
|
+
(typeof result !== 'object' && typeof result !== 'function')) {
|
|
798
|
+
axiosOmission(state);
|
|
799
|
+
scheduleFinish(state.context);
|
|
800
|
+
return result;
|
|
801
|
+
}
|
|
802
|
+
state.context.pendingFetches++;
|
|
803
|
+
try {
|
|
804
|
+
nativeReflectApply(nativePromiseThen, result, [function (response) {
|
|
805
|
+
state.context.pendingFetches--;
|
|
806
|
+
if (state.context === active) {
|
|
807
|
+
if (state.context.saturated) {
|
|
808
|
+
scheduleFinish(state.context);
|
|
809
|
+
return;
|
|
810
|
+
}
|
|
811
|
+
var requestParent = state.requestParents.length > 0
|
|
812
|
+
? state.requestParents[state.requestParents.length - 1]
|
|
813
|
+
: null;
|
|
814
|
+
if (!requestParent) {
|
|
815
|
+
axiosOmission(state);
|
|
816
|
+
} else {
|
|
817
|
+
try {
|
|
818
|
+
var serverParentValue = axiosResponseHeader(response && response.headers, PARENT_EVENT_HEADER);
|
|
819
|
+
var serverParent = safeNodeResponseId(state.context.traceId, requestParent, serverParentValue);
|
|
820
|
+
if (serverParentValue !== null && serverParent === null) axiosOmission(state);
|
|
821
|
+
var status = response && response.status;
|
|
822
|
+
emit(
|
|
823
|
+
state.sites.responseSiteId,
|
|
824
|
+
'response',
|
|
825
|
+
typeof status === 'number' && status >= 200 && status < 300 ? 'success' : 'error',
|
|
826
|
+
serverParent || requestParent,
|
|
827
|
+
);
|
|
828
|
+
} catch (_) { axiosOmission(state); failOpen(); }
|
|
829
|
+
}
|
|
830
|
+
scheduleFinish(state.context);
|
|
831
|
+
}
|
|
832
|
+
}, function (error) {
|
|
833
|
+
state.context.pendingFetches--;
|
|
834
|
+
if (state.context === active) {
|
|
835
|
+
var requestParent = state.requestParents.length > 0
|
|
836
|
+
? state.requestParents[state.requestParents.length - 1]
|
|
837
|
+
: null;
|
|
838
|
+
if (!requestParent) {
|
|
839
|
+
axiosOmission(state);
|
|
840
|
+
} else {
|
|
841
|
+
try {
|
|
842
|
+
var response = error && error.response;
|
|
843
|
+
var serverParentValue = response
|
|
844
|
+
? axiosResponseHeader(response.headers, PARENT_EVENT_HEADER)
|
|
845
|
+
: null;
|
|
846
|
+
var serverParent = response
|
|
847
|
+
? safeNodeResponseId(state.context.traceId, requestParent, serverParentValue)
|
|
848
|
+
: null;
|
|
849
|
+
if (serverParentValue !== null && serverParent === null) axiosOmission(state);
|
|
850
|
+
emit(
|
|
851
|
+
state.sites.responseSiteId,
|
|
852
|
+
'response',
|
|
853
|
+
response ? 'error' : 'network:error',
|
|
854
|
+
serverParent || requestParent,
|
|
855
|
+
);
|
|
856
|
+
} catch (_) { axiosOmission(state); failOpen(); }
|
|
857
|
+
}
|
|
858
|
+
scheduleFinish(state.context);
|
|
859
|
+
}
|
|
860
|
+
throw error;
|
|
861
|
+
}]);
|
|
862
|
+
} catch (_) {
|
|
863
|
+
state.context.pendingFetches--;
|
|
864
|
+
axiosOmission(state);
|
|
865
|
+
scheduleFinish(state.context);
|
|
866
|
+
failOpen();
|
|
867
|
+
}
|
|
868
|
+
return result;
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
function axiosAt(token, owner, callable, receiver, configIndex, safeConfig, applicationArguments) {
|
|
872
|
+
if (!nativeArrayIsArray(applicationArguments) || typeof callable !== 'function') {
|
|
873
|
+
return nativeReflectApply(callable, receiver, applicationArguments);
|
|
874
|
+
}
|
|
875
|
+
var context = active;
|
|
876
|
+
if (context && context.saturated) return nativeReflectApply(callable, receiver, applicationArguments);
|
|
877
|
+
if (context && !admitProbe(context)) return nativeReflectApply(callable, receiver, applicationArguments);
|
|
878
|
+
var sites = context && context.runtimeConfig && context.runtimeConfig.fetchSites[token];
|
|
879
|
+
if (!context || !sites) return nativeReflectApply(callable, receiver, applicationArguments);
|
|
880
|
+
if (safeConfig !== true || !Number.isInteger(configIndex) || configIndex < 0 || configIndex > 8 ||
|
|
881
|
+
!platformFetchCorrelationAllowed()) {
|
|
882
|
+
omit(context);
|
|
883
|
+
return nativeReflectApply(callable, receiver, applicationArguments);
|
|
884
|
+
}
|
|
885
|
+
var state = { context: context, sites: sites, requestParents: [], omissionRecorded: false };
|
|
886
|
+
var args = [];
|
|
887
|
+
var config;
|
|
888
|
+
try {
|
|
889
|
+
for (var argumentIndex = 0; argumentIndex < applicationArguments.length; argumentIndex++) {
|
|
890
|
+
args[argumentIndex] = applicationArguments[argumentIndex];
|
|
891
|
+
}
|
|
892
|
+
config = cloneAxiosConfig(args[configIndex]);
|
|
893
|
+
var transforms = config && axiosTransformList(owner, config);
|
|
894
|
+
if (!config || !transforms) {
|
|
895
|
+
axiosOmission(state);
|
|
896
|
+
return nativeReflectApply(callable, receiver, applicationArguments);
|
|
897
|
+
}
|
|
898
|
+
transforms.push(function haystackAxiosRequestTransform(data, headers) {
|
|
899
|
+
if (context !== active) return data;
|
|
900
|
+
if (context.saturated) return data;
|
|
901
|
+
try {
|
|
902
|
+
var requestConfig = this;
|
|
903
|
+
var requestUrl = requestConfig && requestConfig.url;
|
|
904
|
+
var baseUrl = requestConfig && requestConfig.baseURL;
|
|
905
|
+
if (typeof requestUrl !== 'string' || (baseUrl !== undefined && baseUrl !== null && typeof baseUrl !== 'string') ||
|
|
906
|
+
!nativeLocationHref || !nativeLocationOrigin || !nativeUrlConstructor || !nativeUrlHrefGetter ||
|
|
907
|
+
!headers || typeof headers.has !== 'function' || typeof headers.set !== 'function') {
|
|
908
|
+
axiosOmission(state);
|
|
909
|
+
return data;
|
|
910
|
+
}
|
|
911
|
+
var resolvedBase = baseUrl
|
|
912
|
+
? nativeReflectApply(nativeUrlHrefGetter, nativeReflectConstruct(nativeUrlConstructor, [baseUrl, nativeLocationHref]), [])
|
|
913
|
+
: nativeLocationHref;
|
|
914
|
+
var resolvedUrl = nativeReflectApply(
|
|
915
|
+
nativeUrlHrefGetter,
|
|
916
|
+
nativeReflectConstruct(nativeUrlConstructor, [requestUrl, resolvedBase]),
|
|
917
|
+
[],
|
|
918
|
+
);
|
|
919
|
+
if (resolvedUrl !== nativeLocationOrigin && resolvedUrl.indexOf(nativeLocationOrigin + '/') !== 0) {
|
|
920
|
+
axiosOmission(state);
|
|
921
|
+
return data;
|
|
922
|
+
}
|
|
923
|
+
var reservedHeaders = [TRACE_HEADER, ACTION_HEADER, COHORT_HEADER, PARENT_EVENT_HEADER, REQUEST_SITE_HEADER, 'traceparent'];
|
|
924
|
+
for (var headerIndex = 0; headerIndex < reservedHeaders.length; headerIndex++) {
|
|
925
|
+
if (nativeReflectApply(headers.has, headers, [reservedHeaders[headerIndex]])) {
|
|
926
|
+
axiosOmission(state);
|
|
927
|
+
return data;
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
var requestParent = emit(sites.requestSiteId, 'request', 'sent', context.inputEventId || undefined);
|
|
931
|
+
if (!requestParent) {
|
|
932
|
+
axiosOmission(state);
|
|
933
|
+
return data;
|
|
934
|
+
}
|
|
935
|
+
nativeReflectApply(headers.set, headers, [TRACE_HEADER, context.traceId]);
|
|
936
|
+
nativeReflectApply(headers.set, headers, [ACTION_HEADER, context.actionId]);
|
|
937
|
+
nativeReflectApply(headers.set, headers, [COHORT_HEADER, '' + context.cohortIndex]);
|
|
938
|
+
nativeReflectApply(headers.set, headers, [PARENT_EVENT_HEADER, requestParent]);
|
|
939
|
+
nativeReflectApply(headers.set, headers, [REQUEST_SITE_HEADER, sites.requestSiteId]);
|
|
940
|
+
nativeReflectApply(headers.set, headers, ['traceparent', traceparent(context.traceId)]);
|
|
941
|
+
state.requestParents.push(requestParent);
|
|
942
|
+
} catch (_) { axiosOmission(state); failOpen(); }
|
|
943
|
+
return data;
|
|
944
|
+
});
|
|
945
|
+
config.transformRequest = transforms;
|
|
946
|
+
while (args.length < configIndex) args.push(undefined);
|
|
947
|
+
args[configIndex] = config;
|
|
948
|
+
} catch (_) {
|
|
949
|
+
axiosOmission(state);
|
|
950
|
+
return nativeReflectApply(callable, receiver, applicationArguments);
|
|
951
|
+
}
|
|
952
|
+
var result = nativeReflectApply(callable, receiver, args);
|
|
953
|
+
return observeAxiosResult(result, state);
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
function oazapftsAt(token, owner, callable, safeOptions, applicationArguments) {
|
|
957
|
+
if (!nativeArrayIsArray(applicationArguments) || typeof callable !== 'function') {
|
|
958
|
+
return nativeReflectApply(callable, owner, applicationArguments);
|
|
959
|
+
}
|
|
960
|
+
var context = active;
|
|
961
|
+
if (context && context.saturated) return nativeReflectApply(callable, owner, applicationArguments);
|
|
962
|
+
if (context && !admitProbe(context)) return nativeReflectApply(callable, owner, applicationArguments);
|
|
963
|
+
var sites = context && context.runtimeConfig && context.runtimeConfig.fetchSites[token];
|
|
964
|
+
if (!context || !sites) return nativeReflectApply(callable, owner, applicationArguments);
|
|
965
|
+
if (safeOptions !== true || !platformFetchCorrelationAllowed() || !nativeFetchFunction) {
|
|
966
|
+
omit(context);
|
|
967
|
+
return nativeReflectApply(callable, owner, applicationArguments);
|
|
968
|
+
}
|
|
969
|
+
var args = [];
|
|
970
|
+
try {
|
|
971
|
+
for (var argumentIndex = 0; argumentIndex < applicationArguments.length; argumentIndex++) {
|
|
972
|
+
args[argumentIndex] = applicationArguments[argumentIndex];
|
|
973
|
+
}
|
|
974
|
+
var options = cloneAxiosConfig(args[1]);
|
|
975
|
+
if (!options || nativeGetOwnPropertyDescriptor(options, 'fetch')) {
|
|
976
|
+
omit(context);
|
|
977
|
+
return nativeReflectApply(callable, owner, applicationArguments);
|
|
978
|
+
}
|
|
979
|
+
Object.defineProperty(options, 'fetch', {
|
|
980
|
+
configurable: true,
|
|
981
|
+
enumerable: true,
|
|
982
|
+
writable: true,
|
|
983
|
+
value: function haystackOazapftsFetch(input, init) {
|
|
984
|
+
if (arguments.length > 2) {
|
|
985
|
+
omit(context);
|
|
986
|
+
return nativeReflectApply(nativeFetchFunction, undefined, arguments);
|
|
987
|
+
}
|
|
988
|
+
if (context !== active) {
|
|
989
|
+
return invokeApplicationFetch(nativeFetchFunction, input, init, arguments.length >= 2);
|
|
990
|
+
}
|
|
991
|
+
return correlatedFetch(
|
|
992
|
+
nativeFetchFunction,
|
|
993
|
+
input,
|
|
994
|
+
init,
|
|
995
|
+
sites,
|
|
996
|
+
arguments.length >= 2,
|
|
997
|
+
);
|
|
998
|
+
},
|
|
999
|
+
});
|
|
1000
|
+
while (args.length < 1) args.push(undefined);
|
|
1001
|
+
args[1] = options;
|
|
1002
|
+
} catch (_) {
|
|
1003
|
+
omit(context);
|
|
1004
|
+
return nativeReflectApply(callable, owner, applicationArguments);
|
|
1005
|
+
}
|
|
1006
|
+
return nativeReflectApply(callable, owner, args);
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
function fetchAt(token, fetchImplementation, input, init) {
|
|
1010
|
+
if (arguments.length > 4) {
|
|
1011
|
+
var passthroughArguments = [];
|
|
1012
|
+
for (var argumentIndex = 2; argumentIndex < arguments.length; argumentIndex++) {
|
|
1013
|
+
passthroughArguments[argumentIndex - 2] = arguments[argumentIndex];
|
|
1014
|
+
}
|
|
1015
|
+
if (active) omit(active);
|
|
1016
|
+
return nativeReflectApply(fetchImplementation, undefined, passthroughArguments);
|
|
1017
|
+
}
|
|
1018
|
+
var hasInit = arguments.length >= 4;
|
|
1019
|
+
var context = active;
|
|
1020
|
+
if (context && context.saturated) {
|
|
1021
|
+
return invokeApplicationFetch(fetchImplementation, input, init, hasInit);
|
|
1022
|
+
}
|
|
1023
|
+
if (context && !admitProbe(context)) {
|
|
1024
|
+
return invokeApplicationFetch(fetchImplementation, input, init, hasInit);
|
|
1025
|
+
}
|
|
1026
|
+
var sites = context && context.runtimeConfig && context.runtimeConfig.fetchSites[token];
|
|
1027
|
+
if (context && !sites) return invokeApplicationFetch(fetchImplementation, input, init, hasInit);
|
|
1028
|
+
return correlatedFetch(fetchImplementation, input, init, sites, hasInit);
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
function mergeAngularHttpContractOptions(options, headerPairs) {
|
|
1032
|
+
try {
|
|
1033
|
+
if (!options || typeof options !== 'object' || nativeGetPrototypeOf(options) !== nativeObjectPrototype ||
|
|
1034
|
+
typeof nativeGetOwnPropertyDescriptors !== 'function' || typeof nativeObjectCreate !== 'function' ||
|
|
1035
|
+
typeof nativeDefineProperties !== 'function' || typeof nativeDefineProperty !== 'function') return null;
|
|
1036
|
+
var descriptors = nativeGetOwnPropertyDescriptors(options);
|
|
1037
|
+
var headersDescriptor = descriptors && descriptors.headers;
|
|
1038
|
+
if (!headersDescriptor || !nativeReflectApply(nativeHasOwnProperty, headersDescriptor, ['value']) ||
|
|
1039
|
+
!headersDescriptor.value || typeof headersDescriptor.value !== 'object') return null;
|
|
1040
|
+
var headers = headersDescriptor.value;
|
|
1041
|
+
var has = safeContractPrototypeMethod(headers, 'has');
|
|
1042
|
+
var set = safeContractPrototypeMethod(headers, 'set');
|
|
1043
|
+
if (!has || !set) return null;
|
|
1044
|
+
for (var checkIndex = 0; checkIndex < headerPairs.length; checkIndex++) {
|
|
1045
|
+
var present = nativeReflectApply(has, headers, [headerPairs[checkIndex][0]]);
|
|
1046
|
+
if (present !== false) return null;
|
|
1047
|
+
}
|
|
1048
|
+
var nextHeaders = headers;
|
|
1049
|
+
var headersPrototype = nativeGetPrototypeOf(headers);
|
|
1050
|
+
for (var setIndex = 0; setIndex < headerPairs.length; setIndex++) {
|
|
1051
|
+
nextHeaders = nativeReflectApply(set, nextHeaders, headerPairs[setIndex]);
|
|
1052
|
+
if (!nextHeaders || typeof nextHeaders !== 'object' ||
|
|
1053
|
+
nativeGetPrototypeOf(nextHeaders) !== headersPrototype) return null;
|
|
1054
|
+
}
|
|
1055
|
+
var clone = nativeObjectCreate(nativeObjectPrototype);
|
|
1056
|
+
nativeDefineProperties(clone, descriptors);
|
|
1057
|
+
nativeDefineProperty(clone, 'headers', {
|
|
1058
|
+
configurable: headersDescriptor.configurable,
|
|
1059
|
+
enumerable: headersDescriptor.enumerable,
|
|
1060
|
+
writable: headersDescriptor.writable,
|
|
1061
|
+
value: nextHeaders,
|
|
1062
|
+
});
|
|
1063
|
+
return clone;
|
|
1064
|
+
} catch (_) { return null; }
|
|
1065
|
+
}
|
|
1066
|
+
|
|
1067
|
+
// Angular HttpClient returns a cold Observable. Observing that Observable
|
|
1068
|
+
// would either subscribe twice or replace the application value. Instead,
|
|
1069
|
+
// the compiler-authenticated call site adds the exact correlation headers
|
|
1070
|
+
// before Angular constructs the request. Existing options are admitted only
|
|
1071
|
+
// for a build-declared source/export contract and are copied without reading
|
|
1072
|
+
// application fields. The correlated Node continuation is the terminal HTTP
|
|
1073
|
+
// outcome for this transport, so no browser response is fabricated.
|
|
1074
|
+
function angularHttpAt(token, callable, receiver, method, applicationArguments, optionsAdapter) {
|
|
1075
|
+
if (!nativeArrayIsArray(applicationArguments) || typeof callable !== 'function') {
|
|
1076
|
+
return nativeReflectApply(callable, receiver, applicationArguments);
|
|
1077
|
+
}
|
|
1078
|
+
var context = active;
|
|
1079
|
+
if (context && context.saturated) return nativeReflectApply(callable, receiver, applicationArguments);
|
|
1080
|
+
if (context && !admitProbe(context)) return nativeReflectApply(callable, receiver, applicationArguments);
|
|
1081
|
+
var sites = context && context.runtimeConfig && context.runtimeConfig.fetchSites[token];
|
|
1082
|
+
if (!context || !sites) return nativeReflectApply(callable, receiver, applicationArguments);
|
|
1083
|
+
var optionsIndex = method === 'delete' || method === 'get' || method === 'head' || method === 'options'
|
|
1084
|
+
? 1
|
|
1085
|
+
: method === 'patch' || method === 'post' || method === 'put'
|
|
1086
|
+
? 2
|
|
1087
|
+
: -1;
|
|
1088
|
+
var hasOptions = applicationArguments.length > optionsIndex;
|
|
1089
|
+
if (optionsIndex < 0 || !platformFetchCorrelationAllowed() ||
|
|
1090
|
+
(hasOptions && optionsAdapter !== 'angular-http-headers-set-v1') ||
|
|
1091
|
+
(!hasOptions && optionsAdapter !== null) || applicationArguments.length > optionsIndex + 1 ||
|
|
1092
|
+
typeof applicationArguments[0] !== 'string' ||
|
|
1093
|
+
!nativeLocationHref || !nativeLocationOrigin || !nativeUrlConstructor || !nativeUrlHrefGetter) {
|
|
1094
|
+
omit(context);
|
|
1095
|
+
return nativeReflectApply(callable, receiver, applicationArguments);
|
|
1096
|
+
}
|
|
1097
|
+
var args = [];
|
|
1098
|
+
try {
|
|
1099
|
+
var url = nativeReflectApply(
|
|
1100
|
+
nativeUrlHrefGetter,
|
|
1101
|
+
nativeReflectConstruct(nativeUrlConstructor, [applicationArguments[0], nativeLocationHref]),
|
|
1102
|
+
[],
|
|
1103
|
+
);
|
|
1104
|
+
if (url !== nativeLocationOrigin && url.indexOf(nativeLocationOrigin + '/') !== 0) {
|
|
1105
|
+
omit(context);
|
|
1106
|
+
return nativeReflectApply(callable, receiver, applicationArguments);
|
|
1107
|
+
}
|
|
1108
|
+
if (context.events.length >= MAX_EVENTS) {
|
|
1109
|
+
saturate(context);
|
|
1110
|
+
return nativeReflectApply(callable, receiver, applicationArguments);
|
|
1111
|
+
}
|
|
1112
|
+
var requestParent = 'browser-' + context.traceId + '-' + String(context.events.length + 1).padStart(4, '0');
|
|
1113
|
+
var headerPairs = [
|
|
1114
|
+
['x-haystack-trace-id', context.traceId],
|
|
1115
|
+
['x-haystack-action-id', context.actionId],
|
|
1116
|
+
['x-haystack-cohort', '' + context.cohortIndex],
|
|
1117
|
+
['x-haystack-parent-event-id', requestParent],
|
|
1118
|
+
['x-haystack-request-site-id', sites.requestSiteId],
|
|
1119
|
+
['traceparent', traceparent(context.traceId)],
|
|
1120
|
+
];
|
|
1121
|
+
for (var index = 0; index < applicationArguments.length; index++) args[index] = applicationArguments[index];
|
|
1122
|
+
if (hasOptions) {
|
|
1123
|
+
var merged = mergeAngularHttpContractOptions(applicationArguments[optionsIndex], headerPairs);
|
|
1124
|
+
if (!merged) {
|
|
1125
|
+
omit(context);
|
|
1126
|
+
return nativeReflectApply(callable, receiver, applicationArguments);
|
|
1127
|
+
}
|
|
1128
|
+
args[optionsIndex] = merged;
|
|
1129
|
+
} else {
|
|
1130
|
+
while (args.length < optionsIndex) args.push(undefined);
|
|
1131
|
+
args[optionsIndex] = { headers: {
|
|
1132
|
+
'x-haystack-trace-id': context.traceId,
|
|
1133
|
+
'x-haystack-action-id': context.actionId,
|
|
1134
|
+
'x-haystack-cohort': '' + context.cohortIndex,
|
|
1135
|
+
'x-haystack-parent-event-id': requestParent,
|
|
1136
|
+
'x-haystack-request-site-id': sites.requestSiteId,
|
|
1137
|
+
'traceparent': traceparent(context.traceId),
|
|
1138
|
+
} };
|
|
1139
|
+
}
|
|
1140
|
+
var emittedParent = emit(sites.requestSiteId, 'request', 'sent', context.inputEventId || undefined);
|
|
1141
|
+
if (emittedParent !== requestParent) {
|
|
1142
|
+
return nativeReflectApply(callable, receiver, applicationArguments);
|
|
1143
|
+
}
|
|
1144
|
+
} catch (_) {
|
|
1145
|
+
omit(context);
|
|
1146
|
+
failOpen();
|
|
1147
|
+
return nativeReflectApply(callable, receiver, applicationArguments);
|
|
1148
|
+
}
|
|
1149
|
+
return nativeReflectApply(callable, receiver, args);
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1152
|
+
function deliver(segment) {
|
|
1153
|
+
try {
|
|
1154
|
+
if (recorderDisabled) return false;
|
|
1155
|
+
var endpoint = configuredEndpoint || ownDataValue('__HAYSTACK_WEB_ATLAS_ENDPOINT__');
|
|
1156
|
+
if (typeof endpoint !== 'string' || endpoint.length === 0) {
|
|
1157
|
+
recorderDisabled = true;
|
|
1158
|
+
return false;
|
|
1159
|
+
}
|
|
1160
|
+
if (actionSegmentsAttempted >= MAX_ACTION_SEGMENTS_PER_PAGE ||
|
|
1161
|
+
actionSegmentBytesAttempted >= MAX_ACTION_SEGMENT_BYTES_PER_PAGE) {
|
|
1162
|
+
recorderDisabled = true;
|
|
1163
|
+
return false;
|
|
1164
|
+
}
|
|
1165
|
+
actionSegmentsAttempted++;
|
|
1166
|
+
var body = nativeStringify(segment);
|
|
1167
|
+
if (body.length > MAX_ACTION_SEGMENT_BYTES_PER_PAGE - actionSegmentBytesAttempted) {
|
|
1168
|
+
recorderDisabled = true;
|
|
1169
|
+
return false;
|
|
1170
|
+
}
|
|
1171
|
+
actionSegmentBytesAttempted += body.length;
|
|
1172
|
+
if (actionSegmentsAttempted >= MAX_ACTION_SEGMENTS_PER_PAGE ||
|
|
1173
|
+
actionSegmentBytesAttempted >= MAX_ACTION_SEGMENT_BYTES_PER_PAGE) recorderDisabled = true;
|
|
1174
|
+
if (nativeBeacon) {
|
|
1175
|
+
try { if (nativeBeacon(endpoint, body)) return true; } catch (_) { failOpen(); }
|
|
1176
|
+
}
|
|
1177
|
+
if (!nativeFetch || !configuredPlatformFetch || !initialFetchLooksNative ||
|
|
1178
|
+
!nativePromiseThen || fallbackDeliveryUnavailable ||
|
|
1179
|
+
fallbackDeliveriesInFlight >= MAX_FALLBACK_DELIVERIES_IN_FLIGHT) {
|
|
1180
|
+
// Backpressure is a terminal page-local telemetry condition. Dropping
|
|
1181
|
+
// later evidence is safer than letting a collector outage accumulate
|
|
1182
|
+
// customer-page requests, closures, or serialized trace bodies.
|
|
1183
|
+
recorderDisabled = true;
|
|
1184
|
+
return false;
|
|
1185
|
+
}
|
|
1186
|
+
fallbackDeliveriesInFlight++;
|
|
1187
|
+
var settled = false;
|
|
1188
|
+
var settleFallback = function (failed) {
|
|
1189
|
+
if (settled) return;
|
|
1190
|
+
settled = true;
|
|
1191
|
+
fallbackDeliveriesInFlight--;
|
|
1192
|
+
if (failed) {
|
|
1193
|
+
fallbackDeliveryUnavailable = true;
|
|
1194
|
+
recorderDisabled = true;
|
|
1195
|
+
}
|
|
1196
|
+
};
|
|
1197
|
+
var delivery;
|
|
1198
|
+
try {
|
|
1199
|
+
delivery = nativeFetch(endpoint, {
|
|
1200
|
+
method: 'POST',
|
|
1201
|
+
body: body,
|
|
1202
|
+
keepalive: true,
|
|
1203
|
+
headers: { 'Content-Type': 'text/plain' },
|
|
1204
|
+
});
|
|
1205
|
+
} catch (_) {
|
|
1206
|
+
settleFallback(true);
|
|
1207
|
+
failOpen();
|
|
1208
|
+
return false;
|
|
1209
|
+
}
|
|
1210
|
+
if (delivery === null ||
|
|
1211
|
+
(typeof delivery !== 'object' && typeof delivery !== 'function')) {
|
|
1212
|
+
settleFallback(true);
|
|
1213
|
+
return false;
|
|
1214
|
+
}
|
|
1215
|
+
try {
|
|
1216
|
+
nativeReflectApply(nativePromiseThen, delivery, [
|
|
1217
|
+
function () { settleFallback(false); },
|
|
1218
|
+
function () { settleFallback(true); },
|
|
1219
|
+
]);
|
|
1220
|
+
} catch (_) {
|
|
1221
|
+
settleFallback(true);
|
|
1222
|
+
failOpen();
|
|
1223
|
+
return false;
|
|
1224
|
+
}
|
|
1225
|
+
return true;
|
|
1226
|
+
} catch (_) { failOpen(); }
|
|
1227
|
+
return false;
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1230
|
+
function conditionEventLimit(sites) {
|
|
1231
|
+
// Action start and input consume two fixed slots. Reserve the output slot
|
|
1232
|
+
// plus one request and (when declared) response for every static fetch
|
|
1233
|
+
// site that can fit inside the hard action ceiling. Conditions use the
|
|
1234
|
+
// remainder and disclose one bounded omission if they exhaust it, rather
|
|
1235
|
+
// than starving higher-value continuations in ordinary actions. If the
|
|
1236
|
+
// static continuations alone exceed the ceiling, conditions receive no
|
|
1237
|
+
// slots and the existing whole-buffer cutoff remains the final bound.
|
|
1238
|
+
var reserved = 1;
|
|
1239
|
+
var tokens = nativeObjectKeys(sites.fetchSites);
|
|
1240
|
+
for (var index = 0; index < tokens.length; index++) {
|
|
1241
|
+
var fetchSites = sites.fetchSites[tokens[index]];
|
|
1242
|
+
reserved += fetchSites && fetchSites.responseSiteId !== null ? 2 : 1;
|
|
1243
|
+
}
|
|
1244
|
+
var available = MAX_EVENTS - 2 - reserved;
|
|
1245
|
+
return available > 0 ? available : 0;
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1248
|
+
function beginAction(actionId, sites) {
|
|
1249
|
+
try {
|
|
1250
|
+
if (active || recorderDisabled) return false;
|
|
1251
|
+
var value = manifest();
|
|
1252
|
+
var action = actionFor(actionId);
|
|
1253
|
+
if (!value || !action || !sites || sessionCohort(value.cohortCount) !== action.cohortIndex) return false;
|
|
1254
|
+
var traceId = randomTraceId();
|
|
1255
|
+
if (!traceId) return false;
|
|
1256
|
+
active = {
|
|
1257
|
+
traceId: traceId,
|
|
1258
|
+
actionId: actionId,
|
|
1259
|
+
cohortIndex: action.cohortIndex,
|
|
1260
|
+
events: [],
|
|
1261
|
+
omittedEvents: 0,
|
|
1262
|
+
parentEventId: null,
|
|
1263
|
+
requestSiteId: sites.requestSiteId,
|
|
1264
|
+
responseSiteId: sites.responseSiteId,
|
|
1265
|
+
pendingFetches: 0,
|
|
1266
|
+
rootReturned: false,
|
|
1267
|
+
finishScheduled: false,
|
|
1268
|
+
runtimeConfig: sites,
|
|
1269
|
+
conditionOutcomeKeys: Object.create(null),
|
|
1270
|
+
conditionEvents: 0,
|
|
1271
|
+
conditionEventLimit: conditionEventLimit(sites),
|
|
1272
|
+
conditionBudgetOmitted: false,
|
|
1273
|
+
quarantineProbeOmitted: false,
|
|
1274
|
+
saturated: false,
|
|
1275
|
+
};
|
|
1276
|
+
emit(sites.actionSiteId, 'action-start', 'started', null);
|
|
1277
|
+
return true;
|
|
1278
|
+
} catch (_) {
|
|
1279
|
+
failOpen();
|
|
1280
|
+
active = null;
|
|
1281
|
+
return false;
|
|
1282
|
+
}
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
function wrapAction(actionId, handler) {
|
|
1286
|
+
if (typeof handler !== 'function') return handler;
|
|
1287
|
+
return function haystackWebAtlasActionWrapper() {
|
|
1288
|
+
var sites = runtimeActions[actionId];
|
|
1289
|
+
if (!sites) return nativeReflectApply(handler, this, arguments);
|
|
1290
|
+
if (active) {
|
|
1291
|
+
// A synchronous root can finish in the same task that starts the next
|
|
1292
|
+
// user action, before its zero-delay cleanup callback has run. It has
|
|
1293
|
+
// no outstanding application work, so close it now and attribute the
|
|
1294
|
+
// new action normally. This is common with input followed immediately
|
|
1295
|
+
// by submit (autofill, keyboard submission, and fast automation).
|
|
1296
|
+
if (active.rootReturned && active.pendingFetches === 0) {
|
|
1297
|
+
endAction();
|
|
1298
|
+
} else {
|
|
1299
|
+
// A single global action cannot safely attribute probes from
|
|
1300
|
+
// overlapping roots. Close the older partial trace with an explicit
|
|
1301
|
+
// omission, then let the exact newer action become the root. Stable
|
|
1302
|
+
// identities still validate captured continuations. Token-only async
|
|
1303
|
+
// probes cannot carry a portable root owner, so direct-probe mode
|
|
1304
|
+
// stays enabled after the first overlap rather than guessing.
|
|
1305
|
+
omit(active);
|
|
1306
|
+
overlapQuarantine = true;
|
|
1307
|
+
endAction();
|
|
1308
|
+
}
|
|
1309
|
+
}
|
|
1310
|
+
var started = beginAction(actionId, sites);
|
|
1311
|
+
if (!started) return nativeReflectApply(handler, this, arguments);
|
|
1312
|
+
var context = active;
|
|
1313
|
+
var inputEventId = emit(sites.inputSiteId, 'input-shape', shapeOutcome(arguments.length > 0 ? arguments[0] : undefined));
|
|
1314
|
+
if (context) context.inputEventId = inputEventId;
|
|
1315
|
+
var result;
|
|
1316
|
+
var previousDirectProbeContext = directProbeContext;
|
|
1317
|
+
directProbeContext = context;
|
|
1318
|
+
try {
|
|
1319
|
+
result = nativeReflectApply(handler, this, arguments);
|
|
1320
|
+
} catch (error) {
|
|
1321
|
+
if (context) context.rootReturned = true;
|
|
1322
|
+
if (context === active) endAction();
|
|
1323
|
+
throw error;
|
|
1324
|
+
} finally {
|
|
1325
|
+
directProbeContext = previousDirectProbeContext;
|
|
1326
|
+
}
|
|
1327
|
+
|
|
1328
|
+
// Keep a real Promise-returning action open across awaits. We attach a
|
|
1329
|
+
// side observer through the captured native Promise method and return the
|
|
1330
|
+
// application's original Promise unchanged.
|
|
1331
|
+
var observesPromise = false;
|
|
1332
|
+
if (context && nativePromiseThen && result !== null &&
|
|
1333
|
+
(typeof result === 'object' || typeof result === 'function')) {
|
|
1334
|
+
try {
|
|
1335
|
+
nativeReflectApply(nativePromiseThen, result, [function (value) {
|
|
1336
|
+
if (context === active) {
|
|
1337
|
+
if (!context.saturated) {
|
|
1338
|
+
emit(sites.outputSiteId, 'output-shape', shapeOutcome(value), context.inputEventId || undefined);
|
|
1339
|
+
}
|
|
1340
|
+
context.rootReturned = true;
|
|
1341
|
+
scheduleFinish(context);
|
|
1342
|
+
}
|
|
1343
|
+
}, function (error) {
|
|
1344
|
+
if (context === active) {
|
|
1345
|
+
context.rootReturned = true;
|
|
1346
|
+
scheduleFinish(context);
|
|
1347
|
+
}
|
|
1348
|
+
// Do not hide ignored async-handler failures from error monitoring.
|
|
1349
|
+
throw error;
|
|
1350
|
+
}]);
|
|
1351
|
+
observesPromise = true;
|
|
1352
|
+
} catch (_) { failOpen(); }
|
|
1353
|
+
}
|
|
1354
|
+
if (!observesPromise) {
|
|
1355
|
+
if (context && !nativePromiseThen && result !== null &&
|
|
1356
|
+
(typeof result === 'object' || typeof result === 'function')) omit(context);
|
|
1357
|
+
if (context === active && !context.saturated) {
|
|
1358
|
+
emit(sites.outputSiteId, 'output-shape', shapeOutcome(result), context && context.inputEventId || undefined);
|
|
1359
|
+
}
|
|
1360
|
+
if (context) {
|
|
1361
|
+
context.rootReturned = true;
|
|
1362
|
+
scheduleFinish(context);
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1365
|
+
return result;
|
|
1366
|
+
};
|
|
1367
|
+
}
|
|
1368
|
+
|
|
1369
|
+
function conditionAt(token, value) {
|
|
1370
|
+
try {
|
|
1371
|
+
var context = active;
|
|
1372
|
+
if (context && !admitProbe(context)) return value;
|
|
1373
|
+
var siteId = context && !context.saturated && context.runtimeConfig && context.runtimeConfig.conditionSites[token];
|
|
1374
|
+
if (siteId) emit(siteId, 'condition', value ? 'boolean:true' : 'boolean:false', context.inputEventId || undefined);
|
|
1375
|
+
} catch (_) { failOpen(); }
|
|
1376
|
+
return value;
|
|
1377
|
+
}
|
|
1378
|
+
|
|
1379
|
+
// Loop and coarse-entry probes can execute many times in one action. Keep
|
|
1380
|
+
// the first observation of each fixed boolean outcome so they cannot crowd
|
|
1381
|
+
// the action's request/response evidence out of the bounded event buffer.
|
|
1382
|
+
function conditionOnceAt(token, value) {
|
|
1383
|
+
try {
|
|
1384
|
+
var context = active;
|
|
1385
|
+
if (context && !admitProbe(context)) return value;
|
|
1386
|
+
var siteId = context && !context.saturated && context.runtimeConfig && context.runtimeConfig.conditionSites[token];
|
|
1387
|
+
if (siteId) {
|
|
1388
|
+
var outcome = value ? 'boolean:true' : 'boolean:false';
|
|
1389
|
+
var key = siteId + '\0' + outcome;
|
|
1390
|
+
var seen = context.conditionOutcomeKeys;
|
|
1391
|
+
if (seen[key] !== true) {
|
|
1392
|
+
seen[key] = true;
|
|
1393
|
+
emit(siteId, 'condition', outcome, context.inputEventId || undefined);
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1396
|
+
} catch (_) { failOpen(); }
|
|
1397
|
+
return value;
|
|
1398
|
+
}
|
|
1399
|
+
|
|
1400
|
+
function endAction() {
|
|
1401
|
+
try {
|
|
1402
|
+
if (!active) return null;
|
|
1403
|
+
var value = manifest();
|
|
1404
|
+
var segment = {
|
|
1405
|
+
schemaVersion: 'haystack-web-node-atlas-segment-v1',
|
|
1406
|
+
traceId: active.traceId,
|
|
1407
|
+
actionId: active.actionId,
|
|
1408
|
+
surface: 'browser',
|
|
1409
|
+
buildId: value.browserBuildId,
|
|
1410
|
+
cohortIndex: active.cohortIndex,
|
|
1411
|
+
events: active.events.slice(),
|
|
1412
|
+
omittedEvents: active.omittedEvents,
|
|
1413
|
+
};
|
|
1414
|
+
active = null;
|
|
1415
|
+
deliver(segment);
|
|
1416
|
+
return segment;
|
|
1417
|
+
} catch (_) {
|
|
1418
|
+
failOpen();
|
|
1419
|
+
active = null;
|
|
1420
|
+
return null;
|
|
1421
|
+
}
|
|
1422
|
+
}
|
|
1423
|
+
|
|
1424
|
+
var api = Object.freeze({
|
|
1425
|
+
version: 'haystack-web-node-atlas-browser-v1',
|
|
1426
|
+
configure: configure,
|
|
1427
|
+
registerAction: registerAction,
|
|
1428
|
+
beginAction: beginAction,
|
|
1429
|
+
inputShape: function (siteId, outcome) { if (admitProbe(active)) emit(siteId, 'input-shape', outcome); },
|
|
1430
|
+
condition: function (siteId, outcome) { if (admitProbe(active)) emit(siteId, 'condition', outcome); },
|
|
1431
|
+
fetch: correlatedFetch,
|
|
1432
|
+
fetchAt: fetchAt,
|
|
1433
|
+
angularHttpAt: angularHttpAt,
|
|
1434
|
+
axiosAt: axiosAt,
|
|
1435
|
+
oazapftsAt: oazapftsAt,
|
|
1436
|
+
wrapAction: wrapAction,
|
|
1437
|
+
conditionAt: conditionAt,
|
|
1438
|
+
conditionOnceAt: conditionOnceAt,
|
|
1439
|
+
outputShape: function (siteId, outcome) { if (admitProbe(active)) emit(siteId, 'output-shape', outcome); },
|
|
1440
|
+
uiOutcome: function (siteId, outcome) { if (admitProbe(active)) emit(siteId, 'ui-outcome', outcome); },
|
|
1441
|
+
error: function (siteId, outcome) { if (admitProbe(active)) emit(siteId, 'error', outcome); },
|
|
1442
|
+
endAction: endAction,
|
|
1443
|
+
status: function () {
|
|
1444
|
+
return active
|
|
1445
|
+
? {
|
|
1446
|
+
active: true,
|
|
1447
|
+
disabled: recorderDisabled,
|
|
1448
|
+
saturated: active.saturated,
|
|
1449
|
+
events: active.events.length,
|
|
1450
|
+
omittedEvents: active.omittedEvents,
|
|
1451
|
+
traceId: active.traceId,
|
|
1452
|
+
}
|
|
1453
|
+
: { active: false, disabled: recorderDisabled };
|
|
1454
|
+
},
|
|
1455
|
+
});
|
|
1456
|
+
try {
|
|
1457
|
+
Object.defineProperty(host, '__haystackWebAtlas', {
|
|
1458
|
+
configurable: false,
|
|
1459
|
+
enumerable: false,
|
|
1460
|
+
writable: false,
|
|
1461
|
+
value: api,
|
|
1462
|
+
});
|
|
1463
|
+
} catch (_) {
|
|
1464
|
+
// The application owns this namespace. Never redefine or mutate it, and
|
|
1465
|
+
// never prevent the containing module from evaluating.
|
|
1466
|
+
return null;
|
|
1467
|
+
}
|
|
1468
|
+
return api;
|
|
1469
|
+
})(globalThis);
|