@automate.ax/catalog 0.56.1 → 0.57.0

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
@@ -1,3 +1,3 @@
1
1
  export { airtableService, anthropicService, apolloService, asanaService, brevoService, cerebrasService, cloudflareService, cohereService, deepinfraService, deepseekService, firecrawlService, fireworksService, getIntegrationService, githubService, googleGenaiService, googleService, groqService, huggingfaceService, integrationCatalog, linearService, microsoftService, millionverifierService, mistralService, openaiService, openrouterService, perplexityService, postgresService, resendService, scrapflyService, slackService, tidycalService, togetheraiService, trelloService, vercelAiGatewayService, vercelService, whatsappService, xaiService, type IntegrationServiceId, } from "./catalog.js";
2
- export { defineIntegrationCatalog, defineIntegrationService, scope, type IntegrationAccountConnectionOption, type IntegrationAccountRequirement, type IntegrationConnectionDefinition, type IntegrationFormField, type IntegrationScopeRequirement, type IntegrationServiceDefinition, type ScopeRequirementGroup, type TriggerDefinition, type TriggerPresentation, type TriggerPresentationContext, type TriggerPresentationDetail, type TriggerPresentationValue, } from "./types.js";
3
- export { getHttpTriggerEndpoint, getHttpTriggerEndpointKey, getTriggerDefinition, getTriggerName, getTriggerPresentation, triggerCatalog, triggerDefinitions, type HttpTriggerEndpointOptions, type HttpTriggerScope, type TriggerType, } from "./triggers/index.js";
2
+ export { defineIntegrationCatalog, defineIntegrationService, integrationScope, type IntegrationAccountConnectionOption, type IntegrationAccountRequirement, type IntegrationConnectionDefinition, type IntegrationFormField, type IntegrationScopeRequirement, type IntegrationServiceDefinition, type ScopeRequirementGroup, type TriggerDefinition, type TriggerPresentation, type TriggerPresentationContext, type TriggerPresentationDetail, type TriggerScopePresentation, type TriggerPresentationValue, } from "./types.js";
3
+ export { getHttpTriggerEndpoint, getHttpTriggerEndpointKey, getTriggerDefinition, getTriggerName, getTriggerPresentation, isTriggerVisible, triggerCatalog, triggerDefinitions, type HttpTriggerEndpointOptions, type HttpTriggerScope, type TriggerType, } from "./triggers/index.js";
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  export { airtableService, anthropicService, apolloService, asanaService, brevoService, cerebrasService, cloudflareService, cohereService, deepinfraService, deepseekService, firecrawlService, fireworksService, getIntegrationService, githubService, googleGenaiService, googleService, groqService, huggingfaceService, integrationCatalog, linearService, microsoftService, millionverifierService, mistralService, openaiService, openrouterService, perplexityService, postgresService, resendService, scrapflyService, slackService, tidycalService, togetheraiService, trelloService, vercelAiGatewayService, vercelService, whatsappService, xaiService, } from "./catalog.js";
2
- export { defineIntegrationCatalog, defineIntegrationService, scope, } from "./types.js";
3
- export { getHttpTriggerEndpoint, getHttpTriggerEndpointKey, getTriggerDefinition, getTriggerName, getTriggerPresentation, triggerCatalog, triggerDefinitions, } from "./triggers/index.js";
2
+ export { defineIntegrationCatalog, defineIntegrationService, integrationScope, } from "./types.js";
3
+ export { getHttpTriggerEndpoint, getHttpTriggerEndpointKey, getTriggerDefinition, getTriggerName, getTriggerPresentation, isTriggerVisible, triggerCatalog, triggerDefinitions, } from "./triggers/index.js";
@@ -18,7 +18,7 @@ export declare const coreTriggerDefinitions: {
18
18
  readonly type: "cron.tick";
19
19
  };
