@smplkit/sdk 3.0.4 → 3.0.6
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 +41 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -3
- package/dist/index.d.ts +11 -3
- package/dist/index.js +41 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1992,7 +1992,8 @@ interface LoggerModelClient {
|
|
|
1992
1992
|
}
|
|
1993
1993
|
/** @internal */
|
|
1994
1994
|
interface LogGroupModelClient {
|
|
1995
|
-
|
|
1995
|
+
_createGroup?: (group: LogGroup) => Promise<LogGroup>;
|
|
1996
|
+
_updateGroup?: (group: LogGroup) => Promise<LogGroup>;
|
|
1996
1997
|
_deleteGroup?: (id: string) => Promise<void>;
|
|
1997
1998
|
}
|
|
1998
1999
|
/**
|
|
@@ -2180,8 +2181,15 @@ declare class LogGroupsClient {
|
|
|
2180
2181
|
delete(id: string): Promise<void>;
|
|
2181
2182
|
/** @internal — called by `LogGroup.delete()`. */
|
|
2182
2183
|
_deleteGroup(id: string): Promise<void>;
|
|
2183
|
-
/**
|
|
2184
|
-
|
|
2184
|
+
/**
|
|
2185
|
+
* @internal — called by `LogGroup.save()` for new groups.
|
|
2186
|
+
* POST /api/v1/log_groups creates a new log group. The {id} PUT endpoint
|
|
2187
|
+
* is update-only on the server and returns 404 for non-existent ids,
|
|
2188
|
+
* so create and update have to dispatch to different endpoints.
|
|
2189
|
+
*/
|
|
2190
|
+
_createGroup(group: LogGroup): Promise<LogGroup>;
|
|
2191
|
+
/** @internal — called by `LogGroup.save()` for existing groups. */
|
|
2192
|
+
_updateGroup(group: LogGroup): Promise<LogGroup>;
|
|
2185
2193
|
}
|
|
2186
2194
|
|
|
2187
2195
|
type AppHttp = ReturnType<typeof createClient<___generated_app_d_ts.paths>>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1992,7 +1992,8 @@ interface LoggerModelClient {
|
|
|
1992
1992
|
}
|
|
1993
1993
|
/** @internal */
|
|
1994
1994
|
interface LogGroupModelClient {
|
|
1995
|
-
|
|
1995
|
+
_createGroup?: (group: LogGroup) => Promise<LogGroup>;
|
|
1996
|
+
_updateGroup?: (group: LogGroup) => Promise<LogGroup>;
|
|
1996
1997
|
_deleteGroup?: (id: string) => Promise<void>;
|
|
1997
1998
|
}
|
|
1998
1999
|
/**
|
|
@@ -2180,8 +2181,15 @@ declare class LogGroupsClient {
|
|
|
2180
2181
|
delete(id: string): Promise<void>;
|
|
2181
2182
|
/** @internal — called by `LogGroup.delete()`. */
|
|
2182
2183
|
_deleteGroup(id: string): Promise<void>;
|
|
2183
|
-
/**
|
|
2184
|
-
|
|
2184
|
+
/**
|
|
2185
|
+
* @internal — called by `LogGroup.save()` for new groups.
|
|
2186
|
+
* POST /api/v1/log_groups creates a new log group. The {id} PUT endpoint
|
|
2187
|
+
* is update-only on the server and returns 404 for non-existent ids,
|
|
2188
|
+
* so create and update have to dispatch to different endpoints.
|
|
2189
|
+
*/
|
|
2190
|
+
_createGroup(group: LogGroup): Promise<LogGroup>;
|
|
2191
|
+
/** @internal — called by `LogGroup.save()` for existing groups. */
|
|
2192
|
+
_updateGroup(group: LogGroup): Promise<LogGroup>;
|
|
2185
2193
|
}
|
|
2186
2194
|
|
|
2187
2195
|
type AppHttp = ReturnType<typeof createClient<___generated_app_d_ts.paths>>;
|
package/dist/index.js
CHANGED
|
@@ -19037,13 +19037,23 @@ var LogGroup = class {
|
|
|
19037
19037
|
if (this._client === null) {
|
|
19038
19038
|
throw new Error("LogGroup was constructed without a client; cannot save");
|
|
19039
19039
|
}
|
|
19040
|
-
if (
|
|
19041
|
-
|
|
19042
|
-
|
|
19043
|
-
|
|
19040
|
+
if (this.createdAt === null) {
|
|
19041
|
+
if (!this._client._createGroup) {
|
|
19042
|
+
throw new Error(
|
|
19043
|
+
"LogGroup models obtained from the runtime LoggingClient cannot be saved. Use mgmt.logGroups.new(...) (or client.manage.logGroups.*) to author groups."
|
|
19044
|
+
);
|
|
19045
|
+
}
|
|
19046
|
+
const created = await this._client._createGroup(this);
|
|
19047
|
+
this._apply(created);
|
|
19048
|
+
} else {
|
|
19049
|
+
if (!this._client._updateGroup) {
|
|
19050
|
+
throw new Error(
|
|
19051
|
+
"LogGroup models obtained from the runtime LoggingClient cannot be saved. Use mgmt.logGroups.new(...) (or client.manage.logGroups.*) to author groups."
|
|
19052
|
+
);
|
|
19053
|
+
}
|
|
19054
|
+
const updated = await this._client._updateGroup(this);
|
|
19055
|
+
this._apply(updated);
|
|
19044
19056
|
}
|
|
19045
|
-
const saved = await this._client._saveGroup(this);
|
|
19046
|
-
this._apply(saved);
|
|
19047
19057
|
}
|
|
19048
19058
|
async delete() {
|
|
19049
19059
|
if (this._client === null || this.id === null) {
|
|
@@ -19359,9 +19369,28 @@ var LogGroupsClient = class {
|
|
|
19359
19369
|
wrapFetchError3(err);
|
|
19360
19370
|
}
|
|
19361
19371
|
}
|
|
19362
|
-
/**
|
|
19363
|
-
|
|
19364
|
-
|
|
19372
|
+
/**
|
|
19373
|
+
* @internal — called by `LogGroup.save()` for new groups.
|
|
19374
|
+
* POST /api/v1/log_groups creates a new log group. The {id} PUT endpoint
|
|
19375
|
+
* is update-only on the server and returns 404 for non-existent ids,
|
|
19376
|
+
* so create and update have to dispatch to different endpoints.
|
|
19377
|
+
*/
|
|
19378
|
+
async _createGroup(group) {
|
|
19379
|
+
const body = groupToBody(group);
|
|
19380
|
+
let data;
|
|
19381
|
+
try {
|
|
19382
|
+
const result = await this._http.POST("/api/v1/log_groups", { body });
|
|
19383
|
+
if (!result.response.ok) await checkError3(result.response);
|
|
19384
|
+
data = result.data;
|
|
19385
|
+
} catch (err) {
|
|
19386
|
+
wrapFetchError3(err);
|
|
19387
|
+
}
|
|
19388
|
+
if (!data || !data.data) throw new SmplValidationError("Failed to create log group");
|
|
19389
|
+
return resourceToLogGroup(data.data, this);
|
|
19390
|
+
}
|
|
19391
|
+
/** @internal — called by `LogGroup.save()` for existing groups. */
|
|
19392
|
+
async _updateGroup(group) {
|
|
19393
|
+
if (group.id === null) throw new Error("Cannot update a LogGroup with no id");
|
|
19365
19394
|
const body = groupToBody(group);
|
|
19366
19395
|
let data;
|
|
19367
19396
|
try {
|
|
@@ -19374,7 +19403,9 @@ var LogGroupsClient = class {
|
|
|
19374
19403
|
} catch (err) {
|
|
19375
19404
|
wrapFetchError3(err);
|
|
19376
19405
|
}
|
|
19377
|
-
if (!data || !data.data)
|
|
19406
|
+
if (!data || !data.data) {
|
|
19407
|
+
throw new SmplValidationError(`Failed to update log group ${group.id}`);
|
|
19408
|
+
}
|
|
19378
19409
|
return resourceToLogGroup(data.data, this);
|
|
19379
19410
|
}
|
|
19380
19411
|
};
|