@stackone/connect-sdk 3.16.0 → 3.18.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, 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";
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, UserScope, 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";
@@ -144,7 +144,7 @@ declare const resolveReleaseStageCounts: (counts: ReleaseStageCounts, owner: str
144
144
  declare const applyReleaseStageToConnector: (connector: Connector, allowedStages?: string[]) => Connector | undefined;
145
145
  //#endregion
146
146
  //#region src/errors/types.d.ts
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';
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' | 'USER_SCOPE_VIOLATION_ERROR';
148
148
  //#endregion
149
149
  //#region src/errors/connectSDKErrors.d.ts
150
150
  type InputValidationError = {
@@ -170,6 +170,9 @@ declare class IncompatibleAuthTypeError extends ConnectSDKError {
170
170
  declare class ActingUserRequiredError extends ConnectSDKError {
171
171
  constructor(context: BlockContext, message?: string);
172
172
  }
173
+ declare class UserScopeViolationError extends ConnectSDKError {
174
+ constructor(context: BlockContext, message?: string);
175
+ }
173
176
  declare class InvalidEventOutputError extends ConnectSDKError {
174
177
  constructor(context: BlockContext, message?: string);
175
178
  }
@@ -517,7 +520,9 @@ declare const ACTION_SCHEMA: z.ZodObject<{
517
520
  }, z.core.$strict>>;
518
521
  providerEvents: z.ZodOptional<z.ZodArray<z.ZodString>>;
519
522
  prerequisiteActions: z.ZodOptional<z.ZodArray<z.ZodString>>;
520
- userScoped: z.ZodOptional<z.ZodBoolean>;
523
+ userScoped: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
524
+ identity: z.ZodArray<z.ZodString>;
525
+ }, z.core.$strict>]>>;
521
526
  }, z.core.$strict>;
522
527
  declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
523
528
  StackOne: z.ZodString;
@@ -1105,7 +1110,9 @@ declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
1105
1110
  }, z.core.$strict>>;
1106
1111
  providerEvents: z.ZodOptional<z.ZodArray<z.ZodString>>;
1107
1112
  prerequisiteActions: z.ZodOptional<z.ZodArray<z.ZodString>>;
1108
- userScoped: z.ZodOptional<z.ZodBoolean>;
1113
+ userScoped: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
1114
+ identity: z.ZodArray<z.ZodString>;
1115
+ }, z.core.$strict>]>>;
1109
1116
  actionType: z.ZodLiteral<"refresh_token">;
1110
1117
  }, z.core.$strict>;
1111
1118
  }, z.core.$strict>>;
@@ -1421,7 +1428,9 @@ declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
1421
1428
  }, z.core.$strict>>;
1422
1429
  providerEvents: z.ZodOptional<z.ZodArray<z.ZodString>>;
1423
1430
  prerequisiteActions: z.ZodOptional<z.ZodArray<z.ZodString>>;
1424
- userScoped: z.ZodOptional<z.ZodBoolean>;
1431
+ userScoped: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
1432
+ identity: z.ZodArray<z.ZodString>;
1433
+ }, z.core.$strict>]>>;
1425
1434
  }, z.core.$strict>]>;
1426
1435
  condition: z.ZodOptional<z.ZodString>;
1427
1436
  required: z.ZodDefault<z.ZodBoolean>;
@@ -1988,7 +1997,9 @@ declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
1988
1997
  }, z.core.$strict>>;
1989
1998
  providerEvents: z.ZodOptional<z.ZodArray<z.ZodString>>;
1990
1999
  prerequisiteActions: z.ZodOptional<z.ZodArray<z.ZodString>>;
1991
- userScoped: z.ZodOptional<z.ZodBoolean>;
2000
+ userScoped: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
2001
+ identity: z.ZodArray<z.ZodString>;
2002
+ }, z.core.$strict>]>>;
1992
2003
  actionType: z.ZodLiteral<"refresh_token">;
1993
2004
  }, z.core.$strict>;
1994
2005
  }, z.core.$strict>>;
@@ -2304,7 +2315,9 @@ declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
2304
2315
  }, z.core.$strict>>;
