@fluxscape/react-runtime 1.0.8 → 1.0.9
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/build/preview/build/fluxscape.index.preview.js +1 -1
- package/build/preview/build/fluxscape.index.preview.js.map +1 -1
- package/build/preview/build/index.html +15 -6
- package/build/production/build/fluxscape.index.production.js +1 -1
- package/build/production/build/fluxscape.index.production.js.map +1 -1
- package/dist/index.es.js +1 -1
- package/dist/index.es.js.map +1 -1
- package/dist/index.iife.js +1 -1
- package/dist/index.iife.js.map +1 -1
- package/fluxscape.json +1 -2
- package/package.json +1 -1
- package/build/preview/build/index.js.liquid +0 -1
- package/build/preview/public/global.d.ts.keep +0 -721
|
@@ -1,721 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Noodl Frontend API
|
|
5
|
-
*/
|
|
6
|
-
declare namespace Noodl {
|
|
7
|
-
function getProjectSettings(): any;
|
|
8
|
-
function getMetaData(): any;
|
|
9
|
-
|
|
10
|
-
interface VariablesApi {
|
|
11
|
-
[K in VariableNames]: any
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* You can access all variables in your application trough the Noodl.Variables object.
|
|
16
|
-
* Changing a variable will trigger all connections to be updated for all Variable nodes
|
|
17
|
-
* in your project with the corresponding variable name.
|
|
18
|
-
*
|
|
19
|
-
* Example:
|
|
20
|
-
* ```ts
|
|
21
|
-
* // This will change the variable named MyVariable
|
|
22
|
-
* // and trigger all variable nodes in your project
|
|
23
|
-
* Noodl.Variables.MyVariable = "Hello";
|
|
24
|
-
*
|
|
25
|
-
* // Use this if you have spaces in your variable name
|
|
26
|
-
* Noodl.Variables["My Variable"] = 10;
|
|
27
|
-
*
|
|
28
|
-
* Noodl.Variables.userName = "Mickeeeey";
|
|
29
|
-
*
|
|
30
|
-
* // Reading variables
|
|
31
|
-
* console.log(Noodl.Variables.userName);
|
|
32
|
-
* ```
|
|
33
|
-
*
|
|
34
|
-
* {@link https://docs.noodl.net/#/javascript/reference/variables}
|
|
35
|
-
*/
|
|
36
|
-
const Variables: VariablesApi;
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* One step above Variables are Objects, this is a global data model of Noodl objects.
|
|
40
|
-
* Each object is referenced with an Id and can contain a set of properties.
|
|
41
|
-
* You can access all objects in your workspace through their Id and the Noodl.Objects prefix.
|
|
42
|
-
* Change a property of an object will trigger all connections
|
|
43
|
-
* from object nodes with the corresponding Id and property.
|
|
44
|
-
*
|
|
45
|
-
* Example:
|
|
46
|
-
* ```ts
|
|
47
|
-
* // This will change the property MyProperty
|
|
48
|
-
* // of object with id MyObjectId and trigger
|
|
49
|
-
* // all object nodes (with that id) in your project
|
|
50
|
-
* Noodl.Objects.MyObjectId.MyProperty = "Hello";
|
|
51
|
-
*
|
|
52
|
-
* // Use this notation of that object id contains spaces
|
|
53
|
-
* Noodl.Objects["Form Values"].input_text = "Whoops";
|
|
54
|
-
*
|
|
55
|
-
* Noodl.Objects["Form Values"]["A property with spaces"] = 20;
|
|
56
|
-
*
|
|
57
|
-
* // Reading an object property
|
|
58
|
-
* console.log(Noodl.Objects.CurrentUser.Name);
|
|
59
|
-
*
|
|
60
|
-
* // This will set all properties of the object you assign with
|
|
61
|
-
* // to the object with id "SomeId"
|
|
62
|
-
* // You cannot set the id property this way,
|
|
63
|
-
* // that property will be ignored if part of the object you assign
|
|
64
|
-
* Noodl.Objects.SomeId = {
|
|
65
|
-
* // ...
|
|
66
|
-
* }
|
|
67
|
-
* ```
|
|
68
|
-
*
|
|
69
|
-
* {@link https://docs.noodl.net/#/javascript/reference/objects}
|
|
70
|
-
*/
|
|
71
|
-
const Objects: any;
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Allows access to Object from Javascript.
|
|
75
|
-
*
|
|
76
|
-
* {@link https://docs.noodl.net/#/javascript/reference/object}
|
|
77
|
-
*/
|
|
78
|
-
const Object: any;
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Each array is reference by its Id using the Noodl.Arraysprefix,
|
|
82
|
-
* similar to objects and variables.
|
|
83
|
-
* Changing an array will trigger an update of all Array node with the corresponding Id.
|
|
84
|
-
*
|
|
85
|
-
* Example:
|
|
86
|
-
* ```ts
|
|
87
|
-
* // This will change the array with id MyArray and update all Arrays nodes
|
|
88
|
-
* // with that id.
|
|
89
|
-
* Noodl.Arrays.MyArray = [{ Hello: "There" }];
|
|
90
|
-
*
|
|
91
|
-
* // Use this if you have spaces in your array id
|
|
92
|
-
* Noodl.Arrays["Recepie List"] = [{ Name: "Fancy Burger" }];
|
|
93
|
-
*
|
|
94
|
-
* // Reading arrays
|
|
95
|
-
* console.log(Noodl.Arrays.MyArray);
|
|
96
|
-
*
|
|
97
|
-
* // WARNING, you can access arrays like this but this will not trigger an update
|
|
98
|
-
* // in Noodl. You should avoid modifying arrays like this.
|
|
99
|
-
* Noodl.Arrays.MyArray.push({ Hello: "Again" });
|
|
100
|
-
*
|
|
101
|
-
* // Instead, create a new array. This will trigger an update
|
|
102
|
-
* // on all Array nodes with id MyArray
|
|
103
|
-
* Noodl.Arrays.MyArray = Noodl.Arrays.MyArray.concat([{ Hello: "Again" }]);
|
|
104
|
-
* ```
|
|
105
|
-
*
|
|
106
|
-
* {@link https://docs.noodl.net/#/javascript/reference/arrays}
|
|
107
|
-
*/
|
|
108
|
-
const Arrays: any;
|
|
109
|
-
|
|
110
|
-
interface EventsApi {
|
|
111
|
-
/**
|
|
112
|
-
* Send an event. Works well together with Event Receivers.
|
|
113
|
-
*/
|
|
114
|
-
emit(eventName: string, data: any): void;
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Receive an event. Works together with Event Senders
|
|
118
|
-
*/
|
|
119
|
-
on(eventName: string, callback: (data: any) => void): void;
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Receive an event. Works together with Event Senders
|
|
123
|
-
*/
|
|
124
|
-
once(eventName: string, callback: (data: any) => void): void;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* This is the Noodl event emitter, you can use it to receive and send events from your scripts.
|
|
129
|
-
*
|
|
130
|
-
* {@link https://docs.noodl.net/#/javascript/reference/events}
|
|
131
|
-
*/
|
|
132
|
-
const Events: EventsApi;
|
|
133
|
-
|
|
134
|
-
type RecordQuery<T> =
|
|
135
|
-
{
|
|
136
|
-
lessThan: T
|
|
137
|
-
} |
|
|
138
|
-
{
|
|
139
|
-
lessThanOrEqualTo: T
|
|
140
|
-
} |
|
|
141
|
-
{
|
|
142
|
-
greaterThan: T
|
|
143
|
-
} |
|
|
144
|
-
{
|
|
145
|
-
greaterThanOrEqualTo: T
|
|
146
|
-
} |
|
|
147
|
-
{
|
|
148
|
-
equalTo: T
|
|
149
|
-
} |
|
|
150
|
-
{
|
|
151
|
-
notEqualTo: T
|
|
152
|
-
} |
|
|
153
|
-
{
|
|
154
|
-
containedIn: T
|
|
155
|
-
} |
|
|
156
|
-
{
|
|
157
|
-
notContainedIn : T
|
|
158
|
-
} |
|
|
159
|
-
{
|
|
160
|
-
exists: T
|
|
161
|
-
} |
|
|
162
|
-
{
|
|
163
|
-
matchesRegex: T
|
|
164
|
-
} |
|
|
165
|
-
{
|
|
166
|
-
text: T
|
|
167
|
-
} |
|
|
168
|
-
{
|
|
169
|
-
idEqualTo: T
|
|
170
|
-
} |
|
|
171
|
-
{
|
|
172
|
-
idContainedIn: T
|
|
173
|
-
} |
|
|
174
|
-
{
|
|
175
|
-
pointsTo: T
|
|
176
|
-
} |
|
|
177
|
-
{
|
|
178
|
-
relatedTo: T
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
type RecordQueryField<T> = T extends RecordQuery<any> ?
|
|
182
|
-
{ [K in keyof T]: { [P in K]: T[P] } & Partial<Record<Exclude<keyof T, K>, never>> }[keyof T]
|
|
183
|
-
: never;
|
|
184
|
-
|
|
185
|
-
type RecordSortKey<T extends string> = (`${T}` | `-${T}`)[];
|
|
186
|
-
|
|
187
|
-
interface RecordsApi {
|
|
188
|
-
/**
|
|
189
|
-
* This is an async function that will query the database using the query
|
|
190
|
-
* that you provide and return the result or throw an exception if failed.
|
|
191
|
-
*
|
|
192
|
-
* The query parameter has the same format as the advanced query of the Query Records node.
|
|
193
|
-
* {@link https://docs.noodl.net/#/nodes/data/cloud-data/query-records/#advanced-filters}
|
|
194
|
-
*
|
|
195
|
-
* Example:
|
|
196
|
-
* ```ts
|
|
197
|
-
* const results = await Noodl.Records.query("myClass", {
|
|
198
|
-
* Completed: { equalTo: true },
|
|
199
|
-
* })
|
|
200
|
-
* ```
|
|
201
|
-
*
|
|
202
|
-
* The result is an array of Noodl.Object. The options can be used to specify sorting,
|
|
203
|
-
* it also follows the same pattern as the advanced filters of the Query Records node.
|
|
204
|
-
*
|
|
205
|
-
* Example:
|
|
206
|
-
* ```ts
|
|
207
|
-
* const results = await Noodl.Records.query("myClass", {
|
|
208
|
-
* Completed: { equalTo: true },
|
|
209
|
-
* }, {
|
|
210
|
-
* sort:['createdAt']
|
|
211
|
-
* })
|
|
212
|
-
* ```
|
|
213
|
-
*
|
|
214
|
-
* You can also specify the limit for how many records to return as a maximum (defaults to 100)
|
|
215
|
-
* with the limit option, and if you want the returned records to start from a given
|
|
216
|
-
* index specify the skip option.
|
|
217
|
-
*
|
|
218
|
-
* ```ts
|
|
219
|
-
* const results = await Noodl.Records.query("myClass", {
|
|
220
|
-
* Completed: { equalTo: true },
|
|
221
|
-
* }, {
|
|
222
|
-
* sort: ['-createdAt'], // use - to sort descending
|
|
223
|
-
* skip: 50,
|
|
224
|
-
* limit: 200
|
|
225
|
-
* })
|
|
226
|
-
* ```
|
|
227
|
-
*/
|
|
228
|
-
query<TClassName extends RecordClassName>(
|
|
229
|
-
className: TClassName,
|
|
230
|
-
query?:
|
|
231
|
-
RecordQueryField<{ [K in keyof DatabaseSchema[TClassName]]: RecordQuery<any> }> |
|
|
232
|
-
{ and: RecordQueryField<{ [K in keyof DatabaseSchema[TClassName]]: RecordQuery<any> }>[] },
|
|
233
|
-
options?: {
|
|
234
|
-
limit?: number;
|
|
235
|
-
skip?: number;
|
|
236
|
-
sort?: string | RecordSortKey<keyof DatabaseSchema[TClassName]>;
|
|
237
|
-
include?: string | (keyof DatabaseSchema[TClassName])[];
|
|
238
|
-
select?: string | (keyof DatabaseSchema[TClassName])[];
|
|
239
|
-
}
|
|
240
|
-
): Promise<any>;
|
|
241
|
-
|
|
242
|
-
/**
|
|
243
|
-
* This function returns the count of the number of records of a given class,
|
|
244
|
-
* optionally matching a query filter.
|
|
245
|
-
*
|
|
246
|
-
* Example:
|
|
247
|
-
* ```ts
|
|
248
|
-
* // The number of records of myClass in the database
|
|
249
|
-
* const count = await Noodl.Records.count("myClass")
|
|
250
|
-
*
|
|
251
|
-
* // The number of myClass records in the database that match a query
|
|
252
|
-
* const completedCount = await Noodl.Records.count("myClass", {
|
|
253
|
-
* Completed: { equalTo: true },
|
|
254
|
-
* })
|
|
255
|
-
* ```
|
|
256
|
-
*/
|
|
257
|
-
count(className: RecordClassName, query?: any): Promise<number>;
|
|
258
|
-
|
|
259
|
-
/**
|
|
260
|
-
* Use this function to fetch the latest properties of a specific record
|
|
261
|
-
* from the cloud database. It will return the object / record.
|
|
262
|
-
*
|
|
263
|
-
* Example:
|
|
264
|
-
* ```ts
|
|
265
|
-
* // If you use the a record ID you must also specify the class
|
|
266
|
-
* const myRecord = await Noodl.Records.fetch(myRecordId, { className: "myClass" })
|
|
267
|
-
*
|
|
268
|
-
* // You can also fetch a record you have previously fetched or received from a
|
|
269
|
-
* // query, to get the latest properties from the backend
|
|
270
|
-
* await Noodl.Records.fetch(myRecord)
|
|
271
|
-
* ```
|
|
272
|
-
*/
|
|
273
|
-
fetch(
|
|
274
|
-
objectOrId: string | { getId(): string; },
|
|
275
|
-
options?: {
|
|
276
|
-
className?: RecordClassName;
|
|
277
|
-
keys?: string[] | string;
|
|
278
|
-
include?: string[] | string;
|
|
279
|
-
excludeKeys?: string[] | string;
|
|
280
|
-
}
|
|
281
|
-
): Promise<any>;
|
|
282
|
-
|
|
283
|
-
/**
|
|
284
|
-
* Use this function to write an existing record to the cloud database.
|
|
285
|
-
* It will attempt to save all properties of the record / object
|
|
286
|
-
* if you don't specify the optional properties argument,
|
|
287
|
-
* if so it will set and save those properties.
|
|
288
|
-
*
|
|
289
|
-
* Example:
|
|
290
|
-
* ```ts
|
|
291
|
-
* Noodl.Objects[myRecordId].SomeProperty = "hello"
|
|
292
|
-
*
|
|
293
|
-
* // If you use the record id to save, you need to specify the classname explicitly
|
|
294
|
-
* // by specfiying null or undefinded for properties it will save all proporties in
|
|
295
|
-
* // the record
|
|
296
|
-
* await Noodl.Records.save(myRecordId, null, { className: "myClass" })
|
|
297
|
-
*
|
|
298
|
-
* // Or use the object directly
|
|
299
|
-
* await Noodl.Records.save(Noodl.Objects[myRecordId])
|
|
300
|
-
*
|
|
301
|
-
* // Set specified properties and save only those to the backned
|
|
302
|
-
* await Noodl.Records.save(myRecord, {
|
|
303
|
-
* SomeProperty:'hello'
|
|
304
|
-
* })
|
|
305
|
-
* ```
|
|
306
|
-
*/
|
|
307
|
-
save(
|
|
308
|
-
objectOrId: string | { getId(): string; },
|
|
309
|
-
properties: any,
|
|
310
|
-
options?: {
|
|
311
|
-
className?: RecordClassName;
|
|
312
|
-
acl?: any;
|
|
313
|
-
}
|
|
314
|
-
): Promise<void>;
|
|
315
|
-
|
|
316
|
-
/**
|
|
317
|
-
* This function will increment (or decrease) propertis of a certain record
|
|
318
|
-
* saving it to the cloud database in a race condition safe way.
|
|
319
|
-
* That is, normally you would have to first read the current value,
|
|
320
|
-
* modify it and save it to the database. Here you can do it with one operation.
|
|
321
|
-
*
|
|
322
|
-
* Example:
|
|
323
|
-
* ```ts
|
|
324
|
-
* // Modify the specified numbers in the cloud
|
|
325
|
-
* await Noodl.Records.increment(myRecord, {
|
|
326
|
-
* Score: 10,
|
|
327
|
-
* Life: -1
|
|
328
|
-
* })
|
|
329
|
-
*
|
|
330
|
-
* // Like save, you can use a record Id and class
|
|
331
|
-
* await Noodl.Records.save(myRecordId, { Likes: 1 }, { className: "myClass" })
|
|
332
|
-
* ```
|
|
333
|
-
*
|
|
334
|
-
* Using the options you can also specify access control as described in this guide,
|
|
335
|
-
* this let's you control which users can access a specific record.
|
|
336
|
-
* The access control is specified as below:
|
|
337
|
-
* ```ts
|
|
338
|
-
* await Noodl.Records.save(myRecord, null, {
|
|
339
|
-
* acl: {
|
|
340
|
-
* // "*" means everyone, this rules gives everyone read access but not write
|
|
341
|
-
* "*": { read: true, write: false },
|
|
342
|
-
* // give a specific user write access
|
|
343
|
-
* "a-user-id": { read: true, write: true },
|
|
344
|
-
* // give a specific role write access
|
|
345
|
-
* "role:a-role-name": { read: true, write: true },
|
|
346
|
-
* }
|
|
347
|
-
* })
|
|
348
|
-
* ```
|
|
349
|
-
*/
|
|
350
|
-
increment(
|
|
351
|
-
objectOrId: string | { getId(): string; },
|
|
352
|
-
properties: any,
|
|
353
|
-
options?: {
|
|
354
|
-
className?: RecordClassName;
|
|
355
|
-
}
|
|
356
|
-
): Promise<void>;
|
|
357
|
-
|
|
358
|
-
/**
|
|
359
|
-
* This function will create a new record in the cloud database and return
|
|
360
|
-
* the Noodl.Object of the newly created record.
|
|
361
|
-
* If it's unsuccessful it will throw an exception.
|
|
362
|
-
*
|
|
363
|
-
* Example:
|
|
364
|
-
* ```ts
|
|
365
|
-
* const myNewRecord = await Noodl.Records.create("myClass",{
|
|
366
|
-
* SomeProperty:"Hello"
|
|
367
|
-
* })
|
|
368
|
-
*
|
|
369
|
-
* console.log(myNewRecord.SomeProperty)
|
|
370
|
-
* ```
|
|
371
|
-
*
|
|
372
|
-
* You can use the options agrument to specify access control rules
|
|
373
|
-
* as detailed under Noodl.Records.save above.
|
|
374
|
-
*/
|
|
375
|
-
create(
|
|
376
|
-
className: RecordClassName,
|
|
377
|
-
properties: any,
|
|
378
|
-
options?: {
|
|
379
|
-
acl?: any
|
|
380
|
-
}
|
|
381
|
-
): Promise<any>;
|
|
382
|
-
|
|
383
|
-
/**
|
|
384
|
-
* Use this function to delete an existing record from the cloud database.
|
|
385
|
-
*
|
|
386
|
-
* Example:
|
|
387
|
-
* ```ts
|
|
388
|
-
* // If you specify the id of a record to be deleted, you must also provide the
|
|
389
|
-
* // class name in the options
|
|
390
|
-
* await Noodl.Records.delete(myRecordId,{className:"myClass"})
|
|
391
|
-
*
|
|
392
|
-
* // Or use the object directly (provided it was previously fetched or received via a query)
|
|
393
|
-
* await Noodl.Records.delete(Noodl.Objects[myRecordId])
|
|
394
|
-
* ```
|
|
395
|
-
*/
|
|
396
|
-
delete(
|
|
397
|
-
objectOrId: string | { getId(): string; },
|
|
398
|
-
options?: {
|
|
399
|
-
className?: RecordClassName;
|
|
400
|
-
}
|
|
401
|
-
): Promise<void>;
|
|
402
|
-
|
|
403
|
-
/**
|
|
404
|
-
* Use this function to add a relation between two records.
|
|
405
|
-
*
|
|
406
|
-
* Example:
|
|
407
|
-
* ```ts
|
|
408
|
-
* // You can either specify the Ids and classes directly
|
|
409
|
-
* await Noodl.Records.addRelation({
|
|
410
|
-
* className: "myClass",
|
|
411
|
-
* recordId: "owning-record-id",
|
|
412
|
-
* key: "the-relation-key-on-the-owning-record",
|
|
413
|
-
* targetRecordId: "the-id-of-the-record-to-add-a-relation-to",
|
|
414
|
-
* targetClassName: "the-class-of-the-target-record"
|
|
415
|
-
* })
|
|
416
|
-
*
|
|
417
|
-
* // Or if you already have two records that have been previously fetched or returned from a
|
|
418
|
-
* // query
|
|
419
|
-
* await Noodl.Records.addRelation({
|
|
420
|
-
* record: myRecord,
|
|
421
|
-
* key: 'relation-key',
|
|
422
|
-
* targetRecord: theTargetRecord
|
|
423
|
-
* })
|
|
424
|
-
* ```
|
|
425
|
-
*/
|
|
426
|
-
addRelation(
|
|
427
|
-
options: {
|
|
428
|
-
recordId: string | { getId(): string; },
|
|
429
|
-
className?: RecordClassName,
|
|
430
|
-
key: string,
|
|
431
|
-
targetRecordId: string | { getId(): string; },
|
|
432
|
-
targetClassName?: RecordClassName
|
|
433
|
-
}
|
|
434
|
-
): Promise<void>;
|
|
435
|
-
|
|
436
|
-
/**
|
|
437
|
-
* Use this function to remove a relation between two records.
|
|
438
|
-
*
|
|
439
|
-
* ```ts
|
|
440
|
-
* // You can either specify the Ids and classes directly
|
|
441
|
-
* await Noodl.Records.removeRelation({
|
|
442
|
-
* className: "myClass",
|
|
443
|
-
* recordId: "owning-record-id",
|
|
444
|
-
* key: "the-relation-key-on-the-owning-record",
|
|
445
|
-
* targetRecordId: "the-id-of-the-record-to-remove-a-relation-to",
|
|
446
|
-
* targetClassName: "the-class-of-the-target-record"
|
|
447
|
-
* })
|
|
448
|
-
*
|
|
449
|
-
* // Or if you already have two records that have been previously fetched or returned from a
|
|
450
|
-
* // query
|
|
451
|
-
* await Noodl.Records.removeRelation({
|
|
452
|
-
* record: myRecord,
|
|
453
|
-
* key: 'relation-key',
|
|
454
|
-
* targetRecord: theTargetRecord
|
|
455
|
-
* })
|
|
456
|
-
* ```
|
|
457
|
-
*/
|
|
458
|
-
removeRelation(
|
|
459
|
-
options: {
|
|
460
|
-
recordId: string | { getId(): string; },
|
|
461
|
-
className?: RecordClassName,
|
|
462
|
-
key: string,
|
|
463
|
-
targetRecordId: string | { getId(): string; },
|
|
464
|
-
targetClassName?: RecordClassName
|
|
465
|
-
}
|
|
466
|
-
): Promise<void>;
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
/**
|
|
470
|
-
* With Records you can query, read and write records to the cloud database.
|
|
471
|
-
* All functions are async and will throw an exception if they fail.
|
|
472
|
-
*
|
|
473
|
-
* Example:
|
|
474
|
-
* ```ts
|
|
475
|
-
* try {
|
|
476
|
-
* await Noodl.Records.delete(myRecord)
|
|
477
|
-
* }
|
|
478
|
-
* catch(e) {
|
|
479
|
-
* console.log(e)
|
|
480
|
-
* }
|
|
481
|
-
* ```
|
|
482
|
-
*
|
|
483
|
-
* {@link https://docs.noodl.net/#/javascript/reference/records}
|
|
484
|
-
*/
|
|
485
|
-
const Records: RecordsApi;
|
|
486
|
-
|
|
487
|
-
interface CurrentUserObject {
|
|
488
|
-
id: string;
|
|
489
|
-
email: string;
|
|
490
|
-
emailVerified: boolean;
|
|
491
|
-
username: string;
|
|
492
|
-
|
|
493
|
-
Properties: unknown;
|
|
494
|
-
|
|
495
|
-
/**
|
|
496
|
-
* Log out the current user and terminate the session.
|
|
497
|
-
*/
|
|
498
|
-
logOut(): Promise<void>;
|
|
499
|
-
|
|
500
|
-
/**
|
|
501
|
-
* Attempt to save the properties of the current user.
|
|
502
|
-
*
|
|
503
|
-
* If you have made changes to the current() user object you will need
|
|
504
|
-
* to call this function to write the changes to the backend.
|
|
505
|
-
*/
|
|
506
|
-
save(): Promise<void>;
|
|
507
|
-
|
|
508
|
-
/**
|
|
509
|
-
* Fetch that laters properties of the user object from the cloud database.
|
|
510
|
-
* It will throw an exception if the user session has expired.
|
|
511
|
-
*/
|
|
512
|
-
fetch(): Promise<void>;
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
type UserApiEventNames = 'sessionLost' | 'sessionGained' | 'loggedIn' | 'loggedOut';
|
|
516
|
-
|
|
517
|
-
interface UsersApi {
|
|
518
|
-
/**
|
|
519
|
-
* Attempt to login to create a user session.
|
|
520
|
-
*
|
|
521
|
-
* After a successful login you can access the user object with `Noodl.Users.Current`.
|
|
522
|
-
*/
|
|
523
|
-
logIn(options: { username: string; password: string }): Promise<any>;
|
|
524
|
-
|
|
525
|
-
/**
|
|
526
|
-
* Attempt to sign up a new user, and if successful that user will become the current user session.
|
|
527
|
-
* Username, email and password are required options and properties is optional.
|
|
528
|
-
*/
|
|
529
|
-
signUp(options: {
|
|
530
|
-
username: string;
|
|
531
|
-
password: string;
|
|
532
|
-
email: string;
|
|
533
|
-
properties?: {
|
|
534
|
-
[key: string]: any;
|
|
535
|
-
};
|
|
536
|
-
}): Promise<any>;
|
|
537
|
-
|
|
538
|
-
/**
|
|
539
|
-
* Attempt to login a user with an existing session token.
|
|
540
|
-
* Session tokens can be created in cloud functions e.g. using the impersonate function.
|
|
541
|
-
*
|
|
542
|
-
* After a successful login you can access the user object with `Noodl.Users.Current`.
|
|
543
|
-
*/
|
|
544
|
-
become(sessionToken: string): Promise<void>;
|
|
545
|
-
|
|
546
|
-
/**
|
|
547
|
-
* Listen for events related to the user service.
|
|
548
|
-
*/
|
|
549
|
-
on(eventName: UserApiEventNames, callback: () => void): void;
|
|
550
|
-
|
|
551
|
-
/**
|
|
552
|
-
* Remove an event listener from a specific event.
|
|
553
|
-
*/
|
|
554
|
-
off(eventName: UserApiEventNames, callback: () => void): void;
|
|
555
|
-
|
|
556
|
-
/**
|
|
557
|
-
* Return the current user object and properties if one exists.
|
|
558
|
-
*/
|
|
559
|
-
get Current(): CurrentUserObject | undefined;
|
|
560
|
-
}
|
|
561
|
-
|
|
562
|
-
/**
|
|
563
|
-
* The Noodl.Users object let's you access the current session user.
|
|
564
|
-
*
|
|
565
|
-
* {@link https://docs.noodl.net/#/javascript/reference/users}
|
|
566
|
-
*/
|
|
567
|
-
const Users: UsersApi;
|
|
568
|
-
|
|
569
|
-
// TODO: This is actually a class
|
|
570
|
-
type CloudFile = {
|
|
571
|
-
name: string;
|
|
572
|
-
url: string;
|
|
573
|
-
};
|
|
574
|
-
|
|
575
|
-
interface FilesApi {
|
|
576
|
-
/**
|
|
577
|
-
* Allows uploading a file to the backend.
|
|
578
|
-
* You can specify a progress callback using the options.
|
|
579
|
-
*
|
|
580
|
-
* Example:
|
|
581
|
-
* ```ts
|
|
582
|
-
* const cloudFile = await Noodl.Files.upload(Inputs.File, {
|
|
583
|
-
* onProgress: (p) => {
|
|
584
|
-
* console.log(p.total, p.loaded)
|
|
585
|
-
* }
|
|
586
|
-
* })
|
|
587
|
-
*
|
|
588
|
-
* console.log(cloudFile.name)
|
|
589
|
-
* console.log(cloudFile.url)
|
|
590
|
-
* ```
|
|
591
|
-
*/
|
|
592
|
-
upload(
|
|
593
|
-
filename: string,
|
|
594
|
-
options?: {
|
|
595
|
-
onProgress?: (progress: number) => void;
|
|
596
|
-
}
|
|
597
|
-
): Promise<CloudFile>;
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
/**
|
|
601
|
-
* The Noodl.Files service lets you access the cloud services files.
|
|
602
|
-
*
|
|
603
|
-
* {@link https://docs.noodl.net/#/javascript/reference/files}
|
|
604
|
-
*/
|
|
605
|
-
const Files: FilesApi;
|
|
606
|
-
|
|
607
|
-
interface NavigationApi {
|
|
608
|
-
/**
|
|
609
|
-
* Show the provided visual component as a popup.
|
|
610
|
-
*
|
|
611
|
-
* Example:
|
|
612
|
-
* ```ts
|
|
613
|
-
* const result = await Noodl.Navigation.showPopup("#mysheet/mypopupcomponent", {
|
|
614
|
-
* Message:"hello"
|
|
615
|
-
* })
|
|
616
|
-
*
|
|
617
|
-
* console.log(result.action) // The action used to close the popup
|
|
618
|
-
* console.log(result.parameters) // The close parameters
|
|
619
|
-
* ```
|
|
620
|
-
*/
|
|
621
|
-
showPopup(
|
|
622
|
-
componentPath: string,
|
|
623
|
-
params: any
|
|
624
|
-
): Promise<{
|
|
625
|
-
action: string;
|
|
626
|
-
parameters: any;
|
|
627
|
-
}>;
|
|
628
|
-
|
|
629
|
-
/**
|
|
630
|
-
* Navigate on a given page router, identified with routerName, to a provided page,
|
|
631
|
-
* identified with targetPageName (the path to the page component),
|
|
632
|
-
* and give it the parameters provided in parameters.
|
|
633
|
-
*/
|
|
634
|
-
navigate(
|
|
635
|
-
routerName: PageRouterNames & string,
|
|
636
|
-
targetPageName: keyof PagesSchema & string,
|
|
637
|
-
params: any
|
|
638
|
-
): void;
|
|
639
|
-
|
|
640
|
-
/**
|
|
641
|
-
* Navigate to a specific url path.
|
|
642
|
-
* You can provide query parameters as an object.
|
|
643
|
-
* The function will use the current path mode selected in the project, hash or path.
|
|
644
|
-
*
|
|
645
|
-
* Example:
|
|
646
|
-
* ```ts
|
|
647
|
-
* Noodl.Navigation.navigateToPath("/main/details/" + theClickedObjectId, {
|
|
648
|
-
* query: {
|
|
649
|
-
* filter:true
|
|
650
|
-
* }
|
|
651
|
-
* })
|
|
652
|
-
* ```
|
|
653
|
-
*/
|
|
654
|
-
navigateToPath(path: string, options: any): void;
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
/**
|
|
658
|
-
* The Noodl.Navigation service lets you perform navigation from functions and scripts.
|
|
659
|
-
*
|
|
660
|
-
* {@link https://docs.noodl.net/#/javascript/reference/navigation}
|
|
661
|
-
*/
|
|
662
|
-
const Navigation: NavigationApi;
|
|
663
|
-
|
|
664
|
-
interface CloudFunctionsApi {
|
|
665
|
-
/**
|
|
666
|
-
* Call a cloud function in the backend.
|
|
667
|
-
*
|
|
668
|
-
* Example:
|
|
669
|
-
* ```ts
|
|
670
|
-
* const result = await Noodl.CloudFunctions.run("myFunctionName", {
|
|
671
|
-
* SomeParamater:"yes"
|
|
672
|
-
* })
|
|
673
|
-
* ```
|
|
674
|
-
*/
|
|
675
|
-
run<T extends keyof CloudFunctionSchema & string>(
|
|
676
|
-
functionName: T,
|
|
677
|
-
params: CloudFunctionSchema[T]['inputs']
|
|
678
|
-
): Promise<CloudFunctionSchema[T]['outputs']>;
|
|
679
|
-
}
|
|
680
|
-
|
|
681
|
-
/**
|
|
682
|
-
* The Noodl.CloudFunctions service lets you call Noodl cloud functions.
|
|
683
|
-
*
|
|
684
|
-
* {@link https://docs.noodl.net/#/javascript/reference/cloudfunctions}
|
|
685
|
-
*/
|
|
686
|
-
const CloudFunctions: CloudFunctionsApi;
|
|
687
|
-
}
|
|
688
|
-
|
|
689
|
-
interface ComponentApi {
|
|
690
|
-
/**
|
|
691
|
-
* `Component.Object` is the Component Object of the current component and
|
|
692
|
-
* you can use it just like any other Noodl.Object.
|
|
693
|
-
* Most commonly this means accessing the properties of the object.
|
|
694
|
-
* When you set a property any Component Object node in this component
|
|
695
|
-
* instance will update accordingly.
|
|
696
|
-
*/
|
|
697
|
-
Object: any;
|
|
698
|
-
|
|
699
|
-
/**
|
|
700
|
-
* Object is the Parent Component Object,
|
|
701
|
-
* that is the Component Object of the parent component in the visual heirarchy.
|
|
702
|
-
* It is also used like any other Noodl.Object.
|
|
703
|
-
*/
|
|
704
|
-
ParentObject: any;
|
|
705
|
-
|
|
706
|
-
/**
|
|
707
|
-
* If this component is the template of a repeater this will contain
|
|
708
|
-
* the object of the items array corresponding to this specific component instance.
|
|
709
|
-
* That is the same object as if you set an object Id Source to From Repeater, as shown below.
|
|
710
|
-
*/
|
|
711
|
-
RepeaterObject: any;
|
|
712
|
-
}
|
|
713
|
-
|
|
714
|
-
/**
|
|
715
|
-
* The `Component` object is ony available in Function and Script nodes and
|
|
716
|
-
* it contains things related to the component scope where the
|
|
717
|
-
* Function or Script node is executing.
|
|
718
|
-
*
|
|
719
|
-
* {@link https://docs.noodl.net/#/javascript/reference/component}
|
|
720
|
-
*/
|
|
721
|
-
declare const Component: ComponentApi;
|