@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.
- package/LICENSE +27 -0
- package/README.md +527 -0
- package/bin/firegraph.mjs +129 -0
- package/dist/chunk-KFA7G37W.js +443 -0
- package/dist/chunk-KFA7G37W.js.map +1 -0
- package/dist/chunk-YLGXLEUE.js +47 -0
- package/dist/chunk-YLGXLEUE.js.map +1 -0
- package/dist/client-Bk2Cm6xv.d.cts +131 -0
- package/dist/client-Bk2Cm6xv.d.ts +131 -0
- package/dist/codegen/index.cjs +81 -0
- package/dist/codegen/index.cjs.map +1 -0
- package/dist/codegen/index.d.cts +2 -0
- package/dist/codegen/index.d.ts +2 -0
- package/dist/codegen/index.js +7 -0
- package/dist/codegen/index.js.map +1 -0
- package/dist/editor/client/assets/index-DJJ_b0jI.js +411 -0
- package/dist/editor/client/assets/index-Q0QBYrMV.css +1 -0
- package/dist/editor/client/index.html +16 -0
- package/dist/editor/server/index.mjs +49597 -0
- package/dist/index-CG3R68Hu.d.cts +414 -0
- package/dist/index-CG3R68Hu.d.ts +414 -0
- package/dist/index.cjs +1953 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +186 -0
- package/dist/index.d.ts +186 -0
- package/dist/index.js +1569 -0
- package/dist/index.js.map +1 -0
- package/dist/query-client/index.cjs +484 -0
- package/dist/query-client/index.cjs.map +1 -0
- package/dist/query-client/index.d.cts +15 -0
- package/dist/query-client/index.d.ts +15 -0
- package/dist/query-client/index.js +17 -0
- package/dist/query-client/index.js.map +1 -0
- package/dist/react.cjs +85 -0
- package/dist/react.cjs.map +1 -0
- package/dist/react.d.cts +44 -0
- package/dist/react.d.ts +44 -0
- package/dist/react.js +60 -0
- package/dist/react.js.map +1 -0
- package/dist/svelte.cjs +90 -0
- package/dist/svelte.cjs.map +1 -0
- package/dist/svelte.d.cts +46 -0
- package/dist/svelte.d.ts +46 -0
- package/dist/svelte.js +65 -0
- package/dist/svelte.js.map +1 -0
- package/dist/views-DL60k0cf.d.cts +91 -0
- package/dist/views-DL60k0cf.d.ts +91 -0
- package/package.json +122 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model Views — framework-agnostic view definitions for graph entities.
|
|
3
|
+
*
|
|
4
|
+
* Projects define Web Components that render entity data in purpose-driven
|
|
5
|
+
* ways. Each view class declares a static `viewName`, and receives the
|
|
6
|
+
* entity's `data` payload via a `data` property setter.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* import { defineViews } from 'firegraph';
|
|
11
|
+
*
|
|
12
|
+
* class UserCard extends HTMLElement {
|
|
13
|
+
* static viewName = 'card';
|
|
14
|
+
* static description = 'Compact user card';
|
|
15
|
+
* private _data: Record<string, unknown> = {};
|
|
16
|
+
* set data(v: Record<string, unknown>) { this._data = v; this.render(); }
|
|
17
|
+
* connectedCallback() { this.render(); }
|
|
18
|
+
* private render() {
|
|
19
|
+
* this.innerHTML = `<strong>${this._data.displayName ?? ''}</strong>`;
|
|
20
|
+
* }
|
|
21
|
+
* }
|
|
22
|
+
*
|
|
23
|
+
* export default defineViews({
|
|
24
|
+
* nodes: { user: { views: [UserCard] } },
|
|
25
|
+
* });
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* A Web Component class used as a view. The class must have a static
|
|
30
|
+
* `viewName` and must be constructable. It will be registered as a custom
|
|
31
|
+
* element via `customElements.define()` in browser environments.
|
|
32
|
+
*
|
|
33
|
+
* Note: this interface avoids referencing `HTMLElement` directly so the
|
|
34
|
+
* library can compile without DOM lib types. Consumer code (which has DOM)
|
|
35
|
+
* will satisfy this constraint naturally.
|
|
36
|
+
*/
|
|
37
|
+
interface ViewComponentClass {
|
|
38
|
+
new (...args: any[]): {
|
|
39
|
+
data: Record<string, unknown>;
|
|
40
|
+
};
|
|
41
|
+
/** Short identifier for this view (e.g. 'card', 'profile'). */
|
|
42
|
+
viewName: string;
|
|
43
|
+
/** Optional human-readable description. */
|
|
44
|
+
description?: string;
|
|
45
|
+
}
|
|
46
|
+
/** Configuration for all views of a single entity type. */
|
|
47
|
+
interface EntityViewConfig {
|
|
48
|
+
/** View component classes to register. */
|
|
49
|
+
views: ViewComponentClass[];
|
|
50
|
+
/**
|
|
51
|
+
* Optional sample data for the gallery. A single object matching
|
|
52
|
+
* the entity's JSON Schema — shared across all views.
|
|
53
|
+
*/
|
|
54
|
+
sampleData?: Record<string, unknown>;
|
|
55
|
+
}
|
|
56
|
+
/** Input shape accepted by `defineViews()`. */
|
|
57
|
+
interface ViewRegistryInput {
|
|
58
|
+
/** Node views keyed by aType (e.g. 'user', 'tour'). */
|
|
59
|
+
nodes?: Record<string, EntityViewConfig>;
|
|
60
|
+
/** Edge views keyed by axbType (e.g. 'hasDeparture'). */
|
|
61
|
+
edges?: Record<string, EntityViewConfig>;
|
|
62
|
+
}
|
|
63
|
+
/** Serialisable metadata for a single view. */
|
|
64
|
+
interface ViewMeta {
|
|
65
|
+
/** Custom element tag name (e.g. 'fg-user-card'). */
|
|
66
|
+
tagName: string;
|
|
67
|
+
/** Short identifier matching the component's static viewName. */
|
|
68
|
+
viewName: string;
|
|
69
|
+
/** Optional human-readable description. */
|
|
70
|
+
description?: string;
|
|
71
|
+
}
|
|
72
|
+
/** Serialisable metadata for all views of a single entity type. */
|
|
73
|
+
interface EntityViewMeta {
|
|
74
|
+
views: ViewMeta[];
|
|
75
|
+
sampleData?: Record<string, unknown>;
|
|
76
|
+
}
|
|
77
|
+
/** The resolved view registry returned by `defineViews()`. */
|
|
78
|
+
interface ViewRegistry {
|
|
79
|
+
nodes: Record<string, EntityViewMeta>;
|
|
80
|
+
edges: Record<string, EntityViewMeta>;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Build a `ViewRegistry` from component classes.
|
|
84
|
+
*
|
|
85
|
+
* In the browser the components are registered as custom elements with
|
|
86
|
+
* deterministic tag names (`fg-{entityType}-{viewName}`). On the server
|
|
87
|
+
* (Node.js) only metadata is returned — no custom element registration.
|
|
88
|
+
*/
|
|
89
|
+
declare function defineViews(input: ViewRegistryInput): ViewRegistry;
|
|
90
|
+
|
|
91
|
+
export { type EntityViewConfig as E, type ViewComponentClass as V, type EntityViewMeta as a, type ViewMeta as b, type ViewRegistry as c, type ViewRegistryInput as d, defineViews as e };
|
package/package.json
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@typicalday/firegraph",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Generic Firestore adjacency graph client with smart query planning",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"default": "./dist/index.js"
|
|
14
|
+
},
|
|
15
|
+
"require": {
|
|
16
|
+
"types": "./dist/index.d.cts",
|
|
17
|
+
"default": "./dist/index.cjs"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"./react": {
|
|
21
|
+
"import": {
|
|
22
|
+
"types": "./dist/react.d.ts",
|
|
23
|
+
"default": "./dist/react.js"
|
|
24
|
+
},
|
|
25
|
+
"require": {
|
|
26
|
+
"types": "./dist/react.d.cts",
|
|
27
|
+
"default": "./dist/react.cjs"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"./svelte": {
|
|
31
|
+
"import": {
|
|
32
|
+
"types": "./dist/svelte.d.ts",
|
|
33
|
+
"default": "./dist/svelte.js"
|
|
34
|
+
},
|
|
35
|
+
"require": {
|
|
36
|
+
"types": "./dist/svelte.d.cts",
|
|
37
|
+
"default": "./dist/svelte.cjs"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"./query-client": {
|
|
41
|
+
"import": {
|
|
42
|
+
"types": "./dist/query-client/index.d.ts",
|
|
43
|
+
"default": "./dist/query-client/index.js"
|
|
44
|
+
},
|
|
45
|
+
"require": {
|
|
46
|
+
"types": "./dist/query-client/index.d.cts",
|
|
47
|
+
"default": "./dist/query-client/index.cjs"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"bin": {
|
|
52
|
+
"firegraph": "./bin/firegraph.mjs"
|
|
53
|
+
},
|
|
54
|
+
"files": [
|
|
55
|
+
"dist",
|
|
56
|
+
"bin",
|
|
57
|
+
"skills"
|
|
58
|
+
],
|
|
59
|
+
"peerDependencies": {
|
|
60
|
+
"@google-cloud/firestore": "^8.0.0",
|
|
61
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
62
|
+
"react-dom": "^18.0.0 || ^19.0.0",
|
|
63
|
+
"svelte": "^5.0.0"
|
|
64
|
+
},
|
|
65
|
+
"peerDependenciesMeta": {
|
|
66
|
+
"react": {
|
|
67
|
+
"optional": true
|
|
68
|
+
},
|
|
69
|
+
"react-dom": {
|
|
70
|
+
"optional": true
|
|
71
|
+
},
|
|
72
|
+
"svelte": {
|
|
73
|
+
"optional": true
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
"dependencies": {
|
|
77
|
+
"ajv": "^8.18.0",
|
|
78
|
+
"esbuild": "^0.24.0",
|
|
79
|
+
"jiti": "^2.4.0",
|
|
80
|
+
"nanoid": "^5.0.9"
|
|
81
|
+
},
|
|
82
|
+
"devDependencies": {
|
|
83
|
+
"@google-cloud/firestore": "^8.3.0",
|
|
84
|
+
"@vitest/coverage-v8": "^3.0.0",
|
|
85
|
+
"json-schema-to-typescript": "^15.0.4",
|
|
86
|
+
"tsup": "^8.4.0",
|
|
87
|
+
"typescript": "^5.7.0",
|
|
88
|
+
"vitest": "^3.0.0"
|
|
89
|
+
},
|
|
90
|
+
"repository": {
|
|
91
|
+
"type": "git",
|
|
92
|
+
"url": "https://github.com/typicalday/firegraph.git"
|
|
93
|
+
},
|
|
94
|
+
"publishConfig": {
|
|
95
|
+
"access": "public"
|
|
96
|
+
},
|
|
97
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
98
|
+
"engines": {
|
|
99
|
+
"node": ">=18"
|
|
100
|
+
},
|
|
101
|
+
"scripts": {
|
|
102
|
+
"build": "tsup",
|
|
103
|
+
"build:editor:client": "cd editor && npx vite build",
|
|
104
|
+
"build:editor:server": "node editor/build-server.mjs",
|
|
105
|
+
"build:editor": "npm run build:editor:client && npm run build:editor:server",
|
|
106
|
+
"build:all": "npm run build && npm run build:editor",
|
|
107
|
+
"dev:editor": "cd editor && npm run dev",
|
|
108
|
+
"typecheck": "tsc --noEmit",
|
|
109
|
+
"test": "vitest run",
|
|
110
|
+
"test:unit": "vitest run tests/unit/",
|
|
111
|
+
"test:integration": "vitest run tests/integration/",
|
|
112
|
+
"test:emulator": "bash tests/scripts/test-with-emulator.sh",
|
|
113
|
+
"test:emulator:unit": "bash tests/scripts/test-with-emulator.sh tests/unit/",
|
|
114
|
+
"test:emulator:integration": "bash tests/scripts/test-with-emulator.sh tests/integration/",
|
|
115
|
+
"test:coverage": "vitest run --coverage",
|
|
116
|
+
"test:watch": "vitest",
|
|
117
|
+
"emulator:start": "cd tests/emulator && firebase emulators:start -P demo-firegraph",
|
|
118
|
+
"emulator:stop": "npx kill-port -y 4188 8188",
|
|
119
|
+
"test:pipeline": "vitest run tests/pipeline/ --config tests/pipeline/vitest.config.ts",
|
|
120
|
+
"test:pipeline:integration": "vitest run --config tests/integration-pipeline/vitest.config.ts"
|
|
121
|
+
}
|
|
122
|
+
}
|