2305
2316
  providerEvents: z.ZodOptional<z.ZodArray<z.ZodString>>;
2306
2317
  prerequisiteActions: z.ZodOptional<z.ZodArray<z.ZodString>>;
2307
- userScoped: z.ZodOptional<z.ZodBoolean>;
2318
+ userScoped: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
2319
+ identity: z.ZodArray<z.ZodString>;
2320
+ }, z.core.$strict>]>>;
2308
2321
  }, z.core.$strict>]>;
2309
2322
  condition: z.ZodOptional<z.ZodString>;
2310
2323
  required: z.ZodDefault<z.ZodBoolean>;
@@ -2867,7 +2880,9 @@ declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
2867
2880
  }, z.core.$strict>>;
2868
2881
  providerEvents: z.ZodOptional<z.ZodArray<z.ZodString>>;
2869
2882
  prerequisiteActions: z.ZodOptional<z.ZodArray<z.ZodString>>;
2870
- userScoped: z.ZodOptional<z.ZodBoolean>;
2883
+ userScoped: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
2884
+ identity: z.ZodArray<z.ZodString>;
2885
+ }, z.core.$strict>]>>;
2871
2886
  actionType: z.ZodLiteral<"refresh_token">;
2872
2887
  }, z.core.$strict>;
2873
2888
  }, z.core.$strict>>;
@@ -3183,7 +3198,9 @@ declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
3183
3198
  }, z.core.$strict>>;
3184
3199
  providerEvents: z.ZodOptional<z.ZodArray<z.ZodString>>;
3185
3200
  prerequisiteActions: z.ZodOptional<z.ZodArray<z.ZodString>>;
3186
- userScoped: z.ZodOptional<z.ZodBoolean>;
3201
+ userScoped: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
3202
+ identity: z.ZodArray<z.ZodString>;
3203
+ }, z.core.$strict>]>>;
3187
3204
  }, z.core.$strict>]>;
3188
3205
  condition: z.ZodOptional<z.ZodString>;
3189
3206
  required: z.ZodDefault<z.ZodBoolean>;
@@ -3746,7 +3763,9 @@ declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
3746
3763
  }, z.core.$strict>>;
3747
3764
  providerEvents: z.ZodOptional<z.ZodArray<z.ZodString>>;
3748
3765
  prerequisiteActions: z.ZodOptional<z.ZodArray<z.ZodString>>;
3749
- userScoped: z.ZodOptional<z.ZodBoolean>;
3766
+ userScoped: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
3767
+ identity: z.ZodArray<z.ZodString>;
3768
+ }, z.core.$strict>]>>;
3750
3769
  actionType: z.ZodLiteral<"refresh_token">;
3751
3770
  }, z.core.$strict>;
3752
3771
  }, z.core.$strict>>;
@@ -4062,7 +4081,9 @@ declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
4062
4081
  }, z.core.$strict>>;
4063
4082
  providerEvents: z.ZodOptional<z.ZodArray<z.ZodString>>;
4064
4083
  prerequisiteActions: z.ZodOptional<z.ZodArray<z.ZodString>>;
4065
- userScoped: z.ZodOptional<z.ZodBoolean>;
4084
+ userScoped: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
4085
+ identity: z.ZodArray<z.ZodString>;
4086
+ }, z.core.$strict>]>>;
4066
4087
  }, z.core.$strict>]>;
4067
4088
  condition: z.ZodOptional<z.ZodString>;
4068
4089
  required: z.ZodDefault<z.ZodBoolean>;
@@ -4389,7 +4410,9 @@ declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
4389
4410
  }, z.core.$strict>>;
4390
4411
  providerEvents: z.ZodOptional<z.ZodArray<z.ZodString>>;
4391
4412
  prerequisiteActions: z.ZodOptional<z.ZodArray<z.ZodString>>;
4392
- userScoped: z.ZodOptional<z.ZodBoolean>;
4413
+ userScoped: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
4414
+ identity: z.ZodArray<z.ZodString>;
4415
+ }, z.core.$strict>]>>;
4393
4416
  }, z.core.$strict>>>;
