@typicalday/firegraph 0.1.0

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 (48) hide show
  1. package/LICENSE +27 -0
  2. package/README.md +527 -0
  3. package/bin/firegraph.mjs +129 -0
  4. package/dist/chunk-KFA7G37W.js +443 -0
  5. package/dist/chunk-KFA7G37W.js.map +1 -0
  6. package/dist/chunk-YLGXLEUE.js +47 -0
  7. package/dist/chunk-YLGXLEUE.js.map +1 -0
  8. package/dist/client-Bk2Cm6xv.d.cts +131 -0
  9. package/dist/client-Bk2Cm6xv.d.ts +131 -0
  10. package/dist/codegen/index.cjs +81 -0
  11. package/dist/codegen/index.cjs.map +1 -0
  12. package/dist/codegen/index.d.cts +2 -0
  13. package/dist/codegen/index.d.ts +2 -0
  14. package/dist/codegen/index.js +7 -0
  15. package/dist/codegen/index.js.map +1 -0
  16. package/dist/editor/client/assets/index-DJJ_b0jI.js +411 -0
  17. package/dist/editor/client/assets/index-Q0QBYrMV.css +1 -0
  18. package/dist/editor/client/index.html +16 -0
  19. package/dist/editor/server/index.mjs +49597 -0
  20. package/dist/index-CG3R68Hu.d.cts +414 -0
  21. package/dist/index-CG3R68Hu.d.ts +414 -0
  22. package/dist/index.cjs +1953 -0
  23. package/dist/index.cjs.map +1 -0
  24. package/dist/index.d.cts +186 -0
  25. package/dist/index.d.ts +186 -0
  26. package/dist/index.js +1569 -0
  27. package/dist/index.js.map +1 -0
  28. package/dist/query-client/index.cjs +484 -0
  29. package/dist/query-client/index.cjs.map +1 -0
  30. package/dist/query-client/index.d.cts +15 -0
  31. package/dist/query-client/index.d.ts +15 -0
  32. package/dist/query-client/index.js +17 -0
  33. package/dist/query-client/index.js.map +1 -0
  34. package/dist/react.cjs +85 -0
  35. package/dist/react.cjs.map +1 -0
  36. package/dist/react.d.cts +44 -0
  37. package/dist/react.d.ts +44 -0
  38. package/dist/react.js +60 -0
  39. package/dist/react.js.map +1 -0
  40. package/dist/svelte.cjs +90 -0
  41. package/dist/svelte.cjs.map +1 -0
  42. package/dist/svelte.d.cts +46 -0
  43. package/dist/svelte.d.ts +46 -0
  44. package/dist/svelte.js +65 -0
  45. package/dist/svelte.js.map +1 -0
  46. package/dist/views-DL60k0cf.d.cts +91 -0
  47. package/dist/views-DL60k0cf.d.ts +91 -0
  48. package/package.json +122 -0
