@smplkit/sdk 3.0.20 → 3.0.22

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 CHANGED
@@ -16796,19 +16796,20 @@ var AuditEventBuffer = class {
16796
16796
 
16797
16797
  // src/audit/client.ts
16798
16798
  var JSONAPI_CONTENT_TYPE = "application/vnd.api+json";
16799
- function _attributesFromInput(input) {
16799
+ function _eventBodyFromInput(input) {
16800
16800
  const attrs = {
16801
16801
  action: input.action,
16802
16802
  resource_type: input.resourceType,
16803
- resource_id: input.resourceId
16803
+ resource_id: input.resourceId,
16804
+ do_not_forward: input.doNotForward ?? false
16804
16805
  };
16805
16806
  if (input.occurredAt !== void 0) {
16806
- const ts = input.occurredAt instanceof Date ? input.occurredAt.toISOString() : input.occurredAt;
16807
- attrs.occurred_at = ts;
16807
+ attrs.occurred_at = input.occurredAt instanceof Date ? input.occurredAt.toISOString() : input.occurredAt;
16808
16808
  }
16809
- if (input.data !== void 0) attrs.data = input.data;
16810
- if (input.doNotForward) attrs.do_not_forward = true;
16811
- return attrs;
16809
+ if (input.data !== void 0) {
16810
+ attrs.data = input.data;
16811
+ }
16812
+ return { data: { id: "", type: "event", attributes: attrs } };
16812
16813
  }
16813
16814
  function _eventFromResource(resource) {
16814
16815
  const attrs = resource.attributes;
@@ -16857,9 +16858,13 @@ function _forwarderAttributes(input) {
16857
16858
  enabled: input.enabled ?? true,
16858
16859
  http: _httpToWire(input.http)
16859
16860
  };
16860
- if (input.filter !== void 0) attrs.filter = input.filter;
16861
+ if (input.filter !== void 0) {
16862
+ attrs.filter = input.filter;
16863
+ }
16861
16864
  if (input.transform !== void 0) attrs.transform = input.transform;
16862
- if (input.data !== void 0) attrs.data = input.data;
16865
+ if (input.data !== void 0) {
16866
+ attrs.data = input.data;
16867
+ }
16863
16868
  return attrs;
16864
16869
  }
16865
16870
  function _forwarderFromResource(resource) {
@@ -16923,9 +16928,6 @@ var EventsClient = class {
16923
16928
  const headerInit = {};
16924
16929
  if (item.idempotencyKey !== null) headerInit["Idempotency-Key"] = item.idempotencyKey;
16925
16930
  const result = await this._http.POST("/api/v1/events", {
16926
- // Casting through unknown because the generated body type is
16927
- // EventResponse with id required, while the wrapper builds an
16928
- // unsaved-resource body without an id (server assigns).
16929
16931
  body: item.body,
16930
16932
  headers: headerInit
16931
16933
  });
@@ -16945,10 +16947,7 @@ var EventsClient = class {
16945
16947
  * failures, so a misuse will silently disappear from the queue).
16946
16948
  */
16947
16949
  record(input) {
16948
- const body = {
16949
- data: { id: "", type: "event", attributes: _attributesFromInput(input) }
16950
- };
16951
- this._buffer.enqueue(body, input.idempotencyKey ?? null);
16950
+ this._buffer.enqueue(_eventBodyFromInput(input), input.idempotencyKey ?? null);
16952
16951
  }
16953
16952
  async list(params = {}) {
16954
16953
  const query = {};
@@ -17078,10 +17077,10 @@ var ForwardersClient = class {
17078
17077
  deliveries;
17079
17078
  actions;
17080
17079
  async create(input) {
17081
- const body = { data: { id: "", type: "forwarder", attributes: _forwarderAttributes(input) } };
17082
- const result = await this._http.POST("/api/v1/forwarders", {
17083
- body
17084
- });
17080
+ const body = {
17081
+ data: { id: "", type: "forwarder", attributes: _forwarderAttributes(input) }
17082
+ };
17083
+ const result = await this._http.POST("/api/v1/forwarders", { body });
17085
17084
  if (!result.response.ok || result.data === void 0) {
17086
17085
  throw new Error(
17087
17086
  `audit create forwarder failed: ${result.response.status} ${result.response.statusText}`