@engini/sdk 0.13.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.
@@ -4,7 +4,7 @@
4
4
  * `waitForRefresh` poll helper) that backs the interactive `engini connect` CLI.
5
5
  * See `docs/superpowers/specs/2026-06-18-cli-connect-flow-design.md`.
6
6
  */
7
- import { type ConnectionObject, type ConnectionPublicDetail, type ConnectionPublicListItem, type DefaultConnectionDto, type AccessTokenResponse, type RefreshStatusResponse, type SignInUrlResponse } from "@engini/client";
7
+ import { type ConnectionObject, type ConnectionReplaceResult, type ConnectionPublicDetail, type ConnectionPublicListItem, type DefaultConnectionDto, type AccessTokenResponse, type RefreshStatusResponse, type SignInUrlResponse } from "@engini/client";
8
8
  import { type Transport } from "../http.js";
9
9
  /**
10
10
  * Whether a refresh status is terminal (finished, error, or otherwise not running).
@@ -21,9 +21,49 @@ export interface ConnectionsClient {
21
21
  export declare class ConnectionsResource {
22
22
  private readonly client;
23
23
  constructor(client: ConnectionsClient);
24
- list(application?: string): Promise<ConnectionPublicListItem[]>;
24
+ /**
25
+ * All connections, paginated. `application` filters by slug; `kind` filters by
26
+ * connection kind — `Regular` | `Key` | `OPA` | `MCPClient`, case-insensitive.
27
+ * `Key` is the subset the engini.io Connections page shows under its "Keys"
28
+ * tab. `OPA` and `MCPClient` are accepted but return nothing: this endpoint
29
+ * does not serve those kinds.
30
+ */
31
+ list(application?: string, kind?: string): Promise<ConnectionPublicListItem[]>;
25
32
  get(connectionId: number): Promise<ConnectionPublicDetail>;
26
33
  delete(connectionId: number): Promise<unknown>;
34
+ /**
35
+ * Update a connection in place; returns the updated connection detail.
36
+ *
37
+ * An omitted option is left out of the request and the server leaves that
38
+ * member unchanged.
39
+ *
40
+ * WARNING: supplying `fields` or `metadata` **replaces the entire map** — it
41
+ * does not merge with what is stored. Rotating one credential by passing a
42
+ * single-entry `fields` object clears every other field on the connection.
43
+ * Read the current values with `get()` first and pass the full map.
44
+ */
45
+ update(connectionId: number, opts?: {
46
+ name?: string;
47
+ description?: string;
48
+ fields?: Record<string, string>;
49
+ metadata?: Record<string, string>;
50
+ }): Promise<ConnectionPublicDetail>;
51
+ /**
52
+ * Point one *workflow* at a different connection.
53
+ *
54
+ * This is **workflow-scoped**, not a global swap: it rewires only
55
+ * `workflowId`'s activities from `originalConnectionId` to `newConnectionId`.
56
+ * Other workflows using the original connection are untouched. An options
57
+ * object rather than three positional ids, which are easy to transpose.
58
+ *
59
+ * Rejects if any activity cannot be remapped (the target connection does not
60
+ * expose the required activity or object).
61
+ */
62
+ replace(opts: {
63
+ workflowId: number;
64
+ originalConnectionId: number;
65
+ newConnectionId: number;
66
+ }): Promise<ConnectionReplaceResult>;
27
67
  defaults(): Promise<DefaultConnectionDto[]>;
28
68
  setDefault(connectionId: number): Promise<unknown>;
29
69
  clearDefault(application: string): Promise<unknown>;
@@ -4,7 +4,7 @@
4
4
  * `waitForRefresh` poll helper) that backs the interactive `engini connect` CLI.
5
5
  * See `docs/superpowers/specs/2026-06-18-cli-connect-flow-design.md`.
6
6
  */
7
- import { connectionsGetConnection, connectionsDeleteConnection, connectionsGetConnections, connectionsGetDefaultConnections, connectionsSetDefaultConnection, connectionsClearDefaultConnection, connectionsGetSignInUrl, connectionsGetAccessToken, connectionsCreateConnection, connectionsCheckConnection, connectionsRefreshObjects, connectionsGetRefreshStatus, connectionsGetConnectionObjects, connectionsSelectObjects, } from "@engini/client";
7
+ import { connectionsGetConnection, connectionsDeleteConnection, connectionsGetConnections, connectionsGetDefaultConnections, connectionsSetDefaultConnection, connectionsClearDefaultConnection, connectionsGetSignInUrl, connectionsGetAccessToken, connectionsCreateConnection, connectionsCheckConnection, connectionsRefreshObjects, connectionsGetRefreshStatus, connectionsGetConnectionObjects, connectionsSelectObjects, connectionsUpdateConnection, connectionsReplaceConnection, } from "@engini/client";
8
8
  import { call } from "../http.js";
