@stackone/connect-sdk 3.9.0 → 3.11.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.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { Account, Action, ActionAnnotations, AuthType, AuthenticationConfig, AuthenticationField, AuthenticationNotice, Block, BlockContext, Category, Checkpoint, Connector, ConnectorDocumentation, Cursor, CursorPaginationConfig, DataSyncConfig, DeltaTokenIncrementalConfig, Effect, EventToEmit, FlowType, IncrementalConfig, Input, InputLocation, OffsetPaginationConfig, PagePaginationConfig, PaginationConfig, ReleaseStage, Settings, Source, SourceType, Step, StepFunctionName, StepFunctionParams, StepFunctionsFactory, StreamType, SupportConfig, TestActionConfig, TimeFilterIncrementalConfig, TransportType, WebhookSetupPhase, WebhookSetupPhaseKind } from "@stackone/core";
1
+ import { Account, ActingUser, Action, ActionAnnotations, AuthType, AuthenticationConfig, AuthenticationField, AuthenticationNotice, Block, BlockContext, Category, Checkpoint, Connector, ConnectorDocumentation, Cursor, CursorPaginationConfig, DataSyncConfig, DeltaTokenIncrementalConfig, Effect, EventToEmit, FlowType, IncrementalConfig, Input, InputLocation, OffsetPaginationConfig, PagePaginationConfig, PaginationConfig, ReleaseStage, Settings, Source, SourceType, Step, StepFunctionName, StepFunctionParams, StepFunctionsFactory, StreamType, SupportConfig, TestActionConfig, TimeFilterIncrementalConfig, TransportType, WebhookSetupPhase, WebhookSetupPhaseKind } from "@stackone/core";
2
2
  import { ILogger } from "@stackone/logger";
3
3
  import { IOlapClient, PolicyContext } from "@stackone/olap";
4
4
  import { HttpMethod, IHttpClient, IMcpClient, McpClientConfig, McpServerProber, McpToolDefinition } from "@stackone/transport";
@@ -12,6 +12,7 @@ declare const createBlock: ({
12
12
  connector,
13
13
  inputs,
14
14
  context,
15
+ user,
15
16
  action,
16
17
  credentials,
17
18
  nextCursor,
@@ -24,6 +25,7 @@ declare const createBlock: ({
24
25
  connector: Connector;
25
26
  inputs?: Record<string, unknown>;
26
27
  context: BlockContext;
28
+ user?: ActingUser;
27
29
  action?: Action;
28
30
  credentials?: Record<string, unknown>;
29
31
  nextCursor?: Cursor;
@@ -103,10 +105,46 @@ declare const hasCatastrophicBacktrackingRisk: (source: string) => boolean;
103
105
  //#endregion
104
106
  //#region src/connectors/releaseStage.d.ts
105
107
  declare const isConnectorReleased: (connector: Connector, allowedStages?: string[]) => boolean;
108
+ type ReleaseStageProfileItem = {
109
+ id: string;
110
+ releaseStage: ReleaseStage;
111
+ authTypes?: string[];
112
+ };
113
+ type ReleaseStageProfile = {
114
+ releaseStage: ReleaseStage;
115
+ authTypes: Record<string, ReleaseStage>;
116
+ actions: ReleaseStageProfileItem[];
117
+ eventActions: ReleaseStageProfileItem[];
118
+ };
119
+ type ReleaseStageResolution = {
120
+ actionIds: Set<string>;
121
+ eventActionIds: Set<string>;
122
+ authenticationKeys: Set<string>;
123
+ };
124
+ type ReleaseStageCountGroup = {
125
+ releaseStage: ReleaseStage;
126
+ authTypes?: string[];
127
+ count: number;
128
+ };
129
+ type ReleaseStageCounts = {
130
+ releaseStage: ReleaseStage;
131
+ authTypes: Record<string, ReleaseStage>;
132
+ actions: ReleaseStageCountGroup[];
133
+ eventActions: ReleaseStageCountGroup[];
134
+ };
135
+ type ReleaseStageCountsResolution = {
136
+ actionCount: number;
137
+ eventActionCount: number;
138
+ authenticationKeys: Set<string>;
139
+ };
140
+ declare const buildReleaseStageProfile: (connector: Connector) => ReleaseStageProfile;
141
+ declare const resolveReleaseStageProfile: (profile: ReleaseStageProfile, owner: string | undefined, allowedStages?: string[]) => ReleaseStageResolution | undefined;
142
+ declare const countReleaseStageProfile: (profile: ReleaseStageProfile) => ReleaseStageCounts;
143
+ declare const resolveReleaseStageCounts: (counts: ReleaseStageCounts, owner: string | undefined, allowedStages?: string[]) => ReleaseStageCountsResolution | undefined;
106
144
  declare const applyReleaseStageToConnector: (connector: Connector, allowedStages?: string[]) => Connector | undefined;
107
145
  //#endregion
108
146
  //#region src/errors/types.d.ts
109
- type ErrorType = 'CONNECTOR_PARSE_ERROR' | 'MISSING_ACTION_ERROR' | 'INCOMPATIBLE_AUTH_TYPE_ERROR' | 'INVALID_ACTION_INPUTS_ERROR' | 'INVALID_CURSOR_ERROR' | 'INVALID_EVENT_OUTPUT_ERROR' | 'POLICY_DENIED_ERROR' | 'POLICY_EVALUATION_ERROR' | 'POLICY_PREPARSE_ERROR';
147
+ type ErrorType = 'CONNECTOR_PARSE_ERROR' | 'MISSING_ACTION_ERROR' | 'INCOMPATIBLE_AUTH_TYPE_ERROR' | 'INVALID_ACTION_INPUTS_ERROR' | 'INVALID_CURSOR_ERROR' | 'INVALID_EVENT_OUTPUT_ERROR' | 'POLICY_DENIED_ERROR' | 'POLICY_EVALUATION_ERROR' | 'POLICY_PREPARSE_ERROR' | 'ACTING_USER_REQUIRED_ERROR';
110
148
  //#endregion
111
149
  //#region src/errors/connectSDKErrors.d.ts
112
150
  type InputValidationError = {
@@ -129,6 +167,9 @@ declare class InvalidActionInputsError extends ConnectSDKError {
129
167
  declare class IncompatibleAuthTypeError extends ConnectSDKError {
130
168
  constructor(context: BlockContext, message?: string);
131
169
  }
170
+ declare class ActingUserRequiredError extends ConnectSDKError {
171
+ constructor(context: BlockContext, message?: string);
172
+ }
132
173
  declare class InvalidEventOutputError extends ConnectSDKError {
133
174
  constructor(context: BlockContext, message?: string);
134
175
  }
@@ -475,6 +516,7 @@ declare const ACTION_SCHEMA: z.ZodObject<{
475
516
  }, z.core.$strict>>;
476
517
  providerEvents: z.ZodOptional<z.ZodArray<z.ZodString>>;
477
518
  prerequisiteActions: z.ZodOptional<z.ZodArray<z.ZodString>>;
519
+ userScoped: z.ZodOptional<z.ZodBoolean>;
478
520
  }, z.core.$strict>;
479
521
  declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
480
522
  StackOne: z.ZodString;
@@ -1061,6 +1103,7 @@ declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
1061
1103
  }, z.core.$strict>>;
1062
1104
  providerEvents: z.ZodOptional<z.ZodArray<z.ZodString>>;
1063
1105
  prerequisiteActions: z.ZodOptional<z.ZodArray<z.ZodString>>;
1106
+ userScoped: z.ZodOptional<z.ZodBoolean>;
1064
1107
  actionType: z.ZodLiteral<"refresh_token">;
1065
1108
  }, z.core.$strict>;
1066
1109
  }, z.core.$strict>>;
@@ -1375,6 +1418,7 @@ declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
1375
1418
  }, z.core.$strict>>;
1376
1419
  providerEvents: z.ZodOptional<z.ZodArray<z.ZodString>>;
1377
1420
  prerequisiteActions: z.ZodOptional<z.ZodArray<z.ZodString>>;
1421
+ userScoped: z.ZodOptional<z.ZodBoolean>;
1378
1422
  }, z.core.$strict>]>;
