@flipstream/sdk 0.18.0 → 0.19.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/docs/admin.md CHANGED
@@ -23,7 +23,7 @@ section's basics, and its most common example, are in the package's README under
23
23
  - Every role reads the same access, a viewer limited to some workspaces and Flipstream's own
24
24
  staff included.
25
25
  - **`user`** is
26
- `{ id, email, first_name, last_name, role, roles, unknown_roles, active, workspace_ids, created_on, created_by_id }`:
26
+ `{ id, email, first_name, last_name, role, roles, unknown_roles, active, workspace_ids, created_on, created_by_id, photo }`:
27
27
  a `Member`, as `flipstream.members` answers each person (see "Your organisation's members").
28
28
  - `me()` reads the token's own person and doesn't apply `members`' people-only rule. An API key's
29
29
  token isn't tested with it yet: service accounts come with pulse-admin#93. Every call under one
@@ -58,13 +58,35 @@ section's basics, and its most common example, are in the package's README under
58
58
  - `profile.privacy()` reads on every client. The answer is `{ version, accepted_on }`, and
59
59
  `version` is null when none is accepted. `accepted_on` is that entry's date as a UTC instant
60
60
  with `Z` and milliseconds, or null when `version` is null, or when it is missing or not a
61
- date and time. It reads `GET /users/{id}/profile?refresh=true`. A later
61
+ date and time. A date alone, such as `2025-01-01`, reads as null. It reads `GET /users/{id}/profile?refresh=true`. A later
62
62
  `accepted: false` is not read as a withdrawal. Meta that is not a JSON object is `invalid`.
63
63
  A 404 stays `not_found`.
64
64
  - `profile.setName({ first_name, last_name })` and `profile.acceptPrivacy({ version })` write
65
65
  only on the client the first-party session makes (`session.flipstream`). On every other client
66
66
  they answer `needs_person`, with `why`, and send nothing. No `url` is named: the page's address
67
67
  needs your organisation's short name, and that would be a read.
68
+ - `profile.setPhoto(file)` writes only on that same client. `file` is a `File` or `Blob`. A
69
+ zero-byte file is `refused` (`empty`, `fields: ['file']`) before the type is considered. A
70
+ type other than png, jpeg, gif or webp is `refused` (`type`); `image/jpg` and a blank type
71
+ are that. Over 5 MiB is `refused` (`too_large`); exactly 5 MiB is sent. Those three read
72
+ `size` and `type` once, before the bytes and before any request. The bytes are read next,
73
+ still before any request (#598, SDK-D2071). A read that throws, or that is not an
74
+ ArrayBuffer, is `refused` (`unreadable`). A byte length of 0 is `empty`, and one over 5 MiB
75
+ is `too_large`, even when `size` said otherwise. On the first-party session's client, anything
76
+ that is not a file rejects with a `TypeError` and sends nothing. On every other client,
77
+ `needs_person` comes first. The post is `POST /users/{sub}/upload-file` with
78
+ `{ data, file_type: 'image' }`, `data` a data URL, and there is no user GET first. The file
79
+ is read inside the call's one deadline, with userinfo and the upload, 30 s by default. For a
80
+ large photo on a slow connection pass `deadlineMs` (for example 120000). A `timeout` leaves
81
+ the outcome unknown: it may come before anything was sent, or after the upload went out, when
82
+ the photo may be saved and the old one deleted. Either way the next `me()` shows what the
83
+ server holds.
84
+ `ok` is `{ link }`, the https link by `photo`'s rule. Another
85
+ user, or no usable link, is `invalid`. A 5xx is `unavailable`. A 413 stays `rejected` with
86
+ status 413. Every answer except `needs_person` and `refused` drops that scope's shared reads.
87
+ The server deletes the previous photo after the upload, so another tab, or another person
88
+ page, still showing the old link shows a broken image until its next read of `me()` or
89
+ `members`.
68
90
  - A blank name, or a blank version, is `refused` (`empty`), naming the fields, and nothing is
69
91
  sent. `setName` answers only `saved`. The name write reads `GET /users/{sub}?refresh=true`
70
92
  fresh, not the scope's shared read, and sets `email`, `first_name` and `last_name`, with that
@@ -85,7 +107,7 @@ section's basics, and its most common example, are in the package's README under
85
107
  ## Your organisation's members
86
108
 
87
109
  - **A member** is
88
- `{ id, email, first_name, last_name, role, roles, unknown_roles, active, workspace_ids, created_on, created_by_id }`,
110
+ `{ id, email, first_name, last_name, role, roles, unknown_roles, active, workspace_ids, created_on, created_by_id, photo }`,
89
111
  and nothing else, with `role`, `roles`, `unknown_roles` and `workspace_ids` by `me()`'s rules (see
90
112
  "Who you are"): the highest role they hold, or `null` for none and for Flipstream's own staff,
91
113
  then every role of ours they hold, highest first, and a count of the rest. A role this version
@@ -95,6 +117,11 @@ section's basics, and its most common example, are in the package's README under
95
117
  or when they accepted if accepting did. It's `null` when the service holds none, or one that
96
118
  isn't a time: unlike a dataset's, it never fails the answer.
97
119
  - `created_by_id` is the person who made their account, `null` when the service holds none.
120
+ - `photo` is the https link of their profile photo, never the storage id. It is `null` when they
121
+ have none, when the link does not start with `https://`, or when it does not parse as a URL
122
+ (`https:`, `https:foo`, `https://` with no host, `http:` and `javascript:` included). It never
123
+ fails the person. `me().user`, `members.list` and
124
+ `members.get` all carry it.
98
125
  - `flipstream.members.get({ member_id: created_by_id })` names the maker. When it doesn't answer
99
126
  ok (see below), show the maker as unknown, for example for Flipstream's staff or an account
100
127
  made by another organisation. The SDK doesn't guess which: a `not_found` may also be someone
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flipstream/sdk",
3
- "version": "0.18.0",
3
+ "version": "0.19.0",
4
4
  "description": "TypeScript SDK for the Flipstream APIs: typed requests and checked answers, in Node and in browsers.",
5
5
  "keywords": [
6
6
  "flipstream",