@smplkit/sdk 3.0.54 → 3.0.56

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
@@ -22,20 +22,21 @@ interface AuditEvent {
22
22
  /** ISO-8601-with-offset timestamp of when the audit service ingested the event. */
23
23
  createdAt: string;
24
24
  /**
25
- * Type of the actor that performed the action (`"user"`, `"api_key"`,
26
- * `"system"`, …). Empty string when unknown.
25
+ * Kind of actor that caused the event — e.g. `"USER"`, `"API_KEY"`,
26
+ * `"SYSTEM"`, or any label the caller chose. `null` when the caller
27
+ * did not supply one; the audit service never backfills.
27
28
  */
28
- actorType: string;
29
+ actorType: string | null;
29
30
  /**
30
- * UUID of the actor, when the actor is a tracked entity
31
- * (user, api_key). `null` for system actors or anonymous events.
31
+ * Identifier of the actor that caused the event. Free-form any
32
+ * identifier scheme is accepted. `null` when not supplied.
32
33
  */
33
34
  actorId: string | null;
34
35
  /**
35
- * Display label for the actor typically a name or email. Empty
36
- * string when unknown.
36
+ * Human-readable label for the actor (e.g. an email address or API
37
+ * key name). `null` when not supplied.
37
38
  */
38
- actorLabel: string;
39
+ actorLabel: string | null;
39
40
  /**
40
41
  * Free-form per-event payload defined by the customer. Surfaced on
41
42
  * the audit-event resource as a structured JSONB column.
@@ -61,6 +62,17 @@ interface CreateEventInput {
61
62
  resourceId: string;
62
63
  /** Defaults to server-side `now()` if omitted. */
63
64
  occurredAt?: Date | string;
65
+ /**
66
+ * Free-form label for the kind of actor that caused the event (e.g.
67
+ * `"USER"`, `"API_KEY"`, `"SYSTEM"`, or any custom value). The audit
68
+ * service never backfills this from the request credential — supply
69
+ * it explicitly when you want the event attributed.
70
+ */
71
+ actorType?: string;
72
+ /** Free-form identifier of the actor. Any string scheme is accepted. */
73
+ actorId?: string;
74
+ /** Human-readable label for the actor (e.g. email or API key name). */
75
+ actorLabel?: string;
64
76
  /**
65
77
  * Free-form contextual JSON. To record a resource snapshot, nest it
66
78
  * inside `data` — smplkit's internal convention is `data.snapshot`,
@@ -293,14 +305,19 @@ declare class Forwarder {
293
305
  filter: Record<string, unknown> | null;
294
306
  /**
295
307
  * Optional template applied to each event before delivery. Shape
296
- * depends on {@link transformType}; for `"JSONATA"`, a JSONata
297
- * expression string. `null` delivers the event JSON as-is.
308
+ * depends on {@link transformType}; for {@link TransformType.JSONATA}
309
+ * the value is a JSONata expression string, but the wire schema
310
+ * widens to arbitrary JSON to leave room for future transform engines
311
+ * carrying structured templates. `null` delivers the event JSON as-is.
312
+ *
313
+ * Whenever {@link transform} is set, {@link transformType} must also
314
+ * be set; the SDK enforces this at save time.
298
315
  */
299
- transform: string | null;
316
+ transform: unknown;
300
317
  /**
301
- * Engine used to evaluate {@link transform}. Currently only
302
- * `"JSONATA"` is supported. Auto-filled by the SDK whenever
303
- * {@link transform} is set on save.
318
+ * Engine used to evaluate {@link transform}. Required whenever
319
+ * {@link transform} is set. Today only {@link TransformType.JSONATA}
320
+ * is supported.
304
321
  */
305
322
  transformType: TransformType | null;
306
323
  /**
@@ -324,7 +341,7 @@ declare class Forwarder {
324
341
  enabled?: boolean;
325
342
  description?: string | null;
326
343
  filter?: Record<string, unknown> | null;
327
- transform?: string | null;
344
+ transform?: unknown;
328
345
  transformType?: TransformType | null;
329
346
  createdAt?: string | null;
330
347
  updatedAt?: string | null;
@@ -2849,18 +2866,19 @@ declare class ManagementFlagsClient {
2849
2866
  /**
2850
2867
  * Log severity levels used by the Smpl Logging service.
2851
2868
  *
2852
- * Members are declared in alphabetical order. Severity ordering is not
2853
- * derived from declaration order it lives in the framework adapter
2854
- * code that maps these to each framework's native numeric level.
2869
+ * Members are declared in increasing order of severity per the
2870
+ * convention of every major JS/TS logging library (winston, bunyan,
2871
+ * pino, npm). `SILENT` is the all-suppressing sentinel and sits at
2872
+ * the end.
2855
2873
  */
2856
2874
  declare enum LogLevel {
2875
+ TRACE = "TRACE",
2857
2876
  DEBUG = "DEBUG",
2877
+ INFO = "INFO",
2878
+ WARN = "WARN",
2858
2879
  ERROR = "ERROR",
2859
2880
  FATAL = "FATAL",
2860
- INFO = "INFO",
2861
- SILENT = "SILENT",
2862
- TRACE = "TRACE",
2863
- WARN = "WARN"
2881
+ SILENT = "SILENT"
2864
2882
  }
2865
2883
  /**
2866
2884
  * Describes a logger effective-level change. Frozen — fields cannot be
@@ -3180,20 +3198,27 @@ declare class ForwardersClient implements ForwarderModelClient {
3180
3198
  * Construct an unsaved {@link Forwarder}. Call {@link Forwarder.save}
3181
3199
  * to persist.
3182
3200
  *
3183
- * @param fields.name Display name. Free-form.
3184
- * @param fields.forwarderType Destination type — see {@link ForwarderType}.
3185
- * @param fields.configuration Destination HTTP request configuration.
3186
- * Headers carry credentials and are
3187
- * encrypted at rest server-side; reads
3188
- * return them redacted.
3189
- * @param fields.enabled Whether the forwarder is active. Defaults true.
3190
- * @param fields.description Optional free-text description.
3191
- * @param fields.filter Optional JSON Logic filter; events that
3192
- * don't match are recorded as
3193
- * `filtered_out` deliveries.
3194
- * @param fields.transform Optional JSONata template applied to
3195
- * the event payload before POST. `null`
3196
- * delivers the event as-is.
3201
+ * @param fields.name Display name. Free-form.
3202
+ * @param fields.forwarderType Destination type — see {@link ForwarderType}.
3203
+ * @param fields.configuration Destination HTTP request configuration.
3204
+ * Headers carry credentials and are
3205
+ * encrypted at rest server-side; reads
3206
+ * return them redacted.
3207
+ * @param fields.enabled Whether the forwarder is active. Defaults true.
3208
+ * @param fields.description Optional free-text description.
3209
+ * @param fields.filter Optional JSON Logic filter; events that
3210
+ * don't match are recorded as
3211
+ * `filtered_out` deliveries.
3212
+ * @param fields.transformType Engine used to evaluate `transform`.
3213
+ * Required whenever `transform` is set;
3214
+ * today only {@link TransformType.JSONATA}
3215
+ * is supported.
3216
+ * @param fields.transform Optional template applied to each
3217
+ * event before delivery. The value is
3218
+ * arbitrary JSON — for JSONATA, supply
3219
+ * an expression string; future engines
3220
+ * may accept other shapes. Omit (or pass
3221
+ * `null`) to deliver events unchanged.
3197
3222
  */
3198
3223
  new(fields: {
3199
3224
  name: string;
@@ -3202,7 +3227,8 @@ declare class ForwardersClient implements ForwarderModelClient {
3202
3227
  enabled?: boolean;
3203
3228
  description?: string | null;
3204
3229
  filter?: Record<string, unknown> | null;
3205
- transform?: string | null;
3230
+ transformType?: TransformType | null;
3231
+ transform?: unknown;
3206
3232
  }): Forwarder;
3207
3233
  /**
3208
3234
  * List forwarders for the authenticated account.
package/dist/index.d.ts CHANGED
@@ -22,20 +22,21 @@ interface AuditEvent {
22
22
  /** ISO-8601-with-offset timestamp of when the audit service ingested the event. */
23
23
  createdAt: string;
24
24
  /**
25
- * Type of the actor that performed the action (`"user"`, `"api_key"`,
26
- * `"system"`, …). Empty string when unknown.
25
+ * Kind of actor that caused the event — e.g. `"USER"`, `"API_KEY"`,
26
+ * `"SYSTEM"`, or any label the caller chose. `null` when the caller
27
+ * did not supply one; the audit service never backfills.
27
28
  */
28
- actorType: string;
29
+ actorType: string | null;
29
30
  /**
30
- * UUID of the actor, when the actor is a tracked entity
31
- * (user, api_key). `null` for system actors or anonymous events.
31
+ * Identifier of the actor that caused the event. Free-form any
32
+ * identifier scheme is accepted. `null` when not supplied.
32
33
  */
33
34
  actorId: string | null;
34
35
  /**
35
- * Display label for the actor typically a name or email. Empty
36
- * string when unknown.
36
+ * Human-readable label for the actor (e.g. an email address or API
37
+ * key name). `null` when not supplied.
37
38
  */
38
- actorLabel: string;
39
+ actorLabel: string | null;
39
40
  /**
40
41
  * Free-form per-event payload defined by the customer. Surfaced on
41
42
  * the audit-event resource as a structured JSONB column.
@@ -61,6 +62,17 @@ interface CreateEventInput {
61
62
  resourceId: string;
62
63
  /** Defaults to server-side `now()` if omitted. */
63
64
  occurredAt?: Date | string;
65
+ /**
66
+ * Free-form label for the kind of actor that caused the event (e.g.
67
+ * `"USER"`, `"API_KEY"`, `"SYSTEM"`, or any custom value). The audit
68
+ * service never backfills this from the request credential — supply
69
+ * it explicitly when you want the event attributed.
70
+ */
71
+ actorType?: string;
72
+ /** Free-form identifier of the actor. Any string scheme is accepted. */
73
+ actorId?: string;
74
+ /** Human-readable label for the actor (e.g. email or API key name). */
75
+ actorLabel?: string;
64
76
  /**
65
77
  * Free-form contextual JSON. To record a resource snapshot, nest it
66
78
  * inside `data` — smplkit's internal convention is `data.snapshot`,
@@ -293,14 +305,19 @@ declare class Forwarder {
293
305
  filter: Record<string, unknown> | null;
294
306
  /**
295
307
  * Optional template applied to each event before delivery. Shape
296
- * depends on {@link transformType}; for `"JSONATA"`, a JSONata
297
- * expression string. `null` delivers the event JSON as-is.
308
+ * depends on {@link transformType}; for {@link TransformType.JSONATA}
309
+ * the value is a JSONata expression string, but the wire schema
310
+ * widens to arbitrary JSON to leave room for future transform engines
311
+ * carrying structured templates. `null` delivers the event JSON as-is.
312
+ *
313
+ * Whenever {@link transform} is set, {@link transformType} must also
314
+ * be set; the SDK enforces this at save time.
298
315
  */
299
- transform: string | null;
316
+ transform: unknown;
300
317
  /**
301
- * Engine used to evaluate {@link transform}. Currently only
302
- * `"JSONATA"` is supported. Auto-filled by the SDK whenever
303
- * {@link transform} is set on save.
318
+ * Engine used to evaluate {@link transform}. Required whenever
319
+ * {@link transform} is set. Today only {@link TransformType.JSONATA}
320
+ * is supported.
304
321
  */
305
322
  transformType: TransformType | null;
306
323
  /**
@@ -324,7 +341,7 @@ declare class Forwarder {
324
341
  enabled?: boolean;
325
342
  description?: string | null;
326
343
  filter?: Record<string, unknown> | null;
327
- transform?: string | null;
344
+ transform?: unknown;
328
345
  transformType?: TransformType | null;
329
346
  createdAt?: string | null;
330
347
  updatedAt?: string | null;
@@ -2849,18 +2866,19 @@ declare class ManagementFlagsClient {
2849
2866
  /**
2850
2867
  * Log severity levels used by the Smpl Logging service.
2851
2868
  *
2852
- * Members are declared in alphabetical order. Severity ordering is not
2853
- * derived from declaration order it lives in the framework adapter
2854
- * code that maps these to each framework's native numeric level.
2869
+ * Members are declared in increasing order of severity per the
2870
+ * convention of every major JS/TS logging library (winston, bunyan,
2871
+ * pino, npm). `SILENT` is the all-suppressing sentinel and sits at
2872
+ * the end.
2855
2873
  */
2856
2874
  declare enum LogLevel {
2875
+ TRACE = "TRACE",
2857
2876
  DEBUG = "DEBUG",
2877
+ INFO = "INFO",
2878
+ WARN = "WARN",
2858
2879
  ERROR = "ERROR",
2859
2880
  FATAL = "FATAL",
2860
- INFO = "INFO",
2861
- SILENT = "SILENT",
2862
- TRACE = "TRACE",
2863
- WARN = "WARN"
2881
+ SILENT = "SILENT"
2864
2882
  }
2865
2883
  /**
2866
2884
  * Describes a logger effective-level change. Frozen — fields cannot be
@@ -3180,20 +3198,27 @@ declare class ForwardersClient implements ForwarderModelClient {
3180
3198
  * Construct an unsaved {@link Forwarder}. Call {@link Forwarder.save}
3181
3199
  * to persist.
3182
3200
  *
3183
- * @param fields.name Display name. Free-form.
3184
- * @param fields.forwarderType Destination type — see {@link ForwarderType}.
3185
- * @param fields.configuration Destination HTTP request configuration.
3186
- * Headers carry credentials and are
3187
- * encrypted at rest server-side; reads
3188
- * return them redacted.
3189
- * @param fields.enabled Whether the forwarder is active. Defaults true.
3190
- * @param fields.description Optional free-text description.
3191
- * @param fields.filter Optional JSON Logic filter; events that
3192
- * don't match are recorded as
3193
- * `filtered_out` deliveries.
3194
- * @param fields.transform Optional JSONata template applied to
3195
- * the event payload before POST. `null`
3196
- * delivers the event as-is.
3201
+ * @param fields.name Display name. Free-form.
3202
+ * @param fields.forwarderType Destination type — see {@link ForwarderType}.
3203
+ * @param fields.configuration Destination HTTP request configuration.
3204
+ * Headers carry credentials and are
3205
+ * encrypted at rest server-side; reads
3206
+ * return them redacted.
3207
+ * @param fields.enabled Whether the forwarder is active. Defaults true.
3208
+ * @param fields.description Optional free-text description.
3209
+ * @param fields.filter Optional JSON Logic filter; events that
3210
+ * don't match are recorded as
3211
+ * `filtered_out` deliveries.
3212
+ * @param fields.transformType Engine used to evaluate `transform`.
3213
+ * Required whenever `transform` is set;
3214
+ * today only {@link TransformType.JSONATA}
3215
+ * is supported.
3216
+ * @param fields.transform Optional template applied to each
3217
+ * event before delivery. The value is
3218
+ * arbitrary JSON — for JSONATA, supply
3219
+ * an expression string; future engines
3220
+ * may accept other shapes. Omit (or pass
3221
+ * `null`) to deliver events unchanged.
3197
3222
  */
3198
3223
  new(fields: {
3199
3224
  name: string;
@@ -3202,7 +3227,8 @@ declare class ForwardersClient implements ForwarderModelClient {
3202
3227
  enabled?: boolean;
3203
3228
  description?: string | null;
3204
3229
  filter?: Record<string, unknown> | null;
3205
- transform?: string | null;
3230
+ transformType?: TransformType | null;
3231
+ transform?: unknown;
3206
3232
  }): Forwarder;
3207
3233
  /**
3208
3234
  * List forwarders for the authenticated account.
package/dist/index.js CHANGED
@@ -16856,6 +16856,9 @@ function _eventBodyFromInput(input) {
16856
16856
  if (input.occurredAt !== void 0) {
16857
16857
  attrs.occurred_at = input.occurredAt instanceof Date ? input.occurredAt.toISOString() : input.occurredAt;
16858
16858
  }
16859
+ if (input.actorType !== void 0) attrs.actor_type = input.actorType;
16860
+ if (input.actorId !== void 0) attrs.actor_id = input.actorId;
16861
+ if (input.actorLabel !== void 0) attrs.actor_label = input.actorLabel;
16859
16862
  if (input.data !== void 0) {
16860
16863
  attrs.data = input.data;
16861
16864
  }
@@ -16870,9 +16873,9 @@ function _eventFromResource(resource) {
16870
16873
  resourceId: String(attrs.resource_id ?? ""),
16871
16874
  occurredAt: String(attrs.occurred_at ?? ""),
16872
16875
  createdAt: String(attrs.created_at ?? ""),
16873
- actorType: String(attrs.actor_type ?? ""),
16876
+ actorType: attrs.actor_type ?? null,
16874
16877
  actorId: attrs.actor_id ?? null,
16875
- actorLabel: String(attrs.actor_label ?? ""),
16878
+ actorLabel: attrs.actor_label ?? null,
16876
16879
  data: attrs.data ?? {},
16877
16880
  idempotencyKey: String(attrs.idempotency_key ?? ""),
16878
16881
  doNotForward: Boolean(attrs.do_not_forward ?? false)
@@ -19208,13 +19211,13 @@ function _coerceValues(values) {
19208
19211
 
19209
19212
  // src/logging/types.ts
19210
19213
  var LogLevel = /* @__PURE__ */ ((LogLevel5) => {
19214
+ LogLevel5["TRACE"] = "TRACE";
19211
19215
  LogLevel5["DEBUG"] = "DEBUG";
19216
+ LogLevel5["INFO"] = "INFO";
19217
+ LogLevel5["WARN"] = "WARN";
19212
19218
  LogLevel5["ERROR"] = "ERROR";
19213
19219
  LogLevel5["FATAL"] = "FATAL";
19214
- LogLevel5["INFO"] = "INFO";
19215
19220
  LogLevel5["SILENT"] = "SILENT";
19216
- LogLevel5["TRACE"] = "TRACE";
19217
- LogLevel5["WARN"] = "WARN";
19218
19221
  return LogLevel5;
19219
19222
  })(LogLevel || {});
19220
19223
  var LoggerChangeEvent = class {
@@ -19891,14 +19894,19 @@ var Forwarder = class {
19891
19894
  filter;
19892
19895
  /**
19893
19896
  * Optional template applied to each event before delivery. Shape
19894
- * depends on {@link transformType}; for `"JSONATA"`, a JSONata
19895
- * expression string. `null` delivers the event JSON as-is.
19897
+ * depends on {@link transformType}; for {@link TransformType.JSONATA}
19898
+ * the value is a JSONata expression string, but the wire schema
19899
+ * widens to arbitrary JSON to leave room for future transform engines
19900
+ * carrying structured templates. `null` delivers the event JSON as-is.
19901
+ *
19902
+ * Whenever {@link transform} is set, {@link transformType} must also
19903
+ * be set; the SDK enforces this at save time.
19896
19904
  */
19897
19905
  transform;
19898
19906
  /**
19899
- * Engine used to evaluate {@link transform}. Currently only
19900
- * `"JSONATA"` is supported. Auto-filled by the SDK whenever
19901
- * {@link transform} is set on save.
19907
+ * Engine used to evaluate {@link transform}. Required whenever
19908
+ * {@link transform} is set. Today only {@link TransformType.JSONATA}
19909
+ * is supported.
19902
19910
  */
19903
19911
  transformType;
19904
19912
  /**
@@ -20029,8 +20037,12 @@ function _forwarderAttrs(forwarder) {
20029
20037
  if (forwarder.filter !== null) {
20030
20038
  attrs.filter = forwarder.filter;
20031
20039
  }
20032
- if (forwarder.transform !== null) {
20033
- attrs.transform_type = "JSONATA" /* JSONATA */;
20040
+ const hasTransform = forwarder.transform !== null && forwarder.transform !== void 0;
20041
+ if (hasTransform && forwarder.transformType === null) {
20042
+ throw new Error("Forwarder.transform requires Forwarder.transformType to be set");
20043
+ }
20044
+ if (hasTransform) {
20045
+ attrs.transform_type = forwarder.transformType;
20034
20046
  attrs.transform = forwarder.transform;
20035
20047
  }
20036
20048
  return attrs;
@@ -20062,20 +20074,27 @@ var ForwardersClient = class {
20062
20074
  * Construct an unsaved {@link Forwarder}. Call {@link Forwarder.save}
20063
20075
  * to persist.
20064
20076
  *
20065
- * @param fields.name Display name. Free-form.
20066
- * @param fields.forwarderType Destination type — see {@link ForwarderType}.
20067
- * @param fields.configuration Destination HTTP request configuration.
20068
- * Headers carry credentials and are
20069
- * encrypted at rest server-side; reads
20070
- * return them redacted.
20071
- * @param fields.enabled Whether the forwarder is active. Defaults true.
20072
- * @param fields.description Optional free-text description.
20073
- * @param fields.filter Optional JSON Logic filter; events that
20074
- * don't match are recorded as
20075
- * `filtered_out` deliveries.
20076
- * @param fields.transform Optional JSONata template applied to
20077
- * the event payload before POST. `null`
20078
- * delivers the event as-is.
20077
+ * @param fields.name Display name. Free-form.
20078
+ * @param fields.forwarderType Destination type — see {@link ForwarderType}.
20079
+ * @param fields.configuration Destination HTTP request configuration.
20080
+ * Headers carry credentials and are
20081
+ * encrypted at rest server-side; reads
20082
+ * return them redacted.
20083
+ * @param fields.enabled Whether the forwarder is active. Defaults true.
20084
+ * @param fields.description Optional free-text description.
20085
+ * @param fields.filter Optional JSON Logic filter; events that
20086
+ * don't match are recorded as
20087
+ * `filtered_out` deliveries.
20088
+ * @param fields.transformType Engine used to evaluate `transform`.
20089
+ * Required whenever `transform` is set;
20090
+ * today only {@link TransformType.JSONATA}
20091
+ * is supported.
20092
+ * @param fields.transform Optional template applied to each
20093
+ * event before delivery. The value is
20094
+ * arbitrary JSON — for JSONATA, supply
20095
+ * an expression string; future engines
20096
+ * may accept other shapes. Omit (or pass
20097
+ * `null`) to deliver events unchanged.
20079
20098
  */
20080
20099
  new(fields) {
20081
20100
  return new Forwarder(this, {
@@ -20085,6 +20104,7 @@ var ForwardersClient = class {
20085
20104
  enabled: fields.enabled,
20086
20105
  description: fields.description,
20087
20106
  filter: fields.filter,
20107
+ transformType: fields.transformType,
20088
20108
  transform: fields.transform
20089
20109
  });
20090
20110
  }