4394
4417
  events: z.ZodOptional<z.ZodObject<{
4395
4418
  setup: z.ZodOptional<z.ZodObject<{
@@ -4817,7 +4840,9 @@ declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
4817
4840
  }, z.core.$strict>>;
4818
4841
  providerEvents: z.ZodOptional<z.ZodArray<z.ZodString>>;
4819
4842
  prerequisiteActions: z.ZodOptional<z.ZodArray<z.ZodString>>;
4820
- userScoped: z.ZodOptional<z.ZodBoolean>;
4843
+ userScoped: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
4844
+ identity: z.ZodArray<z.ZodString>;
4845
+ }, z.core.$strict>]>>;
4821
4846
  actionType: z.ZodLiteral<"event">;
4822
4847
  requiresManualSetup: z.ZodOptional<z.ZodBoolean>;
4823
4848
  }, z.core.$strict>>>;
@@ -5137,7 +5162,9 @@ declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
5137
5162
  }, z.core.$strict>>;
5138
5163
  providerEvents: z.ZodOptional<z.ZodArray<z.ZodString>>;
5139
5164
  prerequisiteActions: z.ZodOptional<z.ZodArray<z.ZodString>>;
5140
- userScoped: z.ZodOptional<z.ZodBoolean>;
5165
+ userScoped: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
5166
+ identity: z.ZodArray<z.ZodString>;
5167
+ }, z.core.$strict>]>>;
5141
5168
  actionType: z.ZodLiteral<"custom">;
5142
5169
  result: z.ZodString;
5143
5170
  }, z.core.$strict>>;
@@ -5201,7 +5228,7 @@ type PolicyErrorType = keyof typeof POLICY_ERROR_STATUS;
5201
5228
  declare const isPolicyErrorType: (errorType: ErrorType) => errorType is PolicyErrorType;
5202
5229
  //#endregion
5203
5230
  //#region src/errors/refusal.d.ts