1379
1423
  condition: z.ZodOptional<z.ZodString>;
1380
1424
  required: z.ZodDefault<z.ZodBoolean>;
@@ -1940,6 +1984,7 @@ declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
1940
1984
  }, z.core.$strict>>;
1941
1985
  providerEvents: z.ZodOptional<z.ZodArray<z.ZodString>>;
1942
1986
  prerequisiteActions: z.ZodOptional<z.ZodArray<z.ZodString>>;
1987
+ userScoped: z.ZodOptional<z.ZodBoolean>;
1943
1988
  actionType: z.ZodLiteral<"refresh_token">;
1944
1989
  }, z.core.$strict>;
1945
1990
  }, z.core.$strict>>;
@@ -2254,6 +2299,7 @@ declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
2254
2299
  }, z.core.$strict>>;
2255
2300
  providerEvents: z.ZodOptional<z.ZodArray<z.ZodString>>;
2256
2301
  prerequisiteActions: z.ZodOptional<z.ZodArray<z.ZodString>>;
2302
+ userScoped: z.ZodOptional<z.ZodBoolean>;
2257
2303
  }, z.core.$strict>]>;
2258
2304
  condition: z.ZodOptional<z.ZodString>;
2259
2305
  required: z.ZodDefault<z.ZodBoolean>;
@@ -2815,6 +2861,7 @@ declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
2815
2861
  }, z.core.$strict>>;
2816
2862
  providerEvents: z.ZodOptional<z.ZodArray<z.ZodString>>;
2817
2863
  prerequisiteActions: z.ZodOptional<z.ZodArray<z.ZodString>>;
2864
+ userScoped: z.ZodOptional<z.ZodBoolean>;
2818
2865
  actionType: z.ZodLiteral<"refresh_token">;
2819
2866
  }, z.core.$strict>;
2820
2867
  }, z.core.$strict>>;
@@ -3129,6 +3176,7 @@ declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
3129
3176
  }, z.core.$strict>>;
3130
3177
  providerEvents: z.ZodOptional<z.ZodArray<z.ZodString>>;
3131
3178
  prerequisiteActions: z.ZodOptional<z.ZodArray<z.ZodString>>;
3179
+ userScoped: z.ZodOptional<z.ZodBoolean>;
3132
3180
  }, z.core.$strict>]>;
3133
3181
  condition: z.ZodOptional<z.ZodString>;
3134
3182
  required: z.ZodDefault<z.ZodBoolean>;
@@ -3690,6 +3738,7 @@ declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
3690
3738
  }, z.core.$strict>>;
3691
3739
  providerEvents: z.ZodOptional<z.ZodArray<z.ZodString>>;
