@dxos/plugin-debug 0.8.4-main.ae835ea → 0.8.4-main.bc674ce

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 (116) hide show
  1. package/dist/lib/browser/DebugGraph-6VMEOKEV.mjs +15 -0
  2. package/dist/lib/browser/DebugGraph-6VMEOKEV.mjs.map +7 -0
  3. package/dist/lib/browser/DevtoolsOverviewContainer-77PKFLYV.mjs +19 -0
  4. package/dist/lib/browser/DevtoolsOverviewContainer-77PKFLYV.mjs.map +7 -0
  5. package/dist/lib/browser/{SpaceGenerator-7Q7CX64P.mjs → SpaceGenerator-H33AEFGC.mjs} +226 -233
  6. package/dist/lib/browser/SpaceGenerator-H33AEFGC.mjs.map +7 -0
  7. package/dist/lib/browser/app-graph-builder-LV73R7HR.mjs +598 -0
  8. package/dist/lib/browser/app-graph-builder-LV73R7HR.mjs.map +7 -0
  9. package/dist/lib/browser/{chunk-SRV2AIGJ.mjs → chunk-4UFQXPP7.mjs} +11 -1
  10. package/dist/lib/browser/chunk-4UFQXPP7.mjs.map +7 -0
  11. package/dist/lib/browser/{chunk-WZFZ4ESO.mjs → chunk-A5H5GRV6.mjs} +1 -1
  12. package/dist/lib/browser/chunk-A5H5GRV6.mjs.map +7 -0
  13. package/dist/lib/browser/index.mjs +34 -39
  14. package/dist/lib/browser/index.mjs.map +4 -4
  15. package/dist/lib/browser/meta.json +1 -1
  16. package/dist/lib/browser/react-context-FSWBT3MH.mjs +17 -0
  17. package/dist/lib/browser/react-context-FSWBT3MH.mjs.map +7 -0
  18. package/dist/lib/browser/react-surface-2N6CPSHR.mjs +757 -0
  19. package/dist/lib/browser/react-surface-2N6CPSHR.mjs.map +7 -0
  20. package/dist/lib/browser/settings-KA4GN73K.mjs +31 -0
  21. package/dist/lib/browser/settings-KA4GN73K.mjs.map +7 -0
  22. package/dist/types/src/DebugPlugin.d.ts +2 -1
  23. package/dist/types/src/DebugPlugin.d.ts.map +1 -1
  24. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +6 -0
  25. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
  26. package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
  27. package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
  28. package/dist/types/src/capabilities/index.d.ts +4 -8
  29. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  30. package/dist/types/src/capabilities/react-context/index.d.ts +7 -0
  31. package/dist/types/src/capabilities/react-context/index.d.ts.map +1 -0
  32. package/dist/types/src/capabilities/react-context/react-context.d.ts +10 -0
  33. package/dist/types/src/capabilities/react-context/react-context.d.ts.map +1 -0
  34. package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
  35. package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
  36. package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
  37. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
  38. package/dist/types/src/capabilities/settings/index.d.ts +3 -0
  39. package/dist/types/src/capabilities/settings/index.d.ts.map +1 -0
  40. package/dist/types/src/capabilities/settings/settings.d.ts +5 -0
  41. package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -0
  42. package/dist/types/src/components/DebugGraph.d.ts +5 -4
  43. package/dist/types/src/components/DebugGraph.d.ts.map +1 -1
  44. package/dist/types/src/components/DebugObjectPanel.d.ts +1 -1
  45. package/dist/types/src/components/DebugObjectPanel.d.ts.map +1 -1
  46. package/dist/types/src/components/DebugSettings.d.ts +4 -2
  47. package/dist/types/src/components/DebugSettings.d.ts.map +1 -1
  48. package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts +5 -5
  49. package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts.map +1 -1
  50. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts +2 -2
  51. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts.map +1 -1
  52. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts.map +1 -1
  53. package/dist/types/src/components/SpaceGenerator/presets.d.ts +2 -5
  54. package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -1
  55. package/dist/types/src/components/Wireframe.d.ts +2 -2
  56. package/dist/types/src/components/Wireframe.d.ts.map +1 -1
  57. package/dist/types/src/components/index.d.ts +4 -4
  58. package/dist/types/src/components/index.d.ts.map +1 -1
  59. package/dist/types/src/meta.d.ts +2 -2
  60. package/dist/types/src/meta.d.ts.map +1 -1
  61. package/dist/types/src/translations.d.ts +1 -1
  62. package/dist/types/src/types.d.ts +5 -0
  63. package/dist/types/src/types.d.ts.map +1 -1
  64. package/dist/types/tsconfig.tsbuildinfo +1 -1
  65. package/package.json +76 -70
  66. package/src/DebugPlugin.tsx +16 -31
  67. package/src/capabilities/app-graph-builder/app-graph-builder.ts +420 -0
  68. package/src/capabilities/app-graph-builder/index.ts +7 -0
  69. package/src/capabilities/index.ts +4 -6
  70. package/src/capabilities/react-context/index.ts +7 -0
  71. package/src/capabilities/react-context/react-context.tsx +20 -0
  72. package/src/capabilities/react-surface/index.ts +7 -0
  73. package/src/capabilities/react-surface/react-surface.tsx +409 -0
  74. package/src/capabilities/settings/index.ts +7 -0
  75. package/src/capabilities/settings/settings.ts +30 -0
  76. package/src/components/DebugGraph.tsx +4 -3
  77. package/src/components/DebugObjectPanel.tsx +4 -4
  78. package/src/components/DebugSettings.tsx +44 -18
  79. package/src/components/DevtoolsOverviewContainer.tsx +1 -1
  80. package/src/components/SpaceGenerator/ObjectGenerator.tsx +18 -19
  81. package/src/components/SpaceGenerator/SchemaTable.tsx +2 -2
  82. package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +7 -5
  83. package/src/components/SpaceGenerator/SpaceGenerator.tsx +18 -13
  84. package/src/components/SpaceGenerator/presets.ts +217 -100
  85. package/src/components/Wireframe.tsx +4 -5
  86. package/src/components/index.ts +4 -1
  87. package/src/meta.ts +2 -2
  88. package/src/translations.ts +1 -1
  89. package/src/types.ts +8 -0
  90. package/dist/lib/browser/DebugGraph-EDOH6R2G.mjs +0 -20
  91. package/dist/lib/browser/DebugGraph-EDOH6R2G.mjs.map +0 -7
  92. package/dist/lib/browser/DevtoolsOverviewContainer-EPD6EWT5.mjs +0 -25
  93. package/dist/lib/browser/DevtoolsOverviewContainer-EPD6EWT5.mjs.map +0 -7
  94. package/dist/lib/browser/SpaceGenerator-7Q7CX64P.mjs.map +0 -7
  95. package/dist/lib/browser/app-graph-builder-RXWTHLEW.mjs +0 -588
  96. package/dist/lib/browser/app-graph-builder-RXWTHLEW.mjs.map +0 -7
  97. package/dist/lib/browser/chunk-SRV2AIGJ.mjs.map +0 -7
  98. package/dist/lib/browser/chunk-WZFZ4ESO.mjs.map +0 -7
  99. package/dist/lib/browser/react-context-P2YDWEWI.mjs +0 -16
  100. package/dist/lib/browser/react-context-P2YDWEWI.mjs.map +0 -7
  101. package/dist/lib/browser/react-surface-4XGZUT3Z.mjs +0 -772
  102. package/dist/lib/browser/react-surface-4XGZUT3Z.mjs.map +0 -7
  103. package/dist/lib/browser/settings-SQXR3OAH.mjs +0 -22
  104. package/dist/lib/browser/settings-SQXR3OAH.mjs.map +0 -7
  105. package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
  106. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
  107. package/dist/types/src/capabilities/react-context.d.ts +0 -8
  108. package/dist/types/src/capabilities/react-context.d.ts.map +0 -1
  109. package/dist/types/src/capabilities/react-surface.d.ts +0 -4
  110. package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
  111. package/dist/types/src/capabilities/settings.d.ts +0 -4
  112. package/dist/types/src/capabilities/settings.d.ts.map +0 -1
  113. package/src/capabilities/app-graph-builder.ts +0 -431
  114. package/src/capabilities/react-context.tsx +0 -16
  115. package/src/capabilities/react-surface.tsx +0 -399
  116. package/src/capabilities/settings.ts +0 -19
