@trigger.dev/core 3.0.0-beta.24 → 3.0.0-beta.26

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.
@@ -127,9 +127,14 @@ var SemanticInternalAttributes = {
127
127
  };
128
128
 
129
129
  // src/v3/utils/flattenAttributes.ts
130
+ var NULL_SENTINEL = "$@null((";
130
131
  function flattenAttributes(obj, prefix) {
131
132
  const result = {};
132
- if (!obj) {
133
+ if (obj === void 0) {
134
+ return result;
135
+ }
136
+ if (obj === null) {
137
+ result[prefix || ""] = NULL_SENTINEL;
133
138
  return result;
134
139
  }
135
140
  if (typeof obj === "string") {
@@ -145,13 +150,17 @@ function flattenAttributes(obj, prefix) {
145
150
  return result;
146
151
  }
147
152
  for (const [key, value] of Object.entries(obj)) {
148
- const newPrefix = `${prefix ? `${prefix}.` : ""}${key}`;
153
+ const newPrefix = `${prefix ? `${prefix}.` : ""}${Array.isArray(obj) ? `[${key}]` : key}`;
149
154
  if (Array.isArray(value)) {
150
155
  for (let i = 0; i < value.length; i++) {
151
156
  if (typeof value[i] === "object" && value[i] !== null) {
152
157
  Object.assign(result, flattenAttributes(value[i], `${newPrefix}.[${i}]`));
153
158
  } else {
154
- result[`${newPrefix}.[${i}]`] = value[i];
159
+ if (value[i] === null) {
160
+ result[`${newPrefix}.[${i}]`] = NULL_SENTINEL;
161
+ } else {
162
+ result[`${newPrefix}.[${i}]`] = value[i];
163
+ }
155
164
  }
156
165
  }
157
166
  } else if (isRecord(value)) {
@@ -159,6 +168,8 @@ function flattenAttributes(obj, prefix) {
159
168
  } else {
160
169
  if (typeof value === "number" || typeof value === "string" || typeof value === "boolean") {
161
170
  result[newPrefix] = value;
171
+ } else if (value === null) {
172
+ result[newPrefix] = NULL_SENTINEL;
162
173
  }
163
174
  }
164
175
  }
@@ -819,7 +830,8 @@ z.object({
819
830
  RegexSchema
820
831
  ])).optional(),
821
832
  logLevel: z.string().optional(),
822
- enableConsoleLogging: z.boolean().optional()
833
+ enableConsoleLogging: z.boolean().optional(),
834
+ postInstall: z.string().optional()
823
835
  });
824
836
  z.enum([
825
837
  "WAIT_FOR_DURATION",
@@ -1712,11 +1724,12 @@ async function createPacketAttributes(packet, dataKey, dataTypeKey) {
1712
1724
  try {
1713
1725
  const parsed = parse(packet.data);
1714
1726
  const jsonified = JSON.parse(JSON.stringify(parsed, safeReplacer));
1715
- return {
1727
+ const result = {
1716
1728
  ...flattenAttributes(jsonified, dataKey),
1717
1729
  [dataTypeKey]: "application/json"
1718
1730
  };
1719
- } catch {
1731
+ return result;
1732
+ } catch (e) {
1720
1733
  return;
1721
1734
  }
1722
1735
  case "application/store":