5204
- type RefusalType = PolicyErrorType | 'ACTING_USER_REQUIRED_ERROR';
5231
+ type RefusalType = PolicyErrorType | 'ACTING_USER_REQUIRED_ERROR' | 'USER_SCOPE_VIOLATION_ERROR';
5205
5232
  type Refusal = {
5206
5233
  errorType: RefusalType;
5207
5234
  message: string;
@@ -5382,7 +5409,7 @@ interface MetaAction {
5382
5409
  releaseStage?: ReleaseStage;
5383
5410
  effects?: Effect[];
5384
5411
  annotations?: ActionAnnotations;
5385
- userScoped?: boolean;
5412
+ userScoped?: boolean | UserScope;
5386
5413
  [key: string]: unknown;
5387
5414
  }
5388
5415
  type ConnectorMetaAuthenticationConfig = {
@@ -5508,7 +5535,7 @@ type PolicyCall = {
5508
5535
  declare const decideReadFields: (input: {
5509
5536
  policy: ActionPolicy;
5510
5537
  account: Account;
5511
- action: Pick<Action, "id" | "categories"> & Partial<Pick<Action, "description" | "steps">>;
5538
+ action: Pick<Action, "id" | "categories"> & Partial<Pick<Action, "description" | "steps" | "dataSync">>;
5512
5539
  paths: string[];
5513
5540
  valueTypes?: Record<string, FieldValueType>;
5514
5541
  neighbours?: Record<string, FieldNeighbours>;
@@ -6002,4 +6029,4 @@ declare const runWebhookSetupPhase: ({
6002
6029
  runStepActionFn?: typeof runStepAction;
6003
6030
  }) => Promise<WebhookSetupPhaseResult>;
6004
6031
  //#endregion
6005
- 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 FieldLabeller, type FieldValueType, type GenerateMcpConnectorInput, type GeneratedMcpConnector, INCREMENTAL_SCHEMA, IncompatibleAuthTypeError, type IncrementalStrategy, type InputValidationError, InvalidActionInputsError, InvalidEventOutputError, type LabelAnswer, type LabelDecision, type LabelEvidence, type LabelQuestion, type LabellingOutcome, MAX_FIELD_PATHS, POLICY_ERROR_STATUS, type PaginateOptions, type PaginateResult, type PaginationProgress, type Paginator, PolicyDeniedError, type PolicyErrorType, PolicyEvaluationError, PolicyPreparseError, type Refusal, type RefusalType, 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, createLabellingDecideReadFields, createOffsetPaginator, createPagePaginator, createPaginator, createTimeFilterStrategy, decideInvokeTool, decideReadFields, definitionVersionOf, evaluateExternalAccountIdExtractorByConnector, executeStepFunction, extractItems, fieldPathsOf, filterActionsByAuthType, formatValidationErrorResponse, generateMcpConnector, getActionAuthenticationMethods, getActionFromUrl, getActionMeta, getActionsMeta, getActionsMetaFromConnectors, getActionsMetaSummary, getActionsMetaSummaryFromConnectors, getRefreshTokenExpiresIn, getTokenExpiresIn, hasCatastrophicBacktrackingRisk, isConnectorReleased, isMcpConnector, isPolicyErrorType, labelKeyOf, labelsReferencedBy, loadConnector, maskFields, paginate, parseActionInputs, parseYamlConnector, providerRequestsOf, refusalOf, resolveReleaseStageCounts, resolveReleaseStageProfile, runAction, runConnectorActionById, runConnectorActionByPath, runEventActionById, runStepAction, runTestActions, runWebhookSetupPhase, supportsRefreshAuthentication, unlabelledAllowPolicyIdsOf, validateYamlConnector };
6032
+ 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 FieldLabeller, type FieldValueType, type GenerateMcpConnectorInput, type GeneratedMcpConnector, INCREMENTAL_SCHEMA, IncompatibleAuthTypeError, type IncrementalStrategy, type InputValidationError, InvalidActionInputsError, InvalidEventOutputError, type LabelAnswer, type LabelDecision, type LabelEvidence, type LabelQuestion, type LabellingOutcome, MAX_FIELD_PATHS, POLICY_ERROR_STATUS, type PaginateOptions, type PaginateResult, type PaginationProgress, type Paginator, PolicyDeniedError, type PolicyErrorType, PolicyEvaluationError, PolicyPreparseError, type Refusal, type RefusalType, type ReleaseStageCountGroup, type ReleaseStageCounts, type ReleaseStageCountsResolution, type ReleaseStageProfile, type ReleaseStageProfileItem, type ReleaseStageResolution, TIME_FILTER_INCREMENTAL_SCHEMA, UserScopeViolationError, type ValidationError, type ValidationErrorResponse, type WebhookSetupPhaseResult, addMcpToolActions, applyDefender, applyReleaseStageResolutionToMeta, applyReleaseStageToConnector, buildReleaseStageProfile, completeMcpConnector, computeCredentialsVerifiedByAuth, countReleaseStageProfile, createBlock, createCursorPaginator, createDeltaTokenStrategy, createIncrementalStrategy, createLabellingDecideReadFields, createOffsetPaginator, createPagePaginator, createPaginator, createTimeFilterStrategy, decideInvokeTool, decideReadFields, definitionVersionOf, evaluateExternalAccountIdExtractorByConnector, executeStepFunction, extractItems, fieldPathsOf, filterActionsByAuthType, formatValidationErrorResponse, generateMcpConnector, getActionAuthenticationMethods, getActionFromUrl, getActionMeta, getActionsMeta, getActionsMetaFromConnectors, getActionsMetaSummary, getActionsMetaSummaryFromConnectors, getRefreshTokenExpiresIn, getTokenExpiresIn, hasCatastrophicBacktrackingRisk, isConnectorReleased, isMcpConnector, isPolicyErrorType, labelKeyOf, labelsReferencedBy, loadConnector, maskFields, paginate, parseActionInputs, parseYamlConnector, providerRequestsOf, refusalOf, resolveReleaseStageCounts, resolveReleaseStageProfile, runAction, runConnectorActionById, runConnectorActionByPath, runEventActionById, runStepAction, runTestActions, runWebhookSetupPhase, supportsRefreshAuthentication, unlabelledAllowPolicyIdsOf, 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, 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";
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, UserScope, 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";
@@ -143,7 +143,7 @@ declare const resolveReleaseStageCounts: (counts: ReleaseStageCounts, owner: str
143
143
  declare const applyReleaseStageToConnector: (connector: Connector, allowedStages?: string[]) => Connector | undefined;
144
144
  //#endregion
145
145
  //#region src/errors/types.d.ts
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';
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' | 'USER_SCOPE_VIOLATION_ERROR';
147
147
  //#endregion
148
148
  //#region src/errors/connectSDKErrors.d.ts
149
149
  type InputValidationError = {
@@ -169,6 +169,9 @@ declare class IncompatibleAuthTypeError extends ConnectSDKError {
169
169
  declare class ActingUserRequiredError extends ConnectSDKError {
170
170
  constructor(context: BlockContext, message?: string);
171
171
  }
172
+ declare class UserScopeViolationError extends ConnectSDKError {
173
+ constructor(context: BlockContext, message?: string);
174
+ }
172
175
  declare class InvalidEventOutputError extends ConnectSDKError {
173
176
  constructor(context: BlockContext, message?: string);
174
177
  }
@@ -516,7 +519,9 @@ declare const ACTION_SCHEMA: z.ZodObject<{
516
519
  }, z.core.$strict>>;
517
520
  providerEvents: z.ZodOptional<z.ZodArray<z.ZodString>>;
518
521
  prerequisiteActions: z.ZodOptional<z.ZodArray<z.ZodString>>;
519
- userScoped: z.ZodOptional<z.ZodBoolean>;
522
+ userScoped: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
523
+ identity: z.ZodArray<z.ZodString>;
524
+ }, z.core.$strict>]>>;
520
525
  }, z.core.$strict>;
521
526
  declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
522
527
  StackOne: z.ZodString;
@@ -1104,7 +1109,9 @@ declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
1104
1109
  }, z.core.$strict>>;
1105
1110
  providerEvents: z.ZodOptional<z.ZodArray<z.ZodString>>;
1106
1111
  prerequisiteActions: z.ZodOptional<z.ZodArray<z.ZodString>>;
1107
- userScoped: z.ZodOptional<z.ZodBoolean>;
1112
+ userScoped: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
1113
+ identity: z.ZodArray<z.ZodString>;
1114
+ }, z.core.$strict>]>>;
1108
1115
  actionType: z.ZodLiteral<"refresh_token">;
1109
1116
  }, z.core.$strict>;
