@stepper-io/core 1.0.0 → 1.1.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.mts +89 -1
- package/package.json +5 -7
package/dist/index.d.mts
CHANGED
|
@@ -99,6 +99,13 @@ interface EmbeddedInputField extends Omit<BaseInputField, 'create'> {
|
|
|
99
99
|
create?: {
|
|
100
100
|
action: string;
|
|
101
101
|
};
|
|
102
|
+
/**
|
|
103
|
+
* When true (the default), the editor asks the user to pick one of their own
|
|
104
|
+
* connections before rendering the embed, so another user's token is never
|
|
105
|
+
* inlined into the embedded HTML. Set false to use the step's configured
|
|
106
|
+
* connection instead.
|
|
107
|
+
*/
|
|
108
|
+
chooseConnection?: boolean;
|
|
102
109
|
}
|
|
103
110
|
interface ObjectValue {
|
|
104
111
|
[key: string]: any;
|
|
@@ -195,6 +202,30 @@ type API = {
|
|
|
195
202
|
put: RequestClient;
|
|
196
203
|
delete: RequestClient;
|
|
197
204
|
callbackUrl: () => Promise<string>;
|
|
205
|
+
/**
|
|
206
|
+
* Returns credentials whose access token is usable for the next few minutes.
|
|
207
|
+
*
|
|
208
|
+
* Use this from embedded fields or server-rendered surfaces that need an
|
|
209
|
+
* access token at render time and can't react to a 401 the way an in-action
|
|
210
|
+
* HTTP call can. Repeated calls within a single resolution pass return a
|
|
211
|
+
* stable result so embedded HTML doesn't churn.
|
|
212
|
+
*
|
|
213
|
+
* SECURITY: only `access_token` (plus its `expires_at`) is returned — never
|
|
214
|
+
* the refresh_token or other credential fields — so a stray
|
|
215
|
+
* `JSON.stringify(credentials)` in rendered output can't leak a long-lived
|
|
216
|
+
* token. Still, only ever interpolate `credentials.access_token`.
|
|
217
|
+
*
|
|
218
|
+
* NOTE: near expiry this throws StaleAuthenticationError to ride the
|
|
219
|
+
* dispatcher's refresh-and-retry flow. That recovery works on paths that
|
|
220
|
+
* serialize errors into an ActionResult (action/trigger parameter resolution,
|
|
221
|
+
* embedded fields, and dropdown options resolvers).
|
|
222
|
+
*/
|
|
223
|
+
getFreshCredentials: () => Promise<{
|
|
224
|
+
credentials: {
|
|
225
|
+
access_token: string;
|
|
226
|
+
expires_at?: number;
|
|
227
|
+
};
|
|
228
|
+
}>;
|
|
198
229
|
notificationUrl: () => Promise<{
|
|
199
230
|
success: string;
|
|
200
231
|
failure: string;
|
|
@@ -258,12 +289,62 @@ type ErrorTypes = typeof UnknownError | typeof NonRetryableError | typeof RateLi
|
|
|
258
289
|
type Input = {
|
|
259
290
|
[key: string]: any;
|
|
260
291
|
};
|
|
292
|
+
/**
|
|
293
|
+
* Levels for logger entries emitted via `ctx.logger`. Mirrors the standard
|
|
294
|
+
* console levels.
|
|
295
|
+
*/
|
|
296
|
+
type LogLevel = 'debug' | 'info' | 'warn' | 'error';
|
|
297
|
+
/**
|
|
298
|
+
* A single structured log entry captured during an invocation.
|
|
299
|
+
*/
|
|
300
|
+
interface LogEntry {
|
|
301
|
+
level: LogLevel;
|
|
302
|
+
/** ISO-8601 timestamp at which the entry was emitted. */
|
|
303
|
+
timestamp: string;
|
|
304
|
+
message: string;
|
|
305
|
+
/** Optional structured payload accompanying the message. */
|
|
306
|
+
data?: any;
|
|
307
|
+
/** Origin of the entry: `'app'` for user-emitted, `'http'` for auto-captured request/response traces. */
|
|
308
|
+
source: 'app' | 'http';
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Lightweight logger exposed to action and trigger handlers via `ctx.logger`.
|
|
312
|
+
*
|
|
313
|
+
* Captured entries are returned in the invocation response and persisted to
|
|
314
|
+
* the per-version test execution log when the app version is not live. Live
|
|
315
|
+
* runs receive a no-op logger — logger calls are safe but produce no output.
|
|
316
|
+
*
|
|
317
|
+
* Example:
|
|
318
|
+
* ```ts
|
|
319
|
+
* ctx.logger.info('starting sync', { since: cursor });
|
|
320
|
+
* ctx.logger.debug('intermediate step', { rows: 42 });
|
|
321
|
+
* ```
|
|
322
|
+
*/
|
|
323
|
+
interface Logger {
|
|
324
|
+
debug(message: string, data?: unknown): void;
|
|
325
|
+
info(message: string, data?: unknown): void;
|
|
326
|
+
warn(message: string, data?: unknown): void;
|
|
327
|
+
error(message: string, data?: unknown): void;
|
|
328
|
+
/**
|
|
329
|
+
* Internal: append a structured entry with an explicit `source`. Used by
|
|
330
|
+
* the runtime's HTTP request/response tracer to record `source: 'http'`
|
|
331
|
+
* entries. App authors should use `info`/`debug`/`warn`/`error` instead.
|
|
332
|
+
*/
|
|
333
|
+
appendEntry?(entry: Omit<LogEntry, 'timestamp'>): void;
|
|
334
|
+
}
|
|
261
335
|
type Context<TInput extends Input = Input> = {
|
|
262
336
|
input: TInput;
|
|
263
337
|
env: any;
|
|
264
338
|
auth: any;
|
|
265
339
|
app: StepperApp;
|
|
266
340
|
api: API;
|
|
341
|
+
/**
|
|
342
|
+
* Optional logger for capturing structured entries during the invocation.
|
|
343
|
+
* The runtime injects a `NoopLogger` for live versions and a `CaptureLogger`
|
|
344
|
+
* for non-live (test) versions. App authors can call `ctx.logger?.info(...)`
|
|
345
|
+
* unconditionally — when undefined or noop, calls are a no-op.
|
|
346
|
+
*/
|
|
347
|
+
logger?: Logger;
|
|
267
348
|
metadata?: ContextMetadata;
|
|
268
349
|
};
|
|
269
350
|
type ContextMetadata = {
|
|
@@ -458,6 +539,13 @@ interface StepperApp {
|
|
|
458
539
|
platformVersion: string;
|
|
459
540
|
authentication: Authentication;
|
|
460
541
|
isPlatformApp?: boolean;
|
|
542
|
+
/**
|
|
543
|
+
* Marks an externally-authored, team-owned app. Set automatically by the
|
|
544
|
+
* dispatcher at deploy time — do NOT set manually; any author value is
|
|
545
|
+
* overridden. Absent on Stepper-managed apps. Used by the runtime to gate
|
|
546
|
+
* features for private team apps.
|
|
547
|
+
*/
|
|
548
|
+
isExternalTeamApp?: boolean;
|
|
461
549
|
actions: Action[] | ((context: Context) => Promise<Action[]> | Action[]);
|
|
462
550
|
triggers: Trigger[] | ((context: Context) => Promise<Trigger[]> | Trigger[]);
|
|
463
551
|
globalWebhooks?: GlobalWebhook[];
|
|
@@ -525,4 +613,4 @@ declare class ForbiddenError extends HTTPError {
|
|
|
525
613
|
static is(error: unknown): error is ForbiddenError;
|
|
526
614
|
}
|
|
527
615
|
|
|
528
|
-
export { type API, type Action, type AppDependenciesMap, type Authentication, BadRequestError, BaseError, type BasicAuthentication, type BearerAuthentication, type Callable, type CallableList, type ClientErrorStatusCode, type ContentfulStatusCode, type ContentlessStatusCode, type Context, type ContextMetadata, CriticalAuthenticationError, type CustomAuthentication, type DependencyInfo, type DeprecatedStatusCode, type DescribeResponse, type Descriptions, type DropdownInputFieldMultipleValue, type DropdownInputFieldSingleValue, type DropdownOption, type DynamicList, type EmbeddedInputField, type ErrorField, type ErrorType, type ErrorTypes, type FlowRequestConfiguration, ForbiddenError, type GlobalWebhook, type GlobalWebhookEvent, type GlobalWebhookResponse, HTTPError, HTTPNotFoundError, type HTTPStatusCode, type InfoStatusCode, type Input, type InputField, type InputFields, type Invoke, type ManualTrigger, type MessageField, NonRetryableError, type NoneAuthentication, NotFoundError, type OAuth2Authentication, type ObjectInputField, type PaginatedResponse, type PollingTrigger, RateLimitHitError, type RedirectStatusCode, type RefInputField, type RequestClient, type RequestMiddleware, type SchemaInputField, type ServerErrorStatusCode, StaleAuthenticationError, type StatusCode, type StepperApp, type SubscriptionOptionFilter, type SubscriptionOptions, type SuccessStatusCode, type TemporaryFile, type Trigger, UnauthorizedError, UnknownError, type UnofficialStatusCode, UnprocessableEntityError, type WebhookBaseTrigger, type WebhookPayload, type WebhookPollSourceTrigger, type WebhookSourceTrigger, type WebhookTrigger, action, app, authentication, trigger };
|
|
616
|
+
export { type API, type Action, type AppDependenciesMap, type Authentication, BadRequestError, BaseError, type BasicAuthentication, type BearerAuthentication, type Callable, type CallableList, type ClientErrorStatusCode, type ContentfulStatusCode, type ContentlessStatusCode, type Context, type ContextMetadata, CriticalAuthenticationError, type CustomAuthentication, type DependencyInfo, type DeprecatedStatusCode, type DescribeResponse, type Descriptions, type DropdownInputFieldMultipleValue, type DropdownInputFieldSingleValue, type DropdownOption, type DynamicList, type EmbeddedInputField, type ErrorField, type ErrorType, type ErrorTypes, type FlowRequestConfiguration, ForbiddenError, type GlobalWebhook, type GlobalWebhookEvent, type GlobalWebhookResponse, HTTPError, HTTPNotFoundError, type HTTPStatusCode, type InfoStatusCode, type Input, type InputField, type InputFields, type Invoke, type LogEntry, type LogLevel, type Logger, type ManualTrigger, type MessageField, NonRetryableError, type NoneAuthentication, NotFoundError, type OAuth2Authentication, type ObjectInputField, type PaginatedResponse, type PollingTrigger, RateLimitHitError, type RedirectStatusCode, type RefInputField, type RequestClient, type RequestMiddleware, type SchemaInputField, type ServerErrorStatusCode, StaleAuthenticationError, type StatusCode, type StepperApp, type SubscriptionOptionFilter, type SubscriptionOptions, type SuccessStatusCode, type TemporaryFile, type Trigger, UnauthorizedError, UnknownError, type UnofficialStatusCode, UnprocessableEntityError, type WebhookBaseTrigger, type WebhookPayload, type WebhookPollSourceTrigger, type WebhookSourceTrigger, type WebhookTrigger, action, app, authentication, trigger };
|
package/package.json
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stepper-io/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Core types and runtime helpers for building Stepper apps",
|
|
5
|
-
"main": "dist/index.mjs",
|
|
6
|
-
"types": "dist/index.d.mts",
|
|
5
|
+
"main": "./dist/index.mjs",
|
|
7
6
|
"exports": {
|
|
8
7
|
".": {
|
|
9
|
-
"source": "./src/index.ts",
|
|
10
8
|
"types": "./dist/index.d.mts",
|
|
11
|
-
"import": "./dist/index.mjs"
|
|
12
|
-
"default": "./dist/index.mjs"
|
|
9
|
+
"import": "./dist/index.mjs"
|
|
13
10
|
}
|
|
14
11
|
},
|
|
15
12
|
"files": [
|
|
@@ -45,5 +42,6 @@
|
|
|
45
42
|
"scripts": {
|
|
46
43
|
"build": "tsup",
|
|
47
44
|
"typecheck": "tsc --noEmit"
|
|
48
|
-
}
|
|
45
|
+
},
|
|
46
|
+
"types": "./dist/index.d.mts"
|
|
49
47
|
}
|