@myronsi/messenger-api 2.1.0-alpha.2 → 2.1.0-alpha.3.next.67

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/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  Contract changes only. The backend changelog is `CHANGELOG.md` in the repository root. Rules: `docs/api-compatibility.md`.
4
4
 
5
+ ## 2.1.0-alpha.3
6
+
7
+ - Adds `GET /notifications/avatar/{token}` and `POST /notifications/read/{token}` without a session, for the
8
+ sender photo and the "Mark as read" action of a web push. Both answer `404` for a forged, expired or ended token.
9
+ - Web push payloads add `preview`, `read_token` and, with previews on, `sender_id` and `avatar_token`. Tokens are bound to the push
10
+ device and its session.
11
+
5
12
  ## 2.1.0-alpha.2
6
13
 
7
14
  - Adds notification preferences, session-bound push device registration and per-tab activity leases.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- /* Generated from api/openapi.yaml 2.1.0-alpha.2. Do not edit. */
2
- export declare const API_VERSION: "2.1.0-alpha.2";
1
+ /* Generated from api/openapi.yaml 2.1.0-alpha.3. Do not edit. */
2
+ export declare const API_VERSION: "2.1.0-alpha.3";
3
3
  export type { paths, components, operations } from "./schema.js";
4
4
  export * from "./ws-events.js";
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- export const API_VERSION = "2.1.0-alpha.2";
1
+ export const API_VERSION = "2.1.0-alpha.3";
package/dist/openapi.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  openapi: 3.1.0
2
2
  info:
3
3
  title: Messenger API
4
- version: 2.1.0-alpha.2
4
+ version: 2.1.0-alpha.3
5
5
  summary: REST contract of the Messenger backend (v2).
6
6
  description: |
7
7
  Contract for the Go backend. The WebSocket protocol is described in `websocket/` and
@@ -1758,6 +1758,58 @@ paths:
1758
1758
  $ref: "#/components/responses/NotFound"
1759
1759
  "409":
1760
1760
  $ref: "#/components/responses/Conflict"