20
20
  readonly httpRequest: {
21
- readonly getPrimary: ({ appOrigin, automationId, config, hookSlot, projectId }: import("..").TriggerPresentationContext) => {
21
+ readonly getPrimary: ({ appOrigin, automationId, config, hookSlot, projectId, scopePath, }: import("..").TriggerPresentationContext) => {
22
22
  copyable: true;
23
23
  value: string;
24
24
  };
@@ -34,6 +34,7 @@ export interface HttpTriggerEndpointOptions {
34
34
  hookSlot: number;
35
35
  projectId: string;
36
36
  scope: HttpTriggerScope;
37
+ scopePath?: readonly number[];
37
38
  }
38
39
  /**
39
40
  * Returns the public URL for one deployed HTTP trigger.
@@ -34,7 +34,7 @@ export const coreTriggerDefinitions = {
34
34
  type: "cron.tick",
35
35
  },
36
36
  httpRequest: {
37
- getPrimary: ({ appOrigin, automationId, config, hookSlot, projectId }) => ({
37
+ getPrimary: ({ appOrigin, automationId, config, hookSlot, projectId, scopePath, }) => ({
38
38
  copyable: true,
39
39
  value: getHttpTriggerEndpoint({
40
40
  appOrigin,
@@ -42,6 +42,7 @@ export const coreTriggerDefinitions = {
42
42
  hookSlot,
43
43
  projectId,
44
44
  scope: HTTP_PRESENTATION_CONFIG_SCHEMA.parse(config).scope,
45
+ scopePath,
45
46
  }),
46
47
  }),
47
48
  icon: "webhook",
@@ -67,5 +68,8 @@ export function getHttpTriggerEndpointKey(options) {
67
68
  return options.projectId;
68
69
  if (options.scope === "automation")
69
70
  return options.automationId;
70
- return `${options.automationId}:${options.hookSlot}`;
71
+ return `${options.automationId}:${[
72
+ ...(options.scopePath ?? []),
73
+ options.hookSlot,
74
+ ].join(".")}`;
71
75
  }
@@ -1,4 +1,4 @@
1
- import type { TriggerDefinition, TriggerPresentation, TriggerPresentationContext } from "../types.js";
1
+ import type { TriggerDefinition, TriggerPresentation, TriggerPresentationContext, TriggerScopePresentation } from "../types.js";
2
2
  export { getHttpTriggerEndpoint, getHttpTriggerEndpointKey, type HttpTriggerEndpointOptions, type HttpTriggerScope, } from "./core.js";
3
3
  /** Plain shared definitions for every public trigger type. */
4
4
  export declare const triggerDefinitions: {
@@ -1067,7 +1067,7 @@ export declare const triggerDefinitions: {
1067
1067
  readonly type: "cron.tick";
1068
1068
  };
1069
1069
  readonly httpRequest: {
1070
- readonly getPrimary: ({ appOrigin, automationId, config, hookSlot, projectId }: TriggerPresentationContext) => {
1070
+ readonly getPrimary: ({ appOrigin, automationId, config, hookSlot, projectId, scopePath, }: TriggerPresentationContext) => {
1071
1071
  copyable: true;
1072
1072
  value: string;
1073
1073
  };
@@ -1549,7 +1549,7 @@ export declare const triggerCatalog: ({
1549
1549
  type: "cron.tick";
1550
1550
  } | {
1551
1551
  name: string;
1552
- getPrimary: ({ appOrigin, automationId, config, hookSlot, projectId }: TriggerPresentationContext) => {
1552
+ getPrimary: ({ appOrigin, automationId, config, hookSlot, projectId, scopePath, }: TriggerPresentationContext) => {
1553
1553
  copyable: true;
1554
1554
  value: string;
1555
1555
  };
@@ -2612,3 +2612,10 @@ export declare function getTriggerName(type: string): string;
2612
2612
  export declare function getTriggerPresentation(context: TriggerPresentationContext & {
2613
2613
  eventType: string;
2614
2614
  }): TriggerPresentation;
2615
+ /**
2616
+ * Returns whether a trigger should be shown outside its enclosing scopes.
2617
+ *
2618
+ * @param scopePath - The trigger's enclosing scope path.
2619
+ * @param scopes - The automation's planned scope presentation.
2620
+ */
2621
+ export declare function isTriggerVisible(scopePath: readonly number[], scopes: readonly TriggerScopePresentation[]): boolean;
@@ -73,6 +73,17 @@ export function getTriggerPresentation(context) {
73
73
  type: context.eventType,
74
74
  };
75
75
  }
76
+ /**
77
+ * Returns whether a trigger should be shown outside its enclosing scopes.
78
+ *
79
+ * @param scopePath - The trigger's enclosing scope path.
80
+ * @param scopes - The automation's planned scope presentation.
81
+ */
82
+ export function isTriggerVisible(scopePath, scopes) {
83
+ return !scopes.some((scope) => scope.presentation !== "expanded" &&
84
+ scope.path.length <= scopePath.length &&
85
+ scope.path.every((segment, index) => scopePath[index] === segment));
86
+ }
76
87
  /**
77
88
  * Infers presentation copy from a trigger's stable event type.
78
89
  *
package/dist/types.d.ts CHANGED
@@ -50,7 +50,7 @@ export interface ScopeRequirementGroup {
50
50
  type: "and" | "or";
51
51
  }
52
52
  /** Combinators for declaring recursive integration scope requirements. */
53
- export declare const scope: {
53
+ export declare const integrationScope: {
54
54
  /**
55
55
  * Requires every scope or nested group.
56
56
  *
@@ -107,6 +107,12 @@ export interface TriggerPresentationContext {
107
107
  config: unknown;
108
108
  hookSlot: number;
109
109
  projectId: string;
110
+ scopePath?: readonly number[];
111
+ }
112
+ /** Presentation metadata for one nested automation scope. */
113
+ export interface TriggerScopePresentation {
114
+ path: readonly number[];
115
+ presentation: "collapsed" | "expanded" | "hidden";
110
116
  }
111
117
  /** One user-facing value in a configured trigger's presentation. */
112
118
  export interface TriggerPresentationValue {
package/dist/types.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /** Combinators for declaring recursive integration scope requirements. */
2
- export const scope = {
2
+ export const integrationScope = {
3
3
  /**
4
4
  * Requires every scope or nested group.
5
5
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automate.ax/catalog",
3
- "version": "0.56.1",
3
+ "version": "0.57.0",
4
4
  "description": "Shared integration service and trigger definitions for Automate.ax.",
5
5
  "license": "MIT",
6
6
  "repository": {
package/src/index.ts CHANGED
@@ -41,7 +41,7 @@ export {
41
41
  export {
42
42
  defineIntegrationCatalog,
43
43
  defineIntegrationService,
44
- scope,
44
+ integrationScope,
45
45
  type IntegrationAccountConnectionOption,
46
46
  type IntegrationAccountRequirement,
47
47
  type IntegrationConnectionDefinition,
@@ -53,6 +53,7 @@ export {
53
53
  type TriggerPresentation,
54
54
  type TriggerPresentationContext,
55
55
  type TriggerPresentationDetail,
56
+ type TriggerScopePresentation,
56
57
  type TriggerPresentationValue,
57
58
  } from "./types"
58
59
  export {
@@ -61,6 +62,7 @@ export {
61
62
  getTriggerDefinition,
62
63
  getTriggerName,
63
64
  getTriggerPresentation,
65
+ isTriggerVisible,
64
66
  triggerCatalog,
65
67
  triggerDefinitions,
66
68
  type HttpTriggerEndpointOptions,
@@ -38,7 +38,14 @@ export const coreTriggerDefinitions = {
38
38
  type: "cron.tick",
39
39
  },
40
40
  httpRequest: {
41
- getPrimary: ({ appOrigin, automationId, config, hookSlot, projectId }) => ({
41
+ getPrimary: ({
42
+ appOrigin,
43
+ automationId,
44
+ config,
45
+ hookSlot,
46
+ projectId,
47
+ scopePath,
48
+ }) => ({
42
49
  copyable: true,
43
50
  value: getHttpTriggerEndpoint({
44
51
  appOrigin,
@@ -46,6 +53,7 @@ export const coreTriggerDefinitions = {
46
53
  hookSlot,
47
54
  projectId,
48
55
  scope: HTTP_PRESENTATION_CONFIG_SCHEMA.parse(config).scope,
56
+ scopePath,
49
57
  }),
50
58
  }),
51
59
  icon: "webhook",
@@ -62,6 +70,7 @@ export interface HttpTriggerEndpointOptions {
62
70
  hookSlot: number
63
71
  projectId: string
64
72
  scope: HttpTriggerScope
73
+ scopePath?: readonly number[]
65
74
  }
66
75
 
67
76
  /**
@@ -86,5 +95,8 @@ export function getHttpTriggerEndpointKey(
86
95
  ) {
87
96
  if (options.scope === "project") return options.projectId
88
97
  if (options.scope === "automation") return options.automationId
89
- return `${options.automationId}:${options.hookSlot}`
98
+ return `${options.automationId}:${[
99
+ ...(options.scopePath ?? []),
100
+ options.hookSlot,
101
+ ].join(".")}`
90
102
  }
@@ -16,6 +16,7 @@ import type {
16
16
  TriggerDefinition,
17
17
  TriggerPresentation,
18
18
  TriggerPresentationContext,
19
+ TriggerScopePresentation,
19
20
  } from "../types"
20
21
 
21
22
  export {
@@ -101,6 +102,24 @@ export function getTriggerPresentation(
101
102
  }
102
103
  }
103
104
 
105
+ /**
106
+ * Returns whether a trigger should be shown outside its enclosing scopes.
107
+ *
108
+ * @param scopePath - The trigger's enclosing scope path.
109
+ * @param scopes - The automation's planned scope presentation.
110
+ */
111
+ export function isTriggerVisible(
112
+ scopePath: readonly number[],
113
+ scopes: readonly TriggerScopePresentation[],
114
+ ) {
115
+ return !scopes.some(
116
+ (scope) =>
117
+ scope.presentation !== "expanded" &&
118
+ scope.path.length <= scopePath.length &&
119
+ scope.path.every((segment, index) => scopePath[index] === segment),
120
+ )
121
+ }
122
+
104
123
  /**
105
124
  * Infers presentation copy from a trigger's stable event type.
106
125
  *
package/src/types.ts CHANGED
@@ -64,7 +64,7 @@ export interface ScopeRequirementGroup {
64
64
  }
65
65
 
66
66
  /** Combinators for declaring recursive integration scope requirements. */
67
- export const scope = {
67
+ export const integrationScope = {
68
68
  /**
69
69
  * Requires every scope or nested group.
70
70
  *
@@ -139,6 +139,13 @@ export interface TriggerPresentationContext {
139
139
  config: unknown
140
140
  hookSlot: number
141
141
  projectId: string
142
+ scopePath?: readonly number[]
143
+ }
144
+
145
+ /** Presentation metadata for one nested automation scope. */
146
+ export interface TriggerScopePresentation {
147
+ path: readonly number[]
148
+ presentation: "collapsed" | "expanded" | "hidden"
142
149
  }
143
150
 
144
151
  /** One user-facing value in a configured trigger's presentation. */