3692
3740
  prerequisiteActions: z.ZodOptional<z.ZodArray<z.ZodString>>;
3741
+ userScoped: z.ZodOptional<z.ZodBoolean>;
3693
3742
  actionType: z.ZodLiteral<"refresh_token">;
3694
3743
  }, z.core.$strict>;
3695
3744
  }, z.core.$strict>>;
@@ -4004,6 +4053,7 @@ declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
4004
4053
  }, z.core.$strict>>;
4005
4054
  providerEvents: z.ZodOptional<z.ZodArray<z.ZodString>>;
4006
4055
  prerequisiteActions: z.ZodOptional<z.ZodArray<z.ZodString>>;
4056
+ userScoped: z.ZodOptional<z.ZodBoolean>;
4007
4057
  }, z.core.$strict>]>;
4008
4058
  condition: z.ZodOptional<z.ZodString>;
4009
4059
  required: z.ZodDefault<z.ZodBoolean>;
@@ -4329,6 +4379,7 @@ declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
4329
4379
  }, z.core.$strict>>;
4330
4380
  providerEvents: z.ZodOptional<z.ZodArray<z.ZodString>>;
4331
4381
  prerequisiteActions: z.ZodOptional<z.ZodArray<z.ZodString>>;
4382
+ userScoped: z.ZodOptional<z.ZodBoolean>;
4332
4383
  }, z.core.$strict>>>;
4333
4384
  events: z.ZodOptional<z.ZodObject<{
4334
4385
  setup: z.ZodOptional<z.ZodObject<{
@@ -4755,6 +4806,7 @@ declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
4755
4806
  }, z.core.$strict>>;
4756
4807
  providerEvents: z.ZodOptional<z.ZodArray<z.ZodString>>;
4757
4808
  prerequisiteActions: z.ZodOptional<z.ZodArray<z.ZodString>>;
4809
+ userScoped: z.ZodOptional<z.ZodBoolean>;
4758
4810
  actionType: z.ZodLiteral<"event">;
4759
4811
  requiresManualSetup: z.ZodOptional<z.ZodBoolean>;
4760
4812
  }, z.core.$strict>>>;
@@ -5073,6 +5125,7 @@ declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
5073
5125
  }, z.core.$strict>>;
5074
5126
  providerEvents: z.ZodOptional<z.ZodArray<z.ZodString>>;
5075
5127
  prerequisiteActions: z.ZodOptional<z.ZodArray<z.ZodString>>;
5128
+ userScoped: z.ZodOptional<z.ZodBoolean>;
5076
5129
  actionType: z.ZodLiteral<"custom">;
5077
5130
  result: z.ZodString;
5078
5131
  }, z.core.$strict>>;
@@ -5307,6 +5360,7 @@ interface MetaAction {
5307
5360
  releaseStage?: ReleaseStage;
5308
5361
  effects?: Effect[];
5309
5362
  annotations?: ActionAnnotations;
5363
+ userScoped?: boolean;
5310
5364
  [key: string]: unknown;
5311
5365
  }
