@engini/sdk 0.20.0 → 0.21.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/resources/connections.d.ts +25 -2
- package/dist/resources/connections.js +28 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -37,16 +37,29 @@ export declare class ConnectionsResource {
|
|
|
37
37
|
* An omitted option is left out of the request and the server leaves that
|
|
38
38
|
* member unchanged.
|
|
39
39
|
*
|
|
40
|
+
* `opts.oauthState` is the `state` of a fresh sign-in, and is REQUIRED on an OAuth2
|
|
41
|
+
* connection when `fields` sets `ApiKey`, `RefreshToken` or `ExternalOrgId` to a value
|
|
42
|
+
* that differs from what is stored - the server derives those from its own record of
|
|
43
|
+
* the sign-in and will not take them from a caller. Rotating a credential over the API
|
|
44
|
+
* therefore means running the sign-in (`engini connect`) and passing its state here;
|
|
45
|
+
* without one the request returns 400 `OAUTH_STATE_REQUIRED`. Everything else -
|
|
46
|
+
* renaming, editing `BaseUrl` or any `Key{N}` setting, re-posting the stored credentials
|
|
47
|
+
* unchanged - needs no state at all. `ExternalOrgId` is rejected outright as a
|
|
48
|
+
* server-derived field.
|
|
49
|
+
*
|
|
40
50
|
* WARNING: supplying `fields` or `metadata` **replaces the entire map** — it
|
|
41
51
|
* does not merge with what is stored. Rotating one credential by passing a
|
|
42
52
|
* single-entry `fields` object clears every other field on the connection.
|
|
43
|
-
* Read the current values with `get()` first and pass the full map.
|
|
53
|
+
* Read the current values with `get()` first and pass the full map. Secret fields read
|
|
54
|
+
* back redacted; posting the redaction placeholder unchanged leaves the stored secret
|
|
55
|
+
* alone.
|
|
44
56
|
*/
|
|
45
57
|
update(connectionId: number, opts?: {
|
|
46
58
|
name?: string;
|
|
47
59
|
description?: string;
|
|
48
60
|
fields?: Record<string, string>;
|
|
49
61
|
metadata?: Record<string, string>;
|
|
62
|
+
oauthState?: string;
|
|
50
63
|
}): Promise<ConnectionPublicDetail>;
|
|
51
64
|
/**
|
|
52
65
|
* Point one *workflow* at a different connection.
|
|
@@ -75,9 +88,19 @@ export declare class ConnectionsResource {
|
|
|
75
88
|
}): Promise<SignInUrlResponse>;
|
|
76
89
|
/** Poll an OAuth2 sign-in by `state`; `status` is `completed` when done. */
|
|
77
90
|
getAccessToken(state: string): Promise<AccessTokenResponse>;
|
|
78
|
-
/**
|
|
91
|
+
/**
|
|
92
|
+
* Create a connection; returns the full connection detail.
|
|
93
|
+
*
|
|
94
|
+
* `opts.oauthState` is the `state` from the sign-in this connection came from, and is
|
|
95
|
+
* REQUIRED on OAuth2 authentication methods - the server derives the credentials from
|
|
96
|
+
* its own record of that sign-in and ignores whatever `fields` carry for those keys.
|
|
97
|
+
* Omitting it on an OAuth method returns 400 `OAUTH_STATE_REQUIRED`; a state the server
|
|
98
|
+
* cannot resolve (expired, unknown, or another account's) returns 400
|
|
99
|
+
* `OAUTH_STATE_EXPIRED`. `ExternalOrgId` is rejected outright as a server-derived field.
|
|
100
|
+
*/
|
|
79
101
|
create(application: string, connectionName: string, authenticationId: number, fields: Record<string, string>, opts?: {
|
|
80
102
|
description?: string;
|
|
103
|
+
oauthState?: string;
|
|
81
104
|
}): Promise<ConnectionPublicDetail>;
|
|
82
105
|
/** Test a connection's liveness; returns the decoded check result. */
|
|
83
106
|
check(connectionId: number): Promise<unknown>;
|
|
@@ -108,10 +108,22 @@ export class ConnectionsResource {
|
|
|
108
108
|
* An omitted option is left out of the request and the server leaves that
|
|
109
109
|
* member unchanged.
|
|
110
110
|
*
|
|
111
|
+
* `opts.oauthState` is the `state` of a fresh sign-in, and is REQUIRED on an OAuth2
|
|
112
|
+
* connection when `fields` sets `ApiKey`, `RefreshToken` or `ExternalOrgId` to a value
|
|
113
|
+
* that differs from what is stored - the server derives those from its own record of
|
|
114
|
+
* the sign-in and will not take them from a caller. Rotating a credential over the API
|
|
115
|
+
* therefore means running the sign-in (`engini connect`) and passing its state here;
|
|
116
|
+
* without one the request returns 400 `OAUTH_STATE_REQUIRED`. Everything else -
|
|
117
|
+
* renaming, editing `BaseUrl` or any `Key{N}` setting, re-posting the stored credentials
|
|
118
|
+
* unchanged - needs no state at all. `ExternalOrgId` is rejected outright as a
|
|
119
|
+
* server-derived field.
|
|
120
|
+
*
|
|
111
121
|
* WARNING: supplying `fields` or `metadata` **replaces the entire map** — it
|
|
112
122
|
* does not merge with what is stored. Rotating one credential by passing a
|
|
113
123
|
* single-entry `fields` object clears every other field on the connection.
|
|
114
|
-
* Read the current values with `get()` first and pass the full map.
|
|
124
|
+
* Read the current values with `get()` first and pass the full map. Secret fields read
|
|
125
|
+
* back redacted; posting the redaction placeholder unchanged leaves the stored secret
|
|
126
|
+
* alone.
|
|
115
127
|
*/
|
|
116
128
|
async update(connectionId, opts = {}) {
|
|
117
129
|
return call(connectionsUpdateConnection, {
|
|
@@ -122,6 +134,10 @@ export class ConnectionsResource {
|
|
|
122
134
|
...(opts.description !== undefined ? { description: opts.description } : {}),
|
|
123
135
|
...(opts.fields !== undefined ? { fields: opts.fields } : {}),
|
|
124
136
|
...(opts.metadata !== undefined ? { metadata: opts.metadata } : {}),
|
|
137
|
+
// Spread, like create's: engini-client is generated from the deployed spec, where
|
|
138
|
+
// UpdateConnectionRequest has no oauthState yet, and excess-property checking does
|
|
139
|
+
// not apply to a spread result. Drop the conditional once a regen lands the field.
|
|
140
|
+
...(opts.oauthState !== undefined ? { oauthState: opts.oauthState } : {}),
|
|
125
141
|
},
|
|
126
142
|
});
|
|
127
143
|
}
|
|
@@ -204,7 +220,16 @@ export class ConnectionsResource {
|
|
|
204
220
|
path: { state },
|
|
205
221
|
});
|
|
206
222
|
}
|
|
207
|
-
/**
|
|
223
|
+
/**
|
|
224
|
+
* Create a connection; returns the full connection detail.
|
|
225
|
+
*
|
|
226
|
+
* `opts.oauthState` is the `state` from the sign-in this connection came from, and is
|
|
227
|
+
* REQUIRED on OAuth2 authentication methods - the server derives the credentials from
|
|
228
|
+
* its own record of that sign-in and ignores whatever `fields` carry for those keys.
|
|
229
|
+
* Omitting it on an OAuth method returns 400 `OAUTH_STATE_REQUIRED`; a state the server
|
|
230
|
+
* cannot resolve (expired, unknown, or another account's) returns 400
|
|
231
|
+
* `OAUTH_STATE_EXPIRED`. `ExternalOrgId` is rejected outright as a server-derived field.
|
|
232
|
+
*/
|
|
208
233
|
async create(application, connectionName, authenticationId, fields, opts = {}) {
|
|
209
234
|
return call(connectionsCreateConnection, {
|
|
210
235
|
client: this.client._transport,
|
|
@@ -214,6 +239,7 @@ export class ConnectionsResource {
|
|
|
214
239
|
authenticationId,
|
|
215
240
|
fields,
|
|
216
241
|
...(opts.description !== undefined ? { description: opts.description } : {}),
|
|
242
|
+
...(opts.oauthState !== undefined ? { oauthState: opts.oauthState } : {}),
|
|
217
243
|
},
|
|
218
244
|
});
|
|
219
245
|
}
|
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED