@flipstream/sdk 0.14.0 → 0.16.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.
Files changed (225) hide show
  1. package/CHANGELOG.md +125 -0
  2. package/README.md +95 -1
  3. package/dist/api/datasets.js +8 -8
  4. package/dist/api/datasets.js.map +1 -1
  5. package/dist/api/log.js +6 -10
  6. package/dist/api/log.js.map +1 -1
  7. package/dist/api/pathArgument.d.ts +7 -0
  8. package/dist/api/pathArgument.js +12 -0
  9. package/dist/api/pathArgument.js.map +1 -0
  10. package/dist/auth/transport.d.ts +6 -2
  11. package/dist/auth/transport.js +5 -3
  12. package/dist/auth/transport.js.map +1 -1
  13. package/dist/core/call.d.ts +4 -0
  14. package/dist/core/call.js +7 -1
  15. package/dist/core/call.js.map +1 -1
  16. package/dist/core/fetch.d.ts +20 -1
  17. package/dist/core/fetch.js +50 -3
  18. package/dist/core/fetch.js.map +1 -1
  19. package/dist/core/hosts.d.ts +11 -0
  20. package/dist/core/hosts.js +13 -0
  21. package/dist/core/hosts.js.map +1 -0
  22. package/dist/core/identify.d.ts +6 -2
  23. package/dist/core/identify.js +16 -12
  24. package/dist/core/identify.js.map +1 -1
  25. package/dist/core/result.d.ts +1 -1
  26. package/dist/core/shared.d.ts +2 -0
  27. package/dist/core/shared.js +1 -0
  28. package/dist/core/shared.js.map +1 -1
  29. package/dist/core/signal.d.ts +7 -0
  30. package/dist/core/signal.js +9 -0
  31. package/dist/core/signal.js.map +1 -1
  32. package/dist/first-party/asPerson.d.ts +13 -0
  33. package/dist/first-party/asPerson.js +144 -0
  34. package/dist/first-party/asPerson.js.map +1 -0
  35. package/dist/first-party/attempts.d.ts +71 -0
  36. package/dist/first-party/attempts.js +132 -0
  37. package/dist/first-party/attempts.js.map +1 -0
  38. package/dist/first-party/authProxyMark.d.ts +10 -0
  39. package/dist/first-party/authProxyMark.js +11 -0
  40. package/dist/first-party/authProxyMark.js.map +1 -0
  41. package/dist/first-party/browser.d.ts +55 -0
  42. package/dist/first-party/browser.js +137 -0
  43. package/dist/first-party/browser.js.map +1 -0
  44. package/dist/first-party/browserSession.d.ts +95 -0
  45. package/dist/first-party/browserSession.js +242 -0
  46. package/dist/first-party/browserSession.js.map +1 -0
  47. package/dist/first-party/calls/consent.d.ts +89 -0
  48. package/dist/first-party/calls/consent.js +174 -0
  49. package/dist/first-party/calls/consent.js.map +1 -0
  50. package/dist/first-party/calls/device.d.ts +97 -0
  51. package/dist/first-party/calls/device.js +133 -0
  52. package/dist/first-party/calls/device.js.map +1 -0
  53. package/dist/first-party/calls/invitation.d.ts +244 -0
  54. package/dist/first-party/calls/invitation.js +258 -0
  55. package/dist/first-party/calls/invitation.js.map +1 -0
  56. package/dist/first-party/calls/logIn.d.ts +61 -0
  57. package/dist/first-party/calls/logIn.js +48 -0
  58. package/dist/first-party/calls/logIn.js.map +1 -0
  59. package/dist/first-party/calls/reset.d.ts +61 -0
  60. package/dist/first-party/calls/reset.js +163 -0
  61. package/dist/first-party/calls/reset.js.map +1 -0
  62. package/dist/first-party/calls/signUp.d.ts +21 -0
  63. package/dist/first-party/calls/signUp.js +72 -0
  64. package/dist/first-party/calls/signUp.js.map +1 -0
  65. package/dist/first-party/calls/twoStepSetup.d.ts +78 -0
  66. package/dist/first-party/calls/twoStepSetup.js +168 -0
  67. package/dist/first-party/calls/twoStepSetup.js.map +1 -0
  68. package/dist/first-party/claims.d.ts +88 -0
  69. package/dist/first-party/claims.js +181 -0
  70. package/dist/first-party/claims.js.map +1 -0
  71. package/dist/first-party/enrollment.d.ts +10 -0
  72. package/dist/first-party/enrollment.js +44 -0
  73. package/dist/first-party/enrollment.js.map +1 -0
  74. package/dist/first-party/entry.d.ts +573 -0
  75. package/dist/first-party/entry.js +582 -0
  76. package/dist/first-party/entry.js.map +1 -0
  77. package/dist/first-party/hooks.d.ts +81 -0
  78. package/dist/first-party/hooks.js +19 -0
  79. package/dist/first-party/hooks.js.map +1 -0
  80. package/dist/first-party/http.d.ts +191 -0
  81. package/dist/first-party/http.js +364 -0
  82. package/dist/first-party/http.js.map +1 -0
  83. package/dist/first-party/index.d.ts +14 -0
  84. package/dist/first-party/index.js +3 -0
  85. package/dist/first-party/index.js.map +1 -0
  86. package/dist/first-party/landed.d.ts +32 -0
  87. package/dist/first-party/landed.js +50 -0
  88. package/dist/first-party/landed.js.map +1 -0
  89. package/dist/first-party/landedProof.d.ts +12 -0
  90. package/dist/first-party/landedProof.js +20 -0
  91. package/dist/first-party/landedProof.js.map +1 -0
  92. package/dist/first-party/linkToken.d.ts +15 -0
  93. package/dist/first-party/linkToken.js +28 -0
  94. package/dist/first-party/linkToken.js.map +1 -0
  95. package/dist/first-party/links.d.ts +100 -0
  96. package/dist/first-party/links.js +84 -0
  97. package/dist/first-party/links.js.map +1 -0
  98. package/dist/first-party/locks.d.ts +36 -0
  99. package/dist/first-party/locks.js +64 -0
  100. package/dist/first-party/locks.js.map +1 -0
  101. package/dist/first-party/personTransport.d.ts +38 -0
  102. package/dist/first-party/personTransport.js +177 -0
  103. package/dist/first-party/personTransport.js.map +1 -0
  104. package/dist/first-party/proxy/app.d.ts +32 -0
  105. package/dist/first-party/proxy/app.js +94 -0
  106. package/dist/first-party/proxy/app.js.map +1 -0
  107. package/dist/first-party/proxy/bound.d.ts +5 -0
  108. package/dist/first-party/proxy/bound.js +13 -0
  109. package/dist/first-party/proxy/bound.js.map +1 -0
  110. package/dist/first-party/proxy/cases.d.ts +71 -0
  111. package/dist/first-party/proxy/cases.js +411 -0
  112. package/dist/first-party/proxy/cases.js.map +1 -0
  113. package/dist/first-party/proxy/decide.d.ts +31 -0
  114. package/dist/first-party/proxy/decide.js +139 -0
  115. package/dist/first-party/proxy/decide.js.map +1 -0
  116. package/dist/first-party/proxy/freeze.d.ts +2 -0
  117. package/dist/first-party/proxy/freeze.js +10 -0
  118. package/dist/first-party/proxy/freeze.js.map +1 -0
  119. package/dist/first-party/proxy/handler.d.ts +23 -0
  120. package/dist/first-party/proxy/handler.js +190 -0
  121. package/dist/first-party/proxy/handler.js.map +1 -0
  122. package/dist/first-party/proxy/headers.d.ts +7 -0
  123. package/dist/first-party/proxy/headers.js +20 -0
  124. package/dist/first-party/proxy/headers.js.map +1 -0
  125. package/dist/first-party/proxy/hop.d.ts +9 -0
  126. package/dist/first-party/proxy/hop.js +37 -0
  127. package/dist/first-party/proxy/hop.js.map +1 -0
  128. package/dist/first-party/proxy/host.d.ts +5 -0
  129. package/dist/first-party/proxy/host.js +11 -0
  130. package/dist/first-party/proxy/host.js.map +1 -0
  131. package/dist/first-party/proxy/index.d.ts +7 -0
  132. package/dist/first-party/proxy/index.js +6 -0
  133. package/dist/first-party/proxy/index.js.map +1 -0
  134. package/dist/first-party/proxy/pass-back.d.ts +26 -0
  135. package/dist/first-party/proxy/pass-back.js +47 -0
  136. package/dist/first-party/proxy/pass-back.js.map +1 -0
  137. package/dist/first-party/proxy/paths.d.ts +15 -0
  138. package/dist/first-party/proxy/paths.js +34 -0
  139. package/dist/first-party/proxy/paths.js.map +1 -0
  140. package/dist/first-party/proxy/shown.d.ts +5 -0
  141. package/dist/first-party/proxy/shown.js +16 -0
  142. package/dist/first-party/proxy/shown.js.map +1 -0
  143. package/dist/first-party/proxy/stand-in.d.ts +49 -0
  144. package/dist/first-party/proxy/stand-in.js +341 -0
  145. package/dist/first-party/proxy/stand-in.js.map +1 -0
  146. package/dist/first-party/report.d.ts +56 -0
  147. package/dist/first-party/report.js +38 -0
  148. package/dist/first-party/report.js.map +1 -0
  149. package/dist/first-party/result.d.ts +150 -0
  150. package/dist/first-party/result.js +40 -0
  151. package/dist/first-party/result.js.map +1 -0
  152. package/dist/first-party/session/cell.d.ts +201 -0
  153. package/dist/first-party/session/cell.js +103 -0
  154. package/dist/first-party/session/cell.js.map +1 -0
  155. package/dist/first-party/session/closed.d.ts +11 -0
  156. package/dist/first-party/session/closed.js +15 -0
  157. package/dist/first-party/session/closed.js.map +1 -0
  158. package/dist/first-party/session/index.d.ts +3 -0
  159. package/dist/first-party/session/index.js +3 -0
  160. package/dist/first-party/session/index.js.map +1 -0
  161. package/dist/first-party/session/logout.d.ts +102 -0
  162. package/dist/first-party/session/logout.js +526 -0
  163. package/dist/first-party/session/logout.js.map +1 -0
  164. package/dist/first-party/session/owed.d.ts +105 -0
  165. package/dist/first-party/session/owed.js +128 -0
  166. package/dist/first-party/session/owed.js.map +1 -0
  167. package/dist/first-party/session/refresh.d.ts +19 -0
  168. package/dist/first-party/session/refresh.js +236 -0
  169. package/dist/first-party/session/refresh.js.map +1 -0
  170. package/dist/first-party/session/results.d.ts +38 -0
  171. package/dist/first-party/session/results.js +74 -0
  172. package/dist/first-party/session/results.js.map +1 -0
  173. package/dist/first-party/session/session.d.ts +2 -0
  174. package/dist/first-party/session/session.js +376 -0
  175. package/dist/first-party/session/session.js.map +1 -0
  176. package/dist/first-party/session/shared.d.ts +34 -0
  177. package/dist/first-party/session/shared.js +145 -0
  178. package/dist/first-party/session/shared.js.map +1 -0
  179. package/dist/first-party/session/sharedSignal.d.ts +27 -0
  180. package/dist/first-party/session/sharedSignal.js +55 -0
  181. package/dist/first-party/session/sharedSignal.js.map +1 -0
  182. package/dist/first-party/session/signIn.d.ts +48 -0
  183. package/dist/first-party/session/signIn.js +340 -0
  184. package/dist/first-party/session/signIn.js.map +1 -0
  185. package/dist/first-party/session/signInThrough.d.ts +6 -0
  186. package/dist/first-party/session/signInThrough.js +144 -0
  187. package/dist/first-party/session/signInThrough.js.map +1 -0
  188. package/dist/first-party/session/sync.d.ts +17 -0
  189. package/dist/first-party/session/sync.js +174 -0
  190. package/dist/first-party/session/sync.js.map +1 -0
  191. package/dist/first-party/session/tokens.d.ts +18 -0
  192. package/dist/first-party/session/tokens.js +64 -0
  193. package/dist/first-party/session/tokens.js.map +1 -0
  194. package/dist/first-party/session/types.d.ts +270 -0
  195. package/dist/first-party/session/types.js +3 -0
  196. package/dist/first-party/session/types.js.map +1 -0
  197. package/dist/first-party/sessionWire.d.ts +31 -0
  198. package/dist/first-party/sessionWire.js +91 -0
  199. package/dist/first-party/sessionWire.js.map +1 -0
  200. package/dist/first-party/signInHooks.d.ts +85 -0
  201. package/dist/first-party/signInHooks.js +2 -0
  202. package/dist/first-party/signInHooks.js.map +1 -0
  203. package/dist/first-party/state.d.ts +71 -0
  204. package/dist/first-party/state.js +55 -0
  205. package/dist/first-party/state.js.map +1 -0
  206. package/dist/first-party/strip.d.ts +1 -0
  207. package/dist/first-party/strip.js +8 -0
  208. package/dist/first-party/strip.js.map +1 -0
  209. package/dist/first-party/twoStepLock.d.ts +26 -0
  210. package/dist/first-party/twoStepLock.js +58 -0
  211. package/dist/first-party/twoStepLock.js.map +1 -0
  212. package/dist/first-party/twoStepSession.d.ts +21 -0
  213. package/dist/first-party/twoStepSession.js +31 -0
  214. package/dist/first-party/twoStepSession.js.map +1 -0
  215. package/dist/first-party/wire.d.ts +63 -0
  216. package/dist/first-party/wire.js +5 -0
  217. package/dist/first-party/wire.js.map +1 -0
  218. package/dist/flipstream.d.ts +80 -19
  219. package/dist/flipstream.js +121 -36
  220. package/dist/flipstream.js.map +1 -1
  221. package/dist/node/session.js +3 -1
  222. package/dist/node/session.js.map +1 -1
  223. package/dist/version.gen.js +1 -1
  224. package/docs/first-party.md +300 -0
  225. package/package.json +34 -5
