@iebh/tera-fy 1.0.11 → 1.0.13
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 +12 -0
- package/api.md +324 -222
- package/dist/plugin.vue2.es2019.js +15 -0
- package/dist/plugin.vue2.es2019.js.map +7 -0
- package/dist/terafy.es2019.js +16 -0
- package/dist/terafy.es2019.js.map +7 -0
- package/dist/terafy.js +2 -2
- package/dist/terafy.js.map +4 -4
- package/lib/terafy.client.js +47 -11
- package/lib/terafy.server.js +29 -60
- package/package.json +3 -1
- package/plugins/vue2.js +32 -9
- package/.storybook/main.js +0 -22
- package/.storybook/preview.js +0 -17
- package/docs/assets/anchor.js +0 -350
- package/docs/assets/bass-addons.css +0 -12
- package/docs/assets/bass.css +0 -544
- package/docs/assets/fonts/EOT/SourceCodePro-Bold.eot +0 -0
- package/docs/assets/fonts/EOT/SourceCodePro-Regular.eot +0 -0
- package/docs/assets/fonts/LICENSE.txt +0 -93
- package/docs/assets/fonts/OTF/SourceCodePro-Bold.otf +0 -0
- package/docs/assets/fonts/OTF/SourceCodePro-Regular.otf +0 -0
- package/docs/assets/fonts/TTF/SourceCodePro-Bold.ttf +0 -0
- package/docs/assets/fonts/TTF/SourceCodePro-Regular.ttf +0 -0
- package/docs/assets/fonts/WOFF/OTF/SourceCodePro-Bold.otf.woff +0 -0
- package/docs/assets/fonts/WOFF/OTF/SourceCodePro-Regular.otf.woff +0 -0
- package/docs/assets/fonts/WOFF/TTF/SourceCodePro-Bold.ttf.woff +0 -0
- package/docs/assets/fonts/WOFF/TTF/SourceCodePro-Regular.ttf.woff +0 -0
- package/docs/assets/fonts/WOFF2/OTF/SourceCodePro-Bold.otf.woff2 +0 -0
- package/docs/assets/fonts/WOFF2/OTF/SourceCodePro-Regular.otf.woff2 +0 -0
- package/docs/assets/fonts/WOFF2/TTF/SourceCodePro-Bold.ttf.woff2 +0 -0
- package/docs/assets/fonts/WOFF2/TTF/SourceCodePro-Regular.ttf.woff2 +0 -0
- package/docs/assets/fonts/source-code-pro.css +0 -23
- package/docs/assets/github.css +0 -123
- package/docs/assets/site.js +0 -168
- package/docs/assets/split.css +0 -15
- package/docs/assets/split.js +0 -782
- package/docs/assets/style.css +0 -147
- package/docs/index.html +0 -3636
- package/docs/playground.html +0 -342
package/api.md
CHANGED
|
@@ -5,68 +5,78 @@
|
|
|
5
5
|
* [TeraFy][1]
|
|
6
6
|
* [settings][2]
|
|
7
7
|
* [Properties][3]
|
|
8
|
-
* [
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
* [
|
|
12
|
-
* [
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
* [
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
* [
|
|
29
|
-
* [
|
|
30
|
-
* [
|
|
31
|
-
* [
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
* [
|
|
44
|
-
* [
|
|
45
|
-
* [
|
|
46
|
-
|
|
47
|
-
* [
|
|
48
|
-
* [
|
|
49
|
-
* [
|
|
50
|
-
* [
|
|
51
|
-
* [
|
|
52
|
-
|
|
53
|
-
* [
|
|
54
|
-
|
|
55
|
-
* [
|
|
56
|
-
|
|
57
|
-
* [
|
|
58
|
-
|
|
59
|
-
* [
|
|
60
|
-
|
|
61
|
-
* [
|
|
62
|
-
* [
|
|
63
|
-
* [
|
|
64
|
-
* [
|
|
8
|
+
* [events][4]
|
|
9
|
+
* [dom][5]
|
|
10
|
+
* [Properties][6]
|
|
11
|
+
* [methods][7]
|
|
12
|
+
* [plugins][8]
|
|
13
|
+
* [send][9]
|
|
14
|
+
* [Parameters][10]
|
|
15
|
+
* [sendRaw][11]
|
|
16
|
+
* [Parameters][12]
|
|
17
|
+
* [rpc][13]
|
|
18
|
+
* [Parameters][14]
|
|
19
|
+
* [acceptMessage][15]
|
|
20
|
+
* [Parameters][16]
|
|
21
|
+
* [acceptPostboxes][17]
|
|
22
|
+
* [createProjectStatePatch][18]
|
|
23
|
+
* [Parameters][19]
|
|
24
|
+
* [applyProjectStatePatchLocal][20]
|
|
25
|
+
* [Parameters][21]
|
|
26
|
+
* [init][22]
|
|
27
|
+
* [Parameters][23]
|
|
28
|
+
* [detectMode][24]
|
|
29
|
+
* [injectComms][25]
|
|
30
|
+
* [injectStylesheet][26]
|
|
31
|
+
* [injectMethods][27]
|
|
32
|
+
* [debug][28]
|
|
33
|
+
* [Parameters][29]
|
|
34
|
+
* [set][30]
|
|
35
|
+
* [Parameters][31]
|
|
36
|
+
* [setIfDev][32]
|
|
37
|
+
* [Parameters][33]
|
|
38
|
+
* [use][34]
|
|
39
|
+
* [Parameters][35]
|
|
40
|
+
* [mixin][36]
|
|
41
|
+
* [Parameters][37]
|
|
42
|
+
* [toggleDevMode][38]
|
|
43
|
+
* [Parameters][39]
|
|
44
|
+
* [toggleFocus][40]
|
|
45
|
+
* [Parameters][41]
|
|
46
|
+
* [handshake][42]
|
|
47
|
+
* [Properties][43]
|
|
48
|
+
* [User][44]
|
|
49
|
+
* [Properties][45]
|
|
50
|
+
* [getUser][46]
|
|
51
|
+
* [Project][47]
|
|
52
|
+
* [getProject][48]
|
|
53
|
+
* [getProjects][49]
|
|
54
|
+
* [setActiveProject][50]
|
|
55
|
+
* [Parameters][51]
|
|
56
|
+
* [requireProject][52]
|
|
57
|
+
* [Parameters][53]
|
|
58
|
+
* [selectProject][54]
|
|
59
|
+
* [Parameters][55]
|
|
60
|
+
* [getProjectState][56]
|
|
61
|
+
* [Parameters][57]
|
|
62
|
+
* [setProjectState][58]
|
|
63
|
+
* [Parameters][59]
|
|
64
|
+
* [setProjectStateDefaults][60]
|
|
65
65
|
* [Parameters][61]
|
|
66
|
-
* [
|
|
67
|
-
|
|
68
|
-
* [
|
|
69
|
-
|
|
66
|
+
* [saveProjectState][62]
|
|
67
|
+
* [replaceProjectState][63]
|
|
68
|
+
* [Parameters][64]
|
|
69
|
+
* [applyProjectStatePatch][65]
|
|
70
|
+
* [Parameters][66]
|
|
71
|
+
* [subscribeProjectState][67]
|
|
72
|
+
* [ProjectFile][68]
|
|
73
|
+
* [Properties][69]
|
|
74
|
+
* [getProjectFiles][70]
|
|
75
|
+
* [Parameters][71]
|
|
76
|
+
* [getProjectLibrary][72]
|
|
77
|
+
* [Parameters][73]
|
|
78
|
+
* [setProjectLibrary][74]
|
|
79
|
+
* [Parameters][75]
|
|
70
80
|
|
|
71
81
|
## TeraFy
|
|
72
82
|
|
|
@@ -76,21 +86,28 @@ Main Tera-Fy Client (class singleton) to be used in a frontend browser
|
|
|
76
86
|
|
|
77
87
|
Various settings to configure behaviour
|
|
78
88
|
|
|
79
|
-
Type: [Object][
|
|
89
|
+
Type: [Object][76]
|
|
80
90
|
|
|
81
91
|
#### Properties
|
|
82
92
|
|
|
83
|
-
* `devMode` **[Boolean][
|
|
93
|
+
* `devMode` **[Boolean][77]** Operate in devMode - i.e. force outer refresh when encountering an existing TeraFy instance
|
|
84
94
|
* `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'
|
|
85
|
-
* `modeTimeout` **[Number][
|
|
86
|
-
* `siteUrl` **[String][
|
|
87
|
-
* `restrictOrigin` **[String][
|
|
95
|
+
* `modeTimeout` **[Number][78]** How long entities have in 'detect' mode to identify themselves
|
|
96
|
+
* `siteUrl` **[String][79]** The TERA URL to connect to
|
|
97
|
+
* `restrictOrigin` **[String][79]** URL to restrict communications to
|
|
98
|
+
* `List` **[Array][80]<[String][79]>** of sandbox allowables for the embedded if in embed mode
|
|
99
|
+
|
|
100
|
+
### events
|
|
101
|
+
|
|
102
|
+
Event emitter subscription endpoint
|
|
103
|
+
|
|
104
|
+
Type: Mitt
|
|
88
105
|
|
|
89
106
|
### dom
|
|
90
107
|
|
|
91
108
|
DOMElements for this TeraFy instance
|
|
92
109
|
|
|
93
|
-
Type: [Object][
|
|
110
|
+
Type: [Object][76]
|
|
94
111
|
|
|
95
112
|
#### Properties
|
|
96
113
|
|
|
@@ -103,13 +120,13 @@ Type: [Object][66]
|
|
|
103
120
|
List of function stubs mapped here from the server
|
|
104
121
|
This array is forms the reference of `TeraFy.METHOD()` objects to provide locally which will be mapped via `TeraFy.rpc(METHOD, ...args)`
|
|
105
122
|
|
|
106
|
-
Type: [Array][
|
|
123
|
+
Type: [Array][80]<[String][79]>
|
|
107
124
|
|
|
108
125
|
### plugins
|
|
109
126
|
|
|
110
127
|
Loaded plugins via Use()
|
|
111
128
|
|
|
112
|
-
Type: [Array][
|
|
129
|
+
Type: [Array][80]\<TeraFyPlugin>
|
|
113
130
|
|
|
114
131
|
### send
|
|
115
132
|
|
|
@@ -117,9 +134,9 @@ Send a message + wait for a response object
|
|
|
117
134
|
|
|
118
135
|
#### Parameters
|
|
119
136
|
|
|
120
|
-
* `message` **[Object][
|
|
137
|
+
* `message` **[Object][76]** Message object to send
|
|
121
138
|
|
|
122
|
-
Returns **[Promise][
|
|
139
|
+
Returns **[Promise][81]\<any>** A promise which resolves when the operation has completed with the remote reply
|
|
123
140
|
|
|
124
141
|
### sendRaw
|
|
125
142
|
|
|
@@ -128,7 +145,7 @@ This function does not return or wait for a reply - use `send()` for that
|
|
|
128
145
|
|
|
129
146
|
#### Parameters
|
|
130
147
|
|
|
131
|
-
* `message` **[Object][
|
|
148
|
+
* `message` **[Object][76]** Message object to send
|
|
132
149
|
|
|
133
150
|
### rpc
|
|
134
151
|
|
|
@@ -136,10 +153,10 @@ Call an RPC function in the server instance
|
|
|
136
153
|
|
|
137
154
|
#### Parameters
|
|
138
155
|
|
|
139
|
-
* `method` **[String][
|
|
156
|
+
* `method` **[String][79]** The method name to call
|
|
140
157
|
* `args` **...any** 
|
|
141
158
|
|
|
142
|
-
Returns **[Promise][
|
|
159
|
+
Returns **[Promise][81]\<any>** The resolved output of the server function
|
|
143
160
|
|
|
144
161
|
### acceptMessage
|
|
145
162
|
|
|
@@ -148,7 +165,7 @@ Accept an incoming message
|
|
|
148
165
|
#### Parameters
|
|
149
166
|
|
|
150
167
|
* `rawMessage`  
|
|
151
|
-
* `Raw` **[MessageEvent][
|
|
168
|
+
* `Raw` **[MessageEvent][82]** message event to process
|
|
152
169
|
|
|
153
170
|
### acceptPostboxes
|
|
154
171
|
|
|
@@ -157,27 +174,27 @@ Listening postboxes, these correspond to outgoing message IDs that expect a resp
|
|
|
157
174
|
### createProjectStatePatch
|
|
158
175
|
|
|
159
176
|
Create + transmit a new project state patch base on the current and previous states
|
|
160
|
-
The transmitted patch follows the [JSPatch][
|
|
177
|
+
The transmitted patch follows the [JSPatch][83] standard
|
|
161
178
|
This function accepts an entire projectState instance, computes the delta and transmits that to the server for merging
|
|
162
179
|
|
|
163
180
|
#### Parameters
|
|
164
181
|
|
|
165
|
-
* `newState` **[Object][
|
|
166
|
-
* `oldState` **[Object][
|
|
182
|
+
* `newState` **[Object][76]** The local projectState to accept
|
|
183
|
+
* `oldState` **[Object][76]** The previous projectState to examine against
|
|
167
184
|
|
|
168
|
-
Returns **[Promise][
|
|
185
|
+
Returns **[Promise][81]** A promise which will resolve when the operation has completed
|
|
169
186
|
|
|
170
187
|
### applyProjectStatePatchLocal
|
|
171
188
|
|
|
172
189
|
Client function which accepts a patch from the server and applies it to local project state
|
|
173
|
-
The patch should follow the [JSPatch][
|
|
190
|
+
The patch should follow the [JSPatch][83] standard
|
|
174
191
|
This function is expected to be sub-classed by a plugin
|
|
175
192
|
|
|
176
193
|
#### Parameters
|
|
177
194
|
|
|
178
|
-
* `patch` **[Array][
|
|
195
|
+
* `patch` **[Array][80]** A JSPatch patch to apply
|
|
179
196
|
|
|
180
|
-
Returns **[Promise][
|
|
197
|
+
Returns **[Promise][81]** A promise which will resolve when the operation has completed
|
|
181
198
|
|
|
182
199
|
### init
|
|
183
200
|
|
|
@@ -186,22 +203,22 @@ This function can only be called once and will return the existing init() worker
|
|
|
186
203
|
|
|
187
204
|
#### Parameters
|
|
188
205
|
|
|
189
|
-
* `options` **[Object][
|
|
206
|
+
* `options` **[Object][76]?** Additional options to merge into `settings` via `set`
|
|
190
207
|
|
|
191
|
-
Returns **[Promise][
|
|
208
|
+
Returns **[Promise][81]<[TeraFy][1]>** An eventual promise which will resovle with this terafy instance
|
|
192
209
|
|
|
193
210
|
### detectMode
|
|
194
211
|
|
|
195
212
|
Populate `settings.mode`
|
|
196
213
|
Try to communicate with a parent frame, if none assume we need to fallback to child mode
|
|
197
214
|
|
|
198
|
-
Returns **[Promise][
|
|
215
|
+
Returns **[Promise][81]<[String][79]>** A promise which will resolve with the detected mode to use
|
|
199
216
|
|
|
200
217
|
### injectComms
|
|
201
218
|
|
|
202
219
|
Find an existing active TERA server OR initalize one
|
|
203
220
|
|
|
204
|
-
Returns **[Promise][
|
|
221
|
+
Returns **[Promise][81]** A promise which will resolve when the loading has completed and we have found a parent TERA instance or initiallized a child
|
|
205
222
|
|
|
206
223
|
### injectStylesheet
|
|
207
224
|
|
|
@@ -228,7 +245,20 @@ This function also routes 'special' keys like `devMode` to their internal handle
|
|
|
228
245
|
|
|
229
246
|
#### Parameters
|
|
230
247
|
|
|
231
|
-
* `key` **([String][
|
|
248
|
+
* `key` **([String][79] | [Object][76])** Either a single setting key to set or an object to merge
|
|
249
|
+
* `value` **any** The value to set if `key` is a string
|
|
250
|
+
|
|
251
|
+
Returns **[TeraFy][1]** This chainable terafy instance
|
|
252
|
+
|
|
253
|
+
### setIfDev
|
|
254
|
+
|
|
255
|
+
* **See**: set()
|
|
256
|
+
|
|
257
|
+
Set or merge settings - but only in dev mode
|
|
258
|
+
|
|
259
|
+
#### Parameters
|
|
260
|
+
|
|
261
|
+
* `key` **([String][79] | [Object][76])** Either a single setting key to set or an object to merge
|
|
232
262
|
* `value` **any** The value to set if `key` is a string
|
|
233
263
|
|
|
234
264
|
Returns **[TeraFy][1]** This chainable terafy instance
|
|
@@ -240,8 +270,8 @@ Include a TeraFy client plugin
|
|
|
240
270
|
#### Parameters
|
|
241
271
|
|
|
242
272
|
* `mod`  
|
|
243
|
-
* `options` **[Object][
|
|
244
|
-
* `The` **[Object][
|
|
273
|
+
* `options` **[Object][76]?** Additional options to mutate behaviour during construction (pass options to init() to intialize later options)
|
|
274
|
+
* `The` **[Object][76]** module function to include. Invoked as `(teraClient:TeraFy, options:Object)`
|
|
245
275
|
|
|
246
276
|
Returns **[TeraFy][1]** This chainable terafy instance
|
|
247
277
|
|
|
@@ -251,8 +281,8 @@ Internal function used by use() to merge an external declared singleton against
|
|
|
251
281
|
|
|
252
282
|
#### Parameters
|
|
253
283
|
|
|
254
|
-
* `target` **[Object][
|
|
255
|
-
* `source` **[Object][
|
|
284
|
+
* `target` **[Object][76]** Initalied class instance to extend
|
|
285
|
+
* `source` **[Object][76]** Initalized source object to extend from
|
|
256
286
|
|
|
257
287
|
### toggleDevMode
|
|
258
288
|
|
|
@@ -260,7 +290,7 @@ Set or toggle devMode
|
|
|
260
290
|
|
|
261
291
|
#### Parameters
|
|
262
292
|
|
|
263
|
-
* `devModeEnabled` **([String][
|
|
293
|
+
* `devModeEnabled` **([String][79] | [Boolean][77])** Optional boolean to force dev mode (optional, default `'toggle'`)
|
|
264
294
|
|
|
265
295
|
Returns **[TeraFy][1]** This chainable terafy instance
|
|
266
296
|
|
|
@@ -271,7 +301,7 @@ This is usually because the server component wants to perform some user activity
|
|
|
271
301
|
|
|
272
302
|
#### Parameters
|
|
273
303
|
|
|
274
|
-
* `isFocused` **([String][
|
|
304
|
+
* `isFocused` **([String][79] | [Boolean][77])** Whether to fullscreen the embedded component (optional, default `'toggle'`)
|
|
275
305
|
|
|
276
306
|
## handshake
|
|
277
307
|
|
|
@@ -279,9 +309,9 @@ Return basic server information as a form of validation
|
|
|
279
309
|
|
|
280
310
|
### Properties
|
|
281
311
|
|
|
282
|
-
* `date` **[Date][
|
|
312
|
+
* `date` **[Date][84]** Server date
|
|
283
313
|
|
|
284
|
-
Returns **[Promise][
|
|
314
|
+
Returns **[Promise][81]<[Object][76]>** Basic promise result
|
|
285
315
|
|
|
286
316
|
## User
|
|
287
317
|
|
|
@@ -289,16 +319,16 @@ User / active session within TERA
|
|
|
289
319
|
|
|
290
320
|
### Properties
|
|
291
321
|
|
|
292
|
-
* `id` **[String][
|
|
293
|
-
* `email` **[String][
|
|
294
|
-
* `name` **[String][
|
|
295
|
-
* `isSubscribed` **[Boolean][
|
|
322
|
+
* `id` **[String][79]** Unique identifier of the user
|
|
323
|
+
* `email` **[String][79]** The email address of the current user
|
|
324
|
+
* `name` **[String][79]** The provided full name of the user
|
|
325
|
+
* `isSubscribed` **[Boolean][77]** Whether the active user has a TERA subscription
|
|
296
326
|
|
|
297
327
|
## getUser
|
|
298
328
|
|
|
299
329
|
Fetch the current session user
|
|
300
330
|
|
|
301
|
-
Returns **[Promise][
|
|
331
|
+
Returns **[Promise][81]<[User][44]>** The current logged in user or null if none
|
|
302
332
|
|
|
303
333
|
## Project
|
|
304
334
|
|
|
@@ -308,13 +338,13 @@ Project entry within TERA
|
|
|
308
338
|
|
|
309
339
|
Get the currently active project, if any
|
|
310
340
|
|
|
311
|
-
Returns **[Promise][
|
|
341
|
+
Returns **[Promise][81]<([Project][47] | null)>** The currently active project, if any
|
|
312
342
|
|
|
313
343
|
## getProjects
|
|
314
344
|
|
|
315
345
|
Get a list of projects the current session user has access to
|
|
316
346
|
|
|
317
|
-
Returns **[Promise][
|
|
347
|
+
Returns **[Promise][81]<[Array][80]<[Project][47]>>** Collection of projects the user has access to
|
|
318
348
|
|
|
319
349
|
## setActiveProject
|
|
320
350
|
|
|
@@ -322,7 +352,7 @@ Set the currently active project within TERA
|
|
|
322
352
|
|
|
323
353
|
### Parameters
|
|
324
354
|
|
|
325
|
-
* `project` **([Object][
|
|
355
|
+
* `project` **([Object][76] | [String][79])** The project to set as active - either the full Project object or its ID
|
|
326
356
|
|
|
327
357
|
## requireProject
|
|
328
358
|
|
|
@@ -331,14 +361,14 @@ Note that this function will percist in asking the uesr even if they try to canc
|
|
|
331
361
|
|
|
332
362
|
### Parameters
|
|
333
363
|
|
|
334
|
-
* `options` **[Object][
|
|
364
|
+
* `options` **[Object][76]?** Additional options to mutate behaviour
|
|
335
365
|
|
|
336
|
-
* `options.autoSetActiveProject` **[Boolean][
|
|
337
|
-
* `options.title` **[String][
|
|
338
|
-
* `options.noSelectTitle` **[String][
|
|
339
|
-
* `options.noSelectBody` **[String][
|
|
366
|
+
* `options.autoSetActiveProject` **[Boolean][77]** After selecting a project set that project as active in TERA (optional, default `true`)
|
|
367
|
+
* `options.title` **[String][79]** The title of the dialog to display (optional, default `"Select a project to work with"`)
|
|
368
|
+
* `options.noSelectTitle` **[String][79]** Dialog title when warning the user they need to select something (optional, default `'Select project'`)
|
|
369
|
+
* `options.noSelectBody` **[String][79]** Dialog body when warning the user they need to select something (optional, default `'A project needs to be selected to continue'`)
|
|
340
370
|
|
|
341
|
-
Returns **[Promise][
|
|
371
|
+
Returns **[Promise][81]<[Project][47]>** The active project
|
|
342
372
|
|
|
343
373
|
## selectProject
|
|
344
374
|
|
|
@@ -346,13 +376,13 @@ Prompt the user to select a project from those available
|
|
|
346
376
|
|
|
347
377
|
### Parameters
|
|
348
378
|
|
|
349
|
-
* `options` **[Object][
|
|
379
|
+
* `options` **[Object][76]?** Additional options to mutate behaviour
|
|
350
380
|
|
|
351
|
-
* `options.title` **[String][
|
|
352
|
-
* `options.allowCancel` **[Boolean][
|
|
353
|
-
* `options.setActive` **[Boolean][
|
|
381
|
+
* `options.title` **[String][79]** The title of the dialog to display (optional, default `"Select a project to work with"`)
|
|
382
|
+
* `options.allowCancel` **[Boolean][77]** Advertise cancelling the operation, the dialog can still be cancelled by closing it (optional, default `true`)
|
|
383
|
+
* `options.setActive` **[Boolean][77]** Also set the project as active when selected (optional, default `false`)
|
|
354
384
|
|
|
355
|
-
Returns **[Promise][
|
|
385
|
+
Returns **[Promise][81]<[Project][47]>** The active project
|
|
356
386
|
|
|
357
387
|
## getProjectState
|
|
358
388
|
|
|
@@ -360,12 +390,64 @@ Return the current, full snapshot state of the active project
|
|
|
360
390
|
|
|
361
391
|
### Parameters
|
|
362
392
|
|
|
363
|
-
* `options` **[Object][
|
|
393
|
+
* `options` **[Object][76]?** Additional options to mutate behaviour
|
|
364
394
|
|
|
365
|
-
* `options.autoRequire` **[Boolean][
|
|
366
|
-
* `Paths` **[Array][
|
|
395
|
+
* `options.autoRequire` **[Boolean][77]** Run `requireProject()` automatically before continuing (optional, default `true`)
|
|
396
|
+
* `Paths` **[Array][80]<[String][79]>** to subscribe to e.g. \['/users/'],
|
|
367
397
|
|
|
368
|
-
Returns **[Promise][
|
|
398
|
+
Returns **[Promise][81]<[Object][76]>** The current project state snapshot
|
|
399
|
+
|
|
400
|
+
## setProjectState
|
|
401
|
+
|
|
402
|
+
Set a nested value within the project state
|
|
403
|
+
Paths can be any valid Lodash.set() value such as:
|
|
404
|
+
|
|
405
|
+
- Dotted notation - e.g. `foo.bar.1.baz`
|
|
406
|
+
- Array path segments e.g. `['foo', 'bar', 1, 'baz']`
|
|
407
|
+
|
|
408
|
+
### Parameters
|
|
409
|
+
|
|
410
|
+
* `path` **([String][79] | [Array][80]<[String][79]>)** The sub-path within the project state to set
|
|
411
|
+
* `value` **any** The value to set
|
|
412
|
+
* `options` **[Object][76]?** Additional options to mutate behaviour
|
|
413
|
+
|
|
414
|
+
* `options.save` **[Boolean][77]** Save the changes to the server immediately, disable to queue up multiple writes (optional, default `true`)
|
|
415
|
+
* `options.sync` **[Boolean][77]** Wait for the server to acknowledge the write, you almost never need to do this (optional, default `false`)
|
|
416
|
+
|
|
417
|
+
Returns **[Promise][81]** A promise which resolves when the operation has synced with the server
|
|
418
|
+
|
|
419
|
+
## setProjectStateDefaults
|
|
420
|
+
|
|
421
|
+
* **See**: setProjectState()
|
|
422
|
+
|
|
423
|
+
Set a nested value within the project state - just like `setProjectState()` - but only if no value for that path exists
|
|
424
|
+
|
|
425
|
+
### Parameters
|
|
426
|
+
|
|
427
|
+
* `path` **([String][79] | [Array][80]<[String][79]>)** The sub-path within the project state to set
|
|
428
|
+
* `value` **any** The value to set
|
|
429
|
+
* `options` **[Object][76]?** Additional options to mutate behaviour, see setProjectState() for the full list of supported options
|
|
430
|
+
|
|
431
|
+
Returns **[Promise][81]<[Boolean][77]>** A promise which resolves to whether any changes were made - True if defaults were applied, false otherwise
|
|
432
|
+
|
|
433
|
+
## saveProjectState
|
|
434
|
+
|
|
435
|
+
Force-Save the currently active project state
|
|
436
|
+
|
|
437
|
+
Returns **[Promise][81]** A promise which resolves when the operation has completed
|
|
438
|
+
|
|
439
|
+
## replaceProjectState
|
|
440
|
+
|
|
441
|
+
* **See**: setProjectState()
|
|
442
|
+
|
|
443
|
+
Overwrite the entire project state with a new object
|
|
444
|
+
You almost never want to use this function directly, see `setProjectState(path, value)` for a nicer wrapper
|
|
445
|
+
|
|
446
|
+
### Parameters
|
|
447
|
+
|
|
448
|
+
* `newState` **[Object][76]** The new state to replace the current state with
|
|
449
|
+
|
|
450
|
+
Returns **[Promise][81]** A promise which resolves when the operation has completed
|
|
369
451
|
|
|
370
452
|
## applyProjectStatePatch
|
|
371
453
|
|
|
@@ -373,9 +455,9 @@ Apply a computed `just-diff` patch to the current project state
|
|
|
373
455
|
|
|
374
456
|
### Parameters
|
|
375
457
|
|
|
376
|
-
* `Patch` **[Object][
|
|
458
|
+
* `Patch` **[Object][76]** to apply
|
|
377
459
|
|
|
378
|
-
Returns **[Promise][
|
|
460
|
+
Returns **[Promise][81]** A promise which resolves when the operation has completed
|
|
379
461
|
|
|
380
462
|
## subscribeProjectState
|
|
381
463
|
|
|
@@ -383,7 +465,7 @@ Subscribe to project state changes
|
|
|
383
465
|
This will dispatch an RPC call to the source object `applyProjectStatePatchLocal()` function with the patch
|
|
384
466
|
If the above call fails the subscriber is assumed as dead and unsubscribed from the polling list
|
|
385
467
|
|
|
386
|
-
Returns **[Promise][
|
|
468
|
+
Returns **[Promise][81]<[Function][85]>** A promise which resolves when a subscription has been created, call the resulting function to unsubscribe
|
|
387
469
|
|
|
388
470
|
## ProjectFile
|
|
389
471
|
|
|
@@ -391,19 +473,19 @@ Data structure for a project file
|
|
|
391
473
|
|
|
392
474
|
### Properties
|
|
393
475
|
|
|
394
|
-
* `id` **[String][
|
|
395
|
-
* `name` **[String][
|
|
396
|
-
* `parsedName` **[Object][
|
|
476
|
+
* `id` **[String][79]** A UUID string representing the unique ID of the file
|
|
477
|
+
* `name` **[String][79]** Relative name path (can contain prefix directories) for the human readable file name
|
|
478
|
+
* `parsedName` **[Object][76]** An object representing meta file parts of a file name
|
|
397
479
|
|
|
398
|
-
* `parsedName.basename` **[String][
|
|
399
|
-
* `parsedName.filename` **[String][
|
|
400
|
-
* `parsedName.ext` **[String][
|
|
401
|
-
* `parsedName.dirName` **[String][
|
|
402
|
-
* `created` **[Date][
|
|
403
|
-
* `modified` **[Date][
|
|
404
|
-
* `accessed` **[Date][
|
|
405
|
-
* `size` **[Number][
|
|
406
|
-
* `mime` **[String][
|
|
480
|
+
* `parsedName.basename` **[String][79]** The filename + extention (i.e. everything without directory name)
|
|
481
|
+
* `parsedName.filename` **[String][79]** The file portion of the name (basename without the extension)
|
|
482
|
+
* `parsedName.ext` **[String][79]** The extension portion of the name (always lower case)
|
|
483
|
+
* `parsedName.dirName` **[String][79]** The directory path portion of the name
|
|
484
|
+
* `created` **[Date][84]** A date representing when the file was created
|
|
485
|
+
* `modified` **[Date][84]** A date representing when the file was created
|
|
486
|
+
* `accessed` **[Date][84]** A date representing when the file was last accessed
|
|
487
|
+
* `size` **[Number][78]** Size, in bytes, of the file
|
|
488
|
+
* `mime` **[String][79]** The associated mime type for the file
|
|
407
489
|
|
|
408
490
|
## getProjectFiles
|
|
409
491
|
|
|
@@ -411,12 +493,12 @@ Fetch the files associated with a given project
|
|
|
411
493
|
|
|
412
494
|
### Parameters
|
|
413
495
|
|
|
414
|
-
* `options` **[Object][
|
|
496
|
+
* `options` **[Object][76]** Options which mutate behaviour
|
|
415
497
|
|
|
416
|
-
* `options.autoRequire` **[Boolean][
|
|
417
|
-
* `options.meta` **[Boolean][
|
|
498
|
+
* `options.autoRequire` **[Boolean][77]** Run `requireProject()` automatically before continuing (optional, default `true`)
|
|
499
|
+
* `options.meta` **[Boolean][77]** Pull meta information for each file entity (optional, default `true`)
|
|
418
500
|
|
|
419
|
-
Returns **[Promise][
|
|
501
|
+
Returns **[Promise][81]<[ProjectFile][68]>** A collection of project files for the given project
|
|
420
502
|
|
|
421
503
|
## getProjectLibrary
|
|
422
504
|
|
|
@@ -424,16 +506,16 @@ Fetch the active projects citation library
|
|
|
424
506
|
|
|
425
507
|
### Parameters
|
|
426
508
|
|
|
427
|
-
* `path` **[String][
|
|
428
|
-
* `options` **[Object][
|
|
509
|
+
* `path` **[String][79]?** Optional file path to use, if omitted the contents of `options` are used to guess at a suitable file
|
|
510
|
+
* `options` **[Object][76]?** Additional options to mutate behaviour
|
|
429
511
|
|
|
430
|
-
* `options.autoRequire` **[Boolean][
|
|
431
|
-
* `options.multiple` **[Boolean][
|
|
432
|
-
* `options.filter` **[Function][
|
|
433
|
-
* `options.find` **[Function][
|
|
434
|
-
* `options.hint` **([String][
|
|
512
|
+
* `options.autoRequire` **[Boolean][77]** Run `requireProject()` automatically before continuing (optional, default `true`)
|
|
513
|
+
* `options.multiple` **[Boolean][77]** Allow selection of multiple libraries (optional, default `false`)
|
|
514
|
+
* `options.filter` **[Function][85]?** Optional async file filter, called each time as `(File:ProjectFile)`
|
|
515
|
+
* `options.find` **[Function][85]?** Optional async final stage file filter to reduce all candidates down to one subject file
|
|
516
|
+
* `options.hint` **([String][79] | [Array][80]<[String][79]>)?** Hints to identify the library to select in array order of preference. Generally corresponds to the previous stage - e.g. 'deduped', 'review1', 'review2', 'dedisputed'
|
|
435
517
|
|
|
436
|
-
Returns **[Promise][
|
|
518
|
+
Returns **[Promise][81]<[Array][80]<[ProjectFile][68]>>** Collection of references for the selected library matching the given hint + filter, this could be a zero length array
|
|
437
519
|
|
|
438
520
|
## setProjectLibrary
|
|
439
521
|
|
|
@@ -441,13 +523,13 @@ Save back a projects citation library
|
|
|
441
523
|
|
|
442
524
|
### Parameters
|
|
443
525
|
|
|
444
|
-
* `Collection` **[Array][
|
|
445
|
-
* `options` **[Object][
|
|
526
|
+
* `Collection` **[Array][80]\<RefLibRef>** of references for the selected library
|
|
527
|
+
* `options` **[Object][76]?** Additional options to mutate behaviour
|
|
446
528
|
|
|
447
|
-
* `options.autoRequire` **[Boolean][
|
|
448
|
-
* `options.hint` **[String][
|
|
529
|
+
* `options.autoRequire` **[Boolean][77]** Run `requireProject()` automatically before continuing (optional, default `true`)
|
|
530
|
+
* `options.hint` **[String][79]?** Hint to store against the library. Generally corresponds to the current operation being performed - e.g. 'deduped'
|
|
449
531
|
|
|
450
|
-
Returns **[Promise][
|
|
532
|
+
Returns **[Promise][81]** A promise which resolves when the save operation has completed
|
|
451
533
|
|
|
452
534
|
[1]: #terafy
|
|
453
535
|
|
|
@@ -455,146 +537,166 @@ Returns **[Promise][71]** A promise which resolves when the save operation has c
|
|
|
455
537
|
|
|
456
538
|
[3]: #properties
|
|
457
539
|
|
|
458
|
-
[4]: #
|
|
540
|
+
[4]: #events
|
|
541
|
+
|
|
542
|
+
[5]: #dom
|
|
543
|
+
|
|
544
|
+
[6]: #properties-1
|
|
545
|
+
|
|
546
|
+
[7]: #methods
|
|
547
|
+
|
|
548
|
+
[8]: #plugins
|
|
549
|
+
|
|
550
|
+
[9]: #send
|
|
551
|
+
|
|
552
|
+
[10]: #parameters
|
|
553
|
+
|
|
554
|
+
[11]: #sendraw
|
|
555
|
+
|
|
556
|
+
[12]: #parameters-1
|
|
557
|
+
|
|
558
|
+
[13]: #rpc
|
|
559
|
+
|
|
560
|
+
[14]: #parameters-2
|
|
459
561
|
|
|
460
|
-
[
|
|
562
|
+
[15]: #acceptmessage
|
|
461
563
|
|
|
462
|
-
[
|
|
564
|
+
[16]: #parameters-3
|
|
463
565
|
|
|
464
|
-
[
|
|
566
|
+
[17]: #acceptpostboxes
|
|
465
567
|
|
|
466
|
-
[
|
|
568
|
+
[18]: #createprojectstatepatch
|
|
467
569
|
|
|
468
|
-
[
|
|
570
|
+
[19]: #parameters-4
|
|
469
571
|
|
|
470
|
-
[
|
|
572
|
+
[20]: #applyprojectstatepatchlocal
|
|
471
573
|
|
|
472
|
-
[
|
|
574
|
+
[21]: #parameters-5
|
|
473
575
|
|
|
474
|
-
[
|
|
576
|
+
[22]: #init
|
|
475
577
|
|
|
476
|
-
[
|
|
578
|
+
[23]: #parameters-6
|
|
477
579
|
|
|
478
|
-
[
|
|
580
|
+
[24]: #detectmode
|
|
479
581
|
|
|
480
|
-
[
|
|
582
|
+
[25]: #injectcomms
|
|
481
583
|
|
|
482
|
-
[
|
|
584
|
+
[26]: #injectstylesheet
|
|
483
585
|
|
|
484
|
-
[
|
|
586
|
+
[27]: #injectmethods
|
|
485
587
|
|
|
486
|
-
[
|
|
588
|
+
[28]: #debug
|
|
487
589
|
|
|
488
|
-
[
|
|
590
|
+
[29]: #parameters-7
|
|
489
591
|
|
|
490
|
-
[
|
|
592
|
+
[30]: #set
|
|
491
593
|
|
|
492
|
-
[
|
|
594
|
+
[31]: #parameters-8
|
|
493
595
|
|
|
494
|
-
[
|
|
596
|
+
[32]: #setifdev
|
|
495
597
|
|
|
496
|
-
[
|
|
598
|
+
[33]: #parameters-9
|
|
497
599
|
|
|
498
|
-
[
|
|
600
|
+
[34]: #use
|
|
499
601
|
|
|
500
|
-
[
|
|
602
|
+
[35]: #parameters-10
|
|
501
603
|
|
|
502
|
-
[
|
|
604
|
+
[36]: #mixin
|
|
503
605
|
|
|
504
|
-
[
|
|
606
|
+
[37]: #parameters-11
|
|
505
607
|
|
|
506
|
-
[
|
|
608
|
+
[38]: #toggledevmode
|
|
507
609
|
|
|
508
|
-
[
|
|
610
|
+
[39]: #parameters-12
|
|
509
611
|
|
|
510
|
-
[
|
|
612
|
+
[40]: #togglefocus
|
|
511
613
|
|
|
512
|
-
[
|
|
614
|
+
[41]: #parameters-13
|
|
513
615
|
|
|
514
|
-
[
|
|
616
|
+
[42]: #handshake
|
|
515
617
|
|
|
516
|
-
[
|
|
618
|
+
[43]: #properties-2
|
|
517
619
|
|
|
518
|
-
[
|
|
620
|
+
[44]: #user
|
|
519
621
|
|
|
520
|
-
[
|
|
622
|
+
[45]: #properties-3
|
|
521
623
|
|
|
522
|
-
[
|
|
624
|
+
[46]: #getuser
|
|
523
625
|
|
|
524
|
-
[
|
|
626
|
+
[47]: #project
|
|
525
627
|
|
|
526
|
-
[
|
|
628
|
+
[48]: #getproject
|
|
527
629
|
|
|
528
|
-
[
|
|
630
|
+
[49]: #getprojects
|
|
529
631
|
|
|
530
|
-
[
|
|
632
|
+
[50]: #setactiveproject
|
|
531
633
|
|
|
532
|
-
[
|
|
634
|
+
[51]: #parameters-14
|
|
533
635
|
|
|
534
|
-
[
|
|
636
|
+
[52]: #requireproject
|
|
535
637
|
|
|
536
|
-
[
|
|
638
|
+
[53]: #parameters-15
|
|
537
639
|
|
|
538
|
-
[
|
|
640
|
+
[54]: #selectproject
|
|
539
641
|
|
|
540
|
-
[
|
|
642
|
+
[55]: #parameters-16
|
|
541
643
|
|
|
542
|
-
[
|
|
644
|
+
[56]: #getprojectstate
|
|
543
645
|
|
|
544
|
-
[
|
|
646
|
+
[57]: #parameters-17
|
|
545
647
|
|
|
546
|
-
[
|
|
648
|
+
[58]: #setprojectstate
|
|
547
649
|
|
|
548
|
-
[
|
|
650
|
+
[59]: #parameters-18
|
|
549
651
|
|
|
550
|
-
[
|
|
652
|
+
[60]: #setprojectstatedefaults
|
|
551
653
|
|
|
552
|
-
[
|
|
654
|
+
[61]: #parameters-19
|
|
553
655
|
|
|
554
|
-
[
|
|
656
|
+
[62]: #saveprojectstate
|
|
555
657
|
|
|
556
|
-
[
|
|
658
|
+
[63]: #replaceprojectstate
|
|
557
659
|
|
|
558
|
-
[
|
|
660
|
+
[64]: #parameters-20
|
|
559
661
|
|
|
560
|
-
[
|
|
662
|
+
[65]: #applyprojectstatepatch
|
|
561
663
|
|
|
562
|
-
[
|
|
664
|
+
[66]: #parameters-21
|
|
563
665
|
|
|
564
|
-
[
|
|
666
|
+
[67]: #subscribeprojectstate
|
|
565
667
|
|
|
566
|
-
[
|
|
668
|
+
[68]: #projectfile
|
|
567
669
|
|
|
568
|
-
[
|
|
670
|
+
[69]: #properties-4
|
|
569
671
|
|
|
570
|
-
[
|
|
672
|
+
[70]: #getprojectfiles
|
|
571
673
|
|
|
572
|
-
[
|
|
674
|
+
[71]: #parameters-22
|
|
573
675
|
|
|
574
|
-
[
|
|
676
|
+
[72]: #getprojectlibrary
|
|
575
677
|
|
|
576
|
-
[
|
|
678
|
+
[73]: #parameters-23
|
|
577
679
|
|
|
578
|
-
[
|
|
680
|
+
[74]: #setprojectlibrary
|
|
579
681
|
|
|
580
|
-
[
|
|
682
|
+
[75]: #parameters-24
|
|
581
683
|
|
|
582
|
-
[
|
|
684
|
+
[76]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
|
|
583
685
|
|
|
584
|
-
[
|
|
686
|
+
[77]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
|
|
585
687
|
|
|
586
|
-
[
|
|
688
|
+
[78]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
|
587
689
|
|
|
588
|
-
[
|
|
690
|
+
[79]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
|
589
691
|
|
|
590
|
-
[
|
|
692
|
+
[80]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
|
591
693
|
|
|
592
|
-
[
|
|
694
|
+
[81]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
|
593
695
|
|
|
594
|
-
[
|
|
696
|
+
[82]: https://developer.mozilla.org/docs/Web/API/MessageEvent
|
|
595
697
|
|
|
596
|
-
[
|
|
698
|
+
[83]: http://jsonpatch.com
|
|
597
699
|
|
|
598
|
-
[
|
|
700
|
+
[84]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date
|
|
599
701
|
|
|
600
|
-
[
|
|
702
|
+
[85]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
|