@smplkit/sdk 3.0.71 → 3.0.73
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 +12 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +29 -29
- package/dist/index.d.ts +29 -29
- package/dist/index.js +12 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -11,13 +11,13 @@ import createClient from 'openapi-fetch';
|
|
|
11
11
|
interface AuditEvent {
|
|
12
12
|
/** Server-assigned UUID for this event. */
|
|
13
13
|
id: string;
|
|
14
|
-
/**
|
|
15
|
-
|
|
16
|
-
/** Type of resource the
|
|
14
|
+
/** Event type slug — e.g. `"user.created"`, `"invoice.paid"`. */
|
|
15
|
+
eventType: string;
|
|
16
|
+
/** Type of resource the event operated on — e.g. `"invoice"`. */
|
|
17
17
|
resourceType: string;
|
|
18
|
-
/** Customer-facing id of the resource the
|
|
18
|
+
/** Customer-facing id of the resource the event operated on. */
|
|
19
19
|
resourceId: string;
|
|
20
|
-
/** ISO-8601-with-offset timestamp of when the
|
|
20
|
+
/** ISO-8601-with-offset timestamp of when the event actually happened. */
|
|
21
21
|
occurredAt: string;
|
|
22
22
|
/** ISO-8601-with-offset timestamp of when the audit service ingested the event. */
|
|
23
23
|
createdAt: string;
|
|
@@ -54,9 +54,9 @@ interface AuditEvent {
|
|
|
54
54
|
* Inputs for `client.audit.events.record(...)`.
|
|
55
55
|
*/
|
|
56
56
|
interface CreateEventInput {
|
|
57
|
-
/**
|
|
58
|
-
|
|
59
|
-
/** Type of resource the
|
|
57
|
+
/** Event type slug — e.g. `"invoice.paid"`. */
|
|
58
|
+
eventType: string;
|
|
59
|
+
/** Type of resource the event operated on. */
|
|
60
60
|
resourceType: string;
|
|
61
61
|
/** Customer-facing id of the resource. */
|
|
62
62
|
resourceId: string;
|
|
@@ -95,8 +95,8 @@ interface CreateEventInput {
|
|
|
95
95
|
* `nextCursor` to walk forward.
|
|
96
96
|
*/
|
|
97
97
|
interface ListEventsParams {
|
|
98
|
-
/** Filter to this
|
|
99
|
-
|
|
98
|
+
/** Filter to this event type slug. */
|
|
99
|
+
eventType?: string;
|
|
100
100
|
/** Filter to this resource_type slug. */
|
|
101
101
|
resourceType?: string;
|
|
102
102
|
/** Filter to this resource id. */
|
|
@@ -152,23 +152,23 @@ interface ListResourceTypesPage {
|
|
|
152
152
|
pagination: Pagination;
|
|
153
153
|
}
|
|
154
154
|
/**
|
|
155
|
-
* A distinct
|
|
155
|
+
* A distinct event type slug seen for the account.
|
|
156
156
|
*/
|
|
157
|
-
interface
|
|
158
|
-
/** The
|
|
157
|
+
interface EventType {
|
|
158
|
+
/** The event type slug, surfaced as the JSON:API resource id. */
|
|
159
159
|
id: string;
|
|
160
160
|
/**
|
|
161
161
|
* ISO-8601 timestamp of the earliest sighting for the account. When
|
|
162
162
|
* the list call was filtered by `resourceType`, this is the first
|
|
163
|
-
* sighting of that specific (
|
|
163
|
+
* sighting of that specific (event_type, resource_type) pair.
|
|
164
164
|
*/
|
|
165
165
|
createdAt: string;
|
|
166
166
|
}
|
|
167
167
|
/**
|
|
168
|
-
* Parameters accepted by `client.audit.
|
|
168
|
+
* Parameters accepted by `client.audit.eventTypes.list(...)`.
|
|
169
169
|
*/
|
|
170
|
-
interface
|
|
171
|
-
/** When set, returns only the
|
|
170
|
+
interface ListEventTypesParams {
|
|
171
|
+
/** When set, returns only the event types seen with this resource_type. */
|
|
172
172
|
filterResourceType?: string;
|
|
173
173
|
/** 1-based page number to return. Defaults to 1. */
|
|
174
174
|
pageNumber?: number;
|
|
@@ -178,11 +178,11 @@ interface ListActionsParams {
|
|
|
178
178
|
metaTotal?: boolean;
|
|
179
179
|
}
|
|
180
180
|
/**
|
|
181
|
-
* Page of
|
|
181
|
+
* Page of event types returned by `client.audit.eventTypes.list(...)`.
|
|
182
182
|
*/
|
|
183
|
-
interface
|
|
184
|
-
/**
|
|
185
|
-
|
|
183
|
+
interface EventTypeListPage {
|
|
184
|
+
/** Event types on this page, alphabetically sorted. */
|
|
185
|
+
eventTypes: EventType[];
|
|
186
186
|
/** Pagination metadata. */
|
|
187
187
|
pagination: Pagination;
|
|
188
188
|
}
|
|
@@ -424,7 +424,7 @@ interface Pagination {
|
|
|
424
424
|
* Public surface:
|
|
425
425
|
* client.audit.events.{record,list,get,flush}
|
|
426
426
|
* client.audit.resourceTypes.list(...)
|
|
427
|
-
* client.audit.
|
|
427
|
+
* client.audit.eventTypes.list(...)
|
|
428
428
|
*
|
|
429
429
|
* The runtime audit client owns event recording and read-side queries —
|
|
430
430
|
* fire-and-forget `record`, plus the audit-log list/get and the
|
|
@@ -478,23 +478,23 @@ declare class ResourceTypesClient {
|
|
|
478
478
|
*/
|
|
479
479
|
list(params?: ListResourceTypesParams): Promise<ListResourceTypesPage>;
|
|
480
480
|
}
|
|
481
|
-
declare class
|
|
481
|
+
declare class EventTypesClient {
|
|
482
482
|
private readonly _http;
|
|
483
483
|
constructor(_http: AuditHttp$1);
|
|
484
484
|
/**
|
|
485
|
-
* List the distinct `
|
|
485
|
+
* List the distinct `event_type` slugs recorded for this account.
|
|
486
486
|
*
|
|
487
|
-
* Without `filterResourceType`, returns one row per distinct
|
|
488
|
-
* With `filterResourceType`, returns only the
|
|
487
|
+
* Without `filterResourceType`, returns one row per distinct event type.
|
|
488
|
+
* With `filterResourceType`, returns only the event types recorded with
|
|
489
489
|
* that resource_type, powering cascading-filter UIs (ADR-047 §2.5).
|
|
490
490
|
* Sorted alphabetically; offset pagination via `pageNumber` / `pageSize`.
|
|
491
491
|
*/
|
|
492
|
-
list(params?:
|
|
492
|
+
list(params?: ListEventTypesParams): Promise<EventTypeListPage>;
|
|
493
493
|
}
|
|
494
494
|
declare class AuditClient {
|
|
495
495
|
readonly events: EventsClient;
|
|
496
496
|
readonly resourceTypes: ResourceTypesClient;
|
|
497
|
-
readonly
|
|
497
|
+
readonly eventTypes: EventTypesClient;
|
|
498
498
|
constructor(opts: {
|
|
499
499
|
apiKey: string;
|
|
500
500
|
baseUrl: string;
|
|
@@ -4083,4 +4083,4 @@ declare class SmplPaymentRequiredError extends SmplError {
|
|
|
4083
4083
|
/** @deprecated Use {@link ApiErrorDetail}. */
|
|
4084
4084
|
type ApiErrorObject = ApiErrorDetail;
|
|
4085
4085
|
|
|
4086
|
-
export { AccountSettings, AccountSettingsClient, type ApiErrorDetail, type ApiErrorObject, type
|
|
4086
|
+
export { AccountSettings, AccountSettingsClient, type ApiErrorDetail, type ApiErrorObject, AuditClient, type AuditEvent, type ListEventsPage as AuditEventListPage, type ListEventsParams as AuditEventListParams, type EventType as AuditEventType, type EventTypeListPage as AuditEventTypeListPage, ForwardersClient as AuditForwardersClient, type ListEventTypesParams as AuditListEventTypesParams, type ListResourceTypesParams as AuditListResourceTypesParams, type Pagination as AuditPagination, type ResourceType as AuditResourceType, type ListResourceTypesPage as AuditResourceTypeListPage, BooleanFlag, Color, Config, ConfigChangeEvent, ConfigClient, ConfigEnvironment, ConfigItem, Context, ContextType, ContextTypesClient, ContextsClient, type CreateEventInput as CreateAuditEventInput, Environment, EnvironmentClassification, EnvironmentsClient, Flag, FlagChangeEvent, FlagDeclaration, FlagEnvironment, FlagRule, FlagStats, FlagValue, FlagsClient, ItemType, JsonFlag, LiveConfigProxy, LogGroup, LogLevel, Logger, LoggerChangeEvent, LoggerEnvironment, LoggerSource, type LoggingAdapter, LoggingClient, ManagementAuditClient, NumberFlag, Op, PinoAdapter, type PinoAdapterConfig, Rule, SharedWebSocket, SmplClient, type SmplClientOptions, SmplConflictError, SmplConnectionError, SmplError, SmplManagementClient, type SmplManagementClientOptions, SmplNotFoundError, SmplPaymentRequiredError, SmplTimeoutError, SmplValidationError, SmplConflictError as SmplkitConflictError, SmplConnectionError as SmplkitConnectionError, SmplError as SmplkitError, SmplNotFoundError as SmplkitNotFoundError, SmplPaymentRequiredError as SmplkitPaymentRequiredError, SmplTimeoutError as SmplkitTimeoutError, SmplValidationError as SmplkitValidationError, StringFlag, WinstonAdapter, type WinstonAdapterConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -11,13 +11,13 @@ import createClient from 'openapi-fetch';
|
|
|
11
11
|
interface AuditEvent {
|
|
12
12
|
/** Server-assigned UUID for this event. */
|
|
13
13
|
id: string;
|
|
14
|
-
/**
|
|
15
|
-
|
|
16
|
-
/** Type of resource the
|
|
14
|
+
/** Event type slug — e.g. `"user.created"`, `"invoice.paid"`. */
|
|
15
|
+
eventType: string;
|
|
16
|
+
/** Type of resource the event operated on — e.g. `"invoice"`. */
|
|
17
17
|
resourceType: string;
|
|
18
|
-
/** Customer-facing id of the resource the
|
|
18
|
+
/** Customer-facing id of the resource the event operated on. */
|
|
19
19
|
resourceId: string;
|
|
20
|
-
/** ISO-8601-with-offset timestamp of when the
|
|
20
|
+
/** ISO-8601-with-offset timestamp of when the event actually happened. */
|
|
21
21
|
occurredAt: string;
|
|
22
22
|
/** ISO-8601-with-offset timestamp of when the audit service ingested the event. */
|
|
23
23
|
createdAt: string;
|
|
@@ -54,9 +54,9 @@ interface AuditEvent {
|
|
|
54
54
|
* Inputs for `client.audit.events.record(...)`.
|
|
55
55
|
*/
|
|
56
56
|
interface CreateEventInput {
|
|
57
|
-
/**
|
|
58
|
-
|
|
59
|
-
/** Type of resource the
|
|
57
|
+
/** Event type slug — e.g. `"invoice.paid"`. */
|
|
58
|
+
eventType: string;
|
|
59
|
+
/** Type of resource the event operated on. */
|
|
60
60
|
resourceType: string;
|
|
61
61
|
/** Customer-facing id of the resource. */
|
|
62
62
|
resourceId: string;
|
|
@@ -95,8 +95,8 @@ interface CreateEventInput {
|
|
|
95
95
|
* `nextCursor` to walk forward.
|
|
96
96
|
*/
|
|
97
97
|
interface ListEventsParams {
|
|
98
|
-
/** Filter to this
|
|
99
|
-
|
|
98
|
+
/** Filter to this event type slug. */
|
|
99
|
+
eventType?: string;
|
|
100
100
|
/** Filter to this resource_type slug. */
|
|
101
101
|
resourceType?: string;
|
|
102
102
|
/** Filter to this resource id. */
|
|
@@ -152,23 +152,23 @@ interface ListResourceTypesPage {
|
|
|
152
152
|
pagination: Pagination;
|
|
153
153
|
}
|
|
154
154
|
/**
|
|
155
|
-
* A distinct
|
|
155
|
+
* A distinct event type slug seen for the account.
|
|
156
156
|
*/
|
|
157
|
-
interface
|
|
158
|
-
/** The
|
|
157
|
+
interface EventType {
|
|
158
|
+
/** The event type slug, surfaced as the JSON:API resource id. */
|
|
159
159
|
id: string;
|
|
160
160
|
/**
|
|
161
161
|
* ISO-8601 timestamp of the earliest sighting for the account. When
|
|
162
162
|
* the list call was filtered by `resourceType`, this is the first
|
|
163
|
-
* sighting of that specific (
|
|
163
|
+
* sighting of that specific (event_type, resource_type) pair.
|
|
164
164
|
*/
|
|
165
165
|
createdAt: string;
|
|
166
166
|
}
|
|
167
167
|
/**
|
|
168
|
-
* Parameters accepted by `client.audit.
|
|
168
|
+
* Parameters accepted by `client.audit.eventTypes.list(...)`.
|
|
169
169
|
*/
|
|
170
|
-
interface
|
|
171
|
-
/** When set, returns only the
|
|
170
|
+
interface ListEventTypesParams {
|
|
171
|
+
/** When set, returns only the event types seen with this resource_type. */
|
|
172
172
|
filterResourceType?: string;
|
|
173
173
|
/** 1-based page number to return. Defaults to 1. */
|
|
174
174
|
pageNumber?: number;
|
|
@@ -178,11 +178,11 @@ interface ListActionsParams {
|
|
|
178
178
|
metaTotal?: boolean;
|
|
179
179
|
}
|
|
180
180
|
/**
|
|
181
|
-
* Page of
|
|
181
|
+
* Page of event types returned by `client.audit.eventTypes.list(...)`.
|
|
182
182
|
*/
|
|
183
|
-
interface
|
|
184
|
-
/**
|
|
185
|
-
|
|
183
|
+
interface EventTypeListPage {
|
|
184
|
+
/** Event types on this page, alphabetically sorted. */
|
|
185
|
+
eventTypes: EventType[];
|
|
186
186
|
/** Pagination metadata. */
|
|
187
187
|
pagination: Pagination;
|
|
188
188
|
}
|
|
@@ -424,7 +424,7 @@ interface Pagination {
|
|
|
424
424
|
* Public surface:
|
|
425
425
|
* client.audit.events.{record,list,get,flush}
|
|
426
426
|
* client.audit.resourceTypes.list(...)
|
|
427
|
-
* client.audit.
|
|
427
|
+
* client.audit.eventTypes.list(...)
|
|
428
428
|
*
|
|
429
429
|
* The runtime audit client owns event recording and read-side queries —
|
|
430
430
|
* fire-and-forget `record`, plus the audit-log list/get and the
|
|
@@ -478,23 +478,23 @@ declare class ResourceTypesClient {
|
|
|
478
478
|
*/
|
|
479
479
|
list(params?: ListResourceTypesParams): Promise<ListResourceTypesPage>;
|
|
480
480
|
}
|
|
481
|
-
declare class
|
|
481
|
+
declare class EventTypesClient {
|
|
482
482
|
private readonly _http;
|
|
483
483
|
constructor(_http: AuditHttp$1);
|
|
484
484
|
/**
|
|
485
|
-
* List the distinct `
|
|
485
|
+
* List the distinct `event_type` slugs recorded for this account.
|
|
486
486
|
*
|
|
487
|
-
* Without `filterResourceType`, returns one row per distinct
|
|
488
|
-
* With `filterResourceType`, returns only the
|
|
487
|
+
* Without `filterResourceType`, returns one row per distinct event type.
|
|
488
|
+
* With `filterResourceType`, returns only the event types recorded with
|
|
489
489
|
* that resource_type, powering cascading-filter UIs (ADR-047 §2.5).
|
|
490
490
|
* Sorted alphabetically; offset pagination via `pageNumber` / `pageSize`.
|
|
491
491
|
*/
|
|
492
|
-
list(params?:
|
|
492
|
+
list(params?: ListEventTypesParams): Promise<EventTypeListPage>;
|
|
493
493
|
}
|
|
494
494
|
declare class AuditClient {
|
|
495
495
|
readonly events: EventsClient;
|
|
496
496
|
readonly resourceTypes: ResourceTypesClient;
|
|
497
|
-
readonly
|
|
497
|
+
readonly eventTypes: EventTypesClient;
|
|
498
498
|
constructor(opts: {
|
|
499
499
|
apiKey: string;
|
|
500
500
|
baseUrl: string;
|
|
@@ -4083,4 +4083,4 @@ declare class SmplPaymentRequiredError extends SmplError {
|
|
|
4083
4083
|
/** @deprecated Use {@link ApiErrorDetail}. */
|
|
4084
4084
|
type ApiErrorObject = ApiErrorDetail;
|
|
4085
4085
|
|
|
4086
|
-
export { AccountSettings, AccountSettingsClient, type ApiErrorDetail, type ApiErrorObject, type
|
|
4086
|
+
export { AccountSettings, AccountSettingsClient, type ApiErrorDetail, type ApiErrorObject, AuditClient, type AuditEvent, type ListEventsPage as AuditEventListPage, type ListEventsParams as AuditEventListParams, type EventType as AuditEventType, type EventTypeListPage as AuditEventTypeListPage, ForwardersClient as AuditForwardersClient, type ListEventTypesParams as AuditListEventTypesParams, type ListResourceTypesParams as AuditListResourceTypesParams, type Pagination as AuditPagination, type ResourceType as AuditResourceType, type ListResourceTypesPage as AuditResourceTypeListPage, BooleanFlag, Color, Config, ConfigChangeEvent, ConfigClient, ConfigEnvironment, ConfigItem, Context, ContextType, ContextTypesClient, ContextsClient, type CreateEventInput as CreateAuditEventInput, Environment, EnvironmentClassification, EnvironmentsClient, Flag, FlagChangeEvent, FlagDeclaration, FlagEnvironment, FlagRule, FlagStats, FlagValue, FlagsClient, ItemType, JsonFlag, LiveConfigProxy, LogGroup, LogLevel, Logger, LoggerChangeEvent, LoggerEnvironment, LoggerSource, type LoggingAdapter, LoggingClient, ManagementAuditClient, NumberFlag, Op, PinoAdapter, type PinoAdapterConfig, Rule, SharedWebSocket, SmplClient, type SmplClientOptions, SmplConflictError, SmplConnectionError, SmplError, SmplManagementClient, type SmplManagementClientOptions, SmplNotFoundError, SmplPaymentRequiredError, SmplTimeoutError, SmplValidationError, SmplConflictError as SmplkitConflictError, SmplConnectionError as SmplkitConnectionError, SmplError as SmplkitError, SmplNotFoundError as SmplkitNotFoundError, SmplPaymentRequiredError as SmplkitPaymentRequiredError, SmplTimeoutError as SmplkitTimeoutError, SmplValidationError as SmplkitValidationError, StringFlag, WinstonAdapter, type WinstonAdapterConfig };
|
package/dist/index.js
CHANGED
|
@@ -16848,7 +16848,7 @@ var AuditEventBuffer = class {
|
|
|
16848
16848
|
var JSONAPI_CONTENT_TYPE = "application/vnd.api+json";
|
|
16849
16849
|
function _eventBodyFromInput(input) {
|
|
16850
16850
|
const attrs = {
|
|
16851
|
-
|
|
16851
|
+
event_type: input.eventType,
|
|
16852
16852
|
resource_type: input.resourceType,
|
|
16853
16853
|
resource_id: input.resourceId,
|
|
16854
16854
|
do_not_forward: input.doNotForward ?? false
|
|
@@ -16868,7 +16868,7 @@ function _eventFromResource(resource) {
|
|
|
16868
16868
|
const attrs = resource.attributes;
|
|
16869
16869
|
return {
|
|
16870
16870
|
id: resource.id,
|
|
16871
|
-
|
|
16871
|
+
eventType: String(attrs.event_type ?? ""),
|
|
16872
16872
|
resourceType: String(attrs.resource_type ?? ""),
|
|
16873
16873
|
resourceId: String(attrs.resource_id ?? ""),
|
|
16874
16874
|
occurredAt: String(attrs.occurred_at ?? ""),
|
|
@@ -16947,7 +16947,7 @@ var EventsClient = class {
|
|
|
16947
16947
|
}
|
|
16948
16948
|
async list(params = {}) {
|
|
16949
16949
|
const query = {};
|
|
16950
|
-
if (params.
|
|
16950
|
+
if (params.eventType !== void 0) query["filter[event_type]"] = params.eventType;
|
|
16951
16951
|
if (params.resourceType !== void 0) query["filter[resource_type]"] = params.resourceType;
|
|
16952
16952
|
if (params.resourceId !== void 0) query["filter[resource_id]"] = params.resourceId;
|
|
16953
16953
|
if (params.actorType !== void 0) query["filter[actor_type]"] = params.actorType;
|
|
@@ -17018,15 +17018,15 @@ var ResourceTypesClient = class {
|
|
|
17018
17018
|
return { resourceTypes, pagination: _paginationFromBody(body) };
|
|
17019
17019
|
}
|
|
17020
17020
|
};
|
|
17021
|
-
var
|
|
17021
|
+
var EventTypesClient = class {
|
|
17022
17022
|
constructor(_http) {
|
|
17023
17023
|
this._http = _http;
|
|
17024
17024
|
}
|
|
17025
17025
|
/**
|
|
17026
|
-
* List the distinct `
|
|
17026
|
+
* List the distinct `event_type` slugs recorded for this account.
|
|
17027
17027
|
*
|
|
17028
|
-
* Without `filterResourceType`, returns one row per distinct
|
|
17029
|
-
* With `filterResourceType`, returns only the
|
|
17028
|
+
* Without `filterResourceType`, returns one row per distinct event type.
|
|
17029
|
+
* With `filterResourceType`, returns only the event types recorded with
|
|
17030
17030
|
* that resource_type, powering cascading-filter UIs (ADR-047 §2.5).
|
|
17031
17031
|
* Sorted alphabetically; offset pagination via `pageNumber` / `pageSize`.
|
|
17032
17032
|
*/
|
|
@@ -17037,29 +17037,29 @@ var ActionsClient = class {
|
|
|
17037
17037
|
if (params.pageNumber !== void 0) query["page[number]"] = params.pageNumber;
|
|
17038
17038
|
if (params.pageSize !== void 0) query["page[size]"] = params.pageSize;
|
|
17039
17039
|
if (params.metaTotal !== void 0) query["meta[total]"] = params.metaTotal;
|
|
17040
|
-
const result = await this._http.GET("/api/v1/
|
|
17040
|
+
const result = await this._http.GET("/api/v1/event_types", {
|
|
17041
17041
|
params: { query }
|
|
17042
17042
|
});
|
|
17043
17043
|
if (!result.response.ok) await _throwForResponse(result.response);
|
|
17044
17044
|
if (result.data === void 0) throw new SmplError("Unexpected empty response from audit");
|
|
17045
17045
|
const body = result.data;
|
|
17046
|
-
const
|
|
17046
|
+
const eventTypes = (body.data ?? []).map(
|
|
17047
17047
|
(r) => ({
|
|
17048
17048
|
id: r.id,
|
|
17049
17049
|
createdAt: String(r.attributes.created_at ?? "")
|
|
17050
17050
|
})
|
|
17051
17051
|
);
|
|
17052
|
-
return {
|
|
17052
|
+
return { eventTypes, pagination: _paginationFromBody(body) };
|
|
17053
17053
|
}
|
|
17054
17054
|
};
|
|
17055
17055
|
var AuditClient = class {
|
|
17056
17056
|
events;
|
|
17057
17057
|
resourceTypes;
|
|
17058
|
-
|
|
17058
|
+
eventTypes;
|
|
17059
17059
|
constructor(opts) {
|
|
17060
17060
|
this.events = new EventsClient(opts);
|
|
17061
17061
|
this.resourceTypes = new ResourceTypesClient(this.events._http);
|
|
17062
|
-
this.
|
|
17062
|
+
this.eventTypes = new EventTypesClient(this.events._http);
|
|
17063
17063
|
}
|
|
17064
17064
|
/** @internal */
|
|
17065
17065
|
async _close() {
|