@cedarjs/gqlorm 5.0.7-next.338 → 5.0.7
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/cjs/generator/graphqlGenerator.d.ts +30 -0
- package/dist/cjs/generator/graphqlGenerator.d.ts.map +1 -0
- package/dist/cjs/generator/graphqlGenerator.js +430 -0
- package/dist/cjs/live/types.d.ts +262 -0
- package/dist/cjs/live/types.d.ts.map +1 -0
- package/dist/cjs/live/types.js +16 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/parser/queryParser.d.ts +27 -0
- package/dist/cjs/parser/queryParser.d.ts.map +1 -0
- package/dist/cjs/parser/queryParser.js +339 -0
- package/dist/cjs/queryBuilder.d.ts +114 -0
- package/dist/cjs/queryBuilder.d.ts.map +1 -0
- package/dist/cjs/queryBuilder.js +238 -0
- package/dist/cjs/react/useLiveQuery.d.ts +12 -0
- package/dist/cjs/react/useLiveQuery.d.ts.map +1 -0
- package/dist/cjs/react/useLiveQuery.js +62 -0
- package/dist/cjs/setup.d.ts +39 -0
- package/dist/cjs/setup.d.ts.map +1 -0
- package/dist/cjs/setup.js +31 -0
- package/dist/cjs/types/ast.d.ts +80 -0
- package/dist/cjs/types/ast.d.ts.map +1 -0
- package/dist/cjs/types/ast.js +16 -0
- package/dist/cjs/types/orm.d.ts +163 -0
- package/dist/cjs/types/orm.d.ts.map +1 -0
- package/dist/cjs/types/orm.js +16 -0
- package/dist/cjs/types/orm_for_testing.d.ts +44 -0
- package/dist/cjs/types/orm_for_testing.d.ts.map +1 -0
- package/dist/cjs/types/orm_for_testing.js +16 -0
- package/dist/cjs/types/schema.d.ts +4 -0
- package/dist/cjs/types/schema.d.ts.map +1 -0
- package/dist/cjs/types/schema.js +16 -0
- package/dist/cjs/types/typeUtils.d.ts +10 -0
- package/dist/cjs/types/typeUtils.d.ts.map +1 -0
- package/dist/cjs/types/typeUtils.js +65 -0
- package/dist/react/useLiveQuery.d.ts +2 -5
- package/dist/react/useLiveQuery.d.ts.map +1 -1
- package/package.json +67 -22
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Main query builder entry point that combines parsing and generation
|
|
3
|
+
* This is the primary API that users will interact with
|
|
4
|
+
*/
|
|
5
|
+
import { GraphQLGenerateError } from './generator/graphqlGenerator.js';
|
|
6
|
+
import type { GraphQLQuery } from './generator/graphqlGenerator.js';
|
|
7
|
+
import { QueryParseError } from './parser/queryParser.js';
|
|
8
|
+
import type { QueryAST, QueryOperation } from './types/ast.js';
|
|
9
|
+
import { type FindFirstArgs, type FindManyArgs, type FindUniqueArgs, type FrameworkDbClient, type QueryFunction } from './types/orm.js';
|
|
10
|
+
import type { ModelSchema } from './types/schema.js';
|
|
11
|
+
export declare class QueryBuilderError extends Error {
|
|
12
|
+
cause?: Error | undefined;
|
|
13
|
+
constructor(message: string, cause?: Error | undefined);
|
|
14
|
+
}
|
|
15
|
+
type GenericQueryArgs = FindManyArgs<unknown> | FindUniqueArgs<unknown> | FindFirstArgs<unknown>;
|
|
16
|
+
export interface QueryBuilderOptions {
|
|
17
|
+
/**
|
|
18
|
+
* Whether to validate queries against schema (future feature)
|
|
19
|
+
*/
|
|
20
|
+
readonly validateSchema?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Whether to optimize queries (future feature)
|
|
23
|
+
*/
|
|
24
|
+
readonly optimizeQueries?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Custom field name mappings (future feature)
|
|
27
|
+
*/
|
|
28
|
+
fieldMappings?: Record<string, string>;
|
|
29
|
+
/**
|
|
30
|
+
* Whether to automatically add @live directive to queries
|
|
31
|
+
* @default false
|
|
32
|
+
*/
|
|
33
|
+
readonly enableLiveQueries?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Whether to force @live directive on all queries (overrides
|
|
36
|
+
* enableLiveQueries)
|
|
37
|
+
* @default false
|
|
38
|
+
*/
|
|
39
|
+
readonly forceLiveQueries?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Model schema defining scalar fields for each model
|
|
42
|
+
*/
|
|
43
|
+
readonly schema?: ModelSchema;
|
|
44
|
+
}
|
|
45
|
+
export declare class QueryBuilder {
|
|
46
|
+
#private;
|
|
47
|
+
constructor(options?: QueryBuilderOptions);
|
|
48
|
+
/**
|
|
49
|
+
* Build GraphQL query from ORM-style query
|
|
50
|
+
*/
|
|
51
|
+
build(model: string, operation: QueryOperation, args?: GenericQueryArgs, options?: {
|
|
52
|
+
isLive?: boolean;
|
|
53
|
+
}): GraphQLQuery;
|
|
54
|
+
/**
|
|
55
|
+
* Build GraphQL query from a query function (used with useLiveQuery)
|
|
56
|
+
*/
|
|
57
|
+
buildFromFunction<T, TDb extends object = FrameworkDbClient>(queryFn: QueryFunction<T, TDb>, options?: {
|
|
58
|
+
isLive?: boolean;
|
|
59
|
+
}): GraphQLQuery;
|
|
60
|
+
/**
|
|
61
|
+
* Capture query details from a query function using a proxy
|
|
62
|
+
*/
|
|
63
|
+
private captureQuery;
|
|
64
|
+
/**
|
|
65
|
+
* Create a proxy database client that captures method calls
|
|
66
|
+
*/
|
|
67
|
+
private createProxyDatabase;
|
|
68
|
+
/**
|
|
69
|
+
* Create a proxy model delegate that captures method calls
|
|
70
|
+
*/
|
|
71
|
+
private createModelDelegate;
|
|
72
|
+
/**
|
|
73
|
+
* Parse AST from query (exposed for advanced usage)
|
|
74
|
+
*/
|
|
75
|
+
parseAST(model: string, operation: QueryOperation, args?: GenericQueryArgs): QueryAST;
|
|
76
|
+
/**
|
|
77
|
+
* Generate GraphQL from AST (exposed for advanced usage)
|
|
78
|
+
*/
|
|
79
|
+
generateGraphQL(ast: QueryAST): GraphQLQuery;
|
|
80
|
+
/**
|
|
81
|
+
* Get query builder options
|
|
82
|
+
*/
|
|
83
|
+
getOptions(): QueryBuilderOptions;
|
|
84
|
+
/**
|
|
85
|
+
* Update query builder options
|
|
86
|
+
*/
|
|
87
|
+
updateOptions(newOptions: Partial<QueryBuilderOptions>): void;
|
|
88
|
+
/**
|
|
89
|
+
* Configure the query builder options.
|
|
90
|
+
* Merges the provided options over the current options (non-destructive).
|
|
91
|
+
* When the `schema` key is present in the options object, it is forwarded
|
|
92
|
+
* to the generator — including `undefined`, which reverts to the id-only
|
|
93
|
+
* fallback. Safe to call multiple times — last call wins.
|
|
94
|
+
*/
|
|
95
|
+
configure(options: Partial<QueryBuilderOptions>): void;
|
|
96
|
+
}
|
|
97
|
+
export declare const queryBuilder: QueryBuilder;
|
|
98
|
+
export declare function buildQuery(model: string, operation: QueryOperation, args?: GenericQueryArgs, options?: {
|
|
99
|
+
isLive?: boolean;
|
|
100
|
+
}): GraphQLQuery;
|
|
101
|
+
export declare function buildQueryFromFunction<T, TDb extends object = FrameworkDbClient>(queryFn: QueryFunction<T, TDb>, options?: {
|
|
102
|
+
isLive?: boolean;
|
|
103
|
+
}): GraphQLQuery;
|
|
104
|
+
/**
|
|
105
|
+
* Build a live GraphQL query from ORM-style query (convenience function)
|
|
106
|
+
*/
|
|
107
|
+
export declare function buildLiveQuery(model: string, operation: QueryOperation, args?: GenericQueryArgs): GraphQLQuery;
|
|
108
|
+
/**
|
|
109
|
+
* Build a live GraphQL query from a query function (convenience function)
|
|
110
|
+
*/
|
|
111
|
+
export declare function buildLiveQueryFromFunction<T, TDb extends object = FrameworkDbClient>(queryFn: QueryFunction<T, TDb>): GraphQLQuery;
|
|
112
|
+
export { GraphQLGenerateError, QueryParseError };
|
|
113
|
+
export type { GraphQLQuery, QueryAST, QueryOperation, ModelSchema };
|
|
114
|
+
//# sourceMappingURL=queryBuilder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queryBuilder.d.ts","sourceRoot":"","sources":["../../src/queryBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,oBAAoB,EAErB,MAAM,iCAAiC,CAAA;AACxC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AACnE,O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EACzB,IAAI,CAAC,EAAE,gBAAgB,GACtB,YAAY,CAEd;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CACxC,CAAC,EACD,GAAG,SAAS,MAAM,GAAG,iBAAiB,EACtC,OAAO,EAAE,aAAa,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,YAAY,CAE9C;AAGD,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,CAAA;AAEhD,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,cAAc,EAAE,WAAW,EAAE,CAAA"}
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var queryBuilder_exports = {};
|
|
20
|
+
__export(queryBuilder_exports, {
|
|
21
|
+
GraphQLGenerateError: () => import_graphqlGenerator.GraphQLGenerateError,
|
|
22
|
+
QueryBuilder: () => QueryBuilder,
|
|
23
|
+
QueryBuilderError: () => QueryBuilderError,
|
|
24
|
+
QueryParseError: () => import_queryParser.QueryParseError,
|
|
25
|
+
buildLiveQuery: () => buildLiveQuery,
|
|
26
|
+
buildLiveQueryFromFunction: () => buildLiveQueryFromFunction,
|
|
27
|
+
buildQuery: () => buildQuery,
|
|
28
|
+
buildQueryFromFunction: () => buildQueryFromFunction,
|
|
29
|
+
queryBuilder: () => queryBuilder
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(queryBuilder_exports);
|
|
32
|
+
var import_graphqlGenerator = require("./generator/graphqlGenerator.js");
|
|
33
|
+
var import_queryParser = require("./parser/queryParser.js");
|
|
34
|
+
class QueryBuilderError extends Error {
|
|
35
|
+
constructor(message, cause) {
|
|
36
|
+
super(message);
|
|
37
|
+
this.cause = cause;
|
|
38
|
+
this.name = "QueryBuilderError";
|
|
39
|
+
}
|
|
40
|
+
cause;
|
|
41
|
+
}
|
|
42
|
+
class QueryBuilder {
|
|
43
|
+
#parser = new import_queryParser.QueryParser();
|
|
44
|
+
#generator;
|
|
45
|
+
#options;
|
|
46
|
+
constructor(options = {}) {
|
|
47
|
+
this.#options = structuredClone(options);
|
|
48
|
+
this.#generator = new import_graphqlGenerator.GraphQLGenerator(options.schema);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Build GraphQL query from ORM-style query
|
|
52
|
+
*/
|
|
53
|
+
build(model, operation, args, options) {
|
|
54
|
+
try {
|
|
55
|
+
const ast = this.#parser.parseQuery(model, operation, args);
|
|
56
|
+
if (this.#shouldUseLiveQuery(options?.isLive)) {
|
|
57
|
+
ast.isLive = true;
|
|
58
|
+
}
|
|
59
|
+
this.#parser.validateAST(ast);
|
|
60
|
+
const graphqlQuery = this.#generator.generate(ast);
|
|
61
|
+
return graphqlQuery;
|
|
62
|
+
} catch (error) {
|
|
63
|
+
if (error instanceof import_queryParser.QueryParseError || error instanceof import_graphqlGenerator.GraphQLGenerateError) {
|
|
64
|
+
throw new QueryBuilderError(
|
|
65
|
+
`Failed to build query: ${error.message}`,
|
|
66
|
+
error
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
throw error;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
buildFromFunction(queryFn, options) {
|
|
73
|
+
const capturedQuery = this.captureQuery(queryFn);
|
|
74
|
+
if (!capturedQuery) {
|
|
75
|
+
throw new QueryBuilderError(
|
|
76
|
+
"No query was captured from the provided function"
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
return this.build(
|
|
80
|
+
capturedQuery.model,
|
|
81
|
+
capturedQuery.operation,
|
|
82
|
+
capturedQuery.args,
|
|
83
|
+
options
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Capture query details from a query function using a proxy
|
|
88
|
+
*/
|
|
89
|
+
captureQuery(queryFn) {
|
|
90
|
+
let capturedQuery = null;
|
|
91
|
+
const proxyDb = this.createProxyDatabase((model, operation, args) => {
|
|
92
|
+
capturedQuery = { model, operation, args };
|
|
93
|
+
return {};
|
|
94
|
+
});
|
|
95
|
+
try {
|
|
96
|
+
queryFn(proxyDb);
|
|
97
|
+
return capturedQuery;
|
|
98
|
+
} catch (error) {
|
|
99
|
+
const e = error instanceof Error ? error : new Error(String(error));
|
|
100
|
+
throw new QueryBuilderError("Failed to capture query from function", e);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Create a proxy database client that captures method calls
|
|
105
|
+
*/
|
|
106
|
+
createProxyDatabase(onQuery) {
|
|
107
|
+
const proxyTarget = {};
|
|
108
|
+
return new Proxy(proxyTarget, {
|
|
109
|
+
get: (_, modelName) => {
|
|
110
|
+
if (typeof modelName !== "string") {
|
|
111
|
+
return void 0;
|
|
112
|
+
}
|
|
113
|
+
return this.createModelDelegate(modelName, onQuery);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Create a proxy model delegate that captures method calls
|
|
119
|
+
*/
|
|
120
|
+
createModelDelegate(model, onQuery) {
|
|
121
|
+
return {
|
|
122
|
+
findMany: (args) => {
|
|
123
|
+
onQuery(model, "findMany", args);
|
|
124
|
+
return Promise.resolve([]);
|
|
125
|
+
},
|
|
126
|
+
findUnique: (args) => {
|
|
127
|
+
onQuery(model, "findUnique", args);
|
|
128
|
+
return Promise.resolve(null);
|
|
129
|
+
},
|
|
130
|
+
findFirst: (args) => {
|
|
131
|
+
onQuery(model, "findFirst", args);
|
|
132
|
+
return Promise.resolve(null);
|
|
133
|
+
},
|
|
134
|
+
findUniqueOrThrow: (args) => {
|
|
135
|
+
onQuery(model, "findUniqueOrThrow", args);
|
|
136
|
+
return Promise.resolve(void 0);
|
|
137
|
+
},
|
|
138
|
+
findFirstOrThrow: (args) => {
|
|
139
|
+
onQuery(model, "findFirstOrThrow", args);
|
|
140
|
+
return Promise.resolve(void 0);
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Parse AST from query (exposed for advanced usage)
|
|
146
|
+
*/
|
|
147
|
+
parseAST(model, operation, args) {
|
|
148
|
+
try {
|
|
149
|
+
return this.#parser.parseQuery(model, operation, args);
|
|
150
|
+
} catch (error) {
|
|
151
|
+
if (error instanceof import_queryParser.QueryParseError) {
|
|
152
|
+
throw new QueryBuilderError(
|
|
153
|
+
`Failed to parse query: ${error.message}`,
|
|
154
|
+
error
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
throw error;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Generate GraphQL from AST (exposed for advanced usage)
|
|
162
|
+
*/
|
|
163
|
+
generateGraphQL(ast) {
|
|
164
|
+
try {
|
|
165
|
+
return this.#generator.generate(ast);
|
|
166
|
+
} catch (error) {
|
|
167
|
+
if (error instanceof import_graphqlGenerator.GraphQLGenerateError) {
|
|
168
|
+
throw new QueryBuilderError(
|
|
169
|
+
`Failed to generate GraphQL: ${error.message}`,
|
|
170
|
+
error
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
throw error;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Get query builder options
|
|
178
|
+
*/
|
|
179
|
+
getOptions() {
|
|
180
|
+
return structuredClone(this.#options);
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Update query builder options
|
|
184
|
+
*/
|
|
185
|
+
updateOptions(newOptions) {
|
|
186
|
+
this.#options = { ...this.#options, ...newOptions };
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Configure the query builder options.
|
|
190
|
+
* Merges the provided options over the current options (non-destructive).
|
|
191
|
+
* When the `schema` key is present in the options object, it is forwarded
|
|
192
|
+
* to the generator — including `undefined`, which reverts to the id-only
|
|
193
|
+
* fallback. Safe to call multiple times — last call wins.
|
|
194
|
+
*/
|
|
195
|
+
configure(options) {
|
|
196
|
+
this.#options = { ...this.#options, ...options };
|
|
197
|
+
if ("schema" in options) {
|
|
198
|
+
this.#generator.setSchema(options.schema);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Determine if a query should use @live directive
|
|
203
|
+
*/
|
|
204
|
+
#shouldUseLiveQuery(explicitIsLive) {
|
|
205
|
+
if (explicitIsLive !== void 0) {
|
|
206
|
+
return explicitIsLive;
|
|
207
|
+
}
|
|
208
|
+
if (this.#options.forceLiveQueries) {
|
|
209
|
+
return true;
|
|
210
|
+
}
|
|
211
|
+
return this.#options.enableLiveQueries || false;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
const queryBuilder = new QueryBuilder();
|
|
215
|
+
function buildQuery(model, operation, args, options) {
|
|
216
|
+
return queryBuilder.build(model, operation, args, options);
|
|
217
|
+
}
|
|
218
|
+
function buildQueryFromFunction(queryFn, options) {
|
|
219
|
+
return queryBuilder.buildFromFunction(queryFn, options);
|
|
220
|
+
}
|
|
221
|
+
function buildLiveQuery(model, operation, args) {
|
|
222
|
+
return queryBuilder.build(model, operation, args, { isLive: true });
|
|
223
|
+
}
|
|
224
|
+
function buildLiveQueryFromFunction(queryFn) {
|
|
225
|
+
return queryBuilder.buildFromFunction(queryFn, { isLive: true });
|
|
226
|
+
}
|
|
227
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
228
|
+
0 && (module.exports = {
|
|
229
|
+
GraphQLGenerateError,
|
|
230
|
+
QueryBuilder,
|
|
231
|
+
QueryBuilderError,
|
|
232
|
+
QueryParseError,
|
|
233
|
+
buildLiveQuery,
|
|
234
|
+
buildLiveQueryFromFunction,
|
|
235
|
+
buildQuery,
|
|
236
|
+
buildQueryFromFunction,
|
|
237
|
+
queryBuilder
|
|
238
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React hook for live data fetching using GraphQL queries with `@live`
|
|
3
|
+
* generated from Prisma-like query functions.
|
|
4
|
+
*/
|
|
5
|
+
import { useQuery as cedarUseQuery } from '@cedarjs/web';
|
|
6
|
+
import type { FrameworkDbClient, QueryFunction } from '../types/orm.js';
|
|
7
|
+
export type UseLiveQueryOptions = Omit<NonNullable<Parameters<typeof cedarUseQuery>[1]>, 'variables'>;
|
|
8
|
+
export type UseLiveQueryResult<T> = Omit<ReturnType<typeof cedarUseQuery>, 'data'> & {
|
|
9
|
+
data: T | undefined;
|
|
10
|
+
};
|
|
11
|
+
export declare function useLiveQuery<T, TDb extends object = FrameworkDbClient>(queryFn: QueryFunction<T, TDb>, options?: UseLiveQueryOptions): UseLiveQueryResult<T>;
|
|
12
|
+
//# sourceMappingURL=useLiveQuery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLiveQuery.d.ts","sourceRoot":"","sources":["../../../src/react/useLiveQuery.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,EAAE,QAAQ,IAAI,aAAa,EAAE,MAAM,cAAc,CAAA;AAGxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAKvE,MAAM,MAAM,mBAAmB,GAAG,IAAI,CACpC,WAAW,CAAC,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,EAChD,WAAW,CACZ,CAAA;AAED,MAAM,MAAM,kBAAkB,CAAC,CAAC,IAAI,IAAI,CACtC,UAAU,CAAC,OAAO,aAAa,CAAC,EAChC,MAAM,CACP,GAAG;IACF,IAAI,EAAE,CAAC,GAAG,SAAS,CAAA;CACpB,CAAA;AAYD,wBAAgB,YAAY,CAAC,CAAC,EAAE,GAAG,SAAS,MAAM,GAAG,iBAAiB,EACpE,OAAO,EAAE,aAAa,CAAC,CAAC,EAAE,GAAG,CAAC,EAC9B,OAAO,CAAC,EAAE,mBAAmB,GAC5B,kBAAkB,CAAC,CAAC,CAAC,CA4BvB"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var useLiveQuery_exports = {};
|
|
20
|
+
__export(useLiveQuery_exports, {
|
|
21
|
+
useLiveQuery: () => useLiveQuery
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(useLiveQuery_exports);
|
|
24
|
+
var import_react = require("react");
|
|
25
|
+
var import_graphql = require("graphql");
|
|
26
|
+
var import_web = require("@cedarjs/web");
|
|
27
|
+
var import_queryBuilder = require("../queryBuilder.js");
|
|
28
|
+
function extractRootFieldData(payload) {
|
|
29
|
+
if (!payload) {
|
|
30
|
+
return void 0;
|
|
31
|
+
}
|
|
32
|
+
return Object.values(payload)[0];
|
|
33
|
+
}
|
|
34
|
+
function useLiveQuery(queryFn, options) {
|
|
35
|
+
const { query, variables } = (0, import_react.useMemo)(() => {
|
|
36
|
+
try {
|
|
37
|
+
const graphqlQuery = import_queryBuilder.queryBuilder.buildFromFunction(queryFn, {
|
|
38
|
+
isLive: true
|
|
39
|
+
});
|
|
40
|
+
return {
|
|
41
|
+
query: graphqlQuery.query,
|
|
42
|
+
variables: graphqlQuery.variables ?? {}
|
|
43
|
+
};
|
|
44
|
+
} catch (error) {
|
|
45
|
+
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
46
|
+
throw new Error(`Failed to build GraphQL query: ${errorMsg}`);
|
|
47
|
+
}
|
|
48
|
+
}, [queryFn]);
|
|
49
|
+
const document = (0, import_react.useMemo)(() => (0, import_graphql.parse)(query), [query]);
|
|
50
|
+
const queryResult = (0, import_web.useQuery)(document, {
|
|
51
|
+
...options ?? {},
|
|
52
|
+
variables
|
|
53
|
+
});
|
|
54
|
+
return {
|
|
55
|
+
...queryResult,
|
|
56
|
+
data: extractRootFieldData(queryResult.data)
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
60
|
+
0 && (module.exports = {
|
|
61
|
+
useLiveQuery
|
|
62
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public setup API for gqlorm.
|
|
3
|
+
*
|
|
4
|
+
* Call `configureGqlorm()` once at app startup — typically at the top of
|
|
5
|
+
* `App.tsx` or in a dedicated bootstrap file — before any `useLiveQuery`
|
|
6
|
+
* invocations.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* import { configureGqlorm } from '@cedarjs/gqlorm/setup'
|
|
10
|
+
* import schema from '.cedar/gqlorm-schema.json'
|
|
11
|
+
*
|
|
12
|
+
* configureGqlorm({ schema })
|
|
13
|
+
*/
|
|
14
|
+
import type { ModelSchema } from './types/schema.js';
|
|
15
|
+
export interface ConfigureGqlormOptions {
|
|
16
|
+
/**
|
|
17
|
+
* The model schema mapping lowercase model names to their visible scalar
|
|
18
|
+
* field names. Typically imported from `.cedar/gqlorm-schema.json`, which
|
|
19
|
+
* is auto-generated by Cedar's codegen pipeline.
|
|
20
|
+
*
|
|
21
|
+
* When `undefined`, gqlorm falls back to requesting only the `id` field in
|
|
22
|
+
* auto-generated queries (the behaviour before any schema is configured).
|
|
23
|
+
* Passing `undefined` explicitly is useful in test environments where a
|
|
24
|
+
* full schema is not available.
|
|
25
|
+
*/
|
|
26
|
+
schema: ModelSchema | undefined;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Configure gqlorm at app startup.
|
|
30
|
+
*
|
|
31
|
+
* Applies the provided `ModelSchema` to the global `queryBuilder` singleton so
|
|
32
|
+
* that `useLiveQuery((db) => db.post.findMany())` — with no explicit `select`
|
|
33
|
+
* — generates a GraphQL query requesting all visible scalar fields for the
|
|
34
|
+
* model instead of only `id`.
|
|
35
|
+
*
|
|
36
|
+
* The call is idempotent and safe to invoke multiple times; the last call wins.
|
|
37
|
+
*/
|
|
38
|
+
export declare function configureGqlorm(options: ConfigureGqlormOptions): void;
|
|
39
|
+
//# sourceMappingURL=setup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/setup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAEpD,MAAM,WAAW,sBAAsB;IACrC;;;;;;;;;OASG;IACH,MAAM,EAAE,WAAW,GAAG,SAAS,CAAA;CAChC;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,IAAI,CAErE"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var setup_exports = {};
|
|
20
|
+
__export(setup_exports, {
|
|
21
|
+
configureGqlorm: () => configureGqlorm
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(setup_exports);
|
|
24
|
+
var import_queryBuilder = require("./queryBuilder.js");
|
|
25
|
+
function configureGqlorm(options) {
|
|
26
|
+
import_queryBuilder.queryBuilder.configure({ schema: options.schema });
|
|
27
|
+
}
|
|
28
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
29
|
+
0 && (module.exports = {
|
|
30
|
+
configureGqlorm
|
|
31
|
+
});
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Abstract Syntax Tree (AST) types for representing parsed ORM queries
|
|
3
|
+
* These types form the intermediate representation between ORM syntax and
|
|
4
|
+
* GraphQL queries
|
|
5
|
+
*/
|
|
6
|
+
export interface ASTNode {
|
|
7
|
+
type: string;
|
|
8
|
+
}
|
|
9
|
+
export type QueryOperation = 'findMany' | 'findUnique' | 'findFirst' | 'findUniqueOrThrow' | 'findFirstOrThrow';
|
|
10
|
+
export interface QueryAST extends ASTNode {
|
|
11
|
+
type: 'Query';
|
|
12
|
+
model: string;
|
|
13
|
+
operation: QueryOperation;
|
|
14
|
+
args?: QueryArgsAST;
|
|
15
|
+
isLive?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface QueryArgsAST extends ASTNode {
|
|
18
|
+
type: 'QueryArgs';
|
|
19
|
+
where?: WhereAST;
|
|
20
|
+
select?: SelectAST;
|
|
21
|
+
include?: IncludeAST;
|
|
22
|
+
orderBy?: OrderByAST;
|
|
23
|
+
take?: number;
|
|
24
|
+
skip?: number;
|
|
25
|
+
}
|
|
26
|
+
export interface WhereAST extends ASTNode {
|
|
27
|
+
type: 'Where';
|
|
28
|
+
conditions: WhereCondition[];
|
|
29
|
+
}
|
|
30
|
+
export type WhereCondition = FieldCondition | LogicalCondition | RelationCondition;
|
|
31
|
+
export interface FieldCondition extends ASTNode {
|
|
32
|
+
type: 'FieldCondition';
|
|
33
|
+
field: string;
|
|
34
|
+
operator: ComparisonOperator;
|
|
35
|
+
value: any;
|
|
36
|
+
}
|
|
37
|
+
export interface LogicalCondition extends ASTNode {
|
|
38
|
+
type: 'LogicalCondition';
|
|
39
|
+
operator: LogicalOperator;
|
|
40
|
+
conditions: WhereCondition[];
|
|
41
|
+
}
|
|
42
|
+
export interface RelationCondition extends ASTNode {
|
|
43
|
+
type: 'RelationCondition';
|
|
44
|
+
relation: string;
|
|
45
|
+
condition: WhereAST;
|
|
46
|
+
}
|
|
47
|
+
export type ComparisonOperator = 'equals' | 'not' | 'in' | 'notIn' | 'lt' | 'lte' | 'gt' | 'gte' | 'contains' | 'startsWith' | 'endsWith' | 'isNull' | 'isNotNull';
|
|
48
|
+
export type LogicalOperator = 'AND' | 'OR' | 'NOT';
|
|
49
|
+
export interface SelectAST extends ASTNode {
|
|
50
|
+
type: 'Select';
|
|
51
|
+
fields: FieldSelection[];
|
|
52
|
+
}
|
|
53
|
+
export interface FieldSelection extends ASTNode {
|
|
54
|
+
type: 'FieldSelection';
|
|
55
|
+
field: string;
|
|
56
|
+
selected: boolean;
|
|
57
|
+
nested?: SelectAST | IncludeAST;
|
|
58
|
+
}
|
|
59
|
+
export interface IncludeAST extends ASTNode {
|
|
60
|
+
type: 'Include';
|
|
61
|
+
relations: RelationInclusion[];
|
|
62
|
+
}
|
|
63
|
+
export interface RelationInclusion extends ASTNode {
|
|
64
|
+
type: 'RelationInclusion';
|
|
65
|
+
relation: string;
|
|
66
|
+
included: boolean;
|
|
67
|
+
nested?: IncludeAST;
|
|
68
|
+
args?: QueryArgsAST;
|
|
69
|
+
}
|
|
70
|
+
export interface OrderByAST extends ASTNode {
|
|
71
|
+
type: 'OrderBy';
|
|
72
|
+
fields: OrderByField[];
|
|
73
|
+
}
|
|
74
|
+
export interface OrderByField extends ASTNode {
|
|
75
|
+
type: 'OrderByField';
|
|
76
|
+
field: string;
|
|
77
|
+
direction: 'asc' | 'desc';
|
|
78
|
+
}
|
|
79
|
+
export type ASTNodeType = QueryAST | QueryArgsAST | WhereAST | SelectAST | IncludeAST | OrderByAST | FieldCondition | LogicalCondition | RelationCondition | FieldSelection | RelationInclusion | OrderByField;
|
|
80
|
+
//# sourceMappingURL=ast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ast.d.ts","sourceRoot":"","sources":["../../../src/types/ast.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,MAAM,cAAc,GACtB,UAA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iB,GACjB,YAAY,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var ast_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(ast_exports);
|