@iebh/tera-fy 1.0.15 → 1.0.17

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/README.md CHANGED
@@ -6,8 +6,9 @@ TERA website worker, intended to be embedded with TERA tools.
6
6
  * [TERA-fy API (Markdown, single page)](./api.md)
7
7
  * [API playground](https://iebh.github.io/TERA-fy/playground.html)
8
8
  * [TERA-Explorer](https://github.com/IEBH/TERA-explorer) - A simple example project using TERA-fy
9
- - [Live standalone version](https://explorer.tera-tools.com/)
10
- - [Live Embedded version](https://tera-tools.com/explorer)
9
+ - [Live standalone version](https://explorer.tera-tools.com/)
10
+ - [Live Embedded version](https://tera-tools.com/explorer)
11
+ * [File Hints reference](./hints.md)
11
12
 
12
13
  TERA-fy is a add-on module which extends 3rd party tools with functionality from the [TERA](https://tera-tools.com) project. It provides various functionality like data sync with the parent TERA instance, file upload/download, citation library access and other utilities.
13
14
 
package/api.md CHANGED
@@ -75,12 +75,14 @@
75
75
  * [Properties][71]
76
76
  * [getProjectFiles][72]
77
77
  * [Parameters][73]
78
- * [getProjectLibrary][74]
78
+ * [selectProjectLibrary][74]
79
79
  * [Parameters][75]
80
80
  * [setProjectLibrary][76]
81
81
  * [Parameters][77]
82
- * [uiAlert][78]
82
+ * [setProjectLibrary][78]
83
83
  * [Parameters][79]
84
+ * [uiAlert][80]
85
+ * [Parameters][81]
84
86
 
85
87
  ## TeraFy
86
88
 
@@ -90,16 +92,16 @@ Main Tera-Fy Client (class singleton) to be used in a frontend browser
90
92
 
91
93
  Various settings to configure behaviour
92
94
 
93
- Type: [Object][80]
95
+ Type: [Object][82]
94
96
 
95
97
  #### Properties
96
98
 
97
- * `devMode` **[Boolean][81]** Operate in devMode - i.e. force outer refresh when encountering an existing TeraFy instance
99
+ * `devMode` **[Boolean][83]** Operate in devMode - i.e. force outer refresh when encountering an existing TeraFy instance
98
100
  * `How` **(`"detect"` | `"parent"` | `"child"`)** 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 fallsback to 'child'
99
- * `modeTimeout` **[Number][82]** How long entities have in 'detect' mode to identify themselves
100
- * `siteUrl` **[String][83]** The TERA URL to connect to
101
- * `restrictOrigin` **[String][83]** URL to restrict communications to
102
- * `List` **[Array][84]<[String][83]>** of sandbox allowables for the embedded if in embed mode
101
+ * `modeTimeout` **[Number][84]** How long entities have in 'detect' mode to identify themselves
102
+ * `siteUrl` **[String][85]** The TERA URL to connect to
103
+ * `restrictOrigin` **[String][85]** URL to restrict communications to
104
+ * `List` **[Array][86]<[String][85]>** of sandbox allowables for the embedded if in embed mode
103
105
 
104
106
  ### events
105
107
 
@@ -111,7 +113,7 @@ Type: Mitt
111
113
 
112
114
  DOMElements for this TeraFy instance
113
115
 
114
- Type: [Object][80]
116
+ Type: [Object][82]
115
117
 
116
118
  #### Properties
117
119
 
@@ -124,13 +126,13 @@ Type: [Object][80]
124
126
  List of function stubs mapped here from the server
125
127
  This array is forms the reference of `TeraFy.METHOD()` objects to provide locally which will be mapped via `TeraFy.rpc(METHOD, ...args)`
126
128
 
127
- Type: [Array][84]<[String][83]>
129
+ Type: [Array][86]<[String][85]>
128
130
 
129
131
  ### plugins
130
132
 
131
133
  Loaded plugins via Use()
132
134
 
133
- Type: [Array][84]\<TeraFyPlugin>
135
+ Type: [Array][86]\<TeraFyPlugin>
134
136
 
135
137
  ### send
136
138
 
@@ -138,9 +140,9 @@ Send a message + wait for a response object
138
140
 
139
141
  #### Parameters
140
142
 
141
- * `message` **[Object][80]** Message object to send
143
+ * `message` **[Object][82]** Message object to send
142
144
 
143
- Returns **[Promise][85]\<any>** A promise which resolves when the operation has completed with the remote reply
145
+ Returns **[Promise][87]\<any>** A promise which resolves when the operation has completed with the remote reply
144
146
 
145
147
  ### sendRaw
146
148
 
@@ -149,7 +151,7 @@ This function does not return or wait for a reply - use `send()` for that
149
151
 
150
152
  #### Parameters
151
153
 
152
- * `message` **[Object][80]** Message object to send
154
+ * `message` **[Object][82]** Message object to send
153
155
 
154
156
  ### rpc
155
157
 
@@ -157,10 +159,10 @@ Call an RPC function in the server instance
157
159
 
158
160
  #### Parameters
159
161
 
160
- * `method` **[String][83]** The method name to call
162
+ * `method` **[String][85]** The method name to call
161
163
  * `args` **...any**&#x20;
162
164
 
163
- Returns **[Promise][85]\<any>** The resolved output of the server function
165
+ Returns **[Promise][87]\<any>** The resolved output of the server function
164
166
 
165
167
  ### acceptMessage
166
168
 
@@ -169,7 +171,7 @@ Accept an incoming message
169
171
  #### Parameters
170
172
 
171
173
  * `rawMessage` &#x20;
172
- * `Raw` **[MessageEvent][86]** message event to process
174
+ * `Raw` **[MessageEvent][88]** message event to process
173
175
 
174
176
  ### acceptPostboxes
175
177
 
@@ -178,27 +180,27 @@ Listening postboxes, these correspond to outgoing message IDs that expect a resp
178
180
  ### createProjectStatePatch
179
181
 
180
182
  Create + transmit a new project state patch base on the current and previous states
181
- The transmitted patch follows the [JSPatch][87] standard
183
+ The transmitted patch follows the [JSPatch][89] standard
182
184
  This function accepts an entire projectState instance, computes the delta and transmits that to the server for merging
183
185
 
184
186
  #### Parameters
185
187
 
186
- * `newState` **[Object][80]** The local projectState to accept
187
- * `oldState` **[Object][80]** The previous projectState to examine against
188
+ * `newState` **[Object][82]** The local projectState to accept
189
+ * `oldState` **[Object][82]** The previous projectState to examine against
188
190
 
189
- Returns **[Promise][85]** A promise which will resolve when the operation has completed
191
+ Returns **[Promise][87]** A promise which will resolve when the operation has completed
190
192
 
191
193
  ### applyProjectStatePatchLocal
192
194
 
193
195
  Client function which accepts a patch from the server and applies it to local project state
194
- The patch should follow the [JSPatch][87] standard
196
+ The patch should follow the [JSPatch][89] standard
195
197
  This function is expected to be sub-classed by a plugin
196
198
 
197
199
  #### Parameters
198
200
 
199
- * `patch` **[Array][84]** A JSPatch patch to apply
201
+ * `patch` **[Array][86]** A JSPatch patch to apply
200
202
 
201
- Returns **[Promise][85]** A promise which will resolve when the operation has completed
203
+ Returns **[Promise][87]** A promise which will resolve when the operation has completed
202
204
 
203
205
  ### init
204
206
 
@@ -207,22 +209,22 @@ This function can only be called once and will return the existing init() worker
207
209
 
208
210
  #### Parameters
209
211
 
210
- * `options` **[Object][80]?** Additional options to merge into `settings` via `set`
212
+ * `options` **[Object][82]?** Additional options to merge into `settings` via `set`
211
213
 
212
- Returns **[Promise][85]<[TeraFy][1]>** An eventual promise which will resovle with this terafy instance
214
+ Returns **[Promise][87]<[TeraFy][1]>** An eventual promise which will resovle with this terafy instance
213
215
 
214
216
  ### detectMode
215
217
 
216
218
  Populate `settings.mode`
217
219
  Try to communicate with a parent frame, if none assume we need to fallback to child mode
218
220
 
219
- Returns **[Promise][85]<[String][83]>** A promise which will resolve with the detected mode to use
221
+ Returns **[Promise][87]<[String][85]>** A promise which will resolve with the detected mode to use
220
222
 
221
223
  ### injectComms
222
224
 
223
225
  Find an existing active TERA server OR initalize one
224
226
 
225
- Returns **[Promise][85]** A promise which will resolve when the loading has completed and we have found a parent TERA instance or initiallized a child
227
+ Returns **[Promise][87]** A promise which will resolve when the loading has completed and we have found a parent TERA instance or initiallized a child
226
228
 
227
229
  ### injectStylesheet
228
230
 
@@ -249,7 +251,7 @@ This function also routes 'special' keys like `devMode` to their internal handle
249
251
 
250
252
  #### Parameters
251
253
 
252
- * `key` **([String][83] | [Object][80])** Either a single setting key to set or an object to merge
254
+ * `key` **([String][85] | [Object][82])** Either a single setting key to set or an object to merge
253
255
  * `value` **any** The value to set if `key` is a string
254
256
 
255
257
  Returns **[TeraFy][1]** This chainable terafy instance
@@ -258,11 +260,11 @@ Returns **[TeraFy][1]** This chainable terafy instance
258
260
 
259
261
  * **See**: set()
260
262
 
261
- Set or merge settings - but only in dev mode
263
+ Set or merge settings - but only in dev mode and only if the value is not undefined
262
264
 
263
265
  #### Parameters
264
266
 
265
- * `key` **([String][83] | [Object][80])** Either a single setting key to set or an object to merge
267
+ * `key` **([String][85] | [Object][82])** Either a single setting key to set or an object to merge
266
268
  * `value` **any** The value to set if `key` is a string
267
269
 
268
270
  Returns **[TeraFy][1]** This chainable terafy instance
@@ -274,8 +276,8 @@ Include a TeraFy client plugin
274
276
  #### Parameters
275
277
 
276
278
  * `mod` &#x20;
277
- * `options` **[Object][80]?** Additional options to mutate behaviour during construction (pass options to init() to intialize later options)
278
- * `The` **[Object][80]** module function to include. Invoked as `(teraClient:TeraFy, options:Object)`
279
+ * `options` **[Object][82]?** Additional options to mutate behaviour during construction (pass options to init() to intialize later options)
280
+ * `The` **[Object][82]** module function to include. Invoked as `(teraClient:TeraFy, options:Object)`
279
281
 
280
282
  Returns **[TeraFy][1]** This chainable terafy instance
281
283
 
@@ -285,8 +287,8 @@ Internal function used by use() to merge an external declared singleton against
285
287
 
286
288
  #### Parameters
287
289
 
288
- * `target` **[Object][80]** Initalied class instance to extend
289
- * `source` **[Object][80]** Initalized source object to extend from
290
+ * `target` **[Object][82]** Initalied class instance to extend
291
+ * `source` **[Object][82]** Initalized source object to extend from
290
292
 
291
293
  ### toggleDevMode
292
294
 
@@ -294,7 +296,7 @@ Set or toggle devMode
294
296
 
295
297
  #### Parameters
296
298
 
297
- * `devModeEnabled` **([String][83] | [Boolean][81])** Optional boolean to force dev mode (optional, default `'toggle'`)
299
+ * `devModeEnabled` **([String][85] | [Boolean][83])** Optional boolean to force dev mode (optional, default `'toggle'`)
298
300
 
299
301
  Returns **[TeraFy][1]** This chainable terafy instance
300
302
 
@@ -305,7 +307,7 @@ This is usually because the server component wants to perform some user activity
305
307
 
306
308
  #### Parameters
307
309
 
308
- * `isFocused` **([String][83] | [Boolean][81])** Whether to fullscreen the embedded component (optional, default `'toggle'`)
310
+ * `isFocused` **([String][85] | [Boolean][83])** Whether to fullscreen the embedded component (optional, default `'toggle'`)
309
311
 
310
312
  ## handshake
311
313
 
@@ -313,9 +315,9 @@ Return basic server information as a form of validation
313
315
 
314
316
  ### Properties
315
317
 
316
- * `date` **[Date][88]** Server date
318
+ * `date` **[Date][90]** Server date
317
319
 
318
- Returns **[Promise][85]<[Object][80]>** Basic promise result
320
+ Returns **[Promise][87]<[Object][82]>** Basic promise result
319
321
 
320
322
  ## User
321
323
 
@@ -323,16 +325,16 @@ User / active session within TERA
323
325
 
324
326
  ### Properties
325
327
 
326
- * `id` **[String][83]** Unique identifier of the user
327
- * `email` **[String][83]** The email address of the current user
328
- * `name` **[String][83]** The provided full name of the user
329
- * `isSubscribed` **[Boolean][81]** Whether the active user has a TERA subscription
328
+ * `id` **[String][85]** Unique identifier of the user
329
+ * `email` **[String][85]** The email address of the current user
330
+ * `name` **[String][85]** The provided full name of the user
331
+ * `isSubscribed` **[Boolean][83]** Whether the active user has a TERA subscription
330
332
 
331
333
  ## getUser
332
334
 
333
335
  Fetch the current session user
334
336
 
335
- Returns **[Promise][85]<[User][44]>** The current logged in user or null if none
337
+ Returns **[Promise][87]<[User][44]>** The current logged in user or null if none
336
338
 
337
339
  ## requireUser
338
340
 
@@ -340,7 +342,7 @@ Require a user login to TERA
340
342
  If there is no user OR they are not logged in a prompt is shown to go and do so
341
343
  This is an pre-requisite step for requireProject()
342
344
 
343
- Returns **[Promise][85]** A promise which will resolve if the there is a user and they are logged in
345
+ Returns **[Promise][87]** A promise which will resolve if the there is a user and they are logged in
344
346
 
345
347
  ##
346
348
 
@@ -348,7 +350,7 @@ Require a user login to TERA
348
350
  If there is no user OR they are not logged in a prompt is shown to go and do so
349
351
  This is an pre-requisite step for requireProject()
350
352
 
351
- Returns **[Promise][85]** A promise which will resolve if the there is a user and they are logged in
353
+ Returns **[Promise][87]** A promise which will resolve if the there is a user and they are logged in
352
354
 
353
355
  ## Project
354
356
 
@@ -358,13 +360,13 @@ Project entry within TERA
358
360
 
359
361
  Get the currently active project, if any
360
362
 
361
- Returns **[Promise][85]<([Project][49] | null)>** The currently active project, if any
363
+ Returns **[Promise][87]<([Project][49] | null)>** The currently active project, if any
362
364
 
363
365
  ## getProjects
364
366
 
365
367
  Get a list of projects the current session user has access to
366
368
 
367
- Returns **[Promise][85]<[Array][84]<[Project][49]>>** Collection of projects the user has access to
369
+ Returns **[Promise][87]<[Array][86]<[Project][49]>>** Collection of projects the user has access to
368
370
 
369
371
  ## setActiveProject
370
372
 
@@ -372,7 +374,7 @@ Set the currently active project within TERA
372
374
 
373
375
  ### Parameters
374
376
 
375
- * `project` **([Object][80] | [String][83])** The project to set as active - either the full Project object or its ID
377
+ * `project` **([Object][82] | [String][85])** The project to set as active - either the full Project object or its ID
376
378
 
377
379
  ## requireProject
378
380
 
@@ -381,14 +383,14 @@ Note that this function will percist in asking the uesr even if they try to canc
381
383
 
382
384
  ### Parameters
383
385
 
384
- * `options` **[Object][80]?** Additional options to mutate behaviour
386
+ * `options` **[Object][82]?** Additional options to mutate behaviour
385
387
 
386
- * `options.autoSetActiveProject` **[Boolean][81]** After selecting a project set that project as active in TERA (optional, default `true`)
387
- * `options.title` **[String][83]** The title of the dialog to display (optional, default `"Select a project to work with"`)
388
- * `options.noSelectTitle` **[String][83]** Dialog title when warning the user they need to select something (optional, default `'Select project'`)
389
- * `options.noSelectBody` **[String][83]** Dialog body when warning the user they need to select something (optional, default `'A project needs to be selected to continue'`)
388
+ * `options.autoSetActiveProject` **[Boolean][83]** After selecting a project set that project as active in TERA (optional, default `true`)
389
+ * `options.title` **[String][85]** The title of the dialog to display (optional, default `"Select a project to work with"`)
390
+ * `options.noSelectTitle` **[String][85]** Dialog title when warning the user they need to select something (optional, default `'Select project'`)
391
+ * `options.noSelectBody` **[String][85]** Dialog body when warning the user they need to select something (optional, default `'A project needs to be selected to continue'`)
390
392
 
391
- Returns **[Promise][85]<[Project][49]>** The active project
393
+ Returns **[Promise][87]<[Project][49]>** The active project
392
394
 
393
395
  ## selectProject
394
396
 
@@ -396,13 +398,13 @@ Prompt the user to select a project from those available
396
398
 
397
399
  ### Parameters
398
400
 
399
- * `options` **[Object][80]?** Additional options to mutate behaviour
401
+ * `options` **[Object][82]?** Additional options to mutate behaviour
400
402
 
401
- * `options.title` **[String][83]** The title of the dialog to display (optional, default `"Select a project to work with"`)
402
- * `options.allowCancel` **[Boolean][81]** Advertise cancelling the operation, the dialog can still be cancelled by closing it (optional, default `true`)
403
- * `options.setActive` **[Boolean][81]** Also set the project as active when selected (optional, default `false`)
403
+ * `options.title` **[String][85]** The title of the dialog to display (optional, default `"Select a project to work with"`)
404
+ * `options.allowCancel` **[Boolean][83]** Advertise cancelling the operation, the dialog can still be cancelled by closing it (optional, default `true`)
405
+ * `options.setActive` **[Boolean][83]** Also set the project as active when selected (optional, default `false`)
404
406
 
405
- Returns **[Promise][85]<[Project][49]>** The active project
407
+ Returns **[Promise][87]<[Project][49]>** The active project
406
408
 
407
409
  ## getProjectState
408
410
 
@@ -410,12 +412,12 @@ Return the current, full snapshot state of the active project
410
412
 
411
413
  ### Parameters
412
414
 
413
- * `options` **[Object][80]?** Additional options to mutate behaviour
415
+ * `options` **[Object][82]?** Additional options to mutate behaviour
414
416
 
415
- * `options.autoRequire` **[Boolean][81]** Run `requireProject()` automatically before continuing (optional, default `true`)
416
- * `Paths` **[Array][84]<[String][83]>** to subscribe to e.g. \['/users/'],
417
+ * `options.autoRequire` **[Boolean][83]** Run `requireProject()` automatically before continuing (optional, default `true`)
418
+ * `Paths` **[Array][86]<[String][85]>** to subscribe to e.g. \['/users/'],
417
419
 
418
- Returns **[Promise][85]<[Object][80]>** The current project state snapshot
420
+ Returns **[Promise][87]<[Object][82]>** The current project state snapshot
419
421
 
420
422
  ## setProjectState
421
423
 
@@ -427,14 +429,14 @@ Paths can be any valid Lodash.set() value such as:
427
429
 
428
430
  ### Parameters
429
431
 
430
- * `path` **([String][83] | [Array][84]<[String][83]>)** The sub-path within the project state to set
432
+ * `path` **([String][85] | [Array][86]<[String][85]>)** The sub-path within the project state to set
431
433
  * `value` **any** The value to set
432
- * `options` **[Object][80]?** Additional options to mutate behaviour
434
+ * `options` **[Object][82]?** Additional options to mutate behaviour
433
435
 
434
- * `options.save` **[Boolean][81]** Save the changes to the server immediately, disable to queue up multiple writes (optional, default `true`)
435
- * `options.sync` **[Boolean][81]** Wait for the server to acknowledge the write, you almost never need to do this (optional, default `false`)
436
+ * `options.save` **[Boolean][83]** Save the changes to the server immediately, disable to queue up multiple writes (optional, default `true`)
437
+ * `options.sync` **[Boolean][83]** Wait for the server to acknowledge the write, you almost never need to do this (optional, default `false`)
436
438
 
437
- Returns **[Promise][85]** A promise which resolves when the operation has synced with the server
439
+ Returns **[Promise][87]** A promise which resolves when the operation has synced with the server
438
440
 
439
441
  ## setProjectStateDefaults
440
442
 
@@ -444,17 +446,17 @@ Set a nested value within the project state - just like `setProjectState()` - bu
444
446
 
445
447
  ### Parameters
446
448
 
447
- * `path` **([String][83] | [Array][84]<[String][83]>)** The sub-path within the project state to set
449
+ * `path` **([String][85] | [Array][86]<[String][85]>)** The sub-path within the project state to set
448
450
  * `value` **any** The value to set
449
- * `options` **[Object][80]?** Additional options to mutate behaviour, see setProjectState() for the full list of supported options
451
+ * `options` **[Object][82]?** Additional options to mutate behaviour, see setProjectState() for the full list of supported options
450
452
 
451
- Returns **[Promise][85]<[Boolean][81]>** A promise which resolves to whether any changes were made - True if defaults were applied, false otherwise
453
+ Returns **[Promise][87]<[Boolean][83]>** A promise which resolves to whether any changes were made - True if defaults were applied, false otherwise
452
454
 
453
455
  ## saveProjectState
454
456
 
455
457
  Force-Save the currently active project state
456
458
 
457
- Returns **[Promise][85]** A promise which resolves when the operation has completed
459
+ Returns **[Promise][87]** A promise which resolves when the operation has completed
458
460
 
459
461
  ## replaceProjectState
460
462
 
@@ -465,9 +467,9 @@ You almost never want to use this function directly, see `setProjectState(path,
465
467
 
466
468
  ### Parameters
467
469
 
468
- * `newState` **[Object][80]** The new state to replace the current state with
470
+ * `newState` **[Object][82]** The new state to replace the current state with
469
471
 
470
- Returns **[Promise][85]** A promise which resolves when the operation has completed
472
+ Returns **[Promise][87]** A promise which resolves when the operation has completed
471
473
 
472
474
  ## applyProjectStatePatch
473
475
 
@@ -475,9 +477,9 @@ Apply a computed `just-diff` patch to the current project state
475
477
 
476
478
  ### Parameters
477
479
 
478
- * `Patch` **[Object][80]** to apply
480
+ * `Patch` **[Object][82]** to apply
479
481
 
480
- Returns **[Promise][85]** A promise which resolves when the operation has completed
482
+ Returns **[Promise][87]** A promise which resolves when the operation has completed
481
483
 
482
484
  ## subscribeProjectState
483
485
 
@@ -485,7 +487,7 @@ Subscribe to project state changes
485
487
  This will dispatch an RPC call to the source object `applyProjectStatePatchLocal()` function with the patch
486
488
  If the above call fails the subscriber is assumed as dead and unsubscribed from the polling list
487
489
 
488
- Returns **[Promise][85]<[Function][89]>** A promise which resolves when a subscription has been created, call the resulting function to unsubscribe
490
+ Returns **[Promise][87]<[Function][91]>** A promise which resolves when a subscription has been created, call the resulting function to unsubscribe
489
491
 
490
492
  ## ProjectFile
491
493
 
@@ -493,19 +495,19 @@ Data structure for a project file
493
495
 
494
496
  ### Properties
495
497
 
496
- * `id` **[String][83]** A UUID string representing the unique ID of the file
497
- * `name` **[String][83]** Relative name path (can contain prefix directories) for the human readable file name
498
- * `parsedName` **[Object][80]** An object representing meta file parts of a file name
498
+ * `id` **[String][85]** A UUID string representing the unique ID of the file
499
+ * `name` **[String][85]** Relative name path (can contain prefix directories) for the human readable file name
500
+ * `parsedName` **[Object][82]** An object representing meta file parts of a file name
499
501
 
500
- * `parsedName.basename` **[String][83]** The filename + extention (i.e. everything without directory name)
501
- * `parsedName.filename` **[String][83]** The file portion of the name (basename without the extension)
502
- * `parsedName.ext` **[String][83]** The extension portion of the name (always lower case)
503
- * `parsedName.dirName` **[String][83]** The directory path portion of the name
504
- * `created` **[Date][88]** A date representing when the file was created
505
- * `modified` **[Date][88]** A date representing when the file was created
506
- * `accessed` **[Date][88]** A date representing when the file was last accessed
507
- * `size` **[Number][82]** Size, in bytes, of the file
508
- * `mime` **[String][83]** The associated mime type for the file
502
+ * `parsedName.basename` **[String][85]** The filename + extention (i.e. everything without directory name)
503
+ * `parsedName.filename` **[String][85]** The file portion of the name (basename without the extension)
504
+ * `parsedName.ext` **[String][85]** The extension portion of the name (always lower case)
505
+ * `parsedName.dirName` **[String][85]** The directory path portion of the name
506
+ * `created` **[Date][90]** A date representing when the file was created
507
+ * `modified` **[Date][90]** A date representing when the file was created
508
+ * `accessed` **[Date][90]** A date representing when the file was last accessed
509
+ * `size` **[Number][84]** Size, in bytes, of the file
510
+ * `mime` **[String][85]** The associated mime type for the file
509
511
 
510
512
  ## getProjectFiles
511
513
 
@@ -513,29 +515,48 @@ Fetch the files associated with a given project
513
515
 
514
516
  ### Parameters
515
517
 
516
- * `options` **[Object][80]** Options which mutate behaviour
518
+ * `options` **[Object][82]** Options which mutate behaviour
517
519
 
518
- * `options.autoRequire` **[Boolean][81]** Run `requireProject()` automatically before continuing (optional, default `true`)
519
- * `options.meta` **[Boolean][81]** Pull meta information for each file entity (optional, default `true`)
520
+ * `options.autoRequire` **[Boolean][83]** Run `requireProject()` automatically before continuing (optional, default `true`)
521
+ * `options.meta` **[Boolean][83]** Pull meta information for each file entity (optional, default `true`)
520
522
 
521
- Returns **[Promise][85]<[ProjectFile][70]>** A collection of project files for the given project
523
+ Returns **[Promise][87]<[ProjectFile][70]>** A collection of project files for the given project
522
524
 
523
- ## getProjectLibrary
525
+ ## selectProjectLibrary
524
526
 
525
- Fetch the active projects citation library
527
+ Prompt the user to select a library to operate on
526
528
 
527
529
  ### Parameters
528
530
 
529
- * `path` **[String][83]?** Optional file path to use, if omitted the contents of `options` are used to guess at a suitable file
530
- * `options` **[Object][80]?** Additional options to mutate behaviour
531
+ * `options` **[Object][82]?** Additional options to mutate behaviour
531
532
 
532
- * `options.autoRequire` **[Boolean][81]** Run `requireProject()` automatically before continuing (optional, default `true`)
533
- * `options.multiple` **[Boolean][81]** Allow selection of multiple libraries (optional, default `false`)
534
- * `options.filter` **[Function][89]?** Optional async file filter, called each time as `(File:ProjectFile)`
535
- * `options.find` **[Function][89]?** Optional async final stage file filter to reduce all candidates down to one subject file
536
- * `options.hint` **([String][83] | [Array][84]<[String][83]>)?** Hints to identify the library to select in array order of preference. Generally corresponds to the previous stage - e.g. 'deduped', 'review1', 'review2', 'dedisputed'
533
+ * `options.title` **[String][85]** The title of the dialog to display (optional, default `"Select a citation library"`)
534
+ * `options.hint` **([String][85] | [Array][86]<[String][85]>)?** Hints to identify the library to select in array order of preference. Generally corresponds to the previous stage - e.g. 'deduped', 'review1', 'review2', 'dedisputed'
535
+ * `options.allowUpload` **[Boolean][83]** Allow uploading new files (optional, default `true`)
536
+ * `options.allowRefresh` **[Boolean][83]** Allow the user to manually refresh the file list (optional, default `true`)
537
+ * `options.allowDownloadZip` **[Boolean][83]** Allow the user to download a Zip of all files (optional, default `true`)
538
+ * `options.allowCancel` **[Boolean][83]** Allow cancelling the operation. Will throw `'CANCEL'` as the promise rejection if acationed (optional, default `true`)
539
+ * `options.autoRequire` **[Boolean][83]** Run `requireProject()` automatically before continuing (optional, default `true`)
537
540
 
538
- Returns **[Promise][85]<[Array][84]<[ProjectFile][70]>>** Collection of references for the selected library matching the given hint + filter, this could be a zero length array
541
+ Returns **([Promise][87]<[Array][86]\<Ref>> | [Promise][87]\<any>)** A collection of references (default bevahiour) or a whatever format was requested
542
+
543
+ ## setProjectLibrary
544
+
545
+ Save back a citation library from some input
546
+
547
+ ### Parameters
548
+
549
+ * `path` **[String][85]?** File path to save back to
550
+ * `Collection` **[Array][86]\<RefLibRef>** of references for the selected library
551
+ * `options` **[Object][82]?** Additional options to mutate behaviour
552
+
553
+ * `options.format` **[String][85]** Input format used. ENUM: 'pojo' (return a parsed JS collection), 'blob' (raw JS Blob object), 'file' (named JS File object) (optional, default `'json'`)
554
+ * `options.autoRequire` **[Boolean][83]** Run `requireProject()` automatically before continuing (optional, default `true`)
555
+ * `options.hint` **[String][85]?** Hint to store against the library. Generally corresponds to the current operation being performed - e.g. 'deduped'
556
+ * `options.overwrite` **[Boolean][83]** Allow existing file upsert (optional, default `true`)
557
+ * `options.meta` **[Object][82]?** Optional meta data to merge into the file data
558
+
559
+ Returns **[Promise][87]** A promise which resolves when the save operation has completed
539
560
 
540
561
  ## setProjectLibrary
541
562
 
@@ -543,13 +564,13 @@ Save back a projects citation library
543
564
 
544
565
  ### Parameters
545
566
 
546
- * `Collection` **[Array][84]\<RefLibRef>** of references for the selected library
547
- * `options` **[Object][80]?** Additional options to mutate behaviour
567
+ * `Collection` **[Array][86]\<RefLibRef>** of references for the selected library
568
+ * `options` **[Object][82]?** Additional options to mutate behaviour
548
569
 
549
- * `options.autoRequire` **[Boolean][81]** Run `requireProject()` automatically before continuing (optional, default `true`)
550
- * `options.hint` **[String][83]?** Hint to store against the library. Generally corresponds to the current operation being performed - e.g. 'deduped'
570
+ * `options.autoRequire` **[Boolean][83]** Run `requireProject()` automatically before continuing (optional, default `true`)
571
+ * `options.hint` **[String][85]?** Hint to store against the library. Generally corresponds to the current operation being performed - e.g. 'deduped'
551
572
 
552
- Returns **[Promise][85]** A promise which resolves when the save operation has completed
573
+ Returns **[Promise][87]** A promise which resolves when the save operation has completed
553
574
 
554
575
  ## uiAlert
555
576
 
@@ -557,13 +578,13 @@ Display simple text within TERA
557
578
 
558
579
  ### Parameters
559
580
 
560
- * `text` **[String][83]** The text to display
561
- * `options` **[Object][80]?** Additional options to mutate behaviour
581
+ * `text` **[String][85]** The text to display
582
+ * `options` **[Object][82]?** Additional options to mutate behaviour
562
583
 
563
- * `options.title` **[String][83]** The title of the alert box (optional, default `'TERA'`)
564
- * `options.isHtml` **[Boolean][81]** If falsy the text is rendered as plain-text otherwise it will be assumed as HTML content (optional, default `false`)
584
+ * `options.title` **[String][85]** The title of the alert box (optional, default `'TERA'`)
585
+ * `options.isHtml` **[Boolean][83]** If falsy the text is rendered as plain-text otherwise it will be assumed as HTML content (optional, default `false`)
565
586
 
566
- Returns **[Promise][85]** A promise which resolves when the alert has been dismissed
587
+ Returns **[Promise][87]** A promise which resolves when the alert has been dismissed
567
588
 
568
589
  [1]: #terafy
569
590
 
@@ -711,7 +732,7 @@ Returns **[Promise][85]** A promise which resolves when the alert has been dismi
711
732
 
712
733
  [73]: #parameters-22
713
734
 
714
- [74]: #getprojectlibrary
735
+ [74]: #selectprojectlibrary
715
736
 
716
737
  [75]: #parameters-23
717
738
 
@@ -719,26 +740,30 @@ Returns **[Promise][85]** A promise which resolves when the alert has been dismi
719
740
 
720
741
  [77]: #parameters-24
721
742
 
722
- [78]: #uialert
743
+ [78]: #setprojectlibrary-1
723
744
 
724
745
  [79]: #parameters-25
725
746
 
726
- [80]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
747
+ [80]: #uialert
748
+
749
+ [81]: #parameters-26
750
+
751
+ [82]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
727
752
 
728
- [81]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
753
+ [83]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
729
754
 
730
- [82]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
755
+ [84]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
731
756
 
732
- [83]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
757
+ [85]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
733
758
 
734
- [84]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
759
+ [86]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
735
760
 
736
- [85]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
761
+ [87]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
737
762
 
738
- [86]: https://developer.mozilla.org/docs/Web/API/MessageEvent
763
+ [88]: https://developer.mozilla.org/docs/Web/API/MessageEvent
739
764
 
740
- [87]: http://jsonpatch.com
765
+ [89]: http://jsonpatch.com
741
766
 
742
- [88]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date
767
+ [90]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date
743
768
 
744
- [89]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
769
+ [91]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function