@viu/emporix-sdk 3.1.1 → 3.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.d.cts CHANGED
@@ -9374,6 +9374,287 @@ type HealthThresholds = {
9374
9374
  */
9375
9375
  failedRunIsRed?: boolean;
9376
9376
  };
9377
+ /**
9378
+ * Tenant health thresholds
9379
+ *
9380
+ * The tenant-wide thresholds, together with the built-in defaults they fall back to.
9381
+ */
9382
+ type HealthSettings = {
9383
+ thresholds?: HealthThresholds;
9384
+ builtInDefaults?: HealthThresholds;
9385
+ };
9386
+ /**
9387
+ * Job group
9388
+ *
9389
+ * A named set of import configurations, used to scope the import statistics.
9390
+ */
9391
+ type JobGroup = {
9392
+ /**
9393
+ * The job group identifier.
9394
+ */
9395
+ id?: string;
9396
+ /**
9397
+ * The job group name. Unique within the tenant.
9398
+ */
9399
+ name?: string;
9400
+ /**
9401
+ * The configurations in the group.
9402
+ */
9403
+ configIds?: Array<string>;
9404
+ /**
9405
+ * When the group was created.
9406
+ */
9407
+ createdAt?: string;
9408
+ /**
9409
+ * When the group was last changed.
9410
+ */
9411
+ updatedAt?: string;
9412
+ };
9413
+ /**
9414
+ * Import limits
9415
+ *
9416
+ * The import limits that apply to the tenant.
9417
+ */
9418
+ type ImportLicense$1 = {
9419
+ /**
9420
+ * The maximum number of records a single run may write per target type. Records beyond the limit are skipped and the run finishes as `PARTIAL`.
9421
+ */
9422
+ maxRecordsPerEntity?: number;
9423
+ /**
9424
+ * The maximum number of runs that may be active at once for the tenant. A run requested beyond this limit is rejected with `429`.
9425
+ */
9426
+ maxConcurrentImports?: number;
9427
+ /**
9428
+ * The number of records written to the target per request.
9429
+ */
9430
+ batchSize?: number;
9431
+ /**
9432
+ * The number of target writes performed in parallel.
9433
+ */
9434
+ workers?: number;
9435
+ };
9436
+ /**
9437
+ * Statistics summary
9438
+ *
9439
+ * Headline totals for the window. Rates are fractions between 0 and 1.
9440
+ */
9441
+ type ImportStatsSummary = {
9442
+ /**
9443
+ * The number of runs started in the window.
9444
+ */
9445
+ totalRuns?: number;
9446
+ /**
9447
+ * The number of runs that finished successfully.
9448
+ */
9449
+ succeeded?: number;
9450
+ /**
9451
+ * The number of runs that finished with some records failing.
9452
+ */
9453
+ partial?: number;
9454
+ /**
9455
+ * The number of runs that failed.
9456
+ */
9457
+ failed?: number;
9458
+ /**
9459
+ * The number of runs that were cancelled.
9460
+ */
9461
+ cancelled?: number;
9462
+ /**
9463
+ * The number of source records read.
9464
+ */
9465
+ recordsRead?: number;
9466
+ /**
9467
+ * The number of target objects created.
9468
+ */
9469
+ created?: number;
9470
+ /**
9471
+ * The number of target objects updated.
9472
+ */
9473
+ updated?: number;
9474
+ /**
9475
+ * The number of records skipped because nothing had changed.
9476
+ */
9477
+ skipped?: number;
9478
+ /**
9479
+ * The number of target objects deleted.
9480
+ */
9481
+ deleted?: number;
9482
+ /**
9483
+ * The number of records that could not be imported.
9484
+ */
9485
+ failedRecords?: number;
9486
+ /**
9487
+ * The share of runs that finished successfully.
9488
+ */
9489
+ successRate?: number;
9490
+ /**
9491
+ * The share of records that failed.
9492
+ */
9493
+ failureRate?: number;
9494
+ /**
9495
+ * The share of processed records that resulted in a deletion.
9496
+ */
9497
+ deletionRate?: number;
9498
+ /**
9499
+ * The share of records skipped as unchanged.
9500
+ */
9501
+ skipRate?: number;
9502
+ /**
9503
+ * The mean duration of a finished run, in seconds.
9504
+ */
9505
+ avgRunDurationSec?: number;
9506
+ /**
9507
+ * The mean number of objects created per run.
9508
+ */
9509
+ avgCreatedPerRun?: number;
9510
+ /**
9511
+ * The mean number of objects updated per run.
9512
+ */
9513
+ avgUpdatedPerRun?: number;
9514
+ /**
9515
+ * The number of distinct target objects currently held by the imports in scope.
9516
+ */
9517
+ distinctEntities?: number;
9518
+ /**
9519
+ * The number of runs currently in progress.
9520
+ */
9521
+ activeRuns?: number;
9522
+ };
9523
+ /**
9524
+ * Statistics time bucket
9525
+ *
9526
+ * One bucket of the time series, in UTC.
9527
+ */
9528
+ type ImportStatsPoint = {
9529
+ /**
9530
+ * The start of the bucket.
9531
+ */
9532
+ bucket?: string;
9533
+ runs?: number;
9534
+ succeeded?: number;
9535
+ failed?: number;
9536
+ recordsRead?: number;
9537
+ created?: number;
9538
+ updated?: number;
9539
+ deleted?: number;
9540
+ skipped?: number;
9541
+ failedRecords?: number;
9542
+ };
9543
+ /**
9544
+ * Stream health
9545
+ *
9546
+ * The health of one stream over the window, and the thresholds the verdict used.
9547
+ */
9548
+ type ImportStreamHealth = {
9549
+ streamId?: string;
9550
+ /**
9551
+ * The configuration the stream belongs to.
9552
+ */
9553
+ configId?: string;
9554
+ name?: string;
9555
+ /**
9556
+ * The target type the stream writes to.
9557
+ */
9558
+ targetType?: string;
9559
+ /**
9560
+ * The status of the stream's most recent run.
9561
+ */
9562
+ lastRunStatus?: string;
9563
+ lastRunAt?: string;
9564
+ /**
9565
+ * The number of seconds since the stream last detected new data.
9566
+ */
9567
+ watermarkAgeSeconds?: number;
9568
+ /**
9569
+ * The share of the stream's records that failed in the window.
9570
+ */
9571
+ failureRatio?: number;
9572
+ /**
9573
+ * The stream's health verdict.
9574
+ */
9575
+ health?: 'GREEN' | 'AMBER' | 'RED';
9576
+ thresholds?: ImportEffectiveThresholds;
9577
+ };
9578
+ /**
9579
+ * Effective thresholds
9580
+ *
9581
+ * The threshold values the verdict was actually computed with, after resolving every level.
9582
+ */
9583
+ type ImportEffectiveThresholds = {
9584
+ failureRatioAmber?: number;
9585
+ failureRatioRed?: number;
9586
+ staleAmberHours?: number;
9587
+ staleRedHours?: number;
9588
+ failedRunIsRed?: boolean;
9589
+ /**
9590
+ * Whether any level overrides the built-in defaults.
9591
+ */
9592
+ customised?: boolean;
9593
+ };
9594
+ /**
9595
+ * Named count
9596
+ */
9597
+ type ImportStatsNamedCount = {
9598
+ streamId?: string;
9599
+ name?: string;
9600
+ count?: number;
9601
+ };
9602
+ /**
9603
+ * Error bucket
9604
+ *
9605
+ * A count of errors sharing the same stage and code.
9606
+ */
9607
+ type ImportStatsErrorBucket = {
9608
+ /**
9609
+ * The pipeline stage the error occurred in.
9610
+ */
9611
+ stage?: string;
9612
+ errorCode?: string;
9613
+ count?: number;
9614
+ };
9615
+ /**
9616
+ * Stream changes
9617
+ *
9618
+ * The counts of streams added and removed during the time window.
9619
+ */
9620
+ type ImportStreamChanges = {
9621
+ added?: number;
9622
+ removed?: number;
9623
+ /**
9624
+ * When stream tracking began for the tenant. Streams created before this point are not counted, so a window reaching further back is not comparable.
9625
+ */
9626
+ trackingSince?: string;
9627
+ series?: Array<{
9628
+ bucket?: string;
9629
+ added?: number;
9630
+ removed?: number;
9631
+ }>;
9632
+ };
9633
+ /**
9634
+ * Import statistics
9635
+ *
9636
+ * Aggregated import metrics for the requested window and scope. A section that was not requested via the `sections` parameter is returned as `null`.
9637
+ */
9638
+ type ImportStats$1 = {
9639
+ summary?: ImportStatsSummary;
9640
+ /**
9641
+ * Activity per time bucket, ordered oldest first and gap-free.
9642
+ */
9643
+ series?: Array<ImportStatsPoint>;
9644
+ /**
9645
+ * The health of each stream in scope.
9646
+ */
9647
+ streamHealth?: Array<ImportStreamHealth>;
9648
+ /**
9649
+ * The streams with the most errors during the time window, ordered by error count in descending order.
9650
+ */
9651
+ topFailingStreams?: Array<ImportStatsNamedCount>;
9652
+ /**
9653
+ * The most common errors in the window, grouped by stage and code.
9654
+ */
9655
+ errorBreakdown?: Array<ImportStatsErrorBucket>;
9656
+ streamChanges?: ImportStreamChanges;
9657
+ };
9377
9658
  type PostImporttoolTriggerRunData = {
9378
9659
  body?: {
9379
9660
  /**
@@ -9436,6 +9717,47 @@ type GetImporttoolSearchDataRecordsData = {
9436
9717
  };
9437
9718
  url: '/importtool/{tenant}/data/records';
9438
9719
  };
9720
+ type GetImporttoolStatsData = {
9721
+ body?: never;
9722
+ path: {
9723
+ /**
9724
+ * The tenant you want to access.
9725
+ *
9726
+ */
9727
+ tenant: string;
9728
+ };
9729
+ query?: {
9730
+ /**
9731
+ * Restricts the statistics to a single configuration.
9732
+ */
9733
+ configId?: string;
9734
+ /**
9735
+ * Restricts the statistics to several configurations, as a comma-separated list of identifiers. Ignored when `configId` is given.
9736
+ */
9737
+ configIds?: string;
9738
+ /**
9739
+ * Restricts the statistics to a single stream. Takes precedence over the configuration filters.
9740
+ */
9741
+ streamId?: string;
9742
+ /**
9743
+ * The start of the window, as an ISO-8601 instant. When omitted, defaults to 30 days ago.
9744
+ */
9745
+ from?: string;
9746
+ /**
9747
+ * The end of the window, as an ISO-8601 instant. Exclusive. When omitted, defaults to now.
9748
+ */
9749
+ to?: string;
9750
+ /**
9751
+ * The bucket size of the returned time series.
9752
+ */
9753
+ granularity?: 'DAY' | 'WEEK' | 'MONTH';
9754
+ /**
9755
+ * A comma-separated list of the sections to compute: `TOTALS`, `STREAMS`, `ERRORS`, `CHANGES`. When omitted, defaults to all sections. A section not requested through the `sections` parameter is returned as `null`.
9756
+ */
9757
+ sections?: string;
9758
+ };
9759
+ url: '/importtool/{tenant}/stats';
9760
+ };
9439
9761
 