5312
5366
  type ConnectorMetaAuthenticationConfig = {
@@ -5343,6 +5397,7 @@ type ConnectorMetaAction = {
5343
5397
  release_stage?: ReleaseStage;
5344
5398
  effects?: Effect[];
5345
5399
  annotations?: ActionAnnotations;
5400
+ user_scoped?: boolean;
5346
5401
  action_details?: MetaAction;
5347
5402
  authentication: ActionMetaAuthenticationConfig[];
5348
5403
  };
@@ -5390,6 +5445,9 @@ declare const getActionMeta: (connector: Connector, actionId: string, include?:
5390
5445
  declare const getActionsMetaSummary: (connector: Connector, include?: string[]) => ConnectorMetaSummary;
5391
5446
  declare const getActionsMetaSummaryFromConnectors: (connectors: Connector[], include?: string[]) => ConnectorMetaSummary[];
5392
5447
  //#endregion
5448
+ //#region src/meta/releaseStage.d.ts
5449
+ declare const applyReleaseStageResolutionToMeta: (meta: ConnectorMeta, resolution: ReleaseStageResolution | undefined) => ConnectorMeta | undefined;
5450
+ //#endregion
5393
5451
  //#region src/runners/actionPolicy.d.ts
5394
5452
  type ActionPolicy = {
5395
5453
  levels: LevelPolicies[];
@@ -5561,6 +5619,7 @@ type BaseRunActionParams = {
5561
5619
  headers?: Record<string, string>;
5562
5620
  settings?: Settings;
5563
5621
  source?: Source;
5622
+ user?: ActingUser;
5564
5623
  policy?: ActionPolicy;
5565
5624
  logger?: ILogger;
5566
5625
  decideInvokeToolFn?: typeof decideInvokeTool;
@@ -5633,7 +5692,7 @@ type ExecutedAction = {
5633
5692
  };
5634
5693
  } | {
5635
5694
  outcome: 'refused';
5636
- policy: PolicyContext;
5695
+ policy?: PolicyContext;
5637
5696
  error: ConnectSDKError;
5638
5697
  };
5639
5698
  declare const applyDefender: ({
@@ -5854,4 +5913,4 @@ declare const runWebhookSetupPhase: ({
5854
5913
  runStepActionFn?: typeof runStepAction;
5855
5914
  }) => Promise<WebhookSetupPhaseResult>;
5856
5915
  //#endregion
5857
- export { ACTION_SCHEMA, type ActionMetaAuthenticationConfig, type ActionPolicy, CATEGORY_ACRONYMS, CONNECTOR_YAML_SCHEMA, type CallAction, type CompleteMcpConnectorOptions, type CompletedMcpConnector, ConnectSDKError, type ConnectorMeta, type ConnectorMetaEvent, type ConnectorMetaSummary, type CreatePaginatorOptions, DEFAULT_TIME_FILTER_SAFETY_BUFFER_SECONDS, DELTA_TOKEN_INCREMENTAL_SCHEMA, type EnabledActionsConfig, type ErrorType, type GenerateMcpConnectorInput, type GeneratedMcpConnector, INCREMENTAL_SCHEMA, IncompatibleAuthTypeError, type IncrementalStrategy, type InputValidationError, InvalidActionInputsError, InvalidEventOutputError, POLICY_ERROR_STATUS, type PaginateOptions, type PaginateResult, type PaginationProgress, type Paginator, PolicyDeniedError, type PolicyErrorType, PolicyEvaluationError, PolicyPreparseError, TIME_FILTER_INCREMENTAL_SCHEMA, type ValidationError, type ValidationErrorResponse, type WebhookSetupPhaseResult, addMcpToolActions, applyDefender, applyReleaseStageToConnector, completeMcpConnector, computeCredentialsVerifiedByAuth, createBlock, createCursorPaginator, createDeltaTokenStrategy, createIncrementalStrategy, createOffsetPaginator, createPagePaginator, createPaginator, createTimeFilterStrategy, decideInvokeTool, decideReadFields, evaluateExternalAccountIdExtractorByConnector, executeStepFunction, extractItems, fieldPathsOf, filterActionsByAuthType, formatValidationErrorResponse, generateMcpConnector, getActionAuthenticationMethods, getActionFromUrl, getActionMeta, getActionsMeta, getActionsMetaFromConnectors, getActionsMetaSummary, getActionsMetaSummaryFromConnectors, getRefreshTokenExpiresIn, getTokenExpiresIn, hasCatastrophicBacktrackingRisk, isConnectorReleased, isMcpConnector, isPolicyErrorType, loadConnector, maskFields, paginate, parseActionInputs, parseYamlConnector, runAction, runConnectorActionById, runConnectorActionByPath, runEventActionById, runStepAction, runTestActions, runWebhookSetupPhase, supportsRefreshAuthentication, validateYamlConnector };
5916
+ export { ACTION_SCHEMA, ActingUserRequiredError, type ActionMetaAuthenticationConfig, type ActionPolicy, CATEGORY_ACRONYMS, CONNECTOR_YAML_SCHEMA, type CallAction, type CompleteMcpConnectorOptions, type CompletedMcpConnector, ConnectSDKError, type ConnectorMeta, type ConnectorMetaEvent, type ConnectorMetaSummary, type CreatePaginatorOptions, DEFAULT_TIME_FILTER_SAFETY_BUFFER_SECONDS, DELTA_TOKEN_INCREMENTAL_SCHEMA, type EnabledActionsConfig, type ErrorType, type GenerateMcpConnectorInput, type GeneratedMcpConnector, INCREMENTAL_SCHEMA, IncompatibleAuthTypeError, type IncrementalStrategy, type InputValidationError, InvalidActionInputsError, InvalidEventOutputError, POLICY_ERROR_STATUS, type PaginateOptions, type PaginateResult, type PaginationProgress, type Paginator, PolicyDeniedError, type PolicyErrorType, PolicyEvaluationError, PolicyPreparseError, type ReleaseStageCountGroup, type ReleaseStageCounts, type ReleaseStageCountsResolution, type ReleaseStageProfile, type ReleaseStageProfileItem, type ReleaseStageResolution, TIME_FILTER_INCREMENTAL_SCHEMA, type ValidationError, type ValidationErrorResponse, type WebhookSetupPhaseResult, addMcpToolActions, applyDefender, applyReleaseStageResolutionToMeta, applyReleaseStageToConnector, buildReleaseStageProfile, completeMcpConnector, computeCredentialsVerifiedByAuth, countReleaseStageProfile, createBlock, createCursorPaginator, createDeltaTokenStrategy, createIncrementalStrategy, createOffsetPaginator, createPagePaginator, createPaginator, createTimeFilterStrategy, decideInvokeTool, decideReadFields, evaluateExternalAccountIdExtractorByConnector, executeStepFunction, extractItems, fieldPathsOf, filterActionsByAuthType, formatValidationErrorResponse, generateMcpConnector, getActionAuthenticationMethods, getActionFromUrl, getActionMeta, getActionsMeta, getActionsMetaFromConnectors, getActionsMetaSummary, getActionsMetaSummaryFromConnectors, getRefreshTokenExpiresIn, getTokenExpiresIn, hasCatastrophicBacktrackingRisk, isConnectorReleased, isMcpConnector, isPolicyErrorType, loadConnector, maskFields, paginate, parseActionInputs, parseYamlConnector, resolveReleaseStageCounts, resolveReleaseStageProfile, runAction, runConnectorActionById, runConnectorActionByPath, runEventActionById, runStepAction, runTestActions, runWebhookSetupPhase, supportsRefreshAuthentication, validateYamlConnector };
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { t as __name } from "./chunk-BhWHdk3m.mjs";
2
2
  import { z } from "@stackone/utils";
3
3
  import { HttpMethod, IHttpClient, IMcpClient, McpClientConfig, McpServerProber, McpToolDefinition } from "@stackone/transport";
4
- import { Account, Action, ActionAnnotations, AuthType, AuthenticationConfig, AuthenticationField, AuthenticationNotice, Block, BlockContext, Category, Checkpoint, Connector, ConnectorDocumentation, Cursor, CursorPaginationConfig, DataSyncConfig, DeltaTokenIncrementalConfig, Effect, EventToEmit, FlowType, IncrementalConfig, Input, InputLocation, OffsetPaginationConfig, PagePaginationConfig, PaginationConfig, ReleaseStage, Settings, Source, SourceType, Step, StepFunctionName, StepFunctionParams, StepFunctionsFactory, StreamType, SupportConfig, TestActionConfig, TimeFilterIncrementalConfig, TransportType, WebhookSetupPhase, WebhookSetupPhaseKind } from "@stackone/core";
4
+ import { Account, ActingUser, Action, ActionAnnotations, AuthType, AuthenticationConfig, AuthenticationField, AuthenticationNotice, Block, BlockContext, Category, Checkpoint, Connector, ConnectorDocumentation, Cursor, CursorPaginationConfig, DataSyncConfig, DeltaTokenIncrementalConfig, Effect, EventToEmit, FlowType, IncrementalConfig, Input, InputLocation, OffsetPaginationConfig, PagePaginationConfig, PaginationConfig, ReleaseStage, Settings, Source, SourceType, Step, StepFunctionName, StepFunctionParams, StepFunctionsFactory, StreamType, SupportConfig, TestActionConfig, TimeFilterIncrementalConfig, TransportType, WebhookSetupPhase, WebhookSetupPhaseKind } from "@stackone/core";
5
5
  import { ArgumentValue, CedarEvaluator, FieldDecisions, LevelPolicies, PrincipalRef, ToolDecision } from "@stackone/policy";
6
6
  import { IOlapClient, PolicyContext } from "@stackone/olap";
7
7
  import { ILogger } from "@stackone/logger";
@@ -11,6 +11,7 @@ declare const createBlock: ({
11
11
  connector,
12
12
  inputs,
13
13
  context,
14
+ user,
14
15
  action,
15
16
  credentials,
16
17
  nextCursor,
@@ -23,6 +24,7 @@ declare const createBlock: ({
23
24
  connector: Connector;
24
25
  inputs?: Record<string, unknown>;
25
26
  context: BlockContext;
27
+ user?: ActingUser;
26
28
  action?: Action;
27
29
  credentials?: Record<string, unknown>;
28
30
  nextCursor?: Cursor;
@@ -102,10 +104,46 @@ declare const hasCatastrophicBacktrackingRisk: (source: string) => boolean;
102
104
  //#endregion
103
105
  //#region src/connectors/releaseStage.d.ts
104
106
  declare const isConnectorReleased: (connector: Connector, allowedStages?: string[]) => boolean;
107
+ type ReleaseStageProfileItem = {
108
+ id: string;
109
+ releaseStage: ReleaseStage;
110
+ authTypes?: string[];
111
+ };
112
+ type ReleaseStageProfile = {
113
+ releaseStage: ReleaseStage;
114
+ authTypes: Record<string, ReleaseStage>;
115
+ actions: ReleaseStageProfileItem[];
116
+ eventActions: ReleaseStageProfileItem[];
117
+ };
118
+ type ReleaseStageResolution = {
119
+ actionIds: Set<string>;
120
+ eventActionIds: Set<string>;
121
+ authenticationKeys: Set<string>;
122
+ };
123
+ type ReleaseStageCountGroup = {
124
+ releaseStage: ReleaseStage;
125
+ authTypes?: string[];
126
+ count: number;
127
+ };
128
+ type ReleaseStageCounts = {
129
+ releaseStage: ReleaseStage;
130
+ authTypes: Record<string, ReleaseStage>;
131
+ actions: ReleaseStageCountGroup[];
132
+ eventActions: ReleaseStageCountGroup[];
133
+ };
134
+ type ReleaseStageCountsResolution = {
135
+ actionCount: number;
136
+ eventActionCount: number;
137
+ authenticationKeys: Set<string>;
138
+ };
139
+ declare const buildReleaseStageProfile: (connector: Connector) => ReleaseStageProfile;
140
+ declare const resolveReleaseStageProfile: (profile: ReleaseStageProfile, owner: string | undefined, allowedStages?: string[]) => ReleaseStageResolution | undefined;
141
+ declare const countReleaseStageProfile: (profile: ReleaseStageProfile) => ReleaseStageCounts;
142
+ declare const resolveReleaseStageCounts: (counts: ReleaseStageCounts, owner: string | undefined, allowedStages?: string[]) => ReleaseStageCountsResolution | undefined;
105
143
  declare const applyReleaseStageToConnector: (connector: Connector, allowedStages?: string[]) => Connector | undefined;
106
144
  //#endregion
107
145
  //#region src/errors/types.d.ts
108
- type ErrorType = 'CONNECTOR_PARSE_ERROR' | 'MISSING_ACTION_ERROR' | 'INCOMPATIBLE_AUTH_TYPE_ERROR' | 'INVALID_ACTION_INPUTS_ERROR' | 'INVALID_CURSOR_ERROR' | 'INVALID_EVENT_OUTPUT_ERROR' | 'POLICY_DENIED_ERROR' | 'POLICY_EVALUATION_ERROR' | 'POLICY_PREPARSE_ERROR';
146
+ type ErrorType = 'CONNECTOR_PARSE_ERROR' | 'MISSING_ACTION_ERROR' | 'INCOMPATIBLE_AUTH_TYPE_ERROR' | 'INVALID_ACTION_INPUTS_ERROR' | 'INVALID_CURSOR_ERROR' | 'INVALID_EVENT_OUTPUT_ERROR' | 'POLICY_DENIED_ERROR' | 'POLICY_EVALUATION_ERROR' | 'POLICY_PREPARSE_ERROR' | 'ACTING_USER_REQUIRED_ERROR';
109
147
  //#endregion
110
148
  //#region src/errors/connectSDKErrors.d.ts
111
149
  type InputValidationError = {
@@ -128,6 +166,9 @@ declare class InvalidActionInputsError extends ConnectSDKError {
128
166
  declare class IncompatibleAuthTypeError extends ConnectSDKError {
129
167
  constructor(context: BlockContext, message?: string);
130
168
  }
169
+ declare class ActingUserRequiredError extends ConnectSDKError {
170
+ constructor(context: BlockContext, message?: string);
171
+ }
131
172
  declare class InvalidEventOutputError extends ConnectSDKError {
132
173
  constructor(context: BlockContext, message?: string);
133
174
  }
@@ -474,6 +515,7 @@ declare const ACTION_SCHEMA: z.ZodObject<{
474
515
  }, z.core.$strict>>;
475
516
  providerEvents: z.ZodOptional<z.ZodArray<z.ZodString>>;
476
517
  prerequisiteActions: z.ZodOptional<z.ZodArray<z.ZodString>>;
518
+ userScoped: z.ZodOptional<z.ZodBoolean>;
477
519
  }, z.core.$strict>;
478
520
  declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
479
521
  StackOne: z.ZodString;
@@ -1060,6 +1102,7 @@ declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
1060
1102
  }, z.core.$strict>>;
1061
1103
  providerEvents: z.ZodOptional<z.ZodArray<z.ZodString>>;
1062
1104
  prerequisiteActions: z.ZodOptional<z.ZodArray<z.ZodString>>;
1105
+ userScoped: z.ZodOptional<z.ZodBoolean>;
1063
1106
  actionType: z.ZodLiteral<"refresh_token">;
1064
1107
  }, z.core.$strict>;
1065
1108
  }, z.core.$strict>>;
@@ -1374,6 +1417,7 @@ declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
1374
1417
  }, z.core.$strict>>;
1375
1418
  providerEvents: z.ZodOptional<z.ZodArray<z.ZodString>>;
1376
1419
  prerequisiteActions: z.ZodOptional<z.ZodArray<z.ZodString>>;
1420
+ userScoped: z.ZodOptional<z.ZodBoolean>;
1377
1421
  }, z.core.$strict>]>;
1378
1422
  condition: z.ZodOptional<z.ZodString>;
1379
1423
  required: z.ZodDefault<z.ZodBoolean>;
@@ -1939,6 +1983,7 @@ declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
1939
1983
  }, z.core.$strict>>;
1940
1984
  providerEvents: z.ZodOptional<z.ZodArray<z.ZodString>>;
1941
1985
  prerequisiteActions: z.ZodOptional<z.ZodArray<z.ZodString>>;
1986
+ userScoped: z.ZodOptional<z.ZodBoolean>;
1942
1987
  actionType: z.ZodLiteral<"refresh_token">;
1943
1988
  }, z.core.$strict>;
1944
1989
  }, z.core.$strict>>;
@@ -2253,6 +2298,7 @@ declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
2253
2298
  }, z.core.$strict>>;
