@smplkit/sdk 3.0.52 → 3.0.53
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 +245 -57
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +337 -84
- package/dist/index.d.ts +337 -84
- package/dist/index.js +245 -57
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -17167,10 +17167,10 @@ function resolveChain(chain, environment) {
|
|
|
17167
17167
|
|
|
17168
17168
|
// src/config/types.ts
|
|
17169
17169
|
var ItemType = /* @__PURE__ */ ((ItemType2) => {
|
|
17170
|
-
ItemType2["STRING"] = "STRING";
|
|
17171
|
-
ItemType2["NUMBER"] = "NUMBER";
|
|
17172
17170
|
ItemType2["BOOLEAN"] = "BOOLEAN";
|
|
17173
17171
|
ItemType2["JSON"] = "JSON";
|
|
17172
|
+
ItemType2["NUMBER"] = "NUMBER";
|
|
17173
|
+
ItemType2["STRING"] = "STRING";
|
|
17174
17174
|
return ItemType2;
|
|
17175
17175
|
})(ItemType || {});
|
|
17176
17176
|
var ConfigItem = class {
|
|
@@ -18349,8 +18349,8 @@ var import_openapi_fetch3 = __toESM(require("openapi-fetch"), 1);
|
|
|
18349
18349
|
|
|
18350
18350
|
// src/management/types.ts
|
|
18351
18351
|
var EnvironmentClassification = /* @__PURE__ */ ((EnvironmentClassification3) => {
|
|
18352
|
-
EnvironmentClassification3["STANDARD"] = "STANDARD";
|
|
18353
18352
|
EnvironmentClassification3["AD_HOC"] = "AD_HOC";
|
|
18353
|
+
EnvironmentClassification3["STANDARD"] = "STANDARD";
|
|
18354
18354
|
return EnvironmentClassification3;
|
|
18355
18355
|
})(EnvironmentClassification || {});
|
|
18356
18356
|
var HEX_RE = /^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/;
|
|
@@ -18582,14 +18582,14 @@ var AccountSettings = class {
|
|
|
18582
18582
|
|
|
18583
18583
|
// src/flags/types.ts
|
|
18584
18584
|
var Op = /* @__PURE__ */ ((Op2) => {
|
|
18585
|
+
Op2["CONTAINS"] = "contains";
|
|
18585
18586
|
Op2["EQ"] = "==";
|
|
18586
|
-
Op2["NEQ"] = "!=";
|
|
18587
|
-
Op2["LT"] = "<";
|
|
18588
|
-
Op2["LTE"] = "<=";
|
|
18589
18587
|
Op2["GT"] = ">";
|
|
18590
18588
|
Op2["GTE"] = ">=";
|
|
18591
18589
|
Op2["IN"] = "in";
|
|
18592
|
-
Op2["
|
|
18590
|
+
Op2["LT"] = "<";
|
|
18591
|
+
Op2["LTE"] = "<=";
|
|
18592
|
+
Op2["NEQ"] = "!=";
|
|
18593
18593
|
return Op2;
|
|
18594
18594
|
})(Op || {});
|
|
18595
18595
|
var CONTEXT_FIELDS = /* @__PURE__ */ new Set([
|
|
@@ -19278,13 +19278,13 @@ function _coerceValues(values) {
|
|
|
19278
19278
|
|
|
19279
19279
|
// src/logging/types.ts
|
|
19280
19280
|
var LogLevel = /* @__PURE__ */ ((LogLevel5) => {
|
|
19281
|
-
LogLevel5["TRACE"] = "TRACE";
|
|
19282
19281
|
LogLevel5["DEBUG"] = "DEBUG";
|
|
19283
|
-
LogLevel5["INFO"] = "INFO";
|
|
19284
|
-
LogLevel5["WARN"] = "WARN";
|
|
19285
19282
|
LogLevel5["ERROR"] = "ERROR";
|
|
19286
19283
|
LogLevel5["FATAL"] = "FATAL";
|
|
19284
|
+
LogLevel5["INFO"] = "INFO";
|
|
19287
19285
|
LogLevel5["SILENT"] = "SILENT";
|
|
19286
|
+
LogLevel5["TRACE"] = "TRACE";
|
|
19287
|
+
LogLevel5["WARN"] = "WARN";
|
|
19288
19288
|
return LogLevel5;
|
|
19289
19289
|
})(LogLevel || {});
|
|
19290
19290
|
var LoggerChangeEvent = class {
|
|
@@ -19910,6 +19910,137 @@ var LogGroupsClient = class {
|
|
|
19910
19910
|
}
|
|
19911
19911
|
};
|
|
19912
19912
|
|
|
19913
|
+
// src/audit/types.ts
|
|
19914
|
+
var HttpConfiguration = class {
|
|
19915
|
+
/** HTTP verb used for delivery. Defaults to {@link HttpMethod.POST}. */
|
|
19916
|
+
method;
|
|
19917
|
+
/** Destination URL the audit service POSTs each event to. */
|
|
19918
|
+
url;
|
|
19919
|
+
/**
|
|
19920
|
+
* Headers attached to every outbound request. Values carry credentials
|
|
19921
|
+
* and are encrypted at rest server-side; reads return them redacted.
|
|
19922
|
+
*/
|
|
19923
|
+
headers;
|
|
19924
|
+
/**
|
|
19925
|
+
* Status the destination must return for delivery to count as success
|
|
19926
|
+
* — either an exact code (`"200"`, `"204"`) or a status class
|
|
19927
|
+
* (`"2xx"`, `"4xx"`). Defaults to `"2xx"`.
|
|
19928
|
+
*/
|
|
19929
|
+
successStatus;
|
|
19930
|
+
constructor(fields = {}) {
|
|
19931
|
+
this.method = fields.method ?? "POST" /* POST */;
|
|
19932
|
+
this.url = fields.url ?? "";
|
|
19933
|
+
this.headers = fields.headers ?? [];
|
|
19934
|
+
this.successStatus = fields.successStatus ?? "2xx";
|
|
19935
|
+
}
|
|
19936
|
+
};
|
|
19937
|
+
var Forwarder = class {
|
|
19938
|
+
/**
|
|
19939
|
+
* Server-assigned UUID for this forwarder. `null` until {@link save}
|
|
19940
|
+
* has run for the first time.
|
|
19941
|
+
*/
|
|
19942
|
+
id;
|
|
19943
|
+
/** Display name. Free-form. */
|
|
19944
|
+
name;
|
|
19945
|
+
/** Destination type — see {@link ForwarderType}. */
|
|
19946
|
+
forwarderType;
|
|
19947
|
+
/** Destination request configuration. */
|
|
19948
|
+
configuration;
|
|
19949
|
+
/**
|
|
19950
|
+
* When `false`, the audit service skips delivery for this forwarder
|
|
19951
|
+
* but still records `filtered_out` deliveries.
|
|
19952
|
+
*/
|
|
19953
|
+
enabled;
|
|
19954
|
+
/** Optional free-text description. */
|
|
19955
|
+
description;
|
|
19956
|
+
/**
|
|
19957
|
+
* Optional JSON Logic expression evaluated per event. When set, events
|
|
19958
|
+
* that don't match are recorded as `filtered_out` deliveries instead
|
|
19959
|
+
* of being POSTed to the destination.
|
|
19960
|
+
*/
|
|
19961
|
+
filter;
|
|
19962
|
+
/**
|
|
19963
|
+
* Optional template applied to each event before delivery. Shape
|
|
19964
|
+
* depends on {@link transformType}; for `"JSONATA"`, a JSONata
|
|
19965
|
+
* expression string. `null` delivers the event JSON as-is.
|
|
19966
|
+
*/
|
|
19967
|
+
transform;
|
|
19968
|
+
/**
|
|
19969
|
+
* Engine used to evaluate {@link transform}. Currently only
|
|
19970
|
+
* `"JSONATA"` is supported. Auto-filled by the SDK whenever
|
|
19971
|
+
* {@link transform} is set on save.
|
|
19972
|
+
*/
|
|
19973
|
+
transformType;
|
|
19974
|
+
/**
|
|
19975
|
+
* When the audit service first persisted this forwarder. `null` for
|
|
19976
|
+
* an unsaved instance.
|
|
19977
|
+
*/
|
|
19978
|
+
createdAt;
|
|
19979
|
+
/** When this forwarder was last mutated. */
|
|
19980
|
+
updatedAt;
|
|
19981
|
+
/** Soft-delete timestamp. `null` for live forwarders. */
|
|
19982
|
+
deletedAt;
|
|
19983
|
+
/** Monotonic version counter; bumped on every server-side write. */
|
|
19984
|
+
version;
|
|
19985
|
+
/** @internal */
|
|
19986
|
+
_client;
|
|
19987
|
+
constructor(client, fields) {
|
|
19988
|
+
this._client = client;
|
|
19989
|
+
this.id = fields.id ?? null;
|
|
19990
|
+
this.name = fields.name;
|
|
19991
|
+
this.forwarderType = fields.forwarderType;
|
|
19992
|
+
this.configuration = fields.configuration;
|
|
19993
|
+
this.enabled = fields.enabled ?? true;
|
|
19994
|
+
this.description = fields.description ?? null;
|
|
19995
|
+
this.filter = fields.filter ?? null;
|
|
19996
|
+
this.transform = fields.transform ?? null;
|
|
19997
|
+
this.transformType = fields.transformType ?? null;
|
|
19998
|
+
this.createdAt = fields.createdAt ?? null;
|
|
19999
|
+
this.updatedAt = fields.updatedAt ?? null;
|
|
20000
|
+
this.deletedAt = fields.deletedAt ?? null;
|
|
20001
|
+
this.version = fields.version ?? null;
|
|
20002
|
+
}
|
|
20003
|
+
/**
|
|
20004
|
+
* Create or update this forwarder on the server.
|
|
20005
|
+
*
|
|
20006
|
+
* Upsert behavior is driven by {@link createdAt}: a forwarder with
|
|
20007
|
+
* no `createdAt` is created (POST); otherwise it's full-replace
|
|
20008
|
+
* updated (PUT). After the call, every field is refreshed from the
|
|
20009
|
+
* server response (including newly-assigned `id`, `createdAt`,
|
|
20010
|
+
* `updatedAt`, `version`).
|
|
20011
|
+
*/
|
|
20012
|
+
async save() {
|
|
20013
|
+
if (this._client === null) {
|
|
20014
|
+
throw new Error("Forwarder was constructed without a client; cannot save");
|
|
20015
|
+
}
|
|
20016
|
+
const other = this.createdAt === null ? await this._client._createForwarder(this) : await this._client._updateForwarder(this);
|
|
20017
|
+
this._apply(other);
|
|
20018
|
+
}
|
|
20019
|
+
/** Soft-delete this forwarder on the server. */
|
|
20020
|
+
async delete() {
|
|
20021
|
+
if (this._client === null || this.id === null) {
|
|
20022
|
+
throw new Error("Forwarder was constructed without a client or id; cannot delete");
|
|
20023
|
+
}
|
|
20024
|
+
await this._client._deleteForwarder(this.id);
|
|
20025
|
+
}
|
|
20026
|
+
/** @internal Copy every server-authoritative field from `other` onto self. */
|
|
20027
|
+
_apply(other) {
|
|
20028
|
+
this.id = other.id;
|
|
20029
|
+
this.name = other.name;
|
|
20030
|
+
this.forwarderType = other.forwarderType;
|
|
20031
|
+
this.configuration = other.configuration;
|
|
20032
|
+
this.enabled = other.enabled;
|
|
20033
|
+
this.description = other.description;
|
|
20034
|
+
this.filter = other.filter;
|
|
20035
|
+
this.transform = other.transform;
|
|
20036
|
+
this.transformType = other.transformType;
|
|
20037
|
+
this.createdAt = other.createdAt;
|
|
20038
|
+
this.updatedAt = other.updatedAt;
|
|
20039
|
+
this.deletedAt = other.deletedAt;
|
|
20040
|
+
this.version = other.version;
|
|
20041
|
+
}
|
|
20042
|
+
};
|
|
20043
|
+
|
|
19913
20044
|
// src/management/audit.ts
|
|
19914
20045
|
async function checkError4(response) {
|
|
19915
20046
|
const body = await response.text().catch(() => "");
|
|
@@ -19950,31 +20081,33 @@ function _configurationFromWire(raw) {
|
|
|
19950
20081
|
name: String(h.name ?? ""),
|
|
19951
20082
|
value: String(h.value ?? "")
|
|
19952
20083
|
}));
|
|
19953
|
-
return {
|
|
19954
|
-
method:
|
|
20084
|
+
return new HttpConfiguration({
|
|
20085
|
+
method: r.method ?? "POST" /* POST */,
|
|
19955
20086
|
url: String(r.url ?? ""),
|
|
19956
20087
|
headers,
|
|
19957
20088
|
successStatus: String(r.success_status ?? "2xx")
|
|
19958
|
-
};
|
|
20089
|
+
});
|
|
19959
20090
|
}
|
|
19960
|
-
function
|
|
20091
|
+
function _forwarderAttrs(forwarder) {
|
|
19961
20092
|
const attrs = {
|
|
19962
|
-
name:
|
|
19963
|
-
forwarder_type:
|
|
19964
|
-
enabled:
|
|
19965
|
-
configuration: _configurationToWire(
|
|
20093
|
+
name: forwarder.name,
|
|
20094
|
+
forwarder_type: forwarder.forwarderType,
|
|
20095
|
+
enabled: forwarder.enabled,
|
|
20096
|
+
configuration: _configurationToWire(forwarder.configuration)
|
|
19966
20097
|
};
|
|
19967
|
-
if (
|
|
19968
|
-
if (
|
|
19969
|
-
attrs.filter =
|
|
20098
|
+
if (forwarder.description !== null) attrs.description = forwarder.description;
|
|
20099
|
+
if (forwarder.filter !== null) {
|
|
20100
|
+
attrs.filter = forwarder.filter;
|
|
20101
|
+
}
|
|
20102
|
+
if (forwarder.transform !== null) {
|
|
20103
|
+
attrs.transform_type = "JSONATA" /* JSONATA */;
|
|
20104
|
+
attrs.transform = forwarder.transform;
|
|
19970
20105
|
}
|
|
19971
|
-
if (input.transformType !== void 0) attrs.transform_type = input.transformType;
|
|
19972
|
-
if (input.transform !== void 0) attrs.transform = input.transform;
|
|
19973
20106
|
return attrs;
|
|
19974
20107
|
}
|
|
19975
|
-
function _forwarderFromResource(resource) {
|
|
20108
|
+
function _forwarderFromResource(resource, client) {
|
|
19976
20109
|
const a = resource.attributes;
|
|
19977
|
-
return {
|
|
20110
|
+
return new Forwarder(client, {
|
|
19978
20111
|
id: resource.id,
|
|
19979
20112
|
name: String(a.name ?? ""),
|
|
19980
20113
|
description: a.description ?? null,
|
|
@@ -19988,28 +20121,52 @@ function _forwarderFromResource(resource) {
|
|
|
19988
20121
|
updatedAt: a.updated_at ?? null,
|
|
19989
20122
|
deletedAt: a.deleted_at ?? null,
|
|
19990
20123
|
version: a.version ?? null
|
|
19991
|
-
};
|
|
20124
|
+
});
|
|
19992
20125
|
}
|
|
19993
20126
|
var ForwardersClient = class {
|
|
19994
20127
|
/** @internal */
|
|
19995
20128
|
constructor(_http) {
|
|
19996
20129
|
this._http = _http;
|
|
19997
20130
|
}
|
|
19998
|
-
|
|
19999
|
-
|
|
20000
|
-
|
|
20001
|
-
|
|
20002
|
-
|
|
20003
|
-
|
|
20004
|
-
|
|
20005
|
-
|
|
20006
|
-
|
|
20007
|
-
|
|
20008
|
-
|
|
20009
|
-
|
|
20010
|
-
|
|
20011
|
-
|
|
20131
|
+
/**
|
|
20132
|
+
* Construct an unsaved {@link Forwarder}. Call {@link Forwarder.save}
|
|
20133
|
+
* to persist.
|
|
20134
|
+
*
|
|
20135
|
+
* @param fields.name Display name. Free-form.
|
|
20136
|
+
* @param fields.forwarderType Destination type — see {@link ForwarderType}.
|
|
20137
|
+
* @param fields.configuration Destination HTTP request configuration.
|
|
20138
|
+
* Headers carry credentials and are
|
|
20139
|
+
* encrypted at rest server-side; reads
|
|
20140
|
+
* return them redacted.
|
|
20141
|
+
* @param fields.enabled Whether the forwarder is active. Defaults true.
|
|
20142
|
+
* @param fields.description Optional free-text description.
|
|
20143
|
+
* @param fields.filter Optional JSON Logic filter; events that
|
|
20144
|
+
* don't match are recorded as
|
|
20145
|
+
* `filtered_out` deliveries.
|
|
20146
|
+
* @param fields.transform Optional JSONata template applied to
|
|
20147
|
+
* the event payload before POST. `null`
|
|
20148
|
+
* delivers the event as-is.
|
|
20149
|
+
*/
|
|
20150
|
+
new(fields) {
|
|
20151
|
+
return new Forwarder(this, {
|
|
20152
|
+
name: fields.name,
|
|
20153
|
+
forwarderType: fields.forwarderType,
|
|
20154
|
+
configuration: fields.configuration,
|
|
20155
|
+
enabled: fields.enabled,
|
|
20156
|
+
description: fields.description,
|
|
20157
|
+
filter: fields.filter,
|
|
20158
|
+
transform: fields.transform
|
|
20159
|
+
});
|
|
20012
20160
|
}
|
|
20161
|
+
/**
|
|
20162
|
+
* List forwarders for the authenticated account.
|
|
20163
|
+
*
|
|
20164
|
+
* Offset paginated per ADR-014: pass {@link ListForwardersParams.pageNumber}
|
|
20165
|
+
* (1-based) and {@link ListForwardersParams.pageSize} (default 1000,
|
|
20166
|
+
* max 1000). Pass `metaTotal=true` to populate `total` and `totalPages`
|
|
20167
|
+
* in the returned `pagination` (costs an extra `COUNT` query
|
|
20168
|
+
* server-side).
|
|
20169
|
+
*/
|
|
20013
20170
|
async list(params = {}) {
|
|
20014
20171
|
const query = {};
|
|
20015
20172
|
if (params.forwarderType !== void 0) query["filter[forwarder_type]"] = params.forwarderType;
|
|
@@ -20028,10 +20185,15 @@ var ForwardersClient = class {
|
|
|
20028
20185
|
wrapFetchError4(err);
|
|
20029
20186
|
}
|
|
20030
20187
|
return {
|
|
20031
|
-
forwarders: (data?.data ?? []).map(_forwarderFromResource),
|
|
20188
|
+
forwarders: (data?.data ?? []).map((r) => _forwarderFromResource(r, this)),
|
|
20032
20189
|
pagination: _paginationFromBody2(data ?? {})
|
|
20033
20190
|
};
|
|
20034
20191
|
}
|
|
20192
|
+
/**
|
|
20193
|
+
* Fetch a single forwarder by id. The returned instance is bound to
|
|
20194
|
+
* this client so {@link Forwarder.save} and {@link Forwarder.delete}
|
|
20195
|
+
* round-trip back here.
|
|
20196
|
+
*/
|
|
20035
20197
|
async get(forwarderId) {
|
|
20036
20198
|
let data;
|
|
20037
20199
|
try {
|
|
@@ -20044,41 +20206,67 @@ var ForwardersClient = class {
|
|
|
20044
20206
|
wrapFetchError4(err);
|
|
20045
20207
|
}
|
|
20046
20208
|
if (!data?.data) throw new SmplError("Unexpected empty response from audit");
|
|
20047
|
-
return _forwarderFromResource(data.data);
|
|
20209
|
+
return _forwarderFromResource(data.data, this);
|
|
20210
|
+
}
|
|
20211
|
+
/** Soft-delete a forwarder by id. */
|
|
20212
|
+
async delete(forwarderId) {
|
|
20213
|
+
try {
|
|
20214
|
+
const result = await this._http.DELETE("/api/v1/forwarders/{forwarder_id}", {
|
|
20215
|
+
params: { path: { forwarder_id: forwarderId } }
|
|
20216
|
+
});
|
|
20217
|
+
if (result.response.status !== 204) await checkError4(result.response);
|
|
20218
|
+
} catch (err) {
|
|
20219
|
+
wrapFetchError4(err);
|
|
20220
|
+
}
|
|
20048
20221
|
}
|
|
20049
20222
|
/**
|
|
20050
|
-
*
|
|
20051
|
-
*
|
|
20052
|
-
* Header values must be re-supplied as plaintext; the GET path
|
|
20053
|
-
* returns them in plaintext for exactly this round-trip.
|
|
20223
|
+
* @internal Called by `Forwarder.save()` on unsaved instances.
|
|
20054
20224
|
*/
|
|
20055
|
-
async
|
|
20225
|
+
async _createForwarder(forwarder) {
|
|
20056
20226
|
const body = {
|
|
20057
|
-
data: { id:
|
|
20227
|
+
data: { id: "", type: "forwarder", attributes: _forwarderAttrs(forwarder) }
|
|
20058
20228
|
};
|
|
20059
20229
|
let data;
|
|
20060
20230
|
try {
|
|
20061
|
-
const result = await this._http.
|
|
20062
|
-
params: { path: { forwarder_id: forwarderId } },
|
|
20063
|
-
body
|
|
20064
|
-
});
|
|
20231
|
+
const result = await this._http.POST("/api/v1/forwarders", { body });
|
|
20065
20232
|
if (!result.response.ok) await checkError4(result.response);
|
|
20066
20233
|
data = result.data;
|
|
20067
20234
|
} catch (err) {
|
|
20068
20235
|
wrapFetchError4(err);
|
|
20069
20236
|
}
|
|
20070
20237
|
if (!data?.data) throw new SmplError("Unexpected empty response from audit");
|
|
20071
|
-
return _forwarderFromResource(data.data);
|
|
20238
|
+
return _forwarderFromResource(data.data, this);
|
|
20072
20239
|
}
|
|
20073
|
-
|
|
20240
|
+
/**
|
|
20241
|
+
* @internal Full-replace PUT. Called by `Forwarder.save()` on
|
|
20242
|
+
* instances that already have a `createdAt`. Header values must be
|
|
20243
|
+
* re-supplied as plaintext; the GET path redacts them, so a PUT body
|
|
20244
|
+
* containing `"<redacted>"` would persist that literal.
|
|
20245
|
+
*/
|
|
20246
|
+
async _updateForwarder(forwarder) {
|
|
20247
|
+
if (forwarder.id === null) {
|
|
20248
|
+
throw new Error("cannot update a Forwarder with no id");
|
|
20249
|
+
}
|
|
20250
|
+
const body = {
|
|
20251
|
+
data: { id: forwarder.id, type: "forwarder", attributes: _forwarderAttrs(forwarder) }
|
|
20252
|
+
};
|
|
20253
|
+
let data;
|
|
20074
20254
|
try {
|
|
20075
|
-
const result = await this._http.
|
|
20076
|
-
params: { path: { forwarder_id:
|
|
20255
|
+
const result = await this._http.PUT("/api/v1/forwarders/{forwarder_id}", {
|
|
20256
|
+
params: { path: { forwarder_id: forwarder.id } },
|
|
20257
|
+
body
|
|
20077
20258
|
});
|
|
20078
|
-
if (result.response.
|
|
20259
|
+
if (!result.response.ok) await checkError4(result.response);
|
|
20260
|
+
data = result.data;
|
|
20079
20261
|
} catch (err) {
|
|
20080
20262
|
wrapFetchError4(err);
|
|
20081
20263
|
}
|
|
20264
|
+
if (!data?.data) throw new SmplError("Unexpected empty response from audit");
|
|
20265
|
+
return _forwarderFromResource(data.data, this);
|
|
20266
|
+
}
|
|
20267
|
+
/** @internal Called by `Forwarder.delete()`. */
|
|
20268
|
+
async _deleteForwarder(id) {
|
|
20269
|
+
return this.delete(id);
|
|
20082
20270
|
}
|
|
20083
20271
|
};
|
|
20084
20272
|
var ManagementAuditClient = class {
|