9440
9762
  /**
9441
9763
  * Public types for the Import Service — stable names aliased over the
@@ -9464,7 +9786,11 @@ type ImportCancelResult = CancelResult;
9464
9786
  type ImportErrorRecord = ErrorRecord;
9465
9787
  /** A record that was imported, with its keys, stored fields and last outcome. */
9466
9788
  type ImportedRecord = ImportedRecord$1;
9467
- /** Body for `triggerRun`: `{ mode?, dryRun? }`. `mode` defaults to `DELTA` server-side. */
9789
+ /**
9790
+ * Body for `triggerRun`: `{ mode?, dryRun?, force? }`. `mode` defaults to
9791
+ * `DELTA` server-side; `force` rewrites every extracted record, bypassing the
9792
+ * skip-if-unchanged idempotency.
9793
+ */
9468
9794
  type ImportRunInput = NonNullable<PostImporttoolTriggerRunData["body"]>;
9469
9795
  /** Lifecycle status of an {@link ImportRun}. */
9470
9796
  type ImportRunStatus = NonNullable<ImportRun["status"]>;
@@ -9527,6 +9853,23 @@ type ImportPage<T> = PaginatedItems<T> & {
9527
9853
  /** Total number of pages. */
9528
9854
  totalPages: number;
9529
9855
  };
