@bardioc/app-sdk 0.4.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 (41) hide show
  1. package/LICENSE +5 -0
  2. package/README.md +368 -0
  3. package/assets/fonts/README.md +11 -0
  4. package/assets/fonts/bardioc-fonts.css +55 -0
  5. package/assets/fonts/v1/geist-mono-latin-wght-normal.woff2 +0 -0
  6. package/assets/fonts/v1/nunito-sans-latin-wght-italic.woff2 +0 -0
  7. package/assets/fonts/v1/nunito-sans-latin-wght-normal.woff2 +0 -0
  8. package/dist/contract-matrix.d.ts +130 -0
  9. package/dist/contract-matrix.js +132 -0
  10. package/dist/dev-auth-proxy-core.d.ts +24 -0
  11. package/dist/dev-auth-proxy-core.js +59 -0
  12. package/dist/dev-auth-vite.d.ts +34 -0
  13. package/dist/dev-auth-vite.js +221 -0
  14. package/dist/dev-proxy.d.ts +8 -0
  15. package/dist/dev-proxy.js +40 -0
  16. package/dist/dev-session-cli.d.ts +34 -0
  17. package/dist/dev-session-cli.js +125 -0
  18. package/dist/dev.d.ts +33 -0
  19. package/dist/dev.js +223 -0
  20. package/dist/dot-env.d.ts +2 -0
  21. package/dist/dot-env.js +22 -0
  22. package/dist/errors.d.ts +27 -0
  23. package/dist/errors.js +57 -0
  24. package/dist/host-bridge.d.ts +3 -0
  25. package/dist/host-bridge.js +260 -0
  26. package/dist/index.d.ts +9 -0
  27. package/dist/index.js +6 -0
  28. package/dist/manifest.d.ts +78 -0
  29. package/dist/manifest.js +169 -0
  30. package/dist/protocol.d.ts +26 -0
  31. package/dist/protocol.js +28 -0
  32. package/dist/react.d.ts +26 -0
  33. package/dist/react.js +208 -0
  34. package/dist/transports/graph-transport.d.ts +224 -0
  35. package/dist/transports/graph-transport.js +584 -0
  36. package/dist/transports/os-transport.d.ts +189 -0
  37. package/dist/transports/os-transport.js +444 -0
  38. package/dist/types.d.ts +343 -0
  39. package/dist/vite.d.ts +9 -0
  40. package/dist/vite.js +262 -0
  41. package/package.json +101 -0
