@smplkit/sdk 3.0.86 → 3.0.87

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.d.cts CHANGED
@@ -727,6 +727,46 @@ interface components$1 {
727
727
  */
728
728
  readonly updated_at?: string | null;
729
729
  };
730
+ /**
731
+ * LogGroupCreateRequest
732
+ * @description JSON:API request envelope for creating a log group.
733
+ *
734
+ * Distinct from :class:`LogGroupRequest` because create requires
735
+ * caller-supplied ``data.id`` while update does not.
736
+ */
737
+ LogGroupCreateRequest: {
738
+ data: components$1["schemas"]["LogGroupCreateResource"];
739
+ };
740
+ /**
741
+ * LogGroupCreateResource
742
+ * @description JSON:API resource envelope for creating a log group (id required).
743
+ * @example {
744
+ * "attributes": {
745
+ * "environments": {
746
+ * "prod": {
747
+ * "level": "ERROR"
748
+ * }
749
+ * },
750
+ * "level": "WARN",
751
+ * "name": "Payment pipeline"
752
+ * },
753
+ * "id": "payment-pipeline",
754
+ * "type": "log_group"
755
+ * }
756
+ */
757
+ LogGroupCreateResource: {
758
+ /**
759
+ * Id
760
+ * @description Client-supplied resource id.
761
+ */
762
+ id: string;
763
+ /**
764
+ * Type
765
+ * @constant
766
+ */
767
+ type: "log_group";
768
+ attributes: components$1["schemas"]["LogGroup"];
769
+ };
730
770
  /**
731
771
  * LogGroupListResponse
732
772
  * @description JSON:API collection response for log groups.
@@ -738,7 +778,7 @@ interface components$1 {
738
778
  };
739
779
  /**
740
780
  * LogGroupRequest
741
- * @description JSON:API request envelope for creating or updating a log group.
781
+ * @description JSON:API request envelope for updating a log group.
742
782
  */