1110
1117
  }, z.core.$strict>>;
@@ -1420,7 +1427,9 @@ declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
1420
1427
  }, z.core.$strict>>;
1421
1428
  providerEvents: z.ZodOptional<z.ZodArray<z.ZodString>>;
1422
1429
  prerequisiteActions: z.ZodOptional<z.ZodArray<z.ZodString>>;
1423
- userScoped: z.ZodOptional<z.ZodBoolean>;
1430
+ userScoped: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
1431
+ identity: z.ZodArray<z.ZodString>;
1432
+ }, z.core.$strict>]>>;
1424
1433
  }, z.core.$strict>]>;
1425
1434
  condition: z.ZodOptional<z.ZodString>;
1426
1435
  required: z.ZodDefault<z.ZodBoolean>;
@@ -1987,7 +1996,9 @@ declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
1987
1996
  }, z.core.$strict>>;
1988
1997
  providerEvents: z.ZodOptional<z.ZodArray<z.ZodString>>;
1989
1998
  prerequisiteActions: z.ZodOptional<z.ZodArray<z.ZodString>>;
1990
- userScoped: z.ZodOptional<z.ZodBoolean>;
1999
+ userScoped: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
2000
+ identity: z.ZodArray<z.ZodString>;
2001
+ }, z.core.$strict>]>>;
1991
2002
  actionType: z.ZodLiteral<"refresh_token">;
1992
2003
  }, z.core.$strict>;
1993
2004
  }, z.core.$strict>>;
@@ -2303,7 +2314,9 @@ declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
2303
2314
  }, z.core.$strict>>;
