@live-change/db-server 0.8.15 → 0.8.17

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.
@@ -0,0 +1,1048 @@
1
+ {
2
+ "databases": {
3
+ "system": {
4
+ "tables": {
5
+ "test_tables": {
6
+ "uid": "56f6e8eb065a57e1"
7
+ },
8
+ "test_logs": {
9
+ "uid": "e9378310f11dc5fa"
10
+ },
11
+ "test_indexes": {
12
+ "uid": "d7f2de98c4ed7d75"
13
+ }
14
+ },
15
+ "indexes": {},
16
+ "logs": {}
17
+ },
18
+ "test": {
19
+ "tables": {
20
+ "services": {
21
+ "uid": "6cab0ceaf593f9a1"
22
+ },
23
+ "eventConsumers": {
24
+ "uid": "e6b87e56f2cb849b"
25
+ },
26
+ "eventReports": {
27
+ "uid": "b72bd42afe905cf7"
28
+ },
29
+ "commands": {
30
+ "uid": "8cede2fa952cc2b2"
31
+ },
32
+ "triggers": {
33
+ "uid": "6d38bb37c868a20c"
34
+ },
35
+ "session_Session": {
36
+ "uid": "3618e472055e5aca"
37
+ },
38
+ "user_User": {
39
+ "uid": "1787140cabc39d0e"
40
+ },
41
+ "user_AuthenticatedUser": {
42
+ "uid": "e901392e388f5219"
43
+ },
44
+ "email_SentEmail": {
45
+ "uid": "e6d7878b1d4d9329"
46
+ },
47
+ "email_Email": {
48
+ "uid": "a76d9d9f2b14c5c9"
49
+ },
50
+ "passwordAuthentication_PasswordAuthentication": {
51
+ "uid": "4ed8cd62802ecae3"
52
+ },
53
+ "passwordAuthentication_ResetPasswordAuthentication": {
54
+ "uid": "57879324b0f9def2"
55
+ },
56
+ "userIdentification_Identification": {
57
+ "uid": "a46cf304c8c74731"
58
+ },
59
+ "accessControl_Access": {
60
+ "uid": "f40e53f6a0535046"
61
+ },
62
+ "accessControl_PublicAccess": {
63
+ "uid": "6b0420030127529d"
64
+ },
65
+ "accessControl_AccessRequest": {
66
+ "uid": "d6476b040280cf92"
67
+ },
68
+ "accessControl_AccessInvitation": {
69
+ "uid": "bd2f8ef017b88483"
70
+ },
71
+ "security_Ban": {
72
+ "uid": "1386f7585a1fba12"
73
+ },
74
+ "security_Event": {
75
+ "uid": "cb8472713a95ae7e"
76
+ },
77
+ "notification_Notification": {
78
+ "uid": "21f9b5d3646dd47c"
79
+ },
80
+ "notification_NotificationSetting": {
81
+ "uid": "39458f0b6576c2da"
82
+ },
83
+ "upload_Upload": {
84
+ "uid": "1278b9b038aa3c53"
85
+ },
86
+ "image_Image": {
87
+ "uid": "53d405dd78d158e5"
88
+ },
89
+ "secretCode_Code": {
90
+ "uid": "d5dbaa2b6a055f0a"
91
+ },
92
+ "secretLink_Link": {
93
+ "uid": "ff48b70af65ccfec"
94
+ },
95
+ "messageAuthentication_Authentication": {
96
+ "uid": "20320b112ab6da19"
97
+ },
98
+ "url_Canonical": {
99
+ "uid": "0ff92f47744d9eae"
100
+ },
101
+ "url_Redirect": {
102
+ "uid": "b334c0ba2c33edce"
103
+ },
104
+ "prosemirror_Document": {
105
+ "uid": "0907d437b0e1907a"
106
+ },
107
+ "prosemirror_StepsBucket": {
108
+ "uid": "cc90da724aa01159"
109
+ },
110
+ "prosemirror_Snapshot": {
111
+ "uid": "b3c6b4969e72e72f"
112
+ },
113
+ "content_Content": {
114
+ "uid": "9f0defb906a3dc7c"
115
+ },
116
+ "content_AdditionalContent": {
117
+ "uid": "db1e50dd1d9b6f4f"
118
+ },
119
+ "content_Page": {
120
+ "uid": "aa1eabda331bae5e"
121
+ },
122
+ "content_Metadata": {
123
+ "uid": "dd05ff5c10f91fb3"
124
+ },
125
+ "llmTree_Message": {
126
+ "uid": "fe1cdac47417c506"
127
+ },
128
+ "llmTree_MessageFragment": {
129
+ "uid": "2105ddc42d461d0c"
130
+ },
131
+ "llmTree_Conversation": {
132
+ "uid": "4b8097fbf569815c"
133
+ },
134
+ "triggerRoutes": {
135
+ "uid": "35a0ecb879e0efea"
136
+ },
137
+ "security_relations": {
138
+ "uid": "07db6dc469b5aafa"
139
+ }
140
+ },
141
+ "indexes": {
142
+ "session_Session_byKey": {
143
+ "code": "(async function(input, output, { table, properties }) {\n const mapper = (obj) => ({\n id: properties.map(path => {\n let at = obj\n for(const p of path) at = at && at[p]\n return at === undefined ? '' : JSON.stringify(at)\n }).join(':')+'_'+obj.id,\n to: obj.id\n })\n await input.table(table).onChange((obj, oldObj) =>\n output.change(obj && mapper(obj), oldObj && mapper(oldObj)) )\n })",
144
+ "parameters": {
145
+ "properties": [
146
+ [
147
+ "key"
148
+ ]
149
+ ],
150
+ "table": "session_Session"
151
+ },
152
+ "uid": "33a16bfb19bc1541",
153
+ "sources": [
154
+ {
155
+ "type": "table",
156
+ "name": "session_Session"
157
+ }
158
+ ]
159
+ },
160
+ "user_AuthenticatedUser_byUser": {
161
+ "code": "(async function(input, output, { table, properties }) {\n const mapper = (obj) => ({\n id: properties.map(path => {\n let at = obj\n for(const p of path) at = at && at[p]\n return at === undefined ? '' : JSON.stringify(at)\n }).join(':')+'_'+obj.id,\n to: obj.id\n })\n await input.table(table).onChange((obj, oldObj) =>\n output.change(obj && mapper(obj), oldObj && mapper(oldObj)) )\n })",
162
+ "parameters": {
163
+ "properties": [
164
+ [
165
+ "user"
166
+ ]
167
+ ],
168
+ "table": "user_AuthenticatedUser"
169
+ },
170
+ "uid": "4c5d864c6aa85b82",
171
+ "sources": [
172
+ {
173
+ "type": "table",
174
+ "name": "user_AuthenticatedUser"
175
+ }
176
+ ]
177
+ },
178
+ "email_Email_byUser": {
179
+ "code": "(async function(input, output, { table, properties }) {\n const mapper = (obj) => ({\n id: properties.map(path => {\n let at = obj\n for(const p of path) at = at && at[p]\n return at === undefined ? '' : JSON.stringify(at)\n }).join(':')+'_'+obj.id,\n to: obj.id\n })\n await input.table(table).onChange((obj, oldObj) =>\n output.change(obj && mapper(obj), oldObj && mapper(oldObj)) )\n })",
180
+ "parameters": {
181
+ "properties": [
182
+ [
183
+ "user"
184
+ ]
185
+ ],
186
+ "table": "email_Email"
187
+ },
188
+ "uid": "a5f26719b2fbc7bc",
189
+ "sources": [
190
+ {
191
+ "type": "table",
192
+ "name": "email_Email"
193
+ }
194
+ ]
195
+ },
196
+ "passwordAuthentication_PasswordAuthentication_byUser": {
197
+ "code": "(async function(input, output, { table, properties }) {\n const mapper = (obj) => ({\n id: properties.map(path => {\n let at = obj\n for(const p of path) at = at && at[p]\n return at === undefined ? '' : JSON.stringify(at)\n }).join(':')+'_'+obj.id,\n to: obj.id\n })\n await input.table(table).onChange((obj, oldObj) =>\n output.change(obj && mapper(obj), oldObj && mapper(oldObj)) )\n })",
198
+ "parameters": {
199
+ "properties": [
200
+ [
201
+ "user"
202
+ ]
203
+ ],
204
+ "table": "passwordAuthentication_PasswordAuthentication"
205
+ },
206
+ "uid": "35d802d445843522",
207
+ "sources": [
208
+ {
209
+ "type": "table",
210
+ "name": "passwordAuthentication_PasswordAuthentication"
211
+ }
212
+ ]
213
+ },
214
+ "passwordAuthentication_ResetPasswordAuthentication_byKey": {
215
+ "code": "(async function(input, output, { table, properties }) {\n const mapper = (obj) => ({\n id: properties.map(path => {\n let at = obj\n for(const p of path) at = at && at[p]\n return at === undefined ? '' : JSON.stringify(at)\n }).join(':')+'_'+obj.id,\n to: obj.id\n })\n await input.table(table).onChange((obj, oldObj) =>\n output.change(obj && mapper(obj), oldObj && mapper(oldObj)) )\n })",
216
+ "parameters": {
217
+ "properties": [
218
+ [
219
+ "key"
220
+ ]
221
+ ],
222
+ "table": "passwordAuthentication_ResetPasswordAuthentication"
223
+ },
224
+ "uid": "e9b62bb3f17fc6af",
225
+ "sources": [
226
+ {
227
+ "type": "table",
228
+ "name": "passwordAuthentication_ResetPasswordAuthentication"
229
+ }
230
+ ]
231
+ },
232
+ "passwordAuthentication_ResetPasswordAuthentication_byUser": {
233
+ "code": "(async function(input, output, { table, properties }) {\n const mapper = (obj) => ({\n id: properties.map(path => {\n let at = obj\n for(const p of path) at = at && at[p]\n return at === undefined ? '' : JSON.stringify(at)\n }).join(':')+'_'+obj.id,\n to: obj.id\n })\n await input.table(table).onChange((obj, oldObj) =>\n output.change(obj && mapper(obj), oldObj && mapper(oldObj)) )\n })",
234
+ "parameters": {
235
+ "properties": [
236
+ [
237
+ "user"
238
+ ]
239
+ ],
240
+ "table": "passwordAuthentication_ResetPasswordAuthentication"
241
+ },
242
+ "uid": "7b05663402816717",
243
+ "sources": [
244
+ {
245
+ "type": "table",
246
+ "name": "passwordAuthentication_ResetPasswordAuthentication"
247
+ }
248
+ ]
249
+ },
250
+ "accessControl_Access_bySessionOrUser": {
251
+ "code": "(async function(input, output, { table, properties }) {\n const mapper = (obj) => ({\n id: properties.map(path => {\n let at = obj\n for(const p of path) at = at && at[p]\n return at === undefined ? '' : JSON.stringify(at)\n }).join(':')+'_'+obj.id,\n to: obj.id\n })\n await input.table(table).onChange((obj, oldObj) =>\n output.change(obj && mapper(obj), oldObj && mapper(oldObj)) )\n })",
252
+ "parameters": {
253
+ "properties": [
254
+ [
255
+ "sessionOrUserType"
256
+ ],
257
+ [
258
+ "sessionOrUser"
259
+ ]
260
+ ],
261
+ "table": "accessControl_Access"
262
+ },
263
+ "uid": "921cbb18bbe4efe5",
264
+ "sources": [
265
+ {
266
+ "type": "table",
267
+ "name": "accessControl_Access"
268
+ }
269
+ ]
270
+ },
271
+ "accessControl_Access_byObject": {
272
+ "code": "(async function(input, output, { table, properties }) {\n const mapper = (obj) => ({\n id: properties.map(path => {\n let at = obj\n for(const p of path) at = at && at[p]\n return at === undefined ? '' : JSON.stringify(at)\n }).join(':')+'_'+obj.id,\n to: obj.id\n })\n await input.table(table).onChange((obj, oldObj) =>\n output.change(obj && mapper(obj), oldObj && mapper(oldObj)) )\n })",
273
+ "parameters": {
274
+ "properties": [
275
+ [
276
+ "objectType"
277
+ ],
278
+ [
279
+ "object"
280
+ ]
281
+ ],
282
+ "table": "accessControl_Access"
283
+ },
284
+ "uid": "74f3fae9ab84958b",
285
+ "sources": [
286
+ {
287
+ "type": "table",
288
+ "name": "accessControl_Access"
289
+ }
290
+ ]
291
+ },
292
+ "accessControl_AccessRequest_bySessionOrUser": {
293
+ "code": "(async function(input, output, { table, properties }) {\n const mapper = (obj) => ({\n id: properties.map(path => {\n let at = obj\n for(const p of path) at = at && at[p]\n return at === undefined ? '' : JSON.stringify(at)\n }).join(':')+'_'+obj.id,\n to: obj.id\n })\n await input.table(table).onChange((obj, oldObj) =>\n output.change(obj && mapper(obj), oldObj && mapper(oldObj)) )\n })",
294
+ "parameters": {
295
+ "properties": [
296
+ [
297
+ "sessionOrUserType"
298
+ ],
299
+ [
300
+ "sessionOrUser"
301
+ ]
302
+ ],
303
+ "table": "accessControl_AccessRequest"
304
+ },
305
+ "uid": "f86c075c131c38a3",
306
+ "sources": [
307
+ {
308
+ "type": "table",
309
+ "name": "accessControl_AccessRequest"
310
+ }
311
+ ]
312
+ },
313
+ "accessControl_AccessRequest_byObject": {
314
+ "code": "(async function(input, output, { table, properties }) {\n const mapper = (obj) => ({\n id: properties.map(path => {\n let at = obj\n for(const p of path) at = at && at[p]\n return at === undefined ? '' : JSON.stringify(at)\n }).join(':')+'_'+obj.id,\n to: obj.id\n })\n await input.table(table).onChange((obj, oldObj) =>\n output.change(obj && mapper(obj), oldObj && mapper(oldObj)) )\n })",
315
+ "parameters": {
316
+ "properties": [
317
+ [
318
+ "objectType"
319
+ ],
320
+ [
321
+ "object"
322
+ ]
323
+ ],
324
+ "table": "accessControl_AccessRequest"
325
+ },
326
+ "uid": "21747146eee6db5d",
327
+ "sources": [
328
+ {
329
+ "type": "table",
330
+ "name": "accessControl_AccessRequest"
331
+ }
332
+ ]
333
+ },
334
+ "accessControl_AccessInvitation_byContactOrUser": {
335
+ "code": "(async function(input, output, { table, properties }) {\n const mapper = (obj) => ({\n id: properties.map(path => {\n let at = obj\n for(const p of path) at = at && at[p]\n return at === undefined ? '' : JSON.stringify(at)\n }).join(':')+'_'+obj.id,\n to: obj.id\n })\n await input.table(table).onChange((obj, oldObj) =>\n output.change(obj && mapper(obj), oldObj && mapper(oldObj)) )\n })",
336
+ "parameters": {
337
+ "properties": [
338
+ [
339
+ "contactOrUserType"
340
+ ],
341
+ [
342
+ "contactOrUser"
343
+ ]
344
+ ],
345
+ "table": "accessControl_AccessInvitation"
346
+ },
347
+ "uid": "b364730c907135c8",
348
+ "sources": [
349
+ {
350
+ "type": "table",
351
+ "name": "accessControl_AccessInvitation"
352
+ }
353
+ ]
354
+ },
355
+ "accessControl_AccessInvitation_byObject": {
356
+ "code": "(async function(input, output, { table, properties }) {\n const mapper = (obj) => ({\n id: properties.map(path => {\n let at = obj\n for(const p of path) at = at && at[p]\n return at === undefined ? '' : JSON.stringify(at)\n }).join(':')+'_'+obj.id,\n to: obj.id\n })\n await input.table(table).onChange((obj, oldObj) =>\n output.change(obj && mapper(obj), oldObj && mapper(oldObj)) )\n })",
357
+ "parameters": {
358
+ "properties": [
359
+ [
360
+ "objectType"
361
+ ],
362
+ [
363
+ "object"
364
+ ]
365
+ ],
366
+ "table": "accessControl_AccessInvitation"
367
+ },
368
+ "uid": "27bd8087b9ef7180",
369
+ "sources": [
370
+ {
371
+ "type": "table",
372
+ "name": "accessControl_AccessInvitation"
373
+ }
374
+ ]
375
+ },
376
+ "security_Ban_bans": {
377
+ "code": "(async function(input, output, { table, property }) {\n const values = (obj) => {\n let at = obj\n for(const p of property) at = at && at[p]\n if(at === undefined) return []\n if(Array.isArray(at)) return at.map(v => JSON.stringify(v))\n return [at]\n }\n await input.table(table).onChange((obj, oldObj) => {\n if(obj && oldObj) {\n let pointers = obj && new Set(values(obj))\n let oldPointers = oldObj && new Set(values(oldObj))\n for(let pointer of pointers) {\n if(!!oldPointers.has(pointer)) output.change({ id: pointer+'_'+obj.id, to: obj.id }, null)\n }\n for(let pointer of oldPointers) {\n if(!!pointers.has(pointer)) output.change(null, { id: pointer+'_'+obj.id, to: obj.id })\n }\n } else if(obj) {\n values(obj).forEach(v => output.change({ id: v+'_'+obj.id, to: obj.id }, null))\n } else if(oldObj) {\n values(oldObj).forEach(v => output.change(null, { id: v+'_'+oldObj.id, to: oldObj.id }))\n }\n })\n })",
378
+ "parameters": {
379
+ "property": [
380
+ "keys"
381
+ ],
382
+ "table": "security_Ban"
383
+ },
384
+ "uid": "6ffe163d23bd1ec7",
385
+ "sources": [
386
+ {
387
+ "type": "table",
388
+ "name": "security_Ban"
389
+ }
390
+ ]
391
+ },
392
+ "security_Ban_actionBans": {
393
+ "code": "(async function(input, output) {\n function prefixes(ban) {\n //output.debug(\"BAN\", ban)\n if(!ban.keys) return []\n if(!ban.actions) return []\n const v = ban.keys.length\n const w = ban.actions.length\n let res = new Array(v * w)\n for(let i = 0; i < v; i++) {\n for(let j = 0; j < w; j++) {\n const key = ban.keys[i]\n res[i * v + j] = `${ban.actions[j]}:${key.key}:${key.value}`\n }\n }\n //output.debug(\"BAN ACTIONS\", res)\n return res\n }\n function indexObject(prefix, obj) {\n //output.debug(\"BAN\", obj)\n return {\n id: prefix+'_'+obj.id,\n to: obj.id,\n type: obj.type,\n expire: obj.expire,\n actions: obj.actions\n }\n }\n await input.table(\"security_Ban\").onChange((obj, oldObj) => {\n if(obj && oldObj) {\n //output.debug(\"CHANGE!\", obj, oldObj)\n const pointers = obj && new Set(prefixes(obj))\n const oldPointers = oldObj && new Set(prefixes(oldObj))\n for(let pointer of pointers) {\n if(!!oldPointers.has(pointer)) output.change(indexObject(pointer, obj), null)\n }\n for(let pointer of oldPointers) {\n if(!!pointers.has(pointer)) output.change(null, indexObject(pointer, oldObj))\n }\n } else if(obj) {\n //output.debug(\"CREATE!\", obj, oldObj)\n prefixes(obj).forEach(v => output.change(indexObject(v, obj), null))\n } else if(oldObj) {\n //output.debug(\"DELETE!\", obj, oldObj)\n prefixes(oldObj).forEach(v => output.change(null, indexObject(v, oldObj)))\n }\n })\n })",
394
+ "parameters": {},
395
+ "uid": "acfb6180f6393345",
396
+ "sources": [
397
+ {
398
+ "type": "table",
399
+ "name": "security_Ban"
400
+ }
401
+ ]
402
+ },
403
+ "security_Ban_actionBansByType": {
404
+ "code": "(async function(input, output) {\n function prefixes(ban) {\n //output.debug(\"BAN\", ban)\n if(!ban.keys) return []\n if(!ban.actions) return []\n const v = ban.keys.length\n const w = ban.actions.length\n let res = new Array(v * w)\n for(let i = 0; i < v; i++) {\n for(let j = 0; j < w; j++) {\n const key = ban.keys[i]\n res[i * v + j] = `${ban.actions[j]}:${key.key}:${key.value}:${ban.type}:${ban.expire}`\n }\n }\n output.debug(\"BAN PREFIXES\", res)\n return res\n }\n function indexObject(prefix, obj) {\n //output.debug(\"BAN\", obj)\n return {\n id: prefix+'_'+obj.id,\n to: obj.id,\n type: obj.type,\n expire: obj.expire,\n actions: obj.actions\n }\n }\n await input.table(\"security_Ban\").onChange((obj, oldObj) => {\n if(obj && oldObj) {\n //output.debug(\"CHANGE!\", obj, oldObj)\n let pointers = obj && new Set(prefixes(obj))\n let oldPointers = oldObj && new Set(prefixes(oldObj))\n for(let pointer of pointers) {\n if(!!oldPointers.has(pointer)) output.change(indexObject(pointer, obj), null)\n }\n for(let pointer of oldPointers) {\n if(!!pointers.has(pointer)) output.change(null, indexObject(pointer, oldObj))\n }\n } else if(obj) {\n //output.debug(\"CREATE!\", obj, oldObj)\n prefixes(obj).forEach(v => output.change(indexObject(v, obj), null))\n } else if(oldObj) {\n //output.debug(\"DELETE!\", obj, oldObj)\n prefixes(oldObj).forEach(v => output.change(null, indexObject(v, oldObj)))\n }\n })\n })",
405
+ "parameters": {},
406
+ "uid": "0f2a83fd89adf7cd",
407
+ "sources": [
408
+ {
409
+ "type": "table",
410
+ "name": "security_Ban"
411
+ }
412
+ ]
413
+ },
414
+ "security_Event_byKeyTypeAndTimestamp": {
415
+ "code": "(async function(input, output) {\n async function spread(event) {\n for(const key in event.keys) {\n output.put({\n id: `${key}:${JSON.stringify(event.keys[key])}:${event.type}:${event.timestamp}_${event.id}`,\n type: event.type,\n timestamp: event.timestamp\n })\n }\n }\n await input.table('security_Event').onChange(\n (obj, oldObj) => spread(obj)\n )\n })",
416
+ "parameters": {},
417
+ "uid": "2491114d3b2e571b",
418
+ "sources": [
419
+ {
420
+ "type": "table",
421
+ "name": "security_Event"
422
+ }
423
+ ]
424
+ },
425
+ "notification_Notification_unreadNotifications": {
426
+ "code": "(async function(input, output) {\n await input.table('notification_Notification')\n .map((obj) => obj && obj.readState == 'new' && ({\n id: `\"${obj.sessionOrUserType}\":\"${obj.sessionOrUser}\"_${obj.id}`,\n sessionOrUserType: obj.sessionOrUserType, sessionOrUser: obj.sessionOrUser,\n to: obj.id\n }))\n .to(output)\n })",
427
+ "parameters": {},
428
+ "uid": "3581e5b8a921d104",
429
+ "sources": [
430
+ {
431
+ "type": "table",
432
+ "name": "notification_Notification"
433
+ }
434
+ ]
435
+ },
436
+ "notification_Notification_unreadNotificationsCount": {
437
+ "code": "(async function(input, output) {\n const unreadIndex = await input.index('notification_Notification_unreadNotifications')\n await unreadIndex.onChange(\n async (obj, oldObj) => {\n const { sessionOrUserType, sessionOrUser } = obj || oldObj\n const group = `\"${sessionOrUserType}\":\"${sessionOrUser}\"`\n const prefix = group + '_'\n const count = await unreadIndex.count({ gt: prefix, lt: prefix + '\\xFF' })\n output.put({\n id: group,\n count\n })\n }\n )\n })",
438
+ "parameters": {},
439
+ "uid": "4e00443e4ce0a584",
440
+ "sources": [
441
+ {
442
+ "type": "index",
443
+ "name": "notification_Notification_unreadNotifications"
444
+ }
445
+ ]
446
+ },
447
+ "notification_Notification_bySessionOrUser": {
448
+ "code": "(async function(input, output, { table, properties }) {\n const mapper = (obj) => ({\n id: properties.map(path => {\n let at = obj\n for(const p of path) at = at && at[p]\n return at === undefined ? '' : JSON.stringify(at)\n }).join(':')+'_'+obj.id,\n to: obj.id\n })\n await input.table(table).onChange((obj, oldObj) =>\n output.change(obj && mapper(obj), oldObj && mapper(oldObj)) )\n })",
449
+ "parameters": {
450
+ "properties": [
451
+ [
452
+ "sessionOrUserType"
453
+ ],
454
+ [
455
+ "sessionOrUser"
456
+ ]
457
+ ],
458
+ "table": "notification_Notification"
459
+ },
460
+ "uid": "97dc53b4fbcce2f9",
461
+ "sources": [
462
+ {
463
+ "type": "table",
464
+ "name": "notification_Notification"
465
+ }
466
+ ]
467
+ },
468
+ "notification_Notification_bySessionOrUserAndTime": {
469
+ "code": "(async function(input, output, { table, properties }) {\n const mapper = (obj) => ({\n id: properties.map(path => {\n let at = obj\n for(const p of path) at = at && at[p]\n return at === undefined ? '' : JSON.stringify(at)\n }).join(':')+'_'+obj.id,\n to: obj.id\n })\n await input.table(table).onChange((obj, oldObj) =>\n output.change(obj && mapper(obj), oldObj && mapper(oldObj)) )\n })",
470
+ "parameters": {
471
+ "properties": [
472
+ [
473
+ "sessionOrUserType"
474
+ ],
475
+ [
476
+ "sessionOrUser"
477
+ ],
478
+ [
479
+ "time"
480
+ ]
481
+ ],
482
+ "table": "notification_Notification"
483
+ },
484
+ "uid": "437aba3669da2534",
485
+ "sources": [
486
+ {
487
+ "type": "table",
488
+ "name": "notification_Notification"
489
+ }
490
+ ]
491
+ },
492
+ "notification_Notification_bySessionOrUserAndReadState": {
493
+ "code": "(async function(input, output, { table, properties }) {\n const mapper = (obj) => ({\n id: properties.map(path => {\n let at = obj\n for(const p of path) at = at && at[p]\n return at === undefined ? '' : JSON.stringify(at)\n }).join(':')+'_'+obj.id,\n to: obj.id\n })\n await input.table(table).onChange((obj, oldObj) =>\n output.change(obj && mapper(obj), oldObj && mapper(oldObj)) )\n })",
494
+ "parameters": {
495
+ "properties": [
496
+ [
497
+ "sessionOrUserType"
498
+ ],
499
+ [
500
+ "sessionOrUser"
501
+ ],
502
+ [
503
+ "readState"
504
+ ]
505
+ ],
506
+ "table": "notification_Notification"
507
+ },
508
+ "uid": "96f30b49df1f4c07",
509
+ "sources": [
510
+ {
511
+ "type": "table",
512
+ "name": "notification_Notification"
513
+ }
514
+ ]
515
+ },
516
+ "notification_NotificationSetting_byContact": {
517
+ "code": "(async function(input, output, { table, properties }) {\n const mapper = (obj) => ({\n id: properties.map(path => {\n let at = obj\n for(const p of path) at = at && at[p]\n return at === undefined ? '' : JSON.stringify(at)\n }).join(':')+'_'+obj.id,\n to: obj.id\n })\n await input.table(table).onChange((obj, oldObj) =>\n output.change(obj && mapper(obj), oldObj && mapper(oldObj)) )\n })",
518
+ "parameters": {
519
+ "properties": [
520
+ [
521
+ "contactType"
522
+ ],
523
+ [
524
+ "contact"
525
+ ]
526
+ ],
527
+ "table": "notification_NotificationSetting"
528
+ },
529
+ "uid": "7e861df57706dc7d",
530
+ "sources": [
531
+ {
532
+ "type": "table",
533
+ "name": "notification_NotificationSetting"
534
+ }
535
+ ]
536
+ },
537
+ "notification_NotificationSetting_byNotification": {
538
+ "code": "(async function(input, output, { table, properties }) {\n const mapper = (obj) => ({\n id: properties.map(path => {\n let at = obj\n for(const p of path) at = at && at[p]\n return at === undefined ? '' : JSON.stringify(at)\n }).join(':')+'_'+obj.id,\n to: obj.id\n })\n await input.table(table).onChange((obj, oldObj) =>\n output.change(obj && mapper(obj), oldObj && mapper(oldObj)) )\n })",
539
+ "parameters": {
540
+ "properties": [
541
+ [
542
+ "notificationType"
543
+ ],
544
+ [
545
+ "notification"
546
+ ]
547
+ ],
548
+ "table": "notification_NotificationSetting"
549
+ },
550
+ "uid": "3757f2ab99d99e0f",
551
+ "sources": [
552
+ {
553
+ "type": "table",
554
+ "name": "notification_NotificationSetting"
555
+ }
556
+ ]
557
+ },
558
+ "image_Image_byOwner": {
559
+ "code": "(async function(input, output, { table, properties }) {\n const mapper = (obj) => ({\n id: properties.map(path => {\n let at = obj\n for(const p of path) at = at && at[p]\n return at === undefined ? '' : JSON.stringify(at)\n }).join(':')+'_'+obj.id,\n to: obj.id\n })\n await input.table(table).onChange((obj, oldObj) =>\n output.change(obj && mapper(obj), oldObj && mapper(oldObj)) )\n })",
560
+ "parameters": {
561
+ "properties": [
562
+ [
563
+ "ownerType"
564
+ ],
565
+ [
566
+ "owner"
567
+ ]
568
+ ],
569
+ "table": "image_Image"
570
+ },
571
+ "uid": "8c464a1c561b9778",
572
+ "sources": [
573
+ {
574
+ "type": "table",
575
+ "name": "image_Image"
576
+ }
577
+ ]
578
+ },
579
+ "secretCode_Code_byAuthenticationAndSecretCode": {
580
+ "code": "(async function(input, output, { table, properties }) {\n const mapper = (obj) => ({\n id: properties.map(path => {\n let at = obj\n for(const p of path) at = at && at[p]\n return at === undefined ? '' : JSON.stringify(at)\n }).join(':')+'_'+obj.id,\n to: obj.id\n })\n await input.table(table).onChange((obj, oldObj) =>\n output.change(obj && mapper(obj), oldObj && mapper(oldObj)) )\n })",
581
+ "parameters": {
582
+ "properties": [
583
+ [
584
+ "authentication"
585
+ ],
586
+ [
587
+ "secretCode"
588
+ ]
589
+ ],
590
+ "table": "secretCode_Code"
591
+ },
592
+ "uid": "bd0852b345ad1c70",
593
+ "sources": [
594
+ {
595
+ "type": "table",
596
+ "name": "secretCode_Code"
597
+ }
598
+ ]
599
+ },
600
+ "secretCode_Code_byAuthentication": {
601
+ "code": "(async function(input, output, { table, properties }) {\n const mapper = (obj) => ({\n id: properties.map(path => {\n let at = obj\n for(const p of path) at = at && at[p]\n return at === undefined ? '' : JSON.stringify(at)\n }).join(':')+'_'+obj.id,\n to: obj.id\n })\n await input.table(table).onChange((obj, oldObj) =>\n output.change(obj && mapper(obj), oldObj && mapper(oldObj)) )\n })",
602
+ "parameters": {
603
+ "properties": [
604
+ [
605
+ "authentication"
606
+ ]
607
+ ],
608
+ "table": "secretCode_Code"
609
+ },
610
+ "uid": "7dc2e0339428350d",
611
+ "sources": [
612
+ {
613
+ "type": "table",
614
+ "name": "secretCode_Code"
615
+ }
616
+ ]
617
+ },
618
+ "secretLink_Link_bySecretCode": {
619
+ "code": "(async function(input, output, { table, properties }) {\n const mapper = (obj) => ({\n id: properties.map(path => {\n let at = obj\n for(const p of path) at = at && at[p]\n return at === undefined ? '' : JSON.stringify(at)\n }).join(':')+'_'+obj.id,\n to: obj.id\n })\n await input.table(table).onChange((obj, oldObj) =>\n output.change(obj && mapper(obj), oldObj && mapper(oldObj)) )\n })",
620
+ "parameters": {
621
+ "properties": [
622
+ [
623
+ "secretCode"
624
+ ]
625
+ ],
626
+ "table": "secretLink_Link"
627
+ },
628
+ "uid": "111e9192bd3c8a9c",
629
+ "sources": [
630
+ {
631
+ "type": "table",
632
+ "name": "secretLink_Link"
633
+ }
634
+ ]
635
+ },
636
+ "secretLink_Link_byAuthentication": {
637
+ "code": "(async function(input, output, { table, properties }) {\n const mapper = (obj) => ({\n id: properties.map(path => {\n let at = obj\n for(const p of path) at = at && at[p]\n return at === undefined ? '' : JSON.stringify(at)\n }).join(':')+'_'+obj.id,\n to: obj.id\n })\n await input.table(table).onChange((obj, oldObj) =>\n output.change(obj && mapper(obj), oldObj && mapper(oldObj)) )\n })",
638
+ "parameters": {
639
+ "properties": [
640
+ [
641
+ "authentication"
642
+ ]
643
+ ],
644
+ "table": "secretLink_Link"
645
+ },
646
+ "uid": "3f1770e3306f6e8c",
647
+ "sources": [
648
+ {
649
+ "type": "table",
650
+ "name": "secretLink_Link"
651
+ }
652
+ ]
653
+ },
654
+ "messageAuthentication_Authentication_byContact": {
655
+ "code": "(async function(input, output, { table, properties }) {\n const mapper = (obj) => ({\n id: properties.map(path => {\n let at = obj\n for(const p of path) at = at && at[p]\n return at === undefined ? '' : JSON.stringify(at)\n }).join(':')+'_'+obj.id,\n to: obj.id\n })\n await input.table(table).onChange((obj, oldObj) =>\n output.change(obj && mapper(obj), oldObj && mapper(oldObj)) )\n })",
656
+ "parameters": {
657
+ "properties": [
658
+ [
659
+ "contactType"
660
+ ],
661
+ [
662
+ "contact"
663
+ ]
664
+ ],
665
+ "table": "messageAuthentication_Authentication"
666
+ },
667
+ "uid": "5973f4acc3499caf",
668
+ "sources": [
669
+ {
670
+ "type": "table",
671
+ "name": "messageAuthentication_Authentication"
672
+ }
673
+ ]
674
+ },
675
+ "url_Canonical_byUrl": {
676
+ "code": "(async function(input, output, { table, properties }) {\n const mapper = (obj) => ({\n id: properties.map(path => {\n let at = obj\n for(const p of path) at = at && at[p]\n return at === undefined ? '' : JSON.stringify(at)\n }).join(':')+'_'+obj.id,\n to: obj.id\n })\n await input.table(table).onChange((obj, oldObj) =>\n output.change(obj && mapper(obj), oldObj && mapper(oldObj)) )\n })",
677
+ "parameters": {
678
+ "properties": [
679
+ [
680
+ "targetType"
681
+ ],
682
+ [
683
+ "domain"
684
+ ],
685
+ [
686
+ "path"
687
+ ]
688
+ ],
689
+ "table": "url_Canonical"
690
+ },
691
+ "uid": "8c0a424f8d54cb88",
692
+ "sources": [
693
+ {
694
+ "type": "table",
695
+ "name": "url_Canonical"
696
+ }
697
+ ]
698
+ },
699
+ "url_Redirect_byUrl": {
700
+ "code": "(async function(input, output, { table, properties }) {\n const mapper = (obj) => ({\n id: properties.map(path => {\n let at = obj\n for(const p of path) at = at && at[p]\n return at === undefined ? '' : JSON.stringify(at)\n }).join(':')+'_'+obj.id,\n to: obj.id\n })\n await input.table(table).onChange((obj, oldObj) =>\n output.change(obj && mapper(obj), oldObj && mapper(oldObj)) )\n })",
701
+ "parameters": {
702
+ "properties": [
703
+ [
704
+ "targetType"
705
+ ],
706
+ [
707
+ "domain"
708
+ ],
709
+ [
710
+ "path"
711
+ ]
712
+ ],
713
+ "table": "url_Redirect"
714
+ },
715
+ "uid": "72bd5266d615f793",
716
+ "sources": [
717
+ {
718
+ "type": "table",
719
+ "name": "url_Redirect"
720
+ }
721
+ ]
722
+ },
723
+ "url_Redirect_byTarget": {
724
+ "code": "(async function(input, output, { table, properties }) {\n const mapper = (obj) => ({\n id: properties.map(path => {\n let at = obj\n for(const p of path) at = at && at[p]\n return at === undefined ? '' : JSON.stringify(at)\n }).join(':')+'_'+obj.id,\n to: obj.id\n })\n await input.table(table).onChange((obj, oldObj) =>\n output.change(obj && mapper(obj), oldObj && mapper(oldObj)) )\n })",
725
+ "parameters": {
726
+ "properties": [
727
+ [
728
+ "targetType"
729
+ ],
730
+ [
731
+ "target"
732
+ ]
733
+ ],
734
+ "table": "url_Redirect"
735
+ },
736
+ "uid": "3677d1b78ea1ee4f",
737
+ "sources": [
738
+ {
739
+ "type": "table",
740
+ "name": "url_Redirect"
741
+ }
742
+ ]
743
+ },
744
+ "url_Urls": {
745
+ "code": "(async function(input, output) {\n const urlMapper = urlType => ({targetType, domain, path, target}) =>\n ({\n id: `\"${targetType}\":${JSON.stringify(domain)}:${JSON.stringify(path)}_\"${target}\"`,\n target, domain, path,\n type: urlType\n })\n const redirectMapper = urlMapper('redirect')\n const canonicalMapper = urlMapper('canonical')\n await input.table('url_Redirect').onChange(\n (obj, oldObj) => output.change(obj && redirectMapper(obj), oldObj && redirectMapper(oldObj))\n )\n await input.table('url_Canonical').onChange(\n (obj, oldObj) => output.change(obj && canonicalMapper(obj), oldObj && canonicalMapper(oldObj))\n )\n })",
746
+ "parameters": {},
747
+ "uid": "bb5a8c6aeff614d5",
748
+ "sources": [
749
+ {
750
+ "type": "table",
751
+ "name": "url_Redirect"
752
+ },
753
+ {
754
+ "type": "table",
755
+ "name": "url_Canonical"
756
+ }
757
+ ]
758
+ },
759
+ "url_UrlsWithoutDomain": {
760
+ "code": "(async function(input, output) {\n const urlMapper = urlType => ({targetType, domain, path, target}) =>\n ({\n id: `\"${targetType}\":${JSON.stringify(path)}_\"${target}\"`,\n target, domain, path,\n type: urlType\n })\n const redirectMapper = urlMapper('redirect')\n const canonicalMapper = urlMapper('canonical')\n await input.table('url_Redirect').onChange(\n (obj, oldObj) => output.change(obj && redirectMapper(obj), oldObj && redirectMapper(oldObj))\n )\n await input.table('url_Canonical').onChange(\n (obj, oldObj) => output.change(obj && canonicalMapper(obj), oldObj && canonicalMapper(oldObj))\n )\n })",
761
+ "parameters": {},
762
+ "uid": "0a732ae4ad61e478",
763
+ "sources": [
764
+ {
765
+ "type": "table",
766
+ "name": "url_Redirect"
767
+ },
768
+ {
769
+ "type": "table",
770
+ "name": "url_Canonical"
771
+ }
772
+ ]
773
+ },
774
+ "prosemirror_Snapshot_list": {
775
+ "code": "(async function(input, output, { table, properties }) {\n const mapper = (obj) => ({\n id: properties.map(path => {\n let at = obj\n for(const p of path) at = at && at[p]\n return at === undefined ? '' : JSON.stringify(at)\n }).join(':')+'_'+obj.id,\n to: obj.id\n })\n await input.table(table).onChange((obj, oldObj) =>\n output.change(obj && mapper(obj), oldObj && mapper(oldObj)) )\n })",
776
+ "parameters": {
777
+ "properties": [
778
+ [
779
+ "document"
780
+ ],
781
+ [
782
+ "version"
783
+ ]
784
+ ],
785
+ "table": "prosemirror_Snapshot"
786
+ },
787
+ "uid": "0160469625b444fc",
788
+ "sources": [
789
+ {
790
+ "type": "table",
791
+ "name": "prosemirror_Snapshot"
792
+ }
793
+ ]
794
+ },
795
+ "content_AdditionalContent_byContent": {
796
+ "code": "(async function(input, output, { table, properties }) {\n const mapper = (obj) => ({\n id: properties.map(path => {\n let at = obj\n for(const p of path) at = at && at[p]\n return at === undefined ? '' : JSON.stringify(at)\n }).join(':')+'_'+obj.id,\n to: obj.id\n })\n await input.table(table).onChange((obj, oldObj) =>\n output.change(obj && mapper(obj), oldObj && mapper(oldObj)) )\n })",
797
+ "parameters": {
798
+ "properties": [
799
+ [
800
+ "content"
801
+ ]
802
+ ],
803
+ "table": "content_AdditionalContent"
804
+ },
805
+ "uid": "20e935db78c8ee30",
806
+ "sources": [
807
+ {
808
+ "type": "table",
809
+ "name": "content_AdditionalContent"
810
+ }
811
+ ]
812
+ },
813
+ "llmTree_Message_bySource": {
814
+ "code": "(async function(input, output, { table, properties }) {\n const mapper = (obj) => ({\n id: properties.map(path => {\n let at = obj\n for(const p of path) at = at && at[p]\n return at === undefined ? '' : JSON.stringify(at)\n }).join(':')+'_'+obj.id,\n to: obj.id\n })\n await input.table(table).onChange((obj, oldObj) =>\n output.change(obj && mapper(obj), oldObj && mapper(oldObj)) )\n })",
815
+ "parameters": {
816
+ "properties": [
817
+ [
818
+ "sourceType"
819
+ ],
820
+ [
821
+ "source"
822
+ ]
823
+ ],
824
+ "table": "llmTree_Message"
825
+ },
826
+ "uid": "692213d8cc505d01",
827
+ "sources": [
828
+ {
829
+ "type": "table",
830
+ "name": "llmTree_Message"
831
+ }
832
+ ]
833
+ },
834
+ "llmTree_Message_messageRoots": {
835
+ "code": "(async function(input, output, { tableName }) {\n const table = input.table(tableName)\n async function findRoot(obj) {\n if(!obj) return null\n while(obj.causeType === tableName) {\n const parent = await table.object(obj.cause).get()\n //output.debug(\"MESSAGE ROOTS FIND PARENT\", obj, \"=>\", parent)\n obj = parent\n }\n return obj\n }\n await input.table(tableName).onChange(async (obj, oldObj) => {\n const id = obj.id || oldObj.id\n //output.debug(\"MESSAGE ROOTS CHANGE\", obj, oldObj)\n if(!id) return\n const oldRoot = await findRoot(oldObj)\n const newRoot = await findRoot(obj)\n //console.log(\"MESSAGE ROOTS CHANGED\", id, oldRoot, newRoot)\n if(oldRoot !== newRoot) {\n if(oldRoot) output.delete({ id: `\"${id}\"_${oldRoot.id}`, message: id, root: oldRoot.id })\n if(newRoot) output.put({ id: `${id}_${newRoot.id}`, message: id, root: newRoot.id })\n }\n })\n })",
836
+ "parameters": {
837
+ "tableName": "llmTree_Message"
838
+ },
839
+ "uid": "c91dd703a1f3923f",
840
+ "sources": [
841
+ {
842
+ "type": "table",
843
+ "name": "llmTree_Message"
844
+ }
845
+ ]
846
+ },
847
+ "llmTree_Message_byRoots": {
848
+ "code": "(async function(input, output, { indexName }) {\n const index = await input.index(indexName)\n function mapper(obj) {\n if(!obj) return null\n return { id: `\"${obj.root}\"_${obj.message}}`, to: obj.message, root: obj.root }\n }\n await index.onChange(async (obj, oldObj) =>\n output.change(mapper(obj), mapper(oldObj))\n )\n })",
849
+ "parameters": {
850
+ "indexName": "llmTree_Message_messageRoots"
851
+ },
852
+ "uid": "3da6116aedf3cd5a",
853
+ "sources": [
854
+ {
855
+ "type": "index",
856
+ "name": "llmTree_Message_messageRoots"
857
+ }
858
+ ]
859
+ },
860
+ "llmTree_Message_roots": {
861
+ "code": "(async function(input, output, { indexName }) {\n const index = await input.index(indexName)\n await index.onChange(async (obj, oldObj) => {\n const root = obj?.root || oldObj?.root\n if(!root) return\n const count = await index.count({ gt: `\"${root}\"_`, lt: `${root}_\\xFF`, limit: 101 })\n await output.put({ id: root, count })\n })\n })",
862
+ "parameters": {
863
+ "indexName": "llmTree_Message_byRoots"
864
+ },
865
+ "uid": "0e5abfddae2de7c6",
866
+ "sources": [
867
+ {
868
+ "type": "index",
869
+ "name": "llmTree_Message_byRoots"
870
+ }
871
+ ]
872
+ },
873
+ "llmTree_Message_byCause": {
874
+ "code": "(async function(input, output, { table, properties }) {\n const mapper = (obj) => ({\n id: properties.map(path => {\n let at = obj\n for(const p of path) at = at && at[p]\n return at === undefined ? '' : JSON.stringify(at)\n }).join(':')+'_'+obj.id,\n to: obj.id\n })\n await input.table(table).onChange((obj, oldObj) =>\n output.change(obj && mapper(obj), oldObj && mapper(oldObj)) )\n })",
875
+ "parameters": {
876
+ "properties": [
877
+ [
878
+ "causeType"
879
+ ],
880
+ [
881
+ "cause"
882
+ ]
883
+ ],
884
+ "table": "llmTree_Message"
885
+ },
886
+ "uid": "50e4011f510fa1dc",
887
+ "sources": [
888
+ {
889
+ "type": "table",
890
+ "name": "llmTree_Message"
891
+ }
892
+ ]
893
+ },
894
+ "llmTree_Message_causedCount": {
895
+ "code": "(async function(input, output, { indexName, tableName }) {\n const index = await input.index(indexName)\n const table = await input.table(tableName)\n await index.onChange(async (obj, oldObj) => {\n const id = obj?.id || oldObj?.id\n if(!id) return\n const causeData = id.split('\"_[')[0] + '\"'\n //const [causeType, cause] = causeData.split(':').map(x => JSON.parse(x))\n //if(causeType === tableName) {\n const count = await index.count({ gt: `${causeData}_`, lt: `${causeData}_\\xFF`, limit: 101 })\n console.log(\"CAUSE DATA\", causeData, \"COUNT\", count)\n await output.put({ id: causeData, count })\n //}\n })\n await table.onChange(async (obj, oldObj) => {\n const to = obj?.id || oldObj?.id\n if(!to) return\n const causeData = `\"${tableName}\":\"${to}\"`\n if(!obj) {\n output.delete(to)\n } else {\n const count = await index.count({ gt: `${causeData}_`, lt: `${causeData}_\\xFF`, limit: 101 })\n console.log(\"CAUSE DATA\", causeData, \"COUNT\", count)\n await output.put({ id: causeData, count })\n }\n })\n })",
896
+ "parameters": {
897
+ "indexName": "llmTree_Message_byCause",
898
+ "tableName": "llmTree_Message"
899
+ },
900
+ "uid": "e1b3185e93d728ca",
901
+ "sources": [
902
+ {
903
+ "type": "index",
904
+ "name": "llmTree_Message_byCause"
905
+ },
906
+ {
907
+ "type": "table",
908
+ "name": "llmTree_Message"
909
+ }
910
+ ]
911
+ },
912
+ "llmTree_Message_ends": {
913
+ "code": "(async function(input, output, { tableName, indexName }) {\n const index = await input.index(indexName)\n await index.onChange(async (obj, oldObj) => {\n const count = obj?.count ?? 0\n const oldCount = oldObj?.count ?? 0\n if(count && oldCount) return\n const id = obj?.id || oldObj?.id\n if(!id) return\n const [causeType, cause] = id.split(':').map(x => JSON.parse(x))\n if(causeType === tableName) {\n if(count === 0) {\n output.put({ id: cause })\n } else {\n output.delete({ id: cause })\n }\n }\n })\n })",
914
+ "parameters": {
915
+ "tableName": "llmTree_Message",
916
+ "indexName": "llmTree_Message_causedCount"
917
+ },
918
+ "uid": "6355fba5ccab1c12",
919
+ "sources": [
920
+ {
921
+ "type": "index",
922
+ "name": "llmTree_Message_causedCount"
923
+ }
924
+ ]
925
+ },
926
+ "llmTree_Message_byEnd": {
927
+ "code": "(async function(input, output, { tableName, indexName }) {\n const table = await input.table(tableName)\n const index = await input.index(indexName)\n async function findMessages(obj) {\n const messages = []\n if(!obj) return messages\n messages.push(obj)\n while(obj.causeType === tableName) {\n const parent = await table.object(obj.cause).get()\n messages.push(parent)\n //output.debug(\"MESSAGE ROOTS FIND PARENT\", obj, \"=>\", parent)\n obj = parent\n }\n return messages\n }\n await index.onChange(async (obj, oldObj) => {\n const id = obj?.id || oldObj?.id\n if(!id) return\n const msg = obj?.id && await table.object(obj?.id).get()\n const oldMsg = oldObj?.id && await table.object(oldObj?.id).get()\n const messages = msg && await findMessages(msg) || []\n const oldMessages = oldMsg && await findMessages(oldMsg) || []\n/* console.log(\"END\", id)\n console.log(\"MESSAGES\", messages)*/\n for(const message of oldMessages) {\n if(!messages.find(m => m.id === message.id)) {\n output.delete({ id: `\"${id}\"_${message.id}`, end: id, to: message.id })\n }\n }\n for(const message of messages) {\n if(!oldMessages.find(m => m.id === message.id)) {\n output.put({ id: `\"${id}\"_${message.id}`, end: id, to: message.id })\n }\n }\n })\n })",
928
+ "parameters": {
929
+ "tableName": "llmTree_Message",
930
+ "indexName": "llmTree_Message_ends"
931
+ },
932
+ "uid": "6d38e8bed0331598",
933
+ "sources": [
934
+ {
935
+ "type": "table",
936
+ "name": "llmTree_Message"
937
+ },
938
+ {
939
+ "type": "index",
940
+ "name": "llmTree_Message_ends"
941
+ }
942
+ ]
943
+ },
944
+ "llmTree_MessageFragment_byMessage": {
945
+ "code": "(async function(input, output, { table, properties }) {\n const mapper = (obj) => ({\n id: properties.map(path => {\n let at = obj\n for(const p of path) at = at && at[p]\n return at === undefined ? '' : JSON.stringify(at)\n }).join(':')+'_'+obj.id,\n to: obj.id\n })\n await input.table(table).onChange((obj, oldObj) =>\n output.change(obj && mapper(obj), oldObj && mapper(oldObj)) )\n })",
946
+ "parameters": {
947
+ "properties": [
948
+ [
949
+ "message"
950
+ ]
951
+ ],
952
+ "table": "llmTree_MessageFragment"
953
+ },
954
+ "uid": "6cf9346a48407243",
955
+ "sources": [
956
+ {
957
+ "type": "table",
958
+ "name": "llmTree_MessageFragment"
959
+ }
960
+ ]
961
+ },
962
+ "llmTree_Conversation_bySessionOrUser": {
963
+ "code": "(async function(input, output, { table, properties }) {\n const mapper = (obj) => ({\n id: properties.map(path => {\n let at = obj\n for(const p of path) at = at && at[p]\n return at === undefined ? '' : JSON.stringify(at)\n }).join(':')+'_'+obj.id,\n to: obj.id\n })\n await input.table(table).onChange((obj, oldObj) =>\n output.change(obj && mapper(obj), oldObj && mapper(oldObj)) )\n })",
964
+ "parameters": {
965
+ "properties": [
966
+ [
967
+ "sessionOrUserType"
968
+ ],
969
+ [
970
+ "sessionOrUser"
971
+ ]
972
+ ],
973
+ "table": "llmTree_Conversation"
974
+ },
975
+ "uid": "ee15792892ebca18",
976
+ "sources": [
977
+ {
978
+ "type": "table",
979
+ "name": "llmTree_Conversation"
980
+ }
981
+ ]
982
+ },
983
+ "commands_new": {
984
+ "code": "(async function(input, output, { tableName }) {\n await input.table(tableName).onChange(async (obj, oldObj) => {\n const res = obj && obj.state == 'new' ? { ...obj, id: obj.service + '_' + obj.id } : null\n const oldRes = oldObj && oldObj.state == 'new' ? { ...oldObj, id: oldObj.service + '_' + oldObj.id } : null\n //output.debug(\"CHANGE \", tableName, \"INDEX\", res, \"OLD:\", oldRes)\n await output.change(res, oldRes)\n })\n })",
985
+ "parameters": {
986
+ "tableName": "commands"
987
+ },
988
+ "uid": "9d476987f5eb58d6",
989
+ "sources": [
990
+ {
991
+ "type": "table",
992
+ "name": "commands"
993
+ }
994
+ ]
995
+ },
996
+ "triggers_new": {
997
+ "code": "(async function(input, output, { tableName }) {\n await input.table(tableName).onChange(async (obj, oldObj) => {\n const res = obj && obj.state == 'new' ? { ...obj, id: obj.service + '_' + obj.id } : null\n const oldRes = oldObj && oldObj.state == 'new' ? { ...oldObj, id: oldObj.service + '_' + oldObj.id } : null\n //output.debug(\"CHANGE \", tableName, \"INDEX\", res, \"OLD:\", oldRes)\n await output.change(res, oldRes)\n })\n })",
998
+ "parameters": {
999
+ "tableName": "triggers"
1000
+ },
1001
+ "uid": "b4222a8473ef0282",
1002
+ "sources": [
1003
+ {
1004
+ "type": "table",
1005
+ "name": "triggers"
1006
+ }
1007
+ ]
1008
+ },
1009
+ "security_relations_eventTypeAndKeys": {
1010
+ "code": "(async function(input, output, { table }) {\n const mapper = (obj) => ({ id: obj.eventType+'_'+obj.keys+'_'+obj.id, to: obj.id })\n await input.table(table).onChange((obj, oldObj) =>\n output.change(obj && mapper(obj), oldObj && mapper(oldObj)) )\n })",
1011
+ "parameters": {
1012
+ "table": "security_relations"
1013
+ },
1014
+ "uid": "a9de628f97deca3d",
1015
+ "sources": [
1016
+ {
1017
+ "type": "table",
1018
+ "name": "security_relations"
1019
+ }
1020
+ ]
1021
+ },
1022
+ "security_relations_sourceRelation": {
1023
+ "code": "(async function(input, output, { table }) {\n const mapper = (obj) => ({ id: obj.source+'_'+obj.relation+'_'+obj.id, to: obj.id })\n await input.table(table).onChange((obj, oldObj) =>\n output.change(obj && mapper(obj), oldObj && mapper(oldObj)) )\n })",
1024
+ "parameters": {
1025
+ "table": "security_relations"
1026
+ },
1027
+ "uid": "85bb65338bb7d141",
1028
+ "sources": [
1029
+ {
1030
+ "type": "table",
1031
+ "name": "security_relations"
1032
+ }
1033
+ ]
1034
+ }
1035
+ },
1036
+ "logs": {
1037
+ "events": {
1038
+ "uid": "01ecfc76b5783ed3"
1039
+ }
1040
+ },
1041
+ "storage": {
1042
+ "noMetaSync": true,
1043
+ "noSync": true
1044
+ }
1045
+ }
1046
+ },
1047
+ "timestamp": 1712818290386
1048
+ }