@inferencebureau/apps-sdk 0.16.1 → 0.16.3

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.ts CHANGED
@@ -1524,11 +1524,16 @@ export interface LogLine {
1524
1524
  data?: unknown;
1525
1525
  at: string;
1526
1526
  }
1527
+ /** Takes (message, data), and the data first too, as pino and Gadget's logger did: `logger.info({ id }, "Saved")`. */
1527
1528
  export interface Logger {
1528
1529
  debug(message: string, data?: unknown): void;
1530
+ debug(data: Record<string, unknown>, message?: string): void;
1529
1531
  info(message: string, data?: unknown): void;
1532
+ info(data: Record<string, unknown>, message?: string): void;
1530
1533
  warn(message: string, data?: unknown): void;
1534
+ warn(data: Record<string, unknown>, message?: string): void;
1531
1535
  error(message: string, data?: unknown): void;
1536
+ error(data: Record<string, unknown>, message?: string): void;
1532
1537
  }
1533
1538
  export interface ActionContext<P = Record<string, unknown>> {
1534
1539
  /**
package/dist/runtime.js CHANGED
@@ -139,7 +139,11 @@ function sameText(a, b) {
139
139
  return d === 0;
140
140
  }
141
141
  function collector(lines, echo) {
142
- const at = (level) => (message, data) => {
142
+ const at = (level) => (first, second) => {
143
+ // The data first, as pino has it: logger.info({ id }, "Saved").
144
+ const swap = typeof first !== "string" && (second === undefined || typeof second === "string");
145
+ const message = swap ? second ?? "" : first;
146
+ const data = swap ? first : second;
143
147
  lines.push({ level, message: String(message).slice(0, 2000), ...(data === undefined ? {} : { data }), at: new Date().toISOString() });
144
148
  if (echo)
145
149
  (level === "error" ? console.error : level === "warn" ? console.warn : console.log)(`[action] ${message}`, ...(data === undefined ? [] : [data]));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inferencebureau/apps-sdk",
3
- "version": "0.16.1",
3
+ "version": "0.16.3",
4
4
  "description": "The SDK an Inference Bureau app's code imports: action helpers, metadata types, the records API client, React hooks with AutoTable and AutoForm, and a test harness for its actions.",
5
5
  "license": "UNLICENSED",
6
6
  "keywords": [