@pingops/core 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +122 -129
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +45 -56
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +45 -56
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +118 -129
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -29,9 +29,10 @@ interface SpanPayload {
|
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
|
-
* Attributes to propagate to
|
|
32
|
+
* Attributes to propagate to spans (e.g. when starting a trace with startTrace).
|
|
33
33
|
*/
|
|
34
|
-
interface
|
|
34
|
+
interface PingopsTraceAttributes {
|
|
35
|
+
traceId?: string;
|
|
35
36
|
userId?: string;
|
|
36
37
|
sessionId?: string;
|
|
37
38
|
tags?: string[];
|
|
@@ -160,17 +161,16 @@ declare function filterHeaders(headers: Record<string, string | string[] | undef
|
|
|
160
161
|
/**
|
|
161
162
|
* Extracts and normalizes headers from OpenTelemetry span attributes
|
|
162
163
|
*
|
|
163
|
-
* Handles
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
* - 'http.request.header.
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
* - 'http.request.header.3': 'Bearer token'
|
|
164
|
+
* Handles two formats:
|
|
165
|
+
* 1. Flat array format (e.g., 'http.request.header.0', 'http.request.header.1')
|
|
166
|
+
* - 'http.request.header.0': 'Content-Type'
|
|
167
|
+
* - 'http.request.header.1': 'application/json'
|
|
168
|
+
* 2. Direct key-value format (e.g., 'http.request.header.date', 'http.request.header.content-type')
|
|
169
|
+
* - 'http.request.header.date': 'Mon, 12 Jan 2026 20:22:38 GMT'
|
|
170
|
+
* - 'http.request.header.content-type': 'application/json'
|
|
171
171
|
*
|
|
172
172
|
* This function converts them to:
|
|
173
|
-
* - { 'Content-Type': 'application/json', '
|
|
173
|
+
* - { 'Content-Type': 'application/json', 'date': 'Mon, 12 Jan 2026 20:22:38 GMT' }
|
|
174
174
|
*/
|
|
175
175
|
declare function extractHeadersFromAttributes(attributes: Record<string, unknown>, headerPrefix: "http.request.header" | "http.response.header"): Record<string, string | string[] | undefined> | null;
|
|
176
176
|
/**
|
|
@@ -178,6 +178,26 @@ declare function extractHeadersFromAttributes(attributes: Record<string, unknown
|
|
|
178
178
|
*/
|
|
179
179
|
declare function normalizeHeaders(headers: unknown): Record<string, string | string[] | undefined>;
|
|
180
180
|
//#endregion
|
|
181
|
+
//#region src/filtering/body-decoder.d.ts
|
|
182
|
+
/**
|
|
183
|
+
* Minimal body handling: buffer to string for span attributes.
|
|
184
|
+
* No decompression or truncation; for compressed responses the instrumentation
|
|
185
|
+
* sends base64 + content-encoding so the backend can decompress.
|
|
186
|
+
*/
|
|
187
|
+
/** Span attribute for response content-encoding when body is sent as base64. */
|
|
188
|
+
declare const HTTP_RESPONSE_CONTENT_ENCODING = "http.response.content_encoding";
|
|
189
|
+
/**
|
|
190
|
+
* Returns true if the content-encoding header indicates a compressed body
|
|
191
|
+
* (gzip, br, deflate, x-gzip, x-deflate). Used to decide whether to send
|
|
192
|
+
* body as base64 + content-encoding for backend decompression.
|
|
193
|
+
*/
|
|
194
|
+
declare function isCompressedContentEncoding(headerValue: unknown): boolean;
|
|
195
|
+
/**
|
|
196
|
+
* Converts a buffer to a UTF-8 string for use as request/response body on spans.
|
|
197
|
+
* Returns null for null, undefined, or empty buffer.
|
|
198
|
+
*/
|
|
199
|
+
declare function bufferToBodyString(buffer: Buffer | null | undefined): string | null;
|
|
200
|
+
//#endregion
|
|
181
201
|
//#region src/utils/span-extractor.d.ts
|
|
182
202
|
/**
|
|
183
203
|
* Extracts structured payload from a span
|
|
@@ -221,11 +241,10 @@ declare function createLogger(prefix: string): Logger;
|
|
|
221
241
|
* OpenTelemetry context keys for PingOps
|
|
222
242
|
*/
|
|
223
243
|
/**
|
|
224
|
-
* Context key for
|
|
225
|
-
*
|
|
226
|
-
* This allows wrapHttp to control which HTTP calls are captured.
|
|
244
|
+
* Context key for trace ID attribute.
|
|
245
|
+
* Used to propagate trace identifier to all spans in the context.
|
|
227
246
|
*/
|
|
228
|
-
declare const
|
|
247
|
+
declare const PINGOPS_TRACE_ID: symbol;
|
|
229
248
|
/**
|
|
230
249
|
* Context key for user ID attribute.
|
|
231
250
|
* Used to propagate user identifier to all spans in the context.
|
|
@@ -249,58 +268,28 @@ declare const PINGOPS_METADATA: symbol;
|
|
|
249
268
|
/**
|
|
250
269
|
* Context key for capturing request body.
|
|
251
270
|
* When set, controls whether request bodies should be captured for HTTP spans.
|
|
252
|
-
* This allows wrapHttp to control body capture per-request.
|
|
253
271
|
*/
|
|
254
272
|
declare const PINGOPS_CAPTURE_REQUEST_BODY: symbol;
|
|
255
273
|
/**
|
|
256
274
|
* Context key for capturing response body.
|
|
257
275
|
* When set, controls whether response bodies should be captured for HTTP spans.
|
|
258
|
-
* This allows wrapHttp to control body capture per-request.
|
|
259
276
|
*/
|
|
260
277
|
declare const PINGOPS_CAPTURE_RESPONSE_BODY: symbol;
|
|
261
278
|
//#endregion
|
|
262
|
-
//#region src/
|
|
279
|
+
//#region src/trace-id.d.ts
|
|
263
280
|
/**
|
|
264
|
-
*
|
|
281
|
+
* Deterministic and random trace ID generation for PingOps
|
|
265
282
|
*/
|
|
266
|
-
interface WrapHttpOptions {
|
|
267
|
-
attributes?: WrapHttpAttributes;
|
|
268
|
-
/**
|
|
269
|
-
* Callback to check if SDK is initialized.
|
|
270
|
-
* Required to determine if global instrumentation is enabled.
|
|
271
|
-
*/
|
|
272
|
-
checkInitialized: () => boolean;
|
|
273
|
-
/**
|
|
274
|
-
* Callback to check if global instrumentation is enabled.
|
|
275
|
-
* Required to determine instrumentation behavior.
|
|
276
|
-
*/
|
|
277
|
-
isGlobalInstrumentationEnabled: () => boolean;
|
|
278
|
-
/**
|
|
279
|
-
* Optional callback to ensure SDK is initialized (auto-initialization).
|
|
280
|
-
* If not provided, wrapHttp will try to auto-initialize from environment variables.
|
|
281
|
-
*/
|
|
282
|
-
ensureInitialized?: () => Promise<void>;
|
|
283
|
-
}
|
|
284
283
|
/**
|
|
285
|
-
*
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
*
|
|
290
|
-
*
|
|
291
|
-
* -
|
|
292
|
-
* `wrapHttp` only adds attributes to spans created within the wrapped block.
|
|
293
|
-
* - If `initializePingops` was NOT called: Only HTTP requests within `wrapHttp` blocks
|
|
294
|
-
* are instrumented. Requests outside `wrapHttp` are not instrumented.
|
|
295
|
-
*
|
|
296
|
-
* Note: This is the low-level API. For a simpler API with automatic setup,
|
|
297
|
-
* use `wrapHttp` from `@pingops/sdk` instead.
|
|
298
|
-
*
|
|
299
|
-
* @param options - Options including attributes and required callbacks
|
|
300
|
-
* @param fn - Function to execute within the attribute context
|
|
301
|
-
* @returns The result of the function
|
|
284
|
+
* Converts a Uint8Array to a lowercase hex string.
|
|
285
|
+
*/
|
|
286
|
+
declare function uint8ArrayToHex(bytes: Uint8Array): string;
|
|
287
|
+
/**
|
|
288
|
+
* Creates a trace ID (32 hex chars).
|
|
289
|
+
* - If `seed` is provided: deterministic via SHA-256 of the seed (first 32 hex chars).
|
|
290
|
+
* - Otherwise: random 16 bytes as 32 hex chars.
|
|
302
291
|
*/
|
|
303
|
-
declare function
|
|
292
|
+
declare function createTraceId(seed?: string): Promise<string>;
|
|
304
293
|
//#endregion
|
|
305
|
-
export { DEFAULT_REDACTION_CONFIG, DEFAULT_SENSITIVE_HEADER_PATTERNS, DomainRule, HeaderRedactionConfig, HeaderRedactionStrategy, LogLevel, Logger, PINGOPS_CAPTURE_REQUEST_BODY, PINGOPS_CAPTURE_RESPONSE_BODY,
|
|
294
|
+
export { DEFAULT_REDACTION_CONFIG, DEFAULT_SENSITIVE_HEADER_PATTERNS, DomainRule, HTTP_RESPONSE_CONTENT_ENCODING, HeaderRedactionConfig, HeaderRedactionStrategy, LogLevel, Logger, PINGOPS_CAPTURE_REQUEST_BODY, PINGOPS_CAPTURE_RESPONSE_BODY, PINGOPS_METADATA, PINGOPS_SESSION_ID, PINGOPS_TAGS, PINGOPS_TRACE_ID, PINGOPS_USER_ID, PingopsTraceAttributes, SpanPayload, bufferToBodyString, createLogger, createTraceId, extractHeadersFromAttributes, extractSpanPayload, filterHeaders, getPropagatedAttributesFromContext, isCompressedContentEncoding, isSensitiveHeader, isSpanEligible, normalizeHeaders, redactHeaderValue, shouldCaptureSpan, uint8ArrayToHex };
|
|
306
295
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/types.ts","../src/filtering/span-filter.ts","../src/filtering/domain-filter.ts","../src/filtering/sensitive-headers.ts","../src/filtering/header-filter.ts","../src/utils/span-extractor.ts","../src/utils/context-extractor.ts","../src/logger.ts","../src/context-keys.ts","../src/
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/types.ts","../src/filtering/span-filter.ts","../src/filtering/domain-filter.ts","../src/filtering/sensitive-headers.ts","../src/filtering/header-filter.ts","../src/filtering/body-decoder.ts","../src/utils/span-extractor.ts","../src/utils/context-extractor.ts","../src/logger.ts","../src/context-keys.ts","../src/trace-id.ts"],"sourcesContent":[],"mappings":";;;;;;;UAIiB,UAAA;EAAA,MAAA,EAAA,MAAU;EASV,KAAA,CAAA,EAAA,MAAW,EAAA;EAmBX,gBAAA,CAAA,EAAA,MAAsB,EAAA;;;;ACfvC;UDJiB,WAAA;;;EEuDD,YAAA,CAAA,EAAA,MAAiB;;;;EC5DpB,OAAA,EAAA,MAAA;EAqED,QAAA,EAAA,MAAA;EAsBK,UAAA,EH7EH,MG6EG,CAAA,MAAqB,EAAA,OAAA,CAWzB;EAwBA,MAAA,EAAA;IAgBG,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+
* Attributes to propagate to spans (e.g. when starting a trace with startTrace).
|
|
33
33
|
*/
|
|
34
|
-
interface
|
|
34
|
+
interface PingopsTraceAttributes {
|
|
35
|
+
traceId?: string;
|
|
35
36
|
userId?: string;
|
|
36
37
|
sessionId?: string;
|
|
37
38
|
tags?: string[];
|
|
@@ -160,17 +161,16 @@ declare function filterHeaders(headers: Record<string, string | string[] | undef
|
|
|
160
161
|
/**
|
|
161
162
|
* Extracts and normalizes headers from OpenTelemetry span attributes
|
|
162
163
|
*
|
|
163
|
-
* Handles
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
* - 'http.request.header.
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
* - 'http.request.header.3': 'Bearer token'
|
|
164
|
+
* Handles two formats:
|
|
165
|
+
* 1. Flat array format (e.g., 'http.request.header.0', 'http.request.header.1')
|
|
166
|
+
* - 'http.request.header.0': 'Content-Type'
|
|
167
|
+
* - 'http.request.header.1': 'application/json'
|
|
168
|
+
* 2. Direct key-value format (e.g., 'http.request.header.date', 'http.request.header.content-type')
|
|
169
|
+
* - 'http.request.header.date': 'Mon, 12 Jan 2026 20:22:38 GMT'
|
|
170
|
+
* - 'http.request.header.content-type': 'application/json'
|
|
171
171
|
*
|
|
172
172
|
* This function converts them to:
|
|
173
|
-
* - { 'Content-Type': 'application/json', '
|
|
173
|
+
* - { 'Content-Type': 'application/json', 'date': 'Mon, 12 Jan 2026 20:22:38 GMT' }
|
|
174
174
|
*/
|
|
175
175
|
declare function extractHeadersFromAttributes(attributes: Record<string, unknown>, headerPrefix: "http.request.header" | "http.response.header"): Record<string, string | string[] | undefined> | null;
|
|
176
176
|
/**
|
|
@@ -178,6 +178,26 @@ declare function extractHeadersFromAttributes(attributes: Record<string, unknown
|
|
|
178
178
|
*/
|
|
179
179
|
declare function normalizeHeaders(headers: unknown): Record<string, string | string[] | undefined>;
|
|
180
180
|
//#endregion
|
|
181
|
+
//#region src/filtering/body-decoder.d.ts
|
|
182
|
+
/**
|
|
183
|
+
* Minimal body handling: buffer to string for span attributes.
|
|
184
|
+
* No decompression or truncation; for compressed responses the instrumentation
|
|
185
|
+
* sends base64 + content-encoding so the backend can decompress.
|
|
186
|
+
*/
|
|
187
|
+
/** Span attribute for response content-encoding when body is sent as base64. */
|
|
188
|
+
declare const HTTP_RESPONSE_CONTENT_ENCODING = "http.response.content_encoding";
|
|
189
|
+
/**
|
|
190
|
+
* Returns true if the content-encoding header indicates a compressed body
|
|
191
|
+
* (gzip, br, deflate, x-gzip, x-deflate). Used to decide whether to send
|
|
192
|
+
* body as base64 + content-encoding for backend decompression.
|
|
193
|
+
*/
|
|
194
|
+
declare function isCompressedContentEncoding(headerValue: unknown): boolean;
|
|
195
|
+
/**
|
|
196
|
+
* Converts a buffer to a UTF-8 string for use as request/response body on spans.
|
|
197
|
+
* Returns null for null, undefined, or empty buffer.
|
|
198
|
+
*/
|
|
199
|
+
declare function bufferToBodyString(buffer: Buffer | null | undefined): string | null;
|
|
200
|
+
//#endregion
|
|
181
201
|
//#region src/utils/span-extractor.d.ts
|
|
182
202
|
/**
|
|
183
203
|
* Extracts structured payload from a span
|
|
@@ -221,11 +241,10 @@ declare function createLogger(prefix: string): Logger;
|
|
|
221
241
|
* OpenTelemetry context keys for PingOps
|
|
222
242
|
*/
|
|
223
243
|
/**
|
|
224
|
-
* Context key for
|
|
225
|
-
*
|
|
226
|
-
* This allows wrapHttp to control which HTTP calls are captured.
|
|
244
|
+
* Context key for trace ID attribute.
|
|
245
|
+
* Used to propagate trace identifier to all spans in the context.
|
|
227
246
|
*/
|
|
228
|
-
declare const
|
|
247
|
+
declare const PINGOPS_TRACE_ID: symbol;
|
|
229
248
|
/**
|
|
230
249
|
* Context key for user ID attribute.
|
|
231
250
|
* Used to propagate user identifier to all spans in the context.
|
|
@@ -249,58 +268,28 @@ declare const PINGOPS_METADATA: symbol;
|
|
|
249
268
|
/**
|
|
250
269
|
* Context key for capturing request body.
|
|
251
270
|
* When set, controls whether request bodies should be captured for HTTP spans.
|
|
252
|
-
* This allows wrapHttp to control body capture per-request.
|
|
253
271
|
*/
|
|
254
272
|
declare const PINGOPS_CAPTURE_REQUEST_BODY: symbol;
|
|
255
273
|
/**
|
|
256
274
|
* Context key for capturing response body.
|
|
257
275
|
* When set, controls whether response bodies should be captured for HTTP spans.
|
|
258
|
-
* This allows wrapHttp to control body capture per-request.
|
|
259
276
|
*/
|
|
260
277
|
declare const PINGOPS_CAPTURE_RESPONSE_BODY: symbol;
|
|
261
278
|
//#endregion
|
|
262
|
-
//#region src/
|
|
279
|
+
//#region src/trace-id.d.ts
|
|
263
280
|
/**
|
|
264
|
-
*
|
|
281
|
+
* Deterministic and random trace ID generation for PingOps
|
|
265
282
|
*/
|
|
266
|
-
interface WrapHttpOptions {
|
|
267
|
-
attributes?: WrapHttpAttributes;
|
|
268
|
-
/**
|
|
269
|
-
* Callback to check if SDK is initialized.
|
|
270
|
-
* Required to determine if global instrumentation is enabled.
|
|
271
|
-
*/
|
|
272
|
-
checkInitialized: () => boolean;
|
|
273
|
-
/**
|
|
274
|
-
* Callback to check if global instrumentation is enabled.
|
|
275
|
-
* Required to determine instrumentation behavior.
|
|
276
|
-
*/
|
|
277
|
-
isGlobalInstrumentationEnabled: () => boolean;
|
|
278
|
-
/**
|
|
279
|
-
* Optional callback to ensure SDK is initialized (auto-initialization).
|
|
280
|
-
* If not provided, wrapHttp will try to auto-initialize from environment variables.
|
|
281
|
-
*/
|
|
282
|
-
ensureInitialized?: () => Promise<void>;
|
|
283
|
-
}
|
|
284
283
|
/**
|
|
285
|
-
*
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
*
|
|
290
|
-
*
|
|
291
|
-
* -
|
|
292
|
-
* `wrapHttp` only adds attributes to spans created within the wrapped block.
|
|
293
|
-
* - If `initializePingops` was NOT called: Only HTTP requests within `wrapHttp` blocks
|
|
294
|
-
* are instrumented. Requests outside `wrapHttp` are not instrumented.
|
|
295
|
-
*
|
|
296
|
-
* Note: This is the low-level API. For a simpler API with automatic setup,
|
|
297
|
-
* use `wrapHttp` from `@pingops/sdk` instead.
|
|
298
|
-
*
|
|
299
|
-
* @param options - Options including attributes and required callbacks
|
|
300
|
-
* @param fn - Function to execute within the attribute context
|
|
301
|
-
* @returns The result of the function
|
|
284
|
+
* Converts a Uint8Array to a lowercase hex string.
|
|
285
|
+
*/
|
|
286
|
+
declare function uint8ArrayToHex(bytes: Uint8Array): string;
|
|
287
|
+
/**
|
|
288
|
+
* Creates a trace ID (32 hex chars).
|
|
289
|
+
* - If `seed` is provided: deterministic via SHA-256 of the seed (first 32 hex chars).
|
|
290
|
+
* - Otherwise: random 16 bytes as 32 hex chars.
|
|
302
291
|
*/
|
|
303
|
-
declare function
|
|
292
|
+
declare function createTraceId(seed?: string): Promise<string>;
|
|
304
293
|
//#endregion
|
|
305
|
-
export { DEFAULT_REDACTION_CONFIG, DEFAULT_SENSITIVE_HEADER_PATTERNS, DomainRule, HeaderRedactionConfig, HeaderRedactionStrategy, LogLevel, Logger, PINGOPS_CAPTURE_REQUEST_BODY, PINGOPS_CAPTURE_RESPONSE_BODY,
|
|
294
|
+
export { DEFAULT_REDACTION_CONFIG, DEFAULT_SENSITIVE_HEADER_PATTERNS, DomainRule, HTTP_RESPONSE_CONTENT_ENCODING, HeaderRedactionConfig, HeaderRedactionStrategy, LogLevel, Logger, PINGOPS_CAPTURE_REQUEST_BODY, PINGOPS_CAPTURE_RESPONSE_BODY, PINGOPS_METADATA, PINGOPS_SESSION_ID, PINGOPS_TAGS, PINGOPS_TRACE_ID, PINGOPS_USER_ID, PingopsTraceAttributes, SpanPayload, bufferToBodyString, createLogger, createTraceId, extractHeadersFromAttributes, extractSpanPayload, filterHeaders, getPropagatedAttributesFromContext, isCompressedContentEncoding, isSensitiveHeader, isSpanEligible, normalizeHeaders, redactHeaderValue, shouldCaptureSpan, uint8ArrayToHex };
|
|
306
295
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/filtering/span-filter.ts","../src/filtering/domain-filter.ts","../src/filtering/sensitive-headers.ts","../src/filtering/header-filter.ts","../src/utils/span-extractor.ts","../src/utils/context-extractor.ts","../src/logger.ts","../src/context-keys.ts","../src/
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/filtering/span-filter.ts","../src/filtering/domain-filter.ts","../src/filtering/sensitive-headers.ts","../src/filtering/header-filter.ts","../src/filtering/body-decoder.ts","../src/utils/span-extractor.ts","../src/utils/context-extractor.ts","../src/logger.ts","../src/context-keys.ts","../src/trace-id.ts"],"sourcesContent":[],"mappings":";;;;;;;UAIiB,UAAA;EAAA,MAAA,EAAA,MAAU;EASV,KAAA,CAAA,EAAA,MAAW,EAAA;EAmBX,gBAAA,CAAA,EAAA,MAAsB,EAAA;;;;ACfvC;UDJiB,WAAA;;;EEuDD,YAAA,CAAA,EAAA,MAAiB;;;;EC5DpB,OAAA,EAAA,MAAA;EAqED,QAAA,EAAA,MAAA;EAsBK,UAAA,EH7EH,MG6EG,CAAA,MAAqB,EAAA,OAAA,CAAA;EAmCzB,MAAA,EAAA;IAgBG,IAAA,EAAA,MAAA;IAuDA,OAAA,CAAA,EAAA,MAAiB;;;;AC9IjC;;AAIoB,UJnCH,sBAAA,CImCG;EACjB,OAAA,CAAA,EAAA,MAAA;EAAM,MAAA,CAAA,EAAA,MAAA;EAyGO,SAAA,CAAA,EAAA,MAAA;EAuHA,IAAA,CAAA,EAAA,MAAA,EAAA;aJ/PH;;;AK9Bb;AAqBA;EAWgB,kBAAA,CAAA,EAAkB,OAAA;;;;ACwClC;EACQ,mBAAA,CAAA,EAAA,OAAA;;;;AN5ER;AASA;AAmBA;;;;ACfA;iBAAgB,cAAA,OAAqB;;;ADbrC;AASA;AAmBA;iBEoCgB,iBAAA,gCAEI,+BACD;;;;;;;AF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