@engini/sdk 0.30.0 → 0.32.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/README.md CHANGED
@@ -211,6 +211,7 @@ const page = await client.executions.listPage({ top: 20, cursor: previous.nextCu
211
211
 
212
212
  const run = await client.executions.get(4567);
213
213
  const steps = await client.executions.log(4567); // throws EnginiAPIError on 410 (retention passed)
214
+ const failedSteps = steps.filter((s) => s.status === "ranWithError").map((s) => [s.stepNo, s.errorMessage]);
214
215
  const payloads = await client.executions.data(4567, 3, { type: "response" }); // drains, 10 per page
215
216
  ```
216
217
 
@@ -223,7 +224,17 @@ by `offset` instead.
223
224
  create or update a workflow from it. A workflow is always created turned off, and writes
224
225
  need a workspace-scoped API key.
225
226
 
227
+ `workflows.list` and `folders.list` find the ids a plan or an edit needs. With no `top` they drain
228
+ every match (100 per page); with `top` they return one page, and `listPage` also returns
229
+ `totalCount`. `name` is a case-insensitive substring match, so compare it yourself for an exact one.
230
+ Rows carry no steps: read a workflow back with `getPlan`. `folders.list` lists workflow folders only.
231
+
226
232
  ```ts
233
+ const folders = await client.folders.list({ name: "Sales" }); // substring match
234
+ const sales = folders.find((f) => f.name === "Sales"); // pick the exact name yourself
235
+ const leads = await client.workflows.list({ name: "lead alert", folderId: Number(sales!.id) });
236
+ const firstPage = await client.workflows.listPage({ top: 20 }); // { items, totalCount, offset, top }
237
+
227
238
  const hits = await client.workflows.searchCatalog({ q: "post message", app: "slack" });
228
239
  const schema = await client.workflows.getSchema(hits[0].slug);
229
240
  const connections = await client.workflows.listConnections({ app: "slack" });
package/dist/client.d.ts CHANGED
@@ -9,6 +9,7 @@ import { AuthProvidersResource } from "./resources/authProviders.js";
9
9
  import { OpaResource } from "./resources/opa.js";
10
10
  import { TriggersResource } from "./resources/triggers.js";
11
11
  import { ExecutionsResource } from "./resources/executions.js";
12
+ import { FoldersResource } from "./resources/folders.js";
12
13
  import { WorkflowsResource } from "./resources/workflows.js";
13
14
  import { ApplicationsResource } from "./resources/applications.js";
14
15
  import { AuthResource } from "./resources/auth.js";
@@ -59,6 +60,7 @@ export declare class Engini {
59
60
  readonly triggers: TriggersResource;
60
61
  readonly executions: ExecutionsResource;
61
62
  readonly workflows: WorkflowsResource;
63
+ readonly folders: FoldersResource;
62
64
  readonly applications: ApplicationsResource;
63
65
  readonly auth: AuthResource;
64
66
  readonly provider: Provider;
package/dist/client.js CHANGED
@@ -10,6 +10,7 @@ import { AuthProvidersResource } from "./resources/authProviders.js";
10
10
  import { OpaResource } from "./resources/opa.js";
11
11
  import { TriggersResource } from "./resources/triggers.js";
12
12
  import { ExecutionsResource } from "./resources/executions.js";
13
+ import { FoldersResource } from "./resources/folders.js";
13
14
  import { WorkflowsResource } from "./resources/workflows.js";
14
15
  import { ApplicationsResource } from "./resources/applications.js";
15
16
  import { AuthResource } from "./resources/auth.js";
@@ -26,6 +27,7 @@ export class Engini {
26
27
  triggers;
27
28
  executions;
28
29
  workflows;
30
+ folders;
29
31
  applications;
30
32
  auth;
31
33
  provider;
@@ -84,6 +86,7 @@ export class Engini {
84
86
  this.triggers = new TriggersResource(this);
85
87
  this.executions = new ExecutionsResource(this);
86
88
  this.workflows = new WorkflowsResource(this);
89
+ this.folders = new FoldersResource(this);
87
90
  this.applications = new ApplicationsResource(this);
88
91
  this.auth = new AuthResource(this);
89
92
  }
package/dist/index.d.ts CHANGED
@@ -9,8 +9,8 @@ export { EnginiError, EnginiNetworkError, EnginiAPIError, EnginiAuthError, Engin
9
9
  export type { EnginiAPIErrorOptions, EnginiBuilderErrorOptions, BuilderDiagnostic, } from "./errors.js";
10
10
  export { paginateCursor } from "./pagination.js";
11
11
  export type { CursorPage } from "./pagination.js";
12
- export { ToolsResource, ConnectionsResource, ToolsetsResource, McpResource, OpaResource, AuthProvidersResource, TriggersResource, ApplicationsResource, ExecutionsResource, WorkflowsResource, refreshFailed, verifyWebhook, } from "./resources/index.js";
13
- export type { ToolsGetOptions, ToolsExecuteOptions, ApplicationsListOptions, TriggersClient, TriggerWebhookEvent, ExecutionsClient, ExecutionsListParams, WorkflowsClient, } from "./resources/index.js";
12
+ export { ToolsResource, ConnectionsResource, ToolsetsResource, McpResource, OpaResource, AuthProvidersResource, TriggersResource, ApplicationsResource, ExecutionsResource, WorkflowsResource, FoldersResource, refreshFailed, verifyWebhook, } from "./resources/index.js";
13
+ export type { ToolsGetOptions, ToolsExecuteOptions, ApplicationsListOptions, TriggersClient, TriggerWebhookEvent, ExecutionsClient, ExecutionsListParams, WorkflowsClient, WorkflowsListParams, FoldersClient, FoldersListParams, } from "./resources/index.js";
14
14
  export { Toolset } from "./toolset.js";
15
15
  export type { ConnectionBinding, ToolsetExecuteOptions } from "./toolset.js";
16
16
  export { File } from "./files.js";
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ export { composeUserAgent } from "./http.js";
4
4
  export { VERSION } from "./version.js";
5
5
  export { EnginiError, EnginiNetworkError, EnginiAPIError, EnginiAuthError, EnginiNotFoundError, EnginiValidationError, EnginiRateLimitError, EnginiConflictError, EnginiServerError, EnginiClientError, EnginiConnectionError, EnginiToolsetError, EnginiToolsetNotFoundError, EnginiMcpServerNotFoundError, EnginiTimeoutError, EnginiToolExecutionError, EnginiOpaAgentNotFoundError, EnginiOpaAgentOfflineError, EnginiOpaApplicationAmbiguousError, EnginiOpaAgentTimeoutError, EnginiOpaAgentDispatchError, EnginiTriggerGapError, EnginiTriggerSubscribeFailedError, EnginiTriggerStreamLimitError, EnginiWebhookSignatureError, EnginiBuilderError, } from "./errors.js";
6
6
  export { paginateCursor } from "./pagination.js";
7
- export { ToolsResource, ConnectionsResource, ToolsetsResource, McpResource, OpaResource, AuthProvidersResource, TriggersResource, ApplicationsResource, ExecutionsResource, WorkflowsResource, refreshFailed, verifyWebhook, } from "./resources/index.js";
7
+ export { ToolsResource, ConnectionsResource, ToolsetsResource, McpResource, OpaResource, AuthProvidersResource, TriggersResource, ApplicationsResource, ExecutionsResource, WorkflowsResource, FoldersResource, refreshFailed, verifyWebhook, } from "./resources/index.js";
8
8
  export { Toolset } from "./toolset.js";
9
9
  export { File } from "./files.js";
10
10
  export { OpenAIProvider } from "./providers/openai.js";
@@ -27,7 +27,8 @@ export declare class AuthProvidersResource {
27
27
  get(id: number): Promise<AuthProviderResponse>;
28
28
  /**
29
29
  * Create a provider. `fieldValues` is keyed by slot; password values are write-only. A body
30
- * carrying `clientId` / `clientSecret` is a 400 `INVALID_AUTH_PROVIDER`.
30
+ * carrying `clientId` / `clientSecret` is a 400 `INVALID_AUTH_PROVIDER`. `allowScopeExtend`
31
+ * is optional: omit it and the server applies its default (`true`).
31
32
  */
32
33
  create(body: CreateAuthProviderRequest): Promise<AuthProviderResponse>;
33
34
  /**
@@ -29,7 +29,8 @@ export class AuthProvidersResource {
29
29
  }
30
30
  /**
31
31
  * Create a provider. `fieldValues` is keyed by slot; password values are write-only. A body
32
- * carrying `clientId` / `clientSecret` is a 400 `INVALID_AUTH_PROVIDER`.
32
+ * carrying `clientId` / `clientSecret` is a 400 `INVALID_AUTH_PROVIDER`. `allowScopeExtend`
33
+ * is optional: omit it and the server applies its default (`true`).
33
34
  */
34
35
  async create(body) {
35
36
  return call(authProvidersCreate, { client: this.client._transport, body });
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Folders resource — the folders that organize workflows in each workspace and environment
3
+ * (`GET /v1/folders`). Use it to turn a folder name into the `folderId` that
4
+ * `workflows.list` and `workflows.create` take.
5
+ */
6
+ import { type FolderPublicDto, type FoldersListFoldersData } from "@engini/client";
7
+ import { type Transport } from "../http.js";
8
+ /** Minimal client surface this resource needs (satisfied by `Engini`). */
9
+ export interface FoldersClient {
10
+ _transport: Transport;
11
+ }
12
+ type ListQuery = NonNullable<FoldersListFoldersData["query"]>;
13
+ /**
14
+ * Filters for `folders.list`. `type` is not offered: this resource lists workflow folders only
15
+ * (the only kind the server serves; table folders answer 501), so it always sends `type=workflow`.
16
+ */
17
+ export type FoldersListParams = Omit<ListQuery, "type" | "top" | "offset"> & {
18
+ /** With `top`, fetch one page of at most `top` rows (server cap 100) instead of draining. */
19
+ top?: number;
20
+ /** Only meaningful together with `top`. */
21
+ offset?: number;
22
+ };
23
+ export declare class FoldersResource {
24
+ private readonly client;
25
+ constructor(client: FoldersClient);
26
+ /**
27
+ * Workflow folders, by name unless `sort` says otherwise. `name` is a case-insensitive
28
+ * substring match, so several folders can match: compare `name` yourself for an exact one.
29
+ *
30
+ * With no `top`, drains every match by `offset`, 100 per page. Pass `top` for one bounded page
31
+ * (add `offset` to read a later one); use `listPage` to get `totalCount` back.
32
+ * A row deleted mid-drain can still be skipped.
33
+ */
34
+ list(params?: FoldersListParams): Promise<FolderPublicDto[]>;
35
+ /** One page, with its `totalCount`. */
36
+ listPage(params?: FoldersListParams): Promise<import("@engini/client").PaginatedResponseOfFolderPublicDto>;
37
+ }
38
+ export {};
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Folders resource — the folders that organize workflows in each workspace and environment
3
+ * (`GET /v1/folders`). Use it to turn a folder name into the `folderId` that
4
+ * `workflows.list` and `workflows.create` take.
5
+ */
6
+ import { foldersListFolders } from "@engini/client";
7
+ import { EnginiClientError } from "../errors.js";
8
+ import { call } from "../http.js";
9
+ import { collect, paginate } from "../pagination.js";
10
+ export class FoldersResource {
11
+ client;
12
+ constructor(client) {
13
+ this.client = client;
14
+ }
15
+ /**
16
+ * Workflow folders, by name unless `sort` says otherwise. `name` is a case-insensitive
17
+ * substring match, so several folders can match: compare `name` yourself for an exact one.
18
+ *
19
+ * With no `top`, drains every match by `offset`, 100 per page. Pass `top` for one bounded page
20
+ * (add `offset` to read a later one); use `listPage` to get `totalCount` back.
21
+ * A row deleted mid-drain can still be skipped.
22
+ */
23
+ async list(params = {}) {
24
+ const { top, offset, ...filters } = params;
25
+ if (top !== undefined)
26
+ return (await this.listPage({ ...filters, top, offset })).items ?? [];
27
+ if (offset !== undefined) {
28
+ throw new EnginiClientError("`offset` needs `top`; without `top` every page is drained from the start.");
29
+ }
30
+ const rows = await collect(paginate((skip, pageSize) => call(foldersListFolders, {
31
+ client: this.client._transport,
32
+ query: { ...filters, type: "workflow", offset: skip, top: pageSize },
33
+ })));
34
+ // A folder created mid-drain shifts later pages and repeats a row: keep the first (rows without an id all stay).
35
+ const seen = new Set();
36
+ return rows.filter((row) => row.id == null || (!seen.has(row.id) && !!seen.add(row.id)));
37
+ }
38
+ /** One page, with its `totalCount`. */
39
+ async listPage(params = {}) {
40
+ return call(foldersListFolders, {
41
+ client: this.client._transport,
42
+ query: { ...params, type: "workflow" },
43
+ });
44
+ }
45
+ }
@@ -12,6 +12,8 @@ export type { TriggersClient, TriggerWebhookEvent } from "./triggers.js";
12
12
  export { ExecutionsResource } from "./executions.js";
13
13
  export type { ExecutionsClient, ExecutionsListParams } from "./executions.js";
14
14
  export { WorkflowsResource } from "./workflows.js";
15
- export type { WorkflowsClient } from "./workflows.js";
15
+ export type { WorkflowsClient, WorkflowsListParams } from "./workflows.js";
16
+ export { FoldersResource } from "./folders.js";
17
+ export type { FoldersClient, FoldersListParams } from "./folders.js";
16
18
  export { ApplicationsResource } from "./applications.js";
17
19
  export type { ApplicationsListOptions } from "./applications.js";
@@ -7,4 +7,5 @@ export { OpaResource } from "./opa.js";
7
7
  export { TriggersResource, verifyWebhook } from "./triggers.js";
8
8
  export { ExecutionsResource } from "./executions.js";
9
9
  export { WorkflowsResource } from "./workflows.js";
10
+ export { FoldersResource } from "./folders.js";
10
11
  export { ApplicationsResource } from "./applications.js";
@@ -1,5 +1,6 @@
1
1
  /**
2
- * Workflows resource — the workflow builder (`/v1/workflows*`): look up what a plan may use
2
+ * Workflows resource — list workflows (`GET /v1/workflows`) and the workflow builder
3
+ * (`/v1/workflows*`): look up what a plan may use
3
4
  * (catalog, schemas, options, tables, connections), dry-run a plan with `compile`, and write
4
5
  * one with `create` / `update`.
5
6
  *
@@ -7,15 +8,36 @@
7
8
  * `currentRevisionId`). Writes need a workspace-scoped API key (`SCOPE_REQUIRED` otherwise),
8
9
  * and a workflow is always created turned off.
9
10
  */
10
- import { type BuilderConnectionInfo, type CatalogHit, type CompiledWorkflowDto, type CreateFromPlanResponse, type OptionItem, type TableColumn, type TableItem, type ToolSchema as BuilderToolSchema, type UpdateFromPlanResponse, type WorkflowPlan } from "@engini/client";
11
+ import { type BuilderConnectionInfo, type CatalogHit, type CompiledWorkflowDto, type CreateFromPlanResponse, type OptionItem, type TableColumn, type TableItem, type ToolSchema as BuilderToolSchema, type UpdateFromPlanResponse, type WorkflowPlan, type WorkflowPublicDto, type WorkflowsListWorkflowsData } from "@engini/client";
11
12
  import { type Transport } from "../http.js";
12
13
  /** Minimal client surface this resource needs (satisfied by `Engini`). */
13
14
  export interface WorkflowsClient {
14
15
  _transport: Transport;
15
16
  }
17
+ type ListQuery = NonNullable<WorkflowsListWorkflowsData["query"]>;
18
+ /** Filters for `workflows.list`; `top` / `offset` are handled by the method. */
19
+ export type WorkflowsListParams = Omit<ListQuery, "top" | "offset"> & {
20
+ /** With `top`, fetch one page of at most `top` rows (server cap 100) instead of draining. */
21
+ top?: number;
22
+ /** Only meaningful together with `top`. */
23
+ offset?: number;
24
+ };
16
25
  export declare class WorkflowsResource {
17
26
  private readonly client;
18
27
  constructor(client: WorkflowsClient);
28
+ /**
29
+ * Workflows the credential can see, without their steps (read one back as a plan with `getPlan`).
30
+ * `name` and `folderName` are case-insensitive substring matches, so several rows can match:
31
+ * compare `name` yourself for an exact one. `folderId` is a number here but a string on a folder
32
+ * (`folders.list`), and `0` means "no folder". Table automations are not listed.
33
+ *
34
+ * With no `top`, drains every match by `offset`, 100 per page. Pass `top` for one bounded page
35
+ * (add `offset` to read a later one); use `listPage` to get `totalCount` back.
36
+ * A row deleted mid-drain can still be skipped.
37
+ */
38
+ list(params?: WorkflowsListParams): Promise<WorkflowPublicDto[]>;
39
+ /** One page, with its `totalCount`. */
40
+ listPage(params?: WorkflowsListParams): Promise<import("@engini/client").PaginatedResponseOfWorkflowPublicDto>;
19
41
  /** Search the catalog of actions, triggers and blocks a plan step can name. */
20
42
  searchCatalog(params?: {
21
43
  q?: string;
@@ -76,3 +98,4 @@ export declare class WorkflowsResource {
76
98
  expectedRevisionId?: number;
77
99
  }): Promise<UpdateFromPlanResponse>;
78
100
  }
101
+ export {};
@@ -1,5 +1,6 @@
1
1
  /**
2
- * Workflows resource — the workflow builder (`/v1/workflows*`): look up what a plan may use
2
+ * Workflows resource — list workflows (`GET /v1/workflows`) and the workflow builder
3
+ * (`/v1/workflows*`): look up what a plan may use
3
4
  * (catalog, schemas, options, tables, connections), dry-run a plan with `compile`, and write
4
5
  * one with `create` / `update`.
5
6
  *
@@ -7,13 +8,44 @@
7
8
  * `currentRevisionId`). Writes need a workspace-scoped API key (`SCOPE_REQUIRED` otherwise),
8
9
  * and a workflow is always created turned off.
9
10
  */
10
- import { workflowsCompile, workflowsCreateWorkflow, workflowsGetOptions, workflowsGetPlan, workflowsGetSchema, workflowsListConnections, workflowsListTableColumns, workflowsListTables, workflowsSearchCatalog, workflowsUpdateWorkflow, } from "@engini/client";
11
+ import { workflowsCompile, workflowsCreateWorkflow, workflowsGetOptions, workflowsGetPlan, workflowsGetSchema, workflowsListConnections, workflowsListTableColumns, workflowsListTables, workflowsListWorkflows, workflowsSearchCatalog, workflowsUpdateWorkflow, } from "@engini/client";
12
+ import { EnginiClientError } from "../errors.js";
11
13
  import { call } from "../http.js";
14
+ import { collect, paginate } from "../pagination.js";
12
15
  export class WorkflowsResource {
13
16
  client;
14
17
  constructor(client) {
15
18
  this.client = client;
16
19
  }
20
+ /**
21
+ * Workflows the credential can see, without their steps (read one back as a plan with `getPlan`).
22
+ * `name` and `folderName` are case-insensitive substring matches, so several rows can match:
23
+ * compare `name` yourself for an exact one. `folderId` is a number here but a string on a folder
24
+ * (`folders.list`), and `0` means "no folder". Table automations are not listed.
25
+ *
26
+ * With no `top`, drains every match by `offset`, 100 per page. Pass `top` for one bounded page
27
+ * (add `offset` to read a later one); use `listPage` to get `totalCount` back.
28
+ * A row deleted mid-drain can still be skipped.
29
+ */
30
+ async list(params = {}) {
31
+ const { top, offset, ...filters } = params;
32
+ if (top !== undefined)
33
+ return (await this.listPage({ ...filters, top, offset })).items ?? [];
34
+ if (offset !== undefined) {
35
+ throw new EnginiClientError("`offset` needs `top`; without `top` every page is drained from the start.");
36
+ }
37
+ const rows = await collect(paginate((skip, pageSize) => call(workflowsListWorkflows, {
38
+ client: this.client._transport,
39
+ query: { ...filters, offset: skip, top: pageSize },
40
+ })));
41
+ // A workflow created mid-drain shifts later pages and repeats a row: keep the first (rows without an id all stay).
42
+ const seen = new Set();
43
+ return rows.filter((row) => row.workflowId == null || (!seen.has(row.workflowId) && !!seen.add(row.workflowId)));
44
+ }
45
+ /** One page, with its `totalCount`. */
46
+ async listPage(params = {}) {
47
+ return call(workflowsListWorkflows, { client: this.client._transport, query: params });
48
+ }
17
49
  /** Search the catalog of actions, triggers and blocks a plan step can name. */
18
50
  async searchCatalog(params = {}) {
19
51
  return call(workflowsSearchCatalog, { client: this.client._transport, query: params });
package/dist/version.d.ts CHANGED
@@ -3,4 +3,4 @@
3
3
  * Regenerated on every build/typecheck/test (see the "pre*" scripts in
4
4
  * package.json). Un-stamped local builds yield "0.0.0".
5
5
  */
6
- export declare const VERSION = "0.30.0";
6
+ export declare const VERSION = "0.32.0";
package/dist/version.js CHANGED
@@ -3,4 +3,4 @@
3
3
  * Regenerated on every build/typecheck/test (see the "pre*" scripts in
4
4
  * package.json). Un-stamped local builds yield "0.0.0".
5
5
  */
6
- export const VERSION = "0.30.0";
6
+ export const VERSION = "0.32.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@engini/sdk",
3
- "version": "0.30.0",
3
+ "version": "0.32.0",
4
4
  "description": "Engini SDK — agent-first ergonomic layer over the Engini Public API",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -27,7 +27,7 @@
27
27
  "test": "vitest run"
28
28
  },
29
29
  "dependencies": {
30
- "@engini/client": "0.16.0",
30
+ "@engini/client": "0.19.0",
31
31
  "undici": "^6.0.0"
32
32
  },
33
33
  "devDependencies": {