@smplkit/sdk 3.0.21 → 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.js CHANGED
@@ -16730,19 +16730,20 @@ var AuditEventBuffer = class {
16730
16730
 
16731
16731
  // src/audit/client.ts
16732
16732
  var JSONAPI_CONTENT_TYPE = "application/vnd.api+json";
16733
- function _attributesFromInput(input) {
16733
+ function _eventBodyFromInput(input) {
16734
16734
  const attrs = {
16735
16735
  action: input.action,
16736
16736
  resource_type: input.resourceType,
16737
- resource_id: input.resourceId
16737
+ resource_id: input.resourceId,
16738
+ do_not_forward: input.doNotForward ?? false
16738
16739
  };
16739
16740
  if (input.occurredAt !== void 0) {
16740
- const ts = input.occurredAt instanceof Date ? input.occurredAt.toISOString() : input.occurredAt;
16741
- attrs.occurred_at = ts;
16741
+ attrs.occurred_at = input.occurredAt instanceof Date ? input.occurredAt.toISOString() : input.occurredAt;
16742
16742
  }
16743
- if (input.data !== void 0) attrs.data = input.data;
16744
- if (input.doNotForward) attrs.do_not_forward = true;
16745
- return attrs;
16743
+ if (input.data !== void 0) {
16744
+ attrs.data = input.data;
16745
+ }
16746
+ return { data: { id: "", type: "event", attributes: attrs } };
16746
16747
  }
16747
16748
  function _eventFromResource(resource) {
16748
16749
  const attrs = resource.attributes;
@@ -16791,9 +16792,13 @@ function _forwarderAttributes(input) {
16791
16792
  enabled: input.enabled ?? true,
16792
16793
  http: _httpToWire(input.http)
16793
16794
  };
16794
- if (input.filter !== void 0) attrs.filter = input.filter;
16795
+ if (input.filter !== void 0) {
16796
+ attrs.filter = input.filter;
16797
+ }
16795
16798
  if (input.transform !== void 0) attrs.transform = input.transform;
16796
- if (input.data !== void 0) attrs.data = input.data;
16799
+ if (input.data !== void 0) {
16800
+ attrs.data = input.data;
16801
+ }
16797
16802
  return attrs;
16798
16803
  }
16799
16804
  function _forwarderFromResource(resource) {
@@ -16857,9 +16862,6 @@ var EventsClient = class {
16857
16862
  const headerInit = {};
16858
16863
  if (item.idempotencyKey !== null) headerInit["Idempotency-Key"] = item.idempotencyKey;
16859
16864
  const result = await this._http.POST("/api/v1/events", {
16860
- // Casting through unknown because the generated body type is
16861
- // EventResponse with id required, while the wrapper builds an
16862
- // unsaved-resource body without an id (server assigns).
16863
16865
  body: item.body,
16864
16866
  headers: headerInit
16865
16867
  });
@@ -16879,10 +16881,7 @@ var EventsClient = class {
16879
16881
  * failures, so a misuse will silently disappear from the queue).
16880
16882
  */
16881
16883
  record(input) {
16882
- const body = {
16883
- data: { id: "", type: "event", attributes: _attributesFromInput(input) }
16884
- };
16885
- this._buffer.enqueue(body, input.idempotencyKey ?? null);
16884
+ this._buffer.enqueue(_eventBodyFromInput(input), input.idempotencyKey ?? null);
16886
16885
  }
16887
16886
  async list(params = {}) {
16888
16887
  const query = {};
@@ -17012,10 +17011,10 @@ var ForwardersClient = class {
17012
17011
  deliveries;
17013
17012
  actions;
17014
17013
  async create(input) {
17015
- const body = { data: { id: "", type: "forwarder", attributes: _forwarderAttributes(input) } };
17016
- const result = await this._http.POST("/api/v1/forwarders", {
17017
- body
17018
- });
17014
+ const body = {
17015
+ data: { id: "", type: "forwarder", attributes: _forwarderAttributes(input) }
17016
+ };
17017
+ const result = await this._http.POST("/api/v1/forwarders", { body });
17019
17018
  if (!result.response.ok || result.data === void 0) {
17020
17019
  throw new Error(
17021
17020
  `audit create forwarder failed: ${result.response.status} ${result.response.statusText}`