@stackone/connect-sdk 3.12.0 → 3.14.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
@@ -5200,6 +5200,15 @@ declare const POLICY_ERROR_STATUS: {
5200
5200
  type PolicyErrorType = keyof typeof POLICY_ERROR_STATUS;
5201
5201
  declare const isPolicyErrorType: (errorType: ErrorType) => errorType is PolicyErrorType;
5202
5202
  //#endregion
5203
+ //#region src/errors/refusal.d.ts
5204
+ type RefusalType = PolicyErrorType | 'ACTING_USER_REQUIRED_ERROR';
5205
+ type Refusal = {
5206
+ errorType: RefusalType;
5207
+ message: string;
5208
+ level?: string;
5209
+ };
5210
+ declare const refusalOf: (error: unknown) => Refusal | undefined;
5211
+ //#endregion
5203
5212
  //#region src/exhaustivePagination/types.d.ts
5204
5213
  type CallAction = (inputs: Record<string, unknown>) => Promise<Block>;
5205
5214
  interface Paginator {
@@ -5461,12 +5470,32 @@ declare const getActionsMetaSummaryFromConnectors: (connectors: Connector[], inc
5461
5470
  //#region src/meta/releaseStage.d.ts
5462
5471
  declare const applyReleaseStageResolutionToMeta: (meta: ConnectorMeta, resolution: ReleaseStageResolution | undefined) => ConnectorMeta | undefined;
5463
5472
  //#endregion
5473
+ //#region src/runners/fieldPaths.d.ts
5474
+ declare const MAX_FIELD_PATHS = 250;
5475
+ type FieldValueType = 'string' | 'number' | 'boolean' | 'null' | 'mixed';
5476
+ type FieldNeighbours = {
5477
+ parent: string;
5478
+ siblings: string[];
5479
+ siblingCount: number;
5480
+ };
5481
+ declare const fieldPathsOf: (payload: unknown, options?: {
5482
+ maxPaths?: number;
5483
+ }) => {
5484
+ paths: string[];
5485
+ truncated: boolean;
5486
+ valueTypes: Record<string, FieldValueType>;
5487
+ neighbours: Record<string, FieldNeighbours>;
5488
+ };
5489
+ declare const labelKeyOf: (path: string) => string;
5490
+ //#endregion
5464
5491
  //#region src/runners/actionPolicy.d.ts
5465
5492
  type ActionPolicy = {
5466
5493
  levels: LevelPolicies[];
5467
5494
  principal?: PrincipalRef;
5468
5495
  client?: string;
5469
5496
  toolName?: string;
5497
+ fieldLabels?: Record<string, string[]>;
5498
+ labelDefinitions?: Record<string, string>;
5470
5499
  };
5471
5500
  type PolicyCall = {
5472
5501
  actionRunId: string;
@@ -5478,8 +5507,10 @@ type PolicyCall = {
5478
5507
  declare const decideReadFields: (input: {
5479
5508
  policy: ActionPolicy;
5480
5509
  account: Account;
5481
- action: Pick<Action, "id" | "categories">;
5510
+ action: Pick<Action, "id" | "categories"> & Partial<Pick<Action, "description">>;
5482
5511
  paths: string[];
5512
+ valueTypes?: Record<string, FieldValueType>;
5513
+ neighbours?: Record<string, FieldNeighbours>;
5483
5514
  authType?: AuthType;
5484
5515
  sessionId?: string;
5485
5516
  logger?: ILogger;
@@ -5517,13 +5548,54 @@ declare const executeStepFunction: ({
5517
5548
  buildStepFunction?: typeof StepFunctionsFactory.build;
5518
5549
  }) => Promise<Block>;
5519
5550
  //#endregion
5520
- //#region src/runners/fieldPaths.d.ts
5521
- declare const fieldPathsOf: (payload: unknown, options?: {
5522
- maxPaths?: number;
5523
- }) => {
5524
- paths: string[];
5525
- truncated: boolean;
5551
+ //#region src/runners/fieldLabels.d.ts
5552
+ declare const definitionVersionOf: (definition: string) => string;
5553
+ type LabelEvidence = {
5554
+ fieldPath: string;
5555
+ connector: string;
5556
+ action: string;
5557
+ actionDescription?: string;
5558
+ valueType: FieldValueType;
5559
+ parent: string;
5560
+ siblings: string[];
5561
+ siblingCount: number;
5562
+ };
5563
+ type LabelQuestion = {
5564
+ labelKey: string;
5565
+ label: string;
5566
+ definition: string;
5567
+ evidence: LabelEvidence;
5568
+ };
5569
+ type LabelAnswer = {
5570
+ labelKey: string;
5571
+ label: string;
5572
+ score: number;
5573
+ };
5574
+ type FieldLabeller = (questions: LabelQuestion[], signal: AbortSignal) => Promise<{
5575
+ answers: LabelAnswer[];
5576
+ modelVersion: string;
5577
+ }>;
5578
+ type LabelDecision = {
5579
+ labelKey: string;
5580
+ label: string;
5581
+ score: number;
5582
+ modelVersion: string;
5583
+ definitionVersion: string;
5584
+ evidence: 'shape';
5585
+ };
5586
+ declare const labelsReferencedBy: (levels: LevelPolicies[]) => string[];
5587
+ declare const unlabelledAllowPolicyIdsOf: (levels: LevelPolicies[]) => Set<string>;
5588
+ type LabellingOutcome = {
5589
+ decisions: LabelDecision[];
5590
+ unanswered: string[];
5526
5591
  };
5592
+ declare const createLabellingDecideReadFields: (options: {
5593
+ labeller: FieldLabeller;
5594
+ thresholdFor: (label: string) => number;
5595
+ deadlineMs: number;
5596
+ onLabelled?: (outcome: LabellingOutcome) => void;
5597
+ decide?: typeof decideReadFields;
5598
+ }) => typeof decideReadFields;
5527
5599
  //#endregion
5528
5600
  //#region src/runners/maskFields.d.ts
5529
5601
  declare const maskFields: (payload: unknown, refused: readonly string[], cleared?: ReadonlySet<string>) => {
@@ -5926,4 +5998,4 @@ declare const runWebhookSetupPhase: ({
5926
5998
  runStepActionFn?: typeof runStepAction;
5927
5999
  }) => Promise<WebhookSetupPhaseResult>;
5928
6000
  //#endregion
5929
- 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 };
6001
+ 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, refusalOf, resolveReleaseStageCounts, resolveReleaseStageProfile, runAction, runConnectorActionById, runConnectorActionByPath, runEventActionById, runStepAction, runTestActions, runWebhookSetupPhase, supportsRefreshAuthentication, unlabelledAllowPolicyIdsOf, validateYamlConnector };
package/dist/index.d.mts CHANGED
@@ -5199,6 +5199,15 @@ declare const POLICY_ERROR_STATUS: {
5199
5199
  type PolicyErrorType = keyof typeof POLICY_ERROR_STATUS;
5200
5200
  declare const isPolicyErrorType: (errorType: ErrorType) => errorType is PolicyErrorType;
5201
5201
  //#endregion
5202
+ //#region src/errors/refusal.d.ts
5203
+ type RefusalType = PolicyErrorType | 'ACTING_USER_REQUIRED_ERROR';
5204
+ type Refusal = {
5205
+ errorType: RefusalType;
5206
+ message: string;
5207
+ level?: string;
5208
+ };
5209
+ declare const refusalOf: (error: unknown) => Refusal | undefined;
5210
+ //#endregion
5202
5211
  //#region src/exhaustivePagination/types.d.ts
5203
5212
  type CallAction = (inputs: Record<string, unknown>) => Promise<Block>;
5204
5213
  interface Paginator {
@@ -5460,12 +5469,32 @@ declare const getActionsMetaSummaryFromConnectors: (connectors: Connector[], inc
5460
5469
  //#region src/meta/releaseStage.d.ts
5461
5470
  declare const applyReleaseStageResolutionToMeta: (meta: ConnectorMeta, resolution: ReleaseStageResolution | undefined) => ConnectorMeta | undefined;
5462
5471
  //#endregion
5472
+ //#region src/runners/fieldPaths.d.ts
5473
+ declare const MAX_FIELD_PATHS = 250;
5474
+ type FieldValueType = 'string' | 'number' | 'boolean' | 'null' | 'mixed';
5475
+ type FieldNeighbours = {
5476
+ parent: string;
5477
+ siblings: string[];
5478
+ siblingCount: number;
5479
+ };
5480
+ declare const fieldPathsOf: (payload: unknown, options?: {
5481
+ maxPaths?: number;
5482
+ }) => {
5483
+ paths: string[];
5484
+ truncated: boolean;
5485
+ valueTypes: Record<string, FieldValueType>;
5486
+ neighbours: Record<string, FieldNeighbours>;
5487
+ };
5488
+ declare const labelKeyOf: (path: string) => string;
5489
+ //#endregion
5463
5490
  //#region src/runners/actionPolicy.d.ts
5464
5491
  type ActionPolicy = {
5465
5492
  levels: LevelPolicies[];
5466
5493
  principal?: PrincipalRef;
5467
5494
  client?: string;
5468
5495
  toolName?: string;
5496
+ fieldLabels?: Record<string, string[]>;
5497
+ labelDefinitions?: Record<string, string>;
5469
5498
  };
5470
5499
  type PolicyCall = {
5471
5500
  actionRunId: string;
@@ -5477,8 +5506,10 @@ type PolicyCall = {
5477
5506
  declare const decideReadFields: (input: {
5478
5507
  policy: ActionPolicy;
5479
5508
  account: Account;
5480
- action: Pick<Action, "id" | "categories">;
5509
+ action: Pick<Action, "id" | "categories"> & Partial<Pick<Action, "description">>;
5481
5510
  paths: string[];
5511
+ valueTypes?: Record<string, FieldValueType>;
5512
+ neighbours?: Record<string, FieldNeighbours>;
5482
5513
  authType?: AuthType;
5483
5514
  sessionId?: string;
5484
5515
  logger?: ILogger;
@@ -5516,13 +5547,54 @@ declare const executeStepFunction: ({
5516
5547
  buildStepFunction?: typeof StepFunctionsFactory.build;
5517
5548
  }) => Promise<Block>;
5518
5549
  //#endregion
5519
- //#region src/runners/fieldPaths.d.ts
5520
- declare const fieldPathsOf: (payload: unknown, options?: {
5521
- maxPaths?: number;
5522
- }) => {
5523
- paths: string[];
5524
- truncated: boolean;
5550
+ //#region src/runners/fieldLabels.d.ts
5551
+ declare const definitionVersionOf: (definition: string) => string;
5552
+ type LabelEvidence = {
5553
+ fieldPath: string;
5554
+ connector: string;
5555
+ action: string;
5556
+ actionDescription?: string;
5557
+ valueType: FieldValueType;
5558
+ parent: string;
5559
+ siblings: string[];
5560
+ siblingCount: number;
5561
+ };
5562
+ type LabelQuestion = {
5563
+ labelKey: string;
5564
+ label: string;
5565
+ definition: string;
5566
+ evidence: LabelEvidence;
5567
+ };
5568
+ type LabelAnswer = {
5569
+ labelKey: string;
5570
+ label: string;
5571
+ score: number;
5572
+ };
5573
+ type FieldLabeller = (questions: LabelQuestion[], signal: AbortSignal) => Promise<{
5574
+ answers: LabelAnswer[];
5575
+ modelVersion: string;
5576
+ }>;
5577
+ type LabelDecision = {
5578
+ labelKey: string;
5579
+ label: string;
5580
+ score: number;
5581
+ modelVersion: string;
5582
+ definitionVersion: string;
5583
+ evidence: 'shape';
5584
+ };
5585
+ declare const labelsReferencedBy: (levels: LevelPolicies[]) => string[];
5586
+ declare const unlabelledAllowPolicyIdsOf: (levels: LevelPolicies[]) => Set<string>;
5587
+ type LabellingOutcome = {
5588
+ decisions: LabelDecision[];
5589
+ unanswered: string[];
5525
5590
  };
5591
+ declare const createLabellingDecideReadFields: (options: {
5592
+ labeller: FieldLabeller;
5593
+ thresholdFor: (label: string) => number;
5594
+ deadlineMs: number;
5595
+ onLabelled?: (outcome: LabellingOutcome) => void;
5596
+ decide?: typeof decideReadFields;
5597
+ }) => typeof decideReadFields;
5526
5598
  //#endregion
5527
5599
  //#region src/runners/maskFields.d.ts
5528
5600
  declare const maskFields: (payload: unknown, refused: readonly string[], cleared?: ReadonlySet<string>) => {
@@ -5925,4 +5997,4 @@ declare const runWebhookSetupPhase: ({
5925
5997
  runStepActionFn?: typeof runStepAction;
5926
5998
  }) => Promise<WebhookSetupPhaseResult>;
5927
5999
  //#endregion
5928
- 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 };
6000
+ 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, refusalOf, resolveReleaseStageCounts, resolveReleaseStageProfile, runAction, runConnectorActionById, runConnectorActionByPath, runEventActionById, runStepAction, runTestActions, runWebhookSetupPhase, supportsRefreshAuthentication, unlabelledAllowPolicyIdsOf, validateYamlConnector };