@iebh/tera-fy 1.12.0 → 1.13.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/CHANGELOG.md +14 -0
- package/api.md +295 -234
- package/dist/plugin.vue2.es2019.js +1 -1
- package/dist/terafy.es2019.js +2 -2
- package/dist/terafy.js +2 -2
- package/eslint.config.js +14 -0
- package/lib/terafy.client.js +86 -6
- package/lib/terafy.server.js +97 -1
- package/package.json +8 -18
package/api.md
CHANGED
|
@@ -139,12 +139,18 @@
|
|
|
139
139
|
* [Parameters][135]
|
|
140
140
|
* [uiAlert][136]
|
|
141
141
|
* [Parameters][137]
|
|
142
|
-
* [
|
|
142
|
+
* [uiConfirm][138]
|
|
143
143
|
* [Parameters][139]
|
|
144
|
-
* [
|
|
144
|
+
* [uiProgress][140]
|
|
145
145
|
* [Parameters][141]
|
|
146
|
-
* [
|
|
146
|
+
* [uiPrompt][142]
|
|
147
147
|
* [Parameters][143]
|
|
148
|
+
* [uiThrow][144]
|
|
149
|
+
* [Parameters][145]
|
|
150
|
+
* [uiWindow][146]
|
|
151
|
+
* [Parameters][147]
|
|
152
|
+
* [uiSplat][148]
|
|
153
|
+
* [Parameters][149]
|
|
148
154
|
|
|
149
155
|
## ProjectFile
|
|
150
156
|
|
|
@@ -154,113 +160,113 @@ A project file fetched from TERA
|
|
|
154
160
|
|
|
155
161
|
A UUID string representing the unique ID of the file
|
|
156
162
|
|
|
157
|
-
Type: [String][
|
|
163
|
+
Type: [String][150]
|
|
158
164
|
|
|
159
165
|
### name
|
|
160
166
|
|
|
161
167
|
Relative name path (can contain prefix directories) for the human readable file name
|
|
162
168
|
|
|
163
|
-
Type: [String][
|
|
169
|
+
Type: [String][150]
|
|
164
170
|
|
|
165
171
|
### icon
|
|
166
172
|
|
|
167
173
|
CSS class to use as the file icon
|
|
168
174
|
|
|
169
|
-
Type: [String][
|
|
175
|
+
Type: [String][150]
|
|
170
176
|
|
|
171
177
|
### path
|
|
172
178
|
|
|
173
179
|
Full path to the file
|
|
174
180
|
This is also used as the unique identifier within the project
|
|
175
181
|
|
|
176
|
-
Type: [String][
|
|
182
|
+
Type: [String][150]
|
|
177
183
|
|
|
178
184
|
### url
|
|
179
185
|
|
|
180
186
|
Fully qualified URL to view / access / download the file from TERA
|
|
181
187
|
This will usually open an edit UI within the TERA site
|
|
182
188
|
|
|
183
|
-
Type: [String][
|
|
189
|
+
Type: [String][150]
|
|
184
190
|
|
|
185
191
|
### teraUrl
|
|
186
192
|
|
|
187
193
|
Rewrite of the URL where the absolute URL has been removed in place of a relative path, assuming the owner project is active
|
|
188
194
|
This is used to direct to the edit/view/download UI when the files project is active and is usually used in place of URL for TERA related operations
|
|
189
195
|
|
|
190
|
-
Type: [String][
|
|
196
|
+
Type: [String][150]
|
|
191
197
|
|
|
192
198
|
### parsedName
|
|
193
199
|
|
|
194
200
|
An object representing meta file parts of a file name
|
|
195
201
|
|
|
196
|
-
Type: [Object][
|
|
202
|
+
Type: [Object][151]
|
|
197
203
|
|
|
198
204
|
#### Properties
|
|
199
205
|
|
|
200
|
-
* `basename` **[String][
|
|
201
|
-
* `filename` **[String][
|
|
202
|
-
* `ext` **[String][
|
|
203
|
-
* `dirName` **[String][
|
|
206
|
+
* `basename` **[String][150]** The filename + extention (i.e. everything without directory name)
|
|
207
|
+
* `filename` **[String][150]** The file portion of the name (basename without the extension)
|
|
208
|
+
* `ext` **[String][150]** The extension portion of the name (always lower case)
|
|
209
|
+
* `dirName` **[String][150]** The directory path portion of the name
|
|
204
210
|
|
|
205
211
|
### created
|
|
206
212
|
|
|
207
213
|
A date representing when the file was created
|
|
208
214
|
|
|
209
|
-
Type: [Date][
|
|
215
|
+
Type: [Date][152]
|
|
210
216
|
|
|
211
217
|
### createdFormatted
|
|
212
218
|
|
|
213
219
|
A human readable, formatted version of "created"
|
|
214
220
|
|
|
215
|
-
Type: [String][
|
|
221
|
+
Type: [String][150]
|
|
216
222
|
|
|
217
223
|
### modified
|
|
218
224
|
|
|
219
225
|
A date representing when the file was created
|
|
220
226
|
|
|
221
|
-
Type: [Date][
|
|
227
|
+
Type: [Date][152]
|
|
222
228
|
|
|
223
229
|
### modifiedFormatted
|
|
224
230
|
|
|
225
231
|
A human readable, formatted version of "modified"
|
|
226
232
|
|
|
227
|
-
Type: [String][
|
|
233
|
+
Type: [String][150]
|
|
228
234
|
|
|
229
235
|
### accessed
|
|
230
236
|
|
|
231
237
|
A date representing when the file was last accessed
|
|
232
238
|
|
|
233
|
-
Type: [Date][
|
|
239
|
+
Type: [Date][152]
|
|
234
240
|
|
|
235
241
|
### accessedFormatted
|
|
236
242
|
|
|
237
243
|
A human readable, formatted version of "accessed"
|
|
238
244
|
|
|
239
|
-
Type: [String][
|
|
245
|
+
Type: [String][150]
|
|
240
246
|
|
|
241
247
|
### size
|
|
242
248
|
|
|
243
249
|
Size, in bytes, of the file
|
|
244
250
|
|
|
245
|
-
Type: [Number][
|
|
251
|
+
Type: [Number][153]
|
|
246
252
|
|
|
247
253
|
### sizeFormatted
|
|
248
254
|
|
|
249
255
|
A human readable, formatted version of the file size
|
|
250
256
|
|
|
251
|
-
Type: [String][
|
|
257
|
+
Type: [String][150]
|
|
252
258
|
|
|
253
259
|
### mime
|
|
254
260
|
|
|
255
261
|
The associated mime type for the file
|
|
256
262
|
|
|
257
|
-
Type: [String][
|
|
263
|
+
Type: [String][150]
|
|
258
264
|
|
|
259
265
|
### meta
|
|
260
266
|
|
|
261
267
|
Additional meta information for the file
|
|
262
268
|
|
|
263
|
-
Type: [Object][
|
|
269
|
+
Type: [Object][151]
|
|
264
270
|
|
|
265
271
|
### getContents
|
|
266
272
|
|
|
@@ -270,7 +276,7 @@ Fetch the raw file contents as a Blob
|
|
|
270
276
|
|
|
271
277
|
#### Parameters
|
|
272
278
|
|
|
273
|
-
* `options` **[Object][
|
|
279
|
+
* `options` **[Object][151]?** Additioanl options to mutate behaviourreturns {Blob} The eventual raw file contents as a Blob
|
|
274
280
|
|
|
275
281
|
### setContents
|
|
276
282
|
|
|
@@ -280,9 +286,9 @@ Overwrite the contents of a file with new content
|
|
|
280
286
|
|
|
281
287
|
#### Parameters
|
|
282
288
|
|
|
283
|
-
* `contents` **(File | [Blob][
|
|
289
|
+
* `contents` **(File | [Blob][154] | [FormData][155] | [Object][151] | [Array][156])** The new file contents
|
|
284
290
|
|
|
285
|
-
Returns **[Promise][
|
|
291
|
+
Returns **[Promise][157]** A promise which resolves when the operation has completed
|
|
286
292
|
|
|
287
293
|
### getRefs
|
|
288
294
|
|
|
@@ -290,7 +296,7 @@ Returns **[Promise][151]** A promise which resolves when the operation has compl
|
|
|
290
296
|
|
|
291
297
|
Fetch the file contents as an array of Reflib refs
|
|
292
298
|
|
|
293
|
-
Returns **[Promise][
|
|
299
|
+
Returns **[Promise][157]<[Array][156]\<Ref>>** An eventual array of RefLib references
|
|
294
300
|
|
|
295
301
|
### setRefs
|
|
296
302
|
|
|
@@ -301,18 +307,18 @@ Overwrite the contents of a file with a new collection of Reflib refs
|
|
|
301
307
|
#### Parameters
|
|
302
308
|
|
|
303
309
|
* `refs`  
|
|
304
|
-
* `Collection` **[Array][
|
|
310
|
+
* `Collection` **[Array][156]\<RefLibRef>** of references for the selected library
|
|
305
311
|
|
|
306
|
-
Returns **[Promise][
|
|
312
|
+
Returns **[Promise][157]** A promise which resolves when the operation has completed
|
|
307
313
|
|
|
308
314
|
### serialize
|
|
309
315
|
|
|
310
|
-
* **See**: [https://developer.mozilla.org/en-US/docs/Web/API/Web\_Workers\_API/Structured\_clone\_algorithm][
|
|
316
|
+
* **See**: [https://developer.mozilla.org/en-US/docs/Web/API/Web\_Workers\_API/Structured\_clone\_algorithm][158]
|
|
311
317
|
|
|
312
318
|
Compress a file state down into a serializable entity
|
|
313
319
|
By default this computes a Structured Clone which can be stringified
|
|
314
320
|
|
|
315
|
-
Returns **[Object][
|
|
321
|
+
Returns **[Object][151]** A Structured Clone compatible representation of this ProjectFile instance
|
|
316
322
|
|
|
317
323
|
### deserialize
|
|
318
324
|
|
|
@@ -320,7 +326,7 @@ Restore an entity created with serialize
|
|
|
320
326
|
|
|
321
327
|
#### Parameters
|
|
322
328
|
|
|
323
|
-
* `data` **[Object][
|
|
329
|
+
* `data` **[Object][151]** An input object created via `ProjectFiles.serialize()`
|
|
324
330
|
|
|
325
331
|
Returns **[ProjectFile][1]** A ProjectFile instance setup against the deserializzed data
|
|
326
332
|
|
|
@@ -332,20 +338,21 @@ Main Tera-Fy Client (class singleton) to be used in a frontend browser
|
|
|
332
338
|
|
|
333
339
|
Various settings to configure behaviour
|
|
334
340
|
|
|
335
|
-
Type: [Object][
|
|
341
|
+
Type: [Object][151]
|
|
336
342
|
|
|
337
343
|
#### Properties
|
|
338
344
|
|
|
339
|
-
* `devMode` **[Boolean][
|
|
340
|
-
* `verbosity` **[Number][
|
|
345
|
+
* `devMode` **[Boolean][159]** Operate in devMode - i.e. force outer refresh when encountering an existing TeraFy instance
|
|
346
|
+
* `verbosity` **[Number][153]** Verbosity level, the higher the more chatty TeraFY will be. Set to zero to disable all `debug()` call output
|
|
341
347
|
* `mode` **(`"detect"` | `"parent"` | `"child"` | `"popup"`)** How to communicate with TERA. 'parent' assumes that the parent of the current document is TERA, 'child' spawns an iFrame and uses TERA there, 'detect' tries parent and switches to `modeFallback` if communication fails
|
|
342
|
-
* `modeFallback` **[String][
|
|
343
|
-
* `modeTimeout` **[Number][
|
|
344
|
-
* `siteUrl` **[String][
|
|
345
|
-
* `restrictOrigin` **[String][
|
|
346
|
-
* `List` **[Array][
|
|
347
|
-
* `handshakeInterval` **[Number][
|
|
348
|
-
* `handshakeTimeout` **[Number][
|
|
348
|
+
* `modeFallback` **[String][150]** Method to use when all method detection fails
|
|
349
|
+
* `modeTimeout` **[Number][153]** How long entities have in 'detect' mode to identify themselves
|
|
350
|
+
* `siteUrl` **[String][150]** The TERA URL to connect to
|
|
351
|
+
* `restrictOrigin` **[String][150]** URL to restrict communications to
|
|
352
|
+
* `List` **[Array][156]<[String][150]>** of sandbox allowables for the embedded if in embed mode
|
|
353
|
+
* `handshakeInterval` **[Number][153]** Interval in milliseconds when sanning for a handshake
|
|
354
|
+
* `handshakeTimeout` **[Number][153]** Interval in milliseconds for when to give up trying to handshake
|
|
355
|
+
* `debugPaths` **[Array][156]<([String][150] | [Array][156]<[String][150]>)>?** List of paths (in either dotted or array notation) to enter debugging mode if a change is detected in dev mode e.g. `{debugPaths: ['foo.bar.baz']}`. This really slows down state writes so should only be used for debugging
|
|
349
356
|
|
|
350
357
|
### events
|
|
351
358
|
|
|
@@ -357,13 +364,13 @@ Type: Mitt
|
|
|
357
364
|
|
|
358
365
|
DOMElements for this TeraFy instance
|
|
359
366
|
|
|
360
|
-
Type: [Object][
|
|
367
|
+
Type: [Object][151]
|
|
361
368
|
|
|
362
369
|
#### Properties
|
|
363
370
|
|
|
364
371
|
* `el` **DOMElement** The main tera-fy div wrapper
|
|
365
372
|
* `iframe` **DOMElement** The internal iFrame element (if `settings.mode == 'child'`)
|
|
366
|
-
* `popup` **[Window][
|
|
373
|
+
* `popup` **[Window][160]** The popup window context (if `settings.mode == 'popup'`)
|
|
367
374
|
* `stylesheet` **DOMElement** The corresponding stylesheet
|
|
368
375
|
|
|
369
376
|
### methods
|
|
@@ -371,13 +378,13 @@ Type: [Object][145]
|
|
|
371
378
|
List of function stubs mapped from the server to here
|
|
372
379
|
This array is forms the reference of `TeraFy.METHOD()` objects to provide locally which will be mapped via `TeraFy.rpc(METHOD, ...args)`
|
|
373
380
|
|
|
374
|
-
Type: [Array][
|
|
381
|
+
Type: [Array][156]<[String][150]>
|
|
375
382
|
|
|
376
383
|
### plugins
|
|
377
384
|
|
|
378
385
|
Loaded plugins via Use()
|
|
379
386
|
|
|
380
|
-
Type: [Array][
|
|
387
|
+
Type: [Array][156]\<TeraFyPlugin>
|
|
381
388
|
|
|
382
389
|
### send
|
|
383
390
|
|
|
@@ -385,9 +392,9 @@ Send a message + wait for a response object
|
|
|
385
392
|
|
|
386
393
|
#### Parameters
|
|
387
394
|
|
|
388
|
-
* `message` **[Object][
|
|
395
|
+
* `message` **[Object][151]** Message object to send
|
|
389
396
|
|
|
390
|
-
Returns **[Promise][
|
|
397
|
+
Returns **[Promise][157]\<any>** A promise which resolves when the operation has completed with the remote reply
|
|
391
398
|
|
|
392
399
|
### sendRaw
|
|
393
400
|
|
|
@@ -396,7 +403,7 @@ This function does not return or wait for a reply - use `send()` for that
|
|
|
396
403
|
|
|
397
404
|
#### Parameters
|
|
398
405
|
|
|
399
|
-
* `message` **[Object][
|
|
406
|
+
* `message` **[Object][151]** Message object to send
|
|
400
407
|
|
|
401
408
|
### rpc
|
|
402
409
|
|
|
@@ -404,10 +411,10 @@ Call an RPC function in the server instance
|
|
|
404
411
|
|
|
405
412
|
#### Parameters
|
|
406
413
|
|
|
407
|
-
* `method` **[String][
|
|
414
|
+
* `method` **[String][150]** The method name to call
|
|
408
415
|
* `args` **...any** 
|
|
409
416
|
|
|
410
|
-
Returns **[Promise][
|
|
417
|
+
Returns **[Promise][157]\<any>** The resolved output of the server function
|
|
411
418
|
|
|
412
419
|
### acceptMessage
|
|
413
420
|
|
|
@@ -416,7 +423,7 @@ Accept an incoming message
|
|
|
416
423
|
#### Parameters
|
|
417
424
|
|
|
418
425
|
* `rawMessage`  
|
|
419
|
-
* `Raw` **[MessageEvent][
|
|
426
|
+
* `Raw` **[MessageEvent][161]** message event to process
|
|
420
427
|
|
|
421
428
|
### acceptPostboxes
|
|
422
429
|
|
|
@@ -425,27 +432,27 @@ Listening postboxes, these correspond to outgoing message IDs that expect a resp
|
|
|
425
432
|
### createProjectStatePatch
|
|
426
433
|
|
|
427
434
|
Create + transmit a new project state patch base on the current and previous states
|
|
428
|
-
The transmitted patch follows the [JSPatch][
|
|
435
|
+
The transmitted patch follows the [JSPatch][162] standard
|
|
429
436
|
This function accepts an entire projectState instance, computes the delta and transmits that to the server for merging
|
|
430
437
|
|
|
431
438
|
#### Parameters
|
|
432
439
|
|
|
433
|
-
* `newState` **[Object][
|
|
434
|
-
* `oldState` **[Object][
|
|
440
|
+
* `newState` **[Object][151]** The local projectState to accept
|
|
441
|
+
* `oldState` **[Object][151]** The previous projectState to examine against
|
|
435
442
|
|
|
436
|
-
Returns **[Promise][
|
|
443
|
+
Returns **[Promise][157]** A promise which will resolve when the operation has completed
|
|
437
444
|
|
|
438
445
|
### applyProjectStatePatchLocal
|
|
439
446
|
|
|
440
447
|
Client function which accepts a patch from the server and applies it to local project state
|
|
441
|
-
The patch should follow the [JSPatch][
|
|
448
|
+
The patch should follow the [JSPatch][162] standard
|
|
442
449
|
This function is expected to be sub-classed by a plugin
|
|
443
450
|
|
|
444
451
|
#### Parameters
|
|
445
452
|
|
|
446
|
-
* `patch` **[Array][
|
|
453
|
+
* `patch` **[Array][156]** A JSPatch patch to apply
|
|
447
454
|
|
|
448
|
-
Returns **[Promise][
|
|
455
|
+
Returns **[Promise][157]** A promise which will resolve when the operation has completed
|
|
449
456
|
|
|
450
457
|
### init
|
|
451
458
|
|
|
@@ -454,22 +461,22 @@ This function can only be called once and will return the existing init() worker
|
|
|
454
461
|
|
|
455
462
|
#### Parameters
|
|
456
463
|
|
|
457
|
-
* `options` **[Object][
|
|
464
|
+
* `options` **[Object][151]?** Additional options to merge into `settings` via `set`
|
|
458
465
|
|
|
459
|
-
Returns **[Promise][
|
|
466
|
+
Returns **[Promise][157]<[TeraFy][30]>** An eventual promise which will resovle with this terafy instance
|
|
460
467
|
|
|
461
468
|
### detectMode
|
|
462
469
|
|
|
463
470
|
Populate `settings.mode`
|
|
464
471
|
Try to communicate with a parent frame, if none assume we need to fallback to child mode
|
|
465
472
|
|
|
466
|
-
Returns **[Promise][
|
|
473
|
+
Returns **[Promise][157]<[String][150]>** A promise which will resolve with the detected mode to use
|
|
467
474
|
|
|
468
475
|
### injectComms
|
|
469
476
|
|
|
470
477
|
Find an existing active TERA server OR initalize one
|
|
471
478
|
|
|
472
|
-
Returns **[Promise][
|
|
479
|
+
Returns **[Promise][157]** A promise which will resolve when the loading has completed and we have found a parent TERA instance or initiallized a child
|
|
473
480
|
|
|
474
481
|
### handshakeLoop
|
|
475
482
|
|
|
@@ -477,20 +484,20 @@ Keep trying to handshake until the target responds
|
|
|
477
484
|
|
|
478
485
|
#### Parameters
|
|
479
486
|
|
|
480
|
-
* `options` **[Object][
|
|
487
|
+
* `options` **[Object][151]?** Additional options to mutate behaviour
|
|
481
488
|
|
|
482
489
|
#### Properties
|
|
483
490
|
|
|
484
|
-
* `handshakeInterval` **[Number][
|
|
485
|
-
* `handshakeTimeout` **[Number][
|
|
491
|
+
* `handshakeInterval` **[Number][153]?** Interval in milliseconds when sanning for a handshake, defaults to global setting
|
|
492
|
+
* `handshakeTimeout` **[Number][153]?** Interval in milliseconds for when to give up trying to handshake, defaults to global setting
|
|
486
493
|
|
|
487
|
-
Returns **[Promise][
|
|
494
|
+
Returns **[Promise][157]** A promise which will either resolve when the handshake is successful OR fail with 'TIMEOUT'
|
|
488
495
|
|
|
489
496
|
### injectStylesheet
|
|
490
497
|
|
|
491
498
|
Inject a local stylesheet to handle TERA server functionality
|
|
492
499
|
|
|
493
|
-
Returns **[Promise][
|
|
500
|
+
Returns **[Promise][157]** A promise which will resolve when the loading has completed and we have found a parent TERA instance or initiallized a child
|
|
494
501
|
|
|
495
502
|
### injectMethods
|
|
496
503
|
|
|
@@ -505,7 +512,7 @@ This function will only act if `settings.devMode` is truthy
|
|
|
505
512
|
|
|
506
513
|
* `msg` **...any** 
|
|
507
514
|
* `method` **(`"INFO"` | `"LOG"` | `"WARN"` | `"ERROR"`)** Logging method to use (optional, default `'LOG'`)
|
|
508
|
-
* `verboseLevel` **[Number][
|
|
515
|
+
* `verboseLevel` **[Number][153]** The verbosity level to trigger at. If `settings.verbosity` is lower than this, the message is ignored (optional, default `1`)
|
|
509
516
|
|
|
510
517
|
### set
|
|
511
518
|
|
|
@@ -514,11 +521,11 @@ This function also routes 'special' keys like `devMode` to their internal handle
|
|
|
514
521
|
|
|
515
522
|
#### Parameters
|
|
516
523
|
|
|
517
|
-
* `key` **([String][
|
|
524
|
+
* `key` **([String][150] | [Object][151])** Either a single setting key to set or an object to merge
|
|
518
525
|
* `value` **any** The value to set if `key` is a string
|
|
519
|
-
* `options` **[Object][
|
|
526
|
+
* `options` **[Object][151]?** Additional options to mutate behaviour
|
|
520
527
|
|
|
521
|
-
* `options.ignoreNullish` **[Boolean][
|
|
528
|
+
* `options.ignoreNullish` **[Boolean][159]** If falsy, this forces the setting of undefined or null values rather than ignoring them when specifying values by string (optional, default `true`)
|
|
522
529
|
|
|
523
530
|
Returns **[TeraFy][30]** This chainable terafy instance
|
|
524
531
|
|
|
@@ -530,9 +537,9 @@ Set or merge settings - but only in dev mode and only if the value is not undefi
|
|
|
530
537
|
|
|
531
538
|
#### Parameters
|
|
532
539
|
|
|
533
|
-
* `key` **([String][
|
|
540
|
+
* `key` **([String][150] | [Object][151])** Either a single setting key to set or an object to merge
|
|
534
541
|
* `value` **any** The value to set if `key` is a string
|
|
535
|
-
* `options` **[Object][
|
|
542
|
+
* `options` **[Object][151]?** Additional options to mutate behaviour
|
|
536
543
|
|
|
537
544
|
Returns **[TeraFy][30]** This chainable terafy instance
|
|
538
545
|
|
|
@@ -543,8 +550,8 @@ Include a TeraFy client plugin
|
|
|
543
550
|
#### Parameters
|
|
544
551
|
|
|
545
552
|
* `mod`  
|
|
546
|
-
* `options` **[Object][
|
|
547
|
-
* `The` **[Object][
|
|
553
|
+
* `options` **[Object][151]?** Additional options to mutate behaviour during construction (pass options to init() to intialize later options)
|
|
554
|
+
* `The` **[Object][151]** module function to include. Invoked as `(teraClient:TeraFy, options:Object)`
|
|
548
555
|
|
|
549
556
|
Returns **[TeraFy][30]** This chainable terafy instance
|
|
550
557
|
|
|
@@ -554,8 +561,8 @@ Internal function used by use() to merge an external declared singleton against
|
|
|
554
561
|
|
|
555
562
|
#### Parameters
|
|
556
563
|
|
|
557
|
-
* `target` **[Object][
|
|
558
|
-
* `source` **[Object][
|
|
564
|
+
* `target` **[Object][151]** Initalied class instance to extend
|
|
565
|
+
* `source` **[Object][151]** Initalized source object to extend from
|
|
559
566
|
|
|
560
567
|
### toggleDevMode
|
|
561
568
|
|
|
@@ -567,7 +574,7 @@ This function also accepts meta values:
|
|
|
567
574
|
|
|
568
575
|
#### Parameters
|
|
569
576
|
|
|
570
|
-
* `devModeEnabled` **(`"toggle"` | `"proxy"` | [Boolean][
|
|
577
|
+
* `devModeEnabled` **(`"toggle"` | `"proxy"` | [Boolean][159])** Optional boolean to force dev mode or specify other behaviour (optional, default `'toggle'`)
|
|
571
578
|
|
|
572
579
|
Returns **[TeraFy][30]** This chainable terafy instance
|
|
573
580
|
|
|
@@ -578,7 +585,7 @@ This is usually because the server component wants to perform some user activity
|
|
|
578
585
|
|
|
579
586
|
#### Parameters
|
|
580
587
|
|
|
581
|
-
* `isFocused` **([String][
|
|
588
|
+
* `isFocused` **([String][150] | [Boolean][159])** Whether to fullscreen the embedded component (optional, default `'toggle'`)
|
|
582
589
|
|
|
583
590
|
### selectProjectFile
|
|
584
591
|
|
|
@@ -590,7 +597,7 @@ This is an pre-requisite step for requireProject()
|
|
|
590
597
|
|
|
591
598
|
* `options`  
|
|
592
599
|
|
|
593
|
-
Returns **[Promise][
|
|
600
|
+
Returns **[Promise][157]** A promise which will resolve if the there is a user and they are logged in
|
|
594
601
|
|
|
595
602
|
### getProjectFiles
|
|
596
603
|
|
|
@@ -598,13 +605,13 @@ Fetch the files associated with a given project
|
|
|
598
605
|
|
|
599
606
|
#### Parameters
|
|
600
607
|
|
|
601
|
-
* `options` **[Object][
|
|
608
|
+
* `options` **[Object][151]** Options which mutate behaviour
|
|
602
609
|
|
|
603
|
-
* `options.autoRequire` **[Boolean][
|
|
604
|
-
* `options.lazy` **[Boolean][
|
|
605
|
-
* `options.meta` **[Boolean][
|
|
610
|
+
* `options.autoRequire` **[Boolean][159]** Run `requireProject()` automatically before continuing (optional, default `true`)
|
|
611
|
+
* `options.lazy` **[Boolean][159]** If true, use the fastest method to retrieve the file list such as the cache. If false, force a refresh each time (optional, default `true`)
|
|
612
|
+
* `options.meta` **[Boolean][159]** Pull meta information for each file entity (optional, default `true`)
|
|
606
613
|
|
|
607
|
-
Returns **[Promise][
|
|
614
|
+
Returns **[Promise][157]<[Array][156]<[ProjectFile][1]>>** A collection of project files for the given project
|
|
608
615
|
|
|
609
616
|
### getProjectFile
|
|
610
617
|
|
|
@@ -613,13 +620,13 @@ Fetch a project file by its name
|
|
|
613
620
|
#### Parameters
|
|
614
621
|
|
|
615
622
|
* `id`  
|
|
616
|
-
* `name` **[String][
|
|
617
|
-
* `options` **([Object][
|
|
623
|
+
* `name` **[String][150]** The name + relative directory path component
|
|
624
|
+
* `options` **([Object][151] | [String][150])?** Additional options to mutate behaviour, if a string is given `options.subkey` is assumed
|
|
618
625
|
|
|
619
|
-
* `options.subkey` **[String][
|
|
620
|
-
* `options.cache` **[Boolean][
|
|
626
|
+
* `options.subkey` **[String][150]?** If specified only the extracted subkey is returned rather than the full object
|
|
627
|
+
* `options.cache` **[Boolean][159]** Use the existing file cache if possible, set to false to force a refresh of files from the server first (optional, default `true`)
|
|
621
628
|
|
|
622
|
-
Returns **[Promise][
|
|
629
|
+
Returns **[Promise][157]<[ProjectFile][1]>** The eventual fetched ProjectFile (or requested subkey)
|
|
623
630
|
|
|
624
631
|
### createProjectFile
|
|
625
632
|
|
|
@@ -628,9 +635,9 @@ This creates an empty file which can then be written to
|
|
|
628
635
|
|
|
629
636
|
#### Parameters
|
|
630
637
|
|
|
631
|
-
* `name` **[String][
|
|
638
|
+
* `name` **[String][150]** The name + relative directory path component
|
|
632
639
|
|
|
633
|
-
Returns **[Promise][
|
|
640
|
+
Returns **[Promise][157]<[ProjectFile][1]>** The eventual ProjectFile created
|
|
634
641
|
|
|
635
642
|
## handshake
|
|
636
643
|
|
|
@@ -638,9 +645,9 @@ Return basic server information as a form of validation
|
|
|
638
645
|
|
|
639
646
|
### Properties
|
|
640
647
|
|
|
641
|
-
* `date` **[Date][
|
|
648
|
+
* `date` **[Date][152]** Server date
|
|
642
649
|
|
|
643
|
-
Returns **[Promise][
|
|
650
|
+
Returns **[Promise][157]<[Object][151]>** Basic promise result
|
|
644
651
|
|
|
645
652
|
## setServerVerbosity
|
|
646
653
|
|
|
@@ -648,7 +655,7 @@ RPC callback to set the server verbostiy level
|
|
|
648
655
|
|
|
649
656
|
### Parameters
|
|
650
657
|
|
|
651
|
-
* `verbosity` **[Number][
|
|
658
|
+
* `verbosity` **[Number][153]** The desired server verbosity level
|
|
652
659
|
|
|
653
660
|
## User
|
|
654
661
|
|
|
@@ -656,16 +663,16 @@ User / active session within TERA
|
|
|
656
663
|
|
|
657
664
|
### Properties
|
|
658
665
|
|
|
659
|
-
* `id` **[String][
|
|
660
|
-
* `email` **[String][
|
|
661
|
-
* `name` **[String][
|
|
662
|
-
* `isSubscribed` **[Boolean][
|
|
666
|
+
* `id` **[String][150]** Unique identifier of the user
|
|
667
|
+
* `email` **[String][150]** The email address of the current user
|
|
668
|
+
* `name` **[String][150]** The provided full name of the user
|
|
669
|
+
* `isSubscribed` **[Boolean][159]** Whether the active user has a TERA subscription
|
|
663
670
|
|
|
664
671
|
## getUser
|
|
665
672
|
|
|
666
673
|
Fetch the current session user
|
|
667
674
|
|
|
668
|
-
Returns **[Promise][
|
|
675
|
+
Returns **[Promise][157]<[User][86]>** The current logged in user or null if none
|
|
669
676
|
|
|
670
677
|
## requireUser
|
|
671
678
|
|
|
@@ -675,11 +682,11 @@ This is an pre-requisite step for requireProject()
|
|
|
675
682
|
|
|
676
683
|
### Parameters
|
|
677
684
|
|
|
678
|
-
* `options` **[Object][
|
|
685
|
+
* `options` **[Object][151]?** Additional options to mutate behaviour
|
|
679
686
|
|
|
680
|
-
* `options.forceRetry` **[Boolean][
|
|
687
|
+
* `options.forceRetry` **[Boolean][159]** Forcabily try to refresh the user state (optional, default `false`)
|
|
681
688
|
|
|
682
|
-
Returns **[Promise][
|
|
689
|
+
Returns **[Promise][157]<[User][86]>** The current logged in user or null if none
|
|
683
690
|
|
|
684
691
|
## Project
|
|
685
692
|
|
|
@@ -689,13 +696,13 @@ Project entry within TERA
|
|
|
689
696
|
|
|
690
697
|
Get the currently active project, if any
|
|
691
698
|
|
|
692
|
-
Returns **[Promise][
|
|
699
|
+
Returns **[Promise][157]<([Project][91] | null)>** The currently active project, if any
|
|
693
700
|
|
|
694
701
|
## getProjects
|
|
695
702
|
|
|
696
703
|
Get a list of projects the current session user has access to
|
|
697
704
|
|
|
698
|
-
Returns **[Promise][
|
|
705
|
+
Returns **[Promise][157]<[Array][156]<[Project][91]>>** Collection of projects the user has access to
|
|
699
706
|
|
|
700
707
|
## setActiveProject
|
|
701
708
|
|
|
@@ -703,7 +710,7 @@ Set the currently active project within TERA
|
|
|
703
710
|
|
|
704
711
|
### Parameters
|
|
705
712
|
|
|
706
|
-
* `project` **([Object][
|
|
713
|
+
* `project` **([Object][151] | [String][150])** The project to set as active - either the full Project object or its ID
|
|
707
714
|
|
|
708
715
|
## requireProject
|
|
709
716
|
|
|
@@ -712,14 +719,14 @@ Note that this function will percist in asking the uesr even if they try to canc
|
|
|
712
719
|
|
|
713
720
|
### Parameters
|
|
714
721
|
|
|
715
|
-
* `options` **[Object][
|
|
722
|
+
* `options` **[Object][151]?** Additional options to mutate behaviour
|
|
716
723
|
|
|
717
|
-
* `options.autoSetActiveProject` **[Boolean][
|
|
718
|
-
* `options.title` **[String][
|
|
719
|
-
* `options.noSelectTitle` **[String][
|
|
720
|
-
* `options.noSelectBody` **[String][
|
|
724
|
+
* `options.autoSetActiveProject` **[Boolean][159]** After selecting a project set that project as active in TERA (optional, default `true`)
|
|
725
|
+
* `options.title` **[String][150]** The title of the dialog to display (optional, default `"Select a project to work with"`)
|
|
726
|
+
* `options.noSelectTitle` **[String][150]** Dialog title when warning the user they need to select something (optional, default `'Select project'`)
|
|
727
|
+
* `options.noSelectBody` **[String][150]** Dialog body when warning the user they need to select something (optional, default `'A project needs to be selected to continue'`)
|
|
721
728
|
|
|
722
|
-
Returns **[Promise][
|
|
729
|
+
Returns **[Promise][157]<[Project][91]>** The active project
|
|
723
730
|
|
|
724
731
|
## selectProject
|
|
725
732
|
|
|
@@ -727,13 +734,13 @@ Prompt the user to select a project from those available
|
|
|
727
734
|
|
|
728
735
|
### Parameters
|
|
729
736
|
|
|
730
|
-
* `options` **[Object][
|
|
737
|
+
* `options` **[Object][151]?** Additional options to mutate behaviour
|
|
731
738
|
|
|
732
|
-
* `options.title` **[String][
|
|
733
|
-
* `options.allowCancel` **[Boolean][
|
|
734
|
-
* `options.setActive` **[Boolean][
|
|
739
|
+
* `options.title` **[String][150]** The title of the dialog to display (optional, default `"Select a project to work with"`)
|
|
740
|
+
* `options.allowCancel` **[Boolean][159]** Advertise cancelling the operation, the dialog can still be cancelled by closing it (optional, default `true`)
|
|
741
|
+
* `options.setActive` **[Boolean][159]** Also set the project as active when selected (optional, default `false`)
|
|
735
742
|
|
|
736
|
-
Returns **[Promise][
|
|
743
|
+
Returns **[Promise][157]<[Project][91]>** The active project
|
|
737
744
|
|
|
738
745
|
## getProjectState
|
|
739
746
|
|
|
@@ -741,12 +748,12 @@ Return the current, full snapshot state of the active project
|
|
|
741
748
|
|
|
742
749
|
### Parameters
|
|
743
750
|
|
|
744
|
-
* `options` **[Object][
|
|
751
|
+
* `options` **[Object][151]?** Additional options to mutate behaviour
|
|
745
752
|
|
|
746
|
-
* `options.autoRequire` **[Boolean][
|
|
747
|
-
* `Paths` **[Array][
|
|
753
|
+
* `options.autoRequire` **[Boolean][159]** Run `requireProject()` automatically before continuing (optional, default `true`)
|
|
754
|
+
* `Paths` **[Array][156]<[String][150]>** to subscribe to e.g. \['/users/'],
|
|
748
755
|
|
|
749
|
-
Returns **[Promise][
|
|
756
|
+
Returns **[Promise][157]<[Object][151]>** The current project state snapshot
|
|
750
757
|
|
|
751
758
|
## setProjectState
|
|
752
759
|
|
|
@@ -758,13 +765,13 @@ Paths can be any valid Lodash.set() value such as:
|
|
|
758
765
|
|
|
759
766
|
### Parameters
|
|
760
767
|
|
|
761
|
-
* `path` **([String][
|
|
768
|
+
* `path` **([String][150] | [Array][156]<[String][150]>)** The sub-path within the project state to set
|
|
762
769
|
* `value` **any** The value to set
|
|
763
|
-
* `options` **[Object][
|
|
770
|
+
* `options` **[Object][151]?** Additional options to mutate behaviour
|
|
764
771
|
|
|
765
|
-
* `options.save` **[Boolean][
|
|
772
|
+
* `options.save` **[Boolean][159]** Save the changes to the server immediately, disable to queue up multiple writes (optional, default `true`)
|
|
766
773
|
|
|
767
|
-
Returns **[Promise][
|
|
774
|
+
Returns **[Promise][157]** A promise which resolves when the operation has been dispatched to the server
|
|
768
775
|
|
|
769
776
|
## setProjectStateDefaults
|
|
770
777
|
|
|
@@ -774,31 +781,31 @@ Set a nested value within the project state - just like `setProjectState()` - bu
|
|
|
774
781
|
|
|
775
782
|
### Parameters
|
|
776
783
|
|
|
777
|
-
* `path` **([String][
|
|
784
|
+
* `path` **([String][150] | [Array][156]<[String][150]>)** The sub-path within the project state to set
|
|
778
785
|
* `value` **any** The value to set
|
|
779
|
-
* `options` **[Object][
|
|
786
|
+
* `options` **[Object][151]?** Additional options to mutate behaviour, see setProjectState() for the full list of supported options
|
|
780
787
|
|
|
781
|
-
Returns **[Promise][
|
|
788
|
+
Returns **[Promise][157]<[Boolean][159]>** A promise which resolves to whether any changes were made - True if defaults were applied, false otherwise
|
|
782
789
|
|
|
783
790
|
## setProjectStateFlush
|
|
784
791
|
|
|
785
792
|
Force copying local changes to the server
|
|
786
793
|
This is only ever needed when saving large quantities of data that need to be immediately available
|
|
787
794
|
|
|
788
|
-
Returns **[Promise][
|
|
795
|
+
Returns **[Promise][157]** A promise which resolves when the operation has completed
|
|
789
796
|
|
|
790
797
|
## setProjectStateRefresh
|
|
791
798
|
|
|
792
799
|
Force refetching the remote project state into local
|
|
793
800
|
This is only ever needed when saving large quantities of data that need to be immediately available
|
|
794
801
|
|
|
795
|
-
Returns **[Promise][
|
|
802
|
+
Returns **[Promise][157]** A promise which resolves when the operation has completed
|
|
796
803
|
|
|
797
804
|
## saveProjectState
|
|
798
805
|
|
|
799
806
|
Force-Save the currently active project state
|
|
800
807
|
|
|
801
|
-
Returns **[Promise][
|
|
808
|
+
Returns **[Promise][157]** A promise which resolves when the operation has completed
|
|
802
809
|
|
|
803
810
|
## replaceProjectState
|
|
804
811
|
|
|
@@ -809,9 +816,9 @@ You almost never want to use this function directly, see `setProjectState(path,
|
|
|
809
816
|
|
|
810
817
|
### Parameters
|
|
811
818
|
|
|
812
|
-
* `newState` **[Object][
|
|
819
|
+
* `newState` **[Object][151]** The new state to replace the current state with
|
|
813
820
|
|
|
814
|
-
Returns **[Promise][
|
|
821
|
+
Returns **[Promise][157]** A promise which resolves when the operation has completed
|
|
815
822
|
|
|
816
823
|
## applyProjectStatePatch
|
|
817
824
|
|
|
@@ -819,9 +826,9 @@ Apply a computed `just-diff` patch to the current project state
|
|
|
819
826
|
|
|
820
827
|
### Parameters
|
|
821
828
|
|
|
822
|
-
* `Patch` **[Object][
|
|
829
|
+
* `Patch` **[Object][151]** to apply
|
|
823
830
|
|
|
824
|
-
Returns **[Promise][
|
|
831
|
+
Returns **[Promise][157]** A promise which resolves when the operation has completed
|
|
825
832
|
|
|
826
833
|
## subscribeProjectState
|
|
827
834
|
|
|
@@ -829,7 +836,7 @@ Subscribe to project state changes
|
|
|
829
836
|
This will dispatch an RPC call to the source object `applyProjectStatePatchLocal()` function with the patch
|
|
830
837
|
If the above call fails the subscriber is assumed as dead and unsubscribed from the polling list
|
|
831
838
|
|
|
832
|
-
Returns **[Promise][
|
|
839
|
+
Returns **[Promise][157]<[Function][163]>** A promise which resolves when a subscription has been created, call the resulting function to unsubscribe
|
|
833
840
|
|
|
834
841
|
## FileFilters
|
|
835
842
|
|
|
@@ -837,10 +844,10 @@ Data structure for a file filter
|
|
|
837
844
|
|
|
838
845
|
### Properties
|
|
839
846
|
|
|
840
|
-
* `library` **[Boolean][
|
|
841
|
-
* `filename` **[String][
|
|
842
|
-
* `basename` **[String][
|
|
843
|
-
* `ext` **[String][
|
|
847
|
+
* `library` **[Boolean][159]?** Restrict to library files only
|
|
848
|
+
* `filename` **[String][150]?** CSV of @momsfriendlydevco/match expressions to filter the filename by (filenames are the basename sans extension)
|
|
849
|
+
* `basename` **[String][150]?** CSV of @momsfriendlydevco/match expressions to filter the basename by
|
|
850
|
+
* `ext` **[String][150]?** CSV of @momsfriendlydevco/match expressions to filter the file extension by
|
|
844
851
|
|
|
845
852
|
## selectProjectFile
|
|
846
853
|
|
|
@@ -848,20 +855,20 @@ Prompt the user to select a library to operate on
|
|
|
848
855
|
|
|
849
856
|
### Parameters
|
|
850
857
|
|
|
851
|
-
* `options` **[Object][
|
|
858
|
+
* `options` **[Object][151]?** Additional options to mutate behaviour
|
|
852
859
|
|
|
853
|
-
* `options.title` **[String][
|
|
854
|
-
* `options.hint` **([String][
|
|
855
|
-
* `options.save` **[Boolean][
|
|
860
|
+
* `options.title` **[String][150]** The title of the dialog to display (optional, default `"Select a file"`)
|
|
861
|
+
* `options.hint` **([String][150] | [Array][156]<[String][150]>)?** Hints to identify the file to select in array order of preference
|
|
862
|
+
* `options.save` **[Boolean][159]** Set to truthy if saving a new file, UI will adjust to allowing overwrite OR new file name input (optional, default `false`)
|
|
856
863
|
* `options.filters` **[FileFilters][114]?** Optional file filters
|
|
857
|
-
* `options.allowUpload` **[Boolean][
|
|
858
|
-
* `options.allowRefresh` **[Boolean][
|
|
859
|
-
* `options.allowDownloadZip` **[Boolean][
|
|
860
|
-
* `options.allowCancel` **[Boolean][
|
|
861
|
-
* `options.autoRequire` **[Boolean][
|
|
864
|
+
* `options.allowUpload` **[Boolean][159]** Allow uploading new files (optional, default `true`)
|
|
865
|
+
* `options.allowRefresh` **[Boolean][159]** Allow the user to manually refresh the file list (optional, default `true`)
|
|
866
|
+
* `options.allowDownloadZip` **[Boolean][159]** Allow the user to download a Zip of all files (optional, default `true`)
|
|
867
|
+
* `options.allowCancel` **[Boolean][159]** Allow cancelling the operation. Will throw `'CANCEL'` as the promise rejection if acationed (optional, default `true`)
|
|
868
|
+
* `options.autoRequire` **[Boolean][159]** Run `requireProject()` automatically before continuing (optional, default `true`)
|
|
862
869
|
* `options.filter` **[FileFilters][114]?** Optional file filters
|
|
863
870
|
|
|
864
|
-
Returns **[Promise][
|
|
871
|
+
Returns **[Promise][157]<[ProjectFile][1]>** The eventually selected file, if in save mode new files are created as stubs
|
|
865
872
|
|
|
866
873
|
## getProjectFileContents
|
|
867
874
|
|
|
@@ -869,8 +876,8 @@ Fetch the raw contents of a file by its ID
|
|
|
869
876
|
|
|
870
877
|
### Parameters
|
|
871
878
|
|
|
872
|
-
* `id` **[String][
|
|
873
|
-
* `options` **[Object][
|
|
879
|
+
* `id` **[String][150]?** File ID to retrieve the contents of
|
|
880
|
+
* `options` **[Object][151]?** Additioanl options to mutate behaviour
|
|
874
881
|
|
|
875
882
|
* `options.format` **(`"blob"` | `"json"`)** The format to retrieve the file in (optional, default `'blob'`)
|
|
876
883
|
|
|
@@ -882,9 +889,9 @@ Remove a project file by its ID
|
|
|
882
889
|
|
|
883
890
|
### Parameters
|
|
884
891
|
|
|
885
|
-
* `id` **[String][
|
|
892
|
+
* `id` **[String][150]** The File ID to remove
|
|
886
893
|
|
|
887
|
-
Returns **[Promise][
|
|
894
|
+
Returns **[Promise][157]** A promise which resolves when the operation has completed
|
|
888
895
|
|
|
889
896
|
## setProjectFile
|
|
890
897
|
|
|
@@ -892,10 +899,10 @@ Replace a project files contents
|
|
|
892
899
|
|
|
893
900
|
### Parameters
|
|
894
901
|
|
|
895
|
-
* `id` **[String][
|
|
896
|
-
* `contents` **(File | [Blob][
|
|
902
|
+
* `id` **[String][150]** File to overwrite
|
|
903
|
+
* `contents` **(File | [Blob][154] | [FormData][155] | [Object][151] | [Array][156])** The new file contents
|
|
897
904
|
|
|
898
|
-
Returns **[Promise][
|
|
905
|
+
Returns **[Promise][157]** A promise which will resolve when the write operation has completed
|
|
899
906
|
|
|
900
907
|
## selectProjectLibrary
|
|
901
908
|
|
|
@@ -903,18 +910,18 @@ Prompt the user to select a library to operate on and return a array of referenc
|
|
|
903
910
|
|
|
904
911
|
### Parameters
|
|
905
912
|
|
|
906
|
-
* `options` **[Object][
|
|
913
|
+
* `options` **[Object][151]?** Additional options to mutate behaviour
|
|
907
914
|
|
|
908
|
-
* `options.title` **[String][
|
|
909
|
-
* `options.hint` **([String][
|
|
910
|
-
* `options.allowUpload` **[Boolean][
|
|
911
|
-
* `options.allowRefresh` **[Boolean][
|
|
912
|
-
* `options.allowDownloadZip` **[Boolean][
|
|
913
|
-
* `options.allowCancel` **[Boolean][
|
|
914
|
-
* `options.autoRequire` **[Boolean][
|
|
915
|
+
* `options.title` **[String][150]** The title of the dialog to display (optional, default `"Select a citation library"`)
|
|
916
|
+
* `options.hint` **([String][150] | [Array][156]<[String][150]>)?** Hints to identify the library to select in array order of preference. Generally corresponds to the previous stage - e.g. 'deduped', 'review1', 'review2', 'dedisputed'
|
|
917
|
+
* `options.allowUpload` **[Boolean][159]** Allow uploading new files (optional, default `true`)
|
|
918
|
+
* `options.allowRefresh` **[Boolean][159]** Allow the user to manually refresh the file list (optional, default `true`)
|
|
919
|
+
* `options.allowDownloadZip` **[Boolean][159]** Allow the user to download a Zip of all files (optional, default `true`)
|
|
920
|
+
* `options.allowCancel` **[Boolean][159]** Allow cancelling the operation. Will throw `'CANCEL'` as the promise rejection if acationed (optional, default `true`)
|
|
921
|
+
* `options.autoRequire` **[Boolean][159]** Run `requireProject()` automatically before continuing (optional, default `true`)
|
|
915
922
|
* `options.filters` **[FileFilters][114]?** Optional file filters, defaults to citation library selection only
|
|
916
923
|
|
|
917
|
-
Returns **[Promise][
|
|
924
|
+
Returns **[Promise][157]<[Array][156]\<Ref>>** A collection of references from the selected file
|
|
918
925
|
|
|
919
926
|
## getProjectLibrary
|
|
920
927
|
|
|
@@ -922,15 +929,15 @@ Fetch + convert a project file into a library of citations
|
|
|
922
929
|
|
|
923
930
|
### Parameters
|
|
924
931
|
|
|
925
|
-
* `id` **[String][
|
|
926
|
-
* `options` **[Object][
|
|
932
|
+
* `id` **[String][150]** File ID to read
|
|
933
|
+
* `options` **[Object][151]?** Additional options to mutate behaviour
|
|
927
934
|
|
|
928
|
-
* `options.format` **[String][
|
|
929
|
-
* `options.autoRequire` **[Boolean][
|
|
930
|
-
* `options.filter` **[Function][
|
|
931
|
-
* `options.find` **[Function][
|
|
935
|
+
* `options.format` **[String][150]** Format for the file. ENUM: 'pojo' (return a parsed JS collection), 'blob' (raw JS Blob object), 'file' (named JS File object) (optional, default `'json'`)
|
|
936
|
+
* `options.autoRequire` **[Boolean][159]** Run `requireProject()` automatically before continuing (optional, default `true`)
|
|
937
|
+
* `options.filter` **[Function][163]?** Optional async file filter, called each time as `(File:ProjectFile)`
|
|
938
|
+
* `options.find` **[Function][163]?** Optional async final stage file filter to reduce all candidates down to one subject file
|
|
932
939
|
|
|
933
|
-
Returns **([Promise][
|
|
940
|
+
Returns **([Promise][157]<[Array][156]\<Ref>> | [Promise][157]\<any>)** A collection of references (default bevahiour) or a whatever format was requested
|
|
934
941
|
|
|
935
942
|
## setProjectLibrary
|
|
936
943
|
|
|
@@ -938,33 +945,33 @@ Save back a citation library from some input
|
|
|
938
945
|
|
|
939
946
|
### Parameters
|
|
940
947
|
|
|
941
|
-
* `id` **[String][
|
|
942
|
-
* `refs` **([Array][
|
|
943
|
-
* `options` **[Object][
|
|
948
|
+
* `id` **[String][150]?** File ID to save back to, if omitted a file will be prompted for
|
|
949
|
+
* `refs` **([Array][156]\<RefLibRef> | [Blob][154] | File)?** Collection of references for the selected library or the raw Blob/File
|
|
950
|
+
* `options` **[Object][151]?** Additional options to mutate behaviour
|
|
944
951
|
|
|
945
|
-
* `options.id` **[String][
|
|
946
|
-
* `options.refs` **([Array][
|
|
947
|
-
* `options.format` **[String][
|
|
948
|
-
* `options.autoRequire` **[Boolean][
|
|
949
|
-
* `options.hint` **[String][
|
|
950
|
-
* `options.filename` **[String][
|
|
951
|
-
* `options.title` **[String][
|
|
952
|
-
* `options.overwrite` **[Boolean][
|
|
953
|
-
* `options.meta` **[Object][
|
|
952
|
+
* `options.id` **[String][150]?** Alternate method to specify the file ID to save as, if omitted one will be prompted for
|
|
953
|
+
* `options.refs` **([Array][156]\<RefLibRef> | [Blob][154] | File)?** Alternate method to specify the refs to save as an array or raw Blob/File
|
|
954
|
+
* `options.format` **[String][150]** Input format used. ENUM: 'pojo' (return a parsed JS collection), 'blob' (raw JS Blob object), 'file' (named JS File object) (optional, default `'json'`)
|
|
955
|
+
* `options.autoRequire` **[Boolean][159]** Run `requireProject()` automatically before continuing (optional, default `true`)
|
|
956
|
+
* `options.hint` **[String][150]?** Hint to store against the library. Generally corresponds to the current operation being performed - e.g. 'deduped'
|
|
957
|
+
* `options.filename` **[String][150]?** Suggested filename if `id` is unspecified
|
|
958
|
+
* `options.title` **[String][150]** Dialog title if `id` is unspecified and a prompt is necessary (optional, default `'Save citation library'`)
|
|
959
|
+
* `options.overwrite` **[Boolean][159]** Allow existing file upsert (optional, default `true`)
|
|
960
|
+
* `options.meta` **[Object][151]?** Optional meta data to merge into the file data
|
|
954
961
|
|
|
955
|
-
Returns **[Promise][
|
|
962
|
+
Returns **[Promise][157]** A promise which resolves when the save operation has completed
|
|
956
963
|
|
|
957
964
|
## projectLog
|
|
958
965
|
|
|
959
966
|
Create a log entry for the currently active project
|
|
960
967
|
|
|
961
|
-
The required log object can be of various forms. See [https://tera-tools.com/api/logs.json][
|
|
968
|
+
The required log object can be of various forms. See [https://tera-tools.com/api/logs.json][164] for the full list
|
|
962
969
|
|
|
963
970
|
### Parameters
|
|
964
971
|
|
|
965
|
-
* `log` **[Object][
|
|
972
|
+
* `log` **[Object][151]** The log entry to create
|
|
966
973
|
|
|
967
|
-
Returns **[Promise][
|
|
974
|
+
Returns **[Promise][157]** A promise which resolves when the operation has completed
|
|
968
975
|
|
|
969
976
|
## setPageUrl
|
|
970
977
|
|
|
@@ -973,7 +980,7 @@ This only really makes a difference to tools within the tera-tools.com site wher
|
|
|
973
980
|
|
|
974
981
|
### Parameters
|
|
975
982
|
|
|
976
|
-
* `url` **[String][
|
|
983
|
+
* `url` **[String][150]** The URL to restore on next refresh
|
|
977
984
|
|
|
978
985
|
## setPageTitle
|
|
979
986
|
|
|
@@ -982,7 +989,7 @@ This is usually called by a tool nested within the tera-tools.com embed
|
|
|
982
989
|
|
|
983
990
|
### Parameters
|
|
984
991
|
|
|
985
|
-
* `title` **[String][
|
|
992
|
+
* `title` **[String][150]** The current page title
|
|
986
993
|
|
|
987
994
|
## uiAlert
|
|
988
995
|
|
|
@@ -990,13 +997,27 @@ Display simple text within TERA
|
|
|
990
997
|
|
|
991
998
|
### Parameters
|
|
992
999
|
|
|
993
|
-
* `text` **[String][
|
|
994
|
-
* `options` **[Object][
|
|
1000
|
+
* `text` **[String][150]** The text to display
|
|
1001
|
+
* `options` **[Object][151]?** Additional options to mutate behaviour
|
|
995
1002
|
|
|
996
|
-
* `options.title` **[String][
|
|
997
|
-
* `options.isHtml` **[Boolean][
|
|
1003
|
+
* `options.title` **[String][150]** The title of the alert box (optional, default `'TERA'`)
|
|
1004
|
+
* `options.isHtml` **[Boolean][159]** If falsy the text is rendered as plain-text otherwise it will be assumed as HTML content (optional, default `false`)
|
|
998
1005
|
|
|
999
|
-
Returns **[Promise][
|
|
1006
|
+
Returns **[Promise][157]** A promise which resolves when the alert has been dismissed
|
|
1007
|
+
|
|
1008
|
+
## uiConfirm
|
|
1009
|
+
|
|
1010
|
+
Present a simple ok/cancel dialog to the user
|
|
1011
|
+
|
|
1012
|
+
### Parameters
|
|
1013
|
+
|
|
1014
|
+
* `text` **[String][150]** The text to display
|
|
1015
|
+
* `options` **[Object][151]?** Additional options to mutate behaviour
|
|
1016
|
+
|
|
1017
|
+
* `options.title` **[String][150]** The title of the confirmation box (optional, default `'TERA'`)
|
|
1018
|
+
* `options.isHtml` **[Boolean][159]** If falsy the text is rendered as plain-text otherwise it will be assumed as HTML content (optional, default `false`)
|
|
1019
|
+
|
|
1020
|
+
Returns **[Promise][157]** A promise which resolves with `Promise.resolve('OK')` or rejects with `Promise.reject('CANCEL')`
|
|
1000
1021
|
|
|
1001
1022
|
## uiProgress
|
|
1002
1023
|
|
|
@@ -1005,17 +1026,43 @@ All options are cumulative - i.e. they are merged with other options previously
|
|
|
1005
1026
|
|
|
1006
1027
|
### Parameters
|
|
1007
1028
|
|
|
1008
|
-
* `options` **([Object][
|
|
1029
|
+
* `options` **([Object][151] | [Boolean][159])?** Additional options to mutate behaviour, if boolean false `{close: true}` is assumed
|
|
1030
|
+
|
|
1031
|
+
* `options.title` **[String][150]** Window title, can only be set on the initial call (optional, default `'TERA'`)
|
|
1032
|
+
* `options.body` **[String][150]** Window body text, can only be set on the initial call (optional, default `''`)
|
|
1033
|
+
* `options.bodyHtml` **[Boolean][159]** Treat body text as HTML (optional, default `false`)
|
|
1034
|
+
* `options.close` **[Boolean][159]** Close the existing dialog, if true the dialog is disposed and options reset (optional, default `false`)
|
|
1035
|
+
* `options.text` **[String][150]?** The text of the task being conducted
|
|
1036
|
+
* `options.progress` **[Number][153]?** The current progress of the task being conducted, this is assumed to be a value less than `maxProgress`
|
|
1037
|
+
* `options.maxProgress` **[Number][153]?** The maximum value that the progress can be
|
|
1038
|
+
|
|
1039
|
+
Returns **[Promise][157]** A promise which resolves when the dialog has been updated
|
|
1040
|
+
|
|
1041
|
+
## uiPrompt
|
|
1042
|
+
|
|
1043
|
+
Prompt the user for an input, responding with a Promisable value
|
|
1044
|
+
|
|
1045
|
+
### Parameters
|
|
1046
|
+
|
|
1047
|
+
* `options` **[Object][151]?** Additional options to mutate behaviour
|
|
1009
1048
|
|
|
1010
|
-
* `options.
|
|
1011
|
-
* `options.
|
|
1012
|
-
* `options.
|
|
1013
|
-
* `options.
|
|
1014
|
-
* `options.
|
|
1015
|
-
* `options.progress` **[Number][147]?** The current progress of the task being conducted, this is assumed to be a value less than `maxProgress`
|
|
1016
|
-
* `options.maxProgress` **[Number][147]?** The maximum value that the progress can be
|
|
1049
|
+
* `options.value` **[String][150]?** Current or default value to display pre-filled
|
|
1050
|
+
* `options.title` **[String][150]** The dialog title to display (optional, default `'Input required'`)
|
|
1051
|
+
* `options.body` **[String][150]?** Optional additional body text
|
|
1052
|
+
* `options.bodyHtml` **[Boolean][159]** If truthy, treat the body as HTML (optional, default `false`)
|
|
1053
|
+
* `options.placeholder` **[String][150]?** Optional placeholder text
|
|
1017
1054
|
|
|
1018
|
-
Returns **[Promise][
|
|
1055
|
+
Returns **[Promise][157]\<any>** Either the eventual user value or a throw with `Promise.reject('CANCEL')`
|
|
1056
|
+
|
|
1057
|
+
## uiThrow
|
|
1058
|
+
|
|
1059
|
+
Catch an error using the TERA error handler
|
|
1060
|
+
|
|
1061
|
+
### Parameters
|
|
1062
|
+
|
|
1063
|
+
* `error` **([Error][165] | [Object][151] | [String][150])** Error to handle, generally an Error object but can be a POJO or a scalar string
|
|
1064
|
+
|
|
1065
|
+
Returns **Void** This function is fatal
|
|
1019
1066
|
|
|
1020
1067
|
## uiWindow
|
|
1021
1068
|
|
|
@@ -1023,13 +1070,13 @@ Open a popup window containing a new site
|
|
|
1023
1070
|
|
|
1024
1071
|
### Parameters
|
|
1025
1072
|
|
|
1026
|
-
* `url` **[String][
|
|
1027
|
-
* `options` **[Object][
|
|
1073
|
+
* `url` **[String][150]** The URL to open
|
|
1074
|
+
* `options` **[Object][151]?** Additional options to mutate behaviour
|
|
1028
1075
|
|
|
1029
|
-
* `options.width` **[Number][
|
|
1030
|
-
* `options.height` **[Number][
|
|
1031
|
-
* `options.center` **[Boolean][
|
|
1032
|
-
* `options.permissions` **[Object][
|
|
1076
|
+
* `options.width` **[Number][153]** The desired width of the window (optional, default `500`)
|
|
1077
|
+
* `options.height` **[Number][153]** The desired height of the window (optional, default `600`)
|
|
1078
|
+
* `options.center` **[Boolean][159]** Attempt to center the window on the screen (optional, default `true`)
|
|
1079
|
+
* `options.permissions` **[Object][151]?** Additional permissions to set on opening, defaults to a suitable set of permission for popups (see code)
|
|
1033
1080
|
|
|
1034
1081
|
Returns **WindowProxy** The opened window object (if `noopener` is not set in permissions)
|
|
1035
1082
|
|
|
@@ -1040,10 +1087,10 @@ This function is ideally called within a requestFocus() wrapper
|
|
|
1040
1087
|
|
|
1041
1088
|
### Parameters
|
|
1042
1089
|
|
|
1043
|
-
* `content` **(DOMElement | [String][
|
|
1044
|
-
* `options` **[Object][
|
|
1090
|
+
* `content` **(DOMElement | [String][150] | `false`)** Either a prepared DOM element or string to compile, set to falsy to remove existing content
|
|
1091
|
+
* `options` **[Object][151]?** Additional options to mutate behaviour
|
|
1045
1092
|
|
|
1046
|
-
* `options.logo` **([Boolean][
|
|
1093
|
+
* `options.logo` **([Boolean][159] | [String][150])** Add a logo to the output, if boolean true the Tera-tools logo is used otherwise specify a path or URL (optional, default `false`)
|
|
1047
1094
|
|
|
1048
1095
|
[1]: #projectfile
|
|
1049
1096
|
|
|
@@ -1319,44 +1366,58 @@ This function is ideally called within a requestFocus() wrapper
|
|
|
1319
1366
|
|
|
1320
1367
|
[137]: #parameters-43
|
|
1321
1368
|
|
|
1322
|
-
[138]: #
|
|
1369
|
+
[138]: #uiconfirm
|
|
1323
1370
|
|
|
1324
1371
|
[139]: #parameters-44
|
|
1325
1372
|
|
|
1326
|
-
[140]: #
|
|
1373
|
+
[140]: #uiprogress
|
|
1327
1374
|
|
|
1328
1375
|
[141]: #parameters-45
|
|
1329
1376
|
|
|
1330
|
-
[142]: #
|
|
1377
|
+
[142]: #uiprompt
|
|
1331
1378
|
|
|
1332
1379
|
[143]: #parameters-46
|
|
1333
1380
|
|
|
1334
|
-
[144]:
|
|
1381
|
+
[144]: #uithrow
|
|
1382
|
+
|
|
1383
|
+
[145]: #parameters-47
|
|
1384
|
+
|
|
1385
|
+
[146]: #uiwindow
|
|
1386
|
+
|
|
1387
|
+
[147]: #parameters-48
|
|
1388
|
+
|
|
1389
|
+
[148]: #uisplat
|
|
1390
|
+
|
|
1391
|
+
[149]: #parameters-49
|
|
1392
|
+
|
|
1393
|
+
[150]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
|
1394
|
+
|
|
1395
|
+
[151]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
|
|
1335
1396
|
|
|
1336
|
-
[
|
|
1397
|
+
[152]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date
|
|
1337
1398
|
|
|
1338
|
-
[
|
|
1399
|
+
[153]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
|
1339
1400
|
|
|
1340
|
-
[
|
|
1401
|
+
[154]: https://developer.mozilla.org/docs/Web/API/Blob
|
|
1341
1402
|
|
|
1342
|
-
[
|
|
1403
|
+
[155]: https://developer.mozilla.org/docs/Web/API/FormData
|
|
1343
1404
|
|
|
1344
|
-
[
|
|
1405
|
+
[156]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
|
1345
1406
|
|
|
1346
|
-
[
|
|
1407
|
+
[157]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
|
1347
1408
|
|
|
1348
|
-
[
|
|
1409
|
+
[158]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm
|
|
1349
1410
|
|
|
1350
|
-
[
|
|
1411
|
+
[159]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
|
|
1351
1412
|
|
|
1352
|
-
[
|
|
1413
|
+
[160]: https://developer.mozilla.org/docs/Web/API/Window
|
|
1353
1414
|
|
|
1354
|
-
[
|
|
1415
|
+
[161]: https://developer.mozilla.org/docs/Web/API/MessageEvent
|
|
1355
1416
|
|
|
1356
|
-
[
|
|
1417
|
+
[162]: http://jsonpatch.com
|
|
1357
1418
|
|
|
1358
|
-
[
|
|
1419
|
+
[163]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
|
|
1359
1420
|
|
|
1360
|
-
[
|
|
1421
|
+
[164]: https://tera-tools.com/api/logs.json
|
|
1361
1422
|
|
|
1362
|
-
[
|
|
1423
|
+
[165]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error
|