terse-types 0.0.77 → 0.1.1
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/Configs.d.ts +1266 -1
- package/dist/Configs.js +7 -3
- package/dist/Events.d.ts +112 -0
- package/dist/Events.js +32 -0
- package/dist/Integrations.d.ts +6 -0
- package/dist/Integrations.js +9 -0
- package/dist/Timezones.d.ts +424 -0
- package/dist/Timezones.js +425 -0
- package/dist/Tools.js +4 -2
- package/dist/TriggerDefinition.d.ts +34 -0
- package/dist/TriggerDefinition.js +6 -0
- package/dist/TriggerPresenters.d.ts +38 -8
- package/dist/TriggerPresenters.js +233 -294
- package/dist/TriggerProjections.d.ts +18 -0
- package/dist/TriggerProjections.js +167 -0
- package/dist/Triggers.d.ts +2111 -30
- package/dist/Triggers.js +633 -25
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/types.d.ts +6381 -66
- package/package.json +2 -1
- package/dist/AttioRecordFlatten.d.ts +0 -19
- package/dist/AttioRecordFlatten.js +0 -71
- package/dist/OrganizationMetadata.d.ts +0 -6
- package/dist/OrganizationMetadata.js +0 -10
- package/dist/json-schema/terse-types.schema.json +0 -15994
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "terse-types",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Shared Terse TypeScript types, enums, constants, and helpers.",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -52,6 +52,7 @@
|
|
|
52
52
|
"scripts": {
|
|
53
53
|
"build": "tsc -p tsconfig.build.json && node --input-type=module -e \"import { fix } from 'tsc-esm-fix'; await fix({ cwd: process.cwd(), target: ['dist'], ext: '.js' })\"",
|
|
54
54
|
"check:schema": "node --import tsx scripts/check-schema-compat.ts",
|
|
55
|
+
"generate:timezones": "node --import tsx scripts/generate-timezones.ts",
|
|
55
56
|
"clean": "rm -rf dist",
|
|
56
57
|
"dev": "node ../scripts/tsc-watch-and-fix.mjs tsconfig.build.json dist",
|
|
57
58
|
"format": "pnpm exec prettier --config ../.prettierrc --write \"*.{ts,json}\"",
|
|
@@ -1,19 +0,0 @@
|
|
|
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;
|
|
@@ -1,71 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
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>;
|
|
@@ -1,10 +0,0 @@
|
|
|
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
|
-
});
|