@@ -1,54 +1,53 @@
1
1
  // src/components/SpaceGenerator/SpaceGenerator.tsx
2
- import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
3
2
  import React2, { useCallback, useMemo, useState } from "react";
4
- import { useIntentDispatcher } from "@dxos/app-framework";
3
+ import { useOperationInvoker } from "@dxos/app-framework/react";
5
4
  import { ComputeGraph as ComputeGraph2 } from "@dxos/conductor";
6
- import { Filter as Filter3 } from "@dxos/echo";
5
+ import { Filter as Filter3, Obj as Obj2 } from "@dxos/echo";
7
6
  import { Markdown as Markdown3 } from "@dxos/plugin-markdown/types";
8
7
  import { Sheet as Sheet2 } from "@dxos/plugin-sheet/types";
9
8
  import { Diagram as Diagram2 } from "@dxos/plugin-sketch/types";
10
9
  import { useClient } from "@dxos/react-client";
11
- import { getTypename } from "@dxos/react-client/echo";
12
10
  import { IconButton as IconButton2, Input, Toolbar, useAsyncEffect } from "@dxos/react-ui";
13
11
  import { SyntaxHighlighter } from "@dxos/react-ui-syntax-highlighter";
14
- import { DataType as DataType3 } from "@dxos/schema";
12
+ import { Organization as Organization2, Person as Person2, Task } from "@dxos/types";
15
13
  import { jsonKeyReplacer, sortKeys } from "@dxos/util";
16
14
 
