superapp-miniapp-invoke-native 1.11.4 → 1.12.1
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/lib/main.d.ts +88 -0
- package/lib/main.js +433 -372
- package/lib/main.umd.cjs +1 -1
- package/package.json +1 -1
package/lib/main.d.ts
CHANGED
|
@@ -365,6 +365,34 @@ declare interface MiniAppParamsType {
|
|
|
365
365
|
miniAppIds?: any[];
|
|
366
366
|
}
|
|
367
367
|
|
|
368
|
+
export declare interface MiniappSpanErrorInput {
|
|
369
|
+
type?: string;
|
|
370
|
+
message: string;
|
|
371
|
+
stack?: string;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
export declare interface MiniappSpanEventInput {
|
|
375
|
+
name: string;
|
|
376
|
+
/** Unix epoch time in milliseconds. Must fall inside its span. */
|
|
377
|
+
time: number;
|
|
378
|
+
attributes?: OtelAttributes;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
export declare interface MiniappSpanInput {
|
|
382
|
+
name: string;
|
|
383
|
+
kind: OtelSpanKind;
|
|
384
|
+
/** Unix epoch time in milliseconds. */
|
|
385
|
+
startTime: number;
|
|
386
|
+
/** Unix epoch time in milliseconds. Children must remain inside the parent interval. */
|
|
387
|
+
endTime: number;
|
|
388
|
+
status: OtelSpanStatus;
|
|
389
|
+
attributes?: OtelAttributes;
|
|
390
|
+
events?: MiniappSpanEventInput[];
|
|
391
|
+
error?: MiniappSpanErrorInput;
|
|
392
|
+
/** Child spans. The shell creates each child with this span as its OTel parent. */
|
|
393
|
+
children?: MiniappSpanInput[];
|
|
394
|
+
}
|
|
395
|
+
|
|
368
396
|
declare type MiniAppType = {
|
|
369
397
|
miniApp: string;
|
|
370
398
|
link?: never;
|
|
@@ -397,6 +425,7 @@ export declare class NativeApi {
|
|
|
397
425
|
httpPlugin: HttpPlugins;
|
|
398
426
|
printPlugins: PrintPlugins;
|
|
399
427
|
downloadFilePlugin: DownloadFilePlugin;
|
|
428
|
+
otelPlugins: OtelPlugins;
|
|
400
429
|
}
|
|
401
430
|
|
|
402
431
|
declare interface NativeInfoConfigType {
|
|
@@ -421,6 +450,38 @@ declare interface NativeSendPrintParamsType {
|
|
|
421
450
|
[key: string]: any;
|
|
422
451
|
}
|
|
423
452
|
|
|
453
|
+
export declare const OTEL_PLUGIN_PROTOCOL_VERSION: "1.0";
|
|
454
|
+
|
|
455
|
+
export declare type OtelAttributes = Record<string, OtelAttributeValue>;
|
|
456
|
+
|
|
457
|
+
export declare type OtelAttributeValue = string | number | boolean;
|
|
458
|
+
|
|
459
|
+
declare class OtelPlugins implements OtelPluginsHandleType {
|
|
460
|
+
recordTrace(params: RecordOtelTraceParams): Promise<RecordOtelTraceResult>;
|
|
461
|
+
getStatus(): Promise<OtelPluginStatus>;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
export declare interface OtelPluginsHandleType {
|
|
465
|
+
recordTrace(params: RecordOtelTraceParams): Promise<RecordOtelTraceResult>;
|
|
466
|
+
getStatus(): Promise<OtelPluginStatus>;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
export declare interface OtelPluginStatus {
|
|
470
|
+
recordTrace: boolean;
|
|
471
|
+
protocolVersion: typeof OTEL_PLUGIN_PROTOCOL_VERSION;
|
|
472
|
+
maxSpansPerTrace: number;
|
|
473
|
+
maxDepth: number;
|
|
474
|
+
maxAttributesPerSpan: number;
|
|
475
|
+
maxEventsPerSpan: number;
|
|
476
|
+
maxPayloadBytes: number;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
export declare type OtelRecordCode = "OK" | "UNSUPPORTED" | "DISABLED" | "INVALID_PARAMETERS" | "INVALID_TREE" | "RATE_LIMITED" | "INTERNAL_ERROR";
|
|
480
|
+
|
|
481
|
+
export declare type OtelSpanKind = "internal" | "client";
|
|
482
|
+
|
|
483
|
+
export declare type OtelSpanStatus = "unset" | "ok" | "error";
|
|
484
|
+
|
|
424
485
|
declare type PackOrdersScanBoxType = "pack_orders_scan_box" | "collect_orders_scan_box";
|
|
425
486
|
|
|
426
487
|
declare class PaymentPlugins implements PaymentPluginsHandleType {
|
|
@@ -493,6 +554,33 @@ export declare interface ProcessParamsType {
|
|
|
493
554
|
[key: string]: any;
|
|
494
555
|
}
|
|
495
556
|
|
|
557
|
+
export declare interface RecordedSpanIdentity {
|
|
558
|
+
name: string;
|
|
559
|
+
traceId: string;
|
|
560
|
+
spanId: string;
|
|
561
|
+
parentSpanId?: string;
|
|
562
|
+
children?: RecordedSpanIdentity[];
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
/**
|
|
566
|
+
* One completed span, optionally with nested child spans. The shell creates all
|
|
567
|
+
* real traceId/spanId values and derives parent-child relationships from children.
|
|
568
|
+
*/
|
|
569
|
+
export declare type RecordOtelTraceParams = MiniappSpanInput;
|
|
570
|
+
|
|
571
|
+
export declare interface RecordOtelTraceResult {
|
|
572
|
+
/** True means the shell accepted and ended the spans; export remains asynchronous. */
|
|
573
|
+
accepted: boolean;
|
|
574
|
+
code: OtelRecordCode;
|
|
575
|
+
protocolVersion: typeof OTEL_PLUGIN_PROTOCOL_VERSION;
|
|
576
|
+
sampled?: boolean;
|
|
577
|
+
/** Generated by the shell OTel provider. Miniapps must not provide this value. */
|
|
578
|
+
traceId?: string;
|
|
579
|
+
rootSpanId?: string;
|
|
580
|
+
/** Generated ID tree matching the submitted span/children structure. */
|
|
581
|
+
span?: RecordedSpanIdentity;
|
|
582
|
+
}
|
|
583
|
+
|
|
496
584
|
declare interface RedirectType {
|
|
497
585
|
miniApp: string;
|
|
498
586
|
params: any;
|