@relaymessenger/sdk 0.3.7-staging.1 → 0.3.7-staging.11
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 +9 -8
- package/dist/a2ui.d.ts +3 -2
- package/dist/a2ui.d.ts.map +1 -1
- package/dist/a2ui.js +3 -2
- package/dist/a2ui.js.map +1 -1
- package/dist/client.d.ts +27 -118
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +37 -250
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/login-button/index.d.ts +29 -0
- package/dist/login-button/index.d.ts.map +1 -0
- package/dist/login-button/index.js +58 -0
- package/dist/login-button/index.js.map +1 -0
- package/dist/login.d.ts +49 -0
- package/dist/login.d.ts.map +1 -0
- package/dist/login.js +47 -0
- package/dist/login.js.map +1 -0
- package/dist/operations.d.ts +15 -39
- package/dist/operations.d.ts.map +1 -1
- package/dist/operations.js +15 -49
- package/dist/operations.js.map +1 -1
- package/dist/rich-cards.d.ts +23 -0
- package/dist/rich-cards.d.ts.map +1 -0
- package/dist/rich-cards.js +24 -0
- package/dist/rich-cards.js.map +1 -0
- package/dist/types.d.ts +243 -294
- package/dist/types.d.ts.map +1 -1
- package/dist/websocket.d.ts.map +1 -1
- package/dist/websocket.js +3 -4
- package/dist/websocket.js.map +1 -1
- package/package.json +14 -3
package/dist/login.d.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type JWTPayload } from "jose";
|
|
2
|
+
/**
|
|
3
|
+
* Log in with Relay: Relay is a standard OpenID Connect provider, so any
|
|
4
|
+
* OpenID Connect library works (openid-client, Auth.js, Passport). This is
|
|
5
|
+
* the one step a website that already holds an ID token needs: check its
|
|
6
|
+
* signature against Relay's published keys, its issuer, its audience (your
|
|
7
|
+
* client ID, which is your agent's ID) and its expiry. jose does the
|
|
8
|
+
* checking (RFC 7519, OpenID Connect Core 3.1.3.7).
|
|
9
|
+
*/
|
|
10
|
+
/** Relay's OpenID Connect issuer. Staging is `https://auth.staging.relayapp.im/api/auth`. */
|
|
11
|
+
export declare const RELAY_ISSUER = "https://auth.relayapp.im/api/auth";
|
|
12
|
+
/** The claims Relay puts in an ID token. `email` and `phone_number` only when the person shared them. */
|
|
13
|
+
export interface RelayIdTokenClaims extends JWTPayload {
|
|
14
|
+
/** The person's Relay user ID, stable for your client. */
|
|
15
|
+
sub: string;
|
|
16
|
+
/** Your client ID: your agent's ID. */
|
|
17
|
+
aud: string;
|
|
18
|
+
iss: string;
|
|
19
|
+
exp: number;
|
|
20
|
+
iat: number;
|
|
21
|
+
nonce?: string;
|
|
22
|
+
name?: string;
|
|
23
|
+
/** The person's Relay @handle, without the @. */
|
|
24
|
+
preferred_username?: string;
|
|
25
|
+
picture?: string;
|
|
26
|
+
email?: string;
|
|
27
|
+
email_verified?: boolean;
|
|
28
|
+
/** E.164, only with the `phone` scope and when the person shared it. */
|
|
29
|
+
phone_number?: string;
|
|
30
|
+
phone_number_verified?: boolean;
|
|
31
|
+
}
|
|
32
|
+
export interface VerifyRelayIdTokenOptions {
|
|
33
|
+
/** Your client ID, which is your agent's ID. */
|
|
34
|
+
clientId: string;
|
|
35
|
+
/** Defaults to {@link RELAY_ISSUER}. */
|
|
36
|
+
issuer?: string;
|
|
37
|
+
/** The nonce your login request sent, when it sent one. */
|
|
38
|
+
nonce?: string;
|
|
39
|
+
/** Seconds of clock skew to allow on `exp` and `iat`. Defaults to 60. */
|
|
40
|
+
clockTolerance?: number;
|
|
41
|
+
/** For tests and runtimes without a global fetch. */
|
|
42
|
+
fetch?: typeof globalThis.fetch;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Verifies a Relay ID token and returns its claims. Throws when the
|
|
46
|
+
* signature, issuer, audience, expiry or nonce is wrong.
|
|
47
|
+
*/
|
|
48
|
+
export declare function verifyRelayIdToken(idToken: string, options: VerifyRelayIdTokenOptions): Promise<RelayIdTokenClaims>;
|
|
49
|
+
//# sourceMappingURL=login.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../src/login.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8C,KAAK,UAAU,EAAE,MAAM,MAAM,CAAC;AAEnF;;;;;;;GAOG;AAEH,6FAA6F;AAC7F,eAAO,MAAM,YAAY,sCAAsC,CAAC;AAEhE,yGAAyG;AACzG,MAAM,WAAW,kBAAmB,SAAQ,UAAU;IACpD,0DAA0D;IAC1D,GAAG,EAAE,MAAM,CAAC;IACZ,uCAAuC;IACvC,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iDAAiD;IACjD,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,wEAAwE;IACxE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,MAAM,WAAW,yBAAyB;IACxC,gDAAgD;IAChD,QAAQ,EAAE,MAAM,CAAC;IACjB,wCAAwC;IACxC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2DAA2D;IAC3D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yEAAyE;IACzE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,qDAAqD;IACrD,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;CACjC;AAkBD;;;GAGG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,yBAAyB,GACjC,OAAO,CAAC,kBAAkB,CAAC,CAc7B"}
|
package/dist/login.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { createRemoteJWKSet, customFetch, jwtVerify } from "jose";
|
|
2
|
+
/**
|
|
3
|
+
* Log in with Relay: Relay is a standard OpenID Connect provider, so any
|
|
4
|
+
* OpenID Connect library works (openid-client, Auth.js, Passport). This is
|
|
5
|
+
* the one step a website that already holds an ID token needs: check its
|
|
6
|
+
* signature against Relay's published keys, its issuer, its audience (your
|
|
7
|
+
* client ID, which is your agent's ID) and its expiry. jose does the
|
|
8
|
+
* checking (RFC 7519, OpenID Connect Core 3.1.3.7).
|
|
9
|
+
*/
|
|
10
|
+
/** Relay's OpenID Connect issuer. Staging is `https://auth.staging.relayapp.im/api/auth`. */
|
|
11
|
+
export const RELAY_ISSUER = "https://auth.relayapp.im/api/auth";
|
|
12
|
+
const keySets = new Map();
|
|
13
|
+
const keysFor = async (issuer, fetcher) => {
|
|
14
|
+
const cached = keySets.get(issuer);
|
|
15
|
+
if (cached)
|
|
16
|
+
return cached;
|
|
17
|
+
const response = await fetcher(`${issuer}/.well-known/openid-configuration`);
|
|
18
|
+
if (!response.ok)
|
|
19
|
+
throw new Error(`Relay's OpenID configuration answered ${response.status}.`);
|
|
20
|
+
const discovery = await response.json();
|
|
21
|
+
if (discovery.issuer !== issuer || !discovery.jwks_uri) {
|
|
22
|
+
throw new Error("Relay's OpenID configuration does not match the issuer.");
|
|
23
|
+
}
|
|
24
|
+
const keys = createRemoteJWKSet(new URL(discovery.jwks_uri), { [customFetch]: fetcher });
|
|
25
|
+
keySets.set(issuer, keys);
|
|
26
|
+
return keys;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Verifies a Relay ID token and returns its claims. Throws when the
|
|
30
|
+
* signature, issuer, audience, expiry or nonce is wrong.
|
|
31
|
+
*/
|
|
32
|
+
export async function verifyRelayIdToken(idToken, options) {
|
|
33
|
+
const issuer = (options.issuer ?? RELAY_ISSUER).replace(/\/$/, "");
|
|
34
|
+
const fetcher = options.fetch ?? globalThis.fetch;
|
|
35
|
+
const { payload } = await jwtVerify(idToken, await keysFor(issuer, fetcher), {
|
|
36
|
+
issuer,
|
|
37
|
+
audience: options.clientId,
|
|
38
|
+
algorithms: ["RS256"],
|
|
39
|
+
clockTolerance: options.clockTolerance ?? 60,
|
|
40
|
+
requiredClaims: ["sub", "exp", "iat"],
|
|
41
|
+
});
|
|
42
|
+
if (options.nonce !== undefined && payload.nonce !== options.nonce) {
|
|
43
|
+
throw new Error("The ID token's nonce does not match the login request.");
|
|
44
|
+
}
|
|
45
|
+
return payload;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=login.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login.js","sourceRoot":"","sources":["../src/login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,SAAS,EAAmB,MAAM,MAAM,CAAC;AAEnF;;;;;;;GAOG;AAEH,6FAA6F;AAC7F,MAAM,CAAC,MAAM,YAAY,GAAG,mCAAmC,CAAC;AAoChE,MAAM,OAAO,GAAG,IAAI,GAAG,EAAiD,CAAC;AAEzE,MAAM,OAAO,GAAG,KAAK,EAAE,MAAc,EAAE,OAAgC,EAAE,EAAE;IACzE,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACnC,IAAI,MAAM;QAAE,OAAO,MAAM,CAAC;IAC1B,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,GAAG,MAAM,mCAAmC,CAAC,CAAC;IAC7E,IAAI,CAAC,QAAQ,CAAC,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,yCAAyC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;IAC/F,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC,IAAI,EAA4C,CAAC;IAClF,IAAI,SAAS,CAAC,MAAM,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[{
|
|
|
11
11
|
readonly method: "GET";
|
|
12
12
|
readonly path: "/v1/me";
|
|
13
13
|
readonly operationId: "getMe";
|
|
14
|
-
}, {
|
|
15
|
-
readonly method: "PATCH";
|
|
16
|
-
readonly path: "/v1/me";
|
|
17
|
-
readonly operationId: "updateAgentMe";
|
|
18
14
|
}, {
|
|
19
15
|
readonly method: "POST";
|
|
20
16
|
readonly path: "/v1/chats";
|
|
@@ -149,20 +145,24 @@ export declare const RELAY_V1_OPERATIONS: readonly [{
|
|
|
149
145
|
readonly operationId: "unblockHandle";
|
|
150
146
|
}, {
|
|
151
147
|
readonly method: "GET";
|
|
152
|
-
readonly path: "/v1/
|
|
153
|
-
readonly operationId: "
|
|
148
|
+
readonly path: "/v1/access";
|
|
149
|
+
readonly operationId: "listAgentAccess";
|
|
154
150
|
}, {
|
|
155
|
-
readonly method: "
|
|
156
|
-
readonly path: "/v1/
|
|
157
|
-
readonly operationId: "
|
|
151
|
+
readonly method: "GET";
|
|
152
|
+
readonly path: "/v1/oauth2_client";
|
|
153
|
+
readonly operationId: "getOAuth2Client";
|
|
158
154
|
}, {
|
|
159
155
|
readonly method: "POST";
|
|
160
|
-
readonly path: "/v1/
|
|
161
|
-
readonly operationId: "
|
|
156
|
+
readonly path: "/v1/oauth2_client";
|
|
157
|
+
readonly operationId: "createOAuth2Client";
|
|
162
158
|
}, {
|
|
163
|
-
readonly method: "
|
|
164
|
-
readonly path: "/v1/
|
|
165
|
-
readonly operationId: "
|
|
159
|
+
readonly method: "PATCH";
|
|
160
|
+
readonly path: "/v1/oauth2_client";
|
|
161
|
+
readonly operationId: "updateOAuth2Client";
|
|
162
|
+
}, {
|
|
163
|
+
readonly method: "POST";
|
|
164
|
+
readonly path: "/v1/oauth2_client/reset_secret";
|
|
165
|
+
readonly operationId: "resetOAuth2ClientSecret";
|
|
166
166
|
}, {
|
|
167
167
|
readonly method: "PUT";
|
|
168
168
|
readonly path: "/v1/access/{handle}";
|
|
@@ -171,30 +171,6 @@ export declare const RELAY_V1_OPERATIONS: readonly [{
|
|
|
171
171
|
readonly method: "DELETE";
|
|
172
172
|
readonly path: "/v1/access/{handle}";
|
|
173
173
|
readonly operationId: "removeAgentAccess";
|
|
174
|
-
}, {
|
|
175
|
-
readonly method: "GET";
|
|
176
|
-
readonly path: "/v1/communities";
|
|
177
|
-
readonly operationId: "listCommunities";
|
|
178
|
-
}, {
|
|
179
|
-
readonly method: "GET";
|
|
180
|
-
readonly path: "/v1/communities/{handle}";
|
|
181
|
-
readonly operationId: "getCommunity";
|
|
182
|
-
}, {
|
|
183
|
-
readonly method: "PATCH";
|
|
184
|
-
readonly path: "/v1/communities/{handle}";
|
|
185
|
-
readonly operationId: "updateCommunityMembership";
|
|
186
|
-
}, {
|
|
187
|
-
readonly method: "POST";
|
|
188
|
-
readonly path: "/v1/communities/{handle}/join";
|
|
189
|
-
readonly operationId: "joinCommunity";
|
|
190
|
-
}, {
|
|
191
|
-
readonly method: "POST";
|
|
192
|
-
readonly path: "/v1/communities/{handle}/leave";
|
|
193
|
-
readonly operationId: "leaveCommunity";
|
|
194
|
-
}, {
|
|
195
|
-
readonly method: "GET";
|
|
196
|
-
readonly path: "/v1/communities/{handle}/members";
|
|
197
|
-
readonly operationId: "listCommunityMembers";
|
|
198
174
|
}, {
|
|
199
175
|
readonly method: "GET";
|
|
200
176
|
readonly path: "/v1/webhook-events";
|
|
@@ -252,5 +228,5 @@ export declare const RELAY_V1_OPERATIONS: readonly [{
|
|
|
252
228
|
readonly path: "/v1/calls/{callId}/end";
|
|
253
229
|
readonly operationId: "endCall";
|
|
254
230
|
}];
|
|
255
|
-
export declare const RELAY_WEBHOOK_EVENT_TYPES: readonly ["message.sent", "message.received", "message.read", "message.delivered", "message.failed", "reaction.added", "reaction.removed", "participant.added", "participant.removed", "chat.created", "chat.group_name_updated", "chat.group_icon_updated", "chat.typing_indicator.started", "chat.typing_indicator.stopped", "contact.added", "contact.removed", "call.created", "call.updated", "call.ended", "payment.succeeded", "payment.canceled", "payment.expired", "location.sharing.started", "location.sharing.stopped"
|
|
231
|
+
export declare const RELAY_WEBHOOK_EVENT_TYPES: readonly ["message.sent", "message.received", "message.read", "message.delivered", "message.failed", "reaction.added", "reaction.removed", "participant.added", "participant.removed", "chat.created", "chat.group_name_updated", "chat.group_icon_updated", "chat.typing_indicator.started", "chat.typing_indicator.stopped", "contact.added", "contact.removed", "call.created", "call.updated", "call.ended", "payment.succeeded", "payment.canceled", "payment.expired", "location.sharing.started", "location.sharing.stopped"];
|
|
256
232
|
//# sourceMappingURL=operations.d.ts.map
|
package/dist/operations.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../src/operations.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;IAC7D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,eAAO,MAAM,mBAAmB
|
|
1
|
+
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../src/operations.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;IAC7D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyRgB,CAAC;AAEjD,eAAO,MAAM,yBAAyB,sgBAyB5B,CAAC"}
|
package/dist/operations.js
CHANGED
|
@@ -9,11 +9,6 @@ export const RELAY_V1_OPERATIONS = [
|
|
|
9
9
|
"path": "/v1/me",
|
|
10
10
|
"operationId": "getMe"
|
|
11
11
|
},
|
|
12
|
-
{
|
|
13
|
-
"method": "PATCH",
|
|
14
|
-
"path": "/v1/me",
|
|
15
|
-
"operationId": "updateAgentMe"
|
|
16
|
-
},
|
|
17
12
|
{
|
|
18
13
|
"method": "POST",
|
|
19
14
|
"path": "/v1/chats",
|
|
@@ -179,65 +174,40 @@ export const RELAY_V1_OPERATIONS = [
|
|
|
179
174
|
"path": "/v1/blocked_handles",
|
|
180
175
|
"operationId": "unblockHandle"
|
|
181
176
|
},
|
|
182
|
-
{
|
|
183
|
-
"method": "GET",
|
|
184
|
-
"path": "/v1/tasks",
|
|
185
|
-
"operationId": "listTasks"
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
"method": "POST",
|
|
189
|
-
"path": "/v1/tasks/{taskId}/status",
|
|
190
|
-
"operationId": "updateTaskStatus"
|
|
191
|
-
},
|
|
192
|
-
{
|
|
193
|
-
"method": "POST",
|
|
194
|
-
"path": "/v1/tasks/{taskId}/artifacts",
|
|
195
|
-
"operationId": "addTaskArtifact"
|
|
196
|
-
},
|
|
197
177
|
{
|
|
198
178
|
"method": "GET",
|
|
199
179
|
"path": "/v1/access",
|
|
200
180
|
"operationId": "listAgentAccess"
|
|
201
181
|
},
|
|
202
|
-
{
|
|
203
|
-
"method": "PUT",
|
|
204
|
-
"path": "/v1/access/{handle}",
|
|
205
|
-
"operationId": "setAgentAccess"
|
|
206
|
-
},
|
|
207
|
-
{
|
|
208
|
-
"method": "DELETE",
|
|
209
|
-
"path": "/v1/access/{handle}",
|
|
210
|
-
"operationId": "removeAgentAccess"
|
|
211
|
-
},
|
|
212
182
|
{
|
|
213
183
|
"method": "GET",
|
|
214
|
-
"path": "/v1/
|
|
215
|
-
"operationId": "
|
|
184
|
+
"path": "/v1/oauth2_client",
|
|
185
|
+
"operationId": "getOAuth2Client"
|
|
216
186
|
},
|
|
217
187
|
{
|
|
218
|
-
"method": "
|
|
219
|
-
"path": "/v1/
|
|
220
|
-
"operationId": "
|
|
188
|
+
"method": "POST",
|
|
189
|
+
"path": "/v1/oauth2_client",
|
|
190
|
+
"operationId": "createOAuth2Client"
|
|
221
191
|
},
|
|
222
192
|
{
|
|
223
193
|
"method": "PATCH",
|
|
224
|
-
"path": "/v1/
|
|
225
|
-
"operationId": "
|
|
194
|
+
"path": "/v1/oauth2_client",
|
|
195
|
+
"operationId": "updateOAuth2Client"
|
|
226
196
|
},
|
|
227
197
|
{
|
|
228
198
|
"method": "POST",
|
|
229
|
-
"path": "/v1/
|
|
230
|
-
"operationId": "
|
|
199
|
+
"path": "/v1/oauth2_client/reset_secret",
|
|
200
|
+
"operationId": "resetOAuth2ClientSecret"
|
|
231
201
|
},
|
|
232
202
|
{
|
|
233
|
-
"method": "
|
|
234
|
-
"path": "/v1/
|
|
235
|
-
"operationId": "
|
|
203
|
+
"method": "PUT",
|
|
204
|
+
"path": "/v1/access/{handle}",
|
|
205
|
+
"operationId": "setAgentAccess"
|
|
236
206
|
},
|
|
237
207
|
{
|
|
238
|
-
"method": "
|
|
239
|
-
"path": "/v1/
|
|
240
|
-
"operationId": "
|
|
208
|
+
"method": "DELETE",
|
|
209
|
+
"path": "/v1/access/{handle}",
|
|
210
|
+
"operationId": "removeAgentAccess"
|
|
241
211
|
},
|
|
242
212
|
{
|
|
243
213
|
"method": "GET",
|
|
@@ -335,9 +305,5 @@ export const RELAY_WEBHOOK_EVENT_TYPES = [
|
|
|
335
305
|
"payment.expired",
|
|
336
306
|
"location.sharing.started",
|
|
337
307
|
"location.sharing.stopped",
|
|
338
|
-
"task.created",
|
|
339
|
-
"task.message",
|
|
340
|
-
"task.canceled",
|
|
341
|
-
"task.updated",
|
|
342
308
|
];
|
|
343
309
|
//# sourceMappingURL=operations.js.map
|
package/dist/operations.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations.js","sourceRoot":"","sources":["../src/operations.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC;QACE,QAAQ,EAAE,QAAQ;QAClB,MAAM,EAAE,qBAAqB;QAC7B,aAAa,EAAE,aAAa;KAC7B;IACD;QACE,QAAQ,EAAE,KAAK;QACf,MAAM,EAAE,QAAQ;QAChB,aAAa,EAAE,OAAO;KACvB;IACD;QACE,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"operations.js","sourceRoot":"","sources":["../src/operations.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC;QACE,QAAQ,EAAE,QAAQ;QAClB,MAAM,EAAE,qBAAqB;QAC7B,aAAa,EAAE,aAAa;KAC7B;IACD;QACE,QAAQ,EAAE,KAAK;QACf,MAAM,EAAE,QAAQ;QAChB,aAAa,EAAE,OAAO;KACvB;IACD;QACE,QAAQ,EAAE,MAAM;QAChB,MAAM,EAAE,WAAW;QACnB,aAAa,EAAE,YAAY;KAC5B;IACD;QACE,QAAQ,EAAE,KAAK;QACf,MAAM,EAAE,WAAW;QACnB,aAAa,EAAE,WAAW;KAC3B;IACD;QACE,QAAQ,EAAE,KAAK;QACf,MAAM,EAAE,oBAAoB;QAC5B,aAAa,EAAE,SAAS;KACzB;IACD;QACE,QAAQ,EAAE,KAAK;QACf,MAAM,EAAE,oBAAoB;QAC5B,aAAa,EAAE,YAAY;KAC5B;IACD;QACE,QAAQ,EAAE,MAAM;QAChB,MAAM,EAAE,iCAAiC;QACzC,aAAa,EAAE,gBAAgB;KAChC;IACD;QACE,QAAQ,EAAE,QAAQ;QAClB,MAAM,EAAE,iCAAiC;QACzC,aAAa,EAAE,mBAAmB;KACnC;I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MAAM;QAChB,MAAM,EAAE,kBAAkB;QAC1B,aAAa,EAAE,kBAAkB;KAClC;IACD;QACE,QAAQ,EAAE,OAAO;QACjB,MAAM,EAAE,kBAAkB;QAC1B,aAAa,EAAE,mBAAmB;KACnC;IACD;QACE,QAAQ,EAAE,MAAM;QAChB,MAAM,EAAE,0BAA0B;QAClC,aAAa,EAAE,YAAY;KAC5B;IACD;QACE,QAAQ,EAAE,KAAK;QACf,MAAM,EAAE,0BAA0B;QAClC,aAAa,EAAE,WAAW;KAC3B;IACD;QACE,QAAQ,EAAE,KAAK;QACf,MAAM,EAAE,oBAAoB;QAC5B,aAAa,EAAE,SAAS;KACzB;IACD;QACE,QAAQ,EAAE,MAAM;QAChB,MAAM,EAAE,wBAAwB;QAChC,aAAa,EAAE,SAAS;KACzB;CAC6C,CAAC;AAEjD,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,cAAc;IACd,kBAAkB;IAClB,cAAc;IACd,mBAAmB;IACnB,gBAAgB;IAChB,gBAAgB;IAChB,kBAAkB;IAClB,mBAAmB;IACnB,qBAAqB;IACrB,cAAc;IACd,yBAAyB;IACzB,yBAAyB;IACzB,+BAA+B;IAC/B,+BAA+B;IAC/B,eAAe;IACf,iBAAiB;IACjB,cAAc;IACd,cAAc;IACd,YAAY;IACZ,mBAAmB;IACnB,kBAAkB;IAClB,iBAAiB;IACjB,0BAA0B;IAC1B,0BAA0B;CAClB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { MessagePartResponse, ReplyTo } from "./types.js";
|
|
2
|
+
/** Rich card and carousel limits, the server's (Relay-Server `rich-cards.ts`). */
|
|
3
|
+
export declare const RICH_CARD_TITLE_MAX_LENGTH = 200;
|
|
4
|
+
export declare const RICH_CARD_DESCRIPTION_MAX_LENGTH = 2000;
|
|
5
|
+
export declare const RICH_CARD_MAX_SUGGESTIONS = 4;
|
|
6
|
+
export declare const SUGGESTION_LABEL_MAX_LENGTH = 25;
|
|
7
|
+
export declare const SUGGESTION_ID_MAX_LENGTH = 256;
|
|
8
|
+
export declare const CAROUSEL_MIN_CARDS = 2;
|
|
9
|
+
export declare const CAROUSEL_MAX_CARDS = 10;
|
|
10
|
+
/** The reply suggestion a person tapped: its id, its label, and the card part it answers. */
|
|
11
|
+
export interface SuggestionReply {
|
|
12
|
+
id: string;
|
|
13
|
+
label: string;
|
|
14
|
+
reply_to: ReplyTo & {
|
|
15
|
+
part_index: number;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Read a card reply from a received Message's parts and reply_to. Dispatch on
|
|
20
|
+
* `id`, never on the visible label.
|
|
21
|
+
*/
|
|
22
|
+
export declare const suggestionReply: (parts: readonly MessagePartResponse[], replyTo?: ReplyTo | null) => SuggestionReply | undefined;
|
|
23
|
+
//# sourceMappingURL=rich-cards.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rich-cards.d.ts","sourceRoot":"","sources":["../src/rich-cards.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE/D,kFAAkF;AAClF,eAAO,MAAM,0BAA0B,MAAM,CAAC;AAC9C,eAAO,MAAM,gCAAgC,OAAQ,CAAC;AACtD,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAC3C,eAAO,MAAM,2BAA2B,KAAK,CAAC;AAC9C,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAC5C,eAAO,MAAM,kBAAkB,IAAI,CAAC;AACpC,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAErC,6FAA6F;AAC7F,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,GAAG;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;CAC5C;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,GAC1B,OAAO,SAAS,mBAAmB,EAAE,EACrC,UAAU,OAAO,GAAG,IAAI,KACvB,eAAe,GAAG,SASpB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** Rich card and carousel limits, the server's (Relay-Server `rich-cards.ts`). */
|
|
2
|
+
export const RICH_CARD_TITLE_MAX_LENGTH = 200;
|
|
3
|
+
export const RICH_CARD_DESCRIPTION_MAX_LENGTH = 2_000;
|
|
4
|
+
export const RICH_CARD_MAX_SUGGESTIONS = 4;
|
|
5
|
+
export const SUGGESTION_LABEL_MAX_LENGTH = 25;
|
|
6
|
+
export const SUGGESTION_ID_MAX_LENGTH = 256;
|
|
7
|
+
export const CAROUSEL_MIN_CARDS = 2;
|
|
8
|
+
export const CAROUSEL_MAX_CARDS = 10;
|
|
9
|
+
/**
|
|
10
|
+
* Read a card reply from a received Message's parts and reply_to. Dispatch on
|
|
11
|
+
* `id`, never on the visible label.
|
|
12
|
+
*/
|
|
13
|
+
export const suggestionReply = (parts, replyTo) => {
|
|
14
|
+
const response = parts.find((part) => part.type === "suggestion_response");
|
|
15
|
+
if (!response || !replyTo?.message_id || !Number.isInteger(replyTo.part_index)
|
|
16
|
+
|| replyTo.part_index < 0)
|
|
17
|
+
return undefined;
|
|
18
|
+
return {
|
|
19
|
+
id: response.id,
|
|
20
|
+
label: response.label,
|
|
21
|
+
reply_to: { message_id: replyTo.message_id, part_index: replyTo.part_index },
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=rich-cards.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rich-cards.js","sourceRoot":"","sources":["../src/rich-cards.ts"],"names":[],"mappings":"AAEA,kFAAkF;AAClF,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAG,CAAC;AAC9C,MAAM,CAAC,MAAM,gCAAgC,GAAG,KAAK,CAAC;AACtD,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC;AAC3C,MAAM,CAAC,MAAM,2BAA2B,GAAG,EAAE,CAAC;AAC9C,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,CAAC;AAC5C,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC;AACpC,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAC;AASrC;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,KAAqC,EACrC,OAAwB,EACK,EAAE;IAC/B,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,qBAAqB,CAAC,CAAC;IAC3E,IAAI,CAAC,QAAQ,IAAI,CAAC,OAAO,EAAE,UAAU,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC;WACzE,OAAO,CAAC,UAAW,GAAG,CAAC;QAAE,OAAO,SAAS,CAAC;IAC/C,OAAO;QACL,EAAE,EAAE,QAAQ,CAAC,EAAE;QACf,KAAK,EAAE,QAAQ,CAAC,KAAK;QACrB,QAAQ,EAAE,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,CAAC,UAAW,EAAE;KAC9E,CAAC;AACJ,CAAC,CAAC"}
|