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