@@ -0,0 +1,131 @@
1
+ interface WhereClause {
2
+ field: string;
3
+ op: string;
4
+ value: string | number | boolean;
5
+ }
6
+ interface SummarizedRecord {
7
+ type: string;
8
+ uid: string;
9
+ data?: Record<string, unknown>;
10
+ }
11
+ interface SummarizedEdge {
12
+ fromType: string;
13
+ fromUid: string;
14
+ relation: string;
15
+ toType: string;
16
+ toUid: string;
17
+ data?: Record<string, unknown>;
18
+ }
19
+ interface SchemaResult {
20
+ nodeTypes: string[];
21
+ edgeTypes: {
22
+ relation: string;
23
+ from: string;
24
+ to: string;
25
+ inverseLabel: string | null;
26
+ }[];
27
+ }
28
+ interface GetNodeDetailInput {
29
+ uid: string;
30
+ }
31
+ interface NodeDetailResult {
32
+ node: SummarizedRecord | null;
33
+ outEdges: SummarizedEdge[];
34
+ inEdges: SummarizedEdge[];
35
+ }
36
+ interface GetNodesInput {
37
+ type?: string;
38
+ limit?: number;
39
+ startAfter?: string;
40
+ sortBy?: string;
41
+ sortDir?: 'asc' | 'desc';
42
+ where?: WhereClause[];
43
+ }
44
+ interface GetNodesResult {
45
+ nodes: SummarizedRecord[];
46
+ hasMore: boolean;
47
+ nextCursor?: string | null;
48
+ }
49
+ interface GetEdgesInput {
50
+ aType?: string;
51
+ aUid?: string;
52
+ axbType?: string;
53
+ bType?: string;
54
+ bUid?: string;
55
+ limit?: number;
56
+ startAfter?: string;
57
+ sortBy?: string;
58
+ sortDir?: 'asc' | 'desc';
59
+ where?: WhereClause[];
60
+ }
61
+ interface GetEdgesResult {
62
+ edges: SummarizedEdge[];
63
+ hasMore: boolean;
64
+ nextCursor?: string | null;
65
+ }
66
+ interface TraverseHop {
67
+ axbType: string;
68
+ direction?: 'forward' | 'reverse';
69
+ limit?: number;
70
+ aType?: string;
71
+ bType?: string;
72
+ orderBy?: {
73
+ field: string;
74
+ direction?: 'asc' | 'desc';
75
+ };
76
+ where?: WhereClause[];
77
+ }
78
+ interface TraverseInput {
79
+ startUid: string;
80
+ hops: TraverseHop[];
81
+ maxReads?: number;
82
+ concurrency?: number;
83
+ }
84
+ interface TraverseHopResult {
85
+ relation: string;
86
+ direction: string;
87
+ depth: number;
88
+ edgeCount: number;
89
+ edges: SummarizedEdge[];
90
+ truncated: boolean;
91
+ }
92
+ interface TraverseResult {
93
+ hops: TraverseHopResult[];
94
+ totalReads: number;
95
+ truncated: boolean;
96
+ }
97
+ interface SearchInput {
98
+ q: string;
99
+ limit?: number;
100
+ }
101
+ interface SearchResult {
102
+ results: (SummarizedRecord & {
103
+ matchType: string | null;
104
+ })[];
105
+ }
106
+ interface QueryClientOptions {
107
+ /** Editor server port. Default: auto-detected from config, fallback 3884. */
108
+ port?: number;
109
+ /** Editor server hostname. Default: 'localhost'. */
110
+ host?: string;
111
+ }
112
+
113
+ type QueryClientErrorCode = 'VALIDATION_ERROR' | 'CONNECTION_FAILED' | 'SERVER_ERROR';
114
+ declare class QueryClientError extends Error {
115
+ readonly code: QueryClientErrorCode;
116
+ constructor(message: string, code: QueryClientErrorCode);
117
+ }
118
+ declare class QueryClient {
119
+ private readonly baseUrl;
120
+ constructor(options?: QueryClientOptions);
121
+ private query;
122
+ private mutate;
123
+ getSchema(): Promise<SchemaResult>;
124
+ getNodeDetail(input: GetNodeDetailInput): Promise<NodeDetailResult>;
125
+ getNodes(input: GetNodesInput): Promise<GetNodesResult>;
126
+ getEdges(input: GetEdgesInput): Promise<GetEdgesResult>;
127
+ traverse(input: TraverseInput): Promise<TraverseResult>;
128
+ search(input: SearchInput): Promise<SearchResult>;
129
+ }
130
+
131
+ export { type GetEdgesInput as G, type NodeDetailResult as N, QueryClient as Q, type SummarizedEdge as S, type TraverseHop as T, type WhereClause as W, QueryClientError as a, type QueryClientErrorCode as b, type QueryClientOptions as c, type SummarizedRecord as d, type GetEdgesResult as e, type GetNodeDetailInput as f, type GetNodesInput as g, type GetNodesResult as h, type SchemaResult as i, type SearchInput as j, type SearchResult as k, type TraverseHopResult as l, type TraverseInput as m, type TraverseResult as n };
@@ -0,0 +1,131 @@
1
+ interface WhereClause {
2
+ field: string;
3
+ op: string;
4
+ value: string | number | boolean;
5
+ }
6
+ interface SummarizedRecord {
7
+ type: string;
8
+ uid: string;
9
+ data?: Record<string, unknown>;
10
+ }
11
+ interface SummarizedEdge {
12
+ fromType: string;
13
+ fromUid: string;
14
+ relation: string;
15
+ toType: string;
16
+ toUid: string;
17
+ data?: Record<string, unknown>;
18
+ }
19
+ interface SchemaResult {
20
+ nodeTypes: string[];
21
+ edgeTypes: {
22
+ relation: string;
23
+ from: string;
24
+ to: string;
25
+ inverseLabel: string | null;
26
+ }[];
27
+ }
28
+ interface GetNodeDetailInput {
29
+ uid: string;
30
+ }
31
+ interface NodeDetailResult {
32
+ node: SummarizedRecord | null;
33
+ outEdges: SummarizedEdge[];
34
+ inEdges: SummarizedEdge[];
35
+ }
36
+ interface GetNodesInput {
37
+ type?: string;
38
+ limit?: number;
39
+ startAfter?: string;
40
+ sortBy?: string;
41
+ sortDir?: 'asc' | 'desc';
42
+ where?: WhereClause[];
43
+ }
44
+ interface GetNodesResult {
45
+ nodes: SummarizedRecord[];
46
+ hasMore: boolean;
47
+ nextCursor?: string | null;
48
+ }
49
+ interface GetEdgesInput {
50
+ aType?: string;
51
+ aUid?: string;
52
+ axbType?: string;
53
+ bType?: string;
54
+ bUid?: string;
55
+ limit?: number;
56
+ startAfter?: string;
57
+ sortBy?: string;
58
+ sortDir?: 'asc' | 'desc';
59
+ where?: WhereClause[];
60
+ }
61
+ interface GetEdgesResult {
62
+ edges: SummarizedEdge[];
63
+ hasMore: boolean;
64
+ nextCursor?: string | null;
65
+ }
66
+ interface TraverseHop {
67
+ axbType: string;
68
+ direction?: 'forward' | 'reverse';
69
+ limit?: number;
70
+ aType?: string;
71
+ bType?: string;
72
+ orderBy?: {
73
+ field: string;
74
+ direction?: 'asc' | 'desc';
75
+ };
76
+ where?: WhereClause[];
77
+ }
78
+ interface TraverseInput {
79
+ startUid: string;
80
+ hops: TraverseHop[];
81
+ maxReads?: number;
82
+ concurrency?: number;
83
+ }
84
+ interface TraverseHopResult {
85
+ relation: string;
86
+ direction: string;
87
+ depth: number;
88
+ edgeCount: number;
89
+ edges: SummarizedEdge[];
90
+ truncated: boolean;
91
+ }
92
+ interface TraverseResult {
93
+ hops: TraverseHopResult[];
94
+ totalReads: number;
95
+ truncated: boolean;
96
+ }
97
+ interface SearchInput {
98
+ q: string;
99
+ limit?: number;
100
+ }
101
+ interface SearchResult {
102
+ results: (SummarizedRecord & {
103
+ matchType: string | null;
104
+ })[];
105
+ }
106
+ interface QueryClientOptions {
107
+ /** Editor server port. Default: auto-detected from config, fallback 3884. */
108
+ port?: number;
109
+ /** Editor server hostname. Default: 'localhost'. */
110
+ host?: string;
111
+ }
112
+
113
+ type QueryClientErrorCode = 'VALIDATION_ERROR' | 'CONNECTION_FAILED' | 'SERVER_ERROR';
114
+ declare class QueryClientError extends Error {
115
+ readonly code: QueryClientErrorCode;
116
+ constructor(message: string, code: QueryClientErrorCode);
117
+ }
118
+ declare class QueryClient {
119
+ private readonly baseUrl;
120
+ constructor(options?: QueryClientOptions);
121
+ private query;
122
+ private mutate;
123
+ getSchema(): Promise<SchemaResult>;
124
+ getNodeDetail(input: GetNodeDetailInput): Promise<NodeDetailResult>;
125
+ getNodes(input: GetNodesInput): Promise<GetNodesResult>;
126
+ getEdges(input: GetEdgesInput): Promise<GetEdgesResult>;
127
+ traverse(input: TraverseInput): Promise<TraverseResult>;
128
+ search(input: SearchInput): Promise<SearchResult>;
129
+ }
130
+
131
+ export { type GetEdgesInput as G, type NodeDetailResult as N, QueryClient as Q, type SummarizedEdge as S, type TraverseHop as T, type WhereClause as W, QueryClientError as a, type QueryClientErrorCode as b, type QueryClientOptions as c, type SummarizedRecord as d, type GetEdgesResult as e, type GetNodeDetailInput as f, type GetNodesInput as g, type GetNodesResult as h, type SchemaResult as i, type SearchInput as j, type SearchResult as k, type TraverseHopResult as l, type TraverseInput as m, type TraverseResult as n };
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/codegen/index.ts
31
+ var codegen_exports = {};
32
+ __export(codegen_exports, {
33
+ generateTypes: () => generateTypes
34
+ });
35
+ module.exports = __toCommonJS(codegen_exports);
36
+ function pascalCase(s) {
37
+ return s.replace(
38
+ /(^|[^a-zA-Z0-9])([a-zA-Z])/g,
39
+ (_, _sep, ch) => ch.toUpperCase()
40
+ );
41
+ }
42
+ async function generateTypes(discovery, options = {}) {
43
+ const { compile } = await import("json-schema-to-typescript");
44
+ const { banner = true } = options;
45
+ const chunks = [];
46
+ if (banner) {
47
+ chunks.push(
48
+ "// Auto-generated by firegraph codegen \u2014 do not edit manually\n"
49
+ );
50
+ }
51
+ const sortedNodes = [...discovery.nodes.entries()].sort(
52
+ ([a], [b]) => a.localeCompare(b)
53
+ );
54
+ const sortedEdges = [...discovery.edges.entries()].sort(
55
+ ([a], [b]) => a.localeCompare(b)
56
+ );
57
+ for (const [name, entity] of sortedNodes) {
58
+ const typeName = `${pascalCase(name)}Data`;
59
+ const ts = await compile(entity.schema, typeName, {
60
+ bannerComment: "",
61
+ additionalProperties: false
62
+ });
63
+ chunks.push(ts.trim());
64
+ chunks.push("");
65
+ }
66
+ for (const [name, entity] of sortedEdges) {
67
+ const typeName = `${pascalCase(name)}EdgeData`;
68
+ const ts = await compile(entity.schema, typeName, {
69
+ bannerComment: "",
70
+ additionalProperties: false
71
+ });
72
+ chunks.push(ts.trim());
73
+ chunks.push("");
74
+ }
75
+ return chunks.join("\n").trimEnd() + "\n";
76
+ }
77
+ // Annotate the CommonJS export names for ESM import in node:
78
+ 0 && (module.exports = {
79
+ generateTypes
80
+ });
81
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/codegen/index.ts"],"sourcesContent":["/**\n * Code generation — produces TypeScript type definitions from JSON Schema\n * files discovered via the entity folder convention.\n *\n * Uses `json-schema-to-typescript` to compile each entity's `schema.json`\n * into a TypeScript interface.\n *\n * Naming convention:\n * - Nodes: `{PascalName}Data` (e.g. `TaskData`)\n * - Edges: `{PascalName}EdgeData` (e.g. `HasStepEdgeData`)\n */\n\nimport type { DiscoveryResult } from '../types.js';\n\nfunction pascalCase(s: string): string {\n return s.replace(/(^|[^a-zA-Z0-9])([a-zA-Z])/g, (_, _sep, ch) =>\n ch.toUpperCase(),\n );\n}\n\nexport interface CodegenOptions {\n /** Add banner comment at top of output. Defaults to true. */\n banner?: boolean;\n}\n\n/**\n * Generate TypeScript type definitions from a DiscoveryResult.\n * Returns the full file content as a string.\n */\nexport async function generateTypes(\n discovery: DiscoveryResult,\n options: CodegenOptions = {},\n): Promise<string> {\n // Lazy-load to avoid requiring this dep at runtime for non-codegen usage\n const { compile } = await import('json-schema-to-typescript');\n\n const { banner = true } = options;\n const chunks: string[] = [];\n\n if (banner) {\n chunks.push(\n '// Auto-generated by firegraph codegen — do not edit manually\\n',\n );\n }\n\n // Sort for deterministic output\n const sortedNodes = [...discovery.nodes.entries()].sort(([a], [b]) =>\n a.localeCompare(b),\n );\n const sortedEdges = [...discovery.edges.entries()].sort(([a], [b]) =>\n a.localeCompare(b),\n );\n\n for (const [name, entity] of sortedNodes) {\n const typeName = `${pascalCase(name)}Data`;\n const ts = await compile(entity.schema as any, typeName, {\n bannerComment: '',\n additionalProperties: false,\n });\n chunks.push(ts.trim());\n chunks.push('');\n }\n\n for (const [name, entity] of sortedEdges) {\n const typeName = `${pascalCase(name)}EdgeData`;\n const ts = await compile(entity.schema as any, typeName, {\n bannerComment: '',\n additionalProperties: false,\n });\n chunks.push(ts.trim());\n chunks.push('');\n }\n\n return chunks.join('\\n').trimEnd() + '\\n';\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAcA,SAAS,WAAW,GAAmB;AACrC,SAAO,EAAE;AAAA,IAAQ;AAAA,IAA+B,CAAC,GAAG,MAAM,OACxD,GAAG,YAAY;AAAA,EACjB;AACF;AAWA,eAAsB,cACpB,WACA,UAA0B,CAAC,GACV;AAEjB,QAAM,EAAE,QAAQ,IAAI,MAAM,OAAO,2BAA2B;AAE5D,QAAM,EAAE,SAAS,KAAK,IAAI;AAC1B,QAAM,SAAmB,CAAC;AAE1B,MAAI,QAAQ;AACV,WAAO;AAAA,MACL;AAAA,IACF;AAAA,EACF;AAGA,QAAM,cAAc,CAAC,GAAG,UAAU,MAAM,QAAQ,CAAC,EAAE;AAAA,IAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,MAC9D,EAAE,cAAc,CAAC;AAAA,EACnB;AACA,QAAM,cAAc,CAAC,GAAG,UAAU,MAAM,QAAQ,CAAC,EAAE;AAAA,IAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,MAC9D,EAAE,cAAc,CAAC;AAAA,EACnB;AAEA,aAAW,CAAC,MAAM,MAAM,KAAK,aAAa;AACxC,UAAM,WAAW,GAAG,WAAW,IAAI,CAAC;AACpC,UAAM,KAAK,MAAM,QAAQ,OAAO,QAAe,UAAU;AAAA,MACvD,eAAe;AAAA,MACf,sBAAsB;AAAA,IACxB,CAAC;AACD,WAAO,KAAK,GAAG,KAAK,CAAC;AACrB,WAAO,KAAK,EAAE;AAAA,EAChB;AAEA,aAAW,CAAC,MAAM,MAAM,KAAK,aAAa;AACxC,UAAM,WAAW,GAAG,WAAW,IAAI,CAAC;AACpC,UAAM,KAAK,MAAM,QAAQ,OAAO,QAAe,UAAU;AAAA,MACvD,eAAe;AAAA,MACf,sBAAsB;AAAA,IACxB,CAAC;AACD,WAAO,KAAK,GAAG,KAAK,CAAC;AACrB,WAAO,KAAK,EAAE;AAAA,EAChB;AAEA,SAAO,OAAO,KAAK,IAAI,EAAE,QAAQ,IAAI;AACvC;","names":[]}
@@ -0,0 +1,2 @@
1
+ export { k as CodegenOptions, I as generateTypes } from '../index-CG3R68Hu.cjs';
2
+ import '@google-cloud/firestore';
@@ -0,0 +1,2 @@
1
+ export { k as CodegenOptions, I as generateTypes } from '../index-CG3R68Hu.js';
2
+ import '@google-cloud/firestore';
@@ -0,0 +1,7 @@
1
+ import {
2
+ generateTypes
3
+ } from "../chunk-YLGXLEUE.js";
4
+ export {
5
+ generateTypes
6
+ };
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}