@dxos/plugin-debug 0.8.4-main.67995b8 → 0.8.4-main.c4373fc
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/dist/lib/browser/DebugGraph-EDOH6R2G.mjs +20 -0
- package/dist/lib/browser/DebugGraph-EDOH6R2G.mjs.map +7 -0
- package/dist/lib/browser/{SpaceGenerator-6ZOCEREN.mjs → SpaceGenerator-54FUIZIH.mjs} +239 -61
- package/dist/lib/browser/SpaceGenerator-54FUIZIH.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-SQXFD2BL.mjs → app-graph-builder-I4IHBKKN.mjs} +75 -84
- package/dist/lib/browser/app-graph-builder-I4IHBKKN.mjs.map +7 -0
- package/dist/lib/browser/{chunk-AJA6RYN3.mjs → chunk-SRV2AIGJ.mjs} +2 -2
- package/dist/lib/browser/chunk-SRV2AIGJ.mjs.map +7 -0
- package/dist/lib/browser/{chunk-5XPIRNQS.mjs → chunk-SVCKCXCL.mjs} +2 -4
- package/dist/lib/browser/chunk-SVCKCXCL.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +14 -13
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-context-NVAGLAJD.mjs → react-context-QLZE7VSQ.mjs} +6 -6
- package/dist/lib/browser/react-context-QLZE7VSQ.mjs.map +7 -0
- package/dist/lib/browser/{react-surface-CHHHE5CF.mjs → react-surface-BTWJ2I3F.mjs} +78 -74
- package/dist/lib/browser/react-surface-BTWJ2I3F.mjs.map +7 -0
- package/dist/lib/browser/{settings-LSSWLM5I.mjs → settings-EBVICEEW.mjs} +5 -5
- package/dist/lib/browser/{settings-LSSWLM5I.mjs.map → settings-EBVICEEW.mjs.map} +1 -1
- package/dist/types/src/DebugPlugin.d.ts +1 -1
- package/dist/types/src/DebugPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +5 -5
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-context.d.ts +2 -2
- package/dist/types/src/capabilities/react-surface.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings.d.ts +1 -1
- package/dist/types/src/components/DebugGraph.d.ts +8 -0
- package/dist/types/src/components/DebugGraph.d.ts.map +1 -0
- package/dist/types/src/components/DebugObjectPanel.d.ts.map +1 -1
- package/dist/types/src/components/DebugSettings.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts +1 -1
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts +13 -4
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/draw-util.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/presets.d.ts +4 -1
- package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -1
- package/dist/types/src/components/Wireframe.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +2 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +0 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +2 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +1 -1
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +67 -65
- package/src/DebugPlugin.tsx +6 -7
- package/src/capabilities/app-graph-builder.ts +63 -89
- package/src/capabilities/react-context.tsx +2 -2
- package/src/capabilities/react-surface.tsx +49 -47
- package/src/components/DebugGraph.tsx +14 -0
- package/src/components/DebugObjectPanel.tsx +2 -4
- package/src/components/DebugSettings.tsx +74 -66
- package/src/components/DebugStatus.tsx +2 -2
- package/src/components/SpaceGenerator/ObjectGenerator.tsx +9 -9
- package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +11 -11
- package/src/components/SpaceGenerator/SpaceGenerator.tsx +5 -5
- package/src/components/SpaceGenerator/draw-util.ts +5 -5
- package/src/components/SpaceGenerator/presets.ts +179 -12
- package/src/components/Wireframe.tsx +2 -1
- package/src/components/index.ts +1 -1
- package/src/meta.ts +1 -3
- package/src/translations.ts +2 -0
- package/src/types.ts +1 -1
- package/dist/lib/browser/DebugApp-ZDL4CPY5.mjs +0 -228
- package/dist/lib/browser/DebugApp-ZDL4CPY5.mjs.map +0 -7
- package/dist/lib/browser/SpaceGenerator-6ZOCEREN.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-SQXFD2BL.mjs.map +0 -7
- package/dist/lib/browser/chunk-5XPIRNQS.mjs.map +0 -7
- package/dist/lib/browser/chunk-AJA6RYN3.mjs.map +0 -7
- package/dist/lib/browser/react-context-NVAGLAJD.mjs.map +0 -7
- package/dist/lib/browser/react-surface-CHHHE5CF.mjs.map +0 -7
- package/dist/types/src/components/DebugApp/DebugApp.d.ts +0 -6
- package/dist/types/src/components/DebugApp/DebugApp.d.ts.map +0 -1
- package/dist/types/src/components/DebugApp/Tree.d.ts +0 -18
- package/dist/types/src/components/DebugApp/Tree.d.ts.map +0 -1
- package/dist/types/src/components/DebugApp/index.d.ts +0 -3
- package/dist/types/src/components/DebugApp/index.d.ts.map +0 -1
- package/src/components/DebugApp/DebugApp.tsx +0 -84
- package/src/components/DebugApp/Tree.tsx +0 -103
- package/src/components/DebugApp/index.ts +0 -7
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// src/components/DebugGraph.tsx
|
|
2
|
+
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { Tree } from "@dxos/devtools";
|
|
5
|
+
var DebugGraph = ({ graph, root }) => {
|
|
6
|
+
var _effect = _useSignals();
|
|
7
|
+
try {
|
|
8
|
+
return /* @__PURE__ */ React.createElement(Tree, {
|
|
9
|
+
data: graph.toJSON(root)
|
|
10
|
+
});
|
|
11
|
+
} finally {
|
|
12
|
+
_effect.f();
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
var DebugGraph_default = DebugGraph;
|
|
16
|
+
export {
|
|
17
|
+
DebugGraph,
|
|
18
|
+
DebugGraph_default as default
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=DebugGraph-EDOH6R2G.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/DebugGraph.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { type FC } from 'react';\n\nimport { Tree } from '@dxos/devtools';\nimport { type Graph } from '@dxos/plugin-graph';\n\nexport const DebugGraph: FC<{ graph: Graph; root: string }> = ({ graph, root }) => {\n return <Tree data={graph.toJSON(root)} />;\n};\n\nexport default DebugGraph;\n"],
|
|
5
|
+
"mappings": ";;AAIA,OAAOA,WAAwB;AAE/B,SAASC,YAAY;AAGd,IAAMC,aAAiD,CAAC,EAAEC,OAAOC,KAAI,MAAE;;;AAC5E,WAAO,sBAAA,cAACC,MAAAA;MAAKC,MAAMH,MAAMI,OAAOH,IAAAA;;;;;AAClC;AAEA,IAAA,qBAAeF;",
|
|
6
|
+
"names": ["React", "Tree", "DebugGraph", "graph", "root", "Tree", "data", "toJSON"]
|
|
7
|
+
}
|
|
@@ -3,15 +3,15 @@ import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking"
|
|
|
3
3
|
import React2, { useCallback, useMemo, useState } from "react";
|
|
4
4
|
import { useIntentDispatcher } from "@dxos/app-framework";
|
|
5
5
|
import { ComputeGraph as ComputeGraph2 } from "@dxos/conductor";
|
|
6
|
-
import { Filter as
|
|
7
|
-
import { Markdown as
|
|
6
|
+
import { Filter as Filter3 } from "@dxos/echo";
|
|
7
|
+
import { Markdown as Markdown3 } from "@dxos/plugin-markdown/types";
|
|
8
8
|
import { SheetType as SheetType2 } from "@dxos/plugin-sheet/types";
|
|
9
9
|
import { DiagramType as DiagramType2 } from "@dxos/plugin-sketch/types";
|
|
10
10
|
import { useClient } from "@dxos/react-client";
|
|
11
11
|
import { getTypename } from "@dxos/react-client/echo";
|
|
12
12
|
import { IconButton as IconButton2, Input, Toolbar, useAsyncEffect } from "@dxos/react-ui";
|
|
13
13
|
import { SyntaxHighlighter } from "@dxos/react-ui-syntax-highlighter";
|
|
14
|
-
import { DataType as
|
|
14
|
+
import { DataType as DataType3 } from "@dxos/schema";
|
|
15
15
|
import { jsonKeyReplacer, sortKeys } from "@dxos/util";
|
|
16
16
|
|
|
17
17
|
// src/components/SpaceGenerator/ObjectGenerator.tsx
|
|
@@ -25,15 +25,15 @@ import { SheetType } from "@dxos/plugin-sheet/types";
|
|
|
25
25
|
import { CanvasType, DiagramType } from "@dxos/plugin-sketch/types";
|
|
26
26
|
import { SpaceAction } from "@dxos/plugin-space/types";
|
|
27
27
|
import { faker } from "@dxos/random";
|
|
28
|
-
import { DataType } from "@dxos/schema";
|
|
28
|
+
import { DataType, getTypenameFromQuery } from "@dxos/schema";
|
|
29
29
|
import { createAsyncGenerator } from "@dxos/schema/testing";
|
|
30
30
|
import { range } from "@dxos/util";
|
|
31
31
|
var generator = faker;
|
|
32
32
|
var findViewByTypename = async (views, typename) => {
|
|
33
|
-
return views.find((view) => view.query.
|
|
33
|
+
return views.find((view) => getTypenameFromQuery(view.query.ast) === typename);
|
|
34
34
|
};
|
|
35
35
|
var createGenerator = (client, dispatch, schema) => {
|
|
36
|
-
return async (space, n
|
|
36
|
+
return async (space, n) => {
|
|
37
37
|
const typename = schema.typename;
|
|
38
38
|
const { objects: views } = await space.db.query(Filter.type(DataType.View)).run();
|
|
39
39
|
const view = await findViewByTypename(views, typename);
|
|
@@ -196,47 +196,25 @@ var staticGenerators = /* @__PURE__ */ new Map([
|
|
|
196
196
|
]
|
|
197
197
|
]);
|
|
198
198
|
|
|
199
|
-
// src/components/SpaceGenerator/SchemaTable.tsx
|
|
200
|
-
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
201
|
-
import React from "react";
|
|
202
|
-
import { IconButton } from "@dxos/react-ui";
|
|
203
|
-
var SchemaTable = ({ types, objects = {}, label, onClick }) => {
|
|
204
|
-
var _effect = _useSignals();
|
|
205
|
-
try {
|
|
206
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
207
|
-
className: "grid grid-cols-[1fr_80px_40px] gap-1 overflow-none"
|
|
208
|
-
}, /* @__PURE__ */ React.createElement("h2", {
|
|
209
|
-
className: "p-2"
|
|
210
|
-
}, label), types.map((type) => /* @__PURE__ */ React.createElement("div", {
|
|
211
|
-
key: type.typename,
|
|
212
|
-
className: "grid grid-cols-subgrid col-span-3 items-center"
|
|
213
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
214
|
-
className: "px-2 text-sm font-mono text-subdued"
|
|
215
|
-
}, type.typename), /* @__PURE__ */ React.createElement("div", {
|
|
216
|
-
className: "px-2 text-right font-mono"
|
|
217
|
-
}, objects[type.typename] ?? 0), /* @__PURE__ */ React.createElement(IconButton, {
|
|
218
|
-
variant: "ghost",
|
|
219
|
-
icon: "ph--plus--regular",
|
|
220
|
-
iconOnly: true,
|
|
221
|
-
label: "Create data",
|
|
222
|
-
onClick: () => onClick(type.typename)
|
|
223
|
-
}))));
|
|
224
|
-
} finally {
|
|
225
|
-
_effect.f();
|
|
226
|
-
}
|
|
227
|
-
};
|
|
228
|
-
|
|
229
199
|
// src/components/SpaceGenerator/presets.ts
|
|
230
|
-
import
|
|
200
|
+
import * as Schema from "effect/Schema";
|
|
201
|
+
import { RESEARCH_BLUEPRINT, ResearchOn, agent, entityExtraction } from "@dxos/assistant-testing";
|
|
202
|
+
import { Prompt } from "@dxos/blueprints";
|
|
231
203
|
import { NODE_INPUT as NODE_INPUT2 } from "@dxos/conductor";
|
|
232
|
-
import { DXN as DXN2, Key as Key2, Obj as Obj2, Ref as Ref2, Type as Type2 } from "@dxos/echo";
|
|
233
|
-
import { FunctionTrigger,
|
|
204
|
+
import { DXN as DXN2, Filter as Filter2, Key as Key2, Obj as Obj2, Query, Ref as Ref2, Relation, Type as Type2 } from "@dxos/echo";
|
|
205
|
+
import { FunctionTrigger, serializeFunction } from "@dxos/functions";
|
|
234
206
|
import { invariant } from "@dxos/invariant";
|
|
235
|
-
import {
|
|
207
|
+
import { sync } from "@dxos/plugin-inbox";
|
|
208
|
+
import { Mailbox } from "@dxos/plugin-inbox/types";
|
|
209
|
+
import { Markdown as Markdown2 } from "@dxos/plugin-markdown/types";
|
|
210
|
+
import { createAppend, createChat, createComputeGraph, createConstant, createFunction, createGpt, createQueue, createRandom, createSurface, createTemplate, createText, createTrigger } from "@dxos/react-ui-canvas-compute";
|
|
236
211
|
import { CanvasBoardType, CanvasGraphModel, pointMultiply, pointsToRect, rectToPoints } from "@dxos/react-ui-canvas-editor";
|
|
212
|
+
import { DataType as DataType2, createView } from "@dxos/schema";
|
|
237
213
|
import { range as range2 } from "@dxos/util";
|
|
238
214
|
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-debug/src/components/SpaceGenerator/presets.ts";
|
|
239
|
-
var PresetName = /* @__PURE__ */ function(PresetName2) {
|
|
215
|
+
var PresetName = /* @__PURE__ */ (function(PresetName2) {
|
|
216
|
+
PresetName2["DXOS_TEAM"] = "dxos-team";
|
|
217
|
+
PresetName2["ORG_RESEARCH_PROJECT"] = "org-research-project";
|
|
240
218
|
PresetName2["GPT_QUEUE"] = "webhook-gpt-queue";
|
|
241
219
|
PresetName2["CHAT_GPT"] = "chat-gpt-text";
|
|
242
220
|
PresetName2["OBJECT_CHANGE_QUEUE"] = "objectChange-queue";
|
|
@@ -244,7 +222,7 @@ var PresetName = /* @__PURE__ */ function(PresetName2) {
|
|
|
244
222
|
PresetName2["TIMER_TICK_QUEUE"] = "timerTick-queue";
|
|
245
223
|
PresetName2["DISCORD_MESSAGES"] = "discord-messages";
|
|
246
224
|
return PresetName2;
|
|
247
|
-
}({});
|
|
225
|
+
})({});
|
|
248
226
|
var generator2 = () => ({
|
|
249
227
|
schemas: [
|
|
250
228
|
CanvasBoardType,
|
|
@@ -254,6 +232,176 @@ var generator2 = () => ({
|
|
|
254
232
|
typename: name
|
|
255
233
|
})),
|
|
256
234
|
items: [
|
|
235
|
+
[
|
|
236
|
+
"dxos-team",
|
|
237
|
+
async (space, n, cb) => {
|
|
238
|
+
const objects = range2(n, () => {
|
|
239
|
+
const org = space.db.add(Obj2.make(DataType2.Organization, {
|
|
240
|
+
name: "DXOS",
|
|
241
|
+
website: "https://dxos.org"
|
|
242
|
+
}));
|
|
243
|
+
const doc = space.db.add(Markdown2.makeDocument({
|
|
244
|
+
name: "DXOS Research",
|
|
245
|
+
content: "DXOS builds Composer, an open-source AI-powered malleable application."
|
|
246
|
+
}));
|
|
247
|
+
space.db.add(Relation.make(ResearchOn, {
|
|
248
|
+
[Relation.Source]: doc,
|
|
249
|
+
[Relation.Target]: org,
|
|
250
|
+
completedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
251
|
+
}));
|
|
252
|
+
space.db.add(Obj2.make(DataType2.Person, {
|
|
253
|
+
fullName: "Rich",
|
|
254
|
+
jobTitle: "investor",
|
|
255
|
+
organization: Ref2.make(org)
|
|
256
|
+
}));
|
|
257
|
+
space.db.add(Obj2.make(DataType2.Person, {
|
|
258
|
+
fullName: "Josiah",
|
|
259
|
+
organization: Ref2.make(org)
|
|
260
|
+
}));
|
|
261
|
+
space.db.add(Obj2.make(DataType2.Person, {
|
|
262
|
+
fullName: "Dima",
|
|
263
|
+
organization: Ref2.make(org)
|
|
264
|
+
}));
|
|
265
|
+
space.db.add(Obj2.make(DataType2.Person, {
|
|
266
|
+
fullName: "Mykola",
|
|
267
|
+
organization: Ref2.make(org)
|
|
268
|
+
}));
|
|
269
|
+
space.db.add(Obj2.make(DataType2.Person, {
|
|
270
|
+
fullName: "Will",
|
|
271
|
+
organization: Ref2.make(org)
|
|
272
|
+
}));
|
|
273
|
+
return doc;
|
|
274
|
+
});
|
|
275
|
+
cb?.(objects);
|
|
276
|
+
return objects;
|
|
277
|
+
}
|
|
278
|
+
],
|
|
279
|
+
[
|
|
280
|
+
"org-research-project",
|
|
281
|
+
async (space, n, cb) => {
|
|
282
|
+
const mailbox = await space.db.query(Filter2.type(Mailbox.Mailbox)).first();
|
|
283
|
+
const objects = range2(n, () => {
|
|
284
|
+
const contactsQuery = Query.select(Filter2.type(DataType2.Person, {
|
|
285
|
+
jobTitle: "investor"
|
|
286
|
+
}));
|
|
287
|
+
const organizationsQuery = contactsQuery.reference("organization");
|
|
288
|
+
const notesQuery = organizationsQuery.targetOf(ResearchOn).source();
|
|
289
|
+
const contactsQueryString = 'Query.select(Filter.type(DataType.Person, { jobTitle: "investor" }))';
|
|
290
|
+
const organizationsQueryString = `${contactsQueryString}.reference("organization")`;
|
|
291
|
+
const notesQueryString = `${organizationsQueryString}.targetOf(ResearchOn).source()`;
|
|
292
|
+
const emailSyncTrigger = Obj2.make(FunctionTrigger, {
|
|
293
|
+
enabled: true,
|
|
294
|
+
spec: {
|
|
295
|
+
kind: "timer",
|
|
296
|
+
cron: "* * * * *"
|
|
297
|
+
},
|
|
298
|
+
function: Ref2.make(serializeFunction(sync)),
|
|
299
|
+
input: {
|
|
300
|
+
mailboxId: Obj2.getDXN(mailbox).toString()
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
space.db.add(emailSyncTrigger);
|
|
304
|
+
const contactExtractionTrigger = Obj2.make(FunctionTrigger, {
|
|
305
|
+
enabled: true,
|
|
306
|
+
// TODO(wittjosiah): Queue trigger doesn't support matching query of the column.
|
|
307
|
+
spec: {
|
|
308
|
+
kind: "queue",
|
|
309
|
+
queue: mailbox.queue.dxn.toString()
|
|
310
|
+
},
|
|
311
|
+
function: Ref2.make(serializeFunction(entityExtraction)),
|
|
312
|
+
input: {
|
|
313
|
+
source: "{{event.item}}"
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
space.db.add(contactExtractionTrigger);
|
|
317
|
+
const researchPrompt = space.db.add(Prompt.make({
|
|
318
|
+
name: "Research",
|
|
319
|
+
description: "Research organization",
|
|
320
|
+
input: Schema.Struct({
|
|
321
|
+
org: Schema.Any
|
|
322
|
+
}),
|
|
323
|
+
output: Schema.Any,
|
|
324
|
+
// TODO(dmaretskyi): This mocks research (returns pre-baked result), the actual research might take compute minutes.
|
|
325
|
+
// Remove the mock prompt to do the actual research.
|
|
326
|
+
instructions: "Research the organization provided as input. Create a research note for it at the end. NOTE: Do mocked reseach (set mockSearch to true).",
|
|
327
|
+
blueprints: [
|
|
328
|
+
Ref2.make(RESEARCH_BLUEPRINT)
|
|
329
|
+
]
|
|
330
|
+
}));
|
|
331
|
+
const researchTrigger = Obj2.make(FunctionTrigger, {
|
|
332
|
+
enabled: true,
|
|
333
|
+
spec: {
|
|
334
|
+
kind: "subscription",
|
|
335
|
+
query: {
|
|
336
|
+
string: organizationsQueryString,
|
|
337
|
+
ast: organizationsQuery.ast
|
|
338
|
+
}
|
|
339
|
+
},
|
|
340
|
+
function: Ref2.make(serializeFunction(agent)),
|
|
341
|
+
input: {
|
|
342
|
+
prompt: Ref2.make(researchPrompt),
|
|
343
|
+
input: "{{event.subject}}"
|
|
344
|
+
}
|
|
345
|
+
});
|
|
346
|
+
space.db.add(researchTrigger);
|
|
347
|
+
const mailboxView = createView({
|
|
348
|
+
name: "Mailbox",
|
|
349
|
+
query: Query.select(Filter2.type(DataType2.Message, {
|
|
350
|
+
properties: {
|
|
351
|
+
labels: Filter2.contains("investor")
|
|
352
|
+
}
|
|
353
|
+
})).options({
|
|
354
|
+
queues: [
|
|
355
|
+
mailbox.queue.dxn.toString()
|
|
356
|
+
]
|
|
357
|
+
}),
|
|
358
|
+
queryString: 'Query.select(Filter.type(DataType.Message, { properties: { labels: Filter.contains("investor") } }))',
|
|
359
|
+
jsonSchema: Type2.toJsonSchema(DataType2.Message),
|
|
360
|
+
presentation: Obj2.make(DataType2.Collection, {
|
|
361
|
+
objects: []
|
|
362
|
+
})
|
|
363
|
+
});
|
|
364
|
+
const contactsView = createView({
|
|
365
|
+
name: "Contacts",
|
|
366
|
+
query: contactsQuery,
|
|
367
|
+
queryString: contactsQueryString,
|
|
368
|
+
jsonSchema: Type2.toJsonSchema(DataType2.Person),
|
|
369
|
+
presentation: Obj2.make(DataType2.Collection, {
|
|
370
|
+
objects: []
|
|
371
|
+
})
|
|
372
|
+
});
|
|
373
|
+
const organizationsView = createView({
|
|
374
|
+
name: "Organizations",
|
|
375
|
+
query: organizationsQuery,
|
|
376
|
+
queryString: organizationsQueryString,
|
|
377
|
+
jsonSchema: Type2.toJsonSchema(DataType2.Organization),
|
|
378
|
+
presentation: Obj2.make(DataType2.Collection, {
|
|
379
|
+
objects: []
|
|
380
|
+
})
|
|
381
|
+
});
|
|
382
|
+
const notesView = createView({
|
|
383
|
+
name: "Notes",
|
|
384
|
+
query: notesQuery,
|
|
385
|
+
queryString: notesQueryString,
|
|
386
|
+
jsonSchema: Type2.toJsonSchema(Markdown2.Document),
|
|
387
|
+
presentation: Obj2.make(DataType2.Collection, {
|
|
388
|
+
objects: []
|
|
389
|
+
})
|
|
390
|
+
});
|
|
391
|
+
return space.db.add(DataType2.makeProject({
|
|
392
|
+
name: "Investor Research",
|
|
393
|
+
collections: [
|
|
394
|
+
mailboxView,
|
|
395
|
+
contactsView,
|
|
396
|
+
organizationsView,
|
|
397
|
+
notesView
|
|
398
|
+
].map((view) => Ref2.make(view))
|
|
399
|
+
}));
|
|
400
|
+
});
|
|
401
|
+
cb?.(objects.flat());
|
|
402
|
+
return objects.flat();
|
|
403
|
+
}
|
|
404
|
+
],
|
|
257
405
|
[
|
|
258
406
|
"webhook-gpt-queue",
|
|
259
407
|
async (space, n, cb) => {
|
|
@@ -267,7 +415,7 @@ var generator2 = () => ({
|
|
|
267
415
|
})));
|
|
268
416
|
const triggerShape = createTrigger({
|
|
269
417
|
spaceId: space.id,
|
|
270
|
-
triggerKind:
|
|
418
|
+
triggerKind: "webhook",
|
|
271
419
|
...position({
|
|
272
420
|
x: -18,
|
|
273
421
|
y: -2
|
|
@@ -318,8 +466,9 @@ var generator2 = () => ({
|
|
|
318
466
|
"objectChange-queue",
|
|
319
467
|
async (space, n, cb) => {
|
|
320
468
|
const objects = range2(n, () => {
|
|
321
|
-
const { canvasModel, computeModel } = createQueueSinkPreset(space,
|
|
322
|
-
|
|
469
|
+
const { canvasModel, computeModel } = createQueueSinkPreset(space, "subscription", (triggerSpec) => triggerSpec.query = {
|
|
470
|
+
string: 'Query.select(Filter.typename("dxos.org/type/Chess"))',
|
|
471
|
+
ast: Query.select(Filter2.typename("dxos.org/type/Chess")).ast
|
|
323
472
|
}, "type");
|
|
324
473
|
return addToSpace("objectChange-queue", space, canvasModel, computeModel);
|
|
325
474
|
});
|
|
@@ -331,7 +480,7 @@ var generator2 = () => ({
|
|
|
331
480
|
"timerTick-queue",
|
|
332
481
|
async (space, n, cb) => {
|
|
333
482
|
const objects = range2(n, () => {
|
|
334
|
-
const { canvasModel, computeModel } = createQueueSinkPreset(space,
|
|
483
|
+
const { canvasModel, computeModel } = createQueueSinkPreset(space, "timer", (triggerSpec) => triggerSpec.cron = "*/5 * * * * *", "result");
|
|
335
484
|
return addToSpace("timerTick-queue", space, canvasModel, computeModel);
|
|
336
485
|
});
|
|
337
486
|
cb?.(objects);
|
|
@@ -358,7 +507,7 @@ var generator2 = () => ({
|
|
|
358
507
|
// canvasModel.builder.call((builder) => {
|
|
359
508
|
// const triggerShape = createTrigger({
|
|
360
509
|
// spaceId: space.id,
|
|
361
|
-
// triggerKind:
|
|
510
|
+
// triggerKind: 'email',
|
|
362
511
|
// ...position({ x: -18, y: -2 }),
|
|
363
512
|
// });
|
|
364
513
|
// const trigger = canvasModel.createNode(triggerShape);
|
|
@@ -473,7 +622,7 @@ var generator2 = () => ({
|
|
|
473
622
|
// );
|
|
474
623
|
// const triggerShape = createTrigger({
|
|
475
624
|
// spaceId: space.id,
|
|
476
|
-
// triggerKind:
|
|
625
|
+
// triggerKind: 'email',
|
|
477
626
|
// ...rawPosition({ centerX: -736, centerY: -384, width: 182, height: 192 }),
|
|
478
627
|
// });
|
|
479
628
|
// const trigger = canvasModel.createNode(triggerShape);
|
|
@@ -582,7 +731,7 @@ var generator2 = () => ({
|
|
|
582
731
|
canvasModel.builder.call((builder) => {
|
|
583
732
|
const triggerShape = createTrigger({
|
|
584
733
|
spaceId: space.id,
|
|
585
|
-
triggerKind:
|
|
734
|
+
triggerKind: "timer",
|
|
586
735
|
...position({
|
|
587
736
|
x: -10,
|
|
588
737
|
y: -5
|
|
@@ -718,7 +867,7 @@ var createQueueSinkPreset = (space, triggerKind, initSpec, triggerOutputName) =>
|
|
|
718
867
|
const triggerSpec = functionTrigger.spec;
|
|
719
868
|
invariant(triggerSpec && triggerSpec.kind === triggerKind, "No trigger spec.", {
|
|
720
869
|
F: __dxlog_file,
|
|
721
|
-
L:
|
|
870
|
+
L: 663,
|
|
722
871
|
S: void 0,
|
|
723
872
|
A: [
|
|
724
873
|
"triggerSpec && triggerSpec.kind === triggerKind",
|
|
@@ -731,7 +880,7 @@ var createQueueSinkPreset = (space, triggerKind, initSpec, triggerOutputName) =>
|
|
|
731
880
|
const templateComputeNode = computeModel.nodes.find((n) => n.id === template.node);
|
|
732
881
|
invariant(templateComputeNode, "Template compute node was not created.", {
|
|
733
882
|
F: __dxlog_file,
|
|
734
|
-
L:
|
|
883
|
+
L: 670,
|
|
735
884
|
S: void 0,
|
|
736
885
|
A: [
|
|
737
886
|
"templateComputeNode",
|
|
@@ -793,7 +942,7 @@ var setupQueue = (space, canvasModel, args) => {
|
|
|
793
942
|
var attachTrigger = (functionTrigger, computeModel) => {
|
|
794
943
|
invariant(functionTrigger, void 0, {
|
|
795
944
|
F: __dxlog_file,
|
|
796
|
-
L:
|
|
945
|
+
L: 709,
|
|
797
946
|
S: void 0,
|
|
798
947
|
A: [
|
|
799
948
|
"functionTrigger",
|
|
@@ -848,6 +997,36 @@ var position = (rect) => {
|
|
|
848
997
|
}
|
|
849
998
|
};
|
|
850
999
|
|
|
1000
|
+
// src/components/SpaceGenerator/SchemaTable.tsx
|
|
1001
|
+
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
1002
|
+
import React from "react";
|
|
1003
|
+
import { IconButton } from "@dxos/react-ui";
|
|
1004
|
+
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
|
+
}
|
|
1028
|
+
};
|
|
1029
|
+
|
|
851
1030
|
// src/components/SpaceGenerator/SpaceGenerator.tsx
|
|
852
1031
|
var SpaceGenerator = ({ space, onCreateObjects }) => {
|
|
853
1032
|
var _effect = _useSignals2();
|
|
@@ -855,16 +1034,15 @@ var SpaceGenerator = ({ space, onCreateObjects }) => {
|
|
|
855
1034
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
856
1035
|
const client = useClient();
|
|
857
1036
|
const staticTypes = [
|
|
858
|
-
|
|
1037
|
+
Markdown3.Document,
|
|
859
1038
|
DiagramType2,
|
|
860
1039
|
SheetType2,
|
|
861
1040
|
ComputeGraph2
|
|
862
1041
|
];
|
|
863
1042
|
const recordTypes = [
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
DataType2.Message
|
|
1043
|
+
DataType3.Organization,
|
|
1044
|
+
DataType3.Person,
|
|
1045
|
+
DataType3.Task
|
|
868
1046
|
];
|
|
869
1047
|
const [count, setCount] = useState(1);
|
|
870
1048
|
const [info, setInfo] = useState({});
|
|
@@ -891,7 +1069,7 @@ var SpaceGenerator = ({ space, onCreateObjects }) => {
|
|
|
891
1069
|
const updateInfo = async () => {
|
|
892
1070
|
const echoSchema = await space.db.schemaRegistry.query().run();
|
|
893
1071
|
const staticSchema = space.db.graph.schemaRegistry.schemas;
|
|
894
|
-
const { objects } = await space.db.query(
|
|
1072
|
+
const { objects } = await space.db.query(Filter3.everything()).run();
|
|
895
1073
|
const objectMap = sortKeys(objects.reduce((map, obj) => {
|
|
896
1074
|
const type = getTypename(obj);
|
|
897
1075
|
if (type) {
|
|
@@ -960,8 +1138,8 @@ var SpaceGenerator = ({ space, onCreateObjects }) => {
|
|
|
960
1138
|
label: "Presets",
|
|
961
1139
|
onClick: handleCreateData
|
|
962
1140
|
}), /* @__PURE__ */ React2.createElement("div", null, /* @__PURE__ */ React2.createElement(SyntaxHighlighter, {
|
|
963
|
-
|
|
964
|
-
|
|
1141
|
+
language: "json",
|
|
1142
|
+
classNames: "text-xs"
|
|
965
1143
|
}, JSON.stringify({
|
|
966
1144
|
space,
|
|
967
1145
|
...info
|
|
@@ -978,4 +1156,4 @@ var SpaceGenerator_default = SpaceGenerator;
|
|
|
978
1156
|
export {
|
|
979
1157
|
SpaceGenerator_default as default
|
|
980
1158
|
};
|
|
981
|
-
//# sourceMappingURL=SpaceGenerator-
|
|
1159
|
+
//# sourceMappingURL=SpaceGenerator-54FUIZIH.mjs.map
|