9856
+ /**
9857
+ * Aggregated import analytics: totals, a time series, an error breakdown and
9858
+ * per-stream health. Every section is optional — the `sections` filter decides
9859
+ * which ones the service computes.
9860
+ */
9861
+ type ImportStats = ImportStats$1;
9862
+ /** Query for {@link ImportsService.stats}. All filters optional. */
9863
+ type ImportStatsQuery = Omit<NonNullable<GetImporttoolStatsData["query"]>, never>;
9864
+ /** One dashboard job group: a configuration and the runs grouped under it. */
9865
+ type ImportJobGroup = JobGroup;
9866
+ /**
9867
+ * The tenant's health thresholds — the error rates above which a stream counts
9868
+ * as degraded or failing in {@link ImportStats}.
9869
+ */
9870
+ type ImportHealthThresholds = HealthSettings;
9871
+ /** The tenant's import limits and current consumption. */
9872
+ type ImportLicense = ImportLicense$1;
9530
9873
 
9531
9874
  /** One-based paging options, shared by every paginated import endpoint. */
9532
9875
  interface ImportPageOptions {
@@ -9632,6 +9975,59 @@ declare class ImportService {
9632
9975
  searchRecords(opts: SearchImportedRecordsOptions, auth?: AuthContext): Promise<ImportPage<ImportedRecord>>;
9633
9976
  /** Search the imported records produced by one stream. */
9634
9977
  searchStreamRecords(streamId: string, opts?: SearchStreamRecordsOptions, auth?: AuthContext): Promise<ImportPage<ImportedRecord>>;
9978
+ /**
9979
+ * Aggregated import analytics.
9980
+ *
9981
+ * Every section is optional in the response, and `sections` is what decides
9982
+ * which the service computes — asking for all of them on a tenant with a long
9983
+ * history is the expensive call, so name the ones you render.
9984
+ *
9985
+ * `from` / `to` are ISO timestamps. Omitted, the service picks its own window;
9986
+ * do not assume it is «everything».
9987
+ *
9988
+ * **Preview upstream**: the contract may change without a major bump.
9989
+ */
9990
+ stats(query?: ImportStatsQuery, auth?: AuthContext): Promise<ImportStats>;
9991
+ /**
9992
+ * The dashboard's job groups: configurations with their runs grouped under
9993
+ * them.
9994
+ *
9995
+ * Named after the path rather than the summary («Retrieving job groups»)
9996
+ * because the resource lives under `/dashboard` and is shaped for that view —
9997
+ * a caller wanting plain run history wants {@link listRuns}.
9998
+ *
9999
+ * **Preview upstream**: the contract may change without a major bump.
10000
+ */
10001
+ listJobGroups(auth?: AuthContext): Promise<ImportJobGroup[]>;
10002
+ /**
10003
+ * The tenant's health thresholds — the error rates above which a stream counts
10004
+ * as degraded or failing in {@link stats}.
10005
+ *
10006
+ * Read-only here: changing them needs `importtool.import_manage`, which this
10007
+ * service does not cover.
10008
+ *
10009
+ * **Preview upstream**: the contract may change without a major bump.
10010
+ */
10011
+ getHealthThresholds(auth?: AuthContext): Promise<ImportHealthThresholds>;
10012
+ /**
10013
+ * The tenant's import limits and current consumption.
10014
+ *
10015
+ * **Preview upstream**: the contract may change without a major bump.
10016
+ */
10017
+ getLicense(auth?: AuthContext): Promise<ImportLicense>;
10018
+ /**
10019
+ * Retry only the failed records of a finished run.
10020
+ *
10021
+ * Returns a **new** run — the retry is its own run with `retry: true`, not a
10022
+ * mutation of the original. Poll it with {@link getRun} or follow it with
10023
+ * {@link streamRun} exactly as you would a triggered run.
10024
+ *
10025
+ * Not retried on a 5xx, for the same reason {@link triggerRun} is not: a POST
10026
+ * that timed out may already have queued the retry.
10027
+ *
10028
+ * **Preview upstream**: the contract may change without a major bump.
10029
+ */
10030
+ retryRun(runId: string, auth?: AuthContext): Promise<ImportRun>;
9635
10031
  }
9636
10032
 
9637
10033
  type BaseUnit = {