@iveri/contracts 0.82.1 → 0.83.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
@@ -144,6 +144,14 @@ Plus the request bodies for each, and the seven enums they are built from — `S
144
144
  `SignatureAlgorithm`, `SignatureEncoding`, `SignatureHeaderScheme`, `HandshakeKind`,
145
145
  `MatchOperator`, `DeliveryStatus`.
146
146
 
147
+ Outbound: `Connector` with its `ConnectorAuthManifest`, `Connection`, `Dispatch` and
148
+ `DispatchAttempt`, `ConnectionVerification`, and the consent flow — `StartConnectBody`,
149
+ `ConnectStart`, `ConnectAttempt` and `ConnectAttemptStatus`. Two of the five OAuth shapes a
150
+ connector can use are a person's: `oauth2-authorization-code`, where somebody grants access on the
151
+ provider's consent page (Slack's install, a person's own Slack), and `oauth2-jwt-bearer`, where a
152
+ service account acts as a named user (Google's domain-wide delegation). A connection may belong to
153
+ one person, and only that person or a service on their behalf can send through it.
154
+
147
155
  ### `api/unibox/` → `@iveri/contracts/unibox`
148
156
 
149
157
  `unibox-api`'s surface: `Channel` and its `ChannelIngestSecretResponse`, `Contact` with its
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Where a consent flow stands.
3
+ *
4
+ * **A product learns the outcome here, not from the address it is sent back to.** The return
5
+ * address carries the attempt id and a status, which are a hint for the page the person lands on;
6
+ * the address bar is something anybody can type, so a product that acts on a connection reads the
7
+ * attempt — or the connection — through the API first. The same rule as a payment return URL.
8
+ */
9
+ export declare enum ConnectAttemptStatus {
10
+ /** The consent page has been offered and nothing has come back yet. */
11
+ PENDING = "pending",
12
+ /** The provider granted access and the tokens are stored on the connection. */
13
+ CONNECTED = "connected",
14
+ /**
15
+ * The person declined, the provider refused the code exchange, or the callback could not be
16
+ * matched to what was asked. `failureReason` says which.
17
+ */
18
+ FAILED = "failed",
19
+ /**
20
+ * Nothing came back before the attempt ran out.
21
+ *
22
+ * Not stored: an attempt still pending past its expiry is reported as this, because its state
23
+ * and verifier can no longer be used and "pending" would suggest otherwise.
24
+ */
25
+ EXPIRED = "expired"
26
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Where a consent flow stands.
3
+ *
4
+ * **A product learns the outcome here, not from the address it is sent back to.** The return
5
+ * address carries the attempt id and a status, which are a hint for the page the person lands on;
6
+ * the address bar is something anybody can type, so a product that acts on a connection reads the
7
+ * attempt — or the connection — through the API first. The same rule as a payment return URL.
8
+ */
9
+ export var ConnectAttemptStatus;
10
+ (function (ConnectAttemptStatus) {
11
+ /** The consent page has been offered and nothing has come back yet. */
12
+ ConnectAttemptStatus["PENDING"] = "pending";
13
+ /** The provider granted access and the tokens are stored on the connection. */
14
+ ConnectAttemptStatus["CONNECTED"] = "connected";
15
+ /**
16
+ * The person declined, the provider refused the code exchange, or the callback could not be
17
+ * matched to what was asked. `failureReason` says which.
18
+ */
19
+ ConnectAttemptStatus["FAILED"] = "failed";
20
+ /**
21
+ * Nothing came back before the attempt ran out.
22
+ *
23
+ * Not stored: an attempt still pending past its expiry is reported as this, because its state
24
+ * and verifier can no longer be used and "pending" would suggest otherwise.
25
+ */
26
+ ConnectAttemptStatus["EXPIRED"] = "expired";
27
+ })(ConnectAttemptStatus || (ConnectAttemptStatus = {}));
@@ -0,0 +1,72 @@
1
+ import type { IsoDateTime } from '../../type/iso-date-time.type.js';
2
+ import type { Nullable } from '../../type/nil.type.js';
3
+ import type { UUID } from '../../type/uuid.type.js';
4
+ import type { ConnectAttemptStatus } from './connect-attempt-status.enum.js';
5
+ /**
6
+ * Query parameters Conduit adds to the return address when a consent flow ends.
7
+ *
8
+ * `?conduitConnectAttempt=<id>&conduitConnectStatus=connected|failed`. A hint for the page a person
9
+ * lands on — see {@link ConnectAttemptStatus} on why a product reads the attempt before acting.
10
+ */
11
+ export declare const CONNECT_RETURN_ATTEMPT_PARAM = "conduitConnectAttempt";
12
+ export declare const CONNECT_RETURN_STATUS_PARAM = "conduitConnectStatus";
13
+ /**
14
+ * `POST /api/v1/connections/:id/connect` — start a consent flow on a connection whose connector
15
+ * uses `oauth2-authorization-code`.
16
+ *
17
+ * Started on a **company's** connection, which holds the app's client id and secret. Without
18
+ * `ownerUserId` the tokens land on that connection — Slack's "Add to Slack" by the company's admin.
19
+ * With it they land on that person's own connection under the same key, created on first success
20
+ * — one employee connecting their own Slack. A person may start a flow only for themselves; a
21
+ * product's service may start one for anybody in its tenant, which is how a website's "Connect
22
+ * Slack" button reaches Conduit without the product holding a token.
23
+ */
24
+ export interface StartConnectBody {
25
+ /**
26
+ * Where the person's browser is sent when the flow ends, success or not.
27
+ *
28
+ * Its origin must be on Conduit's allowlist of product addresses, or the start is refused: a
29
+ * callback that redirected anywhere it was told would be an open redirect on our own domain,
30
+ * the shape of a phishing link that looks like ours.
31
+ */
32
+ returnUrl: string;
33
+ /** The person the connection is for. Absent connects the company's own connection. */
34
+ ownerUserId?: Nullable<UUID>;
35
+ }
36
+ /** One consent flow, from start to callback. `GET /api/v1/connect-attempts/:id`. */
37
+ export interface ConnectAttempt {
38
+ id: UUID;
39
+ /** The company connection the flow was started on, whose app credentials it uses. */
40
+ connectionId: UUID;
41
+ /** Its key, which a person's connection shares. */
42
+ connectionKey: string;
43
+ /** The person the flow is for, or null for the company's own connection. */
44
+ ownerUserId: Nullable<UUID>;
45
+ /**
46
+ * The connection now holding the tokens, once connected.
47
+ *
48
+ * The same as {@link connectionId} for a company; the person's own connection otherwise.
49
+ */
50
+ resultConnectionId: Nullable<UUID>;
51
+ status: ConnectAttemptStatus;
52
+ /**
53
+ * Why it failed: the provider's own error code (`access_denied` when the person declined), or
54
+ * what was wrong with the callback. Never a token or a code.
55
+ */
56
+ failureReason: Nullable<string>;
57
+ /** After this the state and verifier are void. Minutes, not hours. */
58
+ expiresAt: IsoDateTime;
59
+ completedAt: Nullable<IsoDateTime>;
60
+ createdAt: IsoDateTime;
61
+ }
62
+ /** `201 Created` from `POST /api/v1/connections/:id/connect`. */
63
+ export interface ConnectStart {
64
+ attempt: ConnectAttempt;
65
+ /**
66
+ * The provider's consent page, with the state and the PKCE challenge already in it.
67
+ *
68
+ * Send the person's browser here. It holds no secret — the verifier never leaves Conduit — but
69
+ * it is single-use and expires with the attempt.
70
+ */
71
+ authorizationUrl: string;
72
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Query parameters Conduit adds to the return address when a consent flow ends.
3
+ *
4
+ * `?conduitConnectAttempt=<id>&conduitConnectStatus=connected|failed`. A hint for the page a person
5
+ * lands on — see {@link ConnectAttemptStatus} on why a product reads the attempt before acting.
6
+ */
7
+ export const CONNECT_RETURN_ATTEMPT_PARAM = 'conduitConnectAttempt';
8
+ export const CONNECT_RETURN_STATUS_PARAM = 'conduitConnectStatus';
@@ -53,11 +53,40 @@ export interface Connection {
53
53
  * nothing points at the connection.
54
54
  */
55
55
  lastAuthError: Nullable<string>;
56
+ /**
57
+ * The person this connection belongs to, or null for a company's connection.
58
+ *
59
+ * A person's connection is made by a consent flow started for them, and it shares its key and
60
+ * connector with the company connection it was started from, whose app credentials it borrows.
61
+ * It holds a token only that person could grant — their own Slack, for their own status — so
62
+ * **only that person, or a service acting on their behalf, can dispatch through it**: a
63
+ * dispatch reaches it by naming the key and `onBehalfOfUserId`, and no other way.
64
+ */
65
+ ownerUserId: Nullable<UUID>;
66
+ /**
67
+ * When a consent flow last finished on this connection, or null when none has.
68
+ *
69
+ * For an `oauth2-authorization-code` connector this is the difference between configured and
70
+ * usable: the client id and secret are typed in, the token is only ever granted.
71
+ */
72
+ connectedAt: Nullable<IsoDateTime>;
56
73
  /** Stops *new* dispatches being accepted. Does not cancel ones already queued. */
57
74
  isActive: boolean;
58
75
  createdAt: IsoDateTime;
59
76
  updatedAt: IsoDateTime;
60
77
  }
78
+ /**
79
+ * Query for `GET /api/v1/connections`.
80
+ *
81
+ * `ownerUserId` lists one person's own connections — how a product learns whether somebody has
82
+ * connected. Absent lists every connection, a company's and every person's.
83
+ */
84
+ export interface GetConnectionsQuery {
85
+ limit?: number;
86
+ offset?: number;
87
+ search?: Nullable<string>;
88
+ ownerUserId?: Nullable<UUID>;
89
+ }
61
90
  /** `GET /api/v1/connections`. Offset-paginated — a small, slow-moving collection. */
62
91
  export interface ConnectionsPage {
63
92
  items: Connection[];
@@ -76,7 +105,9 @@ export interface CreateConnectionBody {
76
105
  *
77
106
  * Which names are expected depends on the connector's auth type: an `API_KEY_HEADER`
78
107
  * manifest names its own, an OAuth one wants `clientId`/`clientSecret` and, for the refresh
79
- * grant, `refreshToken`.
108
+ * grant, `refreshToken`. An authorization-code connection is given `clientId`/`clientSecret`
109
+ * here and receives its tokens through the consent flow. A JWT bearer one wants `clientEmail`,
110
+ * `privateKey` and optionally `privateKeyId`, the fields of a service account's key file.
80
111
  */
81
112
  credentials: Record<string, string>;
82
113
  variables?: Nullable<Record<string, string>>;
@@ -37,5 +37,41 @@ export declare enum ConnectorAuthType {
37
37
  * across replicas rather than left to race — two simultaneous refreshes rotate twice, one
38
38
  * of the two results is stored, and the connection is dead until a human re-authorises it.
39
39
  */
40
- OAUTH2_REFRESH_TOKEN = "oauth2-refresh-token"
40
+ OAUTH2_REFRESH_TOKEN = "oauth2-refresh-token",
41
+ /**
42
+ * OAuth 2.0 authorization code with PKCE (RFC 6749 §4.1, RFC 7636): a person grants access on
43
+ * the provider's own consent page, and the provider hands the tokens back to Conduit.
44
+ *
45
+ * **Nobody types this credential in.** The connection holds the app's client id and secret;
46
+ * the access token, and a refresh token when the provider issues one, arrive at Conduit's
47
+ * callback and are stored encrypted on the connection. That is the only way to obtain a
48
+ * token a provider gives out per installation — Slack's bot token, a person's own Slack token
49
+ * — because only somebody signed in at the provider can grant it.
50
+ *
51
+ * Afterwards it behaves like {@link OAUTH2_REFRESH_TOKEN}: a token with a lifetime is renewed
52
+ * with the refresh token under the same row lock. A token issued with **no lifetime and no
53
+ * refresh token** — Slack's, unless the app turns on rotation — is long-lived and is used until
54
+ * the provider refuses it; assuming an hour would leave it unusable with nothing to renew it.
55
+ *
56
+ * The PKCE verifier and the `state` stay on the server, are single-use and expire in minutes,
57
+ * so a consent page reached twice, or a callback replayed, connects nothing.
58
+ */
59
+ OAUTH2_AUTHORIZATION_CODE = "oauth2-authorization-code",
60
+ /**
61
+ * OAuth 2.0 JWT bearer grant (RFC 7523 §2.1): a service account signs an assertion with its own
62
+ * private key and exchanges it for a short-lived access token, **optionally acting as a named
63
+ * user**.
64
+ *
65
+ * This is Google Workspace's domain-wide delegation: the company's admin trusts one service
66
+ * account once, and Conduit then writes into each employee's own calendar by naming them as
67
+ * the assertion's `sub`. One credential, one consent, every person — nobody connects their own
68
+ * account and nobody can forget to.
69
+ *
70
+ * The user is named **per dispatch**, through the variable the manifest's `subjectVariable`
71
+ * names, so one connection serves a whole company. Tokens are cached per connection *and*
72
+ * subject: a token minted to act as one person must never be sent on behalf of another. No
73
+ * refresh token exists — the key signs a fresh assertion whenever one is needed — so, unlike
74
+ * {@link OAUTH2_REFRESH_TOKEN}, two replicas minting at once costs a token, not a connection.
75
+ */
76
+ OAUTH2_JWT_BEARER = "oauth2-jwt-bearer"
41
77
  }
@@ -39,4 +39,40 @@ export var ConnectorAuthType;
39
39
  * of the two results is stored, and the connection is dead until a human re-authorises it.
40
40
  */
41
41
  ConnectorAuthType["OAUTH2_REFRESH_TOKEN"] = "oauth2-refresh-token";
42
+ /**
43
+ * OAuth 2.0 authorization code with PKCE (RFC 6749 §4.1, RFC 7636): a person grants access on
44
+ * the provider's own consent page, and the provider hands the tokens back to Conduit.
45
+ *
46
+ * **Nobody types this credential in.** The connection holds the app's client id and secret;
47
+ * the access token, and a refresh token when the provider issues one, arrive at Conduit's
48
+ * callback and are stored encrypted on the connection. That is the only way to obtain a
49
+ * token a provider gives out per installation — Slack's bot token, a person's own Slack token
50
+ * — because only somebody signed in at the provider can grant it.
51
+ *
52
+ * Afterwards it behaves like {@link OAUTH2_REFRESH_TOKEN}: a token with a lifetime is renewed
53
+ * with the refresh token under the same row lock. A token issued with **no lifetime and no
54
+ * refresh token** — Slack's, unless the app turns on rotation — is long-lived and is used until
55
+ * the provider refuses it; assuming an hour would leave it unusable with nothing to renew it.
56
+ *
57
+ * The PKCE verifier and the `state` stay on the server, are single-use and expire in minutes,
58
+ * so a consent page reached twice, or a callback replayed, connects nothing.
59
+ */
60
+ ConnectorAuthType["OAUTH2_AUTHORIZATION_CODE"] = "oauth2-authorization-code";
61
+ /**
62
+ * OAuth 2.0 JWT bearer grant (RFC 7523 §2.1): a service account signs an assertion with its own
63
+ * private key and exchanges it for a short-lived access token, **optionally acting as a named
64
+ * user**.
65
+ *
66
+ * This is Google Workspace's domain-wide delegation: the company's admin trusts one service
67
+ * account once, and Conduit then writes into each employee's own calendar by naming them as
68
+ * the assertion's `sub`. One credential, one consent, every person — nobody connects their own
69
+ * account and nobody can forget to.
70
+ *
71
+ * The user is named **per dispatch**, through the variable the manifest's `subjectVariable`
72
+ * names, so one connection serves a whole company. Tokens are cached per connection *and*
73
+ * subject: a token minted to act as one person must never be sent on behalf of another. No
74
+ * refresh token exists — the key signs a fresh assertion whenever one is needed — so, unlike
75
+ * {@link OAUTH2_REFRESH_TOKEN}, two replicas minting at once costs a token, not a connection.
76
+ */
77
+ ConnectorAuthType["OAUTH2_JWT_BEARER"] = "oauth2-jwt-bearer";
42
78
  })(ConnectorAuthType || (ConnectorAuthType = {}));
@@ -11,6 +11,18 @@ import type { ConnectorAuthType } from './connector-auth-type.enum.js';
11
11
  export declare const CONNECTOR_CREDENTIAL_CLIENT_ID = "clientId";
12
12
  export declare const CONNECTOR_CREDENTIAL_CLIENT_SECRET = "clientSecret";
13
13
  export declare const CONNECTOR_CREDENTIAL_REFRESH_TOKEN = "refreshToken";
14
+ /**
15
+ * Credential names a JWT bearer manifest expects to find on a connection.
16
+ *
17
+ * They are the three fields of a Google service account's key file (`client_email`, `private_key`,
18
+ * `private_key_id`) under this API's camelCase. A client reading an uploaded key file maps those
19
+ * fields to these names; the rest of the file — the project id, the token URI — is either public or
20
+ * already the manifest's, so it is not kept. `privateKeyId` is optional: it only selects which of a
21
+ * service account's keys the provider checks the signature against.
22
+ */
23
+ export declare const CONNECTOR_CREDENTIAL_CLIENT_EMAIL = "clientEmail";
24
+ export declare const CONNECTOR_CREDENTIAL_PRIVATE_KEY = "privateKey";
25
+ export declare const CONNECTOR_CREDENTIAL_PRIVATE_KEY_ID = "privateKeyId";
14
26
  /**
15
27
  * How a connector authenticates, as data.
16
28
  *
@@ -48,6 +60,54 @@ export interface ConnectorAuthManifest {
48
60
  * routine. Null falls back to the service default.
49
61
  */
50
62
  expirySkewSeconds: Nullable<number>;
63
+ /**
64
+ * The provider's consent page. `OAUTH2_AUTHORIZATION_CODE` only.
65
+ *
66
+ * Not an outbound target — a person's browser goes there, never Conduit — but it must be https
67
+ * (or a private address where those are allowed), because the consent page is where somebody
68
+ * types their password.
69
+ */
70
+ authorizationUrl: Nullable<string>;
71
+ /**
72
+ * Extra query parameters on the consent URL for a **company's** connection. `OAUTH2_AUTHORIZATION_CODE` only.
73
+ *
74
+ * `scope` is sent as well when set. Data, because providers name things differently — Google
75
+ * wants `access_type=offline` before it issues a refresh token, Slack takes bot scopes as
76
+ * `scope` and a person's scopes as `user_scope`. The parameters the flow itself depends on
77
+ * (`response_type`, `client_id`, `redirect_uri`, `state`, `code_challenge`,
78
+ * `code_challenge_method`) are always Conduit's and cannot be overridden here.
79
+ */
80
+ authorizationParams: Nullable<Record<string, string>>;
81
+ /**
82
+ * The consent URL's parameters for a **person's own** connection, used *instead of* `scope`
83
+ * and {@link authorizationParams}. `OAUTH2_AUTHORIZATION_CODE` only. Null means the same as a
84
+ * company's.
85
+ *
86
+ * Separate because a person asks for less than a company admin does, and asking for more fails:
87
+ * Slack reinstalls the bot when a consent page requests bot scopes, which an ordinary member is
88
+ * usually not allowed to do. A person connecting their own Slack asks for `user_scope` alone.
89
+ */
90
+ personAuthorizationParams: Nullable<Record<string, string>>;
91
+ /**
92
+ * Where the token fields sit in the token response, tried in order. `OAUTH2_AUTHORIZATION_CODE` only.
93
+ *
94
+ * Each entry is a dotted path to an object holding RFC 6749's `access_token`, `refresh_token` and
95
+ * `expires_in`; an empty string is the response itself. The first object carrying an
96
+ * `access_token` wins, and its refresh token and lifetime are read from that same object, so a
97
+ * bot token is never paired with a user's refresh token. Null means the response itself only,
98
+ * which is what RFC 6749 describes. Slack's install answers with a bot token at the top and a
99
+ * person's token under `authed_user`: `['', 'authed_user']`.
100
+ */
101
+ tokenObjectPaths: Nullable<string[]>;
102
+ /**
103
+ * Which variable names the user a service account acts as. `OAUTH2_JWT_BEARER` only.
104
+ *
105
+ * Read from the connection's variables first and the dispatch's `pathParams` second — the same
106
+ * order as a path placeholder, so a connection that fixes it cannot be made to act as anybody
107
+ * else. Absent from both, the service account acts as itself, which is how it reaches a
108
+ * calendar shared with it directly. Null means it always acts as itself.
109
+ */
110
+ subjectVariable: Nullable<string>;
51
111
  }
52
112
  /** {@link ConnectorAuthManifest} as sent on create/update: nullable fields may simply be omitted. */
53
113
  export interface ConnectorAuthManifestInput {
@@ -58,6 +118,11 @@ export interface ConnectorAuthManifestInput {
58
118
  tokenUrl?: Nullable<string>;
59
119
  scope?: Nullable<string>;
60
120
  expirySkewSeconds?: Nullable<number>;
121
+ authorizationUrl?: Nullable<string>;
122
+ authorizationParams?: Nullable<Record<string, string>>;
123
+ personAuthorizationParams?: Nullable<Record<string, string>>;
124
+ tokenObjectPaths?: Nullable<string[]>;
125
+ subjectVariable?: Nullable<string>;
61
126
  }
62
127
  /**
63
128
  * One thing a connector can be asked to do.
@@ -82,6 +147,16 @@ export interface ConnectorOperation {
82
147
  */
83
148
  path: string;
84
149
  description: Nullable<string>;
150
+ /**
151
+ * Statuses meaning the change is **already in place**, recorded as a success.
152
+ *
153
+ * An insert whose id already exists answers 409, a delete of something already gone answers
154
+ * 404 or 410 — and that is exactly what a retry after a lost response sees. A caller that
155
+ * supplies its own id, as a calendar event's is made from a leave request's, is idempotent at
156
+ * the provider; without this the retry that proves it dead-letters, and a dead-letter queue
157
+ * full of things that worked teaches an operator to stop reading it. Empty for most operations.
158
+ */
159
+ alreadyAppliedStatuses: number[];
85
160
  }
86
161
  /** Requests per minute, and how many may arrive at once. Applied per connection. */
87
162
  export interface ConnectorRateLimit {
@@ -114,6 +189,16 @@ export interface ConnectorRetryPolicy {
114
189
  * expired thirty seconds early is not a failing destination and should not be treated as one.
115
190
  */
116
191
  authFailureStatuses: number[];
192
+ /**
193
+ * A dotted path to a boolean the provider sets `true` in a successful JSON response, or null.
194
+ *
195
+ * For a provider that answers **200 to a failure**: Slack's Web API returns
196
+ * `{ "ok": false, "error": "channel_not_found" }` with a 200, so by status alone every refused
197
+ * message reads as delivered. With `ok` here, a 2xx whose body does not hold `true` at that path
198
+ * is a permanent failure, kept with its body for the operator. A body that is not JSON fails
199
+ * the same way: the provider promised a flag and did not send one.
200
+ */
201
+ successBodyField: Nullable<string>;
117
202
  }
118
203
  /**
119
204
  * A third-party API, described entirely as data. §11's "connector manifest".
@@ -7,3 +7,15 @@
7
7
  export const CONNECTOR_CREDENTIAL_CLIENT_ID = 'clientId';
8
8
  export const CONNECTOR_CREDENTIAL_CLIENT_SECRET = 'clientSecret';
9
9
  export const CONNECTOR_CREDENTIAL_REFRESH_TOKEN = 'refreshToken';
10
+ /**
11
+ * Credential names a JWT bearer manifest expects to find on a connection.
12
+ *
13
+ * They are the three fields of a Google service account's key file (`client_email`, `private_key`,
14
+ * `private_key_id`) under this API's camelCase. A client reading an uploaded key file maps those
15
+ * fields to these names; the rest of the file — the project id, the token URI — is either public or
16
+ * already the manifest's, so it is not kept. `privateKeyId` is optional: it only selects which of a
17
+ * service account's keys the provider checks the signature against.
18
+ */
19
+ export const CONNECTOR_CREDENTIAL_CLIENT_EMAIL = 'clientEmail';
20
+ export const CONNECTOR_CREDENTIAL_PRIVATE_KEY = 'privateKey';
21
+ export const CONNECTOR_CREDENTIAL_PRIVATE_KEY_ID = 'privateKeyId';
@@ -24,6 +24,18 @@ export interface Dispatch {
24
24
  connectorKey: string;
25
25
  /** The operation named at submit time. */
26
26
  operation: string;
27
+ /**
28
+ * The person whose own connection this went through, or null for a company's connection.
29
+ *
30
+ * Recorded so the outbound log can say whose token spoke — a status set on somebody's Slack is
31
+ * something they will ask about.
32
+ */
33
+ ownerUserId: Nullable<UUID>;
34
+ /**
35
+ * Who a service account acted as, for a JWT bearer connector; null otherwise or when it acted
36
+ * as itself. Resolved at submit time, like the target URL.
37
+ */
38
+ authSubject: Nullable<string>;
27
39
  /** Optional FIFO lane. Dispatches in the same tenant and lane are claimed in creation order. */
28
40
  orderingKey: Nullable<string>;
29
41
  /**
@@ -114,12 +126,22 @@ export interface SubmitDispatchBody {
114
126
  /** The request body, sent to the provider as-is. */
115
127
  payload: Record<string, unknown>;
116
128
  /**
117
- * Values for `{placeholders}` in the operation's path that the connection does not supply.
129
+ * Values for `{placeholders}` in the operation's path that the connection does not supply, and
130
+ * for the variable a JWT bearer manifest's `subjectVariable` names.
118
131
  *
119
132
  * Percent-encoded into the path, so a value cannot introduce a path segment or a query
120
133
  * string and steer the request at a different endpoint of the same host.
121
134
  */
122
135
  pathParams?: Nullable<Record<string, string>>;
136
+ /**
137
+ * Send through this person's own connection under `connectionKey`, rather than the company's.
138
+ *
139
+ * The only way to reach a person's connection, and refused unless the caller is that person or
140
+ * a service: a person's token speaks as them, so nobody else's request may carry it. Refused
141
+ * as well when the person has not connected — a status update for somebody who never linked
142
+ * their Slack is not something to queue and dead-letter, it is something the caller skips.
143
+ */
144
+ onBehalfOfUserId?: Nullable<UUID>;
123
145
  /** Appended to the resolved URL. Values are encoded. */
124
146
  query?: Nullable<Record<string, string>>;
125
147
  /**
@@ -1,4 +1,6 @@
1
1
  export * from './capture.type.js';
2
+ export * from './connect-attempt-status.enum.js';
3
+ export * from './connect.type.js';
2
4
  export * from './connection-verification-verdict.enum.js';
3
5
  export * from './connection.type.js';
4
6
  export * from './connector-auth-type.enum.js';
@@ -1,4 +1,6 @@
1
1
  export * from './capture.type.js';
2
+ export * from './connect-attempt-status.enum.js';
3
+ export * from './connect.type.js';
2
4
  export * from './connection-verification-verdict.enum.js';
3
5
  export * from './connection.type.js';
4
6
  export * from './connector-auth-type.enum.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iveri/contracts",
3
- "version": "0.82.1",
3
+ "version": "0.83.0",
4
4
  "description": "Wire contracts shared by every Iveri backend and frontend. Zero runtime dependencies.",
5
5
  "license": "MIT",
6
6
  "repository": {