superapp-miniapp-invoke-native 1.11.4 → 1.12.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/lib/main.d.ts +92 -0
- package/lib/main.js +438 -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,41 @@ 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
|
+
recordSpan(params: RecordOtelSpanParams): Promise<RecordOtelTraceResult>;
|
|
462
|
+
getStatus(): Promise<OtelPluginStatus>;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
export declare interface OtelPluginsHandleType {
|
|
466
|
+
recordTrace(params: RecordOtelTraceParams): Promise<RecordOtelTraceResult>;
|
|
467
|
+
recordSpan(params: RecordOtelSpanParams): Promise<RecordOtelTraceResult>;
|
|
468
|
+
getStatus(): Promise<OtelPluginStatus>;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
export declare interface OtelPluginStatus {
|
|
472
|
+
recordTrace: boolean;
|
|
473
|
+
recordSpan: boolean;
|
|
474
|
+
protocolVersion: typeof OTEL_PLUGIN_PROTOCOL_VERSION;
|
|
475
|
+
maxSpansPerTrace: number;
|
|
476
|
+
maxDepth: number;
|
|
477
|
+
maxAttributesPerSpan: number;
|
|
478
|
+
maxEventsPerSpan: number;
|
|
479
|
+
maxPayloadBytes: number;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
export declare type OtelRecordCode = "OK" | "UNSUPPORTED" | "DISABLED" | "INVALID_PARAMETERS" | "INVALID_TREE" | "RATE_LIMITED" | "INTERNAL_ERROR";
|
|
483
|
+
|
|
484
|
+
export declare type OtelSpanKind = "internal" | "client";
|
|
485
|
+
|
|
486
|
+
export declare type OtelSpanStatus = "unset" | "ok" | "error";
|
|
487
|
+
|
|
424
488
|
declare type PackOrdersScanBoxType = "pack_orders_scan_box" | "collect_orders_scan_box";
|
|
425
489
|
|
|
426
490
|
declare class PaymentPlugins implements PaymentPluginsHandleType {
|
|
@@ -493,6 +557,34 @@ export declare interface ProcessParamsType {
|
|
|
493
557
|
[key: string]: any;
|
|
494
558
|
}
|
|
495
559
|
|
|
560
|
+
export declare interface RecordedSpanIdentity {
|
|
561
|
+
name: string;
|
|
562
|
+
traceId: string;
|
|
563
|
+
spanId: string;
|
|
564
|
+
parentSpanId?: string;
|
|
565
|
+
children?: RecordedSpanIdentity[];
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
export declare type RecordOtelSpanParams = Omit<MiniappSpanInput, "children">;
|
|
569
|
+
|
|
570
|
+
export declare interface RecordOtelTraceParams {
|
|
571
|
+
/** A nested span tree. The shell creates all real traceId/spanId values. */
|
|
572
|
+
span: MiniappSpanInput;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
export declare interface RecordOtelTraceResult {
|
|
576
|
+
/** True means the shell accepted and ended the spans; export remains asynchronous. */
|
|
577
|
+
accepted: boolean;
|
|
578
|
+
code: OtelRecordCode;
|
|
579
|
+
protocolVersion: typeof OTEL_PLUGIN_PROTOCOL_VERSION;
|
|
580
|
+
sampled?: boolean;
|
|
581
|
+
/** Generated by the shell OTel provider. Miniapps must not provide this value. */
|
|
582
|
+
traceId?: string;
|
|
583
|
+
rootSpanId?: string;
|
|
584
|
+
/** Generated ID tree matching the submitted span/children structure. */
|
|
585
|
+
span?: RecordedSpanIdentity;
|
|
586
|
+
}
|
|
587
|
+
|
|
496
588
|
declare interface RedirectType {
|
|
497
589
|
miniApp: string;
|
|
498
590
|
params: any;
|