@smplkit/sdk 3.0.88 → 3.0.89
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 +188 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +72 -1
- package/dist/index.d.ts +72 -1
- package/dist/index.js +186 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -2043,6 +2043,12 @@ interface ContextTypeModelClient {
|
|
|
2043
2043
|
interface AccountSettingsModelClient {
|
|
2044
2044
|
_save(data: Record<string, any>): Promise<AccountSettings>;
|
|
2045
2045
|
}
|
|
2046
|
+
/** @internal */
|
|
2047
|
+
interface ServiceModelClient {
|
|
2048
|
+
_create(svc: Service): Promise<Service>;
|
|
2049
|
+
_update(svc: Service): Promise<Service>;
|
|
2050
|
+
delete(id: string): Promise<void>;
|
|
2051
|
+
}
|
|
2046
2052
|
/**
|
|
2047
2053
|
* An environment resource managed by the smplkit platform.
|
|
2048
2054
|
*
|
|
@@ -2155,6 +2161,38 @@ declare class AccountSettings {
|
|
|
2155
2161
|
get _rawData(): Record<string, any>;
|
|
2156
2162
|
toString(): string;
|
|
2157
2163
|
}
|
|
2164
|
+
/**
|
|
2165
|
+
* A service resource managed by the smplkit platform — a backend
|
|
2166
|
+
* application or microservice in the customer's stack.
|
|
2167
|
+
*
|
|
2168
|
+
* Mutate fields, then call {@link save} to create or update.
|
|
2169
|
+
*/
|
|
2170
|
+
declare class Service {
|
|
2171
|
+
/** Unique slug identifier (e.g. `"user_service"`). */
|
|
2172
|
+
id: string | null;
|
|
2173
|
+
/** Human-readable display name. */
|
|
2174
|
+
name: string;
|
|
2175
|
+
/** When the service was created. */
|
|
2176
|
+
createdAt: string | null;
|
|
2177
|
+
/** When the service was last updated. */
|
|
2178
|
+
updatedAt: string | null;
|
|
2179
|
+
/** @internal */
|
|
2180
|
+
readonly _client: ServiceModelClient | null;
|
|
2181
|
+
/** @internal */
|
|
2182
|
+
constructor(client: ServiceModelClient | null, fields: {
|
|
2183
|
+
id: string | null;
|
|
2184
|
+
name: string;
|
|
2185
|
+
createdAt?: string | null;
|
|
2186
|
+
updatedAt?: string | null;
|
|
2187
|
+
});
|
|
2188
|
+
/** Persist this service to the server (creates if new, updates if existing). */
|
|
2189
|
+
save(): Promise<void>;
|
|
2190
|
+
/** Delete this service from the server. */
|
|
2191
|
+
delete(): Promise<void>;
|
|
2192
|
+
/** @internal */
|
|
2193
|
+
_apply(other: Service): void;
|
|
2194
|
+
toString(): string;
|
|
2195
|
+
}
|
|
2158
2196
|
|
|
2159
2197
|
/**
|
|
2160
2198
|
* Public types for the Flags SDK: Op, Context, FlagDeclaration, Rule.
|
|
@@ -3457,6 +3495,36 @@ declare class EnvironmentsClient {
|
|
|
3457
3495
|
/** @internal */
|
|
3458
3496
|
_update(env: Environment): Promise<Environment>;
|
|
3459
3497
|
}
|
|
3498
|
+
/** `mgmt.services.*` — CRUD for services. */
|
|
3499
|
+
declare class ServicesClient {
|
|
3500
|
+
private readonly _http;
|
|
3501
|
+
/** @internal */
|
|
3502
|
+
constructor(_http: AppHttp);
|
|
3503
|
+
/**
|
|
3504
|
+
* Construct an unsaved {@link Service}. Call `.save()` to persist.
|
|
3505
|
+
*/
|
|
3506
|
+
new(id: string, options: {
|
|
3507
|
+
name: string;
|
|
3508
|
+
}): Service;
|
|
3509
|
+
/**
|
|
3510
|
+
* List services.
|
|
3511
|
+
*
|
|
3512
|
+
* Server defaults are `pageNumber=1`, `pageSize=1000` (capped at 1000).
|
|
3513
|
+
* Omit both to fetch the first page; pass them through to walk further
|
|
3514
|
+
* pages. The wrapper does not loop on the customer's behalf — the
|
|
3515
|
+
* customer chooses how to paginate.
|
|
3516
|
+
*/
|
|
3517
|
+
list(params?: {
|
|
3518
|
+
pageNumber?: number;
|
|
3519
|
+
pageSize?: number;
|
|
3520
|
+
}): Promise<Service[]>;
|
|
3521
|
+
get(id: string): Promise<Service>;
|
|
3522
|
+
delete(id: string): Promise<void>;
|
|
3523
|
+
/** @internal */
|
|
3524
|
+
_create(svc: Service): Promise<Service>;
|
|
3525
|
+
/** @internal */
|
|
3526
|
+
_update(svc: Service): Promise<Service>;
|
|
3527
|
+
}
|
|
3460
3528
|
/** `mgmt.contextTypes.*` — CRUD for context types. */
|
|
3461
3529
|
declare class ContextTypesClient {
|
|
3462
3530
|
private readonly _http;
|
|
@@ -3598,6 +3666,8 @@ declare class SmplManagementClient {
|
|
|
3598
3666
|
readonly contextTypes: ContextTypesClient;
|
|
3599
3667
|
/** Environment CRUD. */
|
|
3600
3668
|
readonly environments: EnvironmentsClient;
|
|
3669
|
+
/** Service CRUD. */
|
|
3670
|
+
readonly services: ServicesClient;
|
|
3601
3671
|
/** Account-level settings. */
|
|
3602
3672
|
readonly accountSettings: AccountSettingsClient;
|
|
3603
3673
|
/** Config CRUD (singular — matches runtime `client.config`). */
|
|
@@ -3622,6 +3692,7 @@ declare class SmplManagementClient {
|
|
|
3622
3692
|
private _contextsRef;
|
|
3623
3693
|
private _contextTypesRef;
|
|
3624
3694
|
private _environmentsRef;
|
|
3695
|
+
private _servicesRef;
|
|
3625
3696
|
private _accountSettingsRef;
|
|
3626
3697
|
private _configRef;
|
|
3627
3698
|
private _flagsRef;
|
|
@@ -4300,4 +4371,4 @@ declare class SmplPaymentRequiredError extends SmplError {
|
|
|
4300
4371
|
/** @deprecated Use {@link ApiErrorDetail}. */
|
|
4301
4372
|
type ApiErrorObject = ApiErrorDetail;
|
|
4302
4373
|
|
|
4303
|
-
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 };
|
|
4374
|
+
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, Service, ServicesClient, 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
|
@@ -2043,6 +2043,12 @@ interface ContextTypeModelClient {
|
|
|
2043
2043
|
interface AccountSettingsModelClient {
|
|
2044
2044
|
_save(data: Record<string, any>): Promise<AccountSettings>;
|
|
2045
2045
|
}
|
|
2046
|
+
/** @internal */
|
|
2047
|
+
interface ServiceModelClient {
|
|
2048
|
+
_create(svc: Service): Promise<Service>;
|
|
2049
|
+
_update(svc: Service): Promise<Service>;
|
|
2050
|
+
delete(id: string): Promise<void>;
|
|
2051
|
+
}
|
|
2046
2052
|
/**
|
|
2047
2053
|
* An environment resource managed by the smplkit platform.
|
|
2048
2054
|
*
|
|
@@ -2155,6 +2161,38 @@ declare class AccountSettings {
|
|
|
2155
2161
|
get _rawData(): Record<string, any>;
|
|
2156
2162
|
toString(): string;
|
|
2157
2163
|
}
|
|
2164
|
+
/**
|
|
2165
|
+
* A service resource managed by the smplkit platform — a backend
|
|
2166
|
+
* application or microservice in the customer's stack.
|
|
2167
|
+
*
|
|
2168
|
+
* Mutate fields, then call {@link save} to create or update.
|
|
2169
|
+
*/
|
|
2170
|
+
declare class Service {
|
|
2171
|
+
/** Unique slug identifier (e.g. `"user_service"`). */
|
|
2172
|
+
id: string | null;
|
|
2173
|
+
/** Human-readable display name. */
|
|
2174
|
+
name: string;
|
|
2175
|
+
/** When the service was created. */
|
|
2176
|
+
createdAt: string | null;
|
|
2177
|
+
/** When the service was last updated. */
|
|
2178
|
+
updatedAt: string | null;
|
|
2179
|
+
/** @internal */
|
|
2180
|
+
readonly _client: ServiceModelClient | null;
|
|
2181
|
+
/** @internal */
|
|
2182
|
+
constructor(client: ServiceModelClient | null, fields: {
|
|
2183
|
+
id: string | null;
|
|
2184
|
+
name: string;
|
|
2185
|
+
createdAt?: string | null;
|
|
2186
|
+
updatedAt?: string | null;
|
|
2187
|
+
});
|
|
2188
|
+
/** Persist this service to the server (creates if new, updates if existing). */
|
|
2189
|
+
save(): Promise<void>;
|
|
2190
|
+
/** Delete this service from the server. */
|
|
2191
|
+
delete(): Promise<void>;
|
|
2192
|
+
/** @internal */
|
|
2193
|
+
_apply(other: Service): void;
|
|
2194
|
+
toString(): string;
|
|
2195
|
+
}
|
|
2158
2196
|
|
|
2159
2197
|
/**
|
|
2160
2198
|
* Public types for the Flags SDK: Op, Context, FlagDeclaration, Rule.
|
|
@@ -3457,6 +3495,36 @@ declare class EnvironmentsClient {
|
|
|
3457
3495
|
/** @internal */
|
|
3458
3496
|
_update(env: Environment): Promise<Environment>;
|
|
3459
3497
|
}
|
|
3498
|
+
/** `mgmt.services.*` — CRUD for services. */
|
|
3499
|
+
declare class ServicesClient {
|
|
3500
|
+
private readonly _http;
|
|
3501
|
+
/** @internal */
|
|
3502
|
+
constructor(_http: AppHttp);
|
|
3503
|
+
/**
|
|
3504
|
+
* Construct an unsaved {@link Service}. Call `.save()` to persist.
|
|
3505
|
+
*/
|
|
3506
|
+
new(id: string, options: {
|
|
3507
|
+
name: string;
|
|
3508
|
+
}): Service;
|
|
3509
|
+
/**
|
|
3510
|
+
* List services.
|
|
3511
|
+
*
|
|
3512
|
+
* Server defaults are `pageNumber=1`, `pageSize=1000` (capped at 1000).
|
|
3513
|
+
* Omit both to fetch the first page; pass them through to walk further
|
|
3514
|
+
* pages. The wrapper does not loop on the customer's behalf — the
|
|
3515
|
+
* customer chooses how to paginate.
|
|
3516
|
+
*/
|
|
3517
|
+
list(params?: {
|
|
3518
|
+
pageNumber?: number;
|
|
3519
|
+
pageSize?: number;
|
|
3520
|
+
}): Promise<Service[]>;
|
|
3521
|
+
get(id: string): Promise<Service>;
|
|
3522
|
+
delete(id: string): Promise<void>;
|
|
3523
|
+
/** @internal */
|
|
3524
|
+
_create(svc: Service): Promise<Service>;
|
|
3525
|
+
/** @internal */
|
|
3526
|
+
_update(svc: Service): Promise<Service>;
|
|
3527
|
+
}
|
|
3460
3528
|
/** `mgmt.contextTypes.*` — CRUD for context types. */
|
|
3461
3529
|
declare class ContextTypesClient {
|
|
3462
3530
|
private readonly _http;
|
|
@@ -3598,6 +3666,8 @@ declare class SmplManagementClient {
|
|
|
3598
3666
|
readonly contextTypes: ContextTypesClient;
|
|
3599
3667
|
/** Environment CRUD. */
|
|
3600
3668
|
readonly environments: EnvironmentsClient;
|
|
3669
|
+
/** Service CRUD. */
|
|
3670
|
+
readonly services: ServicesClient;
|
|
3601
3671
|
/** Account-level settings. */
|
|
3602
3672
|
readonly accountSettings: AccountSettingsClient;
|
|
3603
3673
|
/** Config CRUD (singular — matches runtime `client.config`). */
|
|
@@ -3622,6 +3692,7 @@ declare class SmplManagementClient {
|
|
|
3622
3692
|
private _contextsRef;
|
|
3623
3693
|
private _contextTypesRef;
|
|
3624
3694
|
private _environmentsRef;
|
|
3695
|
+
private _servicesRef;
|
|
3625
3696
|
private _accountSettingsRef;
|
|
3626
3697
|
private _configRef;
|
|
3627
3698
|
private _flagsRef;
|
|
@@ -4300,4 +4371,4 @@ declare class SmplPaymentRequiredError extends SmplError {
|
|
|
4300
4371
|
/** @deprecated Use {@link ApiErrorDetail}. */
|
|
4301
4372
|
type ApiErrorObject = ApiErrorDetail;
|
|
4302
4373
|
|
|
4303
|
-
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 };
|
|
4374
|
+
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, Service, ServicesClient, 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
|
@@ -18671,6 +18671,56 @@ var AccountSettings = class {
|
|
|
18671
18671
|
return `AccountSettings(${JSON.stringify(this._data)})`;
|
|
18672
18672
|
}
|
|
18673
18673
|
};
|
|
18674
|
+
var Service = class {
|
|
18675
|
+
/** Unique slug identifier (e.g. `"user_service"`). */
|
|
18676
|
+
id;
|
|
18677
|
+
/** Human-readable display name. */
|
|
18678
|
+
name;
|
|
18679
|
+
/** When the service was created. */
|
|
18680
|
+
createdAt;
|
|
18681
|
+
/** When the service was last updated. */
|
|
18682
|
+
updatedAt;
|
|
18683
|
+
/** @internal */
|
|
18684
|
+
_client;
|
|
18685
|
+
/** @internal */
|
|
18686
|
+
constructor(client, fields) {
|
|
18687
|
+
this._client = client;
|
|
18688
|
+
this.id = fields.id;
|
|
18689
|
+
this.name = fields.name;
|
|
18690
|
+
this.createdAt = fields.createdAt ?? null;
|
|
18691
|
+
this.updatedAt = fields.updatedAt ?? null;
|
|
18692
|
+
}
|
|
18693
|
+
/** Persist this service to the server (creates if new, updates if existing). */
|
|
18694
|
+
async save() {
|
|
18695
|
+
if (this._client === null) {
|
|
18696
|
+
throw new Error("Service was constructed without a client; cannot save");
|
|
18697
|
+
}
|
|
18698
|
+
if (this.createdAt === null) {
|
|
18699
|
+
const saved = await this._client._create(this);
|
|
18700
|
+
this._apply(saved);
|
|
18701
|
+
} else {
|
|
18702
|
+
const saved = await this._client._update(this);
|
|
18703
|
+
this._apply(saved);
|
|
18704
|
+
}
|
|
18705
|
+
}
|
|
18706
|
+
/** Delete this service from the server. */
|
|
18707
|
+
async delete() {
|
|
18708
|
+
if (this._client === null || this.id === null) {
|
|
18709
|
+
throw new Error("Service was constructed without a client or id; cannot delete");
|
|
18710
|
+
}
|
|
18711
|
+
await this._client.delete(this.id);
|
|
18712
|
+
}
|
|
18713
|
+
/** @internal */
|
|
18714
|
+
_apply(other) {
|
|
18715
|
+
this.id = other.id;
|
|
18716
|
+
this.name = other.name;
|
|
18717
|
+
this.createdAt = other.createdAt;
|
|
18718
|
+
this.updatedAt = other.updatedAt;
|
|
18719
|
+
}
|
|
18720
|
+
toString() {
|
|
18721
|
+
return `Service(id=${this.id}, name=${this.name})`;
|
|
18722
|
+
}
|
|
18723
|
+
};
|
|
18674
18724
|
|
|
18675
18725
|
// src/flags/types.ts
|
|
18676
18726
|
var Op = /* @__PURE__ */ ((Op2) => {
|
|
@@ -20759,6 +20809,15 @@ function envFromResource(resource, client) {
|
|
|
20759
20809
|
updatedAt: attrs.updated_at ?? null
|
|
20760
20810
|
});
|
|
20761
20811
|
}
|
|
20812
|
+
function svcFromResource(resource, client) {
|
|
20813
|
+
const attrs = resource.attributes ?? {};
|
|
20814
|
+
return new Service(client, {
|
|
20815
|
+
id: resource.id ?? null,
|
|
20816
|
+
name: attrs.name ?? "",
|
|
20817
|
+
createdAt: attrs.created_at ?? null,
|
|
20818
|
+
updatedAt: attrs.updated_at ?? null
|
|
20819
|
+
});
|
|
20820
|
+
}
|
|
20762
20821
|
function ctFromResource(resource, client) {
|
|
20763
20822
|
const attrs = resource.attributes ?? {};
|
|
20764
20823
|
const rawMeta = attrs.attributes;
|
|
@@ -20921,6 +20980,126 @@ var EnvironmentsClient = class {
|
|
|
20921
20980
|
return envFromResource(data.data, this);
|
|
20922
20981
|
}
|
|
20923
20982
|
};
|
|
20983
|
+
var ServicesClient = class {
|
|
20984
|
+
/** @internal */
|
|
20985
|
+
constructor(_http) {
|
|
20986
|
+
this._http = _http;
|
|
20987
|
+
}
|
|
20988
|
+
/**
|
|
20989
|
+
* Construct an unsaved {@link Service}. Call `.save()` to persist.
|
|
20990
|
+
*/
|
|
20991
|
+
new(id, options) {
|
|
20992
|
+
return new Service(this, {
|
|
20993
|
+
id,
|
|
20994
|
+
name: options.name,
|
|
20995
|
+
createdAt: null,
|
|
20996
|
+
updatedAt: null
|
|
20997
|
+
});
|
|
20998
|
+
}
|
|
20999
|
+
/**
|
|
21000
|
+
* List services.
|
|
21001
|
+
*
|
|
21002
|
+
* Server defaults are `pageNumber=1`, `pageSize=1000` (capped at 1000).
|
|
21003
|
+
* Omit both to fetch the first page; pass them through to walk further
|
|
21004
|
+
* pages. The wrapper does not loop on the customer's behalf — the
|
|
21005
|
+
* customer chooses how to paginate.
|
|
21006
|
+
*/
|
|
21007
|
+
async list(params = {}) {
|
|
21008
|
+
const query = {};
|
|
21009
|
+
if (params.pageNumber !== void 0) query["page[number]"] = params.pageNumber;
|
|
21010
|
+
if (params.pageSize !== void 0) query["page[size]"] = params.pageSize;
|
|
21011
|
+
let data;
|
|
21012
|
+
try {
|
|
21013
|
+
const result = await this._http.GET("/api/v1/services", {
|
|
21014
|
+
params: { query }
|
|
21015
|
+
});
|
|
21016
|
+
if (!result.response.ok) await checkError5(result.response, result.error);
|
|
21017
|
+
data = result.data;
|
|
21018
|
+
} catch (err) {
|
|
21019
|
+
wrapFetchError5(err);
|
|
21020
|
+
}
|
|
21021
|
+
const items = data?.data ?? [];
|
|
21022
|
+
return items.map((r) => svcFromResource(r, this));
|
|
21023
|
+
}
|
|
21024
|
+
async get(id) {
|
|
21025
|
+
let data;
|
|
21026
|
+
try {
|
|
21027
|
+
const result = await this._http.GET("/api/v1/services/{id}", {
|
|
21028
|
+
params: { path: { id } }
|
|
21029
|
+
});
|
|
21030
|
+
if (!result.response.ok) await checkError5(result.response, result.error);
|
|
21031
|
+
data = result.data;
|
|
21032
|
+
} catch (err) {
|
|
21033
|
+
wrapFetchError5(err);
|
|
21034
|
+
}
|
|
21035
|
+
if (!data?.data)
|
|
21036
|
+
throw new SmplNotFoundError(`Service with id ${JSON.stringify(id)} not found`);
|
|
21037
|
+
return svcFromResource(data.data, this);
|
|
21038
|
+
}
|
|
21039
|
+
async delete(id) {
|
|
21040
|
+
try {
|
|
21041
|
+
const result = await this._http.DELETE("/api/v1/services/{id}", {
|
|
21042
|
+
params: { path: { id } }
|
|
21043
|
+
});
|
|
21044
|
+
if (!result.response.ok && result.response.status !== 204) {
|
|
21045
|
+
await checkError5(result.response, result.error);
|
|
21046
|
+
}
|
|
21047
|
+
} catch (err) {
|
|
21048
|
+
wrapFetchError5(err);
|
|
21049
|
+
}
|
|
21050
|
+
}
|
|
21051
|
+
/** @internal */
|
|
21052
|
+
async _create(svc) {
|
|
21053
|
+
if (svc.id === null) {
|
|
21054
|
+
throw new SmplValidationError("Cannot create a Service without an id");
|
|
21055
|
+
}
|
|
21056
|
+
const body = {
|
|
21057
|
+
data: {
|
|
21058
|
+
id: svc.id,
|
|
21059
|
+
type: "service",
|
|
21060
|
+
attributes: {
|
|
21061
|
+
name: svc.name
|
|
21062
|
+
}
|
|
21063
|
+
}
|
|
21064
|
+
};
|
|
21065
|
+
let data;
|
|
21066
|
+
try {
|
|
21067
|
+
const result = await this._http.POST("/api/v1/services", { body });
|
|
21068
|
+
if (!result.response.ok) await checkError5(result.response, result.error);
|
|
21069
|
+
data = result.data;
|
|
21070
|
+
} catch (err) {
|
|
21071
|
+
wrapFetchError5(err);
|
|
21072
|
+
}
|
|
21073
|
+
if (!data?.data) throw new SmplValidationError("Failed to create service");
|
|
21074
|
+
return svcFromResource(data.data, this);
|
|
21075
|
+
}
|
|
21076
|
+
/** @internal */
|
|
21077
|
+
async _update(svc) {
|
|
21078
|
+
if (!svc.id) throw new Error("Cannot update a Service with no id");
|
|
21079
|
+
const body = {
|
|
21080
|
+
data: {
|
|
21081
|
+
id: svc.id,
|
|
21082
|
+
type: "service",
|
|
21083
|
+
attributes: {
|
|
21084
|
+
name: svc.name
|
|
21085
|
+
}
|
|
21086
|
+
}
|
|
21087
|
+
};
|
|
21088
|
+
let data;
|
|
21089
|
+
try {
|
|
21090
|
+
const result = await this._http.PUT("/api/v1/services/{id}", {
|
|
21091
|
+
params: { path: { id: svc.id } },
|
|
21092
|
+
body
|
|
21093
|
+
});
|
|
21094
|
+
if (!result.response.ok) await checkError5(result.response, result.error);
|
|
21095
|
+
data = result.data;
|
|
21096
|
+
} catch (err) {
|
|
21097
|
+
wrapFetchError5(err);
|
|
21098
|
+
}
|
|
21099
|
+
if (!data?.data) throw new SmplValidationError(`Failed to update service ${svc.id}`);
|
|
21100
|
+
return svcFromResource(data.data, this);
|
|
21101
|
+
}
|
|
21102
|
+
};
|
|
20924
21103
|
var ContextTypesClient = class {
|
|
20925
21104
|
/** @internal */
|
|
20926
21105
|
constructor(_http) {
|
|
@@ -21271,6 +21450,8 @@ var SmplManagementClient = class {
|
|
|
21271
21450
|
contextTypes;
|
|
21272
21451
|
/** Environment CRUD. */
|
|
21273
21452
|
environments;
|
|
21453
|
+
/** Service CRUD. */
|
|
21454
|
+
services;
|
|
21274
21455
|
/** Account-level settings. */
|
|
21275
21456
|
accountSettings;
|
|
21276
21457
|
/** Config CRUD (singular — matches runtime `client.config`). */
|
|
@@ -21297,6 +21478,7 @@ var SmplManagementClient = class {
|
|
|
21297
21478
|
this.contexts = this._contextsRef;
|
|
21298
21479
|
this.contextTypes = this._contextTypesRef;
|
|
21299
21480
|
this.environments = this._environmentsRef;
|
|
21481
|
+
this.services = this._servicesRef;
|
|
21300
21482
|
this.accountSettings = this._accountSettingsRef;
|
|
21301
21483
|
this.config = this._configRef;
|
|
21302
21484
|
this.flags = this._flagsRef;
|
|
@@ -21313,6 +21495,7 @@ var SmplManagementClient = class {
|
|
|
21313
21495
|
_contextsRef;
|
|
21314
21496
|
_contextTypesRef;
|
|
21315
21497
|
_environmentsRef;
|
|
21498
|
+
_servicesRef;
|
|
21316
21499
|
_accountSettingsRef;
|
|
21317
21500
|
_configRef;
|
|
21318
21501
|
_flagsRef;
|
|
@@ -21361,6 +21544,7 @@ var SmplManagementClient = class {
|
|
|
21361
21544
|
});
|
|
21362
21545
|
this._sharedContextBuffer = new ContextRegistrationBuffer();
|
|
21363
21546
|
this._environmentsRef = new EnvironmentsClient(this._appHttpRef);
|
|
21547
|
+
this._servicesRef = new ServicesClient(this._appHttpRef);
|
|
21364
21548
|
this._contextTypesRef = new ContextTypesClient(this._appHttpRef);
|
|
21365
21549
|
this._contextsRef = new ContextsClient(this._appHttpRef, this._sharedContextBuffer);
|
|
21366
21550
|
this._accountSettingsRef = new AccountSettingsClient(appBaseUrl, cfg.apiKey);
|
|
@@ -23799,6 +23983,8 @@ export {
|
|
|
23799
23983
|
Op,
|
|
23800
23984
|
PinoAdapter,
|
|
23801
23985
|
Rule,
|
|
23986
|
+
Service,
|
|
23987
|
+
ServicesClient,
|
|
23802
23988
|
SharedWebSocket,
|
|
23803
23989
|
SmplClient,
|
|
23804
23990
|
SmplConflictError,
|