2304
2315
  providerEvents: z.ZodOptional<z.ZodArray<z.ZodString>>;
2305
2316
  prerequisiteActions: z.ZodOptional<z.ZodArray<z.ZodString>>;
2306
- userScoped: z.ZodOptional<z.ZodBoolean>;
2317
+ userScoped: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
2318
+ identity: z.ZodArray<z.ZodString>;
2319
+ }, z.core.$strict>]>>;
2307
2320
  }, z.core.$strict>]>;
2308
2321
  condition: z.ZodOptional<z.ZodString>;
2309
2322
  required: z.ZodDefault<z.ZodBoolean>;
@@ -2866,7 +2879,9 @@ declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
2866
2879
  }, z.core.$strict>>;
2867
2880
  providerEvents: z.ZodOptional<z.ZodArray<z.ZodString>>;
2868
2881
  prerequisiteActions: z.ZodOptional<z.ZodArray<z.ZodString>>;
2869
- userScoped: z.ZodOptional<z.ZodBoolean>;
2882
+ userScoped: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
2883
+ identity: z.ZodArray<z.ZodString>;
2884
+ }, z.core.$strict>]>>;
2870
2885
  actionType: z.ZodLiteral<"refresh_token">;
2871
2886
  }, z.core.$strict>;
2872
2887
  }, z.core.$strict>>;
@@ -3182,7 +3197,9 @@ declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
3182
3197
  }, z.core.$strict>>;
3183
3198
  providerEvents: z.ZodOptional<z.ZodArray<z.ZodString>>;
3184
3199
  prerequisiteActions: z.ZodOptional<z.ZodArray<z.ZodString>>;
3185
- userScoped: z.ZodOptional<z.ZodBoolean>;
3200
+ userScoped: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
3201
+ identity: z.ZodArray<z.ZodString>;
3202
+ }, z.core.$strict>]>>;
3186
3203
  }, z.core.$strict>]>;
3187
3204
  condition: z.ZodOptional<z.ZodString>;
3188
3205
  required: z.ZodDefault<z.ZodBoolean>;
@@ -3745,7 +3762,9 @@ declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
3745
3762
  }, z.core.$strict>>;
3746
3763
  providerEvents: z.ZodOptional<z.ZodArray<z.ZodString>>;
3747
3764
  prerequisiteActions: z.ZodOptional<z.ZodArray<z.ZodString>>;
3748
- userScoped: z.ZodOptional<z.ZodBoolean>;
3765
+ userScoped: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
3766
+ identity: z.ZodArray<z.ZodString>;
3767
+ }, z.core.$strict>]>>;
3749
3768
  actionType: z.ZodLiteral<"refresh_token">;
3750
3769
  }, z.core.$strict>;
3751
3770
  }, z.core.$strict>>;
@@ -4061,7 +4080,9 @@ declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
4061
4080
  }, z.core.$strict>>;
4062
4081
  providerEvents: z.ZodOptional<z.ZodArray<z.ZodString>>;
4063
4082
  prerequisiteActions: z.ZodOptional<z.ZodArray<z.ZodString>>;
4064
- userScoped: z.ZodOptional<z.ZodBoolean>;
4083
+ userScoped: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
4084
+ identity: z.ZodArray<z.ZodString>;
4085
+ }, z.core.$strict>]>>;
4065
4086
  }, z.core.$strict>]>;
4066
4087
  condition: z.ZodOptional<z.ZodString>;
4067
4088
  required: z.ZodDefault<z.ZodBoolean>;
@@ -4388,7 +4409,9 @@ declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
4388
4409
  }, z.core.$strict>>;
4389
4410
  providerEvents: z.ZodOptional<z.ZodArray<z.ZodString>>;
4390
4411
  prerequisiteActions: z.ZodOptional<z.ZodArray<z.ZodString>>;
4391
- userScoped: z.ZodOptional<z.ZodBoolean>;
4412
+ userScoped: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
4413
+ identity: z.ZodArray<z.ZodString>;
4414
+ }, z.core.$strict>]>>;
4392
4415
  }, z.core.$strict>>>;
