@iebh/tera-fy 2.3.10 → 2.3.12

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.
Files changed (82) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/api.md +8 -11
  3. package/dist/plugin.vue2.es2019.js +28 -27
  4. package/dist/terafy.bootstrapper.es2019.js +2 -2
  5. package/dist/terafy.bootstrapper.js +2 -2
  6. package/dist/terafy.es2019.js +5 -5
  7. package/dist/terafy.js +5 -5
  8. package/eslint.config.js +4 -66
  9. package/lib/{projectFile.ts → projectFile.js} +52 -76
  10. package/lib/syncro/{entities.ts → entities.js} +14 -83
  11. package/lib/syncro/{keyed.ts → keyed.js} +46 -68
  12. package/lib/syncro/{syncro.ts → syncro.js} +104 -136
  13. package/lib/{terafy.bootstrapper.ts → terafy.bootstrapper.js} +20 -30
  14. package/lib/{terafy.client.ts → terafy.client.js} +85 -84
  15. package/lib/{terafy.proxy.ts → terafy.proxy.js} +12 -26
  16. package/lib/{terafy.server.ts → terafy.server.js} +204 -229
  17. package/package.json +20 -39
  18. package/plugins/{base.ts → base.js} +3 -5
  19. package/plugins/{firebase.ts → firebase.js} +22 -21
  20. package/plugins/{vite.ts → vite.js} +3 -3
  21. package/plugins/{vue2.ts → vue2.js} +8 -10
  22. package/plugins/{vue3.ts → vue3.js} +7 -10
  23. package/utils/mixin.js +15 -0
  24. package/utils/{pathTools.ts → pathTools.js} +8 -9
  25. package/widgets/tera-file-select.vue +1 -1
  26. package/dist/lib/projectFile.d.ts +0 -190
  27. package/dist/lib/projectFile.js +0 -305
  28. package/dist/lib/projectFile.js.map +0 -1
  29. package/dist/lib/syncro/entities.d.ts +0 -34
  30. package/dist/lib/syncro/entities.js +0 -212
  31. package/dist/lib/syncro/entities.js.map +0 -1
  32. package/dist/lib/syncro/keyed (Rhino's conflicted copy 2026-05-10).js +0 -287
  33. package/dist/lib/syncro/keyed.d.ts +0 -95
  34. package/dist/lib/syncro/keyed.js +0 -288
  35. package/dist/lib/syncro/keyed.js (Rhino's conflicted copy 2026-05-10).map +0 -1
  36. package/dist/lib/syncro/keyed.js.map +0 -1
  37. package/dist/lib/syncro/syncro (Rhino's conflicted copy 2026-05-10).js +0 -765
  38. package/dist/lib/syncro/syncro.d (Rhino's conflicted copy 2026-05-10).ts +0 -336
  39. package/dist/lib/syncro/syncro.d.ts +0 -343
  40. package/dist/lib/syncro/syncro.js +0 -771
  41. package/dist/lib/syncro/syncro.js (Rhino's conflicted copy 2026-05-10).map +0 -1
  42. package/dist/lib/syncro/syncro.js.map +0 -1
  43. package/dist/lib/terafy.bootstrapper.d.ts +0 -42
  44. package/dist/lib/terafy.bootstrapper.js +0 -129
  45. package/dist/lib/terafy.bootstrapper.js.map +0 -1
  46. package/dist/lib/terafy.client.d.ts +0 -555
  47. package/dist/lib/terafy.client.js +0 -1153
  48. package/dist/lib/terafy.client.js.map +0 -1
  49. package/dist/lib/terafy.proxy.d.ts +0 -66
  50. package/dist/lib/terafy.proxy.js +0 -130
  51. package/dist/lib/terafy.proxy.js.map +0 -1
  52. package/dist/lib/terafy.server.d.ts +0 -697
  53. package/dist/lib/terafy.server.js +0 -2062
  54. package/dist/lib/terafy.server.js.map +0 -1
  55. package/dist/plugin.vue2.es2019 (Rhino's conflicted copy 2026-05-10).js +0 -1271
  56. package/dist/plugins/base.d.ts +0 -20
  57. package/dist/plugins/base.js +0 -22
  58. package/dist/plugins/base.js.map +0 -1
  59. package/dist/plugins/firebase.d.ts +0 -62
  60. package/dist/plugins/firebase.js +0 -123
  61. package/dist/plugins/firebase.js.map +0 -1
  62. package/dist/plugins/vite.d.ts +0 -12
  63. package/dist/plugins/vite.js +0 -22
  64. package/dist/plugins/vite.js.map +0 -1
  65. package/dist/plugins/vue2.d.ts +0 -67
  66. package/dist/plugins/vue2.js +0 -104
  67. package/dist/plugins/vue2.js.map +0 -1
  68. package/dist/plugins/vue3.d.ts +0 -63
  69. package/dist/plugins/vue3.js +0 -93
  70. package/dist/plugins/vue3.js.map +0 -1
  71. package/dist/utils/mixin.d.ts +0 -11
  72. package/dist/utils/mixin.js +0 -15
  73. package/dist/utils/mixin.js.map +0 -1
  74. package/dist/utils/pDefer.d.ts +0 -16
  75. package/dist/utils/pDefer.js +0 -19
  76. package/dist/utils/pDefer.js.map +0 -1
  77. package/dist/utils/pathTools.d.ts +0 -70
  78. package/dist/utils/pathTools.js +0 -120
  79. package/dist/utils/pathTools.js.map +0 -1
  80. package/tsconfig.json +0 -30
  81. package/utils/mixin.ts +0 -18
  82. package/utils/pDefer.ts +0 -27
@@ -1,555 +0,0 @@
1
- import ProjectFile from './projectFile.js';
2
- /**
3
- * Main Tera-Fy Client (class singleton) to be used in a frontend browser
4
- *
5
- * @class TeraFy
6
- */
7
- export default class TeraFy {
8
- /**
9
- * Various settings to configure behaviour
10
- *
11
- * @type {Object}
12
- * @property {String} session Unique session signature for this instance of TeraFy, used to sign server messages, if falsy `getEntropicString(16)` is used to populate
13
- * @property {Boolean} devMode Operate in Dev-Mode - i.e. force outer refresh when encountering an existing TeraFy instance + be more tolerant of weird iframe origins
14
- * @property {Number} verbosity Verbosity level, the higher the more chatty TeraFY will be. Set to zero to disable all `debug()` call output
15
- * @property {'detect'|'parent'|'child'|'popup'} mode How to communicate with TERA. 'parent' assumes that the parent of the current document is TERA, 'child' spawns an iFrame and uses TERA there, 'detect' tries parent and switches to `modeFallback` if communication fails
16
- * @property {String} modeFallback Method to use when all method detection fails
17
- * @property {Object<Object<Function>>} modeOverrides Functions to run when switching to specific modes, these are typically used to augment config. Called as `(config:Object)`
18
- * @property {Number} modeTimeout How long entities have in 'detect' mode to identify themselves
19
- * @property {String} siteUrl The TERA URL to connect to
20
- * @property {String} restrictOrigin URL to restrict communications to
21
- * @property {Array<String>} List of sandbox allowables for the embedded if in embed mode
22
- * @property {Number} handshakeInterval Interval in milliseconds when scanning for a handshake
23
- * @property {Number} handshakeTimeout Interval in milliseconds for when to give up trying to handshake
24
- * @property {Array<String|Array<String>>} [debugPaths] 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
25
- */
26
- settings: {
27
- session: string | null;
28
- devMode: boolean;
29
- verbosity: number;
30
- mode: "detect" | "parent" | "child" | "popup";
31
- modeTimeout: number;
32
- modeFallback: string;
33
- modeOverrides: {
34
- [key: string]: (config: any) => void;
35
- };
36
- siteUrl: string;
37
- restrictOrigin: string;
38
- frameSandbox: string[];
39
- handshakeInterval: number;
40
- handshakeTimeout: number;
41
- debugPaths: Array<string | Array<string>> | null;
42
- };
43
- /**
44
- * Event emitter subscription endpoint
45
- * @type {Mitt}
46
- */
47
- events: any;
48
- /**
49
- * DOMElements for this TeraFy instance
50
- *
51
- * @type {Object}
52
- * @property {DOMElement} el The main tera-fy div wrapper
53
- * @property {DOMElement} iframe The internal iFrame element (if `settings.mode == 'child'`)
54
- * @property {Window} popup The popup window context (if `settings.mode == 'popup'`)
55
- * @property {DOMElement} stylesheet The corresponding stylesheet
56
- */
57
- dom: {
58
- el: HTMLDivElement | null;
59
- iframe: HTMLIFrameElement | null;
60
- popup: Window | null;
61
- stylesheet: HTMLStyleElement | null;
62
- };
63
- /**
64
- * List of function stubs mapped from the server to here
65
- * This array is forms the reference of `TeraFy.METHOD()` objects to provide locally which will be mapped via `TeraFy.rpc(METHOD, ...args)`
66
- *
67
- * @type {Array<String>}
68
- */
69
- methods: readonly ["handshake", "setServerVerbosity", "getUser", "requireUser", "getCredentials", "getKindeToken", "bindProject", "getProject", "getProjects", "setActiveProject", "requireProject", "selectProject", "getNamespace", "setNamespace", "listNamespaces", "getProjectState", "setProjectState", "setProjectStateDefaults", "setProjectStateRefresh", "getProjectFileContents", "deleteProjectFile", "setProjectFileContents", "createProjectFolder", "deleteProjectFolder", "selectProjectLibrary", "getProjectLibrary", "setProjectLibrary", "projectLog", "setPage", "uiAlert", "uiConfirm", "uiJson", "uiPanic", "uiProgress", "uiPrompt", "uiThrow", "uiSplat", "uiWindow"];
70
- /**
71
- * Loaded plugins via Use()
72
- * @type {Array<TeraFyPlugin>}
73
- */
74
- plugins: any[];
75
- /**
76
- * Active namespaces we are subscribed to
77
- * Each key is the namespace name with the value as the local reactive \ observer \ object equivalent
78
- * The key string is always of the form `${ENTITY}::${ID}` e.g. `projects:1234`
79
- *
80
- * @type {Object<Object>}
81
- */
82
- namespaces: {
83
- [key: string]: any;
84
- };
85
- /**
86
- * Send a message + wait for a response object
87
- *
88
- * @param {Object} message Message object to send
89
- * @returns {Promise<*>} A promise which resolves when the operation has completed with the remote reply
90
- */
91
- send(message: any): any;
92
- /**
93
- * Send raw message content to the server
94
- * This function does not return or wait for a reply - use `send()` for that
95
- *
96
- * @param {Object} message Message object to send
97
- */
98
- sendRaw(message: any): void;
99
- /**
100
- * Call an RPC function in the server instance
101
- *
102
- * @param {String} method The method name to call
103
- * @param {...*} [args] Optional arguments to pass to the function
104
- *
105
- * @returns {Promise<*>} The resolved output of the server function
106
- */
107
- rpc(method: any, ...args: any[]): any;
108
- /**
109
- * Accept an incoming message
110
- *
111
- * @param {MessageEvent} rawMessage Raw message event to process
112
- *
113
- * @returns {Promise} A promise which will resolve when the message has been processed
114
- */
115
- acceptMessage(rawMessage: any): Promise<any>;
116
- /**
117
- * Listening postboxes, these correspond to outgoing message IDs that expect a response
118
- */
119
- acceptPostboxes: {
120
- [key: string]: any;
121
- };
122
- /**
123
- * Make a namespace available locally
124
- * This generally creates whatever framework flavoured reactive/observer/object is supported locally - generally with writes automatically synced with the master state
125
- *
126
- * @function mountNamespace
127
- * @param {String} name The alias of the namespace, this should be alphanumeric + hyphens + underscores
128
- *
129
- * @returns {Promise<Reactive>} A promise which resolves to the reactive object
130
- */
131
- mountNamespace(name: any): Promise<any>;
132
- /**
133
- * @interface
134
- * Actual namespace mounting function designed to be overridden by plugins
135
- *
136
- * @param {String} name The alias of the namespace, this should be alphanumeric + hyphens + underscores
137
- *
138
- * @returns {Promise} A promise which resolves when the mount operation has completed
139
- */
140
- _mountNamespace(name: any): void;
141
- /**
142
- * Release a locally mounted namespace
143
- * This function will remove the namespace from `namespaces`, cleaning up any memory / subscription hooks
144
- *
145
- * @function unmountNamespace
146
- *
147
- * @param {String} name The name of the namespace to unmount
148
- *
149
- * @returns {Promise} A promise which resolves when the operation has completed
150
- */
151
- unmountNamespace(name: any): void | Promise<void>;
152
- /**
153
- * @interface
154
- * Actual namespace unmounting function designed to be overridden by plugins
155
- *
156
- * @param {String} name The name of the namespace to unmount
157
- *
158
- * @returns {Promise} A promise which resolves when the operation has completed
159
- */
160
- _unmountNamespace(name: any): void;
161
- /**
162
- * Setup the TERA-fy client singleton
163
- *
164
- * @param {Object} [options] Additional options to merge into `settings` via `set`
165
- */
166
- constructor(options?: any);
167
- private initPromise;
168
- /**
169
- * Initialize the TERA client singleton
170
- * This function can only be called once and will return the existing init() worker Promise if its called against
171
- *
172
- * @param {Object} [options] Additional options to merge into `settings` via `set`
173
- * @returns {Promise<TeraFy>} An eventual promise which will resolve with this terafy instance
174
- */
175
- init(options?: any): Promise<TeraFy>;
176
- /**
177
- * Populate `settings.mode`
178
- * Try to communicate with a parent frame, if none assume we need to fallback to child mode
179
- *
180
- * @returns {Promise<String>} A promise which will resolve with the detected mode to use
181
- */
182
- detectMode(): Promise<'parent' | 'child' | 'popup'>;
183
- /**
184
- * Find an existing active TERA server OR initialize one
185
- *
186
- * @returns {Promise} A promise which will resolve when the loading has completed and we have found a parent TERA instance or initialized a child
187
- */
188
- injectComms(): Promise<void>;
189
- /**
190
- * Keep trying to handshake until the target responds
191
- *
192
- * @param {Object} [options] Additional options to mutate behaviour
193
- * @property {Number} [handshakeInterval] Interval in milliseconds when scanning for a handshake, defaults to global setting
194
- * @property {Number} [handshakeTimeout] Interval in milliseconds for when to give up trying to handshake, defaults to global setting
195
- *
196
- * @returns {Promise} A promise which will either resolve when the handshake is successful OR fail with 'TIMEOUT'
197
- */
198
- handshakeLoop(options?: any): Promise<void>;
199
- /**
200
- * Inject a local stylesheet to handle TERA server functionality
201
- *
202
- * @returns {Promise} A promise which will resolve when the loading has completed and we have found a parent TERA instance or initialized a child
203
- */
204
- injectStylesheet(): Promise<void>;
205
- /**
206
- * Inject all server methods defined in `methods` as local functions wrapped in the `rpc` function
207
- *
208
- * @returns {Promise} A promise which resolves when the operation has completed
209
- */
210
- injectMethods(): Promise<void>;
211
- /**
212
- * Debugging output function
213
- * This function will only act if `settings.devMode` is truthy
214
- *
215
- * @param {'INFO'|'LOG'|'WARN'|'ERROR'} [method='LOG'] Logging method to use
216
- * @param {Number} [verboseLevel=1] The verbosity level to trigger at. If `settings.verbosity` is lower than this, the message is ignored
217
- * @param {...*} [msg] Output to show
218
- */
219
- debug(...msg: any[]): void;
220
- /**
221
- * Set or merge settings
222
- * This function also routes 'special' keys like `devMode` to their internal handlers
223
- *
224
- * @param {String|Object} key Either a single setting key to set or an object to merge
225
- * @param {*} value The value to set if `key` is a string
226
- *
227
- * @param {Object} [options] Additional options to mutate behaviour
228
- * @param {Boolean} [options.ignoreNullish=true] If falsy, this forces the setting of undefined or null values rather than ignoring them when specifying values by string
229
- *
230
- * @returns {TeraFy} This chainable terafy instance
231
- */
232
- set(key: string | object, value?: any, options?: {
233
- ignoreNullish?: boolean;
234
- }): this;
235
- /**
236
- * Set or merge settings - but only in dev mode and only if the value is not undefined
237
- *
238
- * @see set()
239
- * @param {String|Object} key Either a single setting key to set or an object to merge
240
- * @param {*} value The value to set if `key` is a string
241
- * @param {Object} [options] Additional options to mutate behaviour
242
- *
243
- * @returns {TeraFy} This chainable terafy instance
244
- */
245
- setIfDev(key: any, value: any, options?: any): this;
246
- /**
247
- * Include a TeraFy client plugin
248
- *
249
- * @param {Function|Object|String} source Either the JS module class, singleton object or URL to fetch it from. Eventually constructed as invoked as `(teraClient:TeraFy, options:Object)`
250
- * @param {Object} [options] Additional options to mutate behaviour during construction (pass options to init() to initialize later options)
251
- *
252
- * @returns {TeraFy} This chainable terafy instance
253
- */
254
- use(source: any, options?: any): this;
255
- /**
256
- * Internal function used by use() to merge an external declared singleton against this object
257
- *
258
- * @param {Object} target Installed class instance to extend
259
- * @param {Object} source Initialized source object to extend from
260
- */
261
- mixin(target: any, source: any): void;
262
- /**
263
- * Set or toggle devMode
264
- * This function also accepts meta values:
265
- *
266
- * 'toggle' - Set dev mode to whatever the opposing value of the current mode
267
- * 'proxy' - Optimize for using a loopback proxy
268
- *
269
- * @param {'toggle'|'proxy'|Boolean} [devModeEnabled='toggle'] Optional boolean to force dev mode or specify other behaviour
270
- *
271
- * @returns {TeraFy} This chainable terafy instance
272
- */
273
- toggleDevMode(devModeEnabled?: 'toggle' | 'proxy' | boolean): this;
274
- /**
275
- * Fit the nested TERA server to a full-screen
276
- * This is usually because the server component wants to perform some user activity like calling $prompt
277
- *
278
- * @param {String|Boolean} [isFocused='toggle'] Whether to fullscreen the embedded component
279
- */
280
- toggleFocus(isFocused?: boolean | 'toggle'): void;
281
- /**
282
- * Generate random entropic character string in Base64
283
- *
284
- * @param {Number} [maxLength=32] Maximum length of the generated string
285
- * @returns {String}
286
- */
287
- getEntropicString(maxLength?: number): string;
288
- /**
289
- * Return basic server information as a form of validation
290
- *
291
- * @function handshake
292
- * @returns {Promise<Object>} Basic promise result
293
- * @property {Date} date Server date
294
- */
295
- /**
296
- * RPC callback to set the server verbosity level
297
- *
298
- * @function setServerVerbosity
299
- * @param {Number} verbosity The desired server verbosity level
300
- */
301
- /**
302
- * User / active session within TERA
303
- *
304
- * @name User
305
- * @property {String} id Unique identifier of the user
306
- * @property {String} email The email address of the current user
307
- * @property {String} name The provided full name of the user
308
- * @property {Boolean} isSubscribed Whether the active user has a TERA subscription
309
- */
310
- /**
311
- * Fetch the current session user
312
- *
313
- * @function getUser
314
- * @param {Boolean} [options.forceRetry=false] Forcibly try to refresh the user state
315
- * @param {Boolean} [options.waitPromises=true] Wait for $auth + $subscriptions to resolve before fetching the user (mainly internal use)
316
- * @returns {Promise<User>} The current logged in user or null if none
317
- */
318
- /**
319
- * Provide an object of credentials for 3rd party services like Firebase/Supabase
320
- *
321
- * @function getCredentials
322
- * @returns {Object} An object containing 3rd party service credentials
323
- */
324
- /**
325
- * Require a user login to TERA
326
- * If there is no user OR they are not logged in a prompt is shown to go and do so
327
- * This is an pre-requisite step for requireProject()
328
- *
329
- * @function requireUser
330
- *
331
- * @param {Object} [options] Additional options to mutate behaviour
332
- * @param {Boolean} [options.forceRetry=false] Forcibly try to refresh the user state
333
- *
334
- * @returns {Promise<User>} The current logged in user or null if none
335
- */
336
- /**
337
- * Require a user login to TERA
338
- * If there is no user OR they are not logged in a prompt is shown to go and do so
339
- * This is an pre-requisite step for requireProject()
340
- *
341
- * @returns {Promise} A promise which will resolve if the there is a user and they are logged in
342
- */
343
- /**
344
- * Project entry within TERA
345
- *
346
- * @name Project
347
- * @url https://tera-tools.com/help/api/schema
348
- */
349
- /**
350
- * Get the currently active project, if any
351
- *
352
- * @function getProject
353
- * @returns {Promise<Project|null>} The currently active project, if any
354
- */
355
- /**
356
- * Get a list of projects the current session user has access to
357
- *
358
- * @function getProjects
359
- * @returns {Promise<Array<Project>>} Collection of projects the user has access to
360
- */
361
- /**
362
- * Set the currently active project within TERA
363
- *
364
- * @function setActiveProject
365
- * @param {Object|String} project The project to set as active - either the full Project object or its ID
366
- */
367
- /**
368
- * Ask the user to select a project from those available - if one isn't already active
369
- * Note that this function will persist in asking the user even if they try to cancel
370
- *
371
- * @function requireProject
372
- * @param {Object} [options] Additional options to mutate behaviour
373
- * @param {Boolean} [options.autoSetActiveProject=true] After selecting a project set that project as active in TERA
374
- * @param {String} [options.title="Select a project to work with"] The title of the dialog to display
375
- * @param {String} [options.noSelectTitle='Select project'] Dialog title when warning the user they need to select something
376
- * @param {String} [options.noSelectBody='A project needs to be selected to continue'] Dialog body when warning the user they need to select something
377
- *
378
- * @returns {Promise<Project>} The active project
379
- */
380
- /**
381
- * Prompt the user to select a project from those available
382
- *
383
- * @function selectProject
384
- * @param {Object} [options] Additional options to mutate behaviour
385
- * @param {String} [options.title="Select a project to work with"] The title of the dialog to display
386
- * @param {Boolean} [options.allowCancel=true] Advertise cancelling the operation, the dialog can still be cancelled by closing it
387
- * @param {Boolean} [options.setActive=false] Also set the project as active when selected
388
- *
389
- * @returns {Promise<Project>} The active project
390
- */
391
- /**
392
- * Get a one-off snapshot of a namespace without mounting it
393
- * This can be used for simpler apps which don't have their own reactive / observer equivalent
394
- *
395
- * @function getNamespace
396
- * @param {String} name The alias of the namespace, this should be alphanumeric + hyphens + underscores
397
- *
398
- * @returns {Promise<Object>} A promise which resolves to the namespace POJO state
399
- */
400
- /**
401
- * Set (or merge by default) a one-off snapshot over an existing namespace
402
- * This can be used for simpler apps which don't have their own reactive / observer equivalent and just want to quickly set something
403
- *
404
- * @function setNamespace
405
- * @param {String} name The name of the namespace
406
- * @param {Object} state The state to merge
407
- * @param {Object} [options] Additional options to mutate behaviour
408
- * @param {'merge'|'set'} [options.method='merge'] How to handle the state. 'merge' (merge a partial state over the existing namespace state), 'set' (completely overwrite the existing namespace)
409
- *
410
- * @returns {Promise<Object>} A promise which resolves to the namespace POJO state
411
- */
412
- /**
413
- * Return a list of namespaces available to the current project
414
- *
415
- * @function listNamespaces
416
- * @returns {Promise<Array<Object>>} Collection of available namespaces for the current project
417
- * @property {String} name The name of the namespace
418
- */
419
- /**
420
- * Return the current, full snapshot state of the active project
421
- *
422
- * @function getProjectState
423
- * @param {Object} [options] Additional options to mutate behaviour
424
- * @param {Boolean} [options.autoRequire=true] Run `requireProject()` automatically before continuing
425
- * @param {Array<String>} Paths to subscribe to e.g. ['/users/'],
426
- *
427
- * @returns {Promise<Object>} The current project state snapshot
428
- */
429
- /**
430
- * Set a nested value within the project state
431
- * Paths can be any valid Lodash.set() value such as:
432
- *
433
- * - Dotted notation - e.g. `foo.bar.1.baz`
434
- * - Array path segments e.g. `['foo', 'bar', 1, 'baz']`
435
- *
436
- * @function setProjectState
437
- * @param {String|Array<String>} path The sub-path within the project state to set
438
- * @param {*} value The value to set
439
- *
440
- * @param {Object} [options] Additional options to mutate behaviour
441
- * @param {Boolean} [options.save=true] Save the changes to the server immediately, disable to queue up multiple writes
442
- *
443
- * @returns {Promise} A promise which resolves when the operation has been dispatched to the server
444
- */
445
- /**
446
- * Set a nested value within the project state - just like `setProjectState()` - but only if no value for that path exists
447
- *
448
- * @function setProjectStateDefaults
449
- * @see setProjectState()
450
- * @param {String|Array<String>} path The sub-path within the project state to set
451
- * @param {*} value The value to set
452
- * @param {Object} [options] Additional options to mutate behaviour, see setProjectState() for the full list of supported options
453
- *
454
- * @returns {Promise<Boolean>} A promise which resolves to whether any changes were made - True if defaults were applied, false otherwise
455
- */
456
- /**
457
- * Force refetching the remote project state into local
458
- * This is only ever needed when saving large quantities of data that need to be immediately available
459
- *
460
- * @function setProjectStateRefresh
461
- * @returns {Promise} A promise which resolves when the operation has completed
462
- */
463
- /**
464
- * Data structure for a file filter
465
- * @name FileFilters
466
- *
467
- * @property {Boolean} [library=false] Restrict to library files only
468
- * @property {String} [filename] CSV of @momsfriendlydevco/match expressions to filter the filename by (filenames are the basename sans extension)
469
- * @property {String} [basename] CSV of @momsfriendlydevco/match expressions to filter the basename by
470
- * @property {String} [ext] CSV of @momsfriendlydevco/match expressions to filter the file extension by
471
- */
472
- /**
473
- * Prompt the user to select a library to operate on
474
- *
475
- * @function selectProjectFile
476
- * @param {Object} [options] Additional options to mutate behaviour
477
- * @param {String} [options.title="Select a file"] The title of the dialog to display
478
- * @param {String|Array<String>} [options.hint] Hints to identify the file to select in array order of preference
479
- * @param {Boolean} [options.save=false] Set to truthy if saving a new file, UI will adjust to allowing overwrite OR new file name input
480
- * @param {String} [options.saveFilename] File name to save as, if omitted the hinting system is used otherwise 'My File.unknown' is assumed
481
- * @param {FileFilters} [options.filters] Optional file filters
482
- * @param {Boolean} [options.allowUpload=true] Allow uploading new files
483
- * @param {Boolean} [options.allowRefresh=true] Allow the user to manually refresh the file list
484
- * @param {Boolean} [options.allowDownloadZip=true] Allow the user to download a Zip of all files
485
- * @param {Boolean} [options.allowCancel=true] Allow cancelling the operation. Will throw `'CANCEL'` as the promise rejection if actioned
486
- * @param {Boolean} [options.autoRequire=true] Run `requireProject()` automatically before continuing
487
- * @param {Boolean} [options.showHiddenFiles=false] Whether hidden data.json files should be shown
488
- *
489
- * @returns {Promise<ProjectFile>} The eventually selected file, if in save mode new files are created as stubs
490
- */
491
- selectProjectFile(options?: any): any;
492
- /**
493
- * Fetch the files associated with a given project
494
- *
495
- * @function getProjectFiles
496
- * @param {Object} options Options which mutate behaviour
497
- * @param {Boolean} [options.autoRequire=true] Run `requireProject()` automatically before continuing
498
- * @param {Boolean} [options.lazy=true] If true, use the fastest method to retrieve the file list such as the cache. If false, force a refresh each time
499
- * @param {Boolean} [options.meta=true] Pull meta information for each file entity
500
- *
501
- * @returns {Promise<Array<ProjectFile>>} A collection of project files for the given project
502
- */
503
- getProjectFiles(options?: any): any;
504
- /**
505
- * Fetch the raw contents of a file by its ID
506
- *
507
- * @function getProjectFileContents
508
- * @param {String} [id] File ID to retrieve the contents of
509
- * @param {Object} [options] Additional options to mutate behaviour
510
- * @param {'blob'|'json'} [options.format='blob'] The format to retrieve the file in
511
- *
512
- * @returns {*} The file contents in the requested format
513
- */
514
- /**
515
- * Fetch a project file by its name
516
- *
517
- * @function getProjectFile
518
- * @param {String} name The file name (or path if inside a directory)
519
- *
520
- * @param {Object|String} [options] Additional options to mutate behaviour, if a string is given `options.subkey` is assumed
521
- * @param {String} [options.subkey] If specified only the extracted subkey is returned rather than the full object
522
- * @param {Boolean} [options.cache=true] Use the existing file cache if possible, set to false to force a refresh of files from the server first
523
- *
524
- * @returns {Promise<ProjectFile>} The eventual fetched ProjectFile (or requested subkey)
525
- */
526
- getProjectFile(name: string, options?: any): any;
527
- /**
528
- * Create a new file
529
- * This creates an empty file which can then be written to
530
- *
531
- * @function createProjectFile
532
- * @param {String} name The name + relative directory path component
533
- * @returns {Promise<ProjectFile>} The eventual ProjectFile created
534
- */
535
- createProjectFile(name: any): any;
536
- /**
537
- * Moves a project file to a new name/path.
538
- * The file's unique ID (UUID) remains the same, but its 'name' (relative path) and associated properties will be updated.
539
- *
540
- * @function moveProjectFile
541
- * @param {String} sourceId The unique ID (UUID) of the file to move.
542
- * @param {String} newName The new relative name for the file (e.g., "documents/report-final.pdf" or "image.png").
543
- * This path is relative to the project's root file directory.
544
- *
545
- * @param {Object} [options] Additional options to mutate behaviour.
546
- * @param {Boolean} [options.autoRequire=true] Run `requireProject()` automatically before continuing.
547
- * @param {Boolean} [options.overwrite=true] If true (default), moving a file to a `newName` that already exists will overwrite the existing file.
548
- * This aligns with the default behavior of the underlying Supabase storage `move` operation.
549
- * If set to false, the function would ideally check and prevent overwrite, but current implementation relies on underlying storage behavior.
550
- *
551
- * @returns {Promise<ProjectFile | null>} A promise which resolves to the updated ProjectFile object for the moved file if found after the operation,
552
- * or null if the file could not be located post-move (e.g., if its ID changed unexpectedly or it was deleted).
553
- */
554
- moveProjectFile(sourceId: string, newName: string, options?: any): Promise<ProjectFile | null>;
555
- }