@lango-project/lango-client 0.2.1 → 0.4.1
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/LICENSE +1 -0
- package/NOTICE +5 -1
- package/README.md +603 -906
- package/cli/.lango/localization.mjs +108 -0
- package/{dist/node → cli}/.lango/runtime.mjs +120 -20
- package/cli/.lango/vendor/i18next.LICENSE +21 -0
- package/cli/.lango/vendor/i18next.mjs +2434 -0
- package/cli/create.mjs +62 -0
- package/cli/create.mjs.map +1 -0
- package/dist/.lango/localization.mjs +108 -0
- package/dist/.lango/runtime.mjs +120 -20
- package/dist/.lango/vendor/i18next.LICENSE +21 -0
- package/dist/.lango/vendor/i18next.mjs +2434 -0
- package/dist/accordion.mjs +277 -0
- package/dist/accordion.mjs.map +1 -0
- package/dist/activities.mjs +185 -0
- package/dist/activities.mjs.map +1 -0
- package/dist/app.mjs +671 -0
- package/dist/app.mjs.map +1 -0
- package/dist/boot.mjs +24 -0
- package/dist/boot.mjs.map +1 -0
- package/dist/bootstrap-LICENSE +21 -0
- package/dist/bootstrap.min.css +6 -0
- package/dist/bootstrap.min.css.map +1 -0
- package/dist/button.mjs +77 -0
- package/dist/button.mjs.map +1 -0
- package/dist/chip.mjs +134 -0
- package/dist/chip.mjs.map +1 -0
- package/dist/client.css +102 -0
- package/dist/collections.mjs +77 -0
- package/dist/collections.mjs.map +1 -0
- package/dist/combo_box.mjs +408 -0
- package/dist/combo_box.mjs.map +1 -0
- package/dist/content.mjs +123 -0
- package/dist/content.mjs.map +1 -0
- package/dist/control.mjs +141 -0
- package/dist/control.mjs.map +1 -0
- package/dist/date_input.mjs +242 -0
- package/dist/date_input.mjs.map +1 -0
- package/dist/dimensions.mjs +102 -0
- package/dist/dimensions.mjs.map +1 -0
- package/dist/error_reporter.mjs +136 -0
- package/dist/error_reporter.mjs.map +1 -0
- package/dist/fields.mjs +454 -0
- package/dist/fields.mjs.map +1 -0
- package/dist/file_input.mjs +227 -0
- package/dist/file_input.mjs.map +1 -0
- package/dist/form.mjs +272 -0
- package/dist/form.mjs.map +1 -0
- package/dist/heartbeat.mjs +167 -254
- package/dist/heartbeat.mjs.map +1 -1
- package/dist/index.html +18 -0
- package/dist/indicators.mjs +127 -0
- package/dist/indicators.mjs.map +1 -0
- package/dist/input_changes.mjs +58 -0
- package/dist/input_changes.mjs.map +1 -0
- package/dist/input_group.mjs +38 -0
- package/dist/input_group.mjs.map +1 -0
- package/dist/layouts.mjs +195 -0
- package/dist/layouts.mjs.map +1 -0
- package/dist/library.mjs +130 -807
- package/dist/library.mjs.map +1 -1
- package/dist/longpoll.mjs +254 -0
- package/dist/longpoll.mjs.map +1 -0
- package/dist/main.mjs +147 -0
- package/dist/main.mjs.map +1 -0
- package/dist/markdown.mjs +61 -0
- package/dist/markdown.mjs.map +1 -0
- package/dist/menus.mjs +468 -0
- package/dist/menus.mjs.map +1 -0
- package/dist/navigation.mjs +260 -410
- package/dist/navigation.mjs.map +1 -1
- package/dist/numeric_input.mjs +181 -0
- package/dist/numeric_input.mjs.map +1 -0
- package/dist/otp_input.mjs +113 -0
- package/dist/otp_input.mjs.map +1 -0
- package/dist/presentations.mjs +852 -0
- package/dist/presentations.mjs.map +1 -0
- package/dist/renderer.mjs +295 -0
- package/dist/renderer.mjs.map +1 -0
- package/dist/rich_content.mjs +99 -0
- package/dist/rich_content.mjs.map +1 -0
- package/dist/table_scope.mjs +166 -0
- package/dist/table_scope.mjs.map +1 -0
- package/dist/tables.mjs +1052 -0
- package/dist/tables.mjs.map +1 -0
- package/dist/tabs.mjs +205 -0
- package/dist/tabs.mjs.map +1 -0
- package/dist/templates.mjs +46 -0
- package/dist/templates.mjs.map +1 -0
- package/dist/vendor/DOMPurify-LICENSE +202 -0
- package/dist/vendor/dompurify.mjs +2454 -0
- package/dist/vendor/flatpickr-LICENSE.md +21 -0
- package/dist/vendor/flatpickr.min.css +13 -0
- package/dist/vendor/flatpickr.mjs +2340 -0
- package/dist/vendor/flatpickr.mjs.map +7 -0
- package/dist/vendor/marked-LICENSE.md +44 -0
- package/dist/vendor/marked.esm.js.map +7 -0
- package/dist/vendor/marked.mjs +85 -0
- package/dist/vendor/purify.es.mjs.map +1 -0
- package/dist/widgets.mjs +197 -0
- package/dist/widgets.mjs.map +1 -0
- package/docs/implementation.md +93 -0
- package/package.json +25 -43
- package/src/accordion.lango +198 -0
- package/src/activities.lango +132 -0
- package/src/app.lango +540 -0
- package/src/boot.lango +12 -0
- package/src/button.lango +49 -0
- package/src/chip.lango +94 -0
- package/src/collections.lango +46 -0
- package/src/combo_box.lango +298 -0
- package/src/content.lango +75 -0
- package/src/control.lango +103 -0
- package/src/create.lango +42 -0
- package/src/date_input.lango +215 -0
- package/src/dimensions.lango +65 -0
- package/src/error_reporter.lango +95 -0
- package/src/fields.lango +327 -0
- package/src/file_input.lango +175 -0
- package/src/form.lango +195 -0
- package/src/heartbeat.lango +136 -199
- package/src/indicators.lango +94 -0
- package/src/input_changes.lango +33 -0
- package/src/input_group.lango +22 -0
- package/src/layouts.lango +137 -0
- package/src/library.lango +194 -599
- package/src/longpoll.lango +187 -0
- package/src/main.lango +118 -0
- package/src/markdown.lango +48 -0
- package/src/menus.lango +336 -0
- package/src/navigation.lango +209 -299
- package/src/numeric_input.lango +131 -0
- package/src/otp_input.lango +83 -0
- package/src/presentations.lango +617 -0
- package/src/renderer.lango +296 -0
- package/src/rich_content.lango +66 -0
- package/src/table_scope.lango +119 -0
- package/src/tables.lango +786 -0
- package/src/tabs.lango +144 -0
- package/src/templates.lango +29 -0
- package/src/widgets.lango +141 -0
- package/web/client.css +102 -0
- package/web/index.html +18 -0
- package/dist/application.mjs +0 -429
- package/dist/application.mjs.map +0 -1
- package/dist/coordinator.mjs +0 -91
- package/dist/coordinator.mjs.map +0 -1
- package/dist/demo.mjs +0 -110
- package/dist/demo.mjs.map +0 -1
- package/dist/demo_controls.mjs +0 -59
- package/dist/demo_controls.mjs.map +0 -1
- package/dist/errors.mjs +0 -201
- package/dist/errors.mjs.map +0 -1
- package/dist/form_state.mjs +0 -266
- package/dist/form_state.mjs.map +0 -1
- package/dist/inheritance.mjs +0 -240
- package/dist/inheritance.mjs.map +0 -1
- package/dist/input_values.mjs +0 -65
- package/dist/input_values.mjs.map +0 -1
- package/dist/node/.lango/xmldom/conventions.js +0 -429
- package/dist/node/.lango/xmldom/dom-parser.js +0 -591
- package/dist/node/.lango/xmldom/dom.js +0 -3759
- package/dist/node/.lango/xmldom/entities.js +0 -2171
- package/dist/node/.lango/xmldom/errors.js +0 -205
- package/dist/node/.lango/xmldom/grammar.js +0 -559
- package/dist/node/.lango/xmldom/index.js +0 -41
- package/dist/node/.lango/xmldom/package.json +0 -1
- package/dist/node/.lango/xmldom/sax.js +0 -983
- package/dist/node/.lango/xmldom.LICENSE.md +0 -8
- package/dist/node/browser_host.mjs +0 -351
- package/dist/node/browser_host.mjs.map +0 -1
- package/dist/node/create_app.mjs +0 -118
- package/dist/node/create_app.mjs.map +0 -1
- package/dist/presentation.mjs +0 -89
- package/dist/presentation.mjs.map +0 -1
- package/dist/protocol.mjs +0 -706
- package/dist/protocol.mjs.map +0 -1
- package/dist/session.mjs +0 -471
- package/dist/session.mjs.map +0 -1
- package/dist/tokens.mjs +0 -298
- package/dist/tokens.mjs.map +0 -1
- package/examples/contacts.lango +0 -293
- package/examples/contacts_flow.lango +0 -174
- package/examples/contacts_store.lango +0 -109
- package/examples/contacts_store_test.lango +0 -65
- package/examples/demo.css +0 -87
- package/examples/demo_test.lango +0 -356
- package/examples/index.html +0 -32
- package/examples/pages.lango +0 -174
- package/examples/server.lango +0 -189
- package/examples/worker.lango +0 -142
- package/src/application.lango +0 -327
- package/src/browser_host.lango +0 -276
- package/src/coordinator.lango +0 -57
- package/src/demo.lango +0 -110
- package/src/demo_controls.lango +0 -53
- package/src/errors.lango +0 -149
- package/src/errors_test.lango +0 -157
- package/src/form_state.lango +0 -168
- package/src/heartbeat_test.lango +0 -479
- package/src/inheritance.lango +0 -167
- package/src/input_values.lango +0 -37
- package/src/logout_test.lango +0 -564
- package/src/navigation_test.lango +0 -556
- package/src/presentation.lango +0 -55
- package/src/protocol.lango +0 -787
- package/src/renderer_test.lango +0 -2047
- package/src/session.lango +0 -343
- package/src/session_test.lango +0 -455
- package/src/tabs_test.lango +0 -216
- package/src/tokens.lango +0 -215
- package/template/.vscode/extensions.json +0 -3
- package/template/.vscode/settings.json +0 -9
- package/template/README.md +0 -44
- package/template/gitignore +0 -4
- package/template/package.json +0 -22
- package/template/public/app.css +0 -10
- package/template/public/index.html +0 -24
- package/template/src/client.lango +0 -78
- package/template/src/pages.lango +0 -55
- package/template/src/server.lango +0 -24
- package/template/src/worker.lango +0 -77
- package/template/test/app.lango +0 -9
- package/tools/browser_runner.lango +0 -32
- package/tools/browser_test.lango +0 -343
- package/tools/create_app.lango +0 -88
- package/tools/create_app_test.lango +0 -43
- package/tools/starter_test.lango +0 -227
- /package/{dist/node → cli}/.lango/bignumber.mjs +0 -0
- /package/{dist → cli}/.lango/xmldom/conventions.js +0 -0
- /package/{dist → cli}/.lango/xmldom/dom-parser.js +0 -0
- /package/{dist → cli}/.lango/xmldom/dom.js +0 -0
- /package/{dist → cli}/.lango/xmldom/entities.js +0 -0
- /package/{dist → cli}/.lango/xmldom/errors.js +0 -0
- /package/{dist → cli}/.lango/xmldom/grammar.js +0 -0
- /package/{dist → cli}/.lango/xmldom/index.js +0 -0
- /package/{dist → cli}/.lango/xmldom/package.json +0 -0
- /package/{dist → cli}/.lango/xmldom/sax.js +0 -0
- /package/{dist → cli}/.lango/xmldom.LICENSE.md +0 -0
package/src/logout_test.lango
DELETED
|
@@ -1,564 +0,0 @@
|
|
|
1
|
-
import js global Promise
|
|
2
|
-
import js global Response
|
|
3
|
-
import js global globalThis as host
|
|
4
|
-
import js "node:timers/promises" as timers
|
|
5
|
-
import "./application"
|
|
6
|
-
class Application
|
|
7
|
-
import "./tokens"
|
|
8
|
-
class TokenStore
|
|
9
|
-
|
|
10
|
-
export main(args)
|
|
11
|
-
|
|
12
|
-
class Document
|
|
13
|
-
methods
|
|
14
|
-
createElement(tag)
|
|
15
|
-
|
|
16
|
-
Document:createElement(tag)
|
|
17
|
-
return new Element()
|
|
18
|
-
|
|
19
|
-
class Element
|
|
20
|
-
properties
|
|
21
|
-
children
|
|
22
|
-
parentNode
|
|
23
|
-
inert
|
|
24
|
-
hidden
|
|
25
|
-
value
|
|
26
|
-
attributes
|
|
27
|
-
listeners
|
|
28
|
-
methods
|
|
29
|
-
appendChild(child)
|
|
30
|
-
setAttribute(name, value)
|
|
31
|
-
addEventListener(type, listener)
|
|
32
|
-
removeEventListener(type, listener)
|
|
33
|
-
|
|
34
|
-
Element()
|
|
35
|
-
@children = []
|
|
36
|
-
@attributes = {
|
|
37
|
-
}
|
|
38
|
-
@listeners = {
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
Element:appendChild(child)
|
|
42
|
-
@children.add(child)
|
|
43
|
-
child.parentNode = @this
|
|
44
|
-
|
|
45
|
-
Element:setAttribute(name, value)
|
|
46
|
-
@attributes[name] = value
|
|
47
|
-
|
|
48
|
-
Element:addEventListener(type, listener)
|
|
49
|
-
if !(type in @listeners)
|
|
50
|
-
@listeners[type] = []
|
|
51
|
-
@listeners[type].add({
|
|
52
|
-
invoke: listener
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
Element:removeEventListener(type, listener)
|
|
56
|
-
callbacks = @listeners[type]
|
|
57
|
-
for callbacks as index: callback
|
|
58
|
-
if callback.invoke == listener
|
|
59
|
-
callbacks.splice(index, 1)
|
|
60
|
-
break
|
|
61
|
-
|
|
62
|
-
class Storage
|
|
63
|
-
properties
|
|
64
|
-
values
|
|
65
|
-
writes
|
|
66
|
-
methods
|
|
67
|
-
getItem(key)
|
|
68
|
-
setItem(key, value)
|
|
69
|
-
removeItem(key)
|
|
70
|
-
|
|
71
|
-
Storage()
|
|
72
|
-
@values = {
|
|
73
|
-
}
|
|
74
|
-
@writes = []
|
|
75
|
-
|
|
76
|
-
Storage:getItem(key)
|
|
77
|
-
return @values[key]
|
|
78
|
-
|
|
79
|
-
Storage:setItem(key, value)
|
|
80
|
-
@values[key] = value
|
|
81
|
-
@writes.add(value)
|
|
82
|
-
|
|
83
|
-
Storage:removeItem(key)
|
|
84
|
-
@values[key] = null
|
|
85
|
-
|
|
86
|
-
class Http
|
|
87
|
-
properties
|
|
88
|
-
calls
|
|
89
|
-
methods
|
|
90
|
-
send(path, options)
|
|
91
|
-
waitFor(count)
|
|
92
|
-
respond(index, body, token = null, status = 200)
|
|
93
|
-
|
|
94
|
-
Http()
|
|
95
|
-
@calls = []
|
|
96
|
-
@waiting = []
|
|
97
|
-
|
|
98
|
-
Http:send(path, options)
|
|
99
|
-
pending = Promise/withResolvers()
|
|
100
|
-
@calls.add({
|
|
101
|
-
path: path
|
|
102
|
-
options: options
|
|
103
|
-
authorization: options.headers.Authorization
|
|
104
|
-
input: from_json(options.body)
|
|
105
|
-
pending: pending
|
|
106
|
-
})
|
|
107
|
-
for @waiting as waiter
|
|
108
|
-
if @calls.length >= waiter.count
|
|
109
|
-
waiter.pending.resolve()
|
|
110
|
-
return pending.promise
|
|
111
|
-
|
|
112
|
-
Http:waitFor(count)
|
|
113
|
-
if @calls.length >= count
|
|
114
|
-
return Promise/resolve()
|
|
115
|
-
pending = Promise/withResolvers()
|
|
116
|
-
@waiting.add({
|
|
117
|
-
count: count
|
|
118
|
-
pending: pending
|
|
119
|
-
})
|
|
120
|
-
return pending.promise
|
|
121
|
-
|
|
122
|
-
Http:respond(index, body, token = null, status = 200)
|
|
123
|
-
headers = {
|
|
124
|
-
"Content-Type": "application/json"
|
|
125
|
-
}
|
|
126
|
-
if token != null
|
|
127
|
-
headers["X-Lango-Token"] = token
|
|
128
|
-
response = new Response(to_json(body), {
|
|
129
|
-
status: status
|
|
130
|
-
headers: headers
|
|
131
|
-
})
|
|
132
|
-
call = @calls[index]
|
|
133
|
-
call.pending.resolve(response)
|
|
134
|
-
|
|
135
|
-
class Harness
|
|
136
|
-
properties
|
|
137
|
-
app
|
|
138
|
-
tokens
|
|
139
|
-
storage
|
|
140
|
-
http
|
|
141
|
-
pending
|
|
142
|
-
first
|
|
143
|
-
second
|
|
144
|
-
old
|
|
145
|
-
nested
|
|
146
|
-
methods
|
|
147
|
-
begin(ping = false, bootstrap = false)
|
|
148
|
-
|
|
149
|
-
Harness(http)
|
|
150
|
-
@http = http
|
|
151
|
-
@storage = new Storage()
|
|
152
|
-
@tokens = new TokenStore(@storage)
|
|
153
|
-
@tokens.save("authenticated")
|
|
154
|
-
|
|
155
|
-
Harness:begin(ping = false, bootstrap = false)
|
|
156
|
-
options = {
|
|
157
|
-
tokens: @tokens
|
|
158
|
-
pingEnabled: ping
|
|
159
|
-
pingIdleMs: 10
|
|
160
|
-
}
|
|
161
|
-
if bootstrap
|
|
162
|
-
options.bootstrapPath = "/_lango/start"
|
|
163
|
-
@app = new Application(new Document(), new Element(), {
|
|
164
|
-
type: "Form"
|
|
165
|
-
name: "profile"
|
|
166
|
-
controls: [{
|
|
167
|
-
type: "Value"
|
|
168
|
-
name: "value"
|
|
169
|
-
value: "initial"
|
|
170
|
-
}, {
|
|
171
|
-
type: "Form"
|
|
172
|
-
name: "nested"
|
|
173
|
-
controls: []
|
|
174
|
-
}]
|
|
175
|
-
}, options)
|
|
176
|
-
@old = @app.session("profile")
|
|
177
|
-
@nested = @app.session(["profile", "nested"])
|
|
178
|
-
|
|
179
|
-
main(args)
|
|
180
|
-
checks = [checkQueues, checkFailures, checkDisposal, checkStartupLogout, checkFailedStartupLogout, checkLatePing, checkSupersededBootstrap, checkRejectedLogout]
|
|
181
|
-
return runChecks(checks, 0)
|
|
182
|
-
|
|
183
|
-
runChecks(checks, index)
|
|
184
|
-
if index == checks.length
|
|
185
|
-
return null
|
|
186
|
-
return runCase(checks[index]).then(()
|
|
187
|
-
capture checks
|
|
188
|
-
capture index
|
|
189
|
-
return runChecks(checks, index + 1)
|
|
190
|
-
)
|
|
191
|
-
|
|
192
|
-
runCase(check)
|
|
193
|
-
original = host.fetch
|
|
194
|
-
http = new Http()
|
|
195
|
-
stub = (path, options)
|
|
196
|
-
capture http
|
|
197
|
-
return http.send(path, options)
|
|
198
|
-
host.fetch = stub
|
|
199
|
-
ready = Promise/resolve()
|
|
200
|
-
return ready.then(()
|
|
201
|
-
capture check
|
|
202
|
-
capture http
|
|
203
|
-
return check(http)
|
|
204
|
-
).finally(()
|
|
205
|
-
capture original
|
|
206
|
-
host.fetch = original
|
|
207
|
-
)
|
|
208
|
-
|
|
209
|
-
expectFailure(pending, expected)
|
|
210
|
-
return pending.then((result)
|
|
211
|
-
throw "UnexpectedSuccess"
|
|
212
|
-
).catch((error)
|
|
213
|
-
capture expected
|
|
214
|
-
assert error == expected
|
|
215
|
-
)
|
|
216
|
-
|
|
217
|
-
checkQueues(http)
|
|
218
|
-
harness = new Harness(http)
|
|
219
|
-
harness.begin()
|
|
220
|
-
harness.first = expectFailure(harness.old.send("/save", "click", "save"), "UiSessionDisposed")
|
|
221
|
-
harness.second = expectFailure(harness.old.send("/save", "click", "save"), "UiSessionDisposed")
|
|
222
|
-
return http.waitFor(1).then(()
|
|
223
|
-
capture harness
|
|
224
|
-
harness.pending = harness.app.logout()
|
|
225
|
-
assert harness.app.logout() == harness.pending
|
|
226
|
-
assertPaused(harness)
|
|
227
|
-
return harness.http.waitFor(2)
|
|
228
|
-
).then(()
|
|
229
|
-
capture harness
|
|
230
|
-
assertRequest(harness.http.calls[1], "/_lango/logout", "authenticated")
|
|
231
|
-
harness.http.respond(1, {
|
|
232
|
-
loggedOut: true
|
|
233
|
-
}, "must-not-save-logout-header")
|
|
234
|
-
return harness.http.waitFor(3)
|
|
235
|
-
).then(()
|
|
236
|
-
capture harness
|
|
237
|
-
assert harness.tokens.latest() == null
|
|
238
|
-
assert harness.storage.getItem("lango:last-token") == null
|
|
239
|
-
assertRequest(harness.http.calls[2], "/_lango/start", "authenticated")
|
|
240
|
-
harness.http.respond(2, {
|
|
241
|
-
}, "anonymous")
|
|
242
|
-
return harness.pending
|
|
243
|
-
).then((token)
|
|
244
|
-
capture harness
|
|
245
|
-
assert token == "anonymous"
|
|
246
|
-
assertResumed(harness)
|
|
247
|
-
harness.http.respond(0, formBody("profile", 1), "late-authenticated")
|
|
248
|
-
return Promise/all([harness.first, harness.second])
|
|
249
|
-
).then(()
|
|
250
|
-
capture harness
|
|
251
|
-
assert harness.http.calls.length == 3
|
|
252
|
-
assert harness.tokens.latest() == "anonymous"
|
|
253
|
-
assert harness.storage.writes.length == 2
|
|
254
|
-
session = harness.app.session("profile")
|
|
255
|
-
harness.pending = session.send("/save", "click", "save")
|
|
256
|
-
return harness.http.waitFor(4)
|
|
257
|
-
).then(()
|
|
258
|
-
capture harness
|
|
259
|
-
call = harness.http.calls[3]
|
|
260
|
-
assert call.input.seqno == 1
|
|
261
|
-
original = harness.http.calls[0]
|
|
262
|
-
assert call.input.formInstanceId != original.input.formInstanceId
|
|
263
|
-
assert call.authorization == "Bearer anonymous"
|
|
264
|
-
harness.http.respond(3, formBody("profile", 1), "anonymous-renewed")
|
|
265
|
-
return harness.pending
|
|
266
|
-
).then((body)
|
|
267
|
-
capture harness
|
|
268
|
-
assert harness.tokens.latest() == "anonymous-renewed"
|
|
269
|
-
println("PASS logout coalesces, detaches forms, suppresses queued and late responses, persists anonymous credentials and resets seqno")
|
|
270
|
-
).finally(()
|
|
271
|
-
capture harness
|
|
272
|
-
harness.app.dispose()
|
|
273
|
-
)
|
|
274
|
-
|
|
275
|
-
assertRequest(call, path, token)
|
|
276
|
-
assert call.path == path
|
|
277
|
-
assert call.authorization == "Bearer ${token}"
|
|
278
|
-
assert call.options.method == "POST"
|
|
279
|
-
assert call.options.cache == "no-store"
|
|
280
|
-
assert call.options.redirect == "error"
|
|
281
|
-
return null
|
|
282
|
-
|
|
283
|
-
assertPaused(harness)
|
|
284
|
-
harness.app.reconcile()
|
|
285
|
-
assert harness.app.session("profile") == null
|
|
286
|
-
assert harness.app.session(["profile", "nested"]) == null
|
|
287
|
-
element = harness.app.control.element
|
|
288
|
-
assert element.inert
|
|
289
|
-
assert element.attributes["aria-busy"] == "true"
|
|
290
|
-
assert element.listeners.click.length == 0
|
|
291
|
-
try
|
|
292
|
-
harness.old.send("/save", "click", "save")
|
|
293
|
-
assert false
|
|
294
|
-
catch error
|
|
295
|
-
assert error == "UiSessionDisposed"
|
|
296
|
-
return null
|
|
297
|
-
|
|
298
|
-
assertResumed(harness)
|
|
299
|
-
assert harness.app.session("profile") != harness.old
|
|
300
|
-
assert harness.app.session("profile") != null
|
|
301
|
-
assert harness.app.session(["profile", "nested"]) != harness.nested
|
|
302
|
-
element = harness.app.control.element
|
|
303
|
-
assert !element.inert
|
|
304
|
-
assert element.attributes["aria-busy"] == "false"
|
|
305
|
-
assert element.listeners.click.length == 1
|
|
306
|
-
assert harness.storage.getItem("lango:last-token") == "anonymous"
|
|
307
|
-
return null
|
|
308
|
-
|
|
309
|
-
formBody(formId, seqno)
|
|
310
|
-
return {
|
|
311
|
-
formId: formId
|
|
312
|
-
seqno: seqno
|
|
313
|
-
ui: {
|
|
314
|
-
replace: {
|
|
315
|
-
}
|
|
316
|
-
remove: []
|
|
317
|
-
}
|
|
318
|
-
vals: {
|
|
319
|
-
}
|
|
320
|
-
cmds: []
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
checkFailures(http)
|
|
324
|
-
harness = new Harness(http)
|
|
325
|
-
harness.begin()
|
|
326
|
-
harness.pending = expectFailure(harness.app.logout(), "UiLogoutHttpError: 500")
|
|
327
|
-
return http.waitFor(1).then(()
|
|
328
|
-
capture harness
|
|
329
|
-
harness.http.respond(0, {
|
|
330
|
-
error: "InternalServerError"
|
|
331
|
-
}, "must-not-persist", 500)
|
|
332
|
-
return harness.pending
|
|
333
|
-
).then(()
|
|
334
|
-
capture harness
|
|
335
|
-
assertPaused(harness)
|
|
336
|
-
assert harness.tokens.latest() == "authenticated"
|
|
337
|
-
harness.pending = expectFailure(harness.app.logout(), "UiTokenBootstrapFailed")
|
|
338
|
-
return harness.http.waitFor(2)
|
|
339
|
-
).then(()
|
|
340
|
-
capture harness
|
|
341
|
-
harness.http.respond(1, {
|
|
342
|
-
loggedOut: true
|
|
343
|
-
})
|
|
344
|
-
return harness.http.waitFor(3)
|
|
345
|
-
).then(()
|
|
346
|
-
capture harness
|
|
347
|
-
harness.http.respond(2, {
|
|
348
|
-
error: "InternalServerError"
|
|
349
|
-
}, "must-not-persist", 500)
|
|
350
|
-
return harness.pending
|
|
351
|
-
).then(()
|
|
352
|
-
capture harness
|
|
353
|
-
assertPaused(harness)
|
|
354
|
-
assert harness.tokens.latest() == null
|
|
355
|
-
assert harness.storage.getItem("lango:last-token") == null
|
|
356
|
-
harness.pending = harness.app.logout()
|
|
357
|
-
return harness.http.waitFor(4)
|
|
358
|
-
).then(()
|
|
359
|
-
capture harness
|
|
360
|
-
assertRequest(harness.http.calls[3], "/_lango/start", "authenticated")
|
|
361
|
-
harness.http.respond(3, {
|
|
362
|
-
}, "anonymous")
|
|
363
|
-
return harness.pending
|
|
364
|
-
).then((token)
|
|
365
|
-
capture harness
|
|
366
|
-
assertResumed(harness)
|
|
367
|
-
println("PASS failed logout stays paused; failed bootstrap retries without revoking twice or persisting error headers")
|
|
368
|
-
).finally(()
|
|
369
|
-
capture harness
|
|
370
|
-
harness.app.dispose()
|
|
371
|
-
)
|
|
372
|
-
|
|
373
|
-
checkDisposal(http)
|
|
374
|
-
harness = new Harness(http)
|
|
375
|
-
harness.begin()
|
|
376
|
-
harness.pending = expectFailure(harness.app.logout(), "UiTokenOperationSuperseded")
|
|
377
|
-
return http.waitFor(1).then(()
|
|
378
|
-
capture harness
|
|
379
|
-
harness.http.respond(0, {
|
|
380
|
-
loggedOut: true
|
|
381
|
-
})
|
|
382
|
-
return harness.http.waitFor(2)
|
|
383
|
-
).then(()
|
|
384
|
-
capture harness
|
|
385
|
-
harness.app.dispose()
|
|
386
|
-
harness.http.respond(1, {
|
|
387
|
-
}, "must-not-persist")
|
|
388
|
-
return harness.pending
|
|
389
|
-
).then(()
|
|
390
|
-
capture harness
|
|
391
|
-
assert harness.tokens.latest() == null
|
|
392
|
-
assert harness.storage.getItem("lango:last-token") == null
|
|
393
|
-
assert harness.app.session("profile") == null
|
|
394
|
-
println("PASS disposal during anonymous bootstrap ignores the late token and never recreates forms")
|
|
395
|
-
)
|
|
396
|
-
|
|
397
|
-
checkStartupLogout(http)
|
|
398
|
-
harness = new Harness(http)
|
|
399
|
-
harness.begin(false, true)
|
|
400
|
-
harness.pending = harness.app.logout()
|
|
401
|
-
return http.waitFor(1).then(()
|
|
402
|
-
capture harness
|
|
403
|
-
assert harness.http.calls.length == 1
|
|
404
|
-
harness.http.respond(0, {
|
|
405
|
-
}, "startup-session")
|
|
406
|
-
return harness.http.waitFor(2)
|
|
407
|
-
).then(()
|
|
408
|
-
capture harness
|
|
409
|
-
assertRequest(harness.http.calls[1], "/_lango/logout", "startup-session")
|
|
410
|
-
harness.http.respond(1, {
|
|
411
|
-
loggedOut: true
|
|
412
|
-
})
|
|
413
|
-
return harness.http.waitFor(3)
|
|
414
|
-
).then(()
|
|
415
|
-
capture harness
|
|
416
|
-
assertRequest(harness.http.calls[2], "/_lango/start", "startup-session")
|
|
417
|
-
harness.http.respond(2, {
|
|
418
|
-
}, "anonymous")
|
|
419
|
-
return harness.pending
|
|
420
|
-
).then((token)
|
|
421
|
-
capture harness
|
|
422
|
-
assertResumed(harness)
|
|
423
|
-
println("PASS logout during startup waits for the actual session before revoking it")
|
|
424
|
-
).finally(()
|
|
425
|
-
capture harness
|
|
426
|
-
harness.app.dispose()
|
|
427
|
-
)
|
|
428
|
-
|
|
429
|
-
checkLatePing(http)
|
|
430
|
-
harness = new Harness(http)
|
|
431
|
-
harness.begin(true)
|
|
432
|
-
return http.waitFor(1).then(()
|
|
433
|
-
capture harness
|
|
434
|
-
assert harness.http.calls[0].path == "/_lango/ping"
|
|
435
|
-
harness.pending = harness.app.logout()
|
|
436
|
-
return harness.http.waitFor(2)
|
|
437
|
-
).then(()
|
|
438
|
-
capture harness
|
|
439
|
-
harness.http.respond(1, {
|
|
440
|
-
loggedOut: true
|
|
441
|
-
})
|
|
442
|
-
return harness.http.waitFor(3)
|
|
443
|
-
).then(()
|
|
444
|
-
capture harness
|
|
445
|
-
harness.http.respond(2, {
|
|
446
|
-
}, "anonymous")
|
|
447
|
-
return harness.pending
|
|
448
|
-
).then((token)
|
|
449
|
-
capture harness
|
|
450
|
-
assertResumed(harness)
|
|
451
|
-
return harness.http.waitFor(4)
|
|
452
|
-
).then(()
|
|
453
|
-
capture harness
|
|
454
|
-
capture timers
|
|
455
|
-
call = harness.http.calls[3]
|
|
456
|
-
assert call.path == "/_lango/ping"
|
|
457
|
-
for call.input.forms as form
|
|
458
|
-
assert form.token == "anonymous"
|
|
459
|
-
harness.app.dispose()
|
|
460
|
-
harness.http.respond(0, {
|
|
461
|
-
forms: [{
|
|
462
|
-
formId: "profile"
|
|
463
|
-
token: "late-ping"
|
|
464
|
-
}, {
|
|
465
|
-
formId: "[\"profile\",\"nested\"]"
|
|
466
|
-
token: "late-nested-ping"
|
|
467
|
-
}]
|
|
468
|
-
})
|
|
469
|
-
harness.http.respond(3, {
|
|
470
|
-
forms: []
|
|
471
|
-
})
|
|
472
|
-
return timers/setTimeout(20)
|
|
473
|
-
).then(()
|
|
474
|
-
capture harness
|
|
475
|
-
assert harness.tokens.latest() == "anonymous"
|
|
476
|
-
assert harness.storage.writes.length == 2
|
|
477
|
-
assert harness.http.calls.length == 4
|
|
478
|
-
println("PASS logout replaces the heartbeat, pings with anonymous tokens and ignores late batch renewals")
|
|
479
|
-
).finally(()
|
|
480
|
-
capture harness
|
|
481
|
-
harness.app.dispose()
|
|
482
|
-
)
|
|
483
|
-
|
|
484
|
-
checkSupersededBootstrap(http)
|
|
485
|
-
storage = new Storage()
|
|
486
|
-
tokens = new TokenStore(storage)
|
|
487
|
-
old = expectFailure(tokens.initialize("/first"), "UiTokenOperationSuperseded")
|
|
488
|
-
current = tokens.initialize("/second")
|
|
489
|
-
http.respond(1, {
|
|
490
|
-
}, "current")
|
|
491
|
-
return current.then((token)
|
|
492
|
-
capture http
|
|
493
|
-
capture tokens
|
|
494
|
-
capture old
|
|
495
|
-
assert tokens.latest() == "current"
|
|
496
|
-
http.respond(0, {
|
|
497
|
-
}, "stale")
|
|
498
|
-
return old
|
|
499
|
-
).then(()
|
|
500
|
-
capture tokens
|
|
501
|
-
capture storage
|
|
502
|
-
assert tokens.latest() == "current"
|
|
503
|
-
assert !tokens.initializing()
|
|
504
|
-
assert storage.writes.length == 1
|
|
505
|
-
println("PASS superseded bootstrap cannot replace newer memory or persisted credentials")
|
|
506
|
-
)
|
|
507
|
-
|
|
508
|
-
checkFailedStartupLogout(http)
|
|
509
|
-
harness = new Harness(http)
|
|
510
|
-
harness.begin(false, true)
|
|
511
|
-
harness.http.respond(0, {
|
|
512
|
-
error: "InternalServerError"
|
|
513
|
-
}, "must-not-persist", 500)
|
|
514
|
-
return expectFailure(harness.tokens.ready(), "UiTokenBootstrapFailed").then(()
|
|
515
|
-
capture harness
|
|
516
|
-
harness.pending = harness.app.logout()
|
|
517
|
-
return harness.http.waitFor(2)
|
|
518
|
-
).then(()
|
|
519
|
-
capture harness
|
|
520
|
-
assertRequest(harness.http.calls[1], "/_lango/logout", "authenticated")
|
|
521
|
-
harness.http.respond(1, {
|
|
522
|
-
loggedOut: true
|
|
523
|
-
})
|
|
524
|
-
return harness.http.waitFor(3)
|
|
525
|
-
).then(()
|
|
526
|
-
capture harness
|
|
527
|
-
harness.http.respond(2, {
|
|
528
|
-
}, "anonymous")
|
|
529
|
-
return harness.pending
|
|
530
|
-
).then((token)
|
|
531
|
-
capture harness
|
|
532
|
-
assertResumed(harness)
|
|
533
|
-
println("PASS failed startup does not prevent revocation of the previously stored session")
|
|
534
|
-
).finally(()
|
|
535
|
-
capture harness
|
|
536
|
-
harness.app.dispose()
|
|
537
|
-
)
|
|
538
|
-
|
|
539
|
-
checkRejectedLogout(http)
|
|
540
|
-
harness = new Harness(http)
|
|
541
|
-
harness.pending = expectFailure(harness.tokens.logout("/_lango/logout"), "UiLogoutHttpError: 401")
|
|
542
|
-
return http.waitFor(1).then(()
|
|
543
|
-
capture harness
|
|
544
|
-
harness.http.respond(0, {
|
|
545
|
-
error: "Unauthorized"
|
|
546
|
-
}, "must-not-persist", 401)
|
|
547
|
-
return harness.pending
|
|
548
|
-
).then(()
|
|
549
|
-
capture harness
|
|
550
|
-
harness.pending = expectFailure(harness.tokens.logout("/_lango/logout"), "UiInvalidLogoutResponse")
|
|
551
|
-
return harness.http.waitFor(2)
|
|
552
|
-
).then(()
|
|
553
|
-
capture harness
|
|
554
|
-
harness.http.respond(1, {
|
|
555
|
-
loggedOut: false
|
|
556
|
-
}, "must-not-persist")
|
|
557
|
-
return harness.pending
|
|
558
|
-
).then(()
|
|
559
|
-
capture harness
|
|
560
|
-
assert harness.tokens.latest() == "authenticated"
|
|
561
|
-
assert harness.storage.getItem("lango:last-token") == "authenticated"
|
|
562
|
-
assert harness.storage.writes.length == 1
|
|
563
|
-
println("PASS unauthorized and unacknowledged logout responses never clear or replace stored credentials")
|
|
564
|
-
)
|