2254
2299
  providerEvents: z.ZodOptional<z.ZodArray<z.ZodString>>;
2255
2300
  prerequisiteActions: z.ZodOptional<z.ZodArray<z.ZodString>>;
2301
+ userScoped: z.ZodOptional<z.ZodBoolean>;
2256
2302
  }, z.core.$strict>]>;
2257
2303
  condition: z.ZodOptional<z.ZodString>;
2258
2304
  required: z.ZodDefault<z.ZodBoolean>;
@@ -2814,6 +2860,7 @@ declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
2814
2860
  }, z.core.$strict>>;
2815
2861
  providerEvents: z.ZodOptional<z.ZodArray<z.ZodString>>;
2816
2862
  prerequisiteActions: z.ZodOptional<z.ZodArray<z.ZodString>>;
2863
+ userScoped: z.ZodOptional<z.ZodBoolean>;
2817
2864
  actionType: z.ZodLiteral<"refresh_token">;
2818
2865
  }, z.core.$strict>;
2819
2866
  }, z.core.$strict>>;
@@ -3128,6 +3175,7 @@ declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
3128
3175
  }, z.core.$strict>>;
3129
3176
  providerEvents: z.ZodOptional<z.ZodArray<z.ZodString>>;
3130
3177
  prerequisiteActions: z.ZodOptional<z.ZodArray<z.ZodString>>;
