@dx-do/client 6.3.0 → 6.3.2
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.js +425 -43
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +418 -44
- package/dist/index.esm.js.map +1 -1
- package/dist/src/index.d.ts +4 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/lib/model/oi/users.d.ts +94 -0
- package/dist/src/lib/model/oi/users.d.ts.map +1 -1
- package/dist/src/lib/model/sli/group.d.ts +59 -0
- package/dist/src/lib/model/sli/group.d.ts.map +1 -0
- package/dist/src/lib/model/sli/save.d.ts +54 -0
- package/dist/src/lib/model/sli/save.d.ts.map +1 -0
- package/dist/src/lib/model/sli/search.d.ts +58 -0
- package/dist/src/lib/model/sli/search.d.ts.map +1 -0
- package/dist/src/lib/services/authorization.service.d.ts +18 -1
- package/dist/src/lib/services/authorization.service.d.ts.map +1 -1
- package/dist/src/lib/services/service-monolith.d.ts +2 -0
- package/dist/src/lib/services/service-monolith.d.ts.map +1 -1
- package/dist/src/lib/services/sli.service.d.ts +53 -0
- package/dist/src/lib/services/sli.service.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -46686,6 +46686,94 @@ exports.OIService = void 0;
|
|
|
46686
46686
|
};
|
|
46687
46687
|
})(exports.OIService || (exports.OIService = {}));
|
|
46688
46688
|
|
|
46689
|
+
/**
|
|
46690
|
+
* The `ess/users/v2/list` user-account listing.
|
|
46691
|
+
*
|
|
46692
|
+
* Hand-modelled from observed responses (no published schema): every field is
|
|
46693
|
+
* inferred from live data across multiple tenants. `looseObject` is used
|
|
46694
|
+
* throughout so undocumented server fields are tolerated rather than dropped or
|
|
46695
|
+
* rejected, and single-observation fields (e.g. {@link UserSchema.shape.authMethod})
|
|
46696
|
+
* are kept as plain strings rather than locked enums.
|
|
46697
|
+
*/
|
|
46698
|
+
exports.OIUsersV2 = void 0;
|
|
46699
|
+
(function (OIUsersV2) {
|
|
46700
|
+
/** One email address attached to a user. */
|
|
46701
|
+
OIUsersV2.EmailIdSchema = v4.z.looseObject({
|
|
46702
|
+
emailAddr: v4.z.string().describe('the email address'),
|
|
46703
|
+
qualifier: v4.z
|
|
46704
|
+
.string()
|
|
46705
|
+
.describe('email category; only "EMAILID" observed in live data'),
|
|
46706
|
+
});
|
|
46707
|
+
/** The user's assigned role. */
|
|
46708
|
+
OIUsersV2.RoleSchema = v4.z.looseObject({
|
|
46709
|
+
name: v4.z
|
|
46710
|
+
.string()
|
|
46711
|
+
.describe('role identifier, e.g. "VIEW105" / "TA" / "PU" / "UZ"'),
|
|
46712
|
+
privileges: v4.z
|
|
46713
|
+
.array(v4.z.unknown())
|
|
46714
|
+
.describe('granted privilege entries; empty in all observed data'),
|
|
46715
|
+
level: v4.z.number().describe('role level; 0 in all observed data'),
|
|
46716
|
+
});
|
|
46717
|
+
/** A single user account. */
|
|
46718
|
+
OIUsersV2.UserSchema = v4.z.looseObject({
|
|
46719
|
+
userRefID: v4.z.number().describe('numeric internal user reference id'),
|
|
46720
|
+
userId: v4.z
|
|
46721
|
+
.string()
|
|
46722
|
+
.describe('login principal; usually the email address upper-cased'),
|
|
46723
|
+
cohort: v4.z
|
|
46724
|
+
.string()
|
|
46725
|
+
.describe('per-user cohort id in dashed, upper-cased GUID form'),
|
|
46726
|
+
firstName: v4.z.string().describe('given name'),
|
|
46727
|
+
lastName: v4.z
|
|
46728
|
+
.string()
|
|
46729
|
+
.optional()
|
|
46730
|
+
.describe('family name; occasionally absent'),
|
|
46731
|
+
statusEnum: v4.z
|
|
46732
|
+
.enum(['ACTIVE', 'INACTIVE'])
|
|
46733
|
+
.describe('account status; only ACTIVE/INACTIVE observed'),
|
|
46734
|
+
emailIds: v4.z
|
|
46735
|
+
.array(OIUsersV2.EmailIdSchema)
|
|
46736
|
+
.describe('email addresses associated with the user'),
|
|
46737
|
+
hasImage: v4.z.boolean().describe('whether a profile image is set'),
|
|
46738
|
+
authMethod: v4.z
|
|
46739
|
+
.string()
|
|
46740
|
+
.describe('authentication method; only "BASIC_AUTH" observed'),
|
|
46741
|
+
dateCreated: v4.z
|
|
46742
|
+
.string()
|
|
46743
|
+
.describe('creation timestamp, ISO-8601 with +0000 offset (not "Z")'),
|
|
46744
|
+
dateModified: v4.z
|
|
46745
|
+
.string()
|
|
46746
|
+
.describe('last-modified timestamp, ISO-8601 with +0000 offset'),
|
|
46747
|
+
startLockTime: v4.z
|
|
46748
|
+
.string()
|
|
46749
|
+
.optional()
|
|
46750
|
+
.describe('lock-start timestamp; present only when the account is locked'),
|
|
46751
|
+
internalAttrs: v4.z
|
|
46752
|
+
.array(v4.z.string().nullable())
|
|
46753
|
+
.describe('internal attribute slots; observed as a length-3 array of nullable strings, semantics undocumented'),
|
|
46754
|
+
tenant: v4.z.string().describe('tenant id the user belongs to'),
|
|
46755
|
+
lockStatus: v4.z
|
|
46756
|
+
.boolean()
|
|
46757
|
+
.describe('whether the account is currently locked'),
|
|
46758
|
+
role: OIUsersV2.RoleSchema.describe('the assigned role'),
|
|
46759
|
+
hasAllDataAccess: v4.z
|
|
46760
|
+
.boolean()
|
|
46761
|
+
.describe('whether the user has unrestricted data access'),
|
|
46762
|
+
userType: v4.z
|
|
46763
|
+
.string()
|
|
46764
|
+
.optional()
|
|
46765
|
+
.describe('account type; the list request filters to USER_ACCOUNT, but the field is not always echoed back'),
|
|
46766
|
+
deleted: v4.z.boolean().describe('soft-delete flag'),
|
|
46767
|
+
});
|
|
46768
|
+
/** The list envelope: a page of users plus the server-side total. */
|
|
46769
|
+
OIUsersV2.UserListResponseSchema = v4.z.looseObject({
|
|
46770
|
+
countTotal: v4.z
|
|
46771
|
+
.number()
|
|
46772
|
+
.describe('total users matching the query on the server, for pagination'),
|
|
46773
|
+
users: v4.z.array(OIUsersV2.UserSchema).describe('the returned page of users'),
|
|
46774
|
+
});
|
|
46775
|
+
})(exports.OIUsersV2 || (exports.OIUsersV2 = {}));
|
|
46776
|
+
|
|
46689
46777
|
/** @internal */
|
|
46690
46778
|
function createPostmanRequest(request) {
|
|
46691
46779
|
function createPostmanHeaders(request) {
|
|
@@ -48562,6 +48650,182 @@ exports.Situations = void 0;
|
|
|
48562
48650
|
(function (Situations) {
|
|
48563
48651
|
})(exports.Situations || (exports.Situations = {}));
|
|
48564
48652
|
|
|
48653
|
+
/**
|
|
48654
|
+
* One row of an SLI's match criteria. SLIs select the metrics they watch by a
|
|
48655
|
+
* list of these AND-ed filters (e.g. "Source contains bd605" AND "Metric ends
|
|
48656
|
+
* with Web Agent Status").
|
|
48657
|
+
*/
|
|
48658
|
+
const SliFilterSchema = v4.z.looseObject({
|
|
48659
|
+
fieldDescription: v4.z
|
|
48660
|
+
.string()
|
|
48661
|
+
.describe('Human label for the field, e.g. "Source" or "Metric"'),
|
|
48662
|
+
field: v4.z
|
|
48663
|
+
.string()
|
|
48664
|
+
.describe('Wire field the filter matches on, e.g. "sourceName" or "attributeName"'),
|
|
48665
|
+
value: v4.z.string().describe('Value to match against the field'),
|
|
48666
|
+
condition: v4.z
|
|
48667
|
+
.string()
|
|
48668
|
+
.describe('Match operator, e.g. "contains", "ends_with", "regex"'),
|
|
48669
|
+
});
|
|
48670
|
+
/**
|
|
48671
|
+
* A full SLI "group" as returned by `groups/search` (per `sliGroups[]` entry)
|
|
48672
|
+
* and `groups?groupId=<id>` (single object). This is the **raw** shape that
|
|
48673
|
+
* `sli export` writes to disk and `sli import` reads back.
|
|
48674
|
+
*
|
|
48675
|
+
* The wire terms are `groupName` / `groupId`; the CLI surfaces these to users
|
|
48676
|
+
* as `sliName` / `sliId`. The deeply-nested `sliDefinition` / `sloDefinition` /
|
|
48677
|
+
* `alertDefinition` blocks are kept **opaque** (loose passthrough) so they
|
|
48678
|
+
* round-trip untouched — we model the envelope, not the SLI/SLO math.
|
|
48679
|
+
*/
|
|
48680
|
+
const SliGroupSchema = v4.z.looseObject({
|
|
48681
|
+
groupName: v4.z.string().describe('SLI name (surfaced to users as `sliName`)'),
|
|
48682
|
+
groupId: v4.z
|
|
48683
|
+
.number()
|
|
48684
|
+
.describe('Server-assigned SLI id (surfaced to users as `sliId`)'),
|
|
48685
|
+
type: v4.z
|
|
48686
|
+
.string()
|
|
48687
|
+
.nullable()
|
|
48688
|
+
.optional()
|
|
48689
|
+
.describe('Group type; "sli" for SLIs. Save bodies set it; the GET-by-id response returns null'),
|
|
48690
|
+
description: v4.z
|
|
48691
|
+
.string()
|
|
48692
|
+
.nullable()
|
|
48693
|
+
.optional()
|
|
48694
|
+
.describe('Free-text description; may be null or empty'),
|
|
48695
|
+
mgId: v4.z
|
|
48696
|
+
.unknown()
|
|
48697
|
+
.nullable()
|
|
48698
|
+
.optional()
|
|
48699
|
+
.describe('Management-group id; null for SLIs'),
|
|
48700
|
+
filters: v4.z
|
|
48701
|
+
.array(SliFilterSchema)
|
|
48702
|
+
.describe('AND-ed metric match criteria selecting the SLI source metrics'),
|
|
48703
|
+
serviceNames: v4.z
|
|
48704
|
+
.array(v4.z.string())
|
|
48705
|
+
.describe('Service names this SLI is bound to. `sli import` overwrites this with the passed serviceName'),
|
|
48706
|
+
sliDefinition: v4.z
|
|
48707
|
+
.looseObject({ functions: v4.z.array(v4.z.unknown()).optional() })
|
|
48708
|
+
.optional()
|
|
48709
|
+
.describe('Opaque SLI computation spec ({ functions: [...] }); round-tripped verbatim'),
|
|
48710
|
+
sloDefinition: v4.z
|
|
48711
|
+
.looseObject({ functions: v4.z.array(v4.z.unknown()).optional() })
|
|
48712
|
+
.optional()
|
|
48713
|
+
.describe('Opaque SLO computation spec ({ functions: [...] }); round-tripped verbatim'),
|
|
48714
|
+
alertDefinition: v4.z
|
|
48715
|
+
.unknown()
|
|
48716
|
+
.optional()
|
|
48717
|
+
.describe('Opaque alert spec; null or an array. Normalized to [] on import when null'),
|
|
48718
|
+
// Read-only server-managed fields (present on reads, ignored on save).
|
|
48719
|
+
creationTime: v4.z.number().optional().describe('Epoch seconds the SLI was created'),
|
|
48720
|
+
lastModifiedTime: v4.z.number().optional().describe('Epoch seconds the SLI was last modified'),
|
|
48721
|
+
createdBy: v4.z.string().nullable().optional().describe('User that created the SLI'),
|
|
48722
|
+
lastUpdatedBy: v4.z.string().nullable().optional().describe('User that last updated the SLI'),
|
|
48723
|
+
totalMetrics: v4.z.number().optional().describe('Count of metrics currently matched by the SLI'),
|
|
48724
|
+
breached: v4.z.boolean().optional().describe('Whether the SLO is currently breached'),
|
|
48725
|
+
product: v4.z.unknown().nullable().optional().describe('Owning product; usually null'),
|
|
48726
|
+
enabled: v4.z.boolean().optional().describe('Whether the SLI is active'),
|
|
48727
|
+
sliStatusCode: v4.z.number().optional().describe('Registration status code; 0 = healthy'),
|
|
48728
|
+
sliStatusMessage: v4.z.string().optional().describe('Human-readable registration status'),
|
|
48729
|
+
fixRequired: v4.z.boolean().optional().describe('Whether the SLI needs attention to register'),
|
|
48730
|
+
pipelineErrors: v4.z.array(v4.z.unknown()).optional().describe('Per-pipeline error details, if any'),
|
|
48731
|
+
defaultGroup: v4.z.boolean().optional().describe('Whether this is a system default group'),
|
|
48732
|
+
});
|
|
48733
|
+
|
|
48734
|
+
/**
|
|
48735
|
+
* Request body for `POST oi/v2/metricconfig/groups/save`. Mirrors the writable
|
|
48736
|
+
* subset of {@link SliGroupSchema} — read-only server fields (creationTime,
|
|
48737
|
+
* createdBy, totalMetrics, …) are not sent.
|
|
48738
|
+
*
|
|
48739
|
+
* `groupId` is the create/update discriminator: present → update that group;
|
|
48740
|
+
* absent → create a new one. `sli import` always omits it so import is
|
|
48741
|
+
* create-only and can never overwrite an existing SLI.
|
|
48742
|
+
*/
|
|
48743
|
+
const SliSaveRequestSchema = v4.z.looseObject({
|
|
48744
|
+
type: v4.z.string().describe('Always "sli" for SLIs'),
|
|
48745
|
+
groupName: v4.z.string().describe('SLI name'),
|
|
48746
|
+
description: v4.z.string().nullable().optional().describe('Free-text description'),
|
|
48747
|
+
mgId: v4.z.unknown().nullable().optional().describe('Management-group id; null for SLIs'),
|
|
48748
|
+
filters: v4.z.array(SliFilterSchema).describe('AND-ed metric match criteria'),
|
|
48749
|
+
serviceNames: v4.z.array(v4.z.string()).describe('Service names the SLI binds to'),
|
|
48750
|
+
sliDefinition: v4.z.unknown().describe('Opaque SLI computation spec, round-tripped from the export'),
|
|
48751
|
+
sloDefinition: v4.z.unknown().describe('Opaque SLO computation spec, round-tripped from the export'),
|
|
48752
|
+
alertDefinition: v4.z.unknown().optional().describe('Opaque alert spec; [] when none'),
|
|
48753
|
+
groupId: v4.z
|
|
48754
|
+
.number()
|
|
48755
|
+
.optional()
|
|
48756
|
+
.describe('Omit to create a new SLI; include to update an existing one'),
|
|
48757
|
+
});
|
|
48758
|
+
/**
|
|
48759
|
+
* Response from `POST oi/v2/metricconfig/groups/save`.
|
|
48760
|
+
*/
|
|
48761
|
+
const SliSaveResponseSchema = v4.z.looseObject({
|
|
48762
|
+
groupId: v4.z.number().describe('Id of the created/updated SLI'),
|
|
48763
|
+
message: v4.z.array(v4.z.string()).describe('Server status messages'),
|
|
48764
|
+
status: v4.z.string().describe('"Success" on success'),
|
|
48765
|
+
});
|
|
48766
|
+
/**
|
|
48767
|
+
* Projects a read-model {@link SliGroup} onto the writable {@link SliSaveRequest}
|
|
48768
|
+
* subset — dropping the read-only server fields (creationTime, createdBy,
|
|
48769
|
+
* totalMetrics, …) and normalizing `type` (default `'sli'`) and
|
|
48770
|
+
* `alertDefinition` (`null` → `[]`).
|
|
48771
|
+
*
|
|
48772
|
+
* @param group - The source SLI (e.g. from `getSli` or a raw export file).
|
|
48773
|
+
* @param opts.serviceNames - Override the bound services; defaults to the group's.
|
|
48774
|
+
* @param opts.create - When true, omit `groupId` so the save *creates* a new SLI;
|
|
48775
|
+
* otherwise `groupId` is carried through and the save *updates* in place.
|
|
48776
|
+
*/
|
|
48777
|
+
function toSliSaveRequest(group, opts = {}) {
|
|
48778
|
+
const body = {
|
|
48779
|
+
type: group.type ?? 'sli',
|
|
48780
|
+
groupName: group.groupName,
|
|
48781
|
+
description: group.description ?? '',
|
|
48782
|
+
mgId: group.mgId ?? null,
|
|
48783
|
+
filters: group.filters,
|
|
48784
|
+
serviceNames: opts.serviceNames ?? group.serviceNames,
|
|
48785
|
+
sliDefinition: group.sliDefinition,
|
|
48786
|
+
sloDefinition: group.sloDefinition,
|
|
48787
|
+
alertDefinition: group.alertDefinition ?? [],
|
|
48788
|
+
};
|
|
48789
|
+
if (!opts.create) {
|
|
48790
|
+
body.groupId = group.groupId;
|
|
48791
|
+
}
|
|
48792
|
+
return body;
|
|
48793
|
+
}
|
|
48794
|
+
|
|
48795
|
+
/**
|
|
48796
|
+
* Request body for `POST oi/v2/metricconfig/groups/search`. Listing SLIs is a
|
|
48797
|
+
* search scoped to `type: "sli"` with a large `pageSize` (the server returns
|
|
48798
|
+
* all matching groups up to that cap).
|
|
48799
|
+
*/
|
|
48800
|
+
const SliSearchRequestSchema = v4.z.looseObject({
|
|
48801
|
+
pageSize: v4.z
|
|
48802
|
+
.number()
|
|
48803
|
+
.describe('Max groups to return. Use a large value (e.g. 5000) to list all SLIs'),
|
|
48804
|
+
type: v4.z
|
|
48805
|
+
.string()
|
|
48806
|
+
.describe('Group type to search; "sli" for SLIs'),
|
|
48807
|
+
});
|
|
48808
|
+
/**
|
|
48809
|
+
* Response from `POST oi/v2/metricconfig/groups/search`. The SLIs are in
|
|
48810
|
+
* `sliGroups`; the surrounding fields are tenant-wide metric-config limits.
|
|
48811
|
+
*/
|
|
48812
|
+
const SliSearchResponseSchema = v4.z.looseObject({
|
|
48813
|
+
totalGroups: v4.z.number().optional().describe('Number of groups returned in `sliGroups`'),
|
|
48814
|
+
pageSize: v4.z.number().optional().describe('Effective page size applied by the server'),
|
|
48815
|
+
enabledMetrics: v4.z.number().optional().describe('Total metrics enabled across all SLIs'),
|
|
48816
|
+
allowedMetricGroupsPerService: v4.z
|
|
48817
|
+
.number()
|
|
48818
|
+
.optional()
|
|
48819
|
+
.describe('Tenant cap on SLI groups per service'),
|
|
48820
|
+
allowedMetricsPerGroup: v4.z
|
|
48821
|
+
.number()
|
|
48822
|
+
.optional()
|
|
48823
|
+
.describe('Tenant cap on metrics per SLI group'),
|
|
48824
|
+
sliGroups: v4.z
|
|
48825
|
+
.array(SliGroupSchema)
|
|
48826
|
+
.describe('The SLI groups matching the search'),
|
|
48827
|
+
});
|
|
48828
|
+
|
|
48565
48829
|
exports.TAS = void 0;
|
|
48566
48830
|
(function (TAS) {
|
|
48567
48831
|
/** @internal */
|
|
@@ -64087,6 +64351,50 @@ class AuthorizationService {
|
|
|
64087
64351
|
getUsers() {
|
|
64088
64352
|
return this.dxSaaSService.tenantGet('oi/v2/api/users');
|
|
64089
64353
|
}
|
|
64354
|
+
/**
|
|
64355
|
+
* Lists users via the ESS users v2 endpoint.
|
|
64356
|
+
*
|
|
64357
|
+
* The path's trailing segment is the cohort id in upper-cased, dashed GUID
|
|
64358
|
+
* form (e.g. `6E82C5F4-8F16-4CD9-8BF0-6263F83054D5`). `oiGet` already injects
|
|
64359
|
+
* the lowercase, dash-less cohort id as the base path segment, so we rebuild
|
|
64360
|
+
* the GUID form here independently of how the config stores it.
|
|
64361
|
+
*
|
|
64362
|
+
* The response type is hand-modelled from observed data ({@link OIUsersV2});
|
|
64363
|
+
* validation is defensive (`safeParse` + `log.warn`), so a server-side shape
|
|
64364
|
+
* change logs a warning but still returns the raw payload to the caller.
|
|
64365
|
+
*
|
|
64366
|
+
* @remarks Response is validated, not thrown — see {@link OIUsersV2}.
|
|
64367
|
+
*/
|
|
64368
|
+
async getUsersV2(startIndex = 1, endIndex = 500) {
|
|
64369
|
+
const cohortGuid = this.toGuidCohortId(this.dxSaaSService.getCohortIDForURL());
|
|
64370
|
+
const raw = await this.dxSaaSService.oiGet(`ess/users/v2/list/${cohortGuid}`, {
|
|
64371
|
+
cachebuster: Math.random(),
|
|
64372
|
+
preventCache: Math.random(),
|
|
64373
|
+
start_index: startIndex,
|
|
64374
|
+
end_index: endIndex,
|
|
64375
|
+
sort_by_field: 'DATEMODIFIED',
|
|
64376
|
+
sort_order: 'desc',
|
|
64377
|
+
user_type: 'USER_ACCOUNT',
|
|
64378
|
+
});
|
|
64379
|
+
const result = exports.OIUsersV2.UserListResponseSchema.safeParse(raw);
|
|
64380
|
+
if (!result.success) {
|
|
64381
|
+
this.log.warn('OIUsersV2 response validation warning: ' + result.error.message);
|
|
64382
|
+
}
|
|
64383
|
+
return raw;
|
|
64384
|
+
}
|
|
64385
|
+
/** Reformats a cohort id to upper-cased, dashed GUID form (`8-4-4-4-12`). */
|
|
64386
|
+
toGuidCohortId(cohortId) {
|
|
64387
|
+
const hex = cohortId.replace(/-/g, '').toLowerCase();
|
|
64388
|
+
return [
|
|
64389
|
+
hex.slice(0, 8),
|
|
64390
|
+
hex.slice(8, 12),
|
|
64391
|
+
hex.slice(12, 16),
|
|
64392
|
+
hex.slice(16, 20),
|
|
64393
|
+
hex.slice(20, 32),
|
|
64394
|
+
]
|
|
64395
|
+
.join('-')
|
|
64396
|
+
.toUpperCase();
|
|
64397
|
+
}
|
|
64090
64398
|
}
|
|
64091
64399
|
|
|
64092
64400
|
/**
|
|
@@ -66703,56 +67011,47 @@ const coerce$1 = (version, options) => {
|
|
|
66703
67011
|
};
|
|
66704
67012
|
var coerce_1 = coerce$1;
|
|
66705
67013
|
|
|
66706
|
-
|
|
66707
|
-
|
|
66708
|
-
|
|
66709
|
-
|
|
66710
|
-
|
|
66711
|
-
hasRequiredLrucache = 1;
|
|
66712
|
-
|
|
66713
|
-
class LRUCache {
|
|
66714
|
-
constructor () {
|
|
66715
|
-
this.max = 1000;
|
|
66716
|
-
this.map = new Map();
|
|
66717
|
-
}
|
|
66718
|
-
|
|
66719
|
-
get (key) {
|
|
66720
|
-
const value = this.map.get(key);
|
|
66721
|
-
if (value === undefined) {
|
|
66722
|
-
return undefined
|
|
66723
|
-
} else {
|
|
66724
|
-
// Remove the key from the map and add it to the end
|
|
66725
|
-
this.map.delete(key);
|
|
66726
|
-
this.map.set(key, value);
|
|
66727
|
-
return value
|
|
66728
|
-
}
|
|
66729
|
-
}
|
|
67014
|
+
class LRUCache {
|
|
67015
|
+
constructor () {
|
|
67016
|
+
this.max = 1000;
|
|
67017
|
+
this.map = new Map();
|
|
67018
|
+
}
|
|
66730
67019
|
|
|
66731
|
-
|
|
66732
|
-
|
|
66733
|
-
|
|
67020
|
+
get (key) {
|
|
67021
|
+
const value = this.map.get(key);
|
|
67022
|
+
if (value === undefined) {
|
|
67023
|
+
return undefined
|
|
67024
|
+
} else {
|
|
67025
|
+
// Remove the key from the map and add it to the end
|
|
67026
|
+
this.map.delete(key);
|
|
67027
|
+
this.map.set(key, value);
|
|
67028
|
+
return value
|
|
67029
|
+
}
|
|
67030
|
+
}
|
|
66734
67031
|
|
|
66735
|
-
|
|
66736
|
-
|
|
67032
|
+
delete (key) {
|
|
67033
|
+
return this.map.delete(key)
|
|
67034
|
+
}
|
|
66737
67035
|
|
|
66738
|
-
|
|
66739
|
-
|
|
66740
|
-
if (this.map.size >= this.max) {
|
|
66741
|
-
const firstKey = this.map.keys().next().value;
|
|
66742
|
-
this.delete(firstKey);
|
|
66743
|
-
}
|
|
67036
|
+
set (key, value) {
|
|
67037
|
+
const deleted = this.delete(key);
|
|
66744
67038
|
|
|
66745
|
-
|
|
66746
|
-
|
|
67039
|
+
if (!deleted && value !== undefined) {
|
|
67040
|
+
// If cache is full, delete the least recently used item
|
|
67041
|
+
if (this.map.size >= this.max) {
|
|
67042
|
+
const firstKey = this.map.keys().next().value;
|
|
67043
|
+
this.delete(firstKey);
|
|
67044
|
+
}
|
|
66747
67045
|
|
|
66748
|
-
|
|
66749
|
-
|
|
66750
|
-
}
|
|
67046
|
+
this.map.set(key, value);
|
|
67047
|
+
}
|
|
66751
67048
|
|
|
66752
|
-
|
|
66753
|
-
|
|
67049
|
+
return this
|
|
67050
|
+
}
|
|
66754
67051
|
}
|
|
66755
67052
|
|
|
67053
|
+
var lrucache = LRUCache;
|
|
67054
|
+
|
|
66756
67055
|
var range;
|
|
66757
67056
|
var hasRequiredRange;
|
|
66758
67057
|
|
|
@@ -66974,7 +67273,7 @@ function requireRange () {
|
|
|
66974
67273
|
|
|
66975
67274
|
range = Range;
|
|
66976
67275
|
|
|
66977
|
-
const LRU =
|
|
67276
|
+
const LRU = lrucache;
|
|
66978
67277
|
const cache = new LRU();
|
|
66979
67278
|
|
|
66980
67279
|
const parseOptions = parseOptions_1;
|
|
@@ -75987,6 +76286,80 @@ class ServiceService {
|
|
|
75987
76286
|
}
|
|
75988
76287
|
}
|
|
75989
76288
|
|
|
76289
|
+
/**
|
|
76290
|
+
* Service for SLIs (Service Level Indicators), modeled by the OI metricconfig
|
|
76291
|
+
* API as metric "groups" of `type: "sli"` under `oi/v2/metricconfig/groups/*`.
|
|
76292
|
+
*
|
|
76293
|
+
* These endpoints require the `x-authorizationview: VIEWALL` header, so this
|
|
76294
|
+
* service uses {@link DxSaasService.oiPost} / {@link DxSaasService.oiGet}
|
|
76295
|
+
* (which inject it) rather than the plain `tenant*` methods.
|
|
76296
|
+
*
|
|
76297
|
+
* Requests are validated against their input schema (throws `ZodError`);
|
|
76298
|
+
* responses are `safeParse`-validated (warn-on-mismatch, raw still returned).
|
|
76299
|
+
* Backs the `sli list` / `sli export` / `sli import` CLI commands.
|
|
76300
|
+
*/
|
|
76301
|
+
class SLIService {
|
|
76302
|
+
dxSaasService;
|
|
76303
|
+
log;
|
|
76304
|
+
/**
|
|
76305
|
+
* @param dxSaasService - An authenticated {@link DxSaasService} for the target tenant.
|
|
76306
|
+
* @param log - Logger conforming to {@link SimpleLog} from `@dx-do/util`.
|
|
76307
|
+
*/
|
|
76308
|
+
constructor(dxSaasService, log) {
|
|
76309
|
+
this.dxSaasService = dxSaasService;
|
|
76310
|
+
this.log = log;
|
|
76311
|
+
}
|
|
76312
|
+
/**
|
|
76313
|
+
* Lists SLIs via `POST oi/v2/metricconfig/groups/search`.
|
|
76314
|
+
*
|
|
76315
|
+
* @remarks Defaults to `{ pageSize: 5000, type: 'sli' }`; pass a partial
|
|
76316
|
+
* override to change the cap. Response is validated but returned raw on
|
|
76317
|
+
* mismatch.
|
|
76318
|
+
* @throws ZodError if the (merged) request fails schema validation.
|
|
76319
|
+
*/
|
|
76320
|
+
async searchSlis(request) {
|
|
76321
|
+
const body = { pageSize: 5000, type: 'sli', ...request };
|
|
76322
|
+
SliSearchRequestSchema.parse(body);
|
|
76323
|
+
const raw = await this.dxSaasService.oiPost('oi/v2/metricconfig/groups/search', body);
|
|
76324
|
+
const result = SliSearchResponseSchema.safeParse(raw);
|
|
76325
|
+
if (!result.success) {
|
|
76326
|
+
this.log.warn('SliSearchResponse validation warning:', result.error.message);
|
|
76327
|
+
}
|
|
76328
|
+
return raw;
|
|
76329
|
+
}
|
|
76330
|
+
/**
|
|
76331
|
+
* Retrieves a single SLI by id via `GET oi/v2/metricconfig/groups?groupId=<id>`.
|
|
76332
|
+
* The returned object is the **raw** group `sli export` writes to disk.
|
|
76333
|
+
*
|
|
76334
|
+
* @remarks Response is validated but returned raw on mismatch.
|
|
76335
|
+
*/
|
|
76336
|
+
async getSli(sliId) {
|
|
76337
|
+
const raw = await this.dxSaasService.oiGet('oi/v2/metricconfig/groups', { groupId: sliId });
|
|
76338
|
+
const result = SliGroupSchema.safeParse(raw);
|
|
76339
|
+
if (!result.success) {
|
|
76340
|
+
this.log.warn('SliGroup validation warning:', result.error.message);
|
|
76341
|
+
}
|
|
76342
|
+
return raw;
|
|
76343
|
+
}
|
|
76344
|
+
/**
|
|
76345
|
+
* Creates or updates an SLI via `POST oi/v2/metricconfig/groups/save`. Omit
|
|
76346
|
+
* `groupId` on the body to create; include it to update.
|
|
76347
|
+
*
|
|
76348
|
+
* @remarks Request is validated against {@link SliSaveRequestSchema}
|
|
76349
|
+
* (throws on bad input); response validated but returned raw on mismatch.
|
|
76350
|
+
* @throws ZodError if the request fails schema validation.
|
|
76351
|
+
*/
|
|
76352
|
+
async saveSli(body) {
|
|
76353
|
+
SliSaveRequestSchema.parse(body);
|
|
76354
|
+
const raw = await this.dxSaasService.oiPost('oi/v2/metricconfig/groups/save', body);
|
|
76355
|
+
const result = SliSaveResponseSchema.safeParse(raw);
|
|
76356
|
+
if (!result.success) {
|
|
76357
|
+
this.log.warn('SliSaveResponse validation warning:', result.error.message);
|
|
76358
|
+
}
|
|
76359
|
+
return raw;
|
|
76360
|
+
}
|
|
76361
|
+
}
|
|
76362
|
+
|
|
75990
76363
|
/**
|
|
75991
76364
|
* Service for cluster/situation alarms: search, overview, lifecycle, inspection,
|
|
75992
76365
|
* and triggering notifications for situations.
|
|
@@ -77971,6 +78344,7 @@ function createServiceMonolith(dxDoConfiguration, log = new NullSimpleLog()) {
|
|
|
77971
78344
|
dxServiceService: new ServiceService(dxSaaSService, log),
|
|
77972
78345
|
dxSessionService: new SessionService(dxSaaSService),
|
|
77973
78346
|
dxSituationService: new SituationService(dxSaaSService, log),
|
|
78347
|
+
dxSLIService: new SLIService(dxSaaSService, log),
|
|
77974
78348
|
dxSQLService: new SQLService(dxSaaSService),
|
|
77975
78349
|
dxStatesService: new DataStoreStatesService(dxSaaSService, log),
|
|
77976
78350
|
dxTASService,
|
|
@@ -78127,12 +78501,19 @@ exports.QueryRequestSchema = QueryRequestSchema;
|
|
|
78127
78501
|
exports.QueryResultSchema = QueryResultSchema;
|
|
78128
78502
|
exports.QuerySpecSpecifierSchema = QuerySpecSpecifierSchema;
|
|
78129
78503
|
exports.QuerySpecifierSchema = QuerySpecifierSchema;
|
|
78504
|
+
exports.SLIService = SLIService;
|
|
78130
78505
|
exports.SQLService = SQLService;
|
|
78131
78506
|
exports.ServiceFilterSpecifierSchema = ServiceFilterSpecifierSchema;
|
|
78132
78507
|
exports.ServiceService = ServiceService;
|
|
78133
78508
|
exports.SessionService = SessionService;
|
|
78134
78509
|
exports.SimpleHTTPError = SimpleHTTPError;
|
|
78135
78510
|
exports.SituationService = SituationService;
|
|
78511
|
+
exports.SliFilterSchema = SliFilterSchema;
|
|
78512
|
+
exports.SliGroupSchema = SliGroupSchema;
|
|
78513
|
+
exports.SliSaveRequestSchema = SliSaveRequestSchema;
|
|
78514
|
+
exports.SliSaveResponseSchema = SliSaveResponseSchema;
|
|
78515
|
+
exports.SliSearchRequestSchema = SliSearchRequestSchema;
|
|
78516
|
+
exports.SliSearchResponseSchema = SliSearchResponseSchema;
|
|
78136
78517
|
exports.SourceNameAllSpecifierSchema = SourceNameAllSpecifierSchema;
|
|
78137
78518
|
exports.SourceNameAndSpecifierSchema = SourceNameAndSpecifierSchema;
|
|
78138
78519
|
exports.SourceNameExactSpecifierSchema = SourceNameExactSpecifierSchema;
|
|
@@ -78330,6 +78711,7 @@ exports.statistic = statistic;
|
|
|
78330
78711
|
exports.summarizeDataStoreSchema = summarizeDataStoreSchema;
|
|
78331
78712
|
exports.tagsGetAll = tagsGetAll;
|
|
78332
78713
|
exports.timezonesList = timezonesList;
|
|
78714
|
+
exports.toSliSaveRequest = toSliSaveRequest;
|
|
78333
78715
|
exports.userBlockDelete = userBlockDelete;
|
|
78334
78716
|
exports.userBlockPut = userBlockPut;
|
|
78335
78717
|
exports.userDelete = userDelete;
|