terse-types 0.0.53 → 0.0.54

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.
@@ -160,6 +160,9 @@ export declare const ApiRoutes: {
160
160
  APPROVAL_DECISION: string;
161
161
  SESSION_EVENTS: string;
162
162
  LISTEN: string;
163
+ SUSPEND: string;
164
+ RESUME: string;
165
+ INPUT_REQUEST: string;
163
166
  CREATE_PROJECT: string;
164
167
  DEPLOY: string;
165
168
  IDENTIFY: string;
@@ -160,6 +160,9 @@
160
160
  "APPROVAL_DECISION": "/sdk/approval-decision",
161
161
  "SESSION_EVENTS": "/sdk/session-events",
162
162
  "LISTEN": "/sdk/listen",
163
+ "SUSPEND": "/sdk/suspend",
164
+ "RESUME": "/sdk/resume",
165
+ "INPUT_REQUEST": "/sdk/input-request",
163
166
  "CREATE_PROJECT": "/sdk/projects",
164
167
  "DEPLOY": "/sdk/deploy",
165
168
  "IDENTIFY": "/sdk/auth/identify",
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Collapses a single Attio value entry (or nested structure) toward primitives /
3
+ * simple objects, matching the shape produced for generated Attio tool outputs.
4
+ */
5
+ export declare function flattenAttioLeafValue(value: unknown): unknown;
6
+ /**
7
+ * Flattens one attribute’s raw value (often an array of interaction rows from the REST API).
8
+ * @param preferArray When true, keep all entries as an array; when false, use the first entry only.
9
+ */
10
+ export declare function flattenAttioAttributeValue(rawValue: unknown, preferArray: boolean): unknown;
11
+ /**
12
+ * Flattens `record.values` from Attio’s GET record / webhook enrichment payload.
13
+ */
14
+ export declare function flattenAttioRecordValues(values: Record<string, unknown>, isMultiValueAttribute: (attributeSlug: string) => boolean): Record<string, unknown>;
15
+ /**
16
+ * Slug-only heuristic when object attribute metadata is unavailable (e.g. Attio webhook triggers).
17
+ * Prefer {@link flattenAttioRecordValues} with object-aware multi-value info from codegen when possible.
18
+ */
19
+ export declare function isProbablyAttioMultiValueAttributeSlug(attributeSlug: string): boolean;
@@ -0,0 +1,71 @@
1
+ /** Keys Attio nests on attribute timeline entries (not the semantic payload). */
2
+ const ATTIO_VALUE_METADATA_KEYS = new Set([
3
+ "active_from",
4
+ "active_until",
5
+ "attribute_type",
6
+ "created_by_actor"
7
+ ]);
8
+ /**
9
+ * Collapses a single Attio value entry (or nested structure) toward primitives /
10
+ * simple objects, matching the shape produced for generated Attio tool outputs.
11
+ */
12
+ export function flattenAttioLeafValue(value) {
13
+ if (value === null || value === undefined)
14
+ return value;
15
+ if (Array.isArray(value))
16
+ return value.map(entry => flattenAttioLeafValue(entry));
17
+ if (typeof value !== "object")
18
+ return value;
19
+ const rawObject = value;
20
+ if (typeof rawObject.full_name === "string")
21
+ return rawObject.full_name;
22
+ if (typeof rawObject.email_address === "string")
23
+ return rawObject.email_address;
24
+ if (typeof rawObject.domain === "string")
25
+ return rawObject.domain;
26
+ if (typeof rawObject.phone_number === "string")
27
+ return rawObject.phone_number;
28
+ if ("value" in rawObject)
29
+ return flattenAttioLeafValue(rawObject.value);
30
+ const dataEntries = Object.entries(rawObject).filter(([key]) => !ATTIO_VALUE_METADATA_KEYS.has(key));
31
+ if (dataEntries.length === 0)
32
+ return rawObject;
33
+ if (dataEntries.length === 1)
34
+ return flattenAttioLeafValue(dataEntries[0][1]);
35
+ return Object.fromEntries(dataEntries.map(([key, entryValue]) => [key, flattenAttioLeafValue(entryValue)]));
36
+ }
37
+ /**
38
+ * Flattens one attribute’s raw value (often an array of interaction rows from the REST API).
39
+ * @param preferArray When true, keep all entries as an array; when false, use the first entry only.
40
+ */
41
+ export function flattenAttioAttributeValue(rawValue, preferArray) {
42
+ if (!Array.isArray(rawValue))
43
+ return flattenAttioLeafValue(rawValue);
44
+ const flattened = rawValue.map(entry => flattenAttioLeafValue(entry)).filter(entry => entry !== undefined);
45
+ return preferArray ? flattened : flattened[0];
46
+ }
47
+ /**
48
+ * Flattens `record.values` from Attio’s GET record / webhook enrichment payload.
49
+ */
50
+ export function flattenAttioRecordValues(values, isMultiValueAttribute) {
51
+ const flattenedValues = {};
52
+ for (const [attributeSlug, rawValue] of Object.entries(values)) {
53
+ flattenedValues[attributeSlug] = flattenAttioAttributeValue(rawValue, isMultiValueAttribute(attributeSlug));
54
+ }
55
+ return flattenedValues;
56
+ }
57
+ /**
58
+ * Slug-only heuristic when object attribute metadata is unavailable (e.g. Attio webhook triggers).
59
+ * Prefer {@link flattenAttioRecordValues} with object-aware multi-value info from codegen when possible.
60
+ */
61
+ export function isProbablyAttioMultiValueAttributeSlug(attributeSlug) {
62
+ const slug = attributeSlug.toLowerCase();
63
+ return (slug === "email_addresses" ||
64
+ slug === "domains" ||
65
+ slug === "phone_numbers" ||
66
+ slug === "social_profiles" ||
67
+ slug === "links" ||
68
+ slug === "tags" ||
69
+ slug.endsWith("_addresses") ||
70
+ slug.endsWith("_ids"));
71
+ }
@@ -177,8 +177,8 @@ export declare const imageSchema: z.ZodObject<{
177
177
  url: z.ZodString;
178
178
  }, z.core.$strip>;
179
179
  export declare const webhookFailureStageSchema: z.ZodEnum<{
180
- handshake: "handshake";
181
180
  delivery: "delivery";
181
+ handshake: "handshake";
182
182
  }>;
183
183
  export type WebhookFailureStage = z.infer<typeof webhookFailureStageSchema>;
184
184
  /**
@@ -189,8 +189,8 @@ export type WebhookFailureStage = z.infer<typeof webhookFailureStageSchema>;
189
189
  export declare const webhookFailureSchema: z.ZodObject<{
190
190
  type: z.ZodLiteral<"webhook_failure">;
191
191
  stage: z.ZodEnum<{
192
- handshake: "handshake";
193
192
  delivery: "delivery";
193
+ handshake: "handshake";
194
194
  }>;
195
195
  message: z.ZodString;
196
196
  triggerUrl: z.ZodString;
@@ -231,8 +231,8 @@ export declare const snippetVariantSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
231
231
  }, z.core.$strip>, z.ZodObject<{
232
232
  type: z.ZodLiteral<"webhook_failure">;
233
233
  stage: z.ZodEnum<{
234
- handshake: "handshake";
235
234
  delivery: "delivery";
235
+ handshake: "handshake";
236
236
  }>;
237
237
  message: z.ZodString;
238
238
  triggerUrl: z.ZodString;
@@ -284,8 +284,8 @@ export declare const chatSnippetSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
284
284
  }, z.core.$strip>, z.ZodObject<{
285
285
  type: z.ZodLiteral<"webhook_failure">;
286
286
  stage: z.ZodEnum<{
287
- handshake: "handshake";
288
287
  delivery: "delivery";
288
+ handshake: "handshake";
289
289
  }>;
290
290
  message: z.ZodString;
291
291
  triggerUrl: z.ZodString;
@@ -344,8 +344,8 @@ export declare const modelEventChatSnippetSchema: z.ZodObject<{
344
344
  }, z.core.$strip>, z.ZodObject<{
345
345
  type: z.ZodLiteral<"webhook_failure">;
346
346
  stage: z.ZodEnum<{
347
- handshake: "handshake";
348
347
  delivery: "delivery";
348
+ handshake: "handshake";
349
349
  }>;
350
350
  message: z.ZodString;
351
351
  triggerUrl: z.ZodString;
@@ -480,8 +480,8 @@ export declare const modelEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
480
480
  }, z.core.$strip>, z.ZodObject<{
481
481
  type: z.ZodLiteral<"webhook_failure">;
482
482
  stage: z.ZodEnum<{
483
- handshake: "handshake";
484
483
  delivery: "delivery";
484
+ handshake: "handshake";
485
485
  }>;
486
486
  message: z.ZodString;
487
487
  triggerUrl: z.ZodString;
@@ -0,0 +1,6 @@
1
+ import { z } from "zod";
2
+ export declare const organizationMetadataSchema: z.ZodObject<{
3
+ stripeCustomerId: z.ZodString;
4
+ runExecutionBlocked: z.ZodPipe<z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>, z.ZodTransform<boolean, string | boolean | undefined>>;
5
+ }, z.core.$strip>;
6
+ export type OrganizationMetadata = z.infer<typeof organizationMetadataSchema>;
@@ -0,0 +1,10 @@
1
+ import { z } from "zod";
2
+ // Can be serialized a string, supports deserialization
3
+ const booleanMetadataSchema = z
4
+ .union([z.boolean(), z.string()])
5
+ .optional()
6
+ .transform(value => value === true || value === "true");
7
+ export const organizationMetadataSchema = z.object({
8
+ stripeCustomerId: z.string(),
9
+ runExecutionBlocked: booleanMetadataSchema
10
+ });
@@ -8,6 +8,7 @@ export declare const RunHistoryStatus: {
8
8
  readonly SKIPPED: "skipped";
9
9
  readonly IN_PROGRESS: "in_progress";
10
10
  readonly AWAITING_APPROVAL: "awaiting_approval";
11
+ readonly SUSPENDED: "suspended";
11
12
  };
12
13
  export declare const runHistoryStatusSchema: z.ZodEnum<{
13
14
  readonly SUCCESS: "success";
@@ -16,6 +17,7 @@ export declare const runHistoryStatusSchema: z.ZodEnum<{
16
17
  readonly SKIPPED: "skipped";
17
18
  readonly IN_PROGRESS: "in_progress";
18
19
  readonly AWAITING_APPROVAL: "awaiting_approval";
20
+ readonly SUSPENDED: "suspended";
19
21
  }>;
20
22
  export type RunHistoryStatus = z.infer<typeof runHistoryStatusSchema>;
21
23
  export declare const runHistoryDecisionActionSchema: z.ZodEnum<{
@@ -7,7 +7,8 @@ export const RunHistoryStatus = {
7
7
  CANCELLED: "cancelled",
8
8
  SKIPPED: "skipped",
9
9
  IN_PROGRESS: "in_progress",
10
- AWAITING_APPROVAL: "awaiting_approval"
10
+ AWAITING_APPROVAL: "awaiting_approval",
11
+ SUSPENDED: "suspended"
11
12
  };
12
13
  export const runHistoryStatusSchema = z.enum(RunHistoryStatus);
13
14
  export const runHistoryDecisionActionSchema = z.enum(["processed", "skipped"]);