9
9
  import { paginate, collect } from "../pagination.js";
10
10
  import { EnginiConnectionError, EnginiTimeoutError, EnginiToolsetError } from "../errors.js";
@@ -76,11 +76,18 @@ export class ConnectionsResource {
76
76
  constructor(client) {
77
77
  this.client = client;
78
78
  }
79
- async list(application) {
79
+ /**
80
+ * All connections, paginated. `application` filters by slug; `kind` filters by
81
+ * connection kind — `Regular` | `Key` | `OPA` | `MCPClient`, case-insensitive.
82
+ * `Key` is the subset the engini.io Connections page shows under its "Keys"
83
+ * tab. `OPA` and `MCPClient` are accepted but return nothing: this endpoint
84
+ * does not serve those kinds.
85
+ */
86
+ async list(application, kind) {
80
87
  const transport = this.client._transport;
81
88
  return collect(paginate((offset, top) => call(connectionsGetConnections, {
82
89
  client: transport,
83
- query: { applicationSlug: application, offset, top },
90
+ query: { applicationSlug: application, kind, offset, top },
84
91
  }), { top: 25 }));
85
92
  }
86
93
  async get(connectionId) {
@@ -95,6 +102,50 @@ export class ConnectionsResource {
95
102
  path: { connectionId },
96
103
  });
97
104
  }
105
+ /**
106
+ * Update a connection in place; returns the updated connection detail.
107
+ *
108
+ * An omitted option is left out of the request and the server leaves that
109
+ * member unchanged.
110
+ *
111
+ * WARNING: supplying `fields` or `metadata` **replaces the entire map** — it
112
+ * does not merge with what is stored. Rotating one credential by passing a
113
+ * single-entry `fields` object clears every other field on the connection.
114
+ * Read the current values with `get()` first and pass the full map.
115
+ */
116
+ async update(connectionId, opts = {}) {
117
+ return call(connectionsUpdateConnection, {
118
+ client: this.client._transport,
119
+ path: { connectionId },
120
+ body: {
121
+ ...(opts.name !== undefined ? { connectionName: opts.name } : {}),
122
+ ...(opts.description !== undefined ? { description: opts.description } : {}),
123
+ ...(opts.fields !== undefined ? { fields: opts.fields } : {}),
124
+ ...(opts.metadata !== undefined ? { metadata: opts.metadata } : {}),
125
+ },
126
+ });
127
+ }
128
+ /**
129
+ * Point one *workflow* at a different connection.
130
+ *
131
+ * This is **workflow-scoped**, not a global swap: it rewires only
132
+ * `workflowId`'s activities from `originalConnectionId` to `newConnectionId`.
133
+ * Other workflows using the original connection are untouched. An options
134
+ * object rather than three positional ids, which are easy to transpose.
135
+ *
136
+ * Rejects if any activity cannot be remapped (the target connection does not
137
+ * expose the required activity or object).
138
+ */
139
+ async replace(opts) {
140
+ return call(connectionsReplaceConnection, {
141
+ client: this.client._transport,
142
+ body: {
143
+ workflowId: opts.workflowId,
144
+ originalConnectionId: opts.originalConnectionId,
145
+ newConnectionId: opts.newConnectionId,
146
+ },
147
+ });
148
+ }
98
149
  async defaults() {
99
150
  const res = await call(connectionsGetDefaultConnections, {
100
151
  client: this.client._transport,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@engini/sdk",
3
- "version": "0.13.0",
3
+ "version": "0.15.0",
4
4
  "description": "Engini SDK — agent-first ergonomic layer over the Engini Public API",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -23,7 +23,7 @@
23
23
  "test": "vitest run"
24
24
  },
25
25
  "dependencies": {
26
- "@engini/client": "0.5.0",
26
+ "@engini/client": "0.6.0",
27
27
  "undici": "^6.0.0"
28
28
  },
29
29
  "devDependencies": {