17
15
  // src/components/SpaceGenerator/ObjectGenerator.tsx
18
- import { createIntent } from "@dxos/app-framework";
19
16
  import { addressToA1Notation } from "@dxos/compute";
20
17
  import { ComputeGraph, ComputeGraphModel, DEFAULT_OUTPUT, NODE_INPUT, NODE_OUTPUT } from "@dxos/conductor";
21
- import { DXN, Filter, Key, Type } from "@dxos/echo";
18
+ import { DXN, Filter, Key } from "@dxos/echo";
22
19
  import { Markdown } from "@dxos/plugin-markdown/types";
23
20
  import { Sheet } from "@dxos/plugin-sheet/types";
24
21
  import { Diagram } from "@dxos/plugin-sketch/types";
25
- import { SpaceAction } from "@dxos/plugin-space/types";
22
+ import { SpaceOperation } from "@dxos/plugin-space/types";
26
23
  import { faker } from "@dxos/random";
27
- import { DataType, getTypenameFromQuery } from "@dxos/schema";
24
+ import { View, getTypenameFromQuery } from "@dxos/schema";
28
25
  import { createAsyncGenerator } from "@dxos/schema/testing";
29
26
  import { range } from "@dxos/util";
30
27
  var generator = faker;
31
28
  var findViewByTypename = async (views, typename) => {
32
29
  return views.find((view) => getTypenameFromQuery(view.query.ast) === typename);
33
30
  };