4393
4416
  events: z.ZodOptional<z.ZodObject<{
4394
4417
  setup: z.ZodOptional<z.ZodObject<{
@@ -4816,7 +4839,9 @@ declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
4816
4839
  }, z.core.$strict>>;
4817
4840
  providerEvents: z.ZodOptional<z.ZodArray<z.ZodString>>;
4818
4841
  prerequisiteActions: z.ZodOptional<z.ZodArray<z.ZodString>>;
4819
- userScoped: z.ZodOptional<z.ZodBoolean>;
4842
+ userScoped: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
4843
+ identity: z.ZodArray<z.ZodString>;
4844
+ }, z.core.$strict>]>>;
4820
4845
  actionType: z.ZodLiteral<"event">;
4821
4846
  requiresManualSetup: z.ZodOptional<z.ZodBoolean>;
4822
4847
  }, z.core.$strict>>>;
@@ -5136,7 +5161,9 @@ declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
5136
5161
  }, z.core.$strict>>;
5137
5162
  providerEvents: z.ZodOptional<z.ZodArray<z.ZodString>>;
5138
5163
  prerequisiteActions: z.ZodOptional<z.ZodArray<z.ZodString>>;
5139
- userScoped: z.ZodOptional<z.ZodBoolean>;
5164
+ userScoped: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
5165
+ identity: z.ZodArray<z.ZodString>;
5166
+ }, z.core.$strict>]>>;
5140
5167
  actionType: z.ZodLiteral<"custom">;
5141
5168
  result: z.ZodString;
5142
5169
  }, z.core.$strict>>;
@@ -5200,7 +5227,7 @@ type PolicyErrorType = keyof typeof POLICY_ERROR_STATUS;
5200
5227
  declare const isPolicyErrorType: (errorType: ErrorType) => errorType is PolicyErrorType;
5201
5228
  //#endregion
5202
5229
  //#region src/errors/refusal.d.ts