@@ -0,0 +1,526 @@
1
+ import { readState } from '../state.js';
2
+ import { BACKOFF_MS, isKeptFor, owedLogout } from './cell.js';
3
+ import { leaveOwed, revokedOn } from './owed.js';
4
+ import { isNewer } from './shared.js';
5
+ const CONFIRMED = { kind: 'confirmed' };
6
+ const NOT_ASKED = { kind: 'unconfirmed', reason: 'unavailable' };
7
+ const SUPERSEDED = { kind: 'superseded' };
8
+ function toldBy(answer) {
9
+ switch (answer.kind) {
10
+ case 'confirmed':
11
+ return CONFIRMED;
12
+ case 'unconfirmed':
13
+ return { kind: 'unconfirmed', reason: answer.reason };
14
+ case 'broken':
15
+ return { kind: 'unconfirmed', reason: 'invalid' };
16
+ default: {
17
+ const exhaustive = answer;
18
+ return exhaustive;
19
+ }
20
+ }
21
+ }
22
+ const NOT_SENT = { kind: 'not-asked' };
23
+ const WAITING = { kind: 'waiting' };
24
+ /** Whether a call that sees `owed` shares a try that has read `read`. */
25
+ function shares(read, owed) {
26
+ switch (read.kind) {
27
+ case 'waiting':
28
+ return true;
29
+ case 'sends':
30
+ return read.generation === owed;
31
+ case 'nothing-owed':
32
+ return false;
33
+ default: {
34
+ const exhaustive = read;
35
+ return exhaustive;
36
+ }
37
+ }
38
+ }
39
+ /**
40
+ * What a try tells one caller (SDK-D1933, SDK-D2022). `pinnedSerial` is the record's serial as the
41
+ * caller's sign-out landed (`SignedOut`). `superseded` means the record moved on since that
42
+ * sign-out: a sign-in, or rarely a renewal by a tab that hadn't heard of it. That tab's cookie
43
+ * replaced the old one; it sent this logout first when it knew it was owed, and this try isn't
44
+ * told whether pulse-auth confirmed it. No pin (`sync()`, the timer): the try's own answer.
45
+ * - `answered`: `superseded` when the serial moved past the pin. Otherwise the try's own answer,
46
+ * whatever the generation: a second sign-out with no sign-in between ends the same cookie, and
47
+ * since #542 the generation can also go back.
48
+ * - `nothing-owed`: `confirmed` only on the pinned serial, where a confirmed logout cleared this
49
+ * sign-out's flag, so pulse-auth confirmed it to another tab. Any other serial is `superseded`.
50
+ */
51
+ function toldTo(outcome, pinnedSerial) {
52
+ switch (outcome.kind) {
53
+ case 'answered':
54
+ // Greater than, not different: a lost record reads serial 0, and one rebuilt from it starts
55
+ // again below the pin. That is no proof of a sign-in, and the answer is pulse-auth's own to a
56
+ // logout this try sent, so the caller is told it (SDK-D2022, PR 546 round 1).
57
+ return pinnedSerial !== undefined && outcome.serial > pinnedSerial ? SUPERSEDED : toldBy(outcome.answer);
58
+ case 'nothing-owed':
59
+ // Equal, not "not past the pin": nothing owed proves a confirmation only on this sign-out's own
60
+ // record. A lower serial is a record lost and rebuilt by another tab, which confirmed nothing
61
+ // (SDK-D2022, PR 546 round 2).
62
+ return pinnedSerial === undefined || outcome.serial === pinnedSerial ? CONFIRMED : SUPERSEDED;
63
+ case 'not-asked':
64
+ return NOT_ASKED;
65
+ default: {
66
+ const exhaustive = outcome;
67
+ return exhaustive;
68
+ }
69
+ }
70
+ }
71
+ export function createLogout(deps, cell, { shared, withState, withCookie, broadcast }, { release }) {
72
+ const { http, report } = deps;
73
+ const storage = deps.storage;
74
+ const sendLogout = async (generation) => {
75
+ const answer = await http.logout();
76
+ if (answer.kind === 'broken') {
77
+ report({ kind: 'answer', path: '/logout', status: answer.httpStatus });
78
+ }
79
+ if (answer.kind === 'confirmed') {
80
+ // Sent under the cookie lock, so it revoked whatever cookie any sign-in left before it:
81
+ // the slot's included, whatever generation an object counted for it.
82
+ if (deps.owed !== null)
83
+ deps.owed.left = null;
84
+ const cleared = await withState((state) => {
85
+ const write = state.logoutPending?.generation === generation
86
+ ? { ...state, logoutPending: null }
87
+ : null;
88
+ // A landed clear drops `owedFor` (`adoptNewer`). A refused clear, or a confirm that
89
+ // wrote nothing because a newer sign-out moved the flag, keeps it (sdk#572).
90
+ return { write, result: write !== null };
91
+ });
92
+ // The clear did not land: storage refused the write, or this confirm wrote nothing because
93
+ // a newer sign-out had moved the flag. The confirmation is kept in memory, so this tab, and
94
+ // the slot it would leave when closed, don't owe it again (sdk#483). A flag storage holds at
95
+ // this generation is remembered as paid, so a tie with the record doesn't bring it back (sdk#506).
96
+ if (!cleared.ran || cleared.value !== true) {
97
+ // Read after the clear let go of the state lock, so another tab may have written since.
98
+ // Safe: the only write that sets a flag at the same generation (a redeem's revoke) runs
99
+ // under the cookie lock, which every caller of sendLogout holds now.
100
+ const stored = storage === null ? null : readState(storage);
101
+ if (stored?.generation === generation && stored.logoutPending?.generation === generation) {
102
+ cell.paidLogout = { generation, serial: stored.serial };
103
+ }
104
+ if (cell.known.logoutPending?.generation === generation)
105
+ cell.known = { ...cell.known, logoutPending: null };
106
+ // The write did not land. Keep what this sign-out was made against, so a record written
107
+ // since can end it (sdk#572, SDK-D1967). A write that lands drops it, below.
108
+ }
109
+ else {
110
+ cell.owedFor = null;
111
+ }
112
+ cell.logoutKept = null;
113
+ }
114
+ return answer;
115
+ };
116
+ const notConfirmed = (answer, generation, serial) => {
117
+ const keep = (kept) => {
118
+ clearTimeout(cell.logoutRetryTimer);
119
+ cell.logoutRetryTimer = undefined;
120
+ cell.logoutBackoffStep = 0;
121
+ cell.logoutKept = { generation, serial, answer: kept };
122
+ };
123
+ switch (answer.kind) {
124
+ case 'unconfirmed':
125
+ if (answer.reason === 'unavailable') {
126
+ // The newest send for this cookie went unanswered: an earlier refusal no longer stands
127
+ // for it, so neither a queued try nor `sync()` reads it (PR 547 round 1).
128
+ if (isKeptFor(cell.logoutKept, { generation, serial }))
129
+ cell.logoutKept = null;
130
+ scheduleLogoutRetry();
131
+ return;
132
+ }
133
+ keep({ kind: 'unconfirmed', reason: answer.reason });
134
+ return;
135
+ case 'broken':
136
+ keep(answer);
137
+ return;
138
+ default: {
139
+ const exhaustive = answer;
140
+ return exhaustive;
141
+ }
142
+ }
143
+ };
144
+ const recordSignOut = async (owing, landed) => {
145
+ const signedOut = (state) => {
146
+ const generation = state.generation + 1;
147
+ return { ...state, generation, signedIn: false, logoutPending: { generation }, principal: null, person: null, madeBy: 'sign-out' };
148
+ };
149
+ const told = (generation) => {
150
+ landed?.();
151
+ release({ status: 'signed-out' });
152
+ broadcast({ type: 'signed-out', generation });
153
+ };
154
+ // One write: a new signed-out generation and its pending logout together.
155
+ const decided = await withState((state) => {
156
+ const next = signedOut(state);
157
+ return { write: next, result: { generation: next.generation, serial: next.serial }, then: () => { told(next.generation); } };
158
+ });
159
+ if (decided.ran)
160
+ return decided.value;
161
+ // The shared state can't record it (storage refused, or the state lock couldn't be had). This
162
+ // tab keeps the signed-out state in memory and tells the others, which learn the same, so until
163
+ // pulse-auth confirms the logout every one of them sends it instead of refreshing. After
164
+ // close() the channel is closed: the sign-out reaches this page's slot and no other tab.
165
+ // What storage read now is what the slot carries if this object closes first (SDK-D1977).
166
+ // Read before the number is set: shared() adopting a record ends any earlier one (SDK-D2005).
167
+ const before = shared();
168
+ const next = signedOut(before);
169
+ // Whose cookie the logout is owed for: a revoke names its own sign-in's person (null when its
170
+ // answer couldn't be read); a sign-out, the person signed in here, from the record or, on a
171
+ // record without one, the token this tab holds at that generation (as a refresh compares,
172
+ // refresh.ts). Unknown: null.
173
+ const held = cell.held;
174
+ const person = owing.kind === 'revoke'
175
+ ? owing.person
176
+ : before.person ?? (held !== null && held.generation === before.generation ? held.access.person : null);
177
+ const record = storage === null ? null : readState(storage);
178
+ const stored = record === null ? 0 : record.generation;
179
+ const serial = record === null ? 0 : record.serial;
180
+ // The record's person, not whose cookie the logout is owed for. A ride renames that other
181
+ // field and leaves this one (SDK-D2053).
182
+ const basePerson = record === null ? null : record.person;
183
+ // A paid entry is not owed (SDK-D2047): this sign-out starts its own. An unpaid one already
184
+ // owed here (heard while this waited for the state lock): this revoke rides on it, as
185
+ // `oweRevoke` would have, so it is renamed as a ride (PR 566 O1).
186
+ const open = owedLogout(cell);
187
+ cell.owedFor = open === null
188
+ ? person === null
189
+ ? { stored, serial, basePerson, person, revoke: null }
190
+ : { stored, serial, basePerson, person, revoke: owing.kind === 'revoke' ? 'made' : null }
191
+ : owing.kind === 'revoke'
192
+ ? revokedOn(open, person, stored)
193
+ : open;
194
+ cell.known = next;
195
+ // This session's own sign-out now: `owedFor` decides, never the slot's entry (sdk#567).
196
+ cell.slotFor = null;
197
+ told(cell.known.generation);
198
+ // Closed already (a sign-in answered after close(), or a signOut() that waited for the state
199
+ // lock): close() left nothing, so this does (sdk#483 finding 1).
200
+ if (cell.closed)
201
+ leaveIfOwed();
202
+ return { generation: cell.known.generation, serial: cell.known.serial };
203
+ };
204
+ // Exactly while this tab's known state is the unrecorded, unconfirmed sign-out the number was read
205
+ // for, with that number: a sign-in recorded since then drops the slot (SDK-D1977). Memory against
206
+ // memory, never the count against a stored number (SDK-D1967, SDK-D2005).
207
+ const leaveIfOwed = () => {
208
+ // A paid entry is not owed, so a close does not leave it (SDK-D2047).
209
+ const owedFor = owedLogout(cell);
210
+ if (deps.owed === null || owedFor === null || cell.known.signedIn)
211
+ return;
212
+ const known = cell.known;
213
+ const left = deps.owed.left;
214
+ // The ride is already in the slot, and a later ride renamed it in place under the cookie
215
+ // lock. Merging this ride again is two riders, and that merge is not associative (SDK-D2046).
216
+ if (owedFor.revoke === 'rode' &&
217
+ left !== null &&
218
+ left.revoke === 'rode' &&
219
+ left.generation === known.generation &&
220
+ left.stored === owedFor.stored)
221
+ return;
222
+ leaveOwed(deps.owed, { generation: known.generation, ...owedFor });
223
+ };
224
+ /**
225
+ * Writes a paid sign-out down once storage takes it, with no request. The sdk#506 branch stays
226
+ * first: a flag storage already holds, cleared while that record is still the paid one. The other
227
+ * branch is derived, not a second field: the flag is already clear, `owedFor` or else `slotFor`
228
+ * is still set, and known is newer than storage (sdk#586). The base is that generation, that
229
+ * serial and that record's person (`basePerson`), not the person the logout is owed for: a ride
230
+ * renames the owed person and leaves the record's (SDK-D2053). A heard sign-out names no owed
231
+ * person and still matches its base, because the entry kept the record's person. A null serial
232
+ * names no record, so it writes only over a lower record that is not signed in and owes no
233
+ * logout. The same person signed in again after a lost record, then renewed until the serial
234
+ * matches, is the one this cannot see. The slot is read inside the state lock, after reconcile,
235
+ * and neither branch writes while it holds an entry. A refused write leaves the mark, and the
236
+ * next sync tries again.
237
+ */
238
+ const paidMark = () => {
239
+ if (cell.known.logoutPending?.generation === cell.known.generation)
240
+ return null;
241
+ const owed = cell.owedFor ?? cell.slotFor;
242
+ if (owed === null || storage === null || !isNewer(cell.known, readState(storage)))
243
+ return null;
244
+ return { stored: owed.stored, serial: owed.serial, basePerson: owed.basePerson };
245
+ };
246
+ const writeDownPaid = async () => {
247
+ if (cell.paidLogout !== null) {
248
+ await withState((state) => ({
249
+ write: (deps.owed?.left ?? null) !== null || cell.paidLogout === null ? null : state,
250
+ result: undefined,
251
+ }));
252
+ return;
253
+ }
254
+ if (paidMark() === null || storage === null)
255
+ return;
256
+ const recordStore = storage;
257
+ await withState((state) => {
258
+ const mark = paidMark();
259
+ const record = readState(recordStore);
260
+ const slotHeld = (deps.owed?.left ?? null) !== null;
261
+ // The record's person, kept where the entry was made. The person the logout is owed for is
262
+ // a different field, and a ride renames that one (SDK-D2053).
263
+ const onBase = mark !== null &&
264
+ !slotHeld &&
265
+ record.generation === mark.stored &&
266
+ mark.serial !== null &&
267
+ record.serial === mark.serial &&
268
+ record.person === mark.basePerson;
269
+ const lowerQuiet = mark !== null &&
270
+ !slotHeld &&
271
+ record.generation < mark.stored &&
272
+ !record.signedIn &&
273
+ record.logoutPending?.generation !== record.generation;
274
+ return { write: onBase || lowerQuiet ? state : null, result: undefined };
275
+ });
276
+ };
277
+ /**
278
+ * Writes down a state only this tab's memory holds (a sign-out storage refused, or one
279
+ * another tab announced), once storage takes it, so a page load knows it too.
280
+ */
281
+ const persistKnown = async () => {
282
+ if (storage === null || !isNewer(cell.known, readState(storage)))
283
+ return;
284
+ await withState((state) => ({
285
+ write: isNewer(state, readState(storage)) ? state : null,
286
+ result: undefined,
287
+ }));
288
+ };
289
+ // Whether this call can pay, decided before any wait. `send` when it cannot: the try then writes
290
+ // the pending sign-out as its first wait, which is when `sync()` sees it (sdk#542 O1). Awaiting
291
+ // a helper that already knows the answer is `send` lets that caller continue before the write.
292
+ const payCopyEarly = () => {
293
+ const state = shared();
294
+ const owed = state.logoutPending;
295
+ const copy = cell.slotFor;
296
+ if (owed === null ||
297
+ owed.generation !== state.generation ||
298
+ copy === null ||
299
+ owedLogout(cell) !== null ||
300
+ (deps.owed?.left ?? null) !== null ||
301
+ storage === null)
302
+ return 'send';
303
+ return 'look';
304
+ };
305
+ const SEND = { kind: 'send' };
306
+ /**
307
+ * Pay this tab's copy of a logout another session already confirmed, before anything writes the
308
+ * pending sign-out. One helper for the try and for a call that shares it (sdk#583, SDK-D2049).
309
+ * `paid`: nothing is sent, and the generation and serial are the state the pay cleared. `send`:
310
+ * the try re-reads and may send. A second call finds the copy gone only after that write landed.
311
+ * A refused pay leaves the copy, so the next call sends, and the re-read finds nothing owed.
312
+ */
313
+ const payCopy = async () => {
314
+ if (payCopyEarly() === 'send')
315
+ return SEND;
316
+ const state = shared();
317
+ const owed = state.logoutPending;
318
+ const copy = cell.slotFor;
319
+ // Once more, after the early check: a reconcile since can drop the copy. The callback decides the rest.
320
+ if (owed === null || owed.generation !== state.generation || copy === null || storage === null)
321
+ return SEND;
322
+ const generation = owed.generation;
323
+ const recordStore = storage;
324
+ // A holder, not a `let` the callback assigns: TypeScript would keep that `let` at `null` (TS#9998).
325
+ // `null` means the callback never ran. That is not a refused write, which ran and decided `pay`.
326
+ const decision = { value: null };
327
+ const cleared = await withState((current) => {
328
+ // `current` is known after reconcile, under the lock. The copy's base is the stored record
329
+ // it was made against. A lower record is a lost one: the sign-out stands, so it pays. A
330
+ // record past that base is not the confirm, and the try sends (SDK-D2049).
331
+ const record = readState(recordStore);
332
+ const slotStill = (deps.owed?.left ?? null) === null && cell.slotFor === copy;
333
+ const notPast = record.generation <= copy.stored;
334
+ if (slotStill &&
335
+ current.generation === generation &&
336
+ current.logoutPending?.generation === generation &&
337
+ notPast) {
338
+ decision.value = { kind: 'pay', generation: current.generation, serial: current.serial };
339
+ return { write: { ...current, logoutPending: null }, result: 'pay' };
340
+ }
341
+ decision.value = 'send';
342
+ return { write: null, result: 'send' };
343
+ });
344
+ const paid = decision.value;
345
+ if (paid !== null && paid !== 'send' && !cleared.ran) {
346
+ if (cell.known.logoutPending?.generation === generation) {
347
+ cell.known = { ...cell.known, logoutPending: null };
348
+ }
349
+ }
350
+ if (paid !== null && paid !== 'send' && isKeptFor(cell.logoutKept, cell.known))
351
+ cell.logoutKept = null;
352
+ return paid !== null && paid !== 'send'
353
+ ? { kind: 'paid', generation: paid.generation, serial: paid.serial }
354
+ : SEND;
355
+ };
356
+ /**
357
+ * Sends the logout the shared state still owes, under the cookie lock. `answered`: what
358
+ * pulse-auth said to the logout `generation` owed, or, for a try queued behind this tab's own send
359
+ * of that same logout, what it said to that send (sdk#531). `nothing-owed`: pulse-auth confirmed it, or a
360
+ * new sign-in replaced the cookie, and `generation` is the state's now. `not-asked`: the lock
361
+ * wasn't had, or the session closed, which is tried again. `read` hears what the try found once
362
+ * it has read the state inside the lock.
363
+ */
364
+ const flushPendingLogout = async (read) => {
365
+ // The mark as this try starts: one set later is a send this try queued behind.
366
+ const before = cell.logoutKept;
367
+ const locked = await withCookie(async () => {
368
+ // The copy is paid before persistKnown. Writing the pending flag first drops the copy, and
369
+ // the try then sends a logout the confirm already paid (sdk#583 round 1).
370
+ const pay = payCopyEarly() === 'send' ? SEND : await payCopy();
371
+ if (pay.kind === 'paid') {
372
+ // A sign-out past the one just paid is still owed: write it and send it. The answer
373
+ // otherwise is the state the pay cleared, not a later read of whatever landed since.
374
+ const now = shared();
375
+ const newer = now.logoutPending;
376
+ if (newer === null || newer.generation !== now.generation || newer.generation <= pay.generation) {
377
+ read({ kind: 'nothing-owed' });
378
+ return { kind: 'nothing-owed', generation: pay.generation, serial: pay.serial };
379
+ }
380
+ }
381
+ await persistKnown();
382
+ // Closed while this waited: nothing new is sent (SDK-D1930). The flag stays recorded, for
383
+ // another tab or the next page load; close() set no retry timer. The check sits after the
384
+ // write. One before it drops a pending sign-out storage had refused. The pay needs no check
385
+ // of its own: a paid copy writes the clear and sends nothing, and a send falls through to
386
+ // this write and then this check.
387
+ if (cell.closed)
388
+ return NOT_SENT;
389
+ // Re-read after the wait. The generation, the kept mark and the serial are this read's.
390
+ const again = shared();
391
+ const still = again.logoutPending;
392
+ if (still !== null && still.generation === again.generation) {
393
+ read({ kind: 'sends', generation: still.generation });
394
+ // Kept while this waited for the lock, for this same cookie (this tab's restore or sign-in
395
+ // sent it): pulse-auth's answer stands, and is this try's too. Sending it again would ask
396
+ // the same question (sdk#531). A mark this try saw as it started is an older send: the
397
+ // timer's try and any later one send, as before (PR 547 round 1).
398
+ const kept = cell.logoutKept;
399
+ if (kept !== before && isKeptFor(kept, again))
400
+ return { kind: 'answered', answer: kept.answer, generation: still.generation, serial: again.serial };
401
+ return { kind: 'answered', answer: await sendLogout(still.generation), generation: still.generation, serial: again.serial };
402
+ }
403
+ read({ kind: 'nothing-owed' });
404
+ return { kind: 'nothing-owed', generation: again.generation, serial: again.serial };
405
+ });
406
+ return locked.ran ? locked.value : NOT_SENT;
407
+ };
408
+ /**
409
+ * What became of one try, once: the timer and the kept mark are set here, for every
410
+ * caller the try is told to.
411
+ */
412
+ const settle = (outcome) => {
413
+ switch (outcome.kind) {
414
+ case 'answered':
415
+ if (outcome.answer.kind === 'confirmed')
416
+ stopRetrying();
417
+ else
418
+ notConfirmed(outcome.answer, outcome.generation, outcome.serial);
419
+ return outcome;
420
+ case 'nothing-owed':
421
+ stopRetrying();
422
+ return outcome;
423
+ case 'not-asked':
424
+ scheduleLogoutRetry();
425
+ return outcome;
426
+ default: {
427
+ const exhaustive = outcome;
428
+ return exhaustive;
429
+ }
430
+ }
431
+ };
432
+ const stopRetrying = () => {
433
+ clearTimeout(cell.logoutRetryTimer);
434
+ cell.logoutRetryTimer = undefined;
435
+ cell.logoutBackoffStep = 0;
436
+ };
437
+ /**
438
+ * The try still out in this tab, and what it has read inside the cookie lock (sdk#517). A check
439
+ * of the shared state (`sync()`) or a sign-out shares it: nothing more is sent, and its outcome
440
+ * is theirs. While it waits for the lock every call shares it, whatever generation that call
441
+ * sees owed, since it reads the state there and sends for the newest one owed. Once it has read
442
+ * it, only a call that sees owed the generation it sends for shares it; a call that sees another
443
+ * one owed, or one after it found nothing owed, starts its own try.
444
+ */
445
+ let inFlight = null;
446
+ /** A try that threw: reported, and tried again on the back-off. */
447
+ const threw = (error) => {
448
+ report({ kind: 'threw', step: 'logout', cause: error });
449
+ scheduleLogoutRetry();
450
+ return NOT_SENT;
451
+ };
452
+ const startTry = () => {
453
+ let found = WAITING;
454
+ const outcome = flushPendingLogout((read) => {
455
+ found = read;
456
+ }).then(settle, threw);
457
+ const mark = { read: () => found, outcome };
458
+ inFlight = mark;
459
+ // Ended however the try ends, a rejection included, so a marker never outlives its try.
460
+ const clear = () => {
461
+ if (inFlight === mark)
462
+ inFlight = null;
463
+ };
464
+ void outcome.then(clear, clear);
465
+ return outcome;
466
+ };
467
+ // A call that shares a try still writes down what only memory holds, as the try it would have
468
+ // started does first: a sign-out storage refused is written once storage takes writes again, so
469
+ // a reload in between doesn't restore the session (SDK-D2012). No request is sent. A write-down
470
+ // that throws is reported, and the call still takes the shared try's outcome: that try's settle
471
+ // owns the timer and the kept mark, so a sharer never arms the back-off (SDK-D1963).
472
+ const share = (outcome) => {
473
+ const wrote = (error) => {
474
+ report({ kind: 'threw', step: 'logout', cause: error });
475
+ return outcome;
476
+ };
477
+ const writeThen = () => persistKnown().then(() => outcome, wrote);
478
+ // No copy to pay: the write is this call's first wait, as it was before the gate (sdk#542 O1).
479
+ if (payCopyEarly() === 'send')
480
+ return writeThen();
481
+ return payCopy().then((pay) => (pay.kind === 'paid' ? outcome : writeThen()), (error) => {
482
+ // A throw is not a pay. The pending flag is still written down (sdk#583 round 2).
483
+ report({ kind: 'threw', step: 'logout', cause: error });
484
+ return writeThen();
485
+ });
486
+ };
487
+ const tryLogout = (pinnedSerial) => {
488
+ const state = shared();
489
+ const owed = state.logoutPending !== null && state.logoutPending.generation === state.generation
490
+ ? state.logoutPending.generation
491
+ : null;
492
+ const outcome = inFlight !== null && shares(inFlight.read(), owed) ? share(inFlight.outcome) : startTry();
493
+ return outcome.then((settled) => toldTo(settled, pinnedSerial));
494
+ };
495
+ const scheduleLogoutRetry = () => {
496
+ const delay = BACKOFF_MS[Math.min(cell.logoutBackoffStep, BACKOFF_MS.length - 1)] ?? 30_000;
497
+ cell.logoutBackoffStep += 1;
498
+ clearTimeout(cell.logoutRetryTimer);
499
+ if (cell.closed)
500
+ return;
501
+ cell.logoutRetryTimer = setTimeout(() => {
502
+ cell.logoutRetryTimer = undefined;
503
+ void tryLogout();
504
+ }, delay);
505
+ };
506
+ // The kept branch's write. A copy another session confirmed since that answer is paid first, so
507
+ // the pending flag is not written back over the confirm (sdk#586). Either way nothing is sent.
508
+ const writeDown = async () => {
509
+ if (payCopyEarly() !== 'send') {
510
+ try {
511
+ const pay = await payCopy();
512
+ // A paid answer is written by the next sync, under the write-down's guards, as share()
513
+ // leaves it (sdk#586 round 2). persistKnown would write it by newness alone.
514
+ if (pay.kind === 'paid')
515
+ return;
516
+ }
517
+ catch (error) {
518
+ // A throw is not a pay. The pending flag is still written down, as share() does (sdk#586).
519
+ report({ kind: 'threw', step: 'logout', cause: error });
520
+ }
521
+ }
522
+ await persistKnown();
523
+ };
524
+ return { sendLogout, recordSignOut, leaveIfOwed, tryLogout, notConfirmed, scheduleLogoutRetry, writeDown, writeDownPaid };
525
+ }
526
+ //# sourceMappingURL=logout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logout.js","sourceRoot":"","sources":["../../../src/first-party/session/logout.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAkB,MAAM,aAAa,CAAA;AACvD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAqC,MAAM,WAAW,CAAA;AAChG,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAChD,OAAO,EAAE,OAAO,EAAoB,MAAM,aAAa,CAAA;AAIvD,MAAM,SAAS,GAAS,EAAE,IAAI,EAAE,WAAW,EAAE,CAAA;AAC7C,MAAM,SAAS,GAAS,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,aAAa,EAAE,CAAA;AACtE,MAAM,UAAU,GAAS,EAAE,IAAI,EAAE,YAAY,EAAE,CAAA;AAE/C,SAAS,MAAM,CAAC,MAAoB;IAClC,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,WAAW;YACd,OAAO,SAAS,CAAA;QAClB,KAAK,aAAa;YAChB,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,CAAC,M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