3178
+ userScoped: z.ZodOptional<z.ZodBoolean>;
3131
3179
  }, z.core.$strict>]>;
3132
3180
  condition: z.ZodOptional<z.ZodString>;
3133
3181
  required: z.ZodDefault<z.ZodBoolean>;
@@ -3689,6 +3737,7 @@ declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
3689
3737
  }, z.core.$strict>>;
3690
3738
  providerEvents: z.ZodOptional<z.ZodArray<z.ZodString>>;
3691
3739
  prerequisiteActions: z.ZodOptional<z.ZodArray<z.ZodString>>;
3740
+ userScoped: z.ZodOptional<z.ZodBoolean>;
3692
3741
  actionType: z.ZodLiteral<"refresh_token">;
3693
3742
  }, z.core.$strict>;
3694
3743
  }, z.core.$strict>>;
@@ -4003,6 +4052,7 @@ declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
4003
4052
  }, z.core.$strict>>;
4004
4053
  providerEvents: z.ZodOptional<z.ZodArray<z.ZodString>>;
4005
4054
  prerequisiteActions: z.ZodOptional<z.ZodArray<z.ZodString>>;
4055
+ userScoped: z.ZodOptional<z.ZodBoolean>;
4006
4056
  }, z.core.$strict>]>;