743
783
  LogGroupRequest: {
744
784
  data: components$1["schemas"]["LogGroupResource"];
@@ -1450,6 +1490,43 @@ interface components {
1450
1490
  */
1451
1491
  registered: number;
1452
1492
  };
1493
+ /**
1494
+ * FlagCreateRequest
1495
+ * @description JSON:API request envelope for creating a flag.
1496
+ *
1497
+ * Distinct from :class:`FlagRequest` because create requires
1498
+ * caller-supplied ``data.id`` while update does not.
1499
+ */
1500
+ FlagCreateRequest: {
1501
+ data: components["schemas"]["FlagCreateResource"];
1502
+ };
1503
+ /**
1504
+ * FlagCreateResource
1505
+ * @description JSON:API resource envelope for creating a flag (id required).
1506
+ * @example {
1507
+ * "attributes": {
1508
+ * "default": false,
1509
+ * "description": "Enable the redesigned checkout flow.",
1510
+ * "name": "Checkout V2",
1511
+ * "type": "BOOLEAN"
1512
+ * },
1513
+ * "id": "checkout-v2",
1514
+ * "type": "flag"
1515
+ * }
1516
+ */
1517
+ FlagCreateResource: {
1518
+ /**
1519
+ * Id
1520
+ * @description Client-supplied resource id.
1521
+ */
1522
+ id: string;
1523
+ /**
1524
+ * Type
1525
+ * @constant
1526
+ */
1527
+ type: "flag";
1528
+ attributes: components["schemas"]["Flag"];
1529
+ };
1453
1530
  /**
1454
1531
  * FlagEnvironment
1455
1532
  * @description Per-environment evaluation configuration for a flag.
@@ -1483,7 +1560,7 @@ interface components {
1483
1560
  };
1484
1561
  /**
1485
1562
  * FlagRequest
1486
- * @description JSON:API request envelope for creating or updating a flag.
1563
+ * @description JSON:API request envelope for updating a flag.
1487
1564
  */
1488
1565
  FlagRequest: {
1489
1566
  data: components["schemas"]["FlagResource"];
@@ -3262,6 +3339,11 @@ declare class ForwardersClient implements ForwarderModelClient {
3262
3339
  * Construct an unsaved {@link Forwarder}. Call {@link Forwarder.save}
3263
3340
  * to persist.
3264
3341
  *
3342
+ * @param key Caller-supplied stable identifier for the
3343
+ * forwarder. Becomes the resource's `id`
3344
+ * and is the unique key used by the audit
3345
+ * service to address it on subsequent
3346
+ * GET / PUT / DELETE calls.
3265
3347
  * @param fields.name Display name. Free-form.
3266
3348
  * @param fields.forwarderType Destination type — see {@link ForwarderType}.
3267
3349
  * @param fields.configuration Destination HTTP request configuration.
@@ -3284,7 +3366,7 @@ declare class ForwardersClient implements ForwarderModelClient {
3284
3366
  * expression. Must be supplied together
3285
3367
  * with `transformType` (both or neither).
3286
3368
  */
3287
- new(fields: {
3369
+ new(key: string, fields: {
3288
3370
  name: string;
3289
3371
  forwarderType: ForwarderType;
3290
3372
  configuration: HttpConfiguration;
@@ -3314,6 +3396,10 @@ declare class ForwardersClient implements ForwarderModelClient {
3314
3396
  delete(forwarderId: string): Promise<void>;
3315
3397
  /**
3316
3398
  * @internal Called by `Forwarder.save()` on unsaved instances.
3399
+ *
3400
+ * The audit service requires a caller-supplied `data.id` on create —
3401
+ * the forwarder's stable key, propagated from
3402
+ * `mgmt.audit.forwarders.new(key, ...)`.
3317
3403
  */
3318
3404
  _createForwarder(forwarder: Forwarder): Promise<Forwarder>;
3319
3405
  /**
package/dist/index.d.ts CHANGED
@@ -727,6 +727,46 @@ interface components$1 {
727
727
  */
728
728
  readonly updated_at?: string | null;
729
729
  };
730
+ /**
731
+ * LogGroupCreateRequest
732
+ * @description JSON:API request envelope for creating a log group.
733
+ *
734
+ * Distinct from :class:`LogGroupRequest` because create requires
735
+ * caller-supplied ``data.id`` while update does not.
736
+ */
737
+ LogGroupCreateRequest: {
738
+ data: components$1["schemas"]["LogGroupCreateResource"];
739
+ };
740
+ /**
741
+ * LogGroupCreateResource
742
+ * @description JSON:API resource envelope for creating a log group (id required).
743
+ * @example {
744
+ * "attributes": {
745
+ * "environments": {
746
+ * "prod": {
747
+ * "level": "ERROR"
748
+ * }
749
+ * },
750
+ * "level": "WARN",
751
+ * "name": "Payment pipeline"
752
+ * },
753
+ * "id": "payment-pipeline",
754
+ * "type": "log_group"
755
+ * }
756
+ */
757
+ LogGroupCreateResource: {
758
+ /**
759
+ * Id
760
+ * @description Client-supplied resource id.
761
+ */
762
+ id: string;
763
+ /**
764
+ * Type
765
+ * @constant
766
+ */
767
+ type: "log_group";
768
+ attributes: components$1["schemas"]["LogGroup"];
769
+ };
730
770
  /**
731
771
  * LogGroupListResponse
732
772
  * @description JSON:API collection response for log groups.
@@ -738,7 +778,7 @@ interface components$1 {
738
778
  };
739
779
  /**
740
780
  * LogGroupRequest
741
- * @description JSON:API request envelope for creating or updating a log group.
781
+ * @description JSON:API request envelope for updating a log group.
742
782
  */
743
783
  LogGroupRequest: {
744
784
  data: components$1["schemas"]["LogGroupResource"];
@@ -1450,6 +1490,43 @@ interface components {
1450
1490
  */
1451
1491
  registered: number;
1452
1492
  };
1493
+ /**
1494
+ * FlagCreateRequest
1495
+ * @description JSON:API request envelope for creating a flag.
1496
+ *
1497
+ * Distinct from :class:`FlagRequest` because create requires
1498
+ * caller-supplied ``data.id`` while update does not.
1499
+ */
1500
+ FlagCreateRequest: {
1501
+ data: components["schemas"]["FlagCreateResource"];
1502
+ };
1503
+ /**
1504
+ * FlagCreateResource
1505
+ * @description JSON:API resource envelope for creating a flag (id required).
1506
+ * @example {
1507
+ * "attributes": {
1508
+ * "default": false,
1509
+ * "description": "Enable the redesigned checkout flow.",
1510
+ * "name": "Checkout V2",
1511
+ * "type": "BOOLEAN"
1512
+ * },
1513
+ * "id": "checkout-v2",
1514
+ * "type": "flag"
1515
+ * }
1516
+ */
1517
+ FlagCreateResource: {
1518
+ /**
1519
+ * Id
1520
+ * @description Client-supplied resource id.
1521
+ */
1522
+ id: string;
1523
+ /**
1524
+ * Type
1525
+ * @constant
1526
+ */
1527
+ type: "flag";
1528
+ attributes: components["schemas"]["Flag"];
1529
+ };
1453
1530
  /**
1454
1531
  * FlagEnvironment
1455
1532
  * @description Per-environment evaluation configuration for a flag.
@@ -1483,7 +1560,7 @@ interface components {
1483
1560
  };
1484
1561
  /**
1485
1562
  * FlagRequest
1486
- * @description JSON:API request envelope for creating or updating a flag.
1563
+ * @description JSON:API request envelope for updating a flag.
1487
1564
  */
1488
1565
  FlagRequest: {
1489
1566
  data: components["schemas"]["FlagResource"];
@@ -3262,6 +3339,11 @@ declare class ForwardersClient implements ForwarderModelClient {
3262
3339
  * Construct an unsaved {@link Forwarder}. Call {@link Forwarder.save}
3263
3340
  * to persist.
3264
3341
  *
3342
+ * @param key Caller-supplied stable identifier for the
3343
+ * forwarder. Becomes the resource's `id`
3344
+ * and is the unique key used by the audit
3345
+ * service to address it on subsequent
3346
+ * GET / PUT / DELETE calls.
3265
3347
  * @param fields.name Display name. Free-form.
3266
3348
  * @param fields.forwarderType Destination type — see {@link ForwarderType}.
3267
3349
  * @param fields.configuration Destination HTTP request configuration.
@@ -3284,7 +3366,7 @@ declare class ForwardersClient implements ForwarderModelClient {
3284
3366
  * expression. Must be supplied together
3285
3367
  * with `transformType` (both or neither).
3286
3368
  */
3287
- new(fields: {
3369
+ new(key: string, fields: {
3288
3370
  name: string;
3289
3371
  forwarderType: ForwarderType;
3290
3372
  configuration: HttpConfiguration;
@@ -3314,6 +3396,10 @@ declare class ForwardersClient implements ForwarderModelClient {
3314
3396
  delete(forwarderId: string): Promise<void>;
3315
3397
  /**
3316
3398
  * @internal Called by `Forwarder.save()` on unsaved instances.
3399
+ *
3400
+ * The audit service requires a caller-supplied `data.id` on create —
3401
+ * the forwarder's stable key, propagated from
3402
+ * `mgmt.audit.forwarders.new(key, ...)`.
3317
3403
  */
3318
3404
  _createForwarder(forwarder: Forwarder): Promise<Forwarder>;
3319
3405
  /**
package/dist/index.js CHANGED
@@ -18899,17 +18899,32 @@ async function checkError(response, error) {
18899
18899
  }
18900
18900
  throwForStatus(response.status, body);
18901
18901
  }
18902
- function buildBody(config) {
18902
+ function buildAttrs(config) {
18903
18903
  const attrs = { name: config.name };
18904
18904
  if (config.description !== null) attrs.description = config.description;
18905
18905
  if (config.parent !== null) attrs.parent = config.parent;
18906
18906
  attrs.items = config._itemsRawDirect;
18907
18907
  attrs.environments = environmentsToWire(config._environmentsDirect);
18908
+ return attrs;
18909
+ }
18910
+ function buildCreateBody(config) {
18911
+ if (config.id === null) {
18912
+ throw new SmplValidationError("Cannot create a Config without an id");
18913
+ }
18914
+ return {
18915
+ data: {
18916
+ id: config.id,
18917
+ type: "config",
18918
+ attributes: buildAttrs(config)
18919
+ }
18920
+ };
18921
+ }
18922
+ function buildUpdateBody(config) {
18908
18923
  return {
18909
18924
  data: {
18910
18925
  id: config.id ?? null,
18911
18926
  type: "config",
18912
- attributes: attrs
18927
+ attributes: buildAttrs(config)
18913
18928
  }
18914
18929
  };
18915
18930
  }
@@ -19099,7 +19114,7 @@ var ManagementConfigClient = class {
19099
19114
  }
19100
19115
  /** @internal — called by `Config.save()` for new resources. */
19101
19116
  async _createConfig(config) {
19102
- const body = buildBody(config);
19117
+ const body = buildCreateBody(config);
19103
19118
  let data;
19104
19119
  try {
19105
19120
  const result = await this._http.POST("/api/v1/configs", { body });
@@ -19114,7 +19129,7 @@ var ManagementConfigClient = class {
19114
19129
  /** @internal — called by `Config.save()` for existing resources. */
19115
19130
  async _updateConfig(config) {
19116
19131
  if (config.id === null) throw new Error("Cannot update a Config with no id");
19117
- const body = buildBody(config);
19132
+ const body = buildUpdateBody(config);
19118
19133
  let data;
19119
19134
  try {
19120
19135
  const result = await this._http.PUT("/api/v1/configs/{id}", {
@@ -19193,19 +19208,34 @@ function environmentsToWire2(envs) {
19193
19208
  }
19194
19209
  return out;
19195
19210
  }
19196
- function flagToBody(flag) {
19211
+ function flagAttrs(flag) {
19212
+ return {
19213
+ name: flag.name,
19214
+ description: flag.description ?? "",
19215
+ type: flag.type,
19216
+ default: flag.default,
19217
+ values: flag.values?.map((v) => ({ name: v.name, value: v.value })),
19218
+ ...Object.keys(flag.environments).length > 0 ? { environments: environmentsToWire2(flag._envsRaw()) } : {}
19219
+ };
19220
+ }
19221
+ function flagToCreateBody(flag) {
19222
+ if (flag.id === null) {
19223
+ throw new SmplValidationError("Cannot create a Flag without an id");
19224
+ }
19197
19225
  return {
19198
19226
  data: {
19199
19227
  id: flag.id,
19200
19228
  type: "flag",
19201
- attributes: {
19202
- name: flag.name,
19203
- description: flag.description ?? "",
19204
- type: flag.type,
19205
- default: flag.default,
19206
- values: flag.values?.map((v) => ({ name: v.name, value: v.value })),
19207
- ...Object.keys(flag.environments).length > 0 ? { environments: environmentsToWire2(flag._envsRaw()) } : {}
19208
- }
19229
+ attributes: flagAttrs(flag)
19230
+ }
19231
+ };
19232
+ }
19233
+ function flagToUpdateBody(flag) {
19234
+ return {
19235
+ data: {
19236
+ id: flag.id ?? null,
19237
+ type: "flag",
19238
+ attributes: flagAttrs(flag)
19209
19239
  }
19210
19240
  };
19211
19241
  }
@@ -19430,7 +19460,7 @@ var ManagementFlagsClient = class {
19430
19460
  }
19431
19461
  /** @internal — called by `Flag.save()` for new resources. */
19432
19462
  async _createFlag(flag) {
19433
- const body = flagToBody(flag);
19463
+ const body = flagToCreateBody(flag);
19434
19464
  let data;
19435
19465
  try {
19436
19466
  const result = await this._http.POST("/api/v1/flags", { body });
@@ -19445,7 +19475,7 @@ var ManagementFlagsClient = class {
19445
19475
  /** @internal — called by `Flag.save()` for existing resources. */
19446
19476
  async _updateFlag(flag) {
19447
19477
  if (flag.id === null) throw new Error("Cannot update a Flag with no id");
19448
- const body = flagToBody(flag);
19478
+ const body = flagToUpdateBody(flag);
19449
19479
  let data;
19450
19480
  try {
19451
19481
  const result = await this._http.PUT("/api/v1/flags/{id}", {
@@ -19837,7 +19867,7 @@ function loggerToBody(logger) {
19837
19867
  data: { id: logger.id, type: "logger", attributes: attrs }
19838
19868
  };
19839
19869
  }
19840
- function groupToBody(group) {
19870
+ function groupAttrs(group) {
19841
19871
  const attrs = {
19842
19872
  name: group.name
19843
19873
  };
@@ -19847,8 +19877,19 @@ function groupToBody(group) {
19847
19877
  if (Object.keys(wire).length > 0) {
19848
19878
  attrs.environments = wire;
19849
19879
  }
19880
+ return attrs;
19881
+ }
19882
+ function groupToCreateBody(group) {
19883
+ if (group.id === null) {
19884
+ throw new SmplValidationError("Cannot create a LogGroup without an id");
19885
+ }
19886
+ return {
19887
+ data: { id: group.id, type: "log_group", attributes: groupAttrs(group) }
19888
+ };
19889
+ }
19890
+ function groupToUpdateBody(group) {
19850
19891
  return {
19851
- data: { id: group.id, type: "log_group", attributes: attrs }
19892
+ data: { id: group.id ?? null, type: "log_group", attributes: groupAttrs(group) }
19852
19893
  };
19853
19894
  }
19854
19895
  var LoggerRegistrationBuffer = class {
@@ -20082,7 +20123,7 @@ var LogGroupsClient = class {
20082
20123
  * so create and update have to dispatch to different endpoints.
20083
20124
  */
20084
20125
  async _createGroup(group) {
20085
- const body = groupToBody(group);
20126
+ const body = groupToCreateBody(group);
20086
20127
  let data;
20087
20128
  try {
20088
20129
  const result = await this._http.POST("/api/v1/log_groups", { body });
@@ -20097,7 +20138,7 @@ var LogGroupsClient = class {
20097
20138
  /** @internal — called by `LogGroup.save()` for existing groups. */
20098
20139
  async _updateGroup(group) {
20099
20140
  if (group.id === null) throw new Error("Cannot update a LogGroup with no id");
20100
- const body = groupToBody(group);
20141
+ const body = groupToUpdateBody(group);
20101
20142
  let data;
20102
20143
  try {
20103
20144
  const result = await this._http.PUT("/api/v1/log_groups/{id}", {
@@ -20364,6 +20405,11 @@ var ForwardersClient = class {
20364
20405
  * Construct an unsaved {@link Forwarder}. Call {@link Forwarder.save}
20365
20406
  * to persist.
20366
20407
  *
20408
+ * @param key Caller-supplied stable identifier for the
20409
+ * forwarder. Becomes the resource's `id`
20410
+ * and is the unique key used by the audit
20411
+ * service to address it on subsequent
20412
+ * GET / PUT / DELETE calls.
20367
20413
  * @param fields.name Display name. Free-form.
20368
20414
  * @param fields.forwarderType Destination type — see {@link ForwarderType}.
20369
20415
  * @param fields.configuration Destination HTTP request configuration.
@@ -20386,8 +20432,9 @@ var ForwardersClient = class {
20386
20432
  * expression. Must be supplied together
20387
20433
  * with `transformType` (both or neither).
20388
20434
  */
20389
- new(fields) {
20435
+ new(key, fields) {
20390
20436
  return new Forwarder(this, {
20437
+ id: key,
20391
20438
  name: fields.name,
20392
20439
  forwarderType: fields.forwarderType,
20393
20440
  configuration: fields.configuration,
@@ -20461,10 +20508,21 @@ var ForwardersClient = class {
20461
20508
  }
20462
20509
  /**
20463
20510
  * @internal Called by `Forwarder.save()` on unsaved instances.
20511
+ *
20512
+ * The audit service requires a caller-supplied `data.id` on create —
20513
+ * the forwarder's stable key, propagated from
20514
+ * `mgmt.audit.forwarders.new(key, ...)`.
20464
20515
  */
20465
20516
  async _createForwarder(forwarder) {
20517
+ if (forwarder.id === null) {
20518
+ throw new Error("cannot create a Forwarder without an id (pass key to forwarders.new)");
20519
+ }
20466
20520
  const body = {
20467
- data: { id: "", type: "forwarder", attributes: _forwarderAttrs(forwarder) }
20521
+ data: {
20522
+ id: forwarder.id,
20523
+ type: "forwarder",
20524
+ attributes: _forwarderAttrs(forwarder)
20525
+ }
20468
20526
  };
20469
20527
  let data;
20470
20528
  try {
@@ -20807,6 +20865,9 @@ var EnvironmentsClient = class {
20807
20865
  }
20808
20866
  /** @internal */
20809
20867
  async _create(env) {
20868
+ if (env.id === null) {
20869
+ throw new SmplValidationError("Cannot create an Environment without an id");
20870
+ }
20810
20871
  const body = {
20811
20872
  data: {
20812
20873
  id: env.id,