terse-cli 0.2.16 → 0.3.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/_tmp_create_project.d.ts +2 -0
- package/dist/_tmp_create_project.d.ts.map +1 -0
- package/dist/_tmp_create_project.js +17 -0
- package/dist/_tmp_create_project.js.map +1 -0
- package/dist/_tmp_delete_agent.d.ts +2 -0
- package/dist/_tmp_delete_agent.d.ts.map +1 -0
- package/dist/_tmp_delete_agent.js +14 -0
- package/dist/_tmp_delete_agent.js.map +1 -0
- package/dist/_tmp_manual_trigger.d.ts +2 -0
- package/dist/_tmp_manual_trigger.d.ts.map +1 -0
- package/dist/_tmp_manual_trigger.js +17 -0
- package/dist/_tmp_manual_trigger.js.map +1 -0
- package/dist/_tmp_patch_active.d.ts +2 -0
- package/dist/_tmp_patch_active.d.ts.map +1 -0
- package/dist/_tmp_patch_active.js +21 -0
- package/dist/_tmp_patch_active.js.map +1 -0
- package/dist/codegen.d.ts +15 -0
- package/dist/codegen.d.ts.map +1 -1
- package/dist/codegen.js +466 -81
- package/dist/codegen.js.map +1 -1
- package/dist/commands/deployTheme.d.ts +28 -0
- package/dist/commands/deployTheme.d.ts.map +1 -0
- package/dist/commands/deployTheme.js +68 -0
- package/dist/commands/deployTheme.js.map +1 -0
- package/dist/commands/dev.d.ts +3 -0
- package/dist/commands/dev.d.ts.map +1 -0
- package/dist/commands/dev.js +47 -0
- package/dist/commands/dev.js.map +1 -0
- package/dist/commands/fsExec.d.ts +8 -0
- package/dist/commands/fsExec.d.ts.map +1 -0
- package/dist/commands/fsExec.js +46 -0
- package/dist/commands/fsExec.js.map +1 -0
- package/dist/commands/generate.d.ts.map +1 -1
- package/dist/commands/generate.js +36 -267
- package/dist/commands/generate.js.map +1 -1
- package/dist/commands/serve.d.ts +1 -0
- package/dist/commands/serve.d.ts.map +1 -0
- package/dist/commands/serve.js +2 -0
- package/dist/commands/serve.js.map +1 -0
- package/dist/commands/terseCliTheme.d.ts +28 -0
- package/dist/commands/terseCliTheme.d.ts.map +1 -0
- package/dist/commands/terseCliTheme.js +68 -0
- package/dist/commands/terseCliTheme.js.map +1 -0
- package/dist/commands/tool.d.ts +6 -0
- package/dist/commands/tool.d.ts.map +1 -0
- package/dist/commands/tool.js +34 -0
- package/dist/commands/tool.js.map +1 -0
- package/dist/commands/toolRun.js +1 -1
- package/dist/commands/toolRun.js.map +1 -1
- package/dist/data/standardSlackEmoji.d.ts +2 -0
- package/dist/data/standardSlackEmoji.d.ts.map +1 -0
- package/dist/data/standardSlackEmoji.js +1978 -0
- package/dist/data/standardSlackEmoji.js.map +1 -0
- package/dist/data/standardSlackEmoji.json +1974 -0
- package/dist/deploy.d.ts +2 -1
- package/dist/deploy.d.ts.map +1 -1
- package/dist/deploy.js +61 -38
- package/dist/deploy.js.map +1 -1
- package/dist/generate.d.ts +2 -1
- package/dist/generate.d.ts.map +1 -1
- package/dist/generate.js +67 -69
- package/dist/generate.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/init.d.ts +2 -1
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +45 -96
- package/dist/init.js.map +1 -1
- package/dist/integrate.d.ts +1 -0
- package/dist/integrate.d.ts.map +1 -1
- package/dist/integrate.js +191 -11
- package/dist/integrate.js.map +1 -1
- package/dist/nonInteractive.d.ts +4 -2
- package/dist/nonInteractive.d.ts.map +1 -1
- package/dist/nonInteractive.js +5 -2
- package/dist/nonInteractive.js.map +1 -1
- package/dist/perf.d.ts +9 -0
- package/dist/perf.d.ts.map +1 -0
- package/dist/perf.js +59 -0
- package/dist/perf.js.map +1 -0
- package/dist/providers/LanguageProvider.d.ts +6 -2
- package/dist/providers/LanguageProvider.d.ts.map +1 -1
- package/dist/providers/codegen.test.d.ts +2 -0
- package/dist/providers/codegen.test.d.ts.map +1 -0
- package/dist/providers/codegen.test.js +45 -0
- package/dist/providers/codegen.test.js.map +1 -0
- package/dist/providers/codegenTypes.d.ts +16 -134
- package/dist/providers/codegenTypes.d.ts.map +1 -1
- package/dist/providers/python/PythonProvider.js +1 -0
- package/dist/providers/python/PythonProvider.js.map +1 -1
- package/dist/providers/python/PythonProvider.test.d.ts +2 -0
- package/dist/providers/python/PythonProvider.test.d.ts.map +1 -0
- package/dist/providers/python/PythonProvider.test.js +169 -0
- package/dist/providers/python/PythonProvider.test.js.map +1 -0
- package/dist/providers/typescript/TypeScriptProvider.d.ts +2 -2
- package/dist/providers/typescript/TypeScriptProvider.d.ts.map +1 -1
- package/dist/providers/typescript/TypeScriptProvider.js +53 -4
- package/dist/providers/typescript/TypeScriptProvider.js.map +1 -1
- package/dist/providers/typescript/attioProjection.d.ts +50 -0
- package/dist/providers/typescript/attioProjection.d.ts.map +1 -0
- package/dist/providers/typescript/attioProjection.js +358 -0
- package/dist/providers/typescript/attioProjection.js.map +1 -0
- package/dist/providers/typescript/modules/IntegrationModule.d.ts +82 -0
- package/dist/providers/typescript/modules/IntegrationModule.d.ts.map +1 -0
- package/dist/providers/typescript/modules/IntegrationModule.js +184 -0
- package/dist/providers/typescript/modules/IntegrationModule.js.map +1 -0
- package/dist/providers/typescript/modules/attio/AttioModule.d.ts +55 -0
- package/dist/providers/typescript/modules/attio/AttioModule.d.ts.map +1 -0
- package/dist/providers/typescript/modules/attio/AttioModule.js +163 -0
- package/dist/providers/typescript/modules/attio/AttioModule.js.map +1 -0
- package/dist/providers/typescript/modules/attio/attioProjection.d.ts +50 -0
- package/dist/providers/typescript/modules/attio/attioProjection.d.ts.map +1 -0
- package/dist/providers/typescript/modules/attio/attioProjection.js +358 -0
- package/dist/providers/typescript/modules/attio/attioProjection.js.map +1 -0
- package/dist/providers/typescript/modules/attio/attioToolMethods.d.ts +4 -0
- package/dist/providers/typescript/modules/attio/attioToolMethods.d.ts.map +1 -0
- package/dist/providers/typescript/modules/attio/attioToolMethods.js +295 -0
- package/dist/providers/typescript/modules/attio/attioToolMethods.js.map +1 -0
- package/dist/providers/typescript/modules/attio/attioTypes.d.ts +36 -0
- package/dist/providers/typescript/modules/attio/attioTypes.d.ts.map +1 -0
- package/dist/providers/typescript/modules/attio/attioTypes.js +2 -0
- package/dist/providers/typescript/modules/attio/attioTypes.js.map +1 -0
- package/dist/providers/typescript/modules/datadog/DatadogModule.d.ts +25 -0
- package/dist/providers/typescript/modules/datadog/DatadogModule.d.ts.map +1 -0
- package/dist/providers/typescript/modules/datadog/DatadogModule.js +33 -0
- package/dist/providers/typescript/modules/datadog/DatadogModule.js.map +1 -0
- package/dist/providers/typescript/modules/github/GithubModule.d.ts +44 -0
- package/dist/providers/typescript/modules/github/GithubModule.d.ts.map +1 -0
- package/dist/providers/typescript/modules/github/GithubModule.js +111 -0
- package/dist/providers/typescript/modules/github/GithubModule.js.map +1 -0
- package/dist/providers/typescript/modules/gmail/GmailModule.d.ts +17 -0
- package/dist/providers/typescript/modules/gmail/GmailModule.d.ts.map +1 -0
- package/dist/providers/typescript/modules/gmail/GmailModule.js +30 -0
- package/dist/providers/typescript/modules/gmail/GmailModule.js.map +1 -0
- package/dist/providers/typescript/modules/hey_reach/HeyReachModule.d.ts +25 -0
- package/dist/providers/typescript/modules/hey_reach/HeyReachModule.d.ts.map +1 -0
- package/dist/providers/typescript/modules/hey_reach/HeyReachModule.js +33 -0
- package/dist/providers/typescript/modules/hey_reach/HeyReachModule.js.map +1 -0
- package/dist/providers/typescript/modules/launchdarkly/LaunchDarklyModule.d.ts +26 -0
- package/dist/providers/typescript/modules/launchdarkly/LaunchDarklyModule.d.ts.map +1 -0
- package/dist/providers/typescript/modules/launchdarkly/LaunchDarklyModule.js +34 -0
- package/dist/providers/typescript/modules/launchdarkly/LaunchDarklyModule.js.map +1 -0
- package/dist/providers/typescript/modules/linear/LinearModule.d.ts +35 -0
- package/dist/providers/typescript/modules/linear/LinearModule.d.ts.map +1 -0
- package/dist/providers/typescript/modules/linear/LinearModule.js +48 -0
- package/dist/providers/typescript/modules/linear/LinearModule.js.map +1 -0
- package/dist/providers/typescript/modules/moduleHelpers.d.ts +23 -0
- package/dist/providers/typescript/modules/moduleHelpers.d.ts.map +1 -0
- package/dist/providers/typescript/modules/moduleHelpers.js +74 -0
- package/dist/providers/typescript/modules/moduleHelpers.js.map +1 -0
- package/dist/providers/typescript/modules/notion/NotionModule.d.ts +33 -0
- package/dist/providers/typescript/modules/notion/NotionModule.d.ts.map +1 -0
- package/dist/providers/typescript/modules/notion/NotionModule.js +44 -0
- package/dist/providers/typescript/modules/notion/NotionModule.js.map +1 -0
- package/dist/providers/typescript/modules/posthog/PosthogModule.d.ts +30 -0
- package/dist/providers/typescript/modules/posthog/PosthogModule.d.ts.map +1 -0
- package/dist/providers/typescript/modules/posthog/PosthogModule.js +60 -0
- package/dist/providers/typescript/modules/posthog/PosthogModule.js.map +1 -0
- package/dist/providers/typescript/modules/registry.d.ts +11 -0
- package/dist/providers/typescript/modules/registry.d.ts.map +1 -0
- package/dist/providers/typescript/modules/registry.js +37 -0
- package/dist/providers/typescript/modules/registry.js.map +1 -0
- package/dist/providers/typescript/modules/resend/ResendModule.d.ts +32 -0
- package/dist/providers/typescript/modules/resend/ResendModule.d.ts.map +1 -0
- package/dist/providers/typescript/modules/resend/ResendModule.js +71 -0
- package/dist/providers/typescript/modules/resend/ResendModule.js.map +1 -0
- package/dist/providers/typescript/modules/slack/SlackModule.d.ts +32 -0
- package/dist/providers/typescript/modules/slack/SlackModule.d.ts.map +1 -0
- package/dist/providers/typescript/modules/slack/SlackModule.js +51 -0
- package/dist/providers/typescript/modules/slack/SlackModule.js.map +1 -0
- package/dist/providers/typescript/modules/snowflake/SnowflakeModule.d.ts +20 -0
- package/dist/providers/typescript/modules/snowflake/SnowflakeModule.d.ts.map +1 -0
- package/dist/providers/typescript/modules/snowflake/SnowflakeModule.js +27 -0
- package/dist/providers/typescript/modules/snowflake/SnowflakeModule.js.map +1 -0
- package/dist/providers/typescript/modules/templateRenderer.d.ts +17 -0
- package/dist/providers/typescript/modules/templateRenderer.d.ts.map +1 -0
- package/dist/providers/typescript/modules/templateRenderer.js +64 -0
- package/dist/providers/typescript/modules/templateRenderer.js.map +1 -0
- package/dist/providers/typescript/modules/terse/TerseModule.d.ts +20 -0
- package/dist/providers/typescript/modules/terse/TerseModule.d.ts.map +1 -0
- package/dist/providers/typescript/modules/terse/TerseModule.js +62 -0
- package/dist/providers/typescript/modules/terse/TerseModule.js.map +1 -0
- package/dist/providers/typescript/modules/workos/WorkOSModule.d.ts +17 -0
- package/dist/providers/typescript/modules/workos/WorkOSModule.d.ts.map +1 -0
- package/dist/providers/typescript/modules/workos/WorkOSModule.js +30 -0
- package/dist/providers/typescript/modules/workos/WorkOSModule.js.map +1 -0
- package/dist/providers/typescript/prepareCodegenData.test.d.ts +2 -0
- package/dist/providers/typescript/prepareCodegenData.test.d.ts.map +1 -0
- package/dist/providers/typescript/prepareCodegenData.test.js +54 -0
- package/dist/providers/typescript/prepareCodegenData.test.js.map +1 -0
- package/dist/providers/typescript/projectedTypes.d.ts +11 -0
- package/dist/providers/typescript/projectedTypes.d.ts.map +1 -0
- package/dist/providers/typescript/projectedTypes.js +53 -0
- package/dist/providers/typescript/projectedTypes.js.map +1 -0
- package/dist/providers/typescript/projectionPrinter.d.ts +26 -0
- package/dist/providers/typescript/projectionPrinter.d.ts.map +1 -0
- package/dist/providers/typescript/projectionPrinter.js +110 -0
- package/dist/providers/typescript/projectionPrinter.js.map +1 -0
- package/dist/providers/typescript/replayLogDedupe.d.ts +6 -0
- package/dist/providers/typescript/replayLogDedupe.d.ts.map +1 -0
- package/dist/providers/typescript/replayLogDedupe.js +156 -0
- package/dist/providers/typescript/replayLogDedupe.js.map +1 -0
- package/dist/providers/typescript/templateEngine.d.ts +8 -2
- package/dist/providers/typescript/templateEngine.d.ts.map +1 -1
- package/dist/providers/typescript/templateEngine.js +241 -29
- package/dist/providers/typescript/templateEngine.js.map +1 -1
- package/dist/providers/typescript/triggerPayloads.d.ts +7 -0
- package/dist/providers/typescript/triggerPayloads.d.ts.map +1 -0
- package/dist/providers/typescript/triggerPayloads.js +60 -0
- package/dist/providers/typescript/triggerPayloads.js.map +1 -0
- package/dist/providers/typescript/triggerTypeDeclarations.d.ts +7 -0
- package/dist/providers/typescript/triggerTypeDeclarations.d.ts.map +1 -0
- package/dist/providers/typescript/triggerTypeDeclarations.js +42 -0
- package/dist/providers/typescript/triggerTypeDeclarations.js.map +1 -0
- package/dist/providers/typescript/triggerTypeRegistry.d.ts +7 -0
- package/dist/providers/typescript/triggerTypeRegistry.d.ts.map +1 -0
- package/dist/providers/typescript/triggerTypeRegistry.js +198 -0
- package/dist/providers/typescript/triggerTypeRegistry.js.map +1 -0
- package/dist/providers/typescript/typePrinter.d.ts +23 -0
- package/dist/providers/typescript/typePrinter.d.ts.map +1 -0
- package/dist/providers/typescript/typePrinter.js +123 -0
- package/dist/providers/typescript/typePrinter.js.map +1 -0
- package/dist/run.d.ts +2 -11
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +42 -153
- package/dist/run.js.map +1 -1
- package/dist/sampleEventId.d.ts +0 -4
- package/dist/sampleEventId.d.ts.map +1 -1
- package/dist/sampleEventId.js +0 -4
- package/dist/sampleEventId.js.map +1 -1
- package/dist/shared/ApiRoutes.d.ts +19 -0
- package/dist/shared/ApiRoutes.d.ts.map +1 -1
- package/dist/shared/ApiRoutes.js +17 -1
- package/dist/shared/ApiRoutes.js.map +1 -1
- package/dist/shared/Configs.d.ts +24 -2
- package/dist/shared/Configs.d.ts.map +1 -1
- package/dist/shared/Configs.js +32 -2
- package/dist/shared/Configs.js.map +1 -1
- package/dist/shared/Integrations.d.ts +18 -1
- package/dist/shared/Integrations.d.ts.map +1 -1
- package/dist/shared/Integrations.js +10 -1
- package/dist/shared/Integrations.js.map +1 -1
- package/dist/shared/InvalidationKeys.d.ts +1 -0
- package/dist/shared/InvalidationKeys.d.ts.map +1 -1
- package/dist/shared/InvalidationKeys.js +3 -0
- package/dist/shared/InvalidationKeys.js.map +1 -1
- package/dist/shared/ModelEvents.d.ts +9 -0
- package/dist/shared/ModelEvents.d.ts.map +1 -1
- package/dist/shared/ModelEvents.js +15 -0
- package/dist/shared/ModelEvents.js.map +1 -1
- package/dist/shared/ToolDisplayUtils.d.ts.map +1 -1
- package/dist/shared/ToolDisplayUtils.js +107 -11
- package/dist/shared/ToolDisplayUtils.js.map +1 -1
- package/dist/shared/types.d.ts +1013 -108
- package/dist/shared/types.d.ts.map +1 -1
- package/dist/shared/types.js.map +1 -1
- package/dist/test.d.ts +2 -1
- package/dist/test.d.ts.map +1 -1
- package/dist/test.js +43 -23
- package/dist/test.js.map +1 -1
- package/dist/triggerParseDetail.d.ts +8 -0
- package/dist/triggerParseDetail.d.ts.map +1 -0
- package/dist/triggerParseDetail.js +30 -0
- package/dist/triggerParseDetail.js.map +1 -0
- package/dist/util.d.ts +2 -3
- package/dist/util.d.ts.map +1 -1
- package/dist/util.js +3 -3
- package/dist/util.js.map +1 -1
- package/package.json +7 -5
- package/src/providers/typescript/modules/attio/attio.schemas.hbs +150 -0
- package/src/providers/typescript/modules/attio/attio.tools.hbs +192 -0
- package/src/providers/typescript/modules/attio/attio.triggers.hbs +130 -0
- package/src/providers/typescript/modules/datadog/datadog.tools.hbs +16 -0
- package/src/providers/typescript/modules/github/github.tools.hbs +68 -0
- package/src/providers/typescript/modules/github/github.triggers.hbs +40 -0
- package/src/providers/typescript/modules/gmail/gmail.tools.hbs +17 -0
- package/src/providers/typescript/modules/gmail/gmail.triggers.hbs +16 -0
- package/src/providers/typescript/modules/hey_reach/hey_reach.tools.hbs +9 -0
- package/src/providers/typescript/modules/hey_reach/hey_reach.triggers.hbs +56 -0
- package/src/providers/typescript/modules/launchdarkly/launchdarkly.tools.hbs +16 -0
- package/src/providers/typescript/modules/linear/linear.tools.hbs +23 -0
- package/src/providers/typescript/modules/linear/linear.triggers.hbs +24 -0
- package/src/providers/typescript/modules/notion/notion.tools.hbs +20 -0
- package/src/providers/typescript/modules/posthog/posthog.tools.hbs +28 -0
- package/{templates/typescript/codegen/partials/resend-section.hbs → src/providers/typescript/modules/resend/resend.tools.hbs} +17 -5
- package/src/providers/typescript/modules/slack/slack.tools.hbs +18 -0
- package/src/providers/typescript/modules/slack/slack.triggers.hbs +28 -0
- package/src/providers/typescript/modules/snowflake/snowflake.tools.hbs +12 -0
- package/src/providers/typescript/modules/terse/terse.tools.hbs +22 -0
- package/src/providers/typescript/modules/terse/terse.triggers.hbs +33 -0
- package/src/providers/typescript/modules/workos/workos.tools.hbs +12 -0
- package/src/providers/typescript/modules/workos/workos.triggers.hbs +64 -0
- package/templates/typescript/codegen/.impeccable/hook.cache.json +1 -0
- package/templates/typescript/codegen/common.hbs +6 -0
- package/templates/typescript/codegen/partials/tools-slice.hbs +18 -0
- package/templates/typescript/codegen/root.hbs +72 -0
- package/templates/typescript/codegen/sdk-primitives.hbs +42 -0
- package/dist/jsonOutput.d.ts +0 -19
- package/dist/jsonOutput.d.ts.map +0 -1
- package/dist/jsonOutput.js +0 -25
- package/dist/jsonOutput.js.map +0 -1
- package/dist/providers/typescript/parkSignals.d.ts +0 -7
- package/dist/providers/typescript/parkSignals.d.ts.map +0 -1
- package/dist/providers/typescript/parkSignals.js +0 -45
- package/dist/providers/typescript/parkSignals.js.map +0 -1
- package/dist/replay.d.ts +0 -3
- package/dist/replay.d.ts.map +0 -1
- package/dist/replay.js +0 -20
- package/dist/replay.js.map +0 -1
- package/dist/testRelay.d.ts +0 -6
- package/dist/testRelay.d.ts.map +0 -1
- package/dist/testRelay.js +0 -91
- package/dist/testRelay.js.map +0 -1
- package/dist/urls.d.ts +0 -3
- package/dist/urls.d.ts.map +0 -1
- package/dist/urls.js +0 -27
- package/dist/urls.js.map +0 -1
- package/templates/typescript/codegen/generated.hbs +0 -15
- package/templates/typescript/codegen/partials/attio-section.hbs +0 -86
- package/templates/typescript/codegen/partials/datadog-section.hbs +0 -3
- package/templates/typescript/codegen/partials/github-section.hbs +0 -30
- package/templates/typescript/codegen/partials/header.hbs +0 -17
- package/templates/typescript/codegen/partials/hey-reach-section.hbs +0 -3
- package/templates/typescript/codegen/partials/launchdarkly-section.hbs +0 -3
- package/templates/typescript/codegen/partials/linear-section.hbs +0 -5
- package/templates/typescript/codegen/partials/notion-section.hbs +0 -5
- package/templates/typescript/codegen/partials/posthog-section.hbs +0 -15
- package/templates/typescript/codegen/partials/skills-section.hbs +0 -105
- package/templates/typescript/codegen/partials/slack-section.hbs +0 -5
- package/templates/typescript/codegen/partials/tools-section.hbs +0 -94
- package/templates/typescript/codegen/partials/triggers-section.hbs +0 -353
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
{{#if toolFile}}
|
|
2
|
+
{{sectionHeader "Attio tools"}}
|
|
3
|
+
|
|
4
|
+
{{> tools-slice toolFile}}
|
|
5
|
+
|
|
6
|
+
{{/if}}
|
|
7
|
+
{{sectionHeader "Attio skill"}}
|
|
8
|
+
|
|
9
|
+
/** Attio — query and upsert records on a CRM object */
|
|
10
|
+
export function attioSkill(opts: { object: AttioObject<any> }): TypedSkill<{{{section.skillToolType}}}> {
|
|
11
|
+
return new AttioOutputConfig("{{escape section.id}}", opts.object.apiSlug)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
{{sectionHeader "Attio internals (generated plumbing — no need to read)"}}
|
|
15
|
+
|
|
16
|
+
{{#if toolFile}}
|
|
17
|
+
function __normalizeAttioObjectSlug(object: unknown): string {
|
|
18
|
+
if (object && typeof object === "object" && "apiSlug" in (object as Record<string, unknown>)) {
|
|
19
|
+
const apiSlug = (object as { apiSlug?: unknown }).apiSlug
|
|
20
|
+
if (typeof apiSlug === "string" && apiSlug.length > 0) return apiSlug
|
|
21
|
+
}
|
|
22
|
+
return typeof object === "string" ? object : ""
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function __serializeAttioFilter(filter: unknown): string | null {
|
|
26
|
+
if (filter === undefined || filter === null) return null
|
|
27
|
+
return JSON.stringify(filter)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function __serializeAttioValues(values: unknown): string {
|
|
31
|
+
return JSON.stringify(values ?? {})
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function __serializeAttioRecords(records: unknown): string {
|
|
35
|
+
if (!Array.isArray(records)) return JSON.stringify([])
|
|
36
|
+
return JSON.stringify(records.filter((record): record is Record<string, unknown> => typeof record === "object" && record !== null && !Array.isArray(record)))
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function __enhanceAttioRecord<TObject extends GeneratedAttioObject>(object: TObject, record: unknown): __AttioRecordWithValues<AttioRecordValuesFor<TObject>> | undefined {
|
|
40
|
+
if (!record || typeof record !== "object") return undefined
|
|
41
|
+
const values = __getAttioRecordValues<AttioRecordValuesFor<TObject>>(__normalizeAttioObjectSlug(object), record)
|
|
42
|
+
return { ...values, ...(record as AttioRecordBase), values, attributes: values } as __AttioRecordWithValues<AttioRecordValuesFor<TObject>>
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function __requireAttioPayload<T>(value: T | null | undefined, what: string): T {
|
|
46
|
+
if (value === null || value === undefined) throw new Error("Attio returned a response without the expected " + what + " payload.")
|
|
47
|
+
return value
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function __enhanceAttioQueryResult<TObject extends GeneratedAttioObject>(object: TObject, result: AttioRecordsResult): AttioQueryRecordsResult<TObject> {
|
|
51
|
+
const records = (result.records || []).map(record => __enhanceAttioRecord(object, record)).filter(Boolean) as Array<AttioRecordFor<TObject>>
|
|
52
|
+
return { records, count: records.length, offset: result.offset ?? 0 }
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function __enhanceAttioSearchResult(result: AttioRecordsResult): AttioSearchRecordsResult {
|
|
56
|
+
const matches = result.matches ?? []
|
|
57
|
+
return { matches, count: matches.length }
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function __enhanceAttioUpsertResult<TObject extends GeneratedAttioObject>(object: TObject, result: AttioRecordsResult): AttioUpsertRecordResult<TObject> {
|
|
61
|
+
const records = (result.records || []).map(record => __enhanceAttioRecord(object, record)).filter(Boolean) as Array<AttioRecordFor<TObject>>
|
|
62
|
+
return { records, count: records.length }
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function __enhanceAttioSingleRecordResult<TObject extends GeneratedAttioObject>(object: TObject, result: AttioRecordsResult): AttioSingleRecordResult<TObject> {
|
|
66
|
+
return __requireAttioPayload(__enhanceAttioRecord(object, result.record), "record")
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
{{/if}}
|
|
70
|
+
const __attioMetadataKeys = new Set([
|
|
71
|
+
"active_from",
|
|
72
|
+
"active_until",
|
|
73
|
+
"attribute_type",
|
|
74
|
+
"created_by_actor",
|
|
75
|
+
])
|
|
76
|
+
|
|
77
|
+
const __attioMultiValueAttributeSlugsByObject: Record<string, readonly string[]> = {
|
|
78
|
+
{{#each section.objects}}
|
|
79
|
+
"{{escape apiSlug}}": [{{{multiValueSlugsText}}}],
|
|
80
|
+
{{/each}}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const __attioObjectSlugByObjectId: Record<string, string> = {
|
|
84
|
+
{{#each section.objects}}
|
|
85
|
+
"{{escape objectId}}": "{{escape apiSlug}}",
|
|
86
|
+
{{/each}}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function __flattenAttioLeafValue(value: unknown): unknown {
|
|
90
|
+
if (value === null || value === undefined) return value
|
|
91
|
+
if (Array.isArray(value)) return value.map(entry => __flattenAttioLeafValue(entry))
|
|
92
|
+
if (typeof value !== "object") return value
|
|
93
|
+
const rawObject = value as Record<string, unknown>
|
|
94
|
+
if (rawObject.attribute_type === "status") return __toAttioSelectOption(rawObject.status)
|
|
95
|
+
if (rawObject.attribute_type === "select") return __toAttioSelectOption(rawObject.option)
|
|
96
|
+
if (typeof rawObject.full_name === "string") return rawObject.full_name
|
|
97
|
+
if (typeof rawObject.email_address === "string") return rawObject.email_address
|
|
98
|
+
if (typeof rawObject.domain === "string") return rawObject.domain
|
|
99
|
+
if (typeof rawObject.phone_number === "string") return rawObject.phone_number
|
|
100
|
+
if ("value" in rawObject) return __flattenAttioLeafValue(rawObject.value)
|
|
101
|
+
const dataEntries = Object.entries(rawObject).filter(([key]) => !__attioMetadataKeys.has(key))
|
|
102
|
+
if (dataEntries.length === 0) return rawObject
|
|
103
|
+
if (dataEntries.length === 1) return __flattenAttioLeafValue(dataEntries[0][1])
|
|
104
|
+
return Object.fromEntries(dataEntries.map(([key, entryValue]) => [key, __flattenAttioLeafValue(entryValue)]))
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function __toAttioSelectOption(option: unknown): unknown {
|
|
108
|
+
if (!option || typeof option !== "object") return option
|
|
109
|
+
const rawOption = option as Record<string, unknown>
|
|
110
|
+
const rawId = rawOption.id && typeof rawOption.id === "object" ? (rawOption.id as Record<string, unknown>) : undefined
|
|
111
|
+
const id = rawId?.status_id ?? rawId?.option_id ?? rawOption.id
|
|
112
|
+
return {
|
|
113
|
+
id: typeof id === "string" ? id : "",
|
|
114
|
+
title: typeof rawOption.title === "string" ? rawOption.title : "",
|
|
115
|
+
is_archived: rawOption.is_archived === true,
|
|
116
|
+
} satisfies AttioSelectOption
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function __flattenAttioAttributeValue(rawValue: unknown, preferArray: boolean): unknown {
|
|
120
|
+
if (!Array.isArray(rawValue)) return __flattenAttioLeafValue(rawValue)
|
|
121
|
+
const flattened = rawValue.map(entry => __flattenAttioLeafValue(entry)).filter(entry => entry !== undefined)
|
|
122
|
+
return preferArray ? flattened : flattened[0]
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function __isAttioMultiValueAttribute(objectSlug: string, attributeSlug: string): boolean {
|
|
126
|
+
return (__attioMultiValueAttributeSlugsByObject[objectSlug] || []).includes(attributeSlug)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function __getAttioRecordValues<TValues extends Record<string, unknown>>(objectSlug: string, record: unknown): TValues {
|
|
130
|
+
const rawValues = record && typeof record === "object" ? (record as { values?: unknown }).values : undefined
|
|
131
|
+
if (!rawValues || typeof rawValues !== "object" || Array.isArray(rawValues)) return {} as TValues
|
|
132
|
+
const flattenedValues: Record<string, unknown> = {}
|
|
133
|
+
for (const [attributeSlug, rawValue] of Object.entries(rawValues)) {
|
|
134
|
+
flattenedValues[attributeSlug] = __flattenAttioAttributeValue(rawValue, __isAttioMultiValueAttribute(objectSlug, attributeSlug))
|
|
135
|
+
}
|
|
136
|
+
return flattenedValues as TValues
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const __attioMultiValueEntrySlugsByList: Record<string, readonly string[]> = {
|
|
140
|
+
{{#each section.lists}}
|
|
141
|
+
"{{escape apiSlug}}": [{{{multiValueSlugsText}}}],
|
|
142
|
+
"{{escape listId}}": [{{{multiValueSlugsText}}}],
|
|
143
|
+
{{/each}}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function __getAttioEntryValues<TValues extends Record<string, unknown>>(listKey: string, rawEntryValues: unknown): TValues {
|
|
147
|
+
if (!rawEntryValues || typeof rawEntryValues !== "object" || Array.isArray(rawEntryValues)) return {} as TValues
|
|
148
|
+
const flattenedValues: Record<string, unknown> = {}
|
|
149
|
+
const multiValueSlugs = __attioMultiValueEntrySlugsByList[listKey] || []
|
|
150
|
+
for (const [attributeSlug, rawValue] of Object.entries(rawEntryValues)) {
|
|
151
|
+
flattenedValues[attributeSlug] = __flattenAttioAttributeValue(rawValue, multiValueSlugs.includes(attributeSlug))
|
|
152
|
+
}
|
|
153
|
+
return flattenedValues as TValues
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function __requireAttioListParentObject(list: unknown, parentObjectSlug: string | null | undefined): string {
|
|
157
|
+
if (parentObjectSlug) return parentObjectSlug
|
|
158
|
+
if (list && typeof list === "object" && "parentObject" in (list as Record<string, unknown>)) {
|
|
159
|
+
const parentObject = (list as { parentObject?: unknown }).parentObject
|
|
160
|
+
if (typeof parentObject === "string" && parentObject.length > 0) return parentObject
|
|
161
|
+
}
|
|
162
|
+
throw new Error("parentObjectSlug is required when the list is passed as a plain ID/slug rather than a generated AttioList constant.")
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function __enhanceAttioListEntry<TList>(list: TList, entry: unknown): AttioListEntryFor<TList> {
|
|
166
|
+
const raw = (entry && typeof entry === "object" ? entry : {}) as { entry_values?: unknown }
|
|
167
|
+
return { ...(raw as object), entry_values: __getAttioEntryValues(__normalizeAttioObjectSlug(list), raw.entry_values) } as AttioListEntryFor<TList>
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
function __enhanceAttioListEntriesResult<TList>(list: TList, result: AttioListsResult): AttioListEntriesResult<TList> {
|
|
171
|
+
const entries = (result.entries || []).map(entry => __enhanceAttioListEntry(list, entry))
|
|
172
|
+
return { entries, count: entries.length, offset: result.offset ?? 0 }
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function __enhanceAttioListEntryResult<TList>(list: TList, result: AttioListsResult): AttioListEntryResult<TList> {
|
|
176
|
+
if (!result.entry) throw new Error("Attio returned a response without the expected list entry payload.")
|
|
177
|
+
return __enhanceAttioListEntry(list, result.entry)
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function __enhanceAttioHistoryResult<TValue>(result: AttioRecordsResult): AttioAttributeHistoryResult<TValue> {
|
|
181
|
+
const history = (result.history || []).map(entry => ({ active_from: entry.active_from, active_until: entry.active_until, value: __flattenAttioLeafValue(entry) as TValue }))
|
|
182
|
+
return { history, count: history.length }
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
registerEventTransform("attio", (event) => {
|
|
186
|
+
const e = event as { record?: { values?: unknown }; resourceIds?: { object_id?: string } }
|
|
187
|
+
if (!e?.record?.values) return event
|
|
188
|
+
const objectId = e.resourceIds?.object_id
|
|
189
|
+
const slug = objectId ? __attioObjectSlugByObjectId[objectId] : undefined
|
|
190
|
+
if (!slug) return event
|
|
191
|
+
return { ...e, record: { ...e.record, values: __getAttioRecordValues(slug, e.record) } }
|
|
192
|
+
})
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
{{sectionHeader "Attio triggers"}}
|
|
2
|
+
|
|
3
|
+
{{#each triggerDeclarations}}
|
|
4
|
+
{{{this}}}
|
|
5
|
+
|
|
6
|
+
{{/each}}
|
|
7
|
+
{{#each section.recordTriggerAliases}}
|
|
8
|
+
{{{this}}}
|
|
9
|
+
{{/each}}
|
|
10
|
+
|
|
11
|
+
function attioParentObjectFilter(object: GeneratedAttioObject | undefined) {
|
|
12
|
+
if (!object) return null
|
|
13
|
+
return { $and: [{ field: "id.object_id", operator: "equals" as const, value: object.objectId }] }
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const attioTriggers = {
|
|
17
|
+
/** Trigger when a call recording is created */
|
|
18
|
+
onCallRecordingCreated(): TypedTrigger<AttioCallRecordingCreatedTrigger> {
|
|
19
|
+
return new AttioInputConfig("{{escape section.id}}", [{ eventType: AttioEventType.CALL_RECORDING_CREATED }])
|
|
20
|
+
},
|
|
21
|
+
/** Trigger when a comment is created */
|
|
22
|
+
onCommentCreated(): TypedTrigger<AttioCommentCreatedTrigger> {
|
|
23
|
+
return new AttioInputConfig("{{escape section.id}}", [{ eventType: AttioEventType.COMMENT_CREATED }])
|
|
24
|
+
},
|
|
25
|
+
/** Trigger when a comment is resolved */
|
|
26
|
+
onCommentResolved(): TypedTrigger<AttioCommentResolvedTrigger> {
|
|
27
|
+
return new AttioInputConfig("{{escape section.id}}", [{ eventType: AttioEventType.COMMENT_RESOLVED }])
|
|
28
|
+
},
|
|
29
|
+
/** Trigger when a comment is unresolved */
|
|
30
|
+
onCommentUnresolved(): TypedTrigger<AttioCommentUnresolvedTrigger> {
|
|
31
|
+
return new AttioInputConfig("{{escape section.id}}", [{ eventType: AttioEventType.COMMENT_UNRESOLVED }])
|
|
32
|
+
},
|
|
33
|
+
/** Trigger when a comment is deleted */
|
|
34
|
+
onCommentDeleted(): TypedTrigger<AttioCommentDeletedTrigger> {
|
|
35
|
+
return new AttioInputConfig("{{escape section.id}}", [{ eventType: AttioEventType.COMMENT_DELETED }])
|
|
36
|
+
},
|
|
37
|
+
/** Trigger when a list is created */
|
|
38
|
+
onListCreated(): TypedTrigger<AttioListCreatedTrigger> {
|
|
39
|
+
return new AttioInputConfig("{{escape section.id}}", [{ eventType: AttioEventType.LIST_CREATED }])
|
|
40
|
+
},
|
|
41
|
+
/** Trigger when a list is updated */
|
|
42
|
+
onListUpdated(): TypedTrigger<AttioListUpdatedTrigger> {
|
|
43
|
+
return new AttioInputConfig("{{escape section.id}}", [{ eventType: AttioEventType.LIST_UPDATED }])
|
|
44
|
+
},
|
|
45
|
+
/** Trigger when a list is deleted */
|
|
46
|
+
onListDeleted(): TypedTrigger<AttioListDeletedTrigger> {
|
|
47
|
+
return new AttioInputConfig("{{escape section.id}}", [{ eventType: AttioEventType.LIST_DELETED }])
|
|
48
|
+
},
|
|
49
|
+
/** Trigger when a list attribute is created */
|
|
50
|
+
onListAttributeCreated(): TypedTrigger<AttioListAttributeCreatedTrigger> {
|
|
51
|
+
return new AttioInputConfig("{{escape section.id}}", [{ eventType: AttioEventType.LIST_ATTRIBUTE_CREATED }])
|
|
52
|
+
},
|
|
53
|
+
/** Trigger when a list attribute is updated */
|
|
54
|
+
onListAttributeUpdated(): TypedTrigger<AttioListAttributeUpdatedTrigger> {
|
|
55
|
+
return new AttioInputConfig("{{escape section.id}}", [{ eventType: AttioEventType.LIST_ATTRIBUTE_UPDATED }])
|
|
56
|
+
},
|
|
57
|
+
/** Trigger when a list entry is created */
|
|
58
|
+
onListEntryCreated(): TypedTrigger<AttioListEntryCreatedTrigger> {
|
|
59
|
+
return new AttioInputConfig("{{escape section.id}}", [{ eventType: AttioEventType.LIST_ENTRY_CREATED }])
|
|
60
|
+
},
|
|
61
|
+
/** Trigger when a list entry is updated */
|
|
62
|
+
onListEntryUpdated(): TypedTrigger<AttioListEntryUpdatedTrigger> {
|
|
63
|
+
return new AttioInputConfig("{{escape section.id}}", [{ eventType: AttioEventType.LIST_ENTRY_UPDATED }])
|
|
64
|
+
},
|
|
65
|
+
/** Trigger when a list entry is deleted */
|
|
66
|
+
onListEntryDeleted(): TypedTrigger<AttioListEntryDeletedTrigger> {
|
|
67
|
+
return new AttioInputConfig("{{escape section.id}}", [{ eventType: AttioEventType.LIST_ENTRY_DELETED }])
|
|
68
|
+
},
|
|
69
|
+
/** Trigger when an object attribute is created */
|
|
70
|
+
onObjectAttributeCreated(): TypedTrigger<AttioObjectAttributeCreatedTrigger> {
|
|
71
|
+
return new AttioInputConfig("{{escape section.id}}", [{ eventType: AttioEventType.OBJECT_ATTRIBUTE_CREATED }])
|
|
72
|
+
},
|
|
73
|
+
/** Trigger when an object attribute is updated */
|
|
74
|
+
onObjectAttributeUpdated(): TypedTrigger<AttioObjectAttributeUpdatedTrigger> {
|
|
75
|
+
return new AttioInputConfig("{{escape section.id}}", [{ eventType: AttioEventType.OBJECT_ATTRIBUTE_UPDATED }])
|
|
76
|
+
},
|
|
77
|
+
/** Trigger when a note is created */
|
|
78
|
+
onNoteCreated(): TypedTrigger<AttioNoteCreatedTrigger> {
|
|
79
|
+
return new AttioInputConfig("{{escape section.id}}", [{ eventType: AttioEventType.NOTE_CREATED }])
|
|
80
|
+
},
|
|
81
|
+
/** Trigger when a note's content is updated */
|
|
82
|
+
onNoteContentUpdated(): TypedTrigger<AttioNoteContentUpdatedTrigger> {
|
|
83
|
+
return new AttioInputConfig("{{escape section.id}}", [{ eventType: AttioEventType.NOTE_CONTENT_UPDATED }])
|
|
84
|
+
},
|
|
85
|
+
/** Trigger when a note is updated */
|
|
86
|
+
onNoteUpdated(): TypedTrigger<AttioNoteUpdatedTrigger> {
|
|
87
|
+
return new AttioInputConfig("{{escape section.id}}", [{ eventType: AttioEventType.NOTE_UPDATED }])
|
|
88
|
+
},
|
|
89
|
+
/** Trigger when a note is deleted */
|
|
90
|
+
onNoteDeleted(): TypedTrigger<AttioNoteDeletedTrigger> {
|
|
91
|
+
return new AttioInputConfig("{{escape section.id}}", [{ eventType: AttioEventType.NOTE_DELETED }])
|
|
92
|
+
},
|
|
93
|
+
/** Trigger when a record is created. Pass `object` to scope to a specific Attio object. */
|
|
94
|
+
onRecordCreated<T extends GeneratedAttioObject = never>(opts?: { object: T }): TypedTrigger<AttioRecordCreatedTrigger<[T] extends [never] ? GeneratedAttioObject["__recordValues"] : T["__recordValues"]>> {
|
|
95
|
+
return new AttioInputConfig("{{escape section.id}}", [{ eventType: AttioEventType.RECORD_CREATED, filter: attioParentObjectFilter(opts?.object) }])
|
|
96
|
+
},
|
|
97
|
+
/** Trigger when records are merged. Pass `object` to scope to a specific Attio object. */
|
|
98
|
+
onRecordMerged<T extends GeneratedAttioObject = never>(opts?: { object: T }): TypedTrigger<AttioRecordMergedTrigger<[T] extends [never] ? GeneratedAttioObject["__recordValues"] : T["__recordValues"]>> {
|
|
99
|
+
return new AttioInputConfig("{{escape section.id}}", [{ eventType: AttioEventType.RECORD_MERGED, filter: attioParentObjectFilter(opts?.object) }])
|
|
100
|
+
},
|
|
101
|
+
/** Trigger when a record is updated. Pass `object` to scope to a specific Attio object. */
|
|
102
|
+
onRecordUpdated<T extends GeneratedAttioObject = never>(opts?: { object: T }): TypedTrigger<AttioRecordUpdatedTrigger<[T] extends [never] ? GeneratedAttioObject["__recordValues"] : T["__recordValues"]>> {
|
|
103
|
+
return new AttioInputConfig("{{escape section.id}}", [{ eventType: AttioEventType.RECORD_UPDATED, filter: attioParentObjectFilter(opts?.object) }])
|
|
104
|
+
},
|
|
105
|
+
/** Trigger when a record is deleted. Pass `object` to scope to a specific Attio object. */
|
|
106
|
+
onRecordDeleted(opts?: { object?: GeneratedAttioObject }): TypedTrigger<AttioRecordDeletedTrigger> {
|
|
107
|
+
return new AttioInputConfig("{{escape section.id}}", [{ eventType: AttioEventType.RECORD_DELETED, filter: attioParentObjectFilter(opts?.object) }])
|
|
108
|
+
},
|
|
109
|
+
/** Trigger when a task is created */
|
|
110
|
+
onTaskCreated(): TypedTrigger<AttioTaskCreatedTrigger> {
|
|
111
|
+
return new AttioInputConfig("{{escape section.id}}", [{ eventType: AttioEventType.TASK_CREATED }])
|
|
112
|
+
},
|
|
113
|
+
/** Trigger when a task is updated */
|
|
114
|
+
onTaskUpdated(): TypedTrigger<AttioTaskUpdatedTrigger> {
|
|
115
|
+
return new AttioInputConfig("{{escape section.id}}", [{ eventType: AttioEventType.TASK_UPDATED }])
|
|
116
|
+
},
|
|
117
|
+
/** Trigger when a task is deleted */
|
|
118
|
+
onTaskDeleted(): TypedTrigger<AttioTaskDeletedTrigger> {
|
|
119
|
+
return new AttioInputConfig("{{escape section.id}}", [{ eventType: AttioEventType.TASK_DELETED }])
|
|
120
|
+
},
|
|
121
|
+
/** Trigger when a workspace member is added */
|
|
122
|
+
onWorkspaceMemberCreated(): TypedTrigger<AttioWorkspaceMemberCreatedTrigger> {
|
|
123
|
+
return new AttioInputConfig("{{escape section.id}}", [{ eventType: AttioEventType.WORKSPACE_MEMBER_CREATED }])
|
|
124
|
+
},
|
|
125
|
+
/** Trigger on one or more Attio event types. Pass `object` to scope record events to a specific Attio object. */
|
|
126
|
+
trigger(opts: { eventTypes: AttioEventType[]; object?: GeneratedAttioObject }): TypedTrigger<AttioTrigger> {
|
|
127
|
+
const filter = attioParentObjectFilter(opts.object)
|
|
128
|
+
return new AttioInputConfig("{{escape section.id}}", opts.eventTypes.map(eventType => ({ eventType, filter })))
|
|
129
|
+
},
|
|
130
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{{sectionHeader "Datadog resources"}}
|
|
2
|
+
|
|
3
|
+
{{> resource-class section.indexClass}}
|
|
4
|
+
|
|
5
|
+
{{#if toolFile}}
|
|
6
|
+
{{sectionHeader "Datadog tools"}}
|
|
7
|
+
|
|
8
|
+
{{> tools-slice toolFile}}
|
|
9
|
+
|
|
10
|
+
{{/if}}
|
|
11
|
+
{{sectionHeader "Datadog skill"}}
|
|
12
|
+
|
|
13
|
+
/** Datadog — search and analyze logs, optionally scoped to specific indexes */
|
|
14
|
+
export function datadogSkill(opts?: { indexes?: DatadogIndex[] }): TypedSkill<{{{section.skillToolType}}}> {
|
|
15
|
+
return new DatadogConfig("{{escape section.id}}", opts?.indexes?.map(i => i.name))
|
|
16
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{{sectionHeader "GitHub resources"}}
|
|
2
|
+
|
|
3
|
+
export class GithubOwner {
|
|
4
|
+
constructor(public readonly name: string) {}
|
|
5
|
+
{{#if section.owners.length}}
|
|
6
|
+
|
|
7
|
+
{{#each section.owners}}
|
|
8
|
+
static {{staticName}} = new GithubOwner("{{escape name}}")
|
|
9
|
+
{{/each}}
|
|
10
|
+
{{/if}}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export class Repos {
|
|
14
|
+
constructor(
|
|
15
|
+
public readonly repositoryId: number,
|
|
16
|
+
public readonly name: string,
|
|
17
|
+
public readonly owner: GithubOwner,
|
|
18
|
+
public readonly fullName: string
|
|
19
|
+
) {}
|
|
20
|
+
{{#if section.repoGroups.length}}
|
|
21
|
+
|
|
22
|
+
{{#each section.repoGroups}}
|
|
23
|
+
static {{ownerStaticName}} = {
|
|
24
|
+
{{#each repos}}
|
|
25
|
+
{{staticName}}: new Repos({{id}}, "{{escape name}}", GithubOwner.{{../ownerStaticName}}, "{{escape fullName}}"),
|
|
26
|
+
{{/each}}
|
|
27
|
+
} as const
|
|
28
|
+
{{/each}}
|
|
29
|
+
{{/if}}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
{{#if repoMappings.length}}
|
|
33
|
+
const __githubRepoNameToFullName = new Map<string, string>([
|
|
34
|
+
{{#each repoMappings}}
|
|
35
|
+
["{{escape name}}", "{{escape fullName}}"],
|
|
36
|
+
{{/each}}
|
|
37
|
+
])
|
|
38
|
+
|
|
39
|
+
function __normalizeGitHubRepos(repo: unknown): string {
|
|
40
|
+
if (repo && typeof repo === "object" && "fullName" in (repo as Record<string, unknown>)) {
|
|
41
|
+
const fullName = (repo as { fullName?: unknown }).fullName
|
|
42
|
+
if (typeof fullName === "string" && fullName.length > 0) return fullName
|
|
43
|
+
}
|
|
44
|
+
if (typeof repo === "string") {
|
|
45
|
+
if (repo.includes("/")) return repo
|
|
46
|
+
return __githubRepoNameToFullName.get(repo) ?? repo
|
|
47
|
+
}
|
|
48
|
+
return String(repo ?? "")
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function __normalizeGitHubReposNames(repositories: unknown): string[] {
|
|
52
|
+
if (!Array.isArray(repositories)) return []
|
|
53
|
+
return repositories.map(repo => __normalizeGitHubRepos(repo))
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
{{/if}}
|
|
57
|
+
{{#if toolFile}}
|
|
58
|
+
{{sectionHeader "GitHub tools"}}
|
|
59
|
+
|
|
60
|
+
{{> tools-slice toolFile}}
|
|
61
|
+
|
|
62
|
+
{{/if}}
|
|
63
|
+
{{sectionHeader "GitHub skill"}}
|
|
64
|
+
|
|
65
|
+
/** GitHub — read code and pull requests from the given repositories */
|
|
66
|
+
export function githubSkill(opts: { repos: Repos[] }): TypedSkill<{{{section.skillToolType}}}> {
|
|
67
|
+
return new GitHubConfig("{{escape section.id}}", opts.repos.map(r => r.repositoryId))
|
|
68
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{{sectionHeader "GitHub triggers"}}
|
|
2
|
+
|
|
3
|
+
{{#each triggerDeclarations}}
|
|
4
|
+
{{{this}}}
|
|
5
|
+
|
|
6
|
+
{{/each}}
|
|
7
|
+
export const githubTriggers = {
|
|
8
|
+
/** Trigger on push to a repository */
|
|
9
|
+
onPush(opts: { repo: Repos }): TypedTrigger<GithubPushTrigger> {
|
|
10
|
+
return new GitHubConfig("{{escape section.id}}", [opts.repo.repositoryId], [GitHubEventType.PUSH])
|
|
11
|
+
},
|
|
12
|
+
/** Trigger when a pull request is opened */
|
|
13
|
+
onPROpened(opts: { repo: Repos }): TypedTrigger<GithubPROpenedTrigger> {
|
|
14
|
+
return new GitHubConfig("{{escape section.id}}", [opts.repo.repositoryId], [GitHubEventType.PR_OPENED])
|
|
15
|
+
},
|
|
16
|
+
/** Trigger when a pull request is merged */
|
|
17
|
+
onPRMerged(opts: { repo: Repos }): TypedTrigger<GithubPRMergedTrigger> {
|
|
18
|
+
return new GitHubConfig("{{escape section.id}}", [opts.repo.repositoryId], [GitHubEventType.PR_MERGED])
|
|
19
|
+
},
|
|
20
|
+
/** Trigger when a pull request is closed */
|
|
21
|
+
onPRClosed(opts: { repo: Repos }): TypedTrigger<GithubPRClosedTrigger> {
|
|
22
|
+
return new GitHubConfig("{{escape section.id}}", [opts.repo.repositoryId], [GitHubEventType.PR_CLOSED])
|
|
23
|
+
},
|
|
24
|
+
/** Trigger when a pull request is synchronized */
|
|
25
|
+
onPRSynchronized(opts: { repo: Repos }): TypedTrigger<GithubPRSynchronizedTrigger> {
|
|
26
|
+
return new GitHubConfig("{{escape section.id}}", [opts.repo.repositoryId], [GitHubEventType.PR_SYNCHRONIZE])
|
|
27
|
+
},
|
|
28
|
+
/** Trigger on any pull request event */
|
|
29
|
+
onPR(opts: { repo: Repos }): TypedTrigger<GithubPRTrigger> {
|
|
30
|
+
return new GitHubConfig("{{escape section.id}}", [opts.repo.repositoryId], [GitHubEventType.PR_OPENED, GitHubEventType.PR_MERGED, GitHubEventType.PR_CLOSED, GitHubEventType.PR_SYNCHRONIZE])
|
|
31
|
+
},
|
|
32
|
+
/** Trigger when a comment is created on an issue or pull request */
|
|
33
|
+
onIssueComment(opts: { repo: Repos }): TypedTrigger<GithubIssueCommentCreatedTrigger> {
|
|
34
|
+
return new GitHubConfig("{{escape section.id}}", [opts.repo.repositoryId], [GitHubEventType.ISSUE_COMMENT_CREATED])
|
|
35
|
+
},
|
|
36
|
+
/** Trigger on specific GitHub events for the given repositories */
|
|
37
|
+
trigger(opts: { repos: Repos[]; eventTypes?: GitHubEventType[] }): TypedTrigger<GithubTrigger> {
|
|
38
|
+
return new GitHubConfig("{{escape section.id}}", opts.repos.map(r => r.repositoryId), opts.eventTypes)
|
|
39
|
+
},
|
|
40
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{{#if toolFile}}
|
|
2
|
+
{{sectionHeader "Gmail tools"}}
|
|
3
|
+
|
|
4
|
+
{{> tools-slice toolFile}}
|
|
5
|
+
|
|
6
|
+
{{/if}}
|
|
7
|
+
{{sectionHeader "Gmail skills"}}
|
|
8
|
+
|
|
9
|
+
/** Gmail — send emails */
|
|
10
|
+
export function gmailSkill(): TypedSkill<{{{section.skillToolType}}}> {
|
|
11
|
+
return new GmailOutputConfig("{{escape section.id}}")
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** Gmail — create draft emails (no auto-send) */
|
|
15
|
+
export function gmailDraftSkill(): TypedSkill<{{{section.skillToolType}}}> {
|
|
16
|
+
return new GmailDraftOutputConfig("{{escape section.id}}")
|
|
17
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{{sectionHeader "Gmail triggers"}}
|
|
2
|
+
|
|
3
|
+
{{#each triggerDeclarations}}
|
|
4
|
+
{{{this}}}
|
|
5
|
+
|
|
6
|
+
{{/each}}
|
|
7
|
+
export const gmailTriggers = {
|
|
8
|
+
/** Trigger when a new email is received */
|
|
9
|
+
onEmail(): TypedTrigger<GmailTrigger> {
|
|
10
|
+
return new GmailConfig("{{escape section.id}}", [GmailEventType.EMAIL_RECEIVED])
|
|
11
|
+
},
|
|
12
|
+
/** Trigger on all Gmail events */
|
|
13
|
+
trigger(opts?: { eventTypes?: GmailEventType[] }): TypedTrigger<GmailTrigger> {
|
|
14
|
+
return new GmailConfig("{{escape section.id}}", opts?.eventTypes)
|
|
15
|
+
},
|
|
16
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{{sectionHeader "HeyReach triggers"}}
|
|
2
|
+
|
|
3
|
+
{{#each triggerDeclarations}}
|
|
4
|
+
{{{this}}}
|
|
5
|
+
|
|
6
|
+
{{/each}}
|
|
7
|
+
export const heyReachTriggers = {
|
|
8
|
+
/** Trigger when a connection request is sent */
|
|
9
|
+
onConnectionRequestSent(opts?: { campaigns?: HeyReachCampaign[] }): TypedTrigger<HeyReachConnectionRequestSentTrigger> {
|
|
10
|
+
return new HeyReachInputConfig("{{escape section.id}}", HeyReachEventType.CONNECTION_REQUEST_SENT, (opts?.campaigns ?? []).map(c => c.campaignId))
|
|
11
|
+
},
|
|
12
|
+
/** Trigger when a connection request is accepted */
|
|
13
|
+
onConnectionRequestAccepted(opts?: { campaigns?: HeyReachCampaign[] }): TypedTrigger<HeyReachConnectionRequestAcceptedTrigger> {
|
|
14
|
+
return new HeyReachInputConfig("{{escape section.id}}", HeyReachEventType.CONNECTION_REQUEST_ACCEPTED, (opts?.campaigns ?? []).map(c => c.campaignId))
|
|
15
|
+
},
|
|
16
|
+
/** Trigger when a LinkedIn message is sent */
|
|
17
|
+
onMessageSent(opts?: { campaigns?: HeyReachCampaign[] }): TypedTrigger<HeyReachMessageSentTrigger> {
|
|
18
|
+
return new HeyReachInputConfig("{{escape section.id}}", HeyReachEventType.MESSAGE_SENT, (opts?.campaigns ?? []).map(c => c.campaignId))
|
|
19
|
+
},
|
|
20
|
+
/** Trigger on the first reply to a LinkedIn message */
|
|
21
|
+
onMessageReplyReceived(opts?: { campaigns?: HeyReachCampaign[] }): TypedTrigger<HeyReachMessageReplyReceivedTrigger> {
|
|
22
|
+
return new HeyReachInputConfig("{{escape section.id}}", HeyReachEventType.MESSAGE_REPLY_RECEIVED, (opts?.campaigns ?? []).map(c => c.campaignId))
|
|
23
|
+
},
|
|
24
|
+
/** Trigger when an InMail is sent */
|
|
25
|
+
onInmailSent(opts?: { campaigns?: HeyReachCampaign[] }): TypedTrigger<HeyReachInmailSentTrigger> {
|
|
26
|
+
return new HeyReachInputConfig("{{escape section.id}}", HeyReachEventType.INMAIL_SENT, (opts?.campaigns ?? []).map(c => c.campaignId))
|
|
27
|
+
},
|
|
28
|
+
/** Trigger on the first reply to an InMail */
|
|
29
|
+
onInmailReplyReceived(opts?: { campaigns?: HeyReachCampaign[] }): TypedTrigger<HeyReachInmailReplyReceivedTrigger> {
|
|
30
|
+
return new HeyReachInputConfig("{{escape section.id}}", HeyReachEventType.INMAIL_REPLY_RECEIVED, (opts?.campaigns ?? []).map(c => c.campaignId))
|
|
31
|
+
},
|
|
32
|
+
/** Trigger when a follow is sent */
|
|
33
|
+
onFollowSent(opts?: { campaigns?: HeyReachCampaign[] }): TypedTrigger<HeyReachFollowSentTrigger> {
|
|
34
|
+
return new HeyReachInputConfig("{{escape section.id}}", HeyReachEventType.FOLLOW_SENT, (opts?.campaigns ?? []).map(c => c.campaignId))
|
|
35
|
+
},
|
|
36
|
+
/** Trigger when a post is liked */
|
|
37
|
+
onLikedPost(opts?: { campaigns?: HeyReachCampaign[] }): TypedTrigger<HeyReachLikedPostTrigger> {
|
|
38
|
+
return new HeyReachInputConfig("{{escape section.id}}", HeyReachEventType.LIKED_POST, (opts?.campaigns ?? []).map(c => c.campaignId))
|
|
39
|
+
},
|
|
40
|
+
/** Trigger when a profile is viewed */
|
|
41
|
+
onViewedProfile(opts?: { campaigns?: HeyReachCampaign[] }): TypedTrigger<HeyReachViewedProfileTrigger> {
|
|
42
|
+
return new HeyReachInputConfig("{{escape section.id}}", HeyReachEventType.VIEWED_PROFILE, (opts?.campaigns ?? []).map(c => c.campaignId))
|
|
43
|
+
},
|
|
44
|
+
/** Trigger when a campaign completes */
|
|
45
|
+
onCampaignCompleted(opts?: { campaigns?: HeyReachCampaign[] }): TypedTrigger<HeyReachCampaignCompletedTrigger> {
|
|
46
|
+
return new HeyReachInputConfig("{{escape section.id}}", HeyReachEventType.CAMPAIGN_COMPLETED, (opts?.campaigns ?? []).map(c => c.campaignId))
|
|
47
|
+
},
|
|
48
|
+
/** Trigger when lead tags are updated */
|
|
49
|
+
onLeadTagUpdated(opts?: { campaigns?: HeyReachCampaign[] }): TypedTrigger<HeyReachLeadTagUpdatedTrigger> {
|
|
50
|
+
return new HeyReachInputConfig("{{escape section.id}}", HeyReachEventType.LEAD_TAG_UPDATED, (opts?.campaigns ?? []).map(c => c.campaignId))
|
|
51
|
+
},
|
|
52
|
+
/** Trigger on specific HeyReach event types */
|
|
53
|
+
trigger(opts: { campaigns?: HeyReachCampaign[]; eventType: HeyReachEventType }): TypedTrigger<HeyReachTrigger> {
|
|
54
|
+
return new HeyReachInputConfig("{{escape section.id}}", opts.eventType, (opts.campaigns ?? []).map(c => c.campaignId))
|
|
55
|
+
},
|
|
56
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{{sectionHeader "LaunchDarkly resources"}}
|
|
2
|
+
|
|
3
|
+
{{> resource-class section.projectClass}}
|
|
4
|
+
|
|
5
|
+
{{#if toolFile}}
|
|
6
|
+
{{sectionHeader "LaunchDarkly tools"}}
|
|
7
|
+
|
|
8
|
+
{{> tools-slice toolFile}}
|
|
9
|
+
|
|
10
|
+
{{/if}}
|
|
11
|
+
{{sectionHeader "LaunchDarkly skill"}}
|
|
12
|
+
|
|
13
|
+
/** LaunchDarkly — read and toggle feature flags in a project + environments */
|
|
14
|
+
export function launchDarklySkill(opts: { project: LaunchDarklyProject; environmentKeys: string[] }): TypedSkill<{{{section.skillToolType}}}> {
|
|
15
|
+
return new LaunchDarklyConfig("{{escape section.id}}", opts.project.projectKey, opts.environmentKeys)
|
|
16
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{{sectionHeader "Linear resources"}}
|
|
2
|
+
|
|
3
|
+
{{> resource-class section.teamClass}}
|
|
4
|
+
|
|
5
|
+
{{> resource-class section.projectClass}}
|
|
6
|
+
|
|
7
|
+
{{#if toolFile}}
|
|
8
|
+
{{sectionHeader "Linear tools"}}
|
|
9
|
+
|
|
10
|
+
{{> tools-slice toolFile}}
|
|
11
|
+
|
|
12
|
+
{{/if}}
|
|
13
|
+
{{sectionHeader "Linear skill"}}
|
|
14
|
+
|
|
15
|
+
/** Linear — read and write issues, optionally scoped to a team or project */
|
|
16
|
+
export function linearSkill(opts?: { team?: LinearTeam; project?: LinearProject }): TypedSkill<{{{section.skillToolType}}}> {
|
|
17
|
+
return new LinearOutputConfig(
|
|
18
|
+
"{{escape section.id}}",
|
|
19
|
+
opts?.team?.teamId ?? null,
|
|
20
|
+
opts?.team?.name ?? null,
|
|
21
|
+
opts?.project?.projectId ?? null
|
|
22
|
+
)
|
|
23
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{{sectionHeader "Linear triggers"}}
|
|
2
|
+
|
|
3
|
+
{{#each triggerDeclarations}}
|
|
4
|
+
{{{this}}}
|
|
5
|
+
|
|
6
|
+
{{/each}}
|
|
7
|
+
export const linearTriggers = {
|
|
8
|
+
/** Trigger when a new issue is created. Optionally scope with `LinearTeam.*` / `LinearProject.*`. */
|
|
9
|
+
onIssueCreated(opts?: { team?: LinearTeam; project?: LinearProject }): TypedTrigger<LinearIssueCreatedTrigger> {
|
|
10
|
+
return new LinearInputConfig("{{escape section.id}}", opts?.project?.projectId ?? null, [LinearEventType.ISSUE_CREATED], opts?.team?.teamId ?? null)
|
|
11
|
+
},
|
|
12
|
+
/** Trigger when an issue is updated */
|
|
13
|
+
onIssueUpdated(opts?: { team?: LinearTeam; project?: LinearProject }): TypedTrigger<LinearIssueUpdatedTrigger> {
|
|
14
|
+
return new LinearInputConfig("{{escape section.id}}", opts?.project?.projectId ?? null, [LinearEventType.ISSUE_UPDATED], opts?.team?.teamId ?? null)
|
|
15
|
+
},
|
|
16
|
+
/** Trigger when a comment is added to an issue */
|
|
17
|
+
onComment(opts?: { team?: LinearTeam; project?: LinearProject }): TypedTrigger<LinearCommentCreatedTrigger> {
|
|
18
|
+
return new LinearInputConfig("{{escape section.id}}", opts?.project?.projectId ?? null, [LinearEventType.COMMENT_CREATED], opts?.team?.teamId ?? null)
|
|
19
|
+
},
|
|
20
|
+
/** Trigger on all Linear events */
|
|
21
|
+
trigger(opts?: { team?: LinearTeam; project?: LinearProject; eventTypes?: LinearEventType[] }): TypedTrigger<LinearTrigger> {
|
|
22
|
+
return new LinearInputConfig("{{escape section.id}}", opts?.project?.projectId ?? null, opts?.eventTypes, opts?.team?.teamId ?? null)
|
|
23
|
+
},
|
|
24
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{{sectionHeader "Notion resources"}}
|
|
2
|
+
|
|
3
|
+
{{> resource-class section.databaseClass}}
|
|
4
|
+
|
|
5
|
+
{{> resource-class section.pageClass}}
|
|
6
|
+
|
|
7
|
+
{{#if toolFile}}
|
|
8
|
+
{{sectionHeader "Notion tools"}}
|
|
9
|
+
|
|
10
|
+
{{> tools-slice toolFile}}
|
|
11
|
+
|
|
12
|
+
{{/if}}
|
|
13
|
+
{{sectionHeader "Notion skill"}}
|
|
14
|
+
|
|
15
|
+
/** Notion — read and write to the given databases or pages */
|
|
16
|
+
export function notionSkill(opts?: { databases?: NotionDatabase[]; pages?: NotionPage[] }): TypedSkill<{{{section.skillToolType}}}> {
|
|
17
|
+
return new NotionConfig("{{escape section.id}}",
|
|
18
|
+
opts?.databases?.map(d => d.databaseId), opts?.databases?.map(d => d.title),
|
|
19
|
+
opts?.pages?.map(p => p.pageId), opts?.pages?.map(p => p.title))
|
|
20
|
+
}
|