1761
+ /notifications/avatar/{token}:
1762
+ parameters:
1763
+ - name: token
1764
+ in: path
1765
+ required: true
1766
+ description: "`avatar_token` of a push notification."
1767
+ schema: { type: string, maxLength: 256 }
1768
+ get:
1769
+ tags: [me]
1770
+ operationId: getNotificationAvatar
1771
+ summary: Sender avatar for a push notification
1772
+ description: |
1773
+ For the service worker, which has no session: the token in the push payload names the recipient
1774
+ and the sender and expires after an hour. Follows the sender's avatar visibility for the recipient.
1775
+ security: []
1776
+ responses:
1777
+ "200":
1778
+ description: Image
1779
+ content:
1780
+ image/*:
1781
+ schema: { type: string, format: binary }
1782
+ "206":
1783
+ description: The requested byte range (`Range` header)
1784
+ content:
1785
+ image/*:
1786
+ schema: { type: string, format: binary }
1787
+ "302":
1788
+ description: Redirect to a short-lived signed storage URL (with `MEDIA_SIGNED_URLS`)
1789
+ "304":
1790
+ description: Not modified (`If-None-Match` with the `ETag` of an earlier answer)
1791
+ "416":
1792
+ description: The requested range is outside the file
1793
+ "404": { $ref: "#/components/responses/NotFound" }
1794
+ /notifications/read/{token}:
1795
+ parameters:
1796
+ - name: token
1797
+ in: path
1798
+ required: true
1799
+ description: "`read_token` of a push notification."
1800
+ schema: { type: string, maxLength: 256 }
1801
+ post:
1802
+ tags: [me]
1803
+ operationId: markNotificationRead
1804
+ summary: Mark a chat read from a push notification
1805
+ description: |
1806
+ For the notification's "Mark as read" action: marks the chat read up to the notified message for
1807
+ the recipient the token names. The token expires after seven days.
1808
+ security: []
1809
+ responses:
1810
+ "204":
1811
+ description: Marked as read
1812
+ "404": { $ref: "#/components/responses/NotFound" }
1761
1813
  /me/notification-devices:
1762
1814
  post:
1763
1815
  tags:
package/dist/schema.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- /* Generated from api/openapi.yaml 2.1.0-alpha.2. Do not edit. */
1
+ /* Generated from api/openapi.yaml 2.1.0-alpha.3. Do not edit. */
2
2
  export interface paths {
3
3
  "/meta": {
4
4
  parameters: {
@@ -1358,6 +1358,54 @@ export interface paths {
1358
1358
  patch?: never;
1359
1359
  trace?: never;
1360
1360
  };
1361
+ "/notifications/avatar/{token}": {
1362
+ parameters: {
1363
+ query?: never;
1364
+ header?: never;
1365
+ path: {
1366
+ /** @description `avatar_token` of a push notification. */
1367
+ token: string;
1368
+ };
1369
+ cookie?: never;
1370
+ };
1371
+ /**
1372
+ * Sender avatar for a push notification
1373
+ * @description For the service worker, which has no session: the token in the push payload names the recipient
1374
+ * and the sender and expires after an hour. Follows the sender's avatar visibility for the recipient.
1375
+ */
1376
+ get: operations["getNotificationAvatar"];
1377
+ put?: never;
1378
+ post?: never;
1379
+ delete?: never;
1380
+ options?: never;
1381
+ head?: never;
1382
+ patch?: never;
1383
+ trace?: never;
1384
+ };
1385
+ "/notifications/read/{token}": {
1386
+ parameters: {
1387
+ query?: never;
1388
+ header?: never;
1389
+ path: {
1390
+ /** @description `read_token` of a push notification. */
1391
+ token: string;
1392
+ };
1393
+ cookie?: never;
1394
+ };
1395
+ get?: never;
1396
+ put?: never;
1397
+ /**
1398
+ * Mark a chat read from a push notification
1399
+ * @description For the notification's "Mark as read" action: marks the chat read up to the notified message for
1400
+ * the recipient the token names. The token expires after seven days.
1401
+ */
1402
+ post: operations["markNotificationRead"];
1403
+ delete?: never;
1404
+ options?: never;
1405
+ head?: never;
1406
+ patch?: never;
1407
+ trace?: never;
1408
+ };
1361
1409
  "/me/notification-devices": {
1362
1410
  parameters: {
1363
1411
  query?: never;
@@ -4490,6 +4538,82 @@ export interface operations {
4490
4538
  409: components["responses"]["Conflict"];
4491
4539
  };
4492
4540
  };
4541
+ getNotificationAvatar: {
4542
+ parameters: {
4543
+ query?: never;
4544
+ header?: never;
4545
+ path: {
4546
+ /** @description `avatar_token` of a push notification. */
4547
+ token: string;
4548
+ };
4549
+ cookie?: never;
4550
+ };
4551
+ requestBody?: never;
4552
+ responses: {
4553
+ /** @description Image */
4554
+ 200: {
4555
+ headers: {
4556
+ [name: string]: unknown;
4557
+ };
4558
+ content: {
4559
+ "image/*": string;
4560
+ };
4561
+ };
4562
+ /** @description The requested byte range (`Range` header) */
4563
+ 206: {
4564
+ headers: {
4565
+ [name: string]: unknown;
4566
+ };
4567
+ content: {
4568
+ "image/*": string;
4569
+ };
4570
+ };
4571
+ /** @description Redirect to a short-lived signed storage URL (with `MEDIA_SIGNED_URLS`) */
4572
+ 302: {
4573
+ headers: {
4574
+ [name: string]: unknown;
4575
+ };
4576
+ content?: never;
4577
+ };
4578
+ /** @description Not modified (`If-None-Match` with the `ETag` of an earlier answer) */
4579
+ 304: {
4580
+ headers: {
4581
+ [name: string]: unknown;
4582
+ };
4583
+ content?: never;
4584
+ };
4585
+ 404: components["responses"]["NotFound"];
4586
+ /** @description The requested range is outside the file */
4587
+ 416: {
4588
+ headers: {
4589
+ [name: string]: unknown;
4590
+ };
4591
+ content?: never;
4592
+ };
4593
+ };
4594
+ };
4595
+ markNotificationRead: {
4596
+ parameters: {
4597
+ query?: never;
4598
+ header?: never;
4599
+ path: {
4600
+ /** @description `read_token` of a push notification. */
4601
+ token: string;
4602
+ };
4603
+ cookie?: never;
4604
+ };
4605
+ requestBody?: never;
4606
+ responses: {
4607
+ /** @description Marked as read */
4608
+ 204: {
4609
+ headers: {
4610
+ [name: string]: unknown;
4611
+ };
4612
+ content?: never;
4613
+ };
4614
+ 404: components["responses"]["NotFound"];
4615
+ };
4616
+ };
4493
4617
  registerNotificationDevice: {
4494
4618
  parameters: {
4495
4619
  query?: never;
@@ -1,4 +1,4 @@
1
- /* Generated from api/openapi.yaml 2.1.0-alpha.2. Do not edit. */
1
+ /* Generated from api/openapi.yaml 2.1.0-alpha.3. Do not edit. */
2
2
 
3
3
  /**
4
4
  * Any WebSocket event, in either direction.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myronsi/messenger-api",
3
- "version": "2.1.0-alpha.2",
3
+ "version": "2.1.0-alpha.3.next.67",
4
4
  "description": "API contract of the Messenger backend: OpenAPI document, WebSocket event schemas and generated TypeScript types",
5
5
  "license": "MIT",
6
6
  "repository": {