@@ -0,0 +1,224 @@
1
+ import type { BatchResult, DeleteOptions, GetNodeOptions, GraphEdgeRaw, GraphNodeRaw, GremlinOptions, HistoryEntry, HistoryOptions, MutationOptions, QueryOptions, SdkTransportPayload, TimeseriesOptions, TimeseriesQueryOptions, TimeseriesValue, TransportScopeOptions } from '../types.js';
2
+ /** Graph transport class providing graph database operations */
3
+ export declare class GraphTransport {
4
+ private _request;
5
+ private _debug;
6
+ constructor(_request: <T = unknown>(payload: SdkTransportPayload) => Promise<T>, options?: {
7
+ debug?: boolean;
8
+ });
9
+ private log;
10
+ private withScope;
11
+ /**
12
+ * Get single node by ID
13
+ * Returns raw backend format (ogit/* fields)
14
+ *
15
+ * @throws {EntityNotFoundError} if node doesn't exist
16
+ * @throws {NetworkError} on HTTP errors
17
+ * @throws {TimeoutError} on request timeout
18
+ */
19
+ get<T = GraphNodeRaw>(id: string, options?: GetNodeOptions): Promise<T>;
20
+ /**
21
+ * Get multiple nodes by IDs (batched request)
22
+ * Uses /query/ids endpoint
23
+ *
24
+ * @returns Array in same order as input IDs (missing nodes = undefined)
25
+ * @throws {ValidationError} if ids array is empty or invalid
26
+ * @throws {NetworkError} on HTTP errors
27
+ * @throws {TimeoutError} on request timeout
28
+ */
29
+ getMany<T = GraphNodeRaw>(ids: string[], options?: GetNodeOptions): Promise<(T | undefined)[]>;
30
+ /**
31
+ * Get node by external ID
32
+ *
33
+ * @throws {EntityNotFoundError} if XID doesn't exist
34
+ * @throws {NetworkError} on HTTP errors
35
+ * @throws {TimeoutError} on request timeout
36
+ */
37
+ getByXid<T = GraphNodeRaw>(xid: string, options?: GetNodeOptions): Promise<T>;
38
+ /**
39
+ * Query nodes using Lucene syntax
40
+ * Returns raw backend format (ogit/* fields)
41
+ *
42
+ * @example
43
+ * const people = await graph.query<GraphNodeRaw>(
44
+ * 'ogit/_type:ogit/Person',
45
+ * { limit: 50, offset: 0 }
46
+ * );
47
+ *
48
+ * @throws {ValidationError} if query syntax is invalid
49
+ * @throws {NetworkError} on HTTP errors
50
+ * @throws {TimeoutError} on request timeout
51
+ */
52
+ query<T = GraphNodeRaw>(lucene: string, options?: QueryOptions): Promise<T[]>;
53
+ /**
54
+ * Execute Gremlin traversal query
55
+ * Returns raw results (structure varies by query)
56
+ *
57
+ * @example
58
+ * const edges = await graph.gremlin(rootId, "outE('ogit/relates')");
59
+ *
60
+ * @throws {EntityNotFoundError} if root node doesn't exist
61
+ * @throws {ValidationError} if query syntax is invalid
62
+ * @throws {NetworkError} on HTTP errors
63
+ * @throws {TimeoutError} on request timeout
64
+ */
65
+ gremlin<T = unknown>(rootId: string, query: string, options?: GremlinOptions): Promise<T[]>;
66
+ /**
67
+ * Execute combined query (Lucene + Gremlin in single call)
68
+ * Returns raw results (structure varies by query)
69
+ *
70
+ * @example
71
+ * const results = await graph.combined(
72
+ * 'ogit/_type:ogit/Person AND name:Test',
73
+ * { limit: 50 }
74
+ * );
75
+ *
76
+ * @throws {ValidationError} if query syntax is invalid
77
+ * @throws {NetworkError} on HTTP errors
78
+ * @throws {TimeoutError} on request timeout
79
+ */
80
+ combined<T = unknown>(query: string, options?: QueryOptions): Promise<T[]>;
81
+ /**
82
+ * Create new graph node
83
+ *
84
+ * @param type - OGIT type (e.g., 'ogit/Person')
85
+ * @param data - Node attributes (ogit/* format)
86
+ * @returns Created node (raw backend format)
87
+ *
88
+ * @throws {ValidationError} if data is invalid or missing required fields
89
+ * @throws {PermissionError} if user lacks permission to create this type
90
+ * @throws {NetworkError} on HTTP errors
91
+ * @throws {TimeoutError} on request timeout
92
+ */
93
+ create<T = GraphNodeRaw>(type: string, data: Record<string, unknown>, options?: MutationOptions): Promise<T>;
94
+ /**
95
+ * Update existing node
96
+ *
97
+ * @param id - Node ID
98
+ * @param data - Fields to update (ogit/* format)
99
+ * @returns Updated node (raw backend format)
100
+ *
101
+ * @throws {EntityNotFoundError} if node doesn't exist
102
+ * @throws {ValidationError} if data is invalid
103
+ * @throws {PermissionError} if user lacks permission to update this node
104
+ * @throws {NetworkError} on HTTP errors
105
+ * @throws {TimeoutError} on request timeout
106
+ */
107
+ update<T = GraphNodeRaw>(id: string, data: Record<string, unknown>, options?: MutationOptions): Promise<T>;
108
+ /**
109
+ * Delete node (soft delete by default)
110
+ *
111
+ * @throws {EntityNotFoundError} if node doesn't exist
112
+ * @throws {PermissionError} if user lacks permission to delete this node
113
+ * @throws {NetworkError} on HTTP errors
114
+ * @throws {TimeoutError} on request timeout
115
+ */
116
+ delete(id: string, options?: DeleteOptions): Promise<void>;
117
+ /**
118
+ * Create edge between two nodes
119
+ *
120
+ * @param from - Source node ID
121
+ * @param to - Target node ID
122
+ * @param type - Edge type (e.g., 'ogit/relates')
123
+ * @returns Created edge (raw backend format)
124
+ *
125
+ * @throws {EntityNotFoundError} if either node doesn't exist
126
+ * @throws {ValidationError} if edge type is invalid or not allowed
127
+ * @throws {PermissionError} if user lacks permission to create this edge
128
+ * @throws {NetworkError} on HTTP errors
129
+ * @throws {TimeoutError} on request timeout
130
+ */
131
+ connect<T = GraphEdgeRaw>(from: string, to: string, type: string, options?: MutationOptions): Promise<T>;
132
+ /**
133
+ * Get node history
134
+ *
135
+ * @param nodeId - Node ID
136
+ * @param options - Time range, limit, etc.
137
+ * @returns Array of historical versions
138
+ *
139
+ * @throws {EntityNotFoundError} if node doesn't exist
140
+ * @throws {NetworkError} on HTTP errors
141
+ * @throws {TimeoutError} on request timeout
142
+ */
143
+ history(nodeId: string, options?: HistoryOptions): Promise<HistoryEntry[]>;
144
+ /**
145
+ * Batch operations
146
+ */
147
+ batch: {
148
+ /**
149
+ * Delete multiple nodes in parallel
150
+ * Continues deleting even if some fail
151
+ *
152
+ * @param ids - Array of node IDs to delete
153
+ * @param options - Delete options (hard delete, etc.)
154
+ * @returns BatchResult with succeeded and failed IDs
155
+ *
156
+ * @example
157
+ * const result = await graph.batch.delete(['id1', 'id2', 'id3'], { hard: false });
158
+ * console.log(`Deleted: ${result.succeeded.length}, Failed: ${result.failed.length}`);
159
+ * result.failed.forEach(f => console.error(`Failed ${f.id}: ${f.error}`));
160
+ */
161
+ delete: (ids: string[], options?: DeleteOptions) => Promise<BatchResult>;
162
+ };
163
+ /**
164
+ * Time series operations
165
+ */
166
+ timeseries: {
167
+ /**
168
+ * Get time series values
169
+ *
170
+ * @throws {EntityNotFoundError} if time series doesn't exist
171
+ * @throws {NetworkError} on HTTP errors
172
+ * @throws {TimeoutError} on request timeout
173
+ */
174
+ get: (id: string, options?: TimeseriesOptions) => Promise<TimeseriesValue[]>;
175
+ /**
176
+ * Add time series values
177
+ *
178
+ * @throws {EntityNotFoundError} if time series doesn't exist
179
+ * @throws {ValidationError} if values format is invalid
180
+ * @throws {NetworkError} on HTTP errors
181
+ * @throws {TimeoutError} on request timeout
182
+ */
183
+ add: (id: string, values: TimeseriesValue[], options?: TransportScopeOptions) => Promise<void>;
184
+ /**
185
+ * Query time series with filters
186
+ *
187
+ * @throws {ValidationError} if query options are invalid
188
+ * @throws {NetworkError} on HTTP errors
189
+ * @throws {TimeoutError} on request timeout
190
+ */
191
+ query: (options: TimeseriesQueryOptions) => Promise<TimeseriesValue[]>;
192
+ };
193
+ /**
194
+ * Content/blob operations
195
+ */
196
+ content: {
197
+ /**
198
+ * Upload binary content to a node
199
+ *
200
+ * @param nodeId - Node ID to attach content to
201
+ * @param data - Binary content as Blob
202
+ * @param contentType - MIME type (e.g., 'image/png', 'application/pdf')
203
+ * @returns Content ID for later retrieval
204
+ *
205
+ * @throws {EntityNotFoundError} if node doesn't exist
206
+ * @throws {ValidationError} if content is invalid
207
+ * @throws {NetworkError} on HTTP errors
208
+ * @throws {TimeoutError} on request timeout
209
+ */
210
+ set: (nodeId: string, data: Blob, contentType: string, options?: TransportScopeOptions) => Promise<string>;
211
+ /**
212
+ * Download binary content from a node
213
+ *
214
+ * @param nodeId - Node ID
215
+ * @param contentId - Content ID returned from set operation
216
+ * @returns Binary content as Blob
217
+ *
218
+ * @throws {EntityNotFoundError} if node or content doesn't exist
219
+ * @throws {NetworkError} on HTTP errors
220
+ * @throws {TimeoutError} on request timeout
221
+ */
222
+ get: (nodeId: string, contentId: string, options?: TransportScopeOptions) => Promise<Blob>;
223
+ };
224
+ }