@lango-project/lango-client 0.2.0 → 0.4.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/LICENSE +1 -0
- package/NOTICE +5 -1
- package/README.md +571 -855
- package/cli/.lango/localization.mjs +108 -0
- package/{dist/node → cli}/.lango/runtime.mjs +112 -19
- 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 +112 -19
- 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 +636 -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 +95 -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 +139 -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/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 -775
- package/dist/library.mjs.map +1 -1
- package/dist/longpoll.mjs +254 -0
- package/dist/longpoll.mjs.map +1 -0
- package/dist/main.mjs +138 -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 +293 -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/tables.mjs +369 -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 +2540 -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 +42 -0
- package/package.json +26 -40
- package/src/accordion.lango +198 -0
- package/src/activities.lango +132 -0
- package/src/app.lango +508 -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 +100 -0
- package/src/create.lango +42 -0
- package/src/date_input.lango +215 -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 -571
- package/src/longpoll.lango +187 -0
- package/src/main.lango +109 -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 +288 -0
- package/src/rich_content.lango +66 -0
- package/src/tables.lango +271 -0
- package/src/tabs.lango +144 -0
- package/src/templates.lango +29 -0
- package/src/widgets.lango +141 -0
- package/web/client.css +95 -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 -431
- 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 -302
- 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 -72
- package/examples/demo_test.lango +0 -356
- package/examples/index.html +0 -28
- package/examples/pages.lango +0 -180
- 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 -1986
- package/src/session.lango +0 -313
- 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 -40
- package/template/gitignore +0 -4
- package/template/package.json +0 -22
- package/template/public/app.css +0 -4
- 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/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/session.lango
DELETED
|
@@ -1,313 +0,0 @@
|
|
|
1
|
-
import js global Promise
|
|
2
|
-
import js global fetch
|
|
3
|
-
import js global crypto
|
|
4
|
-
import "./protocol"
|
|
5
|
-
collectValues(controls)
|
|
6
|
-
applyOwnedResponse(controls, response, formId, seqno, effects, ownerControls)
|
|
7
|
-
protocolVersion()
|
|
8
|
-
import "./tokens"
|
|
9
|
-
browserTokenStore(key = "lango:last-token")
|
|
10
|
-
import "./form_state"
|
|
11
|
-
dirtyFields(controls)
|
|
12
|
-
validateFields(controls)
|
|
13
|
-
validatesRequest(controls, name)
|
|
14
|
-
confirmsRequest(controls, name)
|
|
15
|
-
ownedFields(controls)
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
export class Session
|
|
19
|
-
methods
|
|
20
|
-
send(path, event, name)
|
|
21
|
-
perform(path, event, name)
|
|
22
|
-
finish(reservation = null)
|
|
23
|
-
accept(response, seqno, controls = null)
|
|
24
|
-
dispose()
|
|
25
|
-
receiveToken(token)
|
|
26
|
-
performReady(path, event, name, bootstrapToken = null)
|
|
27
|
-
initializeToken(bootstrapToken)
|
|
28
|
-
reservePing(gate)
|
|
29
|
-
preparePing()
|
|
30
|
-
pingEntry(bootstrapToken = null)
|
|
31
|
-
isDirty()
|
|
32
|
-
validate(report = true)
|
|
33
|
-
currentControls()
|
|
34
|
-
reportErrors()
|
|
35
|
-
|
|
36
|
-
Session(options)
|
|
37
|
-
if !is_string(options.formId) or options.formId == ""
|
|
38
|
-
throw "UiSessionRequiresFormId"
|
|
39
|
-
@formId = options.formId
|
|
40
|
-
@formInstanceId = crypto.randomUUID()
|
|
41
|
-
@controls = options.controls
|
|
42
|
-
@root = options.root
|
|
43
|
-
@effects = options.effects
|
|
44
|
-
@transport = options.transport
|
|
45
|
-
@tokens = options.tokens
|
|
46
|
-
if @tokens == null
|
|
47
|
-
@tokens = browserTokenStore()
|
|
48
|
-
@token = @tokens.latest()
|
|
49
|
-
@seedFromBootstrap = options.seedFromBootstrap == true
|
|
50
|
-
if @seedFromBootstrap
|
|
51
|
-
@token = options.seedToken
|
|
52
|
-
@initialized = false
|
|
53
|
-
@awaitingBootstrap = false
|
|
54
|
-
if @tokens.initializing != null
|
|
55
|
-
@awaitingBootstrap = @tokens.initializing()
|
|
56
|
-
@lifecycle = options.lifecycle
|
|
57
|
-
@heartbeat = options.heartbeat
|
|
58
|
-
@coordinator = options.coordinator
|
|
59
|
-
@resources = options.resources
|
|
60
|
-
@form = options.form
|
|
61
|
-
@window = options.window
|
|
62
|
-
@reservations = []
|
|
63
|
-
@disposed = false
|
|
64
|
-
@seqno = 0
|
|
65
|
-
@pending = 0
|
|
66
|
-
@tail = Promise/resolve()
|
|
67
|
-
|
|
68
|
-
Session:send(path, event, name)
|
|
69
|
-
if @disposed
|
|
70
|
-
throw "UiSessionDisposed"
|
|
71
|
-
if !is_string(path) or !path.startsWith("/") or path.startsWith("//") or path.includes("\\")
|
|
72
|
-
throw "UiSessionRequiresSameOriginPath"
|
|
73
|
-
if confirmsRequest(currentControls(), name) and isDirty()
|
|
74
|
-
if @window == null or !is_kindof(@window.confirm, Function)
|
|
75
|
-
throw "UiDiscardConfirmationUnavailable"
|
|
76
|
-
if !@window.confirm("You have unsaved changes. Discard them?")
|
|
77
|
-
return Promise/resolve(false)
|
|
78
|
-
if @heartbeat != null
|
|
79
|
-
@heartbeat.activity()
|
|
80
|
-
reservation = null
|
|
81
|
-
if @coordinator != null
|
|
82
|
-
reservation = @coordinator.reserve(@resources)
|
|
83
|
-
@reservations.add(reservation)
|
|
84
|
-
@pending++
|
|
85
|
-
if @root != null
|
|
86
|
-
@root.inert = true
|
|
87
|
-
@root.setAttribute("aria-busy", "true")
|
|
88
|
-
waiting = [@tail]
|
|
89
|
-
if reservation != null
|
|
90
|
-
waiting.add(reservation.ready)
|
|
91
|
-
ready = Promise/all(waiting)
|
|
92
|
-
work = ready.then(()
|
|
93
|
-
capture path
|
|
94
|
-
capture event
|
|
95
|
-
capture name
|
|
96
|
-
return perform(path, event, name)
|
|
97
|
-
)
|
|
98
|
-
recovered = work.catch((error)
|
|
99
|
-
ignoreFailure(error)
|
|
100
|
-
)
|
|
101
|
-
@tail = recovered
|
|
102
|
-
return work.finally(()
|
|
103
|
-
capture reservation
|
|
104
|
-
finish(reservation)
|
|
105
|
-
).catch((error)
|
|
106
|
-
if error == "UiValidationFailed" and !@disposed and @pending == 0
|
|
107
|
-
validate()
|
|
108
|
-
throw error
|
|
109
|
-
)
|
|
110
|
-
|
|
111
|
-
ignoreFailure(error)
|
|
112
|
-
return null
|
|
113
|
-
|
|
114
|
-
Session:finish(reservation = null)
|
|
115
|
-
if reservation != null
|
|
116
|
-
@coordinator.release(reservation)
|
|
117
|
-
index = @reservations.indexOf(reservation)
|
|
118
|
-
if index >= 0
|
|
119
|
-
@reservations.splice(index, 1)
|
|
120
|
-
@pending--
|
|
121
|
-
if @disposed
|
|
122
|
-
return null
|
|
123
|
-
if @heartbeat != null
|
|
124
|
-
@heartbeat.activity()
|
|
125
|
-
if @pending == 0 and @root != null
|
|
126
|
-
@root.inert = false
|
|
127
|
-
@root.setAttribute("aria-busy", "false")
|
|
128
|
-
if @pending == 0
|
|
129
|
-
reportErrors()
|
|
130
|
-
return null
|
|
131
|
-
|
|
132
|
-
Session:perform(path, event, name)
|
|
133
|
-
if @tokens.ready != null
|
|
134
|
-
return @tokens.ready().then((bootstrapToken)
|
|
135
|
-
capture path
|
|
136
|
-
capture event
|
|
137
|
-
capture name
|
|
138
|
-
return performReady(path, event, name, bootstrapToken)
|
|
139
|
-
)
|
|
140
|
-
return performReady(path, event, name)
|
|
141
|
-
|
|
142
|
-
Session:performReady(path, event, name, bootstrapToken = null)
|
|
143
|
-
if @disposed
|
|
144
|
-
throw "UiSessionDisposed"
|
|
145
|
-
initializeToken(bootstrapToken)
|
|
146
|
-
controls = currentControls()
|
|
147
|
-
if validatesRequest(controls, name)
|
|
148
|
-
issues = validate(false)
|
|
149
|
-
if issues.length != 0
|
|
150
|
-
throw "UiValidationFailed"
|
|
151
|
-
@seqno++
|
|
152
|
-
if @seqno > 9007199254740991
|
|
153
|
-
throw "UiSessionSequenceExhausted"
|
|
154
|
-
seqno = @seqno
|
|
155
|
-
formId = @formId
|
|
156
|
-
input = {
|
|
157
|
-
protocol: protocolVersion()
|
|
158
|
-
formId: formId
|
|
159
|
-
formInstanceId: @formInstanceId
|
|
160
|
-
seqno: seqno
|
|
161
|
-
event: event
|
|
162
|
-
name: name
|
|
163
|
-
values: collectValues(controls)
|
|
164
|
-
}
|
|
165
|
-
transport = @transport
|
|
166
|
-
result = null
|
|
167
|
-
if transport == null
|
|
168
|
-
result = post(path, input, @token, @this)
|
|
169
|
-
else
|
|
170
|
-
result = transport.send(path, input, @token)
|
|
171
|
-
return result.then((response)
|
|
172
|
-
capture seqno
|
|
173
|
-
capture controls
|
|
174
|
-
return accept(response, seqno, controls)
|
|
175
|
-
)
|
|
176
|
-
|
|
177
|
-
Session:currentControls()
|
|
178
|
-
if @disposed
|
|
179
|
-
throw "UiSessionDisposed"
|
|
180
|
-
if @form != null and @lifecycle != null
|
|
181
|
-
return @lifecycle.controlsFor(@form)
|
|
182
|
-
return @controls
|
|
183
|
-
|
|
184
|
-
Session:isDirty()
|
|
185
|
-
if @disposed
|
|
186
|
-
return false
|
|
187
|
-
return dirtyFields(currentControls())
|
|
188
|
-
|
|
189
|
-
Session:validate(report = true)
|
|
190
|
-
issues = validateFields(currentControls())
|
|
191
|
-
if report and issues.length != 0
|
|
192
|
-
first = issues[0].control
|
|
193
|
-
if first.reportValidity != null
|
|
194
|
-
first.reportValidity()
|
|
195
|
-
return issues
|
|
196
|
-
|
|
197
|
-
Session:reportErrors()
|
|
198
|
-
fields = ownedFields(currentControls())
|
|
199
|
-
for fields as field
|
|
200
|
-
control = field.control
|
|
201
|
-
if is_kindof(control.reportPendingError, Function)
|
|
202
|
-
if control.reportPendingError()
|
|
203
|
-
return null
|
|
204
|
-
return null
|
|
205
|
-
|
|
206
|
-
Session:initializeToken(bootstrapToken)
|
|
207
|
-
if !@initialized
|
|
208
|
-
if @awaitingBootstrap
|
|
209
|
-
@token = bootstrapToken
|
|
210
|
-
else
|
|
211
|
-
if @seedFromBootstrap and bootstrapToken != null
|
|
212
|
-
@token = bootstrapToken
|
|
213
|
-
@initialized = true
|
|
214
|
-
return null
|
|
215
|
-
|
|
216
|
-
Session:reservePing(gate)
|
|
217
|
-
if @disposed
|
|
218
|
-
return Promise/resolve(null)
|
|
219
|
-
ready = @tail
|
|
220
|
-
@tail = gate
|
|
221
|
-
return ready.then(()
|
|
222
|
-
return preparePing()
|
|
223
|
-
)
|
|
224
|
-
|
|
225
|
-
Session:preparePing()
|
|
226
|
-
if @disposed
|
|
227
|
-
return null
|
|
228
|
-
if @tokens.ready != null
|
|
229
|
-
return @tokens.ready().then((bootstrapToken)
|
|
230
|
-
return pingEntry(bootstrapToken)
|
|
231
|
-
)
|
|
232
|
-
return pingEntry()
|
|
233
|
-
|
|
234
|
-
Session:pingEntry(bootstrapToken = null)
|
|
235
|
-
if @disposed
|
|
236
|
-
return null
|
|
237
|
-
initializeToken(bootstrapToken)
|
|
238
|
-
if @token == null
|
|
239
|
-
return null
|
|
240
|
-
return {
|
|
241
|
-
formId: @formId
|
|
242
|
-
token: @token
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
Session:accept(response, seqno, controls = null)
|
|
246
|
-
if @disposed
|
|
247
|
-
throw "UiSessionDisposed"
|
|
248
|
-
body = response
|
|
249
|
-
receivedToken = null
|
|
250
|
-
if response.body != null
|
|
251
|
-
body = response.body
|
|
252
|
-
receivedToken = response.token
|
|
253
|
-
if receivedToken != null
|
|
254
|
-
receiveToken(receivedToken)
|
|
255
|
-
if body.formId != @formId or body.seqno != seqno
|
|
256
|
-
throw "UiClientResponseDoesNotMatchRequest"
|
|
257
|
-
effective = controls
|
|
258
|
-
if effective == null
|
|
259
|
-
effective = @controls
|
|
260
|
-
try
|
|
261
|
-
applyOwnedResponse(effective, body, @formId, seqno, @effects, @controls)
|
|
262
|
-
finally
|
|
263
|
-
if @lifecycle != null
|
|
264
|
-
@lifecycle.reconcile()
|
|
265
|
-
return body
|
|
266
|
-
|
|
267
|
-
Session:receiveToken(token)
|
|
268
|
-
if @disposed
|
|
269
|
-
return null
|
|
270
|
-
@tokens.save(token)
|
|
271
|
-
@token = token
|
|
272
|
-
return null
|
|
273
|
-
|
|
274
|
-
Session:dispose()
|
|
275
|
-
if @disposed
|
|
276
|
-
return null
|
|
277
|
-
@disposed = true
|
|
278
|
-
if @coordinator != null
|
|
279
|
-
for @reservations as reservation
|
|
280
|
-
@coordinator.release(reservation)
|
|
281
|
-
@reservations = []
|
|
282
|
-
if @root != null
|
|
283
|
-
@root.inert = false
|
|
284
|
-
@root.setAttribute("aria-busy", "false")
|
|
285
|
-
return null
|
|
286
|
-
|
|
287
|
-
post(path, input, token, client)
|
|
288
|
-
headers = {
|
|
289
|
-
"Content-Type": "application/json"
|
|
290
|
-
}
|
|
291
|
-
if token != null
|
|
292
|
-
headers.Authorization = "Bearer ${token}"
|
|
293
|
-
return fetch(path, {
|
|
294
|
-
method: "POST"
|
|
295
|
-
headers: headers
|
|
296
|
-
body: to_json(input)
|
|
297
|
-
cache: "no-store"
|
|
298
|
-
redirect: "error"
|
|
299
|
-
}).then((response)
|
|
300
|
-
capture client
|
|
301
|
-
return readResponse(response, client)
|
|
302
|
-
)
|
|
303
|
-
|
|
304
|
-
readResponse(response, client)
|
|
305
|
-
token = response.headers.get("X-Lango-Token")
|
|
306
|
-
if token != null
|
|
307
|
-
client.receiveToken(token)
|
|
308
|
-
return response.json().then((body)
|
|
309
|
-
capture response
|
|
310
|
-
if !response.ok
|
|
311
|
-
throw "UiHttpError: ${response.status}: ${body.error}"
|
|
312
|
-
return body
|
|
313
|
-
)
|