@iebh/tera-fy 1.0.14 → 1.0.15
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/api.md +204 -162
- package/dist/terafy.es2019.js +1 -1
- package/dist/terafy.es2019.js.map +2 -2
- package/dist/terafy.js +1 -1
- package/dist/terafy.js.map +2 -2
- package/lib/terafy.client.js +38 -1
- package/lib/terafy.server.js +56 -4
- package/package.json +1 -1
package/api.md
CHANGED
|
@@ -48,35 +48,39 @@
|
|
|
48
48
|
* [User][44]
|
|
49
49
|
* [Properties][45]
|
|
50
50
|
* [getUser][46]
|
|
51
|
-
* [
|
|
52
|
-
* [
|
|
53
|
-
* [
|
|
54
|
-
* [
|
|
55
|
-
|
|
56
|
-
* [
|
|
51
|
+
* [requireUser][47]
|
|
52
|
+
* [][48]
|
|
53
|
+
* [Project][49]
|
|
54
|
+
* [getProject][50]
|
|
55
|
+
* [getProjects][51]
|
|
56
|
+
* [setActiveProject][52]
|
|
57
57
|
* [Parameters][53]
|
|
58
|
-
* [
|
|
58
|
+
* [requireProject][54]
|
|
59
59
|
* [Parameters][55]
|
|
60
|
-
* [
|
|
60
|
+
* [selectProject][56]
|
|
61
61
|
* [Parameters][57]
|
|
62
|
-
* [
|
|
62
|
+
* [getProjectState][58]
|
|
63
63
|
* [Parameters][59]
|
|
64
|
-
* [
|
|
64
|
+
* [setProjectState][60]
|
|
65
65
|
* [Parameters][61]
|
|
66
|
-
* [
|
|
67
|
-
* [
|
|
68
|
-
|
|
69
|
-
* [
|
|
66
|
+
* [setProjectStateDefaults][62]
|
|
67
|
+
* [Parameters][63]
|
|
68
|
+
* [saveProjectState][64]
|
|
69
|
+
* [replaceProjectState][65]
|
|
70
70
|
* [Parameters][66]
|
|
71
|
-
* [
|
|
72
|
-
* [
|
|
73
|
-
|
|
74
|
-
* [
|
|
75
|
-
* [
|
|
76
|
-
* [
|
|
71
|
+
* [applyProjectStatePatch][67]
|
|
72
|
+
* [Parameters][68]
|
|
73
|
+
* [subscribeProjectState][69]
|
|
74
|
+
* [ProjectFile][70]
|
|
75
|
+
* [Properties][71]
|
|
76
|
+
* [getProjectFiles][72]
|
|
77
77
|
* [Parameters][73]
|
|
78
|
-
* [
|
|
78
|
+
* [getProjectLibrary][74]
|
|
79
79
|
* [Parameters][75]
|
|
80
|
+
* [setProjectLibrary][76]
|
|
81
|
+
* [Parameters][77]
|
|
82
|
+
* [uiAlert][78]
|
|
83
|
+
* [Parameters][79]
|
|
80
84
|
|
|
81
85
|
## TeraFy
|
|
82
86
|
|
|
@@ -86,16 +90,16 @@ Main Tera-Fy Client (class singleton) to be used in a frontend browser
|
|
|
86
90
|
|
|
87
91
|
Various settings to configure behaviour
|
|
88
92
|
|
|
89
|
-
Type: [Object][
|
|
93
|
+
Type: [Object][80]
|
|
90
94
|
|
|
91
95
|
#### Properties
|
|
92
96
|
|
|
93
|
-
* `devMode` **[Boolean][
|
|
97
|
+
* `devMode` **[Boolean][81]** Operate in devMode - i.e. force outer refresh when encountering an existing TeraFy instance
|
|
94
98
|
* `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'
|
|
95
|
-
* `modeTimeout` **[Number][
|
|
96
|
-
* `siteUrl` **[String][
|
|
97
|
-
* `restrictOrigin` **[String][
|
|
98
|
-
* `List` **[Array][
|
|
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
|
|
99
103
|
|
|
100
104
|
### events
|
|
101
105
|
|
|
@@ -107,7 +111,7 @@ Type: Mitt
|
|
|
107
111
|
|
|
108
112
|
DOMElements for this TeraFy instance
|
|
109
113
|
|
|
110
|
-
Type: [Object][
|
|
114
|
+
Type: [Object][80]
|
|
111
115
|
|
|
112
116
|
#### Properties
|
|
113
117
|
|
|
@@ -120,13 +124,13 @@ Type: [Object][76]
|
|
|
120
124
|
List of function stubs mapped here from the server
|
|
121
125
|
This array is forms the reference of `TeraFy.METHOD()` objects to provide locally which will be mapped via `TeraFy.rpc(METHOD, ...args)`
|
|
122
126
|
|
|
123
|
-
Type: [Array][
|
|
127
|
+
Type: [Array][84]<[String][83]>
|
|
124
128
|
|
|
125
129
|
### plugins
|
|
126
130
|
|
|
127
131
|
Loaded plugins via Use()
|
|
128
132
|
|
|
129
|
-
Type: [Array][
|
|
133
|
+
Type: [Array][84]\<TeraFyPlugin>
|
|
130
134
|
|
|
131
135
|
### send
|
|
132
136
|
|
|
@@ -134,9 +138,9 @@ Send a message + wait for a response object
|
|
|
134
138
|
|
|
135
139
|
#### Parameters
|
|
136
140
|
|
|
137
|
-
* `message` **[Object][
|
|
141
|
+
* `message` **[Object][80]** Message object to send
|
|
138
142
|
|
|
139
|
-
Returns **[Promise][
|
|
143
|
+
Returns **[Promise][85]\<any>** A promise which resolves when the operation has completed with the remote reply
|
|
140
144
|
|
|
141
145
|
### sendRaw
|
|
142
146
|
|
|
@@ -145,7 +149,7 @@ This function does not return or wait for a reply - use `send()` for that
|
|
|
145
149
|
|
|
146
150
|
#### Parameters
|
|
147
151
|
|
|
148
|
-
* `message` **[Object][
|
|
152
|
+
* `message` **[Object][80]** Message object to send
|
|
149
153
|
|
|
150
154
|
### rpc
|
|
151
155
|
|
|
@@ -153,10 +157,10 @@ Call an RPC function in the server instance
|
|
|
153
157
|
|
|
154
158
|
#### Parameters
|
|
155
159
|
|
|
156
|
-
* `method` **[String][
|
|
160
|
+
* `method` **[String][83]** The method name to call
|
|
157
161
|
* `args` **...any** 
|
|
158
162
|
|
|
159
|
-
Returns **[Promise][
|
|
163
|
+
Returns **[Promise][85]\<any>** The resolved output of the server function
|
|
160
164
|
|
|
161
165
|
### acceptMessage
|
|
162
166
|
|
|
@@ -165,7 +169,7 @@ Accept an incoming message
|
|
|
165
169
|
#### Parameters
|
|
166
170
|
|
|
167
171
|
* `rawMessage`  
|
|
168
|
-
* `Raw` **[MessageEvent][
|
|
172
|
+
* `Raw` **[MessageEvent][86]** message event to process
|
|
169
173
|
|
|
170
174
|
### acceptPostboxes
|
|
171
175
|
|
|
@@ -174,27 +178,27 @@ Listening postboxes, these correspond to outgoing message IDs that expect a resp
|
|
|
174
178
|
### createProjectStatePatch
|
|
175
179
|
|
|
176
180
|
Create + transmit a new project state patch base on the current and previous states
|
|
177
|
-
The transmitted patch follows the [JSPatch][
|
|
181
|
+
The transmitted patch follows the [JSPatch][87] standard
|
|
178
182
|
This function accepts an entire projectState instance, computes the delta and transmits that to the server for merging
|
|
179
183
|
|
|
180
184
|
#### Parameters
|
|
181
185
|
|
|
182
|
-
* `newState` **[Object][
|
|
183
|
-
* `oldState` **[Object][
|
|
186
|
+
* `newState` **[Object][80]** The local projectState to accept
|
|
187
|
+
* `oldState` **[Object][80]** The previous projectState to examine against
|
|
184
188
|
|
|
185
|
-
Returns **[Promise][
|
|
189
|
+
Returns **[Promise][85]** A promise which will resolve when the operation has completed
|
|
186
190
|
|
|
187
191
|
### applyProjectStatePatchLocal
|
|
188
192
|
|
|
189
193
|
Client function which accepts a patch from the server and applies it to local project state
|
|
190
|
-
The patch should follow the [JSPatch][
|
|
194
|
+
The patch should follow the [JSPatch][87] standard
|
|
191
195
|
This function is expected to be sub-classed by a plugin
|
|
192
196
|
|
|
193
197
|
#### Parameters
|
|
194
198
|
|
|
195
|
-
* `patch` **[Array][
|
|
199
|
+
* `patch` **[Array][84]** A JSPatch patch to apply
|
|
196
200
|
|
|
197
|
-
Returns **[Promise][
|
|
201
|
+
Returns **[Promise][85]** A promise which will resolve when the operation has completed
|
|
198
202
|
|
|
199
203
|
### init
|
|
200
204
|
|
|
@@ -203,22 +207,22 @@ This function can only be called once and will return the existing init() worker
|
|
|
203
207
|
|
|
204
208
|
#### Parameters
|
|
205
209
|
|
|
206
|
-
* `options` **[Object][
|
|
210
|
+
* `options` **[Object][80]?** Additional options to merge into `settings` via `set`
|
|
207
211
|
|
|
208
|
-
Returns **[Promise][
|
|
212
|
+
Returns **[Promise][85]<[TeraFy][1]>** An eventual promise which will resovle with this terafy instance
|
|
209
213
|
|
|
210
214
|
### detectMode
|
|
211
215
|
|
|
212
216
|
Populate `settings.mode`
|
|
213
217
|
Try to communicate with a parent frame, if none assume we need to fallback to child mode
|
|
214
218
|
|
|
215
|
-
Returns **[Promise][
|
|
219
|
+
Returns **[Promise][85]<[String][83]>** A promise which will resolve with the detected mode to use
|
|
216
220
|
|
|
217
221
|
### injectComms
|
|
218
222
|
|
|
219
223
|
Find an existing active TERA server OR initalize one
|
|
220
224
|
|
|
221
|
-
Returns **[Promise][
|
|
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
|
|
222
226
|
|
|
223
227
|
### injectStylesheet
|
|
224
228
|
|
|
@@ -245,7 +249,7 @@ This function also routes 'special' keys like `devMode` to their internal handle
|
|
|
245
249
|
|
|
246
250
|
#### Parameters
|
|
247
251
|
|
|
248
|
-
* `key` **([String][
|
|
252
|
+
* `key` **([String][83] | [Object][80])** Either a single setting key to set or an object to merge
|
|
249
253
|
* `value` **any** The value to set if `key` is a string
|
|
250
254
|
|
|
251
255
|
Returns **[TeraFy][1]** This chainable terafy instance
|
|
@@ -258,7 +262,7 @@ Set or merge settings - but only in dev mode
|
|
|
258
262
|
|
|
259
263
|
#### Parameters
|
|
260
264
|
|
|
261
|
-
* `key` **([String][
|
|
265
|
+
* `key` **([String][83] | [Object][80])** Either a single setting key to set or an object to merge
|
|
262
266
|
* `value` **any** The value to set if `key` is a string
|
|
263
267
|
|
|
264
268
|
Returns **[TeraFy][1]** This chainable terafy instance
|
|
@@ -270,8 +274,8 @@ Include a TeraFy client plugin
|
|
|
270
274
|
#### Parameters
|
|
271
275
|
|
|
272
276
|
* `mod`  
|
|
273
|
-
* `options` **[Object][
|
|
274
|
-
* `The` **[Object][
|
|
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)`
|
|
275
279
|
|
|
276
280
|
Returns **[TeraFy][1]** This chainable terafy instance
|
|
277
281
|
|
|
@@ -281,8 +285,8 @@ Internal function used by use() to merge an external declared singleton against
|
|
|
281
285
|
|
|
282
286
|
#### Parameters
|
|
283
287
|
|
|
284
|
-
* `target` **[Object][
|
|
285
|
-
* `source` **[Object][
|
|
288
|
+
* `target` **[Object][80]** Initalied class instance to extend
|
|
289
|
+
* `source` **[Object][80]** Initalized source object to extend from
|
|
286
290
|
|
|
287
291
|
### toggleDevMode
|
|
288
292
|
|
|
@@ -290,7 +294,7 @@ Set or toggle devMode
|
|
|
290
294
|
|
|
291
295
|
#### Parameters
|
|
292
296
|
|
|
293
|
-
* `devModeEnabled` **([String][
|
|
297
|
+
* `devModeEnabled` **([String][83] | [Boolean][81])** Optional boolean to force dev mode (optional, default `'toggle'`)
|
|
294
298
|
|
|
295
299
|
Returns **[TeraFy][1]** This chainable terafy instance
|
|
296
300
|
|
|
@@ -301,7 +305,7 @@ This is usually because the server component wants to perform some user activity
|
|
|
301
305
|
|
|
302
306
|
#### Parameters
|
|
303
307
|
|
|
304
|
-
* `isFocused` **([String][
|
|
308
|
+
* `isFocused` **([String][83] | [Boolean][81])** Whether to fullscreen the embedded component (optional, default `'toggle'`)
|
|
305
309
|
|
|
306
310
|
## handshake
|
|
307
311
|
|
|
@@ -309,9 +313,9 @@ Return basic server information as a form of validation
|
|
|
309
313
|
|
|
310
314
|
### Properties
|
|
311
315
|
|
|
312
|
-
* `date` **[Date][
|
|
316
|
+
* `date` **[Date][88]** Server date
|
|
313
317
|
|
|
314
|
-
Returns **[Promise][
|
|
318
|
+
Returns **[Promise][85]<[Object][80]>** Basic promise result
|
|
315
319
|
|
|
316
320
|
## User
|
|
317
321
|
|
|
@@ -319,16 +323,32 @@ User / active session within TERA
|
|
|
319
323
|
|
|
320
324
|
### Properties
|
|
321
325
|
|
|
322
|
-
* `id` **[String][
|
|
323
|
-
* `email` **[String][
|
|
324
|
-
* `name` **[String][
|
|
325
|
-
* `isSubscribed` **[Boolean][
|
|
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
|
|
326
330
|
|
|
327
331
|
## getUser
|
|
328
332
|
|
|
329
333
|
Fetch the current session user
|
|
330
334
|
|
|
331
|
-
Returns **[Promise][
|
|
335
|
+
Returns **[Promise][85]<[User][44]>** The current logged in user or null if none
|
|
336
|
+
|
|
337
|
+
## requireUser
|
|
338
|
+
|
|
339
|
+
Require a user login to TERA
|
|
340
|
+
If there is no user OR they are not logged in a prompt is shown to go and do so
|
|
341
|
+
This is an pre-requisite step for requireProject()
|
|
342
|
+
|
|
343
|
+
Returns **[Promise][85]** A promise which will resolve if the there is a user and they are logged in
|
|
344
|
+
|
|
345
|
+
##
|
|
346
|
+
|
|
347
|
+
Require a user login to TERA
|
|
348
|
+
If there is no user OR they are not logged in a prompt is shown to go and do so
|
|
349
|
+
This is an pre-requisite step for requireProject()
|
|
350
|
+
|
|
351
|
+
Returns **[Promise][85]** A promise which will resolve if the there is a user and they are logged in
|
|
332
352
|
|
|
333
353
|
## Project
|
|
334
354
|
|
|
@@ -338,13 +358,13 @@ Project entry within TERA
|
|
|
338
358
|
|
|
339
359
|
Get the currently active project, if any
|
|
340
360
|
|
|
341
|
-
Returns **[Promise][
|
|
361
|
+
Returns **[Promise][85]<([Project][49] | null)>** The currently active project, if any
|
|
342
362
|
|
|
343
363
|
## getProjects
|
|
344
364
|
|
|
345
365
|
Get a list of projects the current session user has access to
|
|
346
366
|
|
|
347
|
-
Returns **[Promise][
|
|
367
|
+
Returns **[Promise][85]<[Array][84]<[Project][49]>>** Collection of projects the user has access to
|
|
348
368
|
|
|
349
369
|
## setActiveProject
|
|
350
370
|
|
|
@@ -352,7 +372,7 @@ Set the currently active project within TERA
|
|
|
352
372
|
|
|
353
373
|
### Parameters
|
|
354
374
|
|
|
355
|
-
* `project` **([Object][
|
|
375
|
+
* `project` **([Object][80] | [String][83])** The project to set as active - either the full Project object or its ID
|
|
356
376
|
|
|
357
377
|
## requireProject
|
|
358
378
|
|
|
@@ -361,14 +381,14 @@ Note that this function will percist in asking the uesr even if they try to canc
|
|
|
361
381
|
|
|
362
382
|
### Parameters
|
|
363
383
|
|
|
364
|
-
* `options` **[Object][
|
|
384
|
+
* `options` **[Object][80]?** Additional options to mutate behaviour
|
|
365
385
|
|
|
366
|
-
* `options.autoSetActiveProject` **[Boolean][
|
|
367
|
-
* `options.title` **[String][
|
|
368
|
-
* `options.noSelectTitle` **[String][
|
|
369
|
-
* `options.noSelectBody` **[String][
|
|
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'`)
|
|
370
390
|
|
|
371
|
-
Returns **[Promise][
|
|
391
|
+
Returns **[Promise][85]<[Project][49]>** The active project
|
|
372
392
|
|
|
373
393
|
## selectProject
|
|
374
394
|
|
|
@@ -376,13 +396,13 @@ Prompt the user to select a project from those available
|
|
|
376
396
|
|
|
377
397
|
### Parameters
|
|
378
398
|
|
|
379
|
-
* `options` **[Object][
|
|
399
|
+
* `options` **[Object][80]?** Additional options to mutate behaviour
|
|
380
400
|
|
|
381
|
-
* `options.title` **[String][
|
|
382
|
-
* `options.allowCancel` **[Boolean][
|
|
383
|
-
* `options.setActive` **[Boolean][
|
|
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`)
|
|
384
404
|
|
|
385
|
-
Returns **[Promise][
|
|
405
|
+
Returns **[Promise][85]<[Project][49]>** The active project
|
|
386
406
|
|
|
387
407
|
## getProjectState
|
|
388
408
|
|
|
@@ -390,12 +410,12 @@ Return the current, full snapshot state of the active project
|
|
|
390
410
|
|
|
391
411
|
### Parameters
|
|
392
412
|
|
|
393
|
-
* `options` **[Object][
|
|
413
|
+
* `options` **[Object][80]?** Additional options to mutate behaviour
|
|
394
414
|
|
|
395
|
-
* `options.autoRequire` **[Boolean][
|
|
396
|
-
* `Paths` **[Array][
|
|
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/'],
|
|
397
417
|
|
|
398
|
-
Returns **[Promise][
|
|
418
|
+
Returns **[Promise][85]<[Object][80]>** The current project state snapshot
|
|
399
419
|
|
|
400
420
|
## setProjectState
|
|
401
421
|
|
|
@@ -407,14 +427,14 @@ Paths can be any valid Lodash.set() value such as:
|
|
|
407
427
|
|
|
408
428
|
### Parameters
|
|
409
429
|
|
|
410
|
-
* `path` **([String][
|
|
430
|
+
* `path` **([String][83] | [Array][84]<[String][83]>)** The sub-path within the project state to set
|
|
411
431
|
* `value` **any** The value to set
|
|
412
|
-
* `options` **[Object][
|
|
432
|
+
* `options` **[Object][80]?** Additional options to mutate behaviour
|
|
413
433
|
|
|
414
|
-
* `options.save` **[Boolean][
|
|
415
|
-
* `options.sync` **[Boolean][
|
|
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`)
|
|
416
436
|
|
|
417
|
-
Returns **[Promise][
|
|
437
|
+
Returns **[Promise][85]** A promise which resolves when the operation has synced with the server
|
|
418
438
|
|
|
419
439
|
## setProjectStateDefaults
|
|
420
440
|
|
|
@@ -424,17 +444,17 @@ Set a nested value within the project state - just like `setProjectState()` - bu
|
|
|
424
444
|
|
|
425
445
|
### Parameters
|
|
426
446
|
|
|
427
|
-
* `path` **([String][
|
|
447
|
+
* `path` **([String][83] | [Array][84]<[String][83]>)** The sub-path within the project state to set
|
|
428
448
|
* `value` **any** The value to set
|
|
429
|
-
* `options` **[Object][
|
|
449
|
+
* `options` **[Object][80]?** Additional options to mutate behaviour, see setProjectState() for the full list of supported options
|
|
430
450
|
|
|
431
|
-
Returns **[Promise][
|
|
451
|
+
Returns **[Promise][85]<[Boolean][81]>** A promise which resolves to whether any changes were made - True if defaults were applied, false otherwise
|
|
432
452
|
|
|
433
453
|
## saveProjectState
|
|
434
454
|
|
|
435
455
|
Force-Save the currently active project state
|
|
436
456
|
|
|
437
|
-
Returns **[Promise][
|
|
457
|
+
Returns **[Promise][85]** A promise which resolves when the operation has completed
|
|
438
458
|
|
|
439
459
|
## replaceProjectState
|
|
440
460
|
|
|
@@ -445,9 +465,9 @@ You almost never want to use this function directly, see `setProjectState(path,
|
|
|
445
465
|
|
|
446
466
|
### Parameters
|
|
447
467
|
|
|
448
|
-
* `newState` **[Object][
|
|
468
|
+
* `newState` **[Object][80]** The new state to replace the current state with
|
|
449
469
|
|
|
450
|
-
Returns **[Promise][
|
|
470
|
+
Returns **[Promise][85]** A promise which resolves when the operation has completed
|
|
451
471
|
|
|
452
472
|
## applyProjectStatePatch
|
|
453
473
|
|
|
@@ -455,9 +475,9 @@ Apply a computed `just-diff` patch to the current project state
|
|
|
455
475
|
|
|
456
476
|
### Parameters
|
|
457
477
|
|
|
458
|
-
* `Patch` **[Object][
|
|
478
|
+
* `Patch` **[Object][80]** to apply
|
|
459
479
|
|
|
460
|
-
Returns **[Promise][
|
|
480
|
+
Returns **[Promise][85]** A promise which resolves when the operation has completed
|
|
461
481
|
|
|
462
482
|
## subscribeProjectState
|
|
463
483
|
|
|
@@ -465,7 +485,7 @@ Subscribe to project state changes
|
|
|
465
485
|
This will dispatch an RPC call to the source object `applyProjectStatePatchLocal()` function with the patch
|
|
466
486
|
If the above call fails the subscriber is assumed as dead and unsubscribed from the polling list
|
|
467
487
|
|
|
468
|
-
Returns **[Promise][
|
|
488
|
+
Returns **[Promise][85]<[Function][89]>** A promise which resolves when a subscription has been created, call the resulting function to unsubscribe
|
|
469
489
|
|
|
470
490
|
## ProjectFile
|
|
471
491
|
|
|
@@ -473,19 +493,19 @@ Data structure for a project file
|
|
|
473
493
|
|
|
474
494
|
### Properties
|
|
475
495
|
|
|
476
|
-
* `id` **[String][
|
|
477
|
-
* `name` **[String][
|
|
478
|
-
* `parsedName` **[Object][
|
|
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
|
|
479
499
|
|
|
480
|
-
* `parsedName.basename` **[String][
|
|
481
|
-
* `parsedName.filename` **[String][
|
|
482
|
-
* `parsedName.ext` **[String][
|
|
483
|
-
* `parsedName.dirName` **[String][
|
|
484
|
-
* `created` **[Date][
|
|
485
|
-
* `modified` **[Date][
|
|
486
|
-
* `accessed` **[Date][
|
|
487
|
-
* `size` **[Number][
|
|
488
|
-
* `mime` **[String][
|
|
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
|
|
489
509
|
|
|
490
510
|
## getProjectFiles
|
|
491
511
|
|
|
@@ -493,12 +513,12 @@ Fetch the files associated with a given project
|
|
|
493
513
|
|
|
494
514
|
### Parameters
|
|
495
515
|
|
|
496
|
-
* `options` **[Object][
|
|
516
|
+
* `options` **[Object][80]** Options which mutate behaviour
|
|
497
517
|
|
|
498
|
-
* `options.autoRequire` **[Boolean][
|
|
499
|
-
* `options.meta` **[Boolean][
|
|
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`)
|
|
500
520
|
|
|
501
|
-
Returns **[Promise][
|
|
521
|
+
Returns **[Promise][85]<[ProjectFile][70]>** A collection of project files for the given project
|
|
502
522
|
|
|
503
523
|
## getProjectLibrary
|
|
504
524
|
|
|
@@ -506,16 +526,16 @@ Fetch the active projects citation library
|
|
|
506
526
|
|
|
507
527
|
### Parameters
|
|
508
528
|
|
|
509
|
-
* `path` **[String][
|
|
510
|
-
* `options` **[Object][
|
|
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
|
|
511
531
|
|
|
512
|
-
* `options.autoRequire` **[Boolean][
|
|
513
|
-
* `options.multiple` **[Boolean][
|
|
514
|
-
* `options.filter` **[Function][
|
|
515
|
-
* `options.find` **[Function][
|
|
516
|
-
* `options.hint` **([String][
|
|
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'
|
|
517
537
|
|
|
518
|
-
Returns **[Promise][
|
|
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
|
|
519
539
|
|
|
520
540
|
## setProjectLibrary
|
|
521
541
|
|
|
@@ -523,13 +543,27 @@ Save back a projects citation library
|
|
|
523
543
|
|
|
524
544
|
### Parameters
|
|
525
545
|
|
|
526
|
-
* `Collection` **[Array][
|
|
527
|
-
* `options` **[Object][
|
|
546
|
+
* `Collection` **[Array][84]\<RefLibRef>** of references for the selected library
|
|
547
|
+
* `options` **[Object][80]?** Additional options to mutate behaviour
|
|
548
|
+
|
|
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'
|
|
528
551
|
|
|
529
|
-
|
|
530
|
-
* `options.hint` **[String][79]?** Hint to store against the library. Generally corresponds to the current operation being performed - e.g. 'deduped'
|
|
552
|
+
Returns **[Promise][85]** A promise which resolves when the save operation has completed
|
|
531
553
|
|
|
532
|
-
|
|
554
|
+
## uiAlert
|
|
555
|
+
|
|
556
|
+
Display simple text within TERA
|
|
557
|
+
|
|
558
|
+
### Parameters
|
|
559
|
+
|
|
560
|
+
* `text` **[String][83]** The text to display
|
|
561
|
+
* `options` **[Object][80]?** Additional options to mutate behaviour
|
|
562
|
+
|
|
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`)
|
|
565
|
+
|
|
566
|
+
Returns **[Promise][85]** A promise which resolves when the alert has been dismissed
|
|
533
567
|
|
|
534
568
|
[1]: #terafy
|
|
535
569
|
|
|
@@ -623,80 +657,88 @@ Returns **[Promise][81]** A promise which resolves when the save operation has c
|
|
|
623
657
|
|
|
624
658
|
[46]: #getuser
|
|
625
659
|
|
|
626
|
-
[47]: #
|
|
660
|
+
[47]: #requireuser
|
|
661
|
+
|
|
662
|
+
[48]: #
|
|
663
|
+
|
|
664
|
+
[49]: #project
|
|
665
|
+
|
|
666
|
+
[50]: #getproject
|
|
667
|
+
|
|
668
|
+
[51]: #getprojects
|
|
627
669
|
|
|
628
|
-
[
|
|
670
|
+
[52]: #setactiveproject
|
|
629
671
|
|
|
630
|
-
[
|
|
672
|
+
[53]: #parameters-14
|
|
631
673
|
|
|
632
|
-
[
|
|
674
|
+
[54]: #requireproject
|
|
633
675
|
|
|
634
|
-
[
|
|
676
|
+
[55]: #parameters-15
|
|
635
677
|
|
|
636
|
-
[
|
|
678
|
+
[56]: #selectproject
|
|
637
679
|
|
|
638
|
-
[
|
|
680
|
+
[57]: #parameters-16
|
|
639
681
|
|
|
640
|
-
[
|
|
682
|
+
[58]: #getprojectstate
|
|
641
683
|
|
|
642
|
-
[
|
|
684
|
+
[59]: #parameters-17
|
|
643
685
|
|
|
644
|
-
[
|
|
686
|
+
[60]: #setprojectstate
|
|
645
687
|
|
|
646
|
-
[
|
|
688
|
+
[61]: #parameters-18
|
|
647
689
|
|
|
648
|
-
[
|
|
690
|
+
[62]: #setprojectstatedefaults
|
|
649
691
|
|
|
650
|
-
[
|
|
692
|
+
[63]: #parameters-19
|
|
651
693
|
|
|
652
|
-
[
|
|
694
|
+
[64]: #saveprojectstate
|
|
653
695
|
|
|
654
|
-
[
|
|
696
|
+
[65]: #replaceprojectstate
|
|
655
697
|
|
|
656
|
-
[
|
|
698
|
+
[66]: #parameters-20
|
|
657
699
|
|
|
658
|
-
[
|
|
700
|
+
[67]: #applyprojectstatepatch
|
|
659
701
|
|
|
660
|
-
[
|
|
702
|
+
[68]: #parameters-21
|
|
661
703
|
|
|
662
|
-
[
|
|
704
|
+
[69]: #subscribeprojectstate
|
|
663
705
|
|
|
664
|
-
[
|
|
706
|
+
[70]: #projectfile
|
|
665
707
|
|
|
666
|
-
[
|
|
708
|
+
[71]: #properties-4
|
|
667
709
|
|
|
668
|
-
[
|
|
710
|
+
[72]: #getprojectfiles
|
|
669
711
|
|
|
670
|
-
[
|
|
712
|
+
[73]: #parameters-22
|
|
671
713
|
|
|
672
|
-
[
|
|
714
|
+
[74]: #getprojectlibrary
|
|
673
715
|
|
|
674
|
-
[
|
|
716
|
+
[75]: #parameters-23
|
|
675
717
|
|
|
676
|
-
[
|
|
718
|
+
[76]: #setprojectlibrary
|
|
677
719
|
|
|
678
|
-
[
|
|
720
|
+
[77]: #parameters-24
|
|
679
721
|
|
|
680
|
-
[
|
|
722
|
+
[78]: #uialert
|
|
681
723
|
|
|
682
|
-
[
|
|
724
|
+
[79]: #parameters-25
|
|
683
725
|
|
|
684
|
-
[
|
|
726
|
+
[80]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
|
|
685
727
|
|
|
686
|
-
[
|
|
728
|
+
[81]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
|
|
687
729
|
|
|
688
|
-
[
|
|
730
|
+
[82]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
|
689
731
|
|
|
690
|
-
[
|
|
732
|
+
[83]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
|
691
733
|
|
|
692
|
-
[
|
|
734
|
+
[84]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
|
693
735
|
|
|
694
|
-
[
|
|
736
|
+
[85]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
|
695
737
|
|
|
696
|
-
[
|
|
738
|
+
[86]: https://developer.mozilla.org/docs/Web/API/MessageEvent
|
|
697
739
|
|
|
698
|
-
[
|
|
740
|
+
[87]: http://jsonpatch.com
|
|
699
741
|
|
|
700
|
-
[
|
|
742
|
+
[88]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date
|
|
701
743
|
|
|
702
|
-
[
|
|
744
|
+
[89]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
|