34
- var createGenerator = (client, dispatch, schema) => {
31
+ var createGenerator = (client, invokePromise, schema) => {
35
32
  return async (space, n) => {
36
33
  const typename = schema.typename;
37
- const { objects: views } = await space.db.query(Filter.type(DataType.View)).run();
34
+ const views = await space.db.query(Filter.type(View.View)).run();
38
35
  const view = await findViewByTypename(views, typename);
39
- const staticSchema = client?.graph.schemaRegistry.schemas.find((schema2) => Type.getTypename(schema2) === typename);
36
+ const staticSchema = client?.graph.schemaRegistry.query({
37
+ typename
38
+ }).runSync()[0];
40
39
  if (!view && !staticSchema) {
41
- await dispatch(createIntent(SpaceAction.AddSchema, {
42
- space,
40
+ await invokePromise(SpaceOperation.AddSchema, {
41
+ db: space.db,
43
42
  schema,
44
43
  show: false
45
- }));
44
+ });
46
45
  } else if (!view && staticSchema) {
47
- await dispatch(createIntent(SpaceAction.UseStaticSchema, {
48
- space,
46
+ await invokePromise(SpaceOperation.UseStaticSchema, {
47
+ db: space.db,
49
48
  typename,
50
49
  show: false
51
- }));
50
+ });
52
51
  }
53
52
  const generate = createAsyncGenerator(generator, schema, {
54
53
  db: space.db
@@ -61,7 +60,7 @@ var staticGenerators = /* @__PURE__ */ new Map([
61
60
  Markdown.Document.typename,
62
61
  async (space, n, cb) => {
63
62
  const objects = range(n).map(() => {
64
- return space.db.add(Markdown.makeDocument({
63
+ return space.db.add(Markdown.make({
65
64
  name: faker.commerce.productName(),
66
65
  content: faker.lorem.sentences(5)
67
66
  }));
@@ -199,15 +198,16 @@ import * as Schema from "effect/Schema";
199
198
  import { Agent, EntityExtraction, ResearchBlueprint } from "@dxos/assistant-toolkit";
200
199
  import { Prompt } from "@dxos/blueprints";
201
200
  import { NODE_INPUT as NODE_INPUT2 } from "@dxos/conductor";
202
- import { DXN as DXN2, Filter as Filter2, Key as Key2, Obj, Query, Ref, Tag, Type as Type2 } from "@dxos/echo";
201
+ import { DXN as DXN2, Filter as Filter2, Key as Key2, Obj, Query, Ref, Tag, Type } from "@dxos/echo";
203
202
  import { Trigger, serializeFunction } from "@dxos/functions";
204
203
  import { invariant } from "@dxos/invariant";
205
- import { sync } from "@dxos/plugin-inbox";
204
+ import { gmail } from "@dxos/plugin-inbox";
206
205
  import { Mailbox } from "@dxos/plugin-inbox/types";
207
206
  import { Markdown as Markdown2 } from "@dxos/plugin-markdown/types";
208
207
  import { createAppend, createChat, createComputeGraph, createConstant, createFunction, createGpt, createQueue, createRandom, createSurface, createTemplate, createText, createTrigger } from "@dxos/react-ui-canvas-compute";
209
208
  import { CanvasBoardType, CanvasGraphModel, pointMultiply, pointsToRect, rectToPoints } from "@dxos/react-ui-canvas-editor";
210
- import { DataType as DataType2, createView } from "@dxos/schema";
209
+ import { View as View2 } from "@dxos/schema";
210
+ import { Message, Organization, Person, Project } from "@dxos/types";
211
211
  import { range as range2, trim } from "@dxos/util";
212
212
  var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-debug/src/components/SpaceGenerator/presets.ts";
213
213
  var PresetName = /* @__PURE__ */ (function(PresetName2) {
@@ -216,8 +216,8 @@ var PresetName = /* @__PURE__ */ (function(PresetName2) {
216
216
  PresetName2["GPT_QUEUE"] = "webhook-gpt-queue";
217
217
  PresetName2["CHAT_GPT"] = "chat-gpt-text";
218
218
  PresetName2["OBJECT_CHANGE_QUEUE"] = "objectChange-queue";
219
- PresetName2["FOREX_FUNCTION_CALL"] = "forex-function-call";
220
219
  PresetName2["TIMER_TICK_QUEUE"] = "timerTick-queue";
220
+ PresetName2["FOREX_FUNCTION_CALL"] = "forex-function-call";
221
221
  PresetName2["DISCORD_MESSAGES"] = "discord-messages";
222
222
  return PresetName2;
223
223
  })({});
@@ -234,22 +234,24 @@ var generator2 = () => ({
234
234
  "dxos-team",
235
235
  async (space, n, cb) => {
236
236
  const objects = range2(n, () => {
237
- const tag = space.db.add(Tag.make({
238
- label: "Investor"
239
- }));
240
- const tagDxn = Obj.getDXN(tag).toString();
241
- const org = space.db.add(Obj.make(DataType2.Organization, {
237
+ const org = space.db.add(Obj.make(Organization.Organization, {
242
238
  name: "DXOS",
243
239
  website: "https://dxos.org"
244
240
  }));
245
- const doc = space.db.add(Markdown2.makeDocument({
241
+ const doc = space.db.add(Markdown2.make({
246
242
  name: "DXOS Research",
247
243
  content: "DXOS builds Composer, an open-source AI-powered malleable application."
248
244
  }));
249
- Obj.getMeta(doc).tags = [
250
- tagDxn
251
- ];
252
- space.db.add(Obj.make(DataType2.Person, {
245
+ const tag = space.db.add(Tag.make({
246
+ label: "Investor"
247
+ }));
248
+ const tagDxn = Obj.getDXN(tag).toString();
249
+ Obj.change(doc, (d) => {
250
+ Obj.getMeta(d).tags = [
251
+ tagDxn
252
+ ];
253
+ });
254
+ space.db.add(Obj.make(Person.Person, {
253
255
  fullName: "Rich",
254
256
  organization: Ref.make(org)
255
257
  }, {
@@ -257,22 +259,18 @@ var generator2 = () => ({
257
259
  tagDxn
258
260
  ]
259
261
  }));
260
- space.db.add(Obj.make(DataType2.Person, {
262
+ space.db.add(Obj.make(Person.Person, {
261
263
  fullName: "Josiah",
262
264
  organization: Ref.make(org)
263
265
  }));
264
- space.db.add(Obj.make(DataType2.Person, {
266
+ space.db.add(Obj.make(Person.Person, {
265
267
  fullName: "Dima",
266
268
  organization: Ref.make(org)
267
269
  }));
268
- space.db.add(Obj.make(DataType2.Person, {
270
+ space.db.add(Obj.make(Person.Person, {
269
271
  fullName: "Mykola",
270
272
  organization: Ref.make(org)
271
273
  }));
272
- space.db.add(Obj.make(DataType2.Person, {
273
- fullName: "Will",
274
- organization: Ref.make(org)
275
- }));
276
274
  return doc;
277
275
  });
278
276
  cb?.(objects);
@@ -288,22 +286,21 @@ var generator2 = () => ({
288
286
  })).first();
289
287
  const tagDxn = Obj.getDXN(tag).toString();
290
288
  const objects = range2(n, () => {
291
- const contactsQuery = Query.select(Filter2.type(DataType2.Person)).select(Filter2.tag(tagDxn));
292
- const organizationsQuery = Query.select(Filter2.type(DataType2.Organization)).select(Filter2.tag(tagDxn));
289
+ const contactsQuery = Query.select(Filter2.type(Person.Person)).select(Filter2.tag(tagDxn));
290
+ const organizationsQuery = Query.select(Filter2.type(Organization.Organization)).select(Filter2.tag(tagDxn));
293
291
  const notesQuery = Query.select(Filter2.type(Markdown2.Document)).select(Filter2.tag(tagDxn));
294
- const emailSyncTrigger = Trigger.make({
292
+ space.db.add(Trigger.make({
295
293
  enabled: true,
296
294
  spec: {
297
295
  kind: "timer",
298
296
  cron: "* * * * *"
299
297
  },
300
- function: Ref.make(serializeFunction(sync)),
298
+ function: Ref.make(serializeFunction(gmail.sync)),
301
299
  input: {
302
300
  mailboxId: Obj.getDXN(mailbox).toString()
303
301
  }
304
- });
305
- space.db.add(emailSyncTrigger);
306
- const contactExtractionTrigger = Trigger.make({
302
+ }));
303
+ space.db.add(Trigger.make({
307
304
  enabled: true,
308
305
  // TODO(wittjosiah): Queue trigger doesn't support matching query of the column.
309
306
  spec: {
@@ -314,8 +311,7 @@ var generator2 = () => ({
314
311
  input: {
315
312
  source: "{{event.item}}"
316
313
  }
317
- });
318
- space.db.add(contactExtractionTrigger);
314
+ }));
319
315
  const researchPrompt = space.db.add(Prompt.make({
320
316
  name: "Research",
321
317
  description: "Research organization",
@@ -334,7 +330,7 @@ var generator2 = () => ({
334
330
  Ref.make(ResearchBlueprint)
335
331
  ]
336
332
  }));
337
- const researchTrigger = Trigger.make({
333
+ space.db.add(Trigger.make({
338
334
  enabled: true,
339
335
  spec: {
340
336
  kind: "subscription",
@@ -347,11 +343,9 @@ var generator2 = () => ({
347
343
  prompt: Ref.make(researchPrompt),
348
344
  input: "{{event.subject}}"
349
345
  }
350
- });
351
- space.db.add(researchTrigger);
352
- const mailboxView = createView({
353
- name: "Mailbox",
354
- query: Query.select(Filter2.type(DataType2.Message, {
346
+ }));
347
+ const mailboxView = View2.make({
348
+ query: Query.select(Filter2.type(Message.Message, {
355
349
  properties: {
356
350
  labels: Filter2.contains("investor")
357
351
  }
@@ -360,43 +354,44 @@ var generator2 = () => ({
360
354
  mailbox.queue.dxn.toString()
361
355
  ]
362
356
  }),
363
- jsonSchema: Type2.toJsonSchema(DataType2.Message),
364
- presentation: Obj.make(DataType2.Collection, {
365
- objects: []
366
- })
357
+ jsonSchema: Type.toJsonSchema(Message.Message)
367
358
  });
368
- const contactsView = createView({
369
- name: "Contacts",
359
+ const contactsView = View2.make({
370
360
  query: contactsQuery,
371
- jsonSchema: Type2.toJsonSchema(DataType2.Person),
372
- presentation: Obj.make(DataType2.Collection, {
373
- objects: []
374
- })
361
+ jsonSchema: Type.toJsonSchema(Person.Person)
375
362
  });
376
- const organizationsView = createView({
377
- name: "Organizations",
363
+ const organizationsView = View2.make({
378
364
  query: organizationsQuery,
379
- jsonSchema: Type2.toJsonSchema(DataType2.Organization),
380
- presentation: Obj.make(DataType2.Collection, {
381
- objects: []
382
- })
365
+ jsonSchema: Type.toJsonSchema(Organization.Organization)
383
366
  });
384
- const notesView = createView({
385
- name: "Notes",
367
+ const notesView = View2.make({
386
368
  query: notesQuery,
387
- jsonSchema: Type2.toJsonSchema(Markdown2.Document),
388
- presentation: Obj.make(DataType2.Collection, {
389
- objects: []
390
- })
369
+ jsonSchema: Type.toJsonSchema(Markdown2.Document)
391
370
  });
392
- return space.db.add(DataType2.makeProject({
371
+ return space.db.add(Project.make({
393
372
  name: "Investor Research",
394
- collections: [
395
- mailboxView,
396
- contactsView,
397
- organizationsView,
398
- notesView
399
- ].map((view) => Ref.make(view))
373
+ columns: [
374
+ {
375
+ name: "Mailbox",
376
+ view: Ref.make(mailboxView),
377
+ order: []
378
+ },
379
+ {
380
+ name: "Contacts",
381
+ view: Ref.make(contactsView),
382
+ order: []
383
+ },
384
+ {
385
+ name: "Organizations",
386
+ view: Ref.make(organizationsView),
387
+ order: []
388
+ },
389
+ {
390
+ name: "Notes",
391
+ view: Ref.make(notesView),
392
+ order: []
393
+ }
394
+ ]
400
395
  }));
401
396
  });
402
397
  cb?.(objects.flat());
@@ -867,20 +862,22 @@ var createQueueSinkPreset = (space, triggerKind, initSpec, triggerOutputName) =>
867
862
  const triggerSpec = functionTrigger.spec;
868
863
  invariant(triggerSpec && triggerSpec.kind === triggerKind, "No trigger spec.", {
869
864
  F: __dxlog_file,
870
- L: 661,
865
+ L: 762,
871
866
  S: void 0,
872
867
  A: [
873
868
  "triggerSpec && triggerSpec.kind === triggerKind",
874
869
  "'No trigger spec.'"
875
870
  ]
876
871
  });
877
- initSpec(triggerSpec);
872
+ Obj.change(functionTrigger, (ft) => {
873
+ initSpec(ft.spec);
874
+ });
878
875
  });
879
876
  const computeModel = createComputeGraph(canvasModel);
880
877
  const templateComputeNode = computeModel.nodes.find((n) => n.id === template.node);
881
878
  invariant(templateComputeNode, "Template compute node was not created.", {
882
879
  F: __dxlog_file,
883
- L: 668,
880
+ L: 771,
884
881
  S: void 0,
885
882
  A: [
886
883
  "templateComputeNode",
@@ -893,7 +890,7 @@ var createQueueSinkPreset = (space, triggerKind, initSpec, triggerOutputName) =>
893
890
  ' "id": "@{{changeId}}"',
894
891
  "}"
895
892
  ].join("\n");
896
- templateComputeNode.inputSchema = Type2.toJsonSchema(Schema.Struct({
893
+ templateComputeNode.inputSchema = Type.toJsonSchema(Schema.Struct({
897
894
  type: Schema.String,
898
895
  changeId: Schema.String
899
896
  }));
@@ -942,16 +939,18 @@ var setupQueue = (space, canvasModel, args) => {
942
939
  var attachTrigger = (functionTrigger, computeModel) => {
943
940
  invariant(functionTrigger, void 0, {
944
941
  F: __dxlog_file,
945
- L: 707,
942
+ L: 811,
946
943
  S: void 0,
947
944
  A: [
948
945
  "functionTrigger",
949
946
  ""
950
947
  ]
951
948
  });
952
- functionTrigger.function = Ref.make(computeModel.root);
953
949
  const inputNode = computeModel.nodes.find((node) => node.type === NODE_INPUT2);
954
- functionTrigger.inputNodeId = inputNode.id;
950
+ Obj.change(functionTrigger, (t) => {
951
+ t.function = Ref.make(computeModel.root);
952
+ t.inputNodeId = inputNode.id;
953
+ });
955
954
  };
956
955
  var rawPosition = (args) => {
957
956
  return {
@@ -998,157 +997,151 @@ var position = (rect) => {
998
997
  };
999
998
 
1000
999
  // src/components/SpaceGenerator/SchemaTable.tsx
1001
- import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
1002
1000
  import React from "react";
1003
1001
  import { IconButton } from "@dxos/react-ui";
1004
1002
  var SchemaTable = ({ types, objects = {}, label, onClick }) => {
1005
- var _effect = _useSignals();
1006
- try {
1007
- return /* @__PURE__ */ React.createElement("div", {
1008
- className: "grid grid-cols-[1fr_80px_40px] gap-1 overflow-none"
1009
- }, /* @__PURE__ */ React.createElement("h2", {
1010
- className: "p-2"
1011
- }, label), types.map((type) => /* @__PURE__ */ React.createElement("div", {
1012
- key: type.typename,
1013
- className: "grid grid-cols-subgrid col-span-3 items-center"
1014
- }, /* @__PURE__ */ React.createElement("div", {
1015
- className: "px-2 text-sm font-mono text-subdued"
1016
- }, type.typename), /* @__PURE__ */ React.createElement("div", {
1017
- className: "px-2 text-right font-mono"
1018
- }, objects[type.typename] ?? 0), /* @__PURE__ */ React.createElement(IconButton, {
1019
- variant: "ghost",
1020
- icon: "ph--plus--regular",
1021
- iconOnly: true,
1022
- label: "Create data",
1023
- onClick: () => onClick(type.typename)
1024
- }))));
1025
- } finally {
1026
- _effect.f();
1027
- }
1003
+ return /* @__PURE__ */ React.createElement("div", {
1004
+ className: "grid grid-cols-[1fr_80px_40px] gap-1 overflow-none"
1005
+ }, /* @__PURE__ */ React.createElement("h2", {
1006
+ className: "p-2"
1007
+ }, label), types.map((type) => /* @__PURE__ */ React.createElement("div", {
1008
+ key: type.typename,
1009
+ className: "grid grid-cols-subgrid col-span-3 items-center"
1010
+ }, /* @__PURE__ */ React.createElement("div", {
1011
+ className: "pli-2 text-sm font-mono text-subdued"
1012
+ }, type.typename), /* @__PURE__ */ React.createElement("div", {
1013
+ className: "pli-2 text-right font-mono"
1014
+ }, objects[type.typename] ?? 0), /* @__PURE__ */ React.createElement(IconButton, {
1015
+ variant: "ghost",
1016
+ icon: "ph--plus--regular",
1017
+ iconOnly: true,
1018
+ label: "Create data",
1019
+ onClick: () => onClick(type.typename)
1020
+ }))));
1028
1021
  };
1029
1022
 
1030
1023
  // src/components/SpaceGenerator/SpaceGenerator.tsx
1031
1024
  var SpaceGenerator = ({ space, onCreateObjects }) => {
1032
- var _effect = _useSignals2();
1033
- try {
1034
- const { dispatchPromise: dispatch } = useIntentDispatcher();
1035
- const client = useClient();
1036
- const staticTypes = [
1037
- Markdown3.Document,
1038
- Diagram2.Diagram,
1039
- Sheet2.Sheet,
1040
- ComputeGraph2
1041
- ];
1042
- const recordTypes = [
1043
- DataType3.Organization,
1044
- DataType3.Person,
1045
- DataType3.Task
1046
- ];
1047
- const [count, setCount] = useState(1);
1048
- const [info, setInfo] = useState({});
1049
- const presets = useMemo(() => generator2(), []);
1050
- const typeMap = useMemo(() => {
1051
- client.addTypes([
1052
- ...staticTypes,
1053
- ...recordTypes,
1054
- ...presets.schemas
1055
- ]);
1056
- const recordGenerators = new Map(recordTypes.map((type) => [
1057
- type.typename,
1058
- createGenerator(client, dispatch, type)
1059
- ]));
1060
- return new Map([
1061
- ...staticGenerators,
1062
- ...presets.items,
1063
- ...recordGenerators
1064
- ]);
1065
- }, [
1066
- client,
1067
- recordTypes
1025
+ const { invokePromise } = useOperationInvoker();
1026
+ const client = useClient();
1027
+ const staticTypes = [
1028
+ Markdown3.Document,
1029
+ Diagram2.Diagram,
1030
+ Sheet2.Sheet,
1031
+ ComputeGraph2
1032
+ ];
1033
+ const recordTypes = [
1034
+ Organization2.Organization,
1035
+ Person2.Person,
1036
+ Task.Task
1037
+ ];
1038
+ const [count, setCount] = useState(1);
1039
+ const [info, setInfo] = useState({});
1040
+ const presets = useMemo(() => generator2(), []);
1041
+ useAsyncEffect(async () => {
1042
+ await client.addTypes([
1043
+ ...staticTypes,
1044
+ ...recordTypes,
1045
+ ...presets.schemas
1068
1046
  ]);
1069
- const updateInfo = async () => {
1070
- const echoSchema = await space.db.schemaRegistry.query().run();
1071
- const staticSchema = space.db.graph.schemaRegistry.schemas;
1072
- const { objects } = await space.db.query(Filter3.everything()).run();
1073
- const objectMap = sortKeys(objects.reduce((map, obj) => {
1074
- const type = getTypename(obj);
1075
- if (type) {
1076
- const count2 = map[type] ?? 0;
1077
- map[type] = count2 + 1;
1078
- }
1079
- return map;
1080
- }, {}));
1081
- setInfo({
1082
- schema: {
1083
- static: staticSchema.length,
1084
- mutable: echoSchema.length
1085
- },
1086
- objects: objectMap
1087
- });
1088
- };
1089
- useAsyncEffect(updateInfo, [
1090
- space
1047
+ }, [
1048
+ client
1049
+ ]);
1050
+ const typeMap = useMemo(() => {
1051
+ const recordGenerators = new Map(recordTypes.map((type) => [
1052
+ type.typename,
1053
+ createGenerator(client, invokePromise, type)
1054
+ ]));
1055
+ return new Map([
1056
+ ...staticGenerators,
1057
+ ...presets.items,
1058
+ ...recordGenerators
1091
1059
  ]);
1092
- const handleCreateData = useCallback(async (typename) => {
1093
- const constructor = typeMap.get(typename);
1094
- if (constructor) {
1095
- await constructor(space, count, onCreateObjects);
1096
- await updateInfo();
1060
+ }, [
1061
+ client,
1062
+ recordTypes,
1063
+ invokePromise
1064
+ ]);
1065
+ const updateInfo = async () => {
1066
+ const echoSchema = await space.db.schemaRegistry.query().run();
1067
+ const staticSchema = await space.db.graph.schemaRegistry.query().run();
1068
+ const objects = await space.db.query(Filter3.everything()).run();
1069
+ const objectMap = sortKeys(objects.reduce((map, obj) => {
1070
+ const type = Obj2.getTypename(obj);
1071
+ if (type) {
1072
+ const count2 = map[type] ?? 0;
1073
+ map[type] = count2 + 1;
1097
1074
  }
1098
- }, [
1099
- typeMap,
1100
- count
1101
- ]);
1102
- return /* @__PURE__ */ React2.createElement("div", {
1103
- role: "none",
1104
- className: "flex flex-col grow overflow-hidden"
1105
- }, /* @__PURE__ */ React2.createElement(Toolbar.Root, {
1106
- classNames: "border-be border-subduedSeparator"
1107
- }, /* @__PURE__ */ React2.createElement(IconButton2, {
1108
- icon: "ph--arrow-clockwise--regular",
1109
- iconOnly: true,
1110
- label: "Refresh",
1111
- onClick: updateInfo
1112
- }), /* @__PURE__ */ React2.createElement(Toolbar.Separator, {
1113
- variant: "gap"
1114
- }), /* @__PURE__ */ React2.createElement(Input.Root, null, /* @__PURE__ */ React2.createElement(Input.TextInput, {
1115
- type: "number",
1116
- min: 1,
1117
- max: 100,
1118
- placeholder: "Count",
1119
- classNames: "!w-[4rem] !text-right",
1120
- size: 8,
1121
- value: count,
1122
- onChange: (ev) => setCount(parseInt(ev.target.value))
1123
- }))), /* @__PURE__ */ React2.createElement("div", {
1124
- className: "flex flex-col overflow-y-auto divide-y divide-separator"
1125
- }, /* @__PURE__ */ React2.createElement(SchemaTable, {
1126
- types: staticTypes,
1127
- objects: info.objects,
1128
- label: "Static Types",
1129
- onClick: handleCreateData
1130
- }), /* @__PURE__ */ React2.createElement(SchemaTable, {
1131
- types: recordTypes,
1132
- objects: info.objects,
1133
- label: "Record Types",
1134
- onClick: handleCreateData
1135
- }), /* @__PURE__ */ React2.createElement(SchemaTable, {
1136
- types: presets.types,
1137
- objects: info.objects,
1138
- label: "Presets",
1139
- onClick: handleCreateData
1140
- }), /* @__PURE__ */ React2.createElement("div", null, /* @__PURE__ */ React2.createElement(SyntaxHighlighter, {
1141
- language: "json",
1142
- classNames: "text-xs"
1143
- }, JSON.stringify({
1144
- space,
1145
- ...info
1146
- }, jsonKeyReplacer({
1147
- truncate: true
1148
- }), 2)))));
1149
- } finally {
1150
- _effect.f();
1151
- }
1075
+ return map;
1076
+ }, {}));
1077
+ setInfo({
1078
+ schema: {
1079
+ static: staticSchema.length,
1080
+ mutable: echoSchema.length
1081
+ },
1082
+ objects: objectMap
1083
+ });
1084
+ };
1085
+ useAsyncEffect(updateInfo, [
1086
+ space
1087
+ ]);
1088
+ const handleCreateData = useCallback(async (typename) => {
1089
+ const constructor = typeMap.get(typename);
1090
+ if (constructor) {
1091
+ await constructor(space, count, onCreateObjects);
1092
+ await updateInfo();
1093
+ }
1094
+ }, [
1095
+ typeMap,
1096
+ count
1097
+ ]);
1098
+ return /* @__PURE__ */ React2.createElement("div", {
1099
+ role: "none",
1100
+ className: "flex flex-col grow overflow-hidden"
1101
+ }, /* @__PURE__ */ React2.createElement(Toolbar.Root, {
1102
+ classNames: "border-be border-subduedSeparator"
1103
+ }, /* @__PURE__ */ React2.createElement(IconButton2, {
1104
+ icon: "ph--arrow-clockwise--regular",
1105
+ iconOnly: true,
1106
+ label: "Refresh",
1107
+ onClick: updateInfo
1108
+ }), /* @__PURE__ */ React2.createElement(Toolbar.Separator, {
1109
+ variant: "gap"
1110
+ }), /* @__PURE__ */ React2.createElement(Input.Root, null, /* @__PURE__ */ React2.createElement(Input.TextInput, {
1111
+ type: "number",
1112
+ min: 1,
1113
+ max: 100,
1114
+ placeholder: "Count",
1115
+ classNames: "!w-[4rem] !text-right",
1116
+ size: 8,
1117
+ value: count,
1118
+ onChange: (ev) => setCount(parseInt(ev.target.value))
1119
+ }))), /* @__PURE__ */ React2.createElement("div", {
1120
+ className: "flex flex-col overflow-y-auto divide-y divide-separator"
1121
+ }, /* @__PURE__ */ React2.createElement(SchemaTable, {
1122
+ types: staticTypes,
1123
+ objects: info.objects,
1124
+ label: "Static Types",
1125
+ onClick: handleCreateData
1126
+ }), /* @__PURE__ */ React2.createElement(SchemaTable, {
1127
+ types: recordTypes,
1128
+ objects: info.objects,
1129
+ label: "Record Types",
1130
+ onClick: handleCreateData
1131
+ }), /* @__PURE__ */ React2.createElement(SchemaTable, {
1132
+ types: presets.types,
1133
+ objects: info.objects,
1134
+ label: "Presets",
1135
+ onClick: handleCreateData
1136
+ }), /* @__PURE__ */ React2.createElement("div", null, /* @__PURE__ */ React2.createElement(SyntaxHighlighter, {
1137
+ language: "json",
1138
+ classNames: "text-xs"
1139
+ }, JSON.stringify({
1140
+ space,
1141
+ ...info
1142
+ }, jsonKeyReplacer({
1143
+ truncate: true
1144
+ }), 2)))));
1152
1145
  };
1153
1146
 
1154
1147
  // src/components/SpaceGenerator/index.ts
@@ -1156,4 +1149,4 @@ var SpaceGenerator_default = SpaceGenerator;
1156
1149
  export {
1157
1150
  SpaceGenerator_default as default
1158
1151
  };
1159
- //# sourceMappingURL=SpaceGenerator-7Q7CX64P.mjs.map
1152
+ //# sourceMappingURL=SpaceGenerator-H33AEFGC.mjs.map