@particle-academy/fancy-connector-core 0.14.0 → 0.15.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/CHANGELOG.md +27 -0
- package/dist/index.cjs +57 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +51 -1
- package/dist/index.d.ts +51 -1
- package/dist/index.js +52 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -2048,11 +2048,27 @@ type CredentialField = {
|
|
|
2048
2048
|
/** A hint for an empty field. NEVER a real value. */
|
|
2049
2049
|
placeholder?: string;
|
|
2050
2050
|
};
|
|
2051
|
+
/** Who performs a setup step. Ships as data: a host mirrors it across JSON. */
|
|
2052
|
+
declare const SETUP_ACTORS: readonly ["person", "agent"];
|
|
2053
|
+
type SetupActor = (typeof SETUP_ACTORS)[number];
|
|
2051
2054
|
type SetupStep = {
|
|
2052
2055
|
title: string;
|
|
2053
2056
|
/** The step, and the trap in it. A step with no trap named is usually wrong. */
|
|
2054
2057
|
detail: string;
|
|
2055
2058
|
url?: string;
|
|
2059
|
+
/** Who does it. Absent means `person` (0.15.0). */
|
|
2060
|
+
actor?: SetupActor;
|
|
2061
|
+
/** What an agent is asked to do. Required when `actor` is `agent`. */
|
|
2062
|
+
prompt?: string;
|
|
2063
|
+
/** Values the person pastes somewhere, e.g. the callback URL. */
|
|
2064
|
+
copy?: {
|
|
2065
|
+
label: string;
|
|
2066
|
+
value: string;
|
|
2067
|
+
}[];
|
|
2068
|
+
/** The credential keys this step yields. */
|
|
2069
|
+
fields?: string[];
|
|
2070
|
+
/** How the person knows the step is done. */
|
|
2071
|
+
done?: string;
|
|
2056
2072
|
};
|
|
2057
2073
|
/**
|
|
2058
2074
|
* The result of a read-only credential check.
|
|
@@ -2850,6 +2866,40 @@ type PubSubPushMessage = {
|
|
|
2850
2866
|
};
|
|
2851
2867
|
declare function decodePubSubPush(raw: Uint8Array | string): PubSubPushMessage;
|
|
2852
2868
|
|
|
2869
|
+
/**
|
|
2870
|
+
* A connector's setup steps, rendered for ONE app.
|
|
2871
|
+
*
|
|
2872
|
+
* A definition is written once for every host, so the values that differ per
|
|
2873
|
+
* host — where its webhooks live, what it calls itself, which connector this
|
|
2874
|
+
* is — are tokens: `{{appUrl}}`, `{{appName}}`, `{{connector}}`, and only
|
|
2875
|
+
* those. Held to `fixtures/setup-render/cases.json`, mirrored in
|
|
2876
|
+
* `php/src/Setup.php`.
|
|
2877
|
+
*
|
|
2878
|
+
* Two refusals, both BY NAME, because each would otherwise reach a person as a
|
|
2879
|
+
* broken instruction that looks deliberate:
|
|
2880
|
+
*
|
|
2881
|
+
* - `unknown-token`: anything else shaped like `{{...}}` — a typo, a spaced
|
|
2882
|
+
* `{{ appUrl }}`, a token a definition invented. Left in, a person pastes a
|
|
2883
|
+
* literal brace into a provider console.
|
|
2884
|
+
* - `missing-context`: a token the host gave no (or an empty) value for. Left
|
|
2885
|
+
* empty, a callback URL becomes `/hooks/twilio` and points nowhere.
|
|
2886
|
+
*
|
|
2887
|
+
* `appUrl` loses ONE trailing slash first, so `{{appUrl}}/hooks` never doubles
|
|
2888
|
+
* it. A context value is inserted once and never expanded again.
|
|
2889
|
+
*/
|
|
2890
|
+
|
|
2891
|
+
declare const SETUP_TOKENS: readonly ["appUrl", "appName", "connector"];
|
|
2892
|
+
type SetupToken = (typeof SETUP_TOKENS)[number];
|
|
2893
|
+
declare const SETUP_RENDER_REASONS: readonly ["unknown-token", "missing-context"];
|
|
2894
|
+
type SetupRenderReason = (typeof SETUP_RENDER_REASONS)[number];
|
|
2895
|
+
type SetupContext = Partial<Record<SetupToken, string>>;
|
|
2896
|
+
declare class SetupRenderError extends Error {
|
|
2897
|
+
readonly reason: SetupRenderReason;
|
|
2898
|
+
constructor(reason: SetupRenderReason, message: string);
|
|
2899
|
+
}
|
|
2900
|
+
/** Render every step for one app: tokens filled, `actor` and `fields` defaulted. */
|
|
2901
|
+
declare function renderSetup(steps: readonly SetupStep[], context: SetupContext): SetupStep[];
|
|
2902
|
+
|
|
2853
2903
|
/**
|
|
2854
2904
|
* How a connector trigger learns that something happened.
|
|
2855
2905
|
*
|
|
@@ -3012,4 +3062,4 @@ oidc?: OidcExpectation): Promise<WebhookVerification>;
|
|
|
3012
3062
|
*/
|
|
3013
3063
|
declare function triggerEvent(trigger: TriggerDescriptor, connection: ResolvedConnection, injected: unknown, config: Record<string, unknown>): unknown;
|
|
3014
3064
|
|
|
3015
|
-
export { AMBIGUOUS_REFUSAL, type ApiContract, type Attempt, type Attendee, type ByteRange, CANONICAL_METRICS, CONNECTOR_API_VERSION, CONNECTOR_MODES, CREDENTIAL_SCOPES, CURSOR_READ_REASONS, type CallOptions, type CallResult, type Capabilities, type Catalogue, type ChainLinks, type ChainOutcome, type ChainRef, type ChallengeHandshake, type Citation, type Classified, type ConnectionCredentials, type ConnectionHost, type ConnectionSpec, type Connector, ConnectorAmbiguous, ConnectorApiMismatch, ConnectorAuthError, ConnectorConfigError, ConnectorError, type ConnectorErrorContext, type ConnectorFaker, ConnectorIdempotencyExpiredError, type ConnectorMode, ConnectorModeError, ConnectorRateLimited, type ConnectorRequest, ConnectorRequestError, type ConnectorResult, ConnectorTransient, ConnectorUnreachable, type ContractOperation, type CredentialField, type CredentialScope, CursorReadError, type CursorReadReason, type CursorReadResult, type CursorReadSpec, DEFAULT_IDEMPOTENCY_WINDOW_SECONDS, DEFAULT_RETRY, DELIVERY_DECODE_KINDS, type DeliveryDeclaration, type DeliveryDecode, type DeliveryMechanism, type DeliveryOutcome, type DeliveryRoute, type DriftFinding, type DriftReport, EXPIRES_AT_UNITS, type ExpiresAtUnit, FAKE_EPOCH, FORM_FIELD_JSON_REASONS, type FailureKind, type FakeRequest, type FakeValues, FormFieldJsonError, type FormFieldJsonReason, type HmacScheme, type HmacVerificationSpec, type HostEnvironment, type IdempotencyOptions, type InboundDelivery, type Invite, type InviteMethod, JWT_ALGORITHMS, type JoinTarget, type JoinTargetKind, type Jwk, type JwtVerification, type LeaseAction, type LeaseDeclaration, type LeaseState, MAX_IDEMPOTENCY_KEY_LENGTH, type MetricDescriptor, type MetricSample, type MimeAttachment, type MimeHeader, type MimeMessage, type MimePart, type ModeInputs, NO_IDEMPOTENCY_KEY_WARNING, OIDC_JWT_SCHEME_KIND, type OidcExpectation, type OidcJwtScheme, type OidcJwtVerificationSpec, PROBLEM_SEVERITIES, PUBSUB_PUSH_REASONS, type PreparedRequest, type ProbeOutcome, type ProbeReport, type ProbeResult, type ProbeSpec, type Problem, type ProviderAdapter, PubSubPushError, type PubSubPushMessage, type PubSubPushReason, RENDERER_VERSION, REVIEW_STALE_DAYS, type RecordedShape, type RecurrenceRule, type RenderRules, type RenderedPayload, type RequestedMode, type ResolveOptions, type ResolvedConnection, type RetryPolicy, type RunIdentity, SANDBOX_KINDS, SIGNED_URI_RULES, SUPPORTED_CONNECTOR_API, type SandboxKind, type Segment, type ServiceDescriptor, type SetupStep, type ShapeMismatch, type SharedTokenScheme, type SharedTokenVerificationSpec, type SignedRequestLine, type SignedUriRule, type SpecSource, type SubscriptionLease, type TextUnit, type Transport, type TransportResponse, type TriggerDescriptor, type VerifyJwtOptions, type VerifyResult, type WebhookVerification, type WebhookVerificationSpec, assertConnectorApi, byteRangeOf, callConnector, capabilityProblems, checkAgainstOpenApi, checkAgainstRecordedShape, classifyError, classifyHttp, classifyStatus, classifyThrown, compareShape, connectionsFor, constantTimeEquals, decodeDelivery, decodeFormFieldJson, decodePubSubPush, deliver, fakeRequest, fakeValues, getConnectionHost, graphemes, handshakeResponse, header, hmac, httpFailure, idempotencyKeyFor, isEmptyPayload, isOidcJwtScheme, isOidcJwtSpec, isRemote, isSharedTokenScheme, isSharedTokenSpec, isUnconditionallyRetryable, joinTargets, leaseAction, leaseFromResponse, leaseRenewAt, leaseState, linkRanges, measure, nextOccurrence, normaliseSignedUri, parseInvite, parseMime, payloadHash, postChain, probe, providerProblems, providerSandboxIsSelectable, readWithCursor, registerConnectionHost, registerTransport, render, reported, resetRateState, resolveConnection, resolveConnectorMode, respectRate, runIdentityFrom, runKeyFrom, runProbes, sandboxIsSelectable, sandboxRefusal, satisfiesMinimum, secretKeyBytes, seedFrom, shapeOf, shouldRetry, sliceByteRange, splitToFit, subscriptionLease, triggerEvent, unchecked, utf8Length, verifyDelivery, verifyHmac, verifyJwt, verifyOidcDelivery, verifySharedToken, withResolvedLimit };
|
|
3065
|
+
export { AMBIGUOUS_REFUSAL, type ApiContract, type Attempt, type Attendee, type ByteRange, CANONICAL_METRICS, CONNECTOR_API_VERSION, CONNECTOR_MODES, CREDENTIAL_SCOPES, CURSOR_READ_REASONS, type CallOptions, type CallResult, type Capabilities, type Catalogue, type ChainLinks, type ChainOutcome, type ChainRef, type ChallengeHandshake, type Citation, type Classified, type ConnectionCredentials, type ConnectionHost, type ConnectionSpec, type Connector, ConnectorAmbiguous, ConnectorApiMismatch, ConnectorAuthError, ConnectorConfigError, ConnectorError, type ConnectorErrorContext, type ConnectorFaker, ConnectorIdempotencyExpiredError, type ConnectorMode, ConnectorModeError, ConnectorRateLimited, type ConnectorRequest, ConnectorRequestError, type ConnectorResult, ConnectorTransient, ConnectorUnreachable, type ContractOperation, type CredentialField, type CredentialScope, CursorReadError, type CursorReadReason, type CursorReadResult, type CursorReadSpec, DEFAULT_IDEMPOTENCY_WINDOW_SECONDS, DEFAULT_RETRY, DELIVERY_DECODE_KINDS, type DeliveryDeclaration, type DeliveryDecode, type DeliveryMechanism, type DeliveryOutcome, type DeliveryRoute, type DriftFinding, type DriftReport, EXPIRES_AT_UNITS, type ExpiresAtUnit, FAKE_EPOCH, FORM_FIELD_JSON_REASONS, type FailureKind, type FakeRequest, type FakeValues, FormFieldJsonError, type FormFieldJsonReason, type HmacScheme, type HmacVerificationSpec, type HostEnvironment, type IdempotencyOptions, type InboundDelivery, type Invite, type InviteMethod, JWT_ALGORITHMS, type JoinTarget, type JoinTargetKind, type Jwk, type JwtVerification, type LeaseAction, type LeaseDeclaration, type LeaseState, MAX_IDEMPOTENCY_KEY_LENGTH, type MetricDescriptor, type MetricSample, type MimeAttachment, type MimeHeader, type MimeMessage, type MimePart, type ModeInputs, NO_IDEMPOTENCY_KEY_WARNING, OIDC_JWT_SCHEME_KIND, type OidcExpectation, type OidcJwtScheme, type OidcJwtVerificationSpec, PROBLEM_SEVERITIES, PUBSUB_PUSH_REASONS, type PreparedRequest, type ProbeOutcome, type ProbeReport, type ProbeResult, type ProbeSpec, type Problem, type ProviderAdapter, PubSubPushError, type PubSubPushMessage, type PubSubPushReason, RENDERER_VERSION, REVIEW_STALE_DAYS, type RecordedShape, type RecurrenceRule, type RenderRules, type RenderedPayload, type RequestedMode, type ResolveOptions, type ResolvedConnection, type RetryPolicy, type RunIdentity, SANDBOX_KINDS, SETUP_ACTORS, SETUP_RENDER_REASONS, SETUP_TOKENS, SIGNED_URI_RULES, SUPPORTED_CONNECTOR_API, type SandboxKind, type Segment, type ServiceDescriptor, type SetupActor, type SetupContext, SetupRenderError, type SetupRenderReason, type SetupStep, type SetupToken, type ShapeMismatch, type SharedTokenScheme, type SharedTokenVerificationSpec, type SignedRequestLine, type SignedUriRule, type SpecSource, type SubscriptionLease, type TextUnit, type Transport, type TransportResponse, type TriggerDescriptor, type VerifyJwtOptions, type VerifyResult, type WebhookVerification, type WebhookVerificationSpec, assertConnectorApi, byteRangeOf, callConnector, capabilityProblems, checkAgainstOpenApi, checkAgainstRecordedShape, classifyError, classifyHttp, classifyStatus, classifyThrown, compareShape, connectionsFor, constantTimeEquals, decodeDelivery, decodeFormFieldJson, decodePubSubPush, deliver, fakeRequest, fakeValues, getConnectionHost, graphemes, handshakeResponse, header, hmac, httpFailure, idempotencyKeyFor, isEmptyPayload, isOidcJwtScheme, isOidcJwtSpec, isRemote, isSharedTokenScheme, isSharedTokenSpec, isUnconditionallyRetryable, joinTargets, leaseAction, leaseFromResponse, leaseRenewAt, leaseState, linkRanges, measure, nextOccurrence, normaliseSignedUri, parseInvite, parseMime, payloadHash, postChain, probe, providerProblems, providerSandboxIsSelectable, readWithCursor, registerConnectionHost, registerTransport, render, renderSetup, reported, resetRateState, resolveConnection, resolveConnectorMode, respectRate, runIdentityFrom, runKeyFrom, runProbes, sandboxIsSelectable, sandboxRefusal, satisfiesMinimum, secretKeyBytes, seedFrom, shapeOf, shouldRetry, sliceByteRange, splitToFit, subscriptionLease, triggerEvent, unchecked, utf8Length, verifyDelivery, verifyHmac, verifyJwt, verifyOidcDelivery, verifySharedToken, withResolvedLimit };
|
package/dist/index.d.ts
CHANGED
|
@@ -2048,11 +2048,27 @@ type CredentialField = {
|
|
|
2048
2048
|
/** A hint for an empty field. NEVER a real value. */
|
|
2049
2049
|
placeholder?: string;
|
|
2050
2050
|
};
|
|
2051
|
+
/** Who performs a setup step. Ships as data: a host mirrors it across JSON. */
|
|
2052
|
+
declare const SETUP_ACTORS: readonly ["person", "agent"];
|
|
2053
|
+
type SetupActor = (typeof SETUP_ACTORS)[number];
|
|
2051
2054
|
type SetupStep = {
|
|
2052
2055
|
title: string;
|
|
2053
2056
|
/** The step, and the trap in it. A step with no trap named is usually wrong. */
|
|
2054
2057
|
detail: string;
|
|
2055
2058
|
url?: string;
|
|
2059
|
+
/** Who does it. Absent means `person` (0.15.0). */
|
|
2060
|
+
actor?: SetupActor;
|
|
2061
|
+
/** What an agent is asked to do. Required when `actor` is `agent`. */
|
|
2062
|
+
prompt?: string;
|
|
2063
|
+
/** Values the person pastes somewhere, e.g. the callback URL. */
|
|
2064
|
+
copy?: {
|
|
2065
|
+
label: string;
|
|
2066
|
+
value: string;
|
|
2067
|
+
}[];
|
|
2068
|
+
/** The credential keys this step yields. */
|
|
2069
|
+
fields?: string[];
|
|
2070
|
+
/** How the person knows the step is done. */
|
|
2071
|
+
done?: string;
|
|
2056
2072
|
};
|
|
2057
2073
|
/**
|
|
2058
2074
|
* The result of a read-only credential check.
|
|
@@ -2850,6 +2866,40 @@ type PubSubPushMessage = {
|
|
|
2850
2866
|
};
|
|
2851
2867
|
declare function decodePubSubPush(raw: Uint8Array | string): PubSubPushMessage;
|
|
2852
2868
|
|
|
2869
|
+
/**
|
|
2870
|
+
* A connector's setup steps, rendered for ONE app.
|
|
2871
|
+
*
|
|
2872
|
+
* A definition is written once for every host, so the values that differ per
|
|
2873
|
+
* host — where its webhooks live, what it calls itself, which connector this
|
|
2874
|
+
* is — are tokens: `{{appUrl}}`, `{{appName}}`, `{{connector}}`, and only
|
|
2875
|
+
* those. Held to `fixtures/setup-render/cases.json`, mirrored in
|
|
2876
|
+
* `php/src/Setup.php`.
|
|
2877
|
+
*
|
|
2878
|
+
* Two refusals, both BY NAME, because each would otherwise reach a person as a
|
|
2879
|
+
* broken instruction that looks deliberate:
|
|
2880
|
+
*
|
|
2881
|
+
* - `unknown-token`: anything else shaped like `{{...}}` — a typo, a spaced
|
|
2882
|
+
* `{{ appUrl }}`, a token a definition invented. Left in, a person pastes a
|
|
2883
|
+
* literal brace into a provider console.
|
|
2884
|
+
* - `missing-context`: a token the host gave no (or an empty) value for. Left
|
|
2885
|
+
* empty, a callback URL becomes `/hooks/twilio` and points nowhere.
|
|
2886
|
+
*
|
|
2887
|
+
* `appUrl` loses ONE trailing slash first, so `{{appUrl}}/hooks` never doubles
|
|
2888
|
+
* it. A context value is inserted once and never expanded again.
|
|
2889
|
+
*/
|
|
2890
|
+
|
|
2891
|
+
declare const SETUP_TOKENS: readonly ["appUrl", "appName", "connector"];
|
|
2892
|
+
type SetupToken = (typeof SETUP_TOKENS)[number];
|
|
2893
|
+
declare const SETUP_RENDER_REASONS: readonly ["unknown-token", "missing-context"];
|
|
2894
|
+
type SetupRenderReason = (typeof SETUP_RENDER_REASONS)[number];
|
|
2895
|
+
type SetupContext = Partial<Record<SetupToken, string>>;
|
|
2896
|
+
declare class SetupRenderError extends Error {
|
|
2897
|
+
readonly reason: SetupRenderReason;
|
|
2898
|
+
constructor(reason: SetupRenderReason, message: string);
|
|
2899
|
+
}
|
|
2900
|
+
/** Render every step for one app: tokens filled, `actor` and `fields` defaulted. */
|
|
2901
|
+
declare function renderSetup(steps: readonly SetupStep[], context: SetupContext): SetupStep[];
|
|
2902
|
+
|
|
2853
2903
|
/**
|
|
2854
2904
|
* How a connector trigger learns that something happened.
|
|
2855
2905
|
*
|
|
@@ -3012,4 +3062,4 @@ oidc?: OidcExpectation): Promise<WebhookVerification>;
|
|
|
3012
3062
|
*/
|
|
3013
3063
|
declare function triggerEvent(trigger: TriggerDescriptor, connection: ResolvedConnection, injected: unknown, config: Record<string, unknown>): unknown;
|
|
3014
3064
|
|
|
3015
|
-
export { AMBIGUOUS_REFUSAL, type ApiContract, type Attempt, type Attendee, type ByteRange, CANONICAL_METRICS, CONNECTOR_API_VERSION, CONNECTOR_MODES, CREDENTIAL_SCOPES, CURSOR_READ_REASONS, type CallOptions, type CallResult, type Capabilities, type Catalogue, type ChainLinks, type ChainOutcome, type ChainRef, type ChallengeHandshake, type Citation, type Classified, type ConnectionCredentials, type ConnectionHost, type ConnectionSpec, type Connector, ConnectorAmbiguous, ConnectorApiMismatch, ConnectorAuthError, ConnectorConfigError, ConnectorError, type ConnectorErrorContext, type ConnectorFaker, ConnectorIdempotencyExpiredError, type ConnectorMode, ConnectorModeError, ConnectorRateLimited, type ConnectorRequest, ConnectorRequestError, type ConnectorResult, ConnectorTransient, ConnectorUnreachable, type ContractOperation, type CredentialField, type CredentialScope, CursorReadError, type CursorReadReason, type CursorReadResult, type CursorReadSpec, DEFAULT_IDEMPOTENCY_WINDOW_SECONDS, DEFAULT_RETRY, DELIVERY_DECODE_KINDS, type DeliveryDeclaration, type DeliveryDecode, type DeliveryMechanism, type DeliveryOutcome, type DeliveryRoute, type DriftFinding, type DriftReport, EXPIRES_AT_UNITS, type ExpiresAtUnit, FAKE_EPOCH, FORM_FIELD_JSON_REASONS, type FailureKind, type FakeRequest, type FakeValues, FormFieldJsonError, type FormFieldJsonReason, type HmacScheme, type HmacVerificationSpec, type HostEnvironment, type IdempotencyOptions, type InboundDelivery, type Invite, type InviteMethod, JWT_ALGORITHMS, type JoinTarget, type JoinTargetKind, type Jwk, type JwtVerification, type LeaseAction, type LeaseDeclaration, type LeaseState, MAX_IDEMPOTENCY_KEY_LENGTH, type MetricDescriptor, type MetricSample, type MimeAttachment, type MimeHeader, type MimeMessage, type MimePart, type ModeInputs, NO_IDEMPOTENCY_KEY_WARNING, OIDC_JWT_SCHEME_KIND, type OidcExpectation, type OidcJwtScheme, type OidcJwtVerificationSpec, PROBLEM_SEVERITIES, PUBSUB_PUSH_REASONS, type PreparedRequest, type ProbeOutcome, type ProbeReport, type ProbeResult, type ProbeSpec, type Problem, type ProviderAdapter, PubSubPushError, type PubSubPushMessage, type PubSubPushReason, RENDERER_VERSION, REVIEW_STALE_DAYS, type RecordedShape, type RecurrenceRule, type RenderRules, type RenderedPayload, type RequestedMode, type ResolveOptions, type ResolvedConnection, type RetryPolicy, type RunIdentity, SANDBOX_KINDS, SIGNED_URI_RULES, SUPPORTED_CONNECTOR_API, type SandboxKind, type Segment, type ServiceDescriptor, type SetupStep, type ShapeMismatch, type SharedTokenScheme, type SharedTokenVerificationSpec, type SignedRequestLine, type SignedUriRule, type SpecSource, type SubscriptionLease, type TextUnit, type Transport, type TransportResponse, type TriggerDescriptor, type VerifyJwtOptions, type VerifyResult, type WebhookVerification, type WebhookVerificationSpec, assertConnectorApi, byteRangeOf, callConnector, capabilityProblems, checkAgainstOpenApi, checkAgainstRecordedShape, classifyError, classifyHttp, classifyStatus, classifyThrown, compareShape, connectionsFor, constantTimeEquals, decodeDelivery, decodeFormFieldJson, decodePubSubPush, deliver, fakeRequest, fakeValues, getConnectionHost, graphemes, handshakeResponse, header, hmac, httpFailure, idempotencyKeyFor, isEmptyPayload, isOidcJwtScheme, isOidcJwtSpec, isRemote, isSharedTokenScheme, isSharedTokenSpec, isUnconditionallyRetryable, joinTargets, leaseAction, leaseFromResponse, leaseRenewAt, leaseState, linkRanges, measure, nextOccurrence, normaliseSignedUri, parseInvite, parseMime, payloadHash, postChain, probe, providerProblems, providerSandboxIsSelectable, readWithCursor, registerConnectionHost, registerTransport, render, reported, resetRateState, resolveConnection, resolveConnectorMode, respectRate, runIdentityFrom, runKeyFrom, runProbes, sandboxIsSelectable, sandboxRefusal, satisfiesMinimum, secretKeyBytes, seedFrom, shapeOf, shouldRetry, sliceByteRange, splitToFit, subscriptionLease, triggerEvent, unchecked, utf8Length, verifyDelivery, verifyHmac, verifyJwt, verifyOidcDelivery, verifySharedToken, withResolvedLimit };
|
|
3065
|
+
export { AMBIGUOUS_REFUSAL, type ApiContract, type Attempt, type Attendee, type ByteRange, CANONICAL_METRICS, CONNECTOR_API_VERSION, CONNECTOR_MODES, CREDENTIAL_SCOPES, CURSOR_READ_REASONS, type CallOptions, type CallResult, type Capabilities, type Catalogue, type ChainLinks, type ChainOutcome, type ChainRef, type ChallengeHandshake, type Citation, type Classified, type ConnectionCredentials, type ConnectionHost, type ConnectionSpec, type Connector, ConnectorAmbiguous, ConnectorApiMismatch, ConnectorAuthError, ConnectorConfigError, ConnectorError, type ConnectorErrorContext, type ConnectorFaker, ConnectorIdempotencyExpiredError, type ConnectorMode, ConnectorModeError, ConnectorRateLimited, type ConnectorRequest, ConnectorRequestError, type ConnectorResult, ConnectorTransient, ConnectorUnreachable, type ContractOperation, type CredentialField, type CredentialScope, CursorReadError, type CursorReadReason, type CursorReadResult, type CursorReadSpec, DEFAULT_IDEMPOTENCY_WINDOW_SECONDS, DEFAULT_RETRY, DELIVERY_DECODE_KINDS, type DeliveryDeclaration, type DeliveryDecode, type DeliveryMechanism, type DeliveryOutcome, type DeliveryRoute, type DriftFinding, type DriftReport, EXPIRES_AT_UNITS, type ExpiresAtUnit, FAKE_EPOCH, FORM_FIELD_JSON_REASONS, type FailureKind, type FakeRequest, type FakeValues, FormFieldJsonError, type FormFieldJsonReason, type HmacScheme, type HmacVerificationSpec, type HostEnvironment, type IdempotencyOptions, type InboundDelivery, type Invite, type InviteMethod, JWT_ALGORITHMS, type JoinTarget, type JoinTargetKind, type Jwk, type JwtVerification, type LeaseAction, type LeaseDeclaration, type LeaseState, MAX_IDEMPOTENCY_KEY_LENGTH, type MetricDescriptor, type MetricSample, type MimeAttachment, type MimeHeader, type MimeMessage, type MimePart, type ModeInputs, NO_IDEMPOTENCY_KEY_WARNING, OIDC_JWT_SCHEME_KIND, type OidcExpectation, type OidcJwtScheme, type OidcJwtVerificationSpec, PROBLEM_SEVERITIES, PUBSUB_PUSH_REASONS, type PreparedRequest, type ProbeOutcome, type ProbeReport, type ProbeResult, type ProbeSpec, type Problem, type ProviderAdapter, PubSubPushError, type PubSubPushMessage, type PubSubPushReason, RENDERER_VERSION, REVIEW_STALE_DAYS, type RecordedShape, type RecurrenceRule, type RenderRules, type RenderedPayload, type RequestedMode, type ResolveOptions, type ResolvedConnection, type RetryPolicy, type RunIdentity, SANDBOX_KINDS, SETUP_ACTORS, SETUP_RENDER_REASONS, SETUP_TOKENS, SIGNED_URI_RULES, SUPPORTED_CONNECTOR_API, type SandboxKind, type Segment, type ServiceDescriptor, type SetupActor, type SetupContext, SetupRenderError, type SetupRenderReason, type SetupStep, type SetupToken, type ShapeMismatch, type SharedTokenScheme, type SharedTokenVerificationSpec, type SignedRequestLine, type SignedUriRule, type SpecSource, type SubscriptionLease, type TextUnit, type Transport, type TransportResponse, type TriggerDescriptor, type VerifyJwtOptions, type VerifyResult, type WebhookVerification, type WebhookVerificationSpec, assertConnectorApi, byteRangeOf, callConnector, capabilityProblems, checkAgainstOpenApi, checkAgainstRecordedShape, classifyError, classifyHttp, classifyStatus, classifyThrown, compareShape, connectionsFor, constantTimeEquals, decodeDelivery, decodeFormFieldJson, decodePubSubPush, deliver, fakeRequest, fakeValues, getConnectionHost, graphemes, handshakeResponse, header, hmac, httpFailure, idempotencyKeyFor, isEmptyPayload, isOidcJwtScheme, isOidcJwtSpec, isRemote, isSharedTokenScheme, isSharedTokenSpec, isUnconditionallyRetryable, joinTargets, leaseAction, leaseFromResponse, leaseRenewAt, leaseState, linkRanges, measure, nextOccurrence, normaliseSignedUri, parseInvite, parseMime, payloadHash, postChain, probe, providerProblems, providerSandboxIsSelectable, readWithCursor, registerConnectionHost, registerTransport, render, renderSetup, reported, resetRateState, resolveConnection, resolveConnectorMode, respectRate, runIdentityFrom, runKeyFrom, runProbes, sandboxIsSelectable, sandboxRefusal, satisfiesMinimum, secretKeyBytes, seedFrom, shapeOf, shouldRetry, sliceByteRange, splitToFit, subscriptionLease, triggerEvent, unchecked, utf8Length, verifyDelivery, verifyHmac, verifyJwt, verifyOidcDelivery, verifySharedToken, withResolvedLimit };
|
package/dist/index.js
CHANGED
|
@@ -2354,6 +2354,53 @@ function withResolvedLimit(rules, limit) {
|
|
|
2354
2354
|
var CREDENTIAL_SCOPES = ["provider", "account"];
|
|
2355
2355
|
var PROBLEM_SEVERITIES = ["block", "warn"];
|
|
2356
2356
|
var CANONICAL_METRICS = ["like", "share", "reply", "quote", "view"];
|
|
2357
|
+
var SETUP_ACTORS = ["person", "agent"];
|
|
2358
|
+
|
|
2359
|
+
// src/setup.ts
|
|
2360
|
+
var SETUP_TOKENS = ["appUrl", "appName", "connector"];
|
|
2361
|
+
var SETUP_RENDER_REASONS = ["unknown-token", "missing-context"];
|
|
2362
|
+
var SetupRenderError = class extends Error {
|
|
2363
|
+
constructor(reason, message) {
|
|
2364
|
+
super(message);
|
|
2365
|
+
this.reason = reason;
|
|
2366
|
+
this.name = "SetupRenderError";
|
|
2367
|
+
}
|
|
2368
|
+
reason;
|
|
2369
|
+
};
|
|
2370
|
+
var TOKEN = /\{\{([^{}]*)\}\}/g;
|
|
2371
|
+
function fill(text, context) {
|
|
2372
|
+
return text.replace(TOKEN, (whole, name) => {
|
|
2373
|
+
if (!SETUP_TOKENS.includes(name)) {
|
|
2374
|
+
throw new SetupRenderError(
|
|
2375
|
+
"unknown-token",
|
|
2376
|
+
`setup step text uses ${whole}, which is not one of ${SETUP_TOKENS.map((t) => `{{${t}}}`).join(", ")}`
|
|
2377
|
+
);
|
|
2378
|
+
}
|
|
2379
|
+
let value = context[name];
|
|
2380
|
+
if (value === void 0 || value === null || value === "") {
|
|
2381
|
+
throw new SetupRenderError("missing-context", `setup step text uses ${whole} and the host gave no value for ${name}`);
|
|
2382
|
+
}
|
|
2383
|
+
if (name === "appUrl" && value.endsWith("/")) value = value.slice(0, -1);
|
|
2384
|
+
return value;
|
|
2385
|
+
});
|
|
2386
|
+
}
|
|
2387
|
+
function renderSetup(steps, context) {
|
|
2388
|
+
return steps.map((step) => {
|
|
2389
|
+
const out = {
|
|
2390
|
+
title: fill(step.title, context),
|
|
2391
|
+
detail: fill(step.detail, context),
|
|
2392
|
+
actor: step.actor ?? "person",
|
|
2393
|
+
fields: [...step.fields ?? []]
|
|
2394
|
+
};
|
|
2395
|
+
if (step.url !== void 0) out.url = fill(step.url, context);
|
|
2396
|
+
if (step.prompt !== void 0) out.prompt = fill(step.prompt, context);
|
|
2397
|
+
if (step.done !== void 0) out.done = fill(step.done, context);
|
|
2398
|
+
if (step.copy !== void 0) {
|
|
2399
|
+
out.copy = step.copy.map((c) => ({ label: fill(c.label, context), value: fill(c.value, context) }));
|
|
2400
|
+
}
|
|
2401
|
+
return out;
|
|
2402
|
+
});
|
|
2403
|
+
}
|
|
2357
2404
|
|
|
2358
2405
|
// src/trigger.ts
|
|
2359
2406
|
function isOidcJwtSpec(spec) {
|
|
@@ -2458,8 +2505,12 @@ export {
|
|
|
2458
2505
|
RENDERER_VERSION,
|
|
2459
2506
|
REVIEW_STALE_DAYS,
|
|
2460
2507
|
SANDBOX_KINDS,
|
|
2508
|
+
SETUP_ACTORS,
|
|
2509
|
+
SETUP_RENDER_REASONS,
|
|
2510
|
+
SETUP_TOKENS,
|
|
2461
2511
|
SIGNED_URI_RULES,
|
|
2462
2512
|
SUPPORTED_CONNECTOR_API,
|
|
2513
|
+
SetupRenderError,
|
|
2463
2514
|
assertConnectorApi,
|
|
2464
2515
|
byteRangeOf,
|
|
2465
2516
|
callConnector,
|
|
@@ -2513,6 +2564,7 @@ export {
|
|
|
2513
2564
|
registerConnectionHost,
|
|
2514
2565
|
registerTransport,
|
|
2515
2566
|
render,
|
|
2567
|
+
renderSetup,
|
|
2516
2568
|
reported,
|
|
2517
2569
|
resetRateState,
|
|
2518
2570
|
resolveConnection,
|