@iebh/tera-fy 1.7.4 → 1.9.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 +24 -0
- package/README.md +48 -0
- package/api.md +334 -286
- package/dist/terafy.es2019.js +2 -2
- package/dist/terafy.js +2 -2
- package/lib/projectFile.js +1 -1
- package/lib/terafy.client.js +88 -23
- package/lib/terafy.proxy.js +115 -0
- package/lib/terafy.server.js +69 -1
- package/package.json +5 -2
- package/plugins/vite.js +18 -0
- package/plugins/vue2.js +1 -1
- package/plugins/vue3.js +1 -1
package/api.md
CHANGED
|
@@ -81,60 +81,64 @@
|
|
|
81
81
|
* [Parameters][77]
|
|
82
82
|
* [handshake][78]
|
|
83
83
|
* [Properties][79]
|
|
84
|
-
* [
|
|
85
|
-
* [
|
|
86
|
-
* [
|
|
87
|
-
* [
|
|
88
|
-
|
|
89
|
-
* [
|
|
90
|
-
* [
|
|
91
|
-
* [
|
|
92
|
-
* [
|
|
93
|
-
|
|
94
|
-
* [
|
|
84
|
+
* [setServerVerbosity][80]
|
|
85
|
+
* [Parameters][81]
|
|
86
|
+
* [User][82]
|
|
87
|
+
* [Properties][83]
|
|
88
|
+
* [getUser][84]
|
|
89
|
+
* [requireUser][85]
|
|
90
|
+
* [Parameters][86]
|
|
91
|
+
* [Project][87]
|
|
92
|
+
* [getProject][88]
|
|
93
|
+
* [getProjects][89]
|
|
94
|
+
* [setActiveProject][90]
|
|
95
95
|
* [Parameters][91]
|
|
96
|
-
* [
|
|
96
|
+
* [requireProject][92]
|
|
97
97
|
* [Parameters][93]
|
|
98
|
-
* [
|
|
98
|
+
* [selectProject][94]
|
|
99
99
|
* [Parameters][95]
|
|
100
|
-
* [
|
|
100
|
+
* [getProjectState][96]
|
|
101
101
|
* [Parameters][97]
|
|
102
|
-
* [
|
|
102
|
+
* [setProjectState][98]
|
|
103
103
|
* [Parameters][99]
|
|
104
|
-
* [
|
|
105
|
-
* [
|
|
106
|
-
* [
|
|
107
|
-
* [
|
|
108
|
-
|
|
109
|
-
* [
|
|
104
|
+
* [setProjectStateDefaults][100]
|
|
105
|
+
* [Parameters][101]
|
|
106
|
+
* [setProjectStateFlush][102]
|
|
107
|
+
* [setProjectStateRefresh][103]
|
|
108
|
+
* [saveProjectState][104]
|
|
109
|
+
* [replaceProjectState][105]
|
|
110
110
|
* [Parameters][106]
|
|
111
|
-
* [
|
|
112
|
-
* [
|
|
113
|
-
|
|
114
|
-
* [
|
|
115
|
-
* [
|
|
116
|
-
* [
|
|
111
|
+
* [applyProjectStatePatch][107]
|
|
112
|
+
* [Parameters][108]
|
|
113
|
+
* [subscribeProjectState][109]
|
|
114
|
+
* [FileFilters][110]
|
|
115
|
+
* [Properties][111]
|
|
116
|
+
* [selectProjectFile][112]
|
|
117
117
|
* [Parameters][113]
|
|
118
|
-
* [
|
|
118
|
+
* [deleteProjectFile][114]
|
|
119
119
|
* [Parameters][115]
|
|
120
|
-
* [
|
|
120
|
+
* [setProjectFile][116]
|
|
121
121
|
* [Parameters][117]
|
|
122
|
-
* [
|
|
122
|
+
* [selectProjectLibrary][118]
|
|
123
123
|
* [Parameters][119]
|
|
124
|
-
* [
|
|
124
|
+
* [getProjectLibrary][120]
|
|
125
125
|
* [Parameters][121]
|
|
126
|
-
* [
|
|
126
|
+
* [setProjectLibrary][122]
|
|
127
127
|
* [Parameters][123]
|
|
128
|
-
* [
|
|
128
|
+
* [projectLog][124]
|
|
129
129
|
* [Parameters][125]
|
|
130
|
-
* [
|
|
130
|
+
* [setPageUrl][126]
|
|
131
131
|
* [Parameters][127]
|
|
132
|
-
* [
|
|
132
|
+
* [setPageTitle][128]
|
|
133
133
|
* [Parameters][129]
|
|
134
|
-
* [
|
|
134
|
+
* [uiAlert][130]
|
|
135
135
|
* [Parameters][131]
|
|
136
|
-
* [
|
|
136
|
+
* [uiProgress][132]
|
|
137
137
|
* [Parameters][133]
|
|
138
|
+
* [uiWindow][134]
|
|
139
|
+
* [Parameters][135]
|
|
140
|
+
* [uiSplat][136]
|
|
141
|
+
* [Parameters][137]
|
|
138
142
|
|
|
139
143
|
## ProjectFile
|
|
140
144
|
|
|
@@ -144,113 +148,113 @@ A project file fetched from TERA
|
|
|
144
148
|
|
|
145
149
|
A UUID string representing the unique ID of the file
|
|
146
150
|
|
|
147
|
-
Type: [String][
|
|
151
|
+
Type: [String][138]
|
|
148
152
|
|
|
149
153
|
### name
|
|
150
154
|
|
|
151
155
|
Relative name path (can contain prefix directories) for the human readable file name
|
|
152
156
|
|
|
153
|
-
Type: [String][
|
|
157
|
+
Type: [String][138]
|
|
154
158
|
|
|
155
159
|
### icon
|
|
156
160
|
|
|
157
161
|
CSS class to use as the file icon
|
|
158
162
|
|
|
159
|
-
Type: [String][
|
|
163
|
+
Type: [String][138]
|
|
160
164
|
|
|
161
165
|
### path
|
|
162
166
|
|
|
163
167
|
Full path to the file
|
|
164
168
|
This is also used as the unique identifier within the project
|
|
165
169
|
|
|
166
|
-
Type: [String][
|
|
170
|
+
Type: [String][138]
|
|
167
171
|
|
|
168
172
|
### url
|
|
169
173
|
|
|
170
174
|
Fully qualified URL to view / access / download the file from TERA
|
|
171
175
|
This will usually open an edit UI within the TERA site
|
|
172
176
|
|
|
173
|
-
Type: [String][
|
|
177
|
+
Type: [String][138]
|
|
174
178
|
|
|
175
179
|
### teraUrl
|
|
176
180
|
|
|
177
181
|
Rewrite of the URL where the absolute URL has been removed in place of a relative path, assuming the owner project is active
|
|
178
182
|
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
|
|
179
183
|
|
|
180
|
-
Type: [String][
|
|
184
|
+
Type: [String][138]
|
|
181
185
|
|
|
182
186
|
### parsedName
|
|
183
187
|
|
|
184
188
|
An object representing meta file parts of a file name
|
|
185
189
|
|
|
186
|
-
Type: [Object][
|
|
190
|
+
Type: [Object][139]
|
|
187
191
|
|
|
188
192
|
#### Properties
|
|
189
193
|
|
|
190
|
-
* `basename` **[String][
|
|
191
|
-
* `filename` **[String][
|
|
192
|
-
* `ext` **[String][
|
|
193
|
-
* `dirName` **[String][
|
|
194
|
+
* `basename` **[String][138]** The filename + extention (i.e. everything without directory name)
|
|
195
|
+
* `filename` **[String][138]** The file portion of the name (basename without the extension)
|
|
196
|
+
* `ext` **[String][138]** The extension portion of the name (always lower case)
|
|
197
|
+
* `dirName` **[String][138]** The directory path portion of the name
|
|
194
198
|
|
|
195
199
|
### created
|
|
196
200
|
|
|
197
201
|
A date representing when the file was created
|
|
198
202
|
|
|
199
|
-
Type: [Date][
|
|
203
|
+
Type: [Date][140]
|
|
200
204
|
|
|
201
205
|
### createdFormatted
|
|
202
206
|
|
|
203
207
|
A human readable, formatted version of "created"
|
|
204
208
|
|
|
205
|
-
Type: [String][
|
|
209
|
+
Type: [String][138]
|
|
206
210
|
|
|
207
211
|
### modified
|
|
208
212
|
|
|
209
213
|
A date representing when the file was created
|
|
210
214
|
|
|
211
|
-
Type: [Date][
|
|
215
|
+
Type: [Date][140]
|
|
212
216
|
|
|
213
217
|
### modifiedFormatted
|
|
214
218
|
|
|
215
219
|
A human readable, formatted version of "modified"
|
|
216
220
|
|
|
217
|
-
Type: [String][
|
|
221
|
+
Type: [String][138]
|
|
218
222
|
|
|
219
223
|
### accessed
|
|
220
224
|
|
|
221
225
|
A date representing when the file was last accessed
|
|
222
226
|
|
|
223
|
-
Type: [Date][
|
|
227
|
+
Type: [Date][140]
|
|
224
228
|
|
|
225
229
|
### accessedFormatted
|
|
226
230
|
|
|
227
231
|
A human readable, formatted version of "accessed"
|
|
228
232
|
|
|
229
|
-
Type: [String][
|
|
233
|
+
Type: [String][138]
|
|
230
234
|
|
|
231
235
|
### size
|
|
232
236
|
|
|
233
237
|
Size, in bytes, of the file
|
|
234
238
|
|
|
235
|
-
Type: [Number][
|
|
239
|
+
Type: [Number][141]
|
|
236
240
|
|
|
237
241
|
### sizeFormatted
|
|
238
242
|
|
|
239
243
|
A human readable, formatted version of the file size
|
|
240
244
|
|
|
241
|
-
Type: [String][
|
|
245
|
+
Type: [String][138]
|
|
242
246
|
|
|
243
247
|
### mime
|
|
244
248
|
|
|
245
249
|
The associated mime type for the file
|
|
246
250
|
|
|
247
|
-
Type: [String][
|
|
251
|
+
Type: [String][138]
|
|
248
252
|
|
|
249
253
|
### meta
|
|
250
254
|
|
|
251
255
|
Additional meta information for the file
|
|
252
256
|
|
|
253
|
-
Type: [Object][
|
|
257
|
+
Type: [Object][139]
|
|
254
258
|
|
|
255
259
|
### getContents
|
|
256
260
|
|
|
@@ -268,9 +272,9 @@ Overwrite the contents of a file with new content
|
|
|
268
272
|
|
|
269
273
|
#### Parameters
|
|
270
274
|
|
|
271
|
-
* `contents` **(File | [Blob][
|
|
275
|
+
* `contents` **(File | [Blob][142] | [FormData][143] | [Object][139] | [Array][144])** The new file contents
|
|
272
276
|
|
|
273
|
-
Returns **[Promise][
|
|
277
|
+
Returns **[Promise][145]** A promise which resolves when the operation has completed
|
|
274
278
|
|
|
275
279
|
### getRefs
|
|
276
280
|
|
|
@@ -278,7 +282,7 @@ Returns **[Promise][141]** A promise which resolves when the operation has compl
|
|
|
278
282
|
|
|
279
283
|
Fetch the file contents as an array of Reflib refs
|
|
280
284
|
|
|
281
|
-
Returns **[Promise][
|
|
285
|
+
Returns **[Promise][145]<[Array][144]\<Ref>>** An eventual array of RefLib references
|
|
282
286
|
|
|
283
287
|
### setRefs
|
|
284
288
|
|
|
@@ -289,18 +293,18 @@ Overwrite the contents of a file with a new collection of Reflib refs
|
|
|
289
293
|
#### Parameters
|
|
290
294
|
|
|
291
295
|
* `refs`  
|
|
292
|
-
* `Collection` **[Array][
|
|
296
|
+
* `Collection` **[Array][144]\<RefLibRef>** of references for the selected library
|
|
293
297
|
|
|
294
|
-
Returns **[Promise][
|
|
298
|
+
Returns **[Promise][145]** A promise which resolves when the operation has completed
|
|
295
299
|
|
|
296
300
|
### serialize
|
|
297
301
|
|
|
298
|
-
* **See**: [https://developer.mozilla.org/en-US/docs/Web/API/Web\_Workers\_API/Structured\_clone\_algorithm][
|
|
302
|
+
* **See**: [https://developer.mozilla.org/en-US/docs/Web/API/Web\_Workers\_API/Structured\_clone\_algorithm][146]
|
|
299
303
|
|
|
300
304
|
Compress a file state down into a serializable entity
|
|
301
305
|
By default this computes a Structured Clone which can be stringified
|
|
302
306
|
|
|
303
|
-
Returns **[Object][
|
|
307
|
+
Returns **[Object][139]** A Structured Clone compatible representation of this ProjectFile instance
|
|
304
308
|
|
|
305
309
|
### deserialize
|
|
306
310
|
|
|
@@ -308,7 +312,7 @@ Restore an entity created with serialize
|
|
|
308
312
|
|
|
309
313
|
#### Parameters
|
|
310
314
|
|
|
311
|
-
* `data` **[Object][
|
|
315
|
+
* `data` **[Object][139]** An input object created via `ProjectFiles.serialize()`
|
|
312
316
|
|
|
313
317
|
Returns **[ProjectFile][1]** A ProjectFile instance setup against the deserializzed data
|
|
314
318
|
|
|
@@ -320,19 +324,19 @@ Main Tera-Fy Client (class singleton) to be used in a frontend browser
|
|
|
320
324
|
|
|
321
325
|
Various settings to configure behaviour
|
|
322
326
|
|
|
323
|
-
Type: [Object][
|
|
327
|
+
Type: [Object][139]
|
|
324
328
|
|
|
325
329
|
#### Properties
|
|
326
330
|
|
|
327
|
-
* `devMode` **[Boolean][
|
|
328
|
-
* `verbosity` **[Number][
|
|
331
|
+
* `devMode` **[Boolean][147]** Operate in devMode - i.e. force outer refresh when encountering an existing TeraFy instance
|
|
332
|
+
* `verbosity` **[Number][141]** Verbosity level, the higher the more chatty TeraFY will be. Set to zero to disable all `debug()` call output
|
|
329
333
|
* `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
|
|
330
|
-
* `modeFallback` **[String][
|
|
331
|
-
* `modeTimeout` **[Number][
|
|
332
|
-
* `siteUrl` **[String][
|
|
333
|
-
* `restrictOrigin` **[String][
|
|
334
|
-
* `List` **[Array][
|
|
335
|
-
* `handshakeInterval` **[Number][
|
|
334
|
+
* `modeFallback` **[String][138]** Method to use when all method detection fails
|
|
335
|
+
* `modeTimeout` **[Number][141]** How long entities have in 'detect' mode to identify themselves
|
|
336
|
+
* `siteUrl` **[String][138]** The TERA URL to connect to
|
|
337
|
+
* `restrictOrigin` **[String][138]** URL to restrict communications to
|
|
338
|
+
* `List` **[Array][144]<[String][138]>** of sandbox allowables for the embedded if in embed mode
|
|
339
|
+
* `handshakeInterval` **[Number][141]** Interval in milliseconds when sanning for a handshake
|
|
336
340
|
|
|
337
341
|
### events
|
|
338
342
|
|
|
@@ -344,13 +348,13 @@ Type: Mitt
|
|
|
344
348
|
|
|
345
349
|
DOMElements for this TeraFy instance
|
|
346
350
|
|
|
347
|
-
Type: [Object][
|
|
351
|
+
Type: [Object][139]
|
|
348
352
|
|
|
349
353
|
#### Properties
|
|
350
354
|
|
|
351
355
|
* `el` **DOMElement** The main tera-fy div wrapper
|
|
352
356
|
* `iframe` **DOMElement** The internal iFrame element (if `settings.mode == 'child'`)
|
|
353
|
-
* `popup` **[Window][
|
|
357
|
+
* `popup` **[Window][148]** The popup window context (if `settings.mode == 'popup'`)
|
|
354
358
|
* `stylesheet` **DOMElement** The corresponding stylesheet
|
|
355
359
|
|
|
356
360
|
### methods
|
|
@@ -358,13 +362,13 @@ Type: [Object][135]
|
|
|
358
362
|
List of function stubs mapped from the server to here
|
|
359
363
|
This array is forms the reference of `TeraFy.METHOD()` objects to provide locally which will be mapped via `TeraFy.rpc(METHOD, ...args)`
|
|
360
364
|
|
|
361
|
-
Type: [Array][
|
|
365
|
+
Type: [Array][144]<[String][138]>
|
|
362
366
|
|
|
363
367
|
### plugins
|
|
364
368
|
|
|
365
369
|
Loaded plugins via Use()
|
|
366
370
|
|
|
367
|
-
Type: [Array][
|
|
371
|
+
Type: [Array][144]\<TeraFyPlugin>
|
|
368
372
|
|
|
369
373
|
### send
|
|
370
374
|
|
|
@@ -372,9 +376,9 @@ Send a message + wait for a response object
|
|
|
372
376
|
|
|
373
377
|
#### Parameters
|
|
374
378
|
|
|
375
|
-
* `message` **[Object][
|
|
379
|
+
* `message` **[Object][139]** Message object to send
|
|
376
380
|
|
|
377
|
-
Returns **[Promise][
|
|
381
|
+
Returns **[Promise][145]\<any>** A promise which resolves when the operation has completed with the remote reply
|
|
378
382
|
|
|
379
383
|
### sendRaw
|
|
380
384
|
|
|
@@ -383,7 +387,7 @@ This function does not return or wait for a reply - use `send()` for that
|
|
|
383
387
|
|
|
384
388
|
#### Parameters
|
|
385
389
|
|
|
386
|
-
* `message` **[Object][
|
|
390
|
+
* `message` **[Object][139]** Message object to send
|
|
387
391
|
|
|
388
392
|
### rpc
|
|
389
393
|
|
|
@@ -391,10 +395,10 @@ Call an RPC function in the server instance
|
|
|
391
395
|
|
|
392
396
|
#### Parameters
|
|
393
397
|
|
|
394
|
-
* `method` **[String][
|
|
398
|
+
* `method` **[String][138]** The method name to call
|
|
395
399
|
* `args` **...any** 
|
|
396
400
|
|
|
397
|
-
Returns **[Promise][
|
|
401
|
+
Returns **[Promise][145]\<any>** The resolved output of the server function
|
|
398
402
|
|
|
399
403
|
### acceptMessage
|
|
400
404
|
|
|
@@ -403,7 +407,7 @@ Accept an incoming message
|
|
|
403
407
|
#### Parameters
|
|
404
408
|
|
|
405
409
|
* `rawMessage`  
|
|
406
|
-
* `Raw` **[MessageEvent][
|
|
410
|
+
* `Raw` **[MessageEvent][149]** message event to process
|
|
407
411
|
|
|
408
412
|
### acceptPostboxes
|
|
409
413
|
|
|
@@ -412,27 +416,27 @@ Listening postboxes, these correspond to outgoing message IDs that expect a resp
|
|
|
412
416
|
### createProjectStatePatch
|
|
413
417
|
|
|
414
418
|
Create + transmit a new project state patch base on the current and previous states
|
|
415
|
-
The transmitted patch follows the [JSPatch][
|
|
419
|
+
The transmitted patch follows the [JSPatch][150] standard
|
|
416
420
|
This function accepts an entire projectState instance, computes the delta and transmits that to the server for merging
|
|
417
421
|
|
|
418
422
|
#### Parameters
|
|
419
423
|
|
|
420
|
-
* `newState` **[Object][
|
|
421
|
-
* `oldState` **[Object][
|
|
424
|
+
* `newState` **[Object][139]** The local projectState to accept
|
|
425
|
+
* `oldState` **[Object][139]** The previous projectState to examine against
|
|
422
426
|
|
|
423
|
-
Returns **[Promise][
|
|
427
|
+
Returns **[Promise][145]** A promise which will resolve when the operation has completed
|
|
424
428
|
|
|
425
429
|
### applyProjectStatePatchLocal
|
|
426
430
|
|
|
427
431
|
Client function which accepts a patch from the server and applies it to local project state
|
|
428
|
-
The patch should follow the [JSPatch][
|
|
432
|
+
The patch should follow the [JSPatch][150] standard
|
|
429
433
|
This function is expected to be sub-classed by a plugin
|
|
430
434
|
|
|
431
435
|
#### Parameters
|
|
432
436
|
|
|
433
|
-
* `patch` **[Array][
|
|
437
|
+
* `patch` **[Array][144]** A JSPatch patch to apply
|
|
434
438
|
|
|
435
|
-
Returns **[Promise][
|
|
439
|
+
Returns **[Promise][145]** A promise which will resolve when the operation has completed
|
|
436
440
|
|
|
437
441
|
### init
|
|
438
442
|
|
|
@@ -441,28 +445,28 @@ This function can only be called once and will return the existing init() worker
|
|
|
441
445
|
|
|
442
446
|
#### Parameters
|
|
443
447
|
|
|
444
|
-
* `options` **[Object][
|
|
448
|
+
* `options` **[Object][139]?** Additional options to merge into `settings` via `set`
|
|
445
449
|
|
|
446
|
-
Returns **[Promise][
|
|
450
|
+
Returns **[Promise][145]<[TeraFy][29]>** An eventual promise which will resovle with this terafy instance
|
|
447
451
|
|
|
448
452
|
### detectMode
|
|
449
453
|
|
|
450
454
|
Populate `settings.mode`
|
|
451
455
|
Try to communicate with a parent frame, if none assume we need to fallback to child mode
|
|
452
456
|
|
|
453
|
-
Returns **[Promise][
|
|
457
|
+
Returns **[Promise][145]<[String][138]>** A promise which will resolve with the detected mode to use
|
|
454
458
|
|
|
455
459
|
### injectComms
|
|
456
460
|
|
|
457
461
|
Find an existing active TERA server OR initalize one
|
|
458
462
|
|
|
459
|
-
Returns **[Promise][
|
|
463
|
+
Returns **[Promise][145]** A promise which will resolve when the loading has completed and we have found a parent TERA instance or initiallized a child
|
|
460
464
|
|
|
461
465
|
### injectStylesheet
|
|
462
466
|
|
|
463
467
|
Inject a local stylesheet to handle TERA server functionality
|
|
464
468
|
|
|
465
|
-
Returns **[Promise][
|
|
469
|
+
Returns **[Promise][145]** A promise which will resolve when the loading has completed and we have found a parent TERA instance or initiallized a child
|
|
466
470
|
|
|
467
471
|
### injectMethods
|
|
468
472
|
|
|
@@ -477,7 +481,7 @@ This function will only act if `settings.devMode` is truthy
|
|
|
477
481
|
|
|
478
482
|
* `msg` **...any** 
|
|
479
483
|
* `method` **(`"INFO"` | `"LOG"` | `"WARN"` | `"ERROR"`)** Logging method to use (optional, default `'LOG'`)
|
|
480
|
-
* `verboseLevel` **[Number][
|
|
484
|
+
* `verboseLevel` **[Number][141]** The verbosity level to trigger at. If `settings.verbosity` is lower than this, the message is ignored (optional, default `1`)
|
|
481
485
|
|
|
482
486
|
### set
|
|
483
487
|
|
|
@@ -486,8 +490,11 @@ This function also routes 'special' keys like `devMode` to their internal handle
|
|
|
486
490
|
|
|
487
491
|
#### Parameters
|
|
488
492
|
|
|
489
|
-
* `key` **([String][
|
|
493
|
+
* `key` **([String][138] | [Object][139])** Either a single setting key to set or an object to merge
|
|
490
494
|
* `value` **any** The value to set if `key` is a string
|
|
495
|
+
* `options` **[Object][139]?** Additional options to mutate behaviour
|
|
496
|
+
|
|
497
|
+
* `options.ignoreNullish` **[Boolean][147]** If falsy, this forces the setting of undefined or null values rather than ignoring them when specifying values by string (optional, default `true`)
|
|
491
498
|
|
|
492
499
|
Returns **[TeraFy][29]** This chainable terafy instance
|
|
493
500
|
|
|
@@ -499,8 +506,9 @@ Set or merge settings - but only in dev mode and only if the value is not undefi
|
|
|
499
506
|
|
|
500
507
|
#### Parameters
|
|
501
508
|
|
|
502
|
-
* `key` **([String][
|
|
509
|
+
* `key` **([String][138] | [Object][139])** Either a single setting key to set or an object to merge
|
|
503
510
|
* `value` **any** The value to set if `key` is a string
|
|
511
|
+
* `options` **[Object][139]?** Additional options to mutate behaviour
|
|
504
512
|
|
|
505
513
|
Returns **[TeraFy][29]** This chainable terafy instance
|
|
506
514
|
|
|
@@ -511,8 +519,8 @@ Include a TeraFy client plugin
|
|
|
511
519
|
#### Parameters
|
|
512
520
|
|
|
513
521
|
* `mod`  
|
|
514
|
-
* `options` **[Object][
|
|
515
|
-
* `The` **[Object][
|
|
522
|
+
* `options` **[Object][139]?** Additional options to mutate behaviour during construction (pass options to init() to intialize later options)
|
|
523
|
+
* `The` **[Object][139]** module function to include. Invoked as `(teraClient:TeraFy, options:Object)`
|
|
516
524
|
|
|
517
525
|
Returns **[TeraFy][29]** This chainable terafy instance
|
|
518
526
|
|
|
@@ -522,16 +530,20 @@ Internal function used by use() to merge an external declared singleton against
|
|
|
522
530
|
|
|
523
531
|
#### Parameters
|
|
524
532
|
|
|
525
|
-
* `target` **[Object][
|
|
526
|
-
* `source` **[Object][
|
|
533
|
+
* `target` **[Object][139]** Initalied class instance to extend
|
|
534
|
+
* `source` **[Object][139]** Initalized source object to extend from
|
|
527
535
|
|
|
528
536
|
### toggleDevMode
|
|
529
537
|
|
|
530
538
|
Set or toggle devMode
|
|
539
|
+
This function also accepts meta values:
|
|
540
|
+
|
|
541
|
+
'toggle' - Set dev mode to whatever the opposing value of the current mode
|
|
542
|
+
'proxy' - Optimize for using a loopback proxy
|
|
531
543
|
|
|
532
544
|
#### Parameters
|
|
533
545
|
|
|
534
|
-
* `devModeEnabled` **(
|
|
546
|
+
* `devModeEnabled` **(`"toggle"` | `"proxy"` | [Boolean][147])** Optional boolean to force dev mode or specify other behaviour (optional, default `'toggle'`)
|
|
535
547
|
|
|
536
548
|
Returns **[TeraFy][29]** This chainable terafy instance
|
|
537
549
|
|
|
@@ -542,7 +554,7 @@ This is usually because the server component wants to perform some user activity
|
|
|
542
554
|
|
|
543
555
|
#### Parameters
|
|
544
556
|
|
|
545
|
-
* `isFocused` **([String][
|
|
557
|
+
* `isFocused` **([String][138] | [Boolean][147])** Whether to fullscreen the embedded component (optional, default `'toggle'`)
|
|
546
558
|
|
|
547
559
|
### selectProjectFile
|
|
548
560
|
|
|
@@ -554,7 +566,7 @@ This is an pre-requisite step for requireProject()
|
|
|
554
566
|
|
|
555
567
|
* `options`  
|
|
556
568
|
|
|
557
|
-
Returns **[Promise][
|
|
569
|
+
Returns **[Promise][145]** A promise which will resolve if the there is a user and they are logged in
|
|
558
570
|
|
|
559
571
|
### getProjectFiles
|
|
560
572
|
|
|
@@ -562,12 +574,13 @@ Fetch the files associated with a given project
|
|
|
562
574
|
|
|
563
575
|
#### Parameters
|
|
564
576
|
|
|
565
|
-
* `options` **[Object][
|
|
577
|
+
* `options` **[Object][139]** Options which mutate behaviour
|
|
566
578
|
|
|
567
|
-
* `options.autoRequire` **[Boolean][
|
|
568
|
-
* `options.
|
|
579
|
+
* `options.autoRequire` **[Boolean][147]** Run `requireProject()` automatically before continuing (optional, default `true`)
|
|
580
|
+
* `options.lazy` **[Boolean][147]** 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`)
|
|
581
|
+
* `options.meta` **[Boolean][147]** Pull meta information for each file entity (optional, default `true`)
|
|
569
582
|
|
|
570
|
-
Returns **[Promise][
|
|
583
|
+
Returns **[Promise][145]<[Array][144]<[ProjectFile][1]>>** A collection of project files for the given project
|
|
571
584
|
|
|
572
585
|
### getProjectFile
|
|
573
586
|
|
|
@@ -576,13 +589,13 @@ Fetch a project file by its name
|
|
|
576
589
|
#### Parameters
|
|
577
590
|
|
|
578
591
|
* `id`  
|
|
579
|
-
* `name` **[String][
|
|
580
|
-
* `options` **([Object][
|
|
592
|
+
* `name` **[String][138]** The name + relative directory path component
|
|
593
|
+
* `options` **([Object][139] | [String][138])?** Additional options to mutate behaviour, if a string is given `options.subkey` is assumed
|
|
581
594
|
|
|
582
|
-
* `options.subkey` **[String][
|
|
583
|
-
* `options.cache` **[Boolean][
|
|
595
|
+
* `options.subkey` **[String][138]?** If specified only the extracted subkey is returned rather than the full object
|
|
596
|
+
* `options.cache` **[Boolean][147]** Use the existing file cache if possible, set to false to force a refresh of files from the server first (optional, default `true`)
|
|
584
597
|
|
|
585
|
-
Returns **[Promise][
|
|
598
|
+
Returns **[Promise][145]<[ProjectFile][1]>** The eventual fetched ProjectFile (or requested subkey)
|
|
586
599
|
|
|
587
600
|
### createProjectFile
|
|
588
601
|
|
|
@@ -591,9 +604,9 @@ This creates an empty file which can then be written to
|
|
|
591
604
|
|
|
592
605
|
#### Parameters
|
|
593
606
|
|
|
594
|
-
* `name` **[String][
|
|
607
|
+
* `name` **[String][138]** The name + relative directory path component
|
|
595
608
|
|
|
596
|
-
Returns **[Promise][
|
|
609
|
+
Returns **[Promise][145]<[ProjectFile][1]>** The eventual ProjectFile created
|
|
597
610
|
|
|
598
611
|
## handshake
|
|
599
612
|
|
|
@@ -601,9 +614,17 @@ Return basic server information as a form of validation
|
|
|
601
614
|
|
|
602
615
|
### Properties
|
|
603
616
|
|
|
604
|
-
* `date` **[Date][
|
|
617
|
+
* `date` **[Date][140]** Server date
|
|
618
|
+
|
|
619
|
+
Returns **[Promise][145]<[Object][139]>** Basic promise result
|
|
620
|
+
|
|
621
|
+
## setServerVerbosity
|
|
622
|
+
|
|
623
|
+
RPC callback to set the server verbostiy level
|
|
624
|
+
|
|
625
|
+
### Parameters
|
|
605
626
|
|
|
606
|
-
|
|
627
|
+
* `verbosity` **[Number][141]** The desired server verbosity level
|
|
607
628
|
|
|
608
629
|
## User
|
|
609
630
|
|
|
@@ -611,16 +632,16 @@ User / active session within TERA
|
|
|
611
632
|
|
|
612
633
|
### Properties
|
|
613
634
|
|
|
614
|
-
* `id` **[String][
|
|
615
|
-
* `email` **[String][
|
|
616
|
-
* `name` **[String][
|
|
617
|
-
* `isSubscribed` **[Boolean][
|
|
635
|
+
* `id` **[String][138]** Unique identifier of the user
|
|
636
|
+
* `email` **[String][138]** The email address of the current user
|
|
637
|
+
* `name` **[String][138]** The provided full name of the user
|
|
638
|
+
* `isSubscribed` **[Boolean][147]** Whether the active user has a TERA subscription
|
|
618
639
|
|
|
619
640
|
## getUser
|
|
620
641
|
|
|
621
642
|
Fetch the current session user
|
|
622
643
|
|
|
623
|
-
Returns **[Promise][
|
|
644
|
+
Returns **[Promise][145]<[User][82]>** The current logged in user or null if none
|
|
624
645
|
|
|
625
646
|
## requireUser
|
|
626
647
|
|
|
@@ -630,11 +651,11 @@ This is an pre-requisite step for requireProject()
|
|
|
630
651
|
|
|
631
652
|
### Parameters
|
|
632
653
|
|
|
633
|
-
* `options` **[Object][
|
|
654
|
+
* `options` **[Object][139]?** Additional options to mutate behaviour
|
|
634
655
|
|
|
635
|
-
* `options.forceRetry` **[Boolean][
|
|
656
|
+
* `options.forceRetry` **[Boolean][147]** Forcabily try to refresh the user state (optional, default `false`)
|
|
636
657
|
|
|
637
|
-
Returns **[Promise][
|
|
658
|
+
Returns **[Promise][145]<[User][82]>** The current logged in user or null if none
|
|
638
659
|
|
|
639
660
|
## Project
|
|
640
661
|
|
|
@@ -644,13 +665,13 @@ Project entry within TERA
|
|
|
644
665
|
|
|
645
666
|
Get the currently active project, if any
|
|
646
667
|
|
|
647
|
-
Returns **[Promise][
|
|
668
|
+
Returns **[Promise][145]<([Project][87] | null)>** The currently active project, if any
|
|
648
669
|
|
|
649
670
|
## getProjects
|
|
650
671
|
|
|
651
672
|
Get a list of projects the current session user has access to
|
|
652
673
|
|
|
653
|
-
Returns **[Promise][
|
|
674
|
+
Returns **[Promise][145]<[Array][144]<[Project][87]>>** Collection of projects the user has access to
|
|
654
675
|
|
|
655
676
|
## setActiveProject
|
|
656
677
|
|
|
@@ -658,7 +679,7 @@ Set the currently active project within TERA
|
|
|
658
679
|
|
|
659
680
|
### Parameters
|
|
660
681
|
|
|
661
|
-
* `project` **([Object][
|
|
682
|
+
* `project` **([Object][139] | [String][138])** The project to set as active - either the full Project object or its ID
|
|
662
683
|
|
|
663
684
|
## requireProject
|
|
664
685
|
|
|
@@ -667,14 +688,14 @@ Note that this function will percist in asking the uesr even if they try to canc
|
|
|
667
688
|
|
|
668
689
|
### Parameters
|
|
669
690
|
|
|
670
|
-
* `options` **[Object][
|
|
691
|
+
* `options` **[Object][139]?** Additional options to mutate behaviour
|
|
671
692
|
|
|
672
|
-
* `options.autoSetActiveProject` **[Boolean][
|
|
673
|
-
* `options.title` **[String][
|
|
674
|
-
* `options.noSelectTitle` **[String][
|
|
675
|
-
* `options.noSelectBody` **[String][
|
|
693
|
+
* `options.autoSetActiveProject` **[Boolean][147]** After selecting a project set that project as active in TERA (optional, default `true`)
|
|
694
|
+
* `options.title` **[String][138]** The title of the dialog to display (optional, default `"Select a project to work with"`)
|
|
695
|
+
* `options.noSelectTitle` **[String][138]** Dialog title when warning the user they need to select something (optional, default `'Select project'`)
|
|
696
|
+
* `options.noSelectBody` **[String][138]** Dialog body when warning the user they need to select something (optional, default `'A project needs to be selected to continue'`)
|
|
676
697
|
|
|
677
|
-
Returns **[Promise][
|
|
698
|
+
Returns **[Promise][145]<[Project][87]>** The active project
|
|
678
699
|
|
|
679
700
|
## selectProject
|
|
680
701
|
|
|
@@ -682,13 +703,13 @@ Prompt the user to select a project from those available
|
|
|
682
703
|
|
|
683
704
|
### Parameters
|
|
684
705
|
|
|
685
|
-
* `options` **[Object][
|
|
706
|
+
* `options` **[Object][139]?** Additional options to mutate behaviour
|
|
686
707
|
|
|
687
|
-
* `options.title` **[String][
|
|
688
|
-
* `options.allowCancel` **[Boolean][
|
|
689
|
-
* `options.setActive` **[Boolean][
|
|
708
|
+
* `options.title` **[String][138]** The title of the dialog to display (optional, default `"Select a project to work with"`)
|
|
709
|
+
* `options.allowCancel` **[Boolean][147]** Advertise cancelling the operation, the dialog can still be cancelled by closing it (optional, default `true`)
|
|
710
|
+
* `options.setActive` **[Boolean][147]** Also set the project as active when selected (optional, default `false`)
|
|
690
711
|
|
|
691
|
-
Returns **[Promise][
|
|
712
|
+
Returns **[Promise][145]<[Project][87]>** The active project
|
|
692
713
|
|
|
693
714
|
## getProjectState
|
|
694
715
|
|
|
@@ -696,12 +717,12 @@ Return the current, full snapshot state of the active project
|
|
|
696
717
|
|
|
697
718
|
### Parameters
|
|
698
719
|
|
|
699
|
-
* `options` **[Object][
|
|
720
|
+
* `options` **[Object][139]?** Additional options to mutate behaviour
|
|
700
721
|
|
|
701
|
-
* `options.autoRequire` **[Boolean][
|
|
702
|
-
* `Paths` **[Array][
|
|
722
|
+
* `options.autoRequire` **[Boolean][147]** Run `requireProject()` automatically before continuing (optional, default `true`)
|
|
723
|
+
* `Paths` **[Array][144]<[String][138]>** to subscribe to e.g. \['/users/'],
|
|
703
724
|
|
|
704
|
-
Returns **[Promise][
|
|
725
|
+
Returns **[Promise][145]<[Object][139]>** The current project state snapshot
|
|
705
726
|
|
|
706
727
|
## setProjectState
|
|
707
728
|
|
|
@@ -713,13 +734,13 @@ Paths can be any valid Lodash.set() value such as:
|
|
|
713
734
|
|
|
714
735
|
### Parameters
|
|
715
736
|
|
|
716
|
-
* `path` **([String][
|
|
737
|
+
* `path` **([String][138] | [Array][144]<[String][138]>)** The sub-path within the project state to set
|
|
717
738
|
* `value` **any** The value to set
|
|
718
|
-
* `options` **[Object][
|
|
739
|
+
* `options` **[Object][139]?** Additional options to mutate behaviour
|
|
719
740
|
|
|
720
|
-
* `options.save` **[Boolean][
|
|
741
|
+
* `options.save` **[Boolean][147]** Save the changes to the server immediately, disable to queue up multiple writes (optional, default `true`)
|
|
721
742
|
|
|
722
|
-
Returns **[Promise][
|
|
743
|
+
Returns **[Promise][145]** A promise which resolves when the operation has been dispatched to the server
|
|
723
744
|
|
|
724
745
|
## setProjectStateDefaults
|
|
725
746
|
|
|
@@ -729,31 +750,31 @@ Set a nested value within the project state - just like `setProjectState()` - bu
|
|
|
729
750
|
|
|
730
751
|
### Parameters
|
|
731
752
|
|
|
732
|
-
* `path` **([String][
|
|
753
|
+
* `path` **([String][138] | [Array][144]<[String][138]>)** The sub-path within the project state to set
|
|
733
754
|
* `value` **any** The value to set
|
|
734
|
-
* `options` **[Object][
|
|
755
|
+
* `options` **[Object][139]?** Additional options to mutate behaviour, see setProjectState() for the full list of supported options
|
|
735
756
|
|
|
736
|
-
Returns **[Promise][
|
|
757
|
+
Returns **[Promise][145]<[Boolean][147]>** A promise which resolves to whether any changes were made - True if defaults were applied, false otherwise
|
|
737
758
|
|
|
738
759
|
## setProjectStateFlush
|
|
739
760
|
|
|
740
761
|
Force copying local changes to the server
|
|
741
762
|
This is only ever needed when saving large quantities of data that need to be immediately available
|
|
742
763
|
|
|
743
|
-
Returns **[Promise][
|
|
764
|
+
Returns **[Promise][145]** A promise which resolves when the operation has completed
|
|
744
765
|
|
|
745
766
|
## setProjectStateRefresh
|
|
746
767
|
|
|
747
768
|
Force refetching the remote project state into local
|
|
748
769
|
This is only ever needed when saving large quantities of data that need to be immediately available
|
|
749
770
|
|
|
750
|
-
Returns **[Promise][
|
|
771
|
+
Returns **[Promise][145]** A promise which resolves when the operation has completed
|
|
751
772
|
|
|
752
773
|
## saveProjectState
|
|
753
774
|
|
|
754
775
|
Force-Save the currently active project state
|
|
755
776
|
|
|
756
|
-
Returns **[Promise][
|
|
777
|
+
Returns **[Promise][145]** A promise which resolves when the operation has completed
|
|
757
778
|
|
|
758
779
|
## replaceProjectState
|
|
759
780
|
|
|
@@ -764,9 +785,9 @@ You almost never want to use this function directly, see `setProjectState(path,
|
|
|
764
785
|
|
|
765
786
|
### Parameters
|
|
766
787
|
|
|
767
|
-
* `newState` **[Object][
|
|
788
|
+
* `newState` **[Object][139]** The new state to replace the current state with
|
|
768
789
|
|
|
769
|
-
Returns **[Promise][
|
|
790
|
+
Returns **[Promise][145]** A promise which resolves when the operation has completed
|
|
770
791
|
|
|
771
792
|
## applyProjectStatePatch
|
|
772
793
|
|
|
@@ -774,9 +795,9 @@ Apply a computed `just-diff` patch to the current project state
|
|
|
774
795
|
|
|
775
796
|
### Parameters
|
|
776
797
|
|
|
777
|
-
* `Patch` **[Object][
|
|
798
|
+
* `Patch` **[Object][139]** to apply
|
|
778
799
|
|
|
779
|
-
Returns **[Promise][
|
|
800
|
+
Returns **[Promise][145]** A promise which resolves when the operation has completed
|
|
780
801
|
|
|
781
802
|
## subscribeProjectState
|
|
782
803
|
|
|
@@ -784,7 +805,7 @@ Subscribe to project state changes
|
|
|
784
805
|
This will dispatch an RPC call to the source object `applyProjectStatePatchLocal()` function with the patch
|
|
785
806
|
If the above call fails the subscriber is assumed as dead and unsubscribed from the polling list
|
|
786
807
|
|
|
787
|
-
Returns **[Promise][
|
|
808
|
+
Returns **[Promise][145]<[Function][151]>** A promise which resolves when a subscription has been created, call the resulting function to unsubscribe
|
|
788
809
|
|
|
789
810
|
## FileFilters
|
|
790
811
|
|
|
@@ -792,10 +813,10 @@ Data structure for a file filter
|
|
|
792
813
|
|
|
793
814
|
### Properties
|
|
794
815
|
|
|
795
|
-
* `library` **[Boolean][
|
|
796
|
-
* `filename` **[String][
|
|
797
|
-
* `basename` **[String][
|
|
798
|
-
* `ext` **[String][
|
|
816
|
+
* `library` **[Boolean][147]?** Restrict to library files only
|
|
817
|
+
* `filename` **[String][138]?** CSV of @momsfriendlydevco/match expressions to filter the filename by (filenames are the basename sans extension)
|
|
818
|
+
* `basename` **[String][138]?** CSV of @momsfriendlydevco/match expressions to filter the basename by
|
|
819
|
+
* `ext` **[String][138]?** CSV of @momsfriendlydevco/match expressions to filter the file extension by
|
|
799
820
|
|
|
800
821
|
## selectProjectFile
|
|
801
822
|
|
|
@@ -803,20 +824,20 @@ Prompt the user to select a library to operate on
|
|
|
803
824
|
|
|
804
825
|
### Parameters
|
|
805
826
|
|
|
806
|
-
* `options` **[Object][
|
|
827
|
+
* `options` **[Object][139]?** Additional options to mutate behaviour
|
|
807
828
|
|
|
808
|
-
* `options.title` **[String][
|
|
809
|
-
* `options.hint` **([String][
|
|
810
|
-
* `options.save` **[Boolean][
|
|
811
|
-
* `options.filters` **[FileFilters][
|
|
812
|
-
* `options.allowUpload` **[Boolean][
|
|
813
|
-
* `options.allowRefresh` **[Boolean][
|
|
814
|
-
* `options.allowDownloadZip` **[Boolean][
|
|
815
|
-
* `options.allowCancel` **[Boolean][
|
|
816
|
-
* `options.autoRequire` **[Boolean][
|
|
817
|
-
* `options.filter` **[FileFilters][
|
|
829
|
+
* `options.title` **[String][138]** The title of the dialog to display (optional, default `"Select a file"`)
|
|
830
|
+
* `options.hint` **([String][138] | [Array][144]<[String][138]>)?** Hints to identify the file to select in array order of preference
|
|
831
|
+
* `options.save` **[Boolean][147]** Set to truthy if saving a new file, UI will adjust to allowing overwrite OR new file name input (optional, default `false`)
|
|
832
|
+
* `options.filters` **[FileFilters][110]?** Optional file filters
|
|
833
|
+
* `options.allowUpload` **[Boolean][147]** Allow uploading new files (optional, default `true`)
|
|
834
|
+
* `options.allowRefresh` **[Boolean][147]** Allow the user to manually refresh the file list (optional, default `true`)
|
|
835
|
+
* `options.allowDownloadZip` **[Boolean][147]** Allow the user to download a Zip of all files (optional, default `true`)
|
|
836
|
+
* `options.allowCancel` **[Boolean][147]** Allow cancelling the operation. Will throw `'CANCEL'` as the promise rejection if acationed (optional, default `true`)
|
|
837
|
+
* `options.autoRequire` **[Boolean][147]** Run `requireProject()` automatically before continuing (optional, default `true`)
|
|
838
|
+
* `options.filter` **[FileFilters][110]?** Optional file filters
|
|
818
839
|
|
|
819
|
-
Returns **[Promise][
|
|
840
|
+
Returns **[Promise][145]<[ProjectFile][1]>** The eventually selected file, if in save mode new files are created as stubs
|
|
820
841
|
|
|
821
842
|
## deleteProjectFile
|
|
822
843
|
|
|
@@ -824,9 +845,9 @@ Remove a project file by its ID
|
|
|
824
845
|
|
|
825
846
|
### Parameters
|
|
826
847
|
|
|
827
|
-
* `id` **[String][
|
|
848
|
+
* `id` **[String][138]** The File ID to remove
|
|
828
849
|
|
|
829
|
-
Returns **[Promise][
|
|
850
|
+
Returns **[Promise][145]** A promise which resolves when the operation has completed
|
|
830
851
|
|
|
831
852
|
## setProjectFile
|
|
832
853
|
|
|
@@ -834,10 +855,10 @@ Replace a project files contents
|
|
|
834
855
|
|
|
835
856
|
### Parameters
|
|
836
857
|
|
|
837
|
-
* `id` **[String][
|
|
838
|
-
* `contents` **(File | [Blob][
|
|
858
|
+
* `id` **[String][138]** File to overwrite
|
|
859
|
+
* `contents` **(File | [Blob][142] | [FormData][143] | [Object][139] | [Array][144])** The new file contents
|
|
839
860
|
|
|
840
|
-
Returns **[Promise][
|
|
861
|
+
Returns **[Promise][145]** A promise which will resolve when the write operation has completed
|
|
841
862
|
|
|
842
863
|
## selectProjectLibrary
|
|
843
864
|
|
|
@@ -845,18 +866,18 @@ Prompt the user to select a library to operate on and return a array of referenc
|
|
|
845
866
|
|
|
846
867
|
### Parameters
|
|
847
868
|
|
|
848
|
-
* `options` **[Object][
|
|
869
|
+
* `options` **[Object][139]?** Additional options to mutate behaviour
|
|
849
870
|
|
|
850
|
-
* `options.title` **[String][
|
|
851
|
-
* `options.hint` **([String][
|
|
852
|
-
* `options.allowUpload` **[Boolean][
|
|
853
|
-
* `options.allowRefresh` **[Boolean][
|
|
854
|
-
* `options.allowDownloadZip` **[Boolean][
|
|
855
|
-
* `options.allowCancel` **[Boolean][
|
|
856
|
-
* `options.autoRequire` **[Boolean][
|
|
857
|
-
* `options.filters` **[FileFilters][
|
|
871
|
+
* `options.title` **[String][138]** The title of the dialog to display (optional, default `"Select a citation library"`)
|
|
872
|
+
* `options.hint` **([String][138] | [Array][144]<[String][138]>)?** Hints to identify the library to select in array order of preference. Generally corresponds to the previous stage - e.g. 'deduped', 'review1', 'review2', 'dedisputed'
|
|
873
|
+
* `options.allowUpload` **[Boolean][147]** Allow uploading new files (optional, default `true`)
|
|
874
|
+
* `options.allowRefresh` **[Boolean][147]** Allow the user to manually refresh the file list (optional, default `true`)
|
|
875
|
+
* `options.allowDownloadZip` **[Boolean][147]** Allow the user to download a Zip of all files (optional, default `true`)
|
|
876
|
+
* `options.allowCancel` **[Boolean][147]** Allow cancelling the operation. Will throw `'CANCEL'` as the promise rejection if acationed (optional, default `true`)
|
|
877
|
+
* `options.autoRequire` **[Boolean][147]** Run `requireProject()` automatically before continuing (optional, default `true`)
|
|
878
|
+
* `options.filters` **[FileFilters][110]?** Optional file filters, defaults to citation library selection only
|
|
858
879
|
|
|
859
|
-
Returns **[Promise][
|
|
880
|
+
Returns **[Promise][145]<[Array][144]\<Ref>>** A collection of references from the selected file
|
|
860
881
|
|
|
861
882
|
## getProjectLibrary
|
|
862
883
|
|
|
@@ -864,15 +885,15 @@ Fetch + convert a project file into a library of citations
|
|
|
864
885
|
|
|
865
886
|
### Parameters
|
|
866
887
|
|
|
867
|
-
* `id` **[String][
|
|
868
|
-
* `options` **[Object][
|
|
888
|
+
* `id` **[String][138]** File ID to read
|
|
889
|
+
* `options` **[Object][139]?** Additional options to mutate behaviour
|
|
869
890
|
|
|
870
|
-
* `options.format` **[String][
|
|
871
|
-
* `options.autoRequire` **[Boolean][
|
|
872
|
-
* `options.filter` **[Function][
|
|
873
|
-
* `options.find` **[Function][
|
|
891
|
+
* `options.format` **[String][138]** Format for the file. ENUM: 'pojo' (return a parsed JS collection), 'blob' (raw JS Blob object), 'file' (named JS File object) (optional, default `'json'`)
|
|
892
|
+
* `options.autoRequire` **[Boolean][147]** Run `requireProject()` automatically before continuing (optional, default `true`)
|
|
893
|
+
* `options.filter` **[Function][151]?** Optional async file filter, called each time as `(File:ProjectFile)`
|
|
894
|
+
* `options.find` **[Function][151]?** Optional async final stage file filter to reduce all candidates down to one subject file
|
|
874
895
|
|
|
875
|
-
Returns **([Promise][
|
|
896
|
+
Returns **([Promise][145]<[Array][144]\<Ref>> | [Promise][145]\<any>)** A collection of references (default bevahiour) or a whatever format was requested
|
|
876
897
|
|
|
877
898
|
## setProjectLibrary
|
|
878
899
|
|
|
@@ -880,33 +901,33 @@ Save back a citation library from some input
|
|
|
880
901
|
|
|
881
902
|
### Parameters
|
|
882
903
|
|
|
883
|
-
* `id` **[String][
|
|
884
|
-
* `refs` **([Array][
|
|
885
|
-
* `options` **[Object][
|
|
904
|
+
* `id` **[String][138]?** File ID to save back to, if omitted a file will be prompted for
|
|
905
|
+
* `refs` **([Array][144]\<RefLibRef> | [Blob][142] | File)?** Collection of references for the selected library or the raw Blob/File
|
|
906
|
+
* `options` **[Object][139]?** Additional options to mutate behaviour
|
|
886
907
|
|
|
887
|
-
* `options.id` **[String][
|
|
888
|
-
* `options.refs` **([Array][
|
|
889
|
-
* `options.format` **[String][
|
|
890
|
-
* `options.autoRequire` **[Boolean][
|
|
891
|
-
* `options.hint` **[String][
|
|
892
|
-
* `options.filename` **[String][
|
|
893
|
-
* `options.title` **[String][
|
|
894
|
-
* `options.overwrite` **[Boolean][
|
|
895
|
-
* `options.meta` **[Object][
|
|
908
|
+
* `options.id` **[String][138]?** Alternate method to specify the file ID to save as, if omitted one will be prompted for
|
|
909
|
+
* `options.refs` **([Array][144]\<RefLibRef> | [Blob][142] | File)?** Alternate method to specify the refs to save as an array or raw Blob/File
|
|
910
|
+
* `options.format` **[String][138]** Input format used. ENUM: 'pojo' (return a parsed JS collection), 'blob' (raw JS Blob object), 'file' (named JS File object) (optional, default `'json'`)
|
|
911
|
+
* `options.autoRequire` **[Boolean][147]** Run `requireProject()` automatically before continuing (optional, default `true`)
|
|
912
|
+
* `options.hint` **[String][138]?** Hint to store against the library. Generally corresponds to the current operation being performed - e.g. 'deduped'
|
|
913
|
+
* `options.filename` **[String][138]?** Suggested filename if `id` is unspecified
|
|
914
|
+
* `options.title` **[String][138]** Dialog title if `id` is unspecified and a prompt is necessary (optional, default `'Save citation library'`)
|
|
915
|
+
* `options.overwrite` **[Boolean][147]** Allow existing file upsert (optional, default `true`)
|
|
916
|
+
* `options.meta` **[Object][139]?** Optional meta data to merge into the file data
|
|
896
917
|
|
|
897
|
-
Returns **[Promise][
|
|
918
|
+
Returns **[Promise][145]** A promise which resolves when the save operation has completed
|
|
898
919
|
|
|
899
920
|
## projectLog
|
|
900
921
|
|
|
901
922
|
Create a log entry for the currently active project
|
|
902
923
|
|
|
903
|
-
The required log object can be of various forms. See [https://tera-tools.com/api/logs.json][
|
|
924
|
+
The required log object can be of various forms. See [https://tera-tools.com/api/logs.json][152] for the full list
|
|
904
925
|
|
|
905
926
|
### Parameters
|
|
906
927
|
|
|
907
|
-
* `log` **[Object][
|
|
928
|
+
* `log` **[Object][139]** The log entry to create
|
|
908
929
|
|
|
909
|
-
Returns **[Promise][
|
|
930
|
+
Returns **[Promise][145]** A promise which resolves when the operation has completed
|
|
910
931
|
|
|
911
932
|
## setPageUrl
|
|
912
933
|
|
|
@@ -915,7 +936,7 @@ This only really makes a difference to tools within the tera-tools.com site wher
|
|
|
915
936
|
|
|
916
937
|
### Parameters
|
|
917
938
|
|
|
918
|
-
* `url` **[String][
|
|
939
|
+
* `url` **[String][138]** The URL to restore on next refresh
|
|
919
940
|
|
|
920
941
|
## setPageTitle
|
|
921
942
|
|
|
@@ -924,7 +945,7 @@ This is usually called by a tool nested within the tera-tools.com embed
|
|
|
924
945
|
|
|
925
946
|
### Parameters
|
|
926
947
|
|
|
927
|
-
* `title` **[String][
|
|
948
|
+
* `title` **[String][138]** The current page title
|
|
928
949
|
|
|
929
950
|
## uiAlert
|
|
930
951
|
|
|
@@ -932,25 +953,32 @@ Display simple text within TERA
|
|
|
932
953
|
|
|
933
954
|
### Parameters
|
|
934
955
|
|
|
935
|
-
* `text` **[String][
|
|
936
|
-
* `options` **[Object][
|
|
956
|
+
* `text` **[String][138]** The text to display
|
|
957
|
+
* `options` **[Object][139]?** Additional options to mutate behaviour
|
|
937
958
|
|
|
938
|
-
* `options.title` **[String][
|
|
939
|
-
* `options.isHtml` **[Boolean][
|
|
959
|
+
* `options.title` **[String][138]** The title of the alert box (optional, default `'TERA'`)
|
|
960
|
+
* `options.isHtml` **[Boolean][147]** If falsy the text is rendered as plain-text otherwise it will be assumed as HTML content (optional, default `false`)
|
|
940
961
|
|
|
941
|
-
Returns **[Promise][
|
|
962
|
+
Returns **[Promise][145]** A promise which resolves when the alert has been dismissed
|
|
942
963
|
|
|
943
|
-
##
|
|
964
|
+
## uiProgress
|
|
944
965
|
|
|
945
|
-
Display
|
|
946
|
-
|
|
966
|
+
Display, update or dispose of windows for long running tasks
|
|
967
|
+
All options are cumulative - i.e. they are merged with other options previously provided
|
|
947
968
|
|
|
948
969
|
### Parameters
|
|
949
970
|
|
|
950
|
-
* `
|
|
951
|
-
|
|
971
|
+
* `options` **([Object][139] | [Boolean][147])?** Additional options to mutate behaviour, if boolean false `{close: true}` is assumed
|
|
972
|
+
|
|
973
|
+
* `options.title` **[String][138]** Window title, can only be set on the initial call (optional, default `'TERA'`)
|
|
974
|
+
* `options.body` **[String][138]** Window body text, can only be set on the initial call (optional, default `''`)
|
|
975
|
+
* `options.bodyHtml` **[Boolean][147]** Treat body text as HTML (optional, default `false`)
|
|
976
|
+
* `options.close` **[Boolean][147]** Close the existing dialog, if true the dialog is disposed and options reset (optional, default `false`)
|
|
977
|
+
* `options.text` **[String][138]?** The text of the task being conducted
|
|
978
|
+
* `options.progress` **[Number][141]?** The current progress of the task being conducted, this is assumed to be a value less than `maxProgress`
|
|
979
|
+
* `options.maxProgress` **[Number][141]?** The maximum value that the progress can be
|
|
952
980
|
|
|
953
|
-
|
|
981
|
+
Returns **[Promise][145]** A promise which resolves when the dialog has been updated
|
|
954
982
|
|
|
955
983
|
## uiWindow
|
|
956
984
|
|
|
@@ -958,16 +986,28 @@ Open a popup window containing a new site
|
|
|
958
986
|
|
|
959
987
|
### Parameters
|
|
960
988
|
|
|
961
|
-
* `url` **[String][
|
|
962
|
-
* `options` **[Object][
|
|
989
|
+
* `url` **[String][138]** The URL to open
|
|
990
|
+
* `options` **[Object][139]?** Additional options to mutate behaviour
|
|
963
991
|
|
|
964
|
-
* `options.width` **[Number][
|
|
965
|
-
* `options.height` **[Number][
|
|
966
|
-
* `options.center` **[Boolean][
|
|
967
|
-
* `options.permissions` **[Object][
|
|
992
|
+
* `options.width` **[Number][141]** The desired width of the window (optional, default `500`)
|
|
993
|
+
* `options.height` **[Number][141]** The desired height of the window (optional, default `600`)
|
|
994
|
+
* `options.center` **[Boolean][147]** Attempt to center the window on the screen (optional, default `true`)
|
|
995
|
+
* `options.permissions` **[Object][139]?** Additional permissions to set on opening, defaults to a suitable set of permission for popups (see code)
|
|
968
996
|
|
|
969
997
|
Returns **WindowProxy** The opened window object (if `noopener` is not set in permissions)
|
|
970
998
|
|
|
999
|
+
## uiSplat
|
|
1000
|
+
|
|
1001
|
+
Display HTML content full-screen within TERA
|
|
1002
|
+
This function is ideally called within a requestFocus() wrapper
|
|
1003
|
+
|
|
1004
|
+
### Parameters
|
|
1005
|
+
|
|
1006
|
+
* `content` **(DOMElement | [String][138] | `false`)** Either a prepared DOM element or string to compile, set to falsy to remove existing content
|
|
1007
|
+
* `options` **[Object][139]?** Additional options to mutate behaviour
|
|
1008
|
+
|
|
1009
|
+
* `options.logo` **([Boolean][147] | [String][138])** Add a logo to the output, if boolean true the Tera-tools logo is used otherwise specify a path or URL (optional, default `false`)
|
|
1010
|
+
|
|
971
1011
|
[1]: #projectfile
|
|
972
1012
|
|
|
973
1013
|
[2]: #id
|
|
@@ -1126,140 +1166,148 @@ Returns **WindowProxy** The opened window object (if `noopener` is not set in pe
|
|
|
1126
1166
|
|
|
1127
1167
|
[79]: #properties-3
|
|
1128
1168
|
|
|
1129
|
-
[80]: #
|
|
1169
|
+
[80]: #setserververbosity
|
|
1130
1170
|
|
|
1131
|
-
[81]: #
|
|
1171
|
+
[81]: #parameters-21
|
|
1132
1172
|
|
|
1133
|
-
[82]: #
|
|
1173
|
+
[82]: #user
|
|
1134
1174
|
|
|
1135
|
-
[83]: #
|
|
1175
|
+
[83]: #properties-4
|
|
1136
1176
|
|
|
1137
|
-
[84]: #
|
|
1177
|
+
[84]: #getuser
|
|
1138
1178
|
|
|
1139
|
-
[85]: #
|
|
1179
|
+
[85]: #requireuser
|
|
1140
1180
|
|
|
1141
|
-
[86]: #
|
|
1181
|
+
[86]: #parameters-22
|
|
1142
1182
|
|
|
1143
|
-
[87]: #
|
|
1183
|
+
[87]: #project
|
|
1144
1184
|
|
|
1145
|
-
[88]: #
|
|
1185
|
+
[88]: #getproject
|
|
1146
1186
|
|
|
1147
|
-
[89]: #
|
|
1187
|
+
[89]: #getprojects
|
|
1148
1188
|
|
|
1149
|
-
[90]: #
|
|
1189
|
+
[90]: #setactiveproject
|
|
1150
1190
|
|
|
1151
1191
|
[91]: #parameters-23
|
|
1152
1192
|
|
|
1153
|
-
[92]: #
|
|
1193
|
+
[92]: #requireproject
|
|
1154
1194
|
|
|
1155
1195
|
[93]: #parameters-24
|
|
1156
1196
|
|
|
1157
|
-
[94]: #
|
|
1197
|
+
[94]: #selectproject
|
|
1158
1198
|
|
|
1159
1199
|
[95]: #parameters-25
|
|
1160
1200
|
|
|
1161
|
-
[96]: #
|
|
1201
|
+
[96]: #getprojectstate
|
|
1162
1202
|
|
|
1163
1203
|
[97]: #parameters-26
|
|
1164
1204
|
|
|
1165
|
-
[98]: #
|
|
1205
|
+
[98]: #setprojectstate
|
|
1166
1206
|
|
|
1167
1207
|
[99]: #parameters-27
|
|
1168
1208
|
|
|
1169
|
-
[100]: #
|
|
1209
|
+
[100]: #setprojectstatedefaults
|
|
1170
1210
|
|
|
1171
|
-
[101]: #
|
|
1211
|
+
[101]: #parameters-28
|
|
1172
1212
|
|
|
1173
|
-
[102]: #
|
|
1213
|
+
[102]: #setprojectstateflush
|
|
1174
1214
|
|
|
1175
|
-
[103]: #
|
|
1215
|
+
[103]: #setprojectstaterefresh
|
|
1176
1216
|
|
|
1177
|
-
[104]: #
|
|
1217
|
+
[104]: #saveprojectstate
|
|
1178
1218
|
|
|
1179
|
-
[105]: #
|
|
1219
|
+
[105]: #replaceprojectstate
|
|
1180
1220
|
|
|
1181
1221
|
[106]: #parameters-29
|
|
1182
1222
|
|
|
1183
|
-
[107]: #
|
|
1223
|
+
[107]: #applyprojectstatepatch
|
|
1184
1224
|
|
|
1185
|
-
[108]: #
|
|
1225
|
+
[108]: #parameters-30
|
|
1186
1226
|
|
|
1187
|
-
[109]: #
|
|
1227
|
+
[109]: #subscribeprojectstate
|
|
1188
1228
|
|
|
1189
|
-
[110]: #
|
|
1229
|
+
[110]: #filefilters
|
|
1190
1230
|
|
|
1191
|
-
[111]: #
|
|
1231
|
+
[111]: #properties-5
|
|
1192
1232
|
|
|
1193
|
-
[112]: #
|
|
1233
|
+
[112]: #selectprojectfile-1
|
|
1194
1234
|
|
|
1195
1235
|
[113]: #parameters-31
|
|
1196
1236
|
|
|
1197
|
-
[114]: #
|
|
1237
|
+
[114]: #deleteprojectfile
|
|
1198
1238
|
|
|
1199
1239
|
[115]: #parameters-32
|
|
1200
1240
|
|
|
1201
|
-
[116]: #
|
|
1241
|
+
[116]: #setprojectfile
|
|
1202
1242
|
|
|
1203
1243
|
[117]: #parameters-33
|
|
1204
1244
|
|
|
1205
|
-
[118]: #
|
|
1245
|
+
[118]: #selectprojectlibrary
|
|
1206
1246
|
|
|
1207
1247
|
[119]: #parameters-34
|
|
1208
1248
|
|
|
1209
|
-
[120]: #
|
|
1249
|
+
[120]: #getprojectlibrary
|
|
1210
1250
|
|
|
1211
1251
|
[121]: #parameters-35
|
|
1212
1252
|
|
|
1213
|
-
[122]: #
|
|
1253
|
+
[122]: #setprojectlibrary
|
|
1214
1254
|
|
|
1215
1255
|
[123]: #parameters-36
|
|
1216
1256
|
|
|
1217
|
-
[124]: #
|
|
1257
|
+
[124]: #projectlog
|
|
1218
1258
|
|
|
1219
1259
|
[125]: #parameters-37
|
|
1220
1260
|
|
|
1221
|
-
[126]: #
|
|
1261
|
+
[126]: #setpageurl
|
|
1222
1262
|
|
|
1223
1263
|
[127]: #parameters-38
|
|
1224
1264
|
|
|
1225
|
-
[128]: #
|
|
1265
|
+
[128]: #setpagetitle
|
|
1226
1266
|
|
|
1227
1267
|
[129]: #parameters-39
|
|
1228
1268
|
|
|
1229
|
-
[130]: #
|
|
1269
|
+
[130]: #uialert
|
|
1230
1270
|
|
|
1231
1271
|
[131]: #parameters-40
|
|
1232
1272
|
|
|
1233
|
-
[132]: #
|
|
1273
|
+
[132]: #uiprogress
|
|
1234
1274
|
|
|
1235
1275
|
[133]: #parameters-41
|
|
1236
1276
|
|
|
1237
|
-
[134]:
|
|
1277
|
+
[134]: #uiwindow
|
|
1278
|
+
|
|
1279
|
+
[135]: #parameters-42
|
|
1280
|
+
|
|
1281
|
+
[136]: #uisplat
|
|
1282
|
+
|
|
1283
|
+
[137]: #parameters-43
|
|
1284
|
+
|
|
1285
|
+
[138]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
|
1238
1286
|
|
|
1239
|
-
[
|
|
1287
|
+
[139]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
|
|
1240
1288
|
|
|
1241
|
-
[
|
|
1289
|
+
[140]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date
|
|
1242
1290
|
|
|
1243
|
-
[
|
|
1291
|
+
[141]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
|
1244
1292
|
|
|
1245
|
-
[
|
|
1293
|
+
[142]: https://developer.mozilla.org/docs/Web/API/Blob
|
|
1246
1294
|
|
|
1247
|
-
[
|
|
1295
|
+
[143]: https://developer.mozilla.org/docs/Web/API/FormData
|
|
1248
1296
|
|
|
1249
|
-
[
|
|
1297
|
+
[144]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
|
1250
1298
|
|
|
1251
|
-
[
|
|
1299
|
+
[145]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
|
1252
1300
|
|
|
1253
|
-
[
|
|
1301
|
+
[146]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm
|
|
1254
1302
|
|
|
1255
|
-
[
|
|
1303
|
+
[147]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
|
|
1256
1304
|
|
|
1257
|
-
[
|
|
1305
|
+
[148]: https://developer.mozilla.org/docs/Web/API/Window
|
|
1258
1306
|
|
|
1259
|
-
[
|
|
1307
|
+
[149]: https://developer.mozilla.org/docs/Web/API/MessageEvent
|
|
1260
1308
|
|
|
1261
|
-
[
|
|
1309
|
+
[150]: http://jsonpatch.com
|
|
1262
1310
|
|
|
1263
|
-
[
|
|
1311
|
+
[151]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
|
|
1264
1312
|
|
|
1265
|
-
[
|
|
1313
|
+
[152]: https://tera-tools.com/api/logs.json
|