5203
- type RefusalType = PolicyErrorType | 'ACTING_USER_REQUIRED_ERROR';
5230
+ type RefusalType = PolicyErrorType | 'ACTING_USER_REQUIRED_ERROR' | 'USER_SCOPE_VIOLATION_ERROR';
5204
5231
  type Refusal = {
5205
5232
  errorType: RefusalType;
5206
5233
  message: string;
@@ -5381,7 +5408,7 @@ interface MetaAction {
5381
5408
  releaseStage?: ReleaseStage;
5382
5409
  effects?: Effect[];
5383
5410
  annotations?: ActionAnnotations;
5384
- userScoped?: boolean;
5411
+ userScoped?: boolean | UserScope;
5385
5412
  [key: string]: unknown;
5386
5413
  }
5387
5414
  type ConnectorMetaAuthenticationConfig = {
@@ -5507,7 +5534,7 @@ type PolicyCall = {
5507
5534
  declare const decideReadFields: (input: {
5508
5535
  policy: ActionPolicy;
5509
5536
  account: Account;
5510
- action: Pick<Action, "id" | "categories"> & Partial<Pick<Action, "description" | "steps">>;
5537
+ action: Pick<Action, "id" | "categories"> & Partial<Pick<Action, "description" | "steps" | "dataSync">>;
5511
5538
  paths: string[];
5512
5539
  valueTypes?: Record<string, FieldValueType>;
5513
5540
  neighbours?: Record<string, FieldNeighbours>;
@@ -6001,4 +6028,4 @@ declare const runWebhookSetupPhase: ({
6001
6028
  runStepActionFn?: typeof runStepAction;
6002
6029
  }) => Promise<WebhookSetupPhaseResult>;
6003
6030
  //#endregion
6004
- 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 FieldLabeller, type FieldValueType, type GenerateMcpConnectorInput, type GeneratedMcpConnector, INCREMENTAL_SCHEMA, IncompatibleAuthTypeError, type IncrementalStrategy, type InputValidationError, InvalidActionInputsError, InvalidEventOutputError, type LabelAnswer, type LabelDecision, type LabelEvidence, type LabelQuestion, type LabellingOutcome, MAX_FIELD_PATHS, POLICY_ERROR_STATUS, type PaginateOptions, type PaginateResult, type PaginationProgress, type Paginator, PolicyDeniedError, type PolicyErrorType, PolicyEvaluationError, PolicyPreparseError, type Refusal, type RefusalType, 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, createLabellingDecideReadFields, createOffsetPaginator, createPagePaginator, createPaginator, createTimeFilterStrategy, decideInvokeTool, decideReadFields, definitionVersionOf, evaluateExternalAccountIdExtractorByConnector, executeStepFunction, extractItems, fieldPathsOf, filterActionsByAuthType, formatValidationErrorResponse, generateMcpConnector, getActionAuthenticationMethods, getActionFromUrl, getActionMeta, getActionsMeta, getActionsMetaFromConnectors, getActionsMetaSummary, getActionsMetaSummaryFromConnectors, getRefreshTokenExpiresIn, getTokenExpiresIn, hasCatastrophicBacktrackingRisk, isConnectorReleased, isMcpConnector, isPolicyErrorType, labelKeyOf, labelsReferencedBy, loadConnector, maskFields, paginate, parseActionInputs, parseYamlConnector, providerRequestsOf, refusalOf, resolveReleaseStageCounts, resolveReleaseStageProfile, runAction, runConnectorActionById, runConnectorActionByPath, runEventActionById, runStepAction, runTestActions, runWebhookSetupPhase, supportsRefreshAuthentication, unlabelledAllowPolicyIdsOf, validateYamlConnector };
6031
+ 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 FieldLabeller, type FieldValueType, type GenerateMcpConnectorInput, type GeneratedMcpConnector, INCREMENTAL_SCHEMA, IncompatibleAuthTypeError, type IncrementalStrategy, type InputValidationError, InvalidActionInputsError, InvalidEventOutputError, type LabelAnswer, type LabelDecision, type LabelEvidence, type LabelQuestion, type LabellingOutcome, MAX_FIELD_PATHS, POLICY_ERROR_STATUS, type PaginateOptions, type PaginateResult, type PaginationProgress, type Paginator, PolicyDeniedError, type PolicyErrorType, PolicyEvaluationError, PolicyPreparseError, type Refusal, type RefusalType, type ReleaseStageCountGroup, type ReleaseStageCounts, type ReleaseStageCountsResolution, type ReleaseStageProfile, type ReleaseStageProfileItem, type ReleaseStageResolution, TIME_FILTER_INCREMENTAL_SCHEMA, UserScopeViolationError, type ValidationError, type ValidationErrorResponse, type WebhookSetupPhaseResult, addMcpToolActions, applyDefender, applyReleaseStageResolutionToMeta, applyReleaseStageToConnector, buildReleaseStageProfile, completeMcpConnector, computeCredentialsVerifiedByAuth, countReleaseStageProfile, createBlock, createCursorPaginator, createDeltaTokenStrategy, createIncrementalStrategy, createLabellingDecideReadFields, createOffsetPaginator, createPagePaginator, createPaginator, createTimeFilterStrategy, decideInvokeTool, decideReadFields, definitionVersionOf, evaluateExternalAccountIdExtractorByConnector, executeStepFunction, extractItems, fieldPathsOf, filterActionsByAuthType, formatValidationErrorResponse, generateMcpConnector, getActionAuthenticationMethods, getActionFromUrl, getActionMeta, getActionsMeta, getActionsMetaFromConnectors, getActionsMetaSummary, getActionsMetaSummaryFromConnectors, getRefreshTokenExpiresIn, getTokenExpiresIn, hasCatastrophicBacktrackingRisk, isConnectorReleased, isMcpConnector, isPolicyErrorType, labelKeyOf, labelsReferencedBy, loadConnector, maskFields, paginate, parseActionInputs, parseYamlConnector, providerRequestsOf, refusalOf, resolveReleaseStageCounts, resolveReleaseStageProfile, runAction, runConnectorActionById, runConnectorActionByPath, runEventActionById, runStepAction, runTestActions, runWebhookSetupPhase, supportsRefreshAuthentication, unlabelledAllowPolicyIdsOf, validateYamlConnector };