4007
4057
  condition: z.ZodOptional<z.ZodString>;
4008
4058
  required: z.ZodDefault<z.ZodBoolean>;
@@ -4328,6 +4378,7 @@ declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
4328
4378
  }, z.core.$strict>>;
4329
4379
  providerEvents: z.ZodOptional<z.ZodArray<z.ZodString>>;
4330
4380
  prerequisiteActions: z.ZodOptional<z.ZodArray<z.ZodString>>;
4381
+ userScoped: z.ZodOptional<z.ZodBoolean>;
4331
4382
  }, z.core.$strict>>>;
4332
4383
  events: z.ZodOptional<z.ZodObject<{
4333
4384
  setup: z.ZodOptional<z.ZodObject<{
@@ -4754,6 +4805,7 @@ declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
4754
4805
  }, z.core.$strict>>;
4755
4806
  providerEvents: z.ZodOptional<z.ZodArray<z.ZodString>>;
4756
4807
  prerequisiteActions: z.ZodOptional<z.ZodArray<z.ZodString>>;
4808
+ userScoped: z.ZodOptional<z.ZodBoolean>;
4757
4809
  actionType: z.ZodLiteral<"event">;
4758
4810
  requiresManualSetup: z.ZodOptional<z.ZodBoolean>;
4759
4811
  }, z.core.$strict>>>;
@@ -5072,6 +5124,7 @@ declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
5072
5124
  }, z.core.$strict>>;
5073
5125
  providerEvents: z.ZodOptional<z.ZodArray<z.ZodString>>;
5074
5126
  prerequisiteActions: z.ZodOptional<z.ZodArray<z.ZodString>>;
5127
+ userScoped: z.ZodOptional<z.ZodBoolean>;
5075
5128
  actionType: z.ZodLiteral<"custom">;
5076
5129
  result: z.ZodString;
5077
5130
  }, z.core.$strict>>;
@@ -5306,6 +5359,7 @@ interface MetaAction {
5306
5359
  releaseStage?: ReleaseStage;
5307
5360
  effects?: Effect[];
5308
5361
  annotations?: ActionAnnotations;
5362
+ userScoped?: boolean;
5309
5363
  [key: string]: unknown;
5310
5364
  }
