@iebh/tera-fy 2.0.22 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +36 -0
- package/api.md +68 -66
- package/dist/lib/projectFile.d.ts +182 -0
- package/dist/lib/projectFile.js +157 -0
- package/dist/lib/projectFile.js.map +1 -0
- package/dist/lib/syncro/entities.d.ts +28 -0
- package/dist/lib/syncro/entities.js +203 -0
- package/dist/lib/syncro/entities.js.map +1 -0
- package/dist/lib/syncro/keyed.d.ts +95 -0
- package/dist/lib/syncro/keyed.js +286 -0
- package/dist/lib/syncro/keyed.js.map +1 -0
- package/dist/lib/syncro/syncro.d.ts +328 -0
- package/dist/lib/syncro/syncro.js +633 -0
- package/dist/lib/syncro/syncro.js.map +1 -0
- package/dist/lib/terafy.bootstrapper.d.ts +42 -0
- package/dist/lib/terafy.bootstrapper.js +130 -0
- package/dist/lib/terafy.bootstrapper.js.map +1 -0
- package/dist/lib/terafy.client.d.ts +532 -0
- package/dist/lib/terafy.client.js +1110 -0
- package/dist/lib/terafy.client.js.map +1 -0
- package/dist/lib/terafy.proxy.d.ts +66 -0
- package/dist/lib/terafy.proxy.js +123 -0
- package/dist/lib/terafy.proxy.js.map +1 -0
- package/dist/lib/terafy.server.d.ts +607 -0
- package/dist/lib/terafy.server.js +1774 -0
- package/dist/lib/terafy.server.js.map +1 -0
- package/dist/plugin.vue2.es2019.js +30 -13
- package/dist/plugins/base.d.ts +20 -0
- package/dist/plugins/base.js +21 -0
- package/dist/plugins/base.js.map +1 -0
- package/dist/plugins/firebase.d.ts +62 -0
- package/dist/plugins/firebase.js +111 -0
- package/dist/plugins/firebase.js.map +1 -0
- package/dist/plugins/vite.d.ts +12 -0
- package/dist/plugins/vite.js +22 -0
- package/dist/plugins/vite.js.map +1 -0
- package/dist/plugins/vue2.d.ts +68 -0
- package/dist/plugins/vue2.js +96 -0
- package/dist/plugins/vue2.js.map +1 -0
- package/dist/plugins/vue3.d.ts +64 -0
- package/dist/plugins/vue3.js +96 -0
- package/dist/plugins/vue3.js.map +1 -0
- package/dist/terafy.bootstrapper.es2019.js +2 -2
- package/dist/terafy.bootstrapper.js +2 -2
- package/dist/terafy.es2019.js +2 -2
- package/dist/terafy.js +1 -1
- package/dist/utils/mixin.d.ts +11 -0
- package/dist/utils/mixin.js +15 -0
- package/dist/utils/mixin.js.map +1 -0
- package/dist/utils/pDefer.d.ts +12 -0
- package/dist/utils/pDefer.js +14 -0
- package/dist/utils/pDefer.js.map +1 -0
- package/dist/utils/pathTools.d.ts +70 -0
- package/dist/utils/pathTools.js +120 -0
- package/dist/utils/pathTools.js.map +1 -0
- package/eslint.config.js +44 -8
- package/lib/{projectFile.js → projectFile.ts} +83 -40
- package/lib/syncro/entities.ts +288 -0
- package/lib/syncro/{keyed.js → keyed.ts} +114 -57
- package/lib/syncro/{syncro.js → syncro.ts} +201 -168
- package/lib/{terafy.bootstrapper.js → terafy.bootstrapper.ts} +49 -31
- package/lib/{terafy.client.js → terafy.client.ts} +94 -86
- package/lib/{terafy.proxy.js → terafy.proxy.ts} +43 -16
- package/lib/{terafy.server.js → terafy.server.ts} +364 -223
- package/package.json +65 -26
- package/plugins/{base.js → base.ts} +3 -1
- package/plugins/{firebase.js → firebase.ts} +34 -16
- package/plugins/{vite.js → vite.ts} +3 -3
- package/plugins/{vue2.js → vue2.ts} +17 -10
- package/plugins/{vue3.js → vue3.ts} +11 -9
- package/tsconfig.json +30 -0
- package/utils/{mixin.js → mixin.ts} +1 -1
- package/utils/{pDefer.js → pDefer.ts} +10 -3
- package/utils/{pathTools.js → pathTools.ts} +11 -9
- package/lib/syncro/entities.js +0 -232
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
# [2.2.0](https://github.com/IEBH/TERA-fy/compare/v2.0.22...v2.2.0) (2025-04-16)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### chore
|
|
7
|
+
|
|
8
|
+
* Build dist ([a4291ac](https://github.com/IEBH/TERA-fy/commit/a4291acb9343a57721e55e9da849a986144fca0b))
|
|
9
|
+
* Build dist ([cc32061](https://github.com/IEBH/TERA-fy/commit/cc32061f5267f47b7bea8fe3f0da7dfdd14dc10b))
|
|
10
|
+
* Rename all files to TS, need to fix errors ([ffd793e](https://github.com/IEBH/TERA-fy/commit/ffd793eeed09f3e3921f7007a6fd9621bbbccb7d))
|
|
11
|
+
|
|
12
|
+
### devops
|
|
13
|
+
|
|
14
|
+
* Compile js files using tsc and export those ([0993b9c](https://github.com/IEBH/TERA-fy/commit/0993b9c02e9d7c43b16eb6d1cfea0b7e2853e6bf))
|
|
15
|
+
* Finish clearing `dist` directory on TS branch ([06758e9](https://github.com/IEBH/TERA-fy/commit/06758e98208cfa73326e9ae205c411075ee20c2a))
|
|
16
|
+
|
|
17
|
+
### feat
|
|
18
|
+
|
|
19
|
+
* Update build process for typescript ([72de0a2](https://github.com/IEBH/TERA-fy/commit/72de0a22017d7b60911c2209849f652524db7eb3))
|
|
20
|
+
|
|
21
|
+
### fix
|
|
22
|
+
|
|
23
|
+
* .default is undefined ([3e5c74e](https://github.com/IEBH/TERA-fy/commit/3e5c74ebe1d7dce3e424477f5bfb7eb5e708d8d1))
|
|
24
|
+
* Issue with TERA hanging and not loading embedded page ([a5ed9f8](https://github.com/IEBH/TERA-fy/commit/a5ed9f86264cb944d9365194eb5036592136b4f7))
|
|
25
|
+
* Issues from merge and resolving conflicts ([70d92e5](https://github.com/IEBH/TERA-fy/commit/70d92e5f0dd7c46bc39088e364c5d23b234f00a2))
|
|
26
|
+
* Matt's code review ([7725b5f](https://github.com/IEBH/TERA-fy/commit/7725b5f1fbf808334e7e99e362864203d1587ded))
|
|
27
|
+
* Minor build fixes ([e05a9fd](https://github.com/IEBH/TERA-fy/commit/e05a9fdfe02ea53973c1bdd971ee69d978d7104f))
|
|
28
|
+
* Prevent required argument error ([78c7710](https://github.com/IEBH/TERA-fy/commit/78c7710705dfeec4865ef597eb02984f94decfb9))
|
|
29
|
+
* This not binding correctly ([096d00c](https://github.com/IEBH/TERA-fy/commit/096d00c73408d27c6c0e9dc8e6c57369fa678841))
|
|
30
|
+
|
|
31
|
+
### major
|
|
32
|
+
|
|
33
|
+
* Fix all TypeScript compilation errors ([8c28b99](https://github.com/IEBH/TERA-fy/commit/8c28b9940a135fbf773a14dd25b615d057764751))
|
|
34
|
+
|
|
35
|
+
### refactor
|
|
36
|
+
|
|
37
|
+
* Inject MFDC JS rules into TS linter rules ([23d3b13](https://github.com/IEBH/TERA-fy/commit/23d3b13adda21a98e3b612817f35e949e084a10c))
|
|
38
|
+
|
|
3
39
|
## [2.0.22](https://github.com/IEBH/TERA-fy/compare/v2.0.21...v2.0.22) (2025-04-10)
|
|
4
40
|
|
|
5
41
|
## [2.0.21](https://github.com/IEBH/TERA-fy/compare/v2.0.18...v2.0.21) (2025-04-10)
|
package/api.md
CHANGED
|
@@ -293,7 +293,7 @@ Fetch the raw file contents as a Blob
|
|
|
293
293
|
|
|
294
294
|
* `options` **[Object][159]?** Additioanl options to mutate behaviour
|
|
295
295
|
|
|
296
|
-
Returns **[
|
|
296
|
+
Returns **[Promise][162]<[Blob][163]>** The eventual raw file contents as a Blob
|
|
297
297
|
|
|
298
298
|
### setContents
|
|
299
299
|
|
|
@@ -303,9 +303,9 @@ Overwrite the contents of a file with new content
|
|
|
303
303
|
|
|
304
304
|
#### Parameters
|
|
305
305
|
|
|
306
|
-
* `contents` **(File | [Blob][
|
|
306
|
+
* `contents` **(File | [Blob][163] | [FormData][164] | [Object][159] | [Array][165])** The new file contents
|
|
307
307
|
|
|
308
|
-
Returns **[Promise][
|
|
308
|
+
Returns **[Promise][162]\<void>** A promise which resolves when the operation has completed
|
|
309
309
|
|
|
310
310
|
### getRefs
|
|
311
311
|
|
|
@@ -313,7 +313,7 @@ Returns **[Promise][165]** A promise which resolves when the operation has compl
|
|
|
313
313
|
|
|
314
314
|
Fetch the file contents as an array of Reflib refs
|
|
315
315
|
|
|
316
|
-
Returns **[Promise][
|
|
316
|
+
Returns **[Promise][162]<[Array][165]\<RefLibRef>>** An eventual array of RefLib references
|
|
317
317
|
|
|
318
318
|
### setRefs
|
|
319
319
|
|
|
@@ -323,9 +323,9 @@ Overwrite the contents of a file with a new collection of Reflib refs
|
|
|
323
323
|
|
|
324
324
|
#### Parameters
|
|
325
325
|
|
|
326
|
-
* `refs` **[Array][
|
|
326
|
+
* `refs` **[Array][165]\<RefLibRef>** Collection of references for the selected library
|
|
327
327
|
|
|
328
|
-
Returns **[Promise][
|
|
328
|
+
Returns **[Promise][162]\<void>** A promise which resolves when the operation has completed
|
|
329
329
|
|
|
330
330
|
### serialize
|
|
331
331
|
|
|
@@ -339,10 +339,12 @@ Returns **[Object][159]** A Structured Clone compatible representation of this P
|
|
|
339
339
|
### deserialize
|
|
340
340
|
|
|
341
341
|
Restore an entity created with serialize
|
|
342
|
+
NOTE: This requires the 'tera' instance to be manually added to the 'data' object before calling deserialize,
|
|
343
|
+
as it's not included in the serialized output.
|
|
342
344
|
|
|
343
345
|
#### Parameters
|
|
344
346
|
|
|
345
|
-
* `data` **[Object][159]** An input object created via `ProjectFiles.serialize()`
|
|
347
|
+
* `data` **[Object][159]** An input object created via `ProjectFiles.serialize()` (MUST include a 'tera' property added manually)
|
|
346
348
|
|
|
347
349
|
Returns **[ProjectFile][1]** A ProjectFile instance setup against the deserializzed data
|
|
348
350
|
|
|
@@ -367,10 +369,10 @@ Type: [Object][159]
|
|
|
367
369
|
* `modeTimeout` **[Number][161]** How long entities have in 'detect' mode to identify themselves
|
|
368
370
|
* `siteUrl` **[String][158]** The TERA URL to connect to
|
|
369
371
|
* `restrictOrigin` **[String][158]** URL to restrict communications to
|
|
370
|
-
* `List` **[Array][
|
|
372
|
+
* `List` **[Array][165]<[String][158]>** of sandbox allowables for the embedded if in embed mode
|
|
371
373
|
* `handshakeInterval` **[Number][161]** Interval in milliseconds when sanning for a handshake
|
|
372
374
|
* `handshakeTimeout` **[Number][161]** Interval in milliseconds for when to give up trying to handshake
|
|
373
|
-
* `debugPaths` **[Array][
|
|
375
|
+
* `debugPaths` **[Array][165]<([String][158] | [Array][165]<[String][158]>)>?** List of paths (in either dotted or array notation) to enter debugging mode if a change is detected in dev mode e.g. `{debugPaths: ['foo.bar.baz']}`. This really slows down state writes so should only be used for debugging
|
|
374
376
|
|
|
375
377
|
### events
|
|
376
378
|
|
|
@@ -396,13 +398,13 @@ Type: [Object][159]
|
|
|
396
398
|
List of function stubs mapped from the server to here
|
|
397
399
|
This array is forms the reference of `TeraFy.METHOD()` objects to provide locally which will be mapped via `TeraFy.rpc(METHOD, ...args)`
|
|
398
400
|
|
|
399
|
-
Type: [Array][
|
|
401
|
+
Type: [Array][165]<[String][158]>
|
|
400
402
|
|
|
401
403
|
### plugins
|
|
402
404
|
|
|
403
405
|
Loaded plugins via Use()
|
|
404
406
|
|
|
405
|
-
Type: [Array][
|
|
407
|
+
Type: [Array][165]\<TeraFyPlugin>
|
|
406
408
|
|
|
407
409
|
### namespaces
|
|
408
410
|
|
|
@@ -420,7 +422,7 @@ Send a message + wait for a response object
|
|
|
420
422
|
|
|
421
423
|
* `message` **[Object][159]** Message object to send
|
|
422
424
|
|
|
423
|
-
Returns **[Promise][
|
|
425
|
+
Returns **[Promise][162]\<any>** A promise which resolves when the operation has completed with the remote reply
|
|
424
426
|
|
|
425
427
|
### sendRaw
|
|
426
428
|
|
|
@@ -440,7 +442,7 @@ Call an RPC function in the server instance
|
|
|
440
442
|
* `method` **[String][158]** The method name to call
|
|
441
443
|
* `args` **...any?** Optional arguments to pass to the function
|
|
442
444
|
|
|
443
|
-
Returns **[Promise][
|
|
445
|
+
Returns **[Promise][162]\<any>** The resolved output of the server function
|
|
444
446
|
|
|
445
447
|
### acceptMessage
|
|
446
448
|
|
|
@@ -450,7 +452,7 @@ Accept an incoming message
|
|
|
450
452
|
|
|
451
453
|
* `rawMessage` **[MessageEvent][170]** Raw message event to process
|
|
452
454
|
|
|
453
|
-
Returns **[Promise][
|
|
455
|
+
Returns **[Promise][162]** A promise which will resolve when the message has been processed
|
|
454
456
|
|
|
455
457
|
### acceptPostboxes
|
|
456
458
|
|
|
@@ -465,20 +467,20 @@ This function can only be called once and will return the existing init() worker
|
|
|
465
467
|
|
|
466
468
|
* `options` **[Object][159]?** Additional options to merge into `settings` via `set`
|
|
467
469
|
|
|
468
|
-
Returns **[Promise][
|
|
470
|
+
Returns **[Promise][162]<[TeraFy][31]>** An eventual promise which will resovle with this terafy instance
|
|
469
471
|
|
|
470
472
|
### detectMode
|
|
471
473
|
|
|
472
474
|
Populate `settings.mode`
|
|
473
475
|
Try to communicate with a parent frame, if none assume we need to fallback to child mode
|
|
474
476
|
|
|
475
|
-
Returns **[Promise][
|
|
477
|
+
Returns **[Promise][162]<[String][158]>** A promise which will resolve with the detected mode to use
|
|
476
478
|
|
|
477
479
|
### injectComms
|
|
478
480
|
|
|
479
481
|
Find an existing active TERA server OR initalize one
|
|
480
482
|
|
|
481
|
-
Returns **[Promise][
|
|
483
|
+
Returns **[Promise][162]** A promise which will resolve when the loading has completed and we have found a parent TERA instance or initiallized a child
|
|
482
484
|
|
|
483
485
|
### handshakeLoop
|
|
484
486
|
|
|
@@ -493,13 +495,13 @@ Keep trying to handshake until the target responds
|
|
|
493
495
|
* `handshakeInterval` **[Number][161]?** Interval in milliseconds when sanning for a handshake, defaults to global setting
|
|
494
496
|
* `handshakeTimeout` **[Number][161]?** Interval in milliseconds for when to give up trying to handshake, defaults to global setting
|
|
495
497
|
|
|
496
|
-
Returns **[Promise][
|
|
498
|
+
Returns **[Promise][162]** A promise which will either resolve when the handshake is successful OR fail with 'TIMEOUT'
|
|
497
499
|
|
|
498
500
|
### injectStylesheet
|
|
499
501
|
|
|
500
502
|
Inject a local stylesheet to handle TERA server functionality
|
|
501
503
|
|
|
502
|
-
Returns **[Promise][
|
|
504
|
+
Returns **[Promise][162]** A promise which will resolve when the loading has completed and we have found a parent TERA instance or initiallized a child
|
|
503
505
|
|
|
504
506
|
### injectMethods
|
|
505
507
|
|
|
@@ -606,9 +608,9 @@ This is an pre-requisite step for requireProject()
|
|
|
606
608
|
|
|
607
609
|
#### Parameters
|
|
608
610
|
|
|
609
|
-
* `options`
|
|
611
|
+
* `options` **any?** 
|
|
610
612
|
|
|
611
|
-
Returns **[Promise][
|
|
613
|
+
Returns **[Promise][162]** A promise which will resolve if the there is a user and they are logged in
|
|
612
614
|
|
|
613
615
|
## mountNamespace
|
|
614
616
|
|
|
@@ -619,7 +621,7 @@ This generally creates whatever framework flavoured reactive/observer/object is
|
|
|
619
621
|
|
|
620
622
|
* `name` **[String][158]** The alias of the namespace, this should be alphanumeric + hyphens + underscores
|
|
621
623
|
|
|
622
|
-
Returns **[Promise][
|
|
624
|
+
Returns **[Promise][162]\<Reactive>** A promise which resolves to the reactive object
|
|
623
625
|
|
|
624
626
|
## Actual namespace mounting function designed to be overriden by plugins
|
|
625
627
|
|
|
@@ -627,7 +629,7 @@ Returns **[Promise][165]\<Reactive>** A promise which resolves to the reactive o
|
|
|
627
629
|
|
|
628
630
|
* `name` **[String][158]** The alias of the namespace, this should be alphanumeric + hyphens + underscores
|
|
629
631
|
|
|
630
|
-
Returns **[Promise][
|
|
632
|
+
Returns **[Promise][162]** A promise which resolves when the mount operation has completed
|
|
631
633
|
|
|
632
634
|
## unmountNamespace
|
|
633
635
|
|
|
@@ -638,7 +640,7 @@ This function will remove the namespace from `namespaces`, cleaning up any memor
|
|
|
638
640
|
|
|
639
641
|
* `name` **[String][158]** The name of the namespace to unmount
|
|
640
642
|
|
|
641
|
-
Returns **[Promise][
|
|
643
|
+
Returns **[Promise][162]** A promise which resolves when the operation has completed
|
|
642
644
|
|
|
643
645
|
## Actual namespace unmounting function designed to be overriden by plugins
|
|
644
646
|
|
|
@@ -646,7 +648,7 @@ Returns **[Promise][165]** A promise which resolves when the operation has compl
|
|
|
646
648
|
|
|
647
649
|
* `name` **[String][158]** The name of the namespace to unmount
|
|
648
650
|
|
|
649
|
-
Returns **[Promise][
|
|
651
|
+
Returns **[Promise][162]** A promise which resolves when the operation has completed
|
|
650
652
|
|
|
651
653
|
## handshake
|
|
652
654
|
|
|
@@ -656,7 +658,7 @@ Return basic server information as a form of validation
|
|
|
656
658
|
|
|
657
659
|
* `date` **[Date][160]** Server date
|
|
658
660
|
|
|
659
|
-
Returns **[Promise][
|
|
661
|
+
Returns **[Promise][162]<[Object][159]>** Basic promise result
|
|
660
662
|
|
|
661
663
|
## setServerVerbosity
|
|
662
664
|
|
|
@@ -681,7 +683,7 @@ User / active session within TERA
|
|
|
681
683
|
|
|
682
684
|
Fetch the current session user
|
|
683
685
|
|
|
684
|
-
Returns **[Promise][
|
|
686
|
+
Returns **[Promise][162]<[User][88]>** The current logged in user or null if none
|
|
685
687
|
|
|
686
688
|
## getCredentials
|
|
687
689
|
|
|
@@ -701,7 +703,7 @@ This is an pre-requisite step for requireProject()
|
|
|
701
703
|
|
|
702
704
|
* `options.forceRetry` **[Boolean][167]** Forcabily try to refresh the user state (optional, default `false`)
|
|
703
705
|
|
|
704
|
-
Returns **[Promise][
|
|
706
|
+
Returns **[Promise][162]<[User][88]>** The current logged in user or null if none
|
|
705
707
|
|
|
706
708
|
## Project
|
|
707
709
|
|
|
@@ -711,13 +713,13 @@ Project entry within TERA
|
|
|
711
713
|
|
|
712
714
|
Get the currently active project, if any
|
|
713
715
|
|
|
714
|
-
Returns **[Promise][
|
|
716
|
+
Returns **[Promise][162]<([Project][94] | null)>** The currently active project, if any
|
|
715
717
|
|
|
716
718
|
## getProjects
|
|
717
719
|
|
|
718
720
|
Get a list of projects the current session user has access to
|
|
719
721
|
|
|
720
|
-
Returns **[Promise][
|
|
722
|
+
Returns **[Promise][162]<[Array][165]<[Project][94]>>** Collection of projects the user has access to
|
|
721
723
|
|
|
722
724
|
## setActiveProject
|
|
723
725
|
|
|
@@ -741,7 +743,7 @@ Note that this function will percist in asking the uesr even if they try to canc
|
|
|
741
743
|
* `options.noSelectTitle` **[String][158]** Dialog title when warning the user they need to select something (optional, default `'Select project'`)
|
|
742
744
|
* `options.noSelectBody` **[String][158]** Dialog body when warning the user they need to select something (optional, default `'A project needs to be selected to continue'`)
|
|
743
745
|
|
|
744
|
-
Returns **[Promise][
|
|
746
|
+
Returns **[Promise][162]<[Project][94]>** The active project
|
|
745
747
|
|
|
746
748
|
## selectProject
|
|
747
749
|
|
|
@@ -755,7 +757,7 @@ Prompt the user to select a project from those available
|
|
|
755
757
|
* `options.allowCancel` **[Boolean][167]** Advertise cancelling the operation, the dialog can still be cancelled by closing it (optional, default `true`)
|
|
756
758
|
* `options.setActive` **[Boolean][167]** Also set the project as active when selected (optional, default `false`)
|
|
757
759
|
|
|
758
|
-
Returns **[Promise][
|
|
760
|
+
Returns **[Promise][162]<[Project][94]>** The active project
|
|
759
761
|
|
|
760
762
|
## getNamespace
|
|
761
763
|
|
|
@@ -766,7 +768,7 @@ This can be used for simpler apps which don't have their own reactive / observer
|
|
|
766
768
|
|
|
767
769
|
* `name` **[String][158]** The alias of the namespace, this should be alphanumeric + hyphens + underscores
|
|
768
770
|
|
|
769
|
-
Returns **[Promise][
|
|
771
|
+
Returns **[Promise][162]<[Object][159]>** A promise which resolves to the namespace POJO state
|
|
770
772
|
|
|
771
773
|
## setNamespace
|
|
772
774
|
|
|
@@ -781,7 +783,7 @@ This can be used for simpler apps which don't have their own reactive / observer
|
|
|
781
783
|
|
|
782
784
|
* `options.method` **(`"merge"` | `"set"`)** How to handle the state. 'merge' (merge a partial state over the existing namespace state), 'set' (completely overwrite the existing namespace) (optional, default `'merge'`)
|
|
783
785
|
|
|
784
|
-
Returns **[Promise][
|
|
786
|
+
Returns **[Promise][162]<[Object][159]>** A promise which resolves to the namespace POJO state
|
|
785
787
|
|
|
786
788
|
## listNamespaces
|
|
787
789
|
|
|
@@ -791,7 +793,7 @@ Return a list of namespaces available to the current project
|
|
|
791
793
|
|
|
792
794
|
* `name` **[String][158]** The name of the namespace
|
|
793
795
|
|
|
794
|
-
Returns **[Promise][
|
|
796
|
+
Returns **[Promise][162]<[Array][165]<[Object][159]>>** Collection of available namespaces for the current project
|
|
795
797
|
|
|
796
798
|
## getProjectState
|
|
797
799
|
|
|
@@ -802,9 +804,9 @@ Return the current, full snapshot state of the active project
|
|
|
802
804
|
* `options` **[Object][159]?** Additional options to mutate behaviour
|
|
803
805
|
|
|
804
806
|
* `options.autoRequire` **[Boolean][167]** Run `requireProject()` automatically before continuing (optional, default `true`)
|
|
805
|
-
* `Paths` **[Array][
|
|
807
|
+
* `Paths` **[Array][165]<[String][158]>** to subscribe to e.g. \['/users/'],
|
|
806
808
|
|
|
807
|
-
Returns **[Promise][
|
|
809
|
+
Returns **[Promise][162]<[Object][159]>** The current project state snapshot
|
|
808
810
|
|
|
809
811
|
## setProjectState
|
|
810
812
|
|
|
@@ -816,13 +818,13 @@ Paths can be any valid Lodash.set() value such as:
|
|
|
816
818
|
|
|
817
819
|
### Parameters
|
|
818
820
|
|
|
819
|
-
* `path` **([String][158] | [Array][
|
|
821
|
+
* `path` **([String][158] | [Array][165]<[String][158]>)** The sub-path within the project state to set
|
|
820
822
|
* `value` **any** The value to set
|
|
821
823
|
* `options` **[Object][159]?** Additional options to mutate behaviour
|
|
822
824
|
|
|
823
825
|
* `options.save` **[Boolean][167]** Save the changes to the server immediately, disable to queue up multiple writes (optional, default `true`)
|
|
824
826
|
|
|
825
|
-
Returns **[Promise][
|
|
827
|
+
Returns **[Promise][162]** A promise which resolves when the operation has been dispatched to the server
|
|
826
828
|
|
|
827
829
|
## setProjectStateDefaults
|
|
828
830
|
|
|
@@ -832,18 +834,18 @@ Set a nested value within the project state - just like `setProjectState()` - bu
|
|
|
832
834
|
|
|
833
835
|
### Parameters
|
|
834
836
|
|
|
835
|
-
* `path` **([String][158] | [Array][
|
|
837
|
+
* `path` **([String][158] | [Array][165]<[String][158]>)** The sub-path within the project state to set
|
|
836
838
|
* `value` **any** The value to set
|
|
837
839
|
* `options` **[Object][159]?** Additional options to mutate behaviour, see setProjectState() for the full list of supported options
|
|
838
840
|
|
|
839
|
-
Returns **[Promise][
|
|
841
|
+
Returns **[Promise][162]<[Boolean][167]>** A promise which resolves to whether any changes were made - True if defaults were applied, false otherwise
|
|
840
842
|
|
|
841
843
|
## setProjectStateRefresh
|
|
842
844
|
|
|
843
845
|
Force refetching the remote project state into local
|
|
844
846
|
This is only ever needed when saving large quantities of data that need to be immediately available
|
|
845
847
|
|
|
846
|
-
Returns **[Promise][
|
|
848
|
+
Returns **[Promise][162]** A promise which resolves when the operation has completed
|
|
847
849
|
|
|
848
850
|
## FileFilters
|
|
849
851
|
|
|
@@ -865,7 +867,7 @@ Prompt the user to select a library to operate on
|
|
|
865
867
|
* `options` **[Object][159]?** Additional options to mutate behaviour
|
|
866
868
|
|
|
867
869
|
* `options.title` **[String][158]** The title of the dialog to display (optional, default `"Select a file"`)
|
|
868
|
-
* `options.hint` **([String][158] | [Array][
|
|
870
|
+
* `options.hint` **([String][158] | [Array][165]<[String][158]>)?** Hints to identify the file to select in array order of preference
|
|
869
871
|
* `options.save` **[Boolean][167]** Set to truthy if saving a new file, UI will adjust to allowing overwrite OR new file name input (optional, default `false`)
|
|
870
872
|
* `options.filters` **[FileFilters][116]?** Optional file filters
|
|
871
873
|
* `options.allowUpload` **[Boolean][167]** Allow uploading new files (optional, default `true`)
|
|
@@ -875,7 +877,7 @@ Prompt the user to select a library to operate on
|
|
|
875
877
|
* `options.autoRequire` **[Boolean][167]** Run `requireProject()` automatically before continuing (optional, default `true`)
|
|
876
878
|
* `options.filter` **[FileFilters][116]?** Optional file filters
|
|
877
879
|
|
|
878
|
-
Returns **[Promise][
|
|
880
|
+
Returns **[Promise][162]<[ProjectFile][1]>** The eventually selected file, if in save mode new files are created as stubs
|
|
879
881
|
|
|
880
882
|
## getProjectFiles
|
|
881
883
|
|
|
@@ -889,7 +891,7 @@ Fetch the files associated with a given project
|
|
|
889
891
|
* `options.lazy` **[Boolean][167]** If true, use the fastest method to retrieve the file list such as the cache. If false, force a refresh each time (optional, default `true`)
|
|
890
892
|
* `options.meta` **[Boolean][167]** Pull meta information for each file entity (optional, default `true`)
|
|
891
893
|
|
|
892
|
-
Returns **[Promise][
|
|
894
|
+
Returns **[Promise][162]<[Array][165]<[ProjectFile][1]>>** A collection of project files for the given project
|
|
893
895
|
|
|
894
896
|
## getProjectFileContents
|
|
895
897
|
|
|
@@ -916,7 +918,7 @@ Fetch a project file by its name
|
|
|
916
918
|
* `options.subkey` **[String][158]?** If specified only the extracted subkey is returned rather than the full object
|
|
917
919
|
* `options.cache` **[Boolean][167]** Use the existing file cache if possible, set to false to force a refresh of files from the server first (optional, default `true`)
|
|
918
920
|
|
|
919
|
-
Returns **[Promise][
|
|
921
|
+
Returns **[Promise][162]<[ProjectFile][1]>** The eventual fetched ProjectFile (or requested subkey)
|
|
920
922
|
|
|
921
923
|
## createProjectFile
|
|
922
924
|
|
|
@@ -927,7 +929,7 @@ This creates an empty file which can then be written to
|
|
|
927
929
|
|
|
928
930
|
* `name` **[String][158]** The name + relative directory path component
|
|
929
931
|
|
|
930
|
-
Returns **[Promise][
|
|
932
|
+
Returns **[Promise][162]<[ProjectFile][1]>** The eventual ProjectFile created
|
|
931
933
|
|
|
932
934
|
## deleteProjectFile
|
|
933
935
|
|
|
@@ -937,7 +939,7 @@ Remove a project file by its ID
|
|
|
937
939
|
|
|
938
940
|
* `id` **[String][158]** The File ID to remove
|
|
939
941
|
|
|
940
|
-
Returns **[Promise][
|
|
942
|
+
Returns **[Promise][162]** A promise which resolves when the operation has completed
|
|
941
943
|
|
|
942
944
|
## setProjectFileContents
|
|
943
945
|
|
|
@@ -946,17 +948,17 @@ Save (or overwrite) a file within a project
|
|
|
946
948
|
### Parameters
|
|
947
949
|
|
|
948
950
|
* `id` **([String][158] | [ProjectFile][1])?** ProjectFile or ID of the same to overwrite, if omitted a file is prompted for
|
|
949
|
-
* `contents` **(File | [Blob][
|
|
951
|
+
* `contents` **(File | [Blob][163] | [FormData][164] | [Object][159] | [Array][165])** The new file contents
|
|
950
952
|
* `options` **[Object][159]?** Additional options to mutate behaviour
|
|
951
953
|
|
|
952
954
|
* `options.id` **([String][158] | [ProjectFile][1])?** Alternate method to specify the file ID to save as, if omitted one will be prompted for
|
|
953
955
|
* `options.autoRequire` **[Boolean][167]** Run `requireProject()` automatically before continuing (optional, default `true`)
|
|
954
|
-
* `options.hint` **([String][158] | [Array][
|
|
956
|
+
* `options.hint` **([String][158] | [Array][165]<[String][158]>)?** Hint(s) to store against the library. Generally corresponds to the current operation being performed - e.g. 'deduped'
|
|
955
957
|
* `options.filename` **[String][158]?** Suggested filename if `id` is unspecified
|
|
956
958
|
* `options.title` **[String][158]** Dialog title if `id` is unspecified and a prompt is necessary (optional, default `'Save citation library'`)
|
|
957
959
|
* `options.meta` **[Object][159]?** Optional meta data to merge into the file data
|
|
958
960
|
|
|
959
|
-
Returns **[Promise][
|
|
961
|
+
Returns **[Promise][162]** A promise which will resolve when the write operation has completed
|
|
960
962
|
|
|
961
963
|
## selectProjectLibrary
|
|
962
964
|
|
|
@@ -967,7 +969,7 @@ Prompt the user to select a library to operate on and return a array of referenc
|
|
|
967
969
|
* `options` **[Object][159]?** Additional options to mutate behaviour
|
|
968
970
|
|
|
969
971
|
* `options.title` **[String][158]** The title of the dialog to display (optional, default `"Select a citation library"`)
|
|
970
|
-
* `options.hint` **([String][158] | [Array][
|
|
972
|
+
* `options.hint` **([String][158] | [Array][165]<[String][158]>)?** Hints to identify the library to select in array order of preference. Generally corresponds to the previous stage - e.g. 'deduped', 'review1', 'review2', 'dedisputed'
|
|
971
973
|
* `options.allowUpload` **[Boolean][167]** Allow uploading new files (optional, default `true`)
|
|
972
974
|
* `options.allowRefresh` **[Boolean][167]** Allow the user to manually refresh the file list (optional, default `true`)
|
|
973
975
|
* `options.allowDownloadZip` **[Boolean][167]** Allow the user to download a Zip of all files (optional, default `true`)
|
|
@@ -976,7 +978,7 @@ Prompt the user to select a library to operate on and return a array of referenc
|
|
|
976
978
|
* `options.filters` **[FileFilters][116]?** Optional file filters, defaults to citation library selection only
|
|
977
979
|
* `options` **...any?** Additional options - see `getProjectLibrary()`
|
|
978
980
|
|
|
979
|
-
Returns **[Promise][
|
|
981
|
+
Returns **[Promise][162]<[Array][165]\<Ref>>** A collection of references from the selected file
|
|
980
982
|
|
|
981
983
|
## getProjectLibrary
|
|
982
984
|
|
|
@@ -992,7 +994,7 @@ Fetch + convert a project file into a library of citations
|
|
|
992
994
|
* `options.filter` **[Function][168]?** Optional async file filter, called each time as `(File:ProjectFile)`
|
|
993
995
|
* `options.find` **[Function][168]?** Optional async final stage file filter to reduce all candidates down to one subject file
|
|
994
996
|
|
|
995
|
-
Returns **([Promise][
|
|
997
|
+
Returns **([Promise][162]<[Array][165]\<Ref>> | [Promise][162]\<any>)** A collection of references (default bevahiour) or a whatever format was requested
|
|
996
998
|
|
|
997
999
|
## setProjectLibrary
|
|
998
1000
|
|
|
@@ -1001,11 +1003,11 @@ Save back a citation library from some input
|
|
|
1001
1003
|
### Parameters
|
|
1002
1004
|
|
|
1003
1005
|
* `id` **[String][158]?** File ID to save back to, if omitted a file will be prompted for
|
|
1004
|
-
* `refs` **([Array][
|
|
1006
|
+
* `refs` **([Array][165]\<RefLibRef> | [Blob][163] | File)?** Collection of references for the selected library or the raw Blob/File
|
|
1005
1007
|
* `options` **[Object][159]?** Additional options to mutate behaviour
|
|
1006
1008
|
|
|
1007
1009
|
* `options.id` **[String][158]?** Alternate method to specify the file ID to save as, if omitted one will be prompted for
|
|
1008
|
-
* `options.refs` **([Array][
|
|
1010
|
+
* `options.refs` **([Array][165]\<RefLibRef> | [Blob][163] | File)?** Alternate method to specify the refs to save as an array or raw Blob/File
|
|
1009
1011
|
* `options.format` **[String][158]** Input format used. ENUM: 'pojo' (return a parsed JS collection), 'blob' (raw JS Blob object), 'file' (named JS File object) (optional, default `'json'`)
|
|
1010
1012
|
* `options.autoRequire` **[Boolean][167]** Run `requireProject()` automatically before continuing (optional, default `true`)
|
|
1011
1013
|
* `options.hint` **[String][158]?** Hint to store against the library. Generally corresponds to the current operation being performed - e.g. 'deduped'
|
|
@@ -1014,7 +1016,7 @@ Save back a citation library from some input
|
|
|
1014
1016
|
* `options.overwrite` **[Boolean][167]** Allow existing file upsert (optional, default `true`)
|
|
1015
1017
|
* `options.meta` **[Object][159]?** Optional meta data to merge into the file data
|
|
1016
1018
|
|
|
1017
|
-
Returns **[Promise][
|
|
1019
|
+
Returns **[Promise][162]** A promise which resolves when the save operation has completed
|
|
1018
1020
|
|
|
1019
1021
|
## projectLog
|
|
1020
1022
|
|
|
@@ -1026,7 +1028,7 @@ The required log object can be of various forms. See [https://tera-tools.com/api
|
|
|
1026
1028
|
|
|
1027
1029
|
* `log` **[Object][159]** The log entry to create
|
|
1028
1030
|
|
|
1029
|
-
Returns **[Promise][
|
|
1031
|
+
Returns **[Promise][162]** A promise which resolves when the operation has completed
|
|
1030
1032
|
|
|
1031
1033
|
## setPage
|
|
1032
1034
|
|
|
@@ -1054,7 +1056,7 @@ Display simple text within TERA
|
|
|
1054
1056
|
* `options.title` **[String][158]** The title of the alert box (optional, default `'TERA'`)
|
|
1055
1057
|
* `options.buttons` **(`"ok"` | `false`)** Button set to use or falsy to disable (optional, default `'ok'`)
|
|
1056
1058
|
|
|
1057
|
-
Returns **[Promise][
|
|
1059
|
+
Returns **[Promise][162]** A promise which resolves when the alert has been dismissed
|
|
1058
1060
|
|
|
1059
1061
|
## uiConfirm
|
|
1060
1062
|
|
|
@@ -1069,7 +1071,7 @@ Present a simple ok/cancel dialog to the user
|
|
|
1069
1071
|
* `options.isHtml` **[Boolean][167]** If falsy the text is rendered as plain-text otherwise it will be assumed as HTML content (optional, default `false`)
|
|
1070
1072
|
* `options.title` **[String][158]** The title of the confirmation box (optional, default `'TERA'`)
|
|
1071
1073
|
|
|
1072
|
-
Returns **[Promise][
|
|
1074
|
+
Returns **[Promise][162]** A promise which resolves with `Promise.resolve('OK')` or rejects with `Promise.reject('CANCEL')`
|
|
1073
1075
|
|
|
1074
1076
|
## uiPanic
|
|
1075
1077
|
|
|
@@ -1097,7 +1099,7 @@ All options are cumulative - i.e. they are merged with other options previously
|
|
|
1097
1099
|
* `options.progress` **[Number][161]?** The current progress of the task being conducted, this is assumed to be a value less than `maxProgress`
|
|
1098
1100
|
* `options.maxProgress` **[Number][161]?** The maximum value that the progress can be
|
|
1099
1101
|
|
|
1100
|
-
Returns **[Promise][
|
|
1102
|
+
Returns **[Promise][162]** A promise which resolves when the dialog has been updated
|
|
1101
1103
|
|
|
1102
1104
|
## uiPrompt
|
|
1103
1105
|
|
|
@@ -1115,7 +1117,7 @@ Prompt the user for an input, responding with a Promisable value
|
|
|
1115
1117
|
* `options.placeholder` **[String][158]?** Optional placeholder text
|
|
1116
1118
|
* `options.required` **[Boolean][167]** Treat nullish or empty inputs as a cancel operation (optional, default `true`)
|
|
1117
1119
|
|
|
1118
|
-
Returns **[Promise][
|
|
1120
|
+
Returns **[Promise][162]\<any>** Either the eventual user value or a throw with `Promise.reject('CANCEL')`
|
|
1119
1121
|
|
|
1120
1122
|
## uiThrow
|
|
1121
1123
|
|
|
@@ -1477,13 +1479,13 @@ This function is ideally called within a requestFocus() wrapper
|
|
|
1477
1479
|
|
|
1478
1480
|
[161]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
|
1479
1481
|
|
|
1480
|
-
[162]: https://developer.mozilla.org/docs/Web/
|
|
1482
|
+
[162]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
|
1481
1483
|
|
|
1482
|
-
[163]: https://developer.mozilla.org/docs/Web/API/
|
|
1484
|
+
[163]: https://developer.mozilla.org/docs/Web/API/Blob
|
|
1483
1485
|
|
|
1484
|
-
[164]: https://developer.mozilla.org/docs/Web/
|
|
1486
|
+
[164]: https://developer.mozilla.org/docs/Web/API/FormData
|
|
1485
1487
|
|
|
1486
|
-
[165]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/
|
|
1488
|
+
[165]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
|
1487
1489
|
|
|
1488
1490
|
[166]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm
|
|
1489
1491
|
|