5311
5365
  type ConnectorMetaAuthenticationConfig = {
@@ -5342,6 +5396,7 @@ type ConnectorMetaAction = {
5342
5396
  release_stage?: ReleaseStage;
5343
5397
  effects?: Effect[];
5344
5398
  annotations?: ActionAnnotations;
5399
+ user_scoped?: boolean;
5345
5400
  action_details?: MetaAction;
5346
5401
  authentication: ActionMetaAuthenticationConfig[];
5347
5402
  };
@@ -5389,6 +5444,9 @@ declare const getActionMeta: (connector: Connector, actionId: string, include?:
5389
5444
  declare const getActionsMetaSummary: (connector: Connector, include?: string[]) => ConnectorMetaSummary;
5390
5445
  declare const getActionsMetaSummaryFromConnectors: (connectors: Connector[], include?: string[]) => ConnectorMetaSummary[];
5391
5446
  //#endregion
5447
+ //#region src/meta/releaseStage.d.ts
5448
+ declare const applyReleaseStageResolutionToMeta: (meta: ConnectorMeta, resolution: ReleaseStageResolution | undefined) => ConnectorMeta | undefined;
5449
+ //#endregion
5392
5450
  //#region src/runners/actionPolicy.d.ts
5393
5451
  type ActionPolicy = {
5394
5452
  levels: LevelPolicies[];
@@ -5560,6 +5618,7 @@ type BaseRunActionParams = {
5560
5618
  headers?: Record<string, string>;
5561
5619
  settings?: Settings;
5562
5620
  source?: Source;
5621
+ user?: ActingUser;
5563
5622
  policy?: ActionPolicy;
5564
5623
  logger?: ILogger;
5565
5624
  decideInvokeToolFn?: typeof decideInvokeTool;
@@ -5632,7 +5691,7 @@ type ExecutedAction = {
5632
5691
  };
5633
5692
  } | {
5634
5693
  outcome: 'refused';
5635
- policy: PolicyContext;
5694
+ policy?: PolicyContext;
5636
5695
  error: ConnectSDKError;
5637
5696
  };
5638
5697
  declare const applyDefender: ({
@@ -5853,4 +5912,4 @@ declare const runWebhookSetupPhase: ({
5853
5912
  runStepActionFn?: typeof runStepAction;
5854
5913
  }) => Promise<WebhookSetupPhaseResult>;
5855
5914
  //#endregion
5856
- export { ACTION_SCHEMA, type ActionMetaAuthenticationConfig, type ActionPolicy, CATEGORY_ACRONYMS, CONNECTOR_YAML_SCHEMA, type CallAction, type CompleteMcpConnectorOptions, type CompletedMcpConnector, ConnectSDKError, type ConnectorMeta, type ConnectorMetaEvent, type ConnectorMetaSummary, type CreatePaginatorOptions, DEFAULT_TIME_FILTER_SAFETY_BUFFER_SECONDS, DELTA_TOKEN_INCREMENTAL_SCHEMA, type EnabledActionsConfig, type ErrorType, type GenerateMcpConnectorInput, type GeneratedMcpConnector, INCREMENTAL_SCHEMA, IncompatibleAuthTypeError, type IncrementalStrategy, type InputValidationError, InvalidActionInputsError, InvalidEventOutputError, POLICY_ERROR_STATUS, type PaginateOptions, type PaginateResult, type PaginationProgress, type Paginator, PolicyDeniedError, type PolicyErrorType, PolicyEvaluationError, PolicyPreparseError, TIME_FILTER_INCREMENTAL_SCHEMA, type ValidationError, type ValidationErrorResponse, type WebhookSetupPhaseResult, addMcpToolActions, applyDefender, applyReleaseStageToConnector, completeMcpConnector, computeCredentialsVerifiedByAuth, createBlock, createCursorPaginator, createDeltaTokenStrategy, createIncrementalStrategy, createOffsetPaginator, createPagePaginator, createPaginator, createTimeFilterStrategy, decideInvokeTool, decideReadFields, evaluateExternalAccountIdExtractorByConnector, executeStepFunction, extractItems, fieldPathsOf, filterActionsByAuthType, formatValidationErrorResponse, generateMcpConnector, getActionAuthenticationMethods, getActionFromUrl, getActionMeta, getActionsMeta, getActionsMetaFromConnectors, getActionsMetaSummary, getActionsMetaSummaryFromConnectors, getRefreshTokenExpiresIn, getTokenExpiresIn, hasCatastrophicBacktrackingRisk, isConnectorReleased, isMcpConnector, isPolicyErrorType, loadConnector, maskFields, paginate, parseActionInputs, parseYamlConnector, runAction, runConnectorActionById, runConnectorActionByPath, runEventActionById, runStepAction, runTestActions, runWebhookSetupPhase, supportsRefreshAuthentication, validateYamlConnector };
5915
+ export { ACTION_SCHEMA, ActingUserRequiredError, type ActionMetaAuthenticationConfig, type ActionPolicy, CATEGORY_ACRONYMS, CONNECTOR_YAML_SCHEMA, type CallAction, type CompleteMcpConnectorOptions, type CompletedMcpConnector, ConnectSDKError, type ConnectorMeta, type ConnectorMetaEvent, type ConnectorMetaSummary, type CreatePaginatorOptions, DEFAULT_TIME_FILTER_SAFETY_BUFFER_SECONDS, DELTA_TOKEN_INCREMENTAL_SCHEMA, type EnabledActionsConfig, type ErrorType, type GenerateMcpConnectorInput, type GeneratedMcpConnector, INCREMENTAL_SCHEMA, IncompatibleAuthTypeError, type IncrementalStrategy, type InputValidationError, InvalidActionInputsError, InvalidEventOutputError, POLICY_ERROR_STATUS, type PaginateOptions, type PaginateResult, type PaginationProgress, type Paginator, PolicyDeniedError, type PolicyErrorType, PolicyEvaluationError, PolicyPreparseError, type ReleaseStageCountGroup, type ReleaseStageCounts, type ReleaseStageCountsResolution, type ReleaseStageProfile, type ReleaseStageProfileItem, type ReleaseStageResolution, TIME_FILTER_INCREMENTAL_SCHEMA, type ValidationError, type ValidationErrorResponse, type WebhookSetupPhaseResult, addMcpToolActions, applyDefender, applyReleaseStageResolutionToMeta, applyReleaseStageToConnector, buildReleaseStageProfile, completeMcpConnector, computeCredentialsVerifiedByAuth, countReleaseStageProfile, createBlock, createCursorPaginator, createDeltaTokenStrategy, createIncrementalStrategy, createOffsetPaginator, createPagePaginator, createPaginator, createTimeFilterStrategy, decideInvokeTool, decideReadFields, evaluateExternalAccountIdExtractorByConnector, executeStepFunction, extractItems, fieldPathsOf, filterActionsByAuthType, formatValidationErrorResponse, generateMcpConnector, getActionAuthenticationMethods, getActionFromUrl, getActionMeta, getActionsMeta, getActionsMetaFromConnectors, getActionsMetaSummary, getActionsMetaSummaryFromConnectors, getRefreshTokenExpiresIn, getTokenExpiresIn, hasCatastrophicBacktrackingRisk, isConnectorReleased, isMcpConnector, isPolicyErrorType, loadConnector, maskFields, paginate, parseActionInputs, parseYamlConnector, resolveReleaseStageCounts, resolveReleaseStageProfile, runAction, runConnectorActionById, runConnectorActionByPath, runEventActionById, runStepAction, runTestActions, runWebhookSetupPhase, supportsRefreshAuthentication, validateYamlConnector };