@constructive-io/graphql-codegen 2.23.3 → 2.24.1
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/README.md +147 -2
- package/cli/codegen/babel-ast.d.ts +53 -0
- package/cli/codegen/babel-ast.js +160 -0
- package/cli/codegen/barrel.d.ts +7 -2
- package/cli/codegen/barrel.js +193 -102
- package/cli/codegen/client.js +61 -0
- package/cli/codegen/custom-mutations.d.ts +2 -12
- package/cli/codegen/custom-mutations.js +116 -124
- package/cli/codegen/custom-queries.d.ts +2 -10
- package/cli/codegen/custom-queries.js +236 -335
- package/cli/codegen/gql-ast.js +22 -1
- package/cli/codegen/index.d.ts +3 -0
- package/cli/codegen/index.js +73 -3
- package/cli/codegen/invalidation.d.ts +20 -0
- package/cli/codegen/invalidation.js +327 -0
- package/cli/codegen/mutation-keys.d.ts +24 -0
- package/cli/codegen/mutation-keys.js +247 -0
- package/cli/codegen/mutations.d.ts +5 -19
- package/cli/codegen/mutations.js +385 -383
- package/cli/codegen/orm/barrel.d.ts +1 -1
- package/cli/codegen/orm/barrel.js +42 -10
- package/cli/codegen/orm/client-generator.d.ts +1 -19
- package/cli/codegen/orm/client-generator.js +108 -77
- package/cli/codegen/orm/custom-ops-generator.d.ts +1 -12
- package/cli/codegen/orm/custom-ops-generator.js +192 -235
- package/cli/codegen/orm/input-types-generator.d.ts +13 -1
- package/cli/codegen/orm/input-types-generator.js +425 -147
- package/cli/codegen/orm/model-generator.d.ts +1 -19
- package/cli/codegen/orm/model-generator.js +229 -234
- package/cli/codegen/queries.d.ts +4 -12
- package/cli/codegen/queries.js +660 -390
- package/cli/codegen/query-keys.d.ts +15 -0
- package/cli/codegen/query-keys.js +477 -0
- package/cli/codegen/scalars.js +1 -0
- package/cli/codegen/schema-types-generator.d.ts +15 -10
- package/cli/codegen/schema-types-generator.js +87 -175
- package/cli/codegen/type-resolver.d.ts +1 -30
- package/cli/codegen/type-resolver.js +0 -53
- package/cli/codegen/types.d.ts +1 -1
- package/cli/codegen/types.js +76 -21
- package/cli/codegen/utils.d.ts +6 -0
- package/cli/codegen/utils.js +19 -0
- package/esm/cli/codegen/babel-ast.d.ts +53 -0
- package/esm/cli/codegen/babel-ast.js +111 -0
- package/esm/cli/codegen/barrel.d.ts +7 -2
- package/esm/cli/codegen/barrel.js +161 -103
- package/esm/cli/codegen/client.js +61 -0
- package/esm/cli/codegen/custom-mutations.d.ts +2 -12
- package/esm/cli/codegen/custom-mutations.js +83 -124
- package/esm/cli/codegen/custom-queries.d.ts +2 -10
- package/esm/cli/codegen/custom-queries.js +204 -336
- package/esm/cli/codegen/gql-ast.js +23 -2
- package/esm/cli/codegen/index.d.ts +3 -0
- package/esm/cli/codegen/index.js +69 -2
- package/esm/cli/codegen/invalidation.d.ts +20 -0
- package/esm/cli/codegen/invalidation.js +291 -0
- package/esm/cli/codegen/mutation-keys.d.ts +24 -0
- package/esm/cli/codegen/mutation-keys.js +211 -0
- package/esm/cli/codegen/mutations.d.ts +5 -19
- package/esm/cli/codegen/mutations.js +353 -384
- package/esm/cli/codegen/orm/barrel.d.ts +1 -1
- package/esm/cli/codegen/orm/barrel.js +10 -11
- package/esm/cli/codegen/orm/client-generator.d.ts +1 -19
- package/esm/cli/codegen/orm/client-generator.js +76 -78
- package/esm/cli/codegen/orm/custom-ops-generator.d.ts +1 -12
- package/esm/cli/codegen/orm/custom-ops-generator.js +160 -236
- package/esm/cli/codegen/orm/input-types-generator.d.ts +13 -1
- package/esm/cli/codegen/orm/input-types-generator.js +393 -148
- package/esm/cli/codegen/orm/model-generator.d.ts +1 -19
- package/esm/cli/codegen/orm/model-generator.js +197 -235
- package/esm/cli/codegen/queries.d.ts +4 -12
- package/esm/cli/codegen/queries.js +628 -391
- package/esm/cli/codegen/query-keys.d.ts +15 -0
- package/esm/cli/codegen/query-keys.js +441 -0
- package/esm/cli/codegen/scalars.js +1 -0
- package/esm/cli/codegen/schema-types-generator.d.ts +15 -10
- package/esm/cli/codegen/schema-types-generator.js +54 -175
- package/esm/cli/codegen/type-resolver.d.ts +1 -30
- package/esm/cli/codegen/type-resolver.js +0 -49
- package/esm/cli/codegen/types.d.ts +1 -1
- package/esm/cli/codegen/types.js +44 -22
- package/esm/cli/codegen/utils.d.ts +6 -0
- package/esm/cli/codegen/utils.js +18 -0
- package/esm/types/config.d.ts +75 -0
- package/esm/types/config.js +18 -0
- package/package.json +6 -4
- package/types/config.d.ts +75 -0
- package/types/config.js +19 -1
- package/cli/codegen/ts-ast.d.ts +0 -124
- package/cli/codegen/ts-ast.js +0 -280
- package/esm/cli/codegen/ts-ast.d.ts +0 -124
- package/esm/cli/codegen/ts-ast.js +0 -260
|
@@ -1,17 +1,48 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.generateModelsBarrel = generateModelsBarrel;
|
|
4
37
|
exports.generateTypesBarrel = generateTypesBarrel;
|
|
5
|
-
const
|
|
38
|
+
const t = __importStar(require("@babel/types"));
|
|
39
|
+
const babel_ast_1 = require("../babel-ast");
|
|
6
40
|
const utils_1 = require("../utils");
|
|
7
41
|
/**
|
|
8
42
|
* Generate the models/index.ts barrel file
|
|
9
43
|
*/
|
|
10
44
|
function generateModelsBarrel(tables) {
|
|
11
|
-
const
|
|
12
|
-
const sourceFile = (0, ts_ast_1.createSourceFile)(project, 'index.ts');
|
|
13
|
-
// Add file header
|
|
14
|
-
sourceFile.insertText(0, (0, ts_ast_1.createFileHeader)('Models barrel export') + '\n\n');
|
|
45
|
+
const statements = [];
|
|
15
46
|
// Export all model classes (Select types are now in input-types.ts)
|
|
16
47
|
for (const table of tables) {
|
|
17
48
|
const { typeName } = (0, utils_1.getTableNames)(table);
|
|
@@ -19,14 +50,15 @@ function generateModelsBarrel(tables) {
|
|
|
19
50
|
// Use same naming logic as model-generator to avoid "index.ts" clash with barrel file
|
|
20
51
|
const baseFileName = (0, utils_1.lcFirst)(typeName);
|
|
21
52
|
const moduleFileName = baseFileName === 'index' ? `${baseFileName}Model` : baseFileName;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
});
|
|
53
|
+
// Create: export { ModelName } from './moduleName';
|
|
54
|
+
const exportDecl = t.exportNamedDeclaration(null, [t.exportSpecifier(t.identifier(modelName), t.identifier(modelName))], t.stringLiteral(`./${moduleFileName}`));
|
|
55
|
+
statements.push(exportDecl);
|
|
26
56
|
}
|
|
57
|
+
const header = (0, utils_1.getGeneratedFileHeader)('Models barrel export');
|
|
58
|
+
const code = (0, babel_ast_1.generateCode)(statements);
|
|
27
59
|
return {
|
|
28
60
|
fileName: 'models/index.ts',
|
|
29
|
-
content:
|
|
61
|
+
content: header + '\n' + code,
|
|
30
62
|
};
|
|
31
63
|
}
|
|
32
64
|
/**
|
|
@@ -1,25 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* ORM Client generator
|
|
2
|
+
* ORM Client generator (Babel AST-based)
|
|
3
3
|
*
|
|
4
4
|
* Generates the createClient() factory function and main client file.
|
|
5
|
-
*
|
|
6
|
-
* Example output:
|
|
7
|
-
* ```typescript
|
|
8
|
-
* import { OrmClient, OrmClientConfig } from './client';
|
|
9
|
-
* import { UserModel } from './models/user';
|
|
10
|
-
* import { queryOperations } from './query';
|
|
11
|
-
* import { mutationOperations } from './mutation';
|
|
12
|
-
*
|
|
13
|
-
* export function createClient(config: OrmClientConfig) {
|
|
14
|
-
* const client = new OrmClient(config);
|
|
15
|
-
* return {
|
|
16
|
-
* user: new UserModel(client),
|
|
17
|
-
* post: new PostModel(client),
|
|
18
|
-
* query: queryOperations(client),
|
|
19
|
-
* mutation: mutationOperations(client),
|
|
20
|
-
* };
|
|
21
|
-
* }
|
|
22
|
-
* ```
|
|
23
5
|
*/
|
|
24
6
|
import type { CleanTable } from '../../../types/schema';
|
|
25
7
|
export interface GeneratedClientFile {
|
|
@@ -1,10 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.generateOrmClientFile = generateOrmClientFile;
|
|
4
37
|
exports.generateQueryBuilderFile = generateQueryBuilderFile;
|
|
5
38
|
exports.generateSelectTypesFile = generateSelectTypesFile;
|
|
6
39
|
exports.generateCreateClientFile = generateCreateClientFile;
|
|
7
|
-
const
|
|
40
|
+
const t = __importStar(require("@babel/types"));
|
|
41
|
+
const babel_ast_1 = require("../babel-ast");
|
|
8
42
|
const utils_1 = require("../utils");
|
|
9
43
|
/**
|
|
10
44
|
* Generate the main client.ts file (OrmClient class)
|
|
@@ -543,105 +577,102 @@ export type InferSelectResult<TEntity, TSelect> = TSelect extends undefined
|
|
|
543
577
|
content,
|
|
544
578
|
};
|
|
545
579
|
}
|
|
580
|
+
function createImportDeclaration(moduleSpecifier, namedImports, typeOnly = false) {
|
|
581
|
+
const specifiers = namedImports.map((name) => t.importSpecifier(t.identifier(name), t.identifier(name)));
|
|
582
|
+
const decl = t.importDeclaration(specifiers, t.stringLiteral(moduleSpecifier));
|
|
583
|
+
decl.importKind = typeOnly ? 'type' : 'value';
|
|
584
|
+
return decl;
|
|
585
|
+
}
|
|
546
586
|
/**
|
|
547
587
|
* Generate the main index.ts with createClient factory
|
|
548
588
|
*/
|
|
549
589
|
function generateCreateClientFile(tables, hasCustomQueries, hasCustomMutations) {
|
|
550
|
-
const
|
|
551
|
-
const sourceFile = (0, ts_ast_1.createSourceFile)(project, 'index.ts');
|
|
552
|
-
// Add file header
|
|
553
|
-
sourceFile.insertText(0, (0, ts_ast_1.createFileHeader)('ORM Client - createClient factory') + '\n\n');
|
|
590
|
+
const statements = [];
|
|
554
591
|
// Add imports
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
namedImports: ['OrmClient'],
|
|
559
|
-
typeOnlyNamedImports: ['OrmClientConfig'],
|
|
560
|
-
}),
|
|
561
|
-
];
|
|
592
|
+
// Import OrmClient (value) and OrmClientConfig (type) separately
|
|
593
|
+
statements.push(createImportDeclaration('./client', ['OrmClient']));
|
|
594
|
+
statements.push(createImportDeclaration('./client', ['OrmClientConfig'], true));
|
|
562
595
|
// Import models
|
|
563
596
|
for (const table of tables) {
|
|
564
597
|
const { typeName } = (0, utils_1.getTableNames)(table);
|
|
565
598
|
const modelName = `${typeName}Model`;
|
|
566
599
|
const fileName = (0, utils_1.lcFirst)(typeName);
|
|
567
|
-
|
|
568
|
-
moduleSpecifier: `./models/${fileName}`,
|
|
569
|
-
namedImports: [modelName],
|
|
570
|
-
}));
|
|
600
|
+
statements.push(createImportDeclaration(`./models/${fileName}`, [modelName]));
|
|
571
601
|
}
|
|
572
602
|
// Import custom operations
|
|
573
603
|
if (hasCustomQueries) {
|
|
574
|
-
|
|
575
|
-
moduleSpecifier: './query',
|
|
576
|
-
namedImports: ['createQueryOperations'],
|
|
577
|
-
}));
|
|
604
|
+
statements.push(createImportDeclaration('./query', ['createQueryOperations']));
|
|
578
605
|
}
|
|
579
606
|
if (hasCustomMutations) {
|
|
580
|
-
|
|
581
|
-
moduleSpecifier: './mutation',
|
|
582
|
-
namedImports: ['createMutationOperations'],
|
|
583
|
-
}));
|
|
607
|
+
statements.push(createImportDeclaration('./mutation', ['createMutationOperations']));
|
|
584
608
|
}
|
|
585
|
-
sourceFile.addImportDeclarations(imports);
|
|
586
609
|
// Re-export types and classes
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
610
|
+
// export type { OrmClientConfig, QueryResult, GraphQLError } from './client';
|
|
611
|
+
const typeExportDecl = t.exportNamedDeclaration(null, [
|
|
612
|
+
t.exportSpecifier(t.identifier('OrmClientConfig'), t.identifier('OrmClientConfig')),
|
|
613
|
+
t.exportSpecifier(t.identifier('QueryResult'), t.identifier('QueryResult')),
|
|
614
|
+
t.exportSpecifier(t.identifier('GraphQLError'), t.identifier('GraphQLError')),
|
|
615
|
+
], t.stringLiteral('./client'));
|
|
616
|
+
typeExportDecl.exportKind = 'type';
|
|
617
|
+
statements.push(typeExportDecl);
|
|
618
|
+
// export { GraphQLRequestError } from './client';
|
|
619
|
+
statements.push(t.exportNamedDeclaration(null, [t.exportSpecifier(t.identifier('GraphQLRequestError'), t.identifier('GraphQLRequestError'))], t.stringLiteral('./client')));
|
|
620
|
+
// export { QueryBuilder } from './query-builder';
|
|
621
|
+
statements.push(t.exportNamedDeclaration(null, [t.exportSpecifier(t.identifier('QueryBuilder'), t.identifier('QueryBuilder'))], t.stringLiteral('./query-builder')));
|
|
622
|
+
// export * from './select-types';
|
|
623
|
+
statements.push(t.exportAllDeclaration(t.stringLiteral('./select-types')));
|
|
624
|
+
// Build the return object properties
|
|
625
|
+
const returnProperties = [];
|
|
626
|
+
for (const table of tables) {
|
|
598
627
|
const { typeName, singularName } = (0, utils_1.getTableNames)(table);
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
628
|
+
const modelName = `${typeName}Model`;
|
|
629
|
+
returnProperties.push(t.objectProperty(t.identifier(singularName), t.newExpression(t.identifier(modelName), [t.identifier('client')])));
|
|
630
|
+
}
|
|
602
631
|
if (hasCustomQueries) {
|
|
603
|
-
|
|
632
|
+
returnProperties.push(t.objectProperty(t.identifier('query'), t.callExpression(t.identifier('createQueryOperations'), [t.identifier('client')])));
|
|
604
633
|
}
|
|
605
634
|
if (hasCustomMutations) {
|
|
606
|
-
|
|
635
|
+
returnProperties.push(t.objectProperty(t.identifier('mutation'), t.callExpression(t.identifier('createMutationOperations'), [t.identifier('client')])));
|
|
607
636
|
}
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
637
|
+
// Build the createClient function body
|
|
638
|
+
const clientDecl = t.variableDeclaration('const', [
|
|
639
|
+
t.variableDeclarator(t.identifier('client'), t.newExpression(t.identifier('OrmClient'), [t.identifier('config')])),
|
|
640
|
+
]);
|
|
641
|
+
const returnStmt = t.returnStatement(t.objectExpression(returnProperties));
|
|
642
|
+
const configParam = t.identifier('config');
|
|
643
|
+
configParam.typeAnnotation = t.tsTypeAnnotation(t.tsTypeReference(t.identifier('OrmClientConfig')));
|
|
644
|
+
const createClientFunc = t.functionDeclaration(t.identifier('createClient'), [configParam], t.blockStatement([clientDecl, returnStmt]));
|
|
645
|
+
// Add JSDoc comment
|
|
646
|
+
const jsdocComment = (0, babel_ast_1.commentBlock)(`*
|
|
647
|
+
* Create an ORM client instance
|
|
648
|
+
*
|
|
649
|
+
* @example
|
|
650
|
+
* \`\`\`typescript
|
|
651
|
+
* const db = createClient({
|
|
652
|
+
* endpoint: 'https://api.example.com/graphql',
|
|
653
|
+
* headers: { Authorization: 'Bearer token' },
|
|
654
|
+
* });
|
|
655
|
+
*
|
|
656
|
+
* // Query users
|
|
657
|
+
* const users = await db.user.findMany({
|
|
658
|
+
* select: { id: true, name: true },
|
|
659
|
+
* first: 10,
|
|
660
|
+
* }).execute();
|
|
661
|
+
*
|
|
662
|
+
* // Create a user
|
|
663
|
+
* const newUser = await db.user.create({
|
|
664
|
+
* data: { name: 'John', email: 'john@example.com' },
|
|
665
|
+
* select: { id: true },
|
|
666
|
+
* }).execute();
|
|
667
|
+
* \`\`\`
|
|
668
|
+
`);
|
|
669
|
+
const exportedFunc = t.exportNamedDeclaration(createClientFunc);
|
|
670
|
+
exportedFunc.leadingComments = [jsdocComment];
|
|
671
|
+
statements.push(exportedFunc);
|
|
672
|
+
const header = (0, utils_1.getGeneratedFileHeader)('ORM Client - createClient factory');
|
|
673
|
+
const code = (0, babel_ast_1.generateCode)(statements);
|
|
643
674
|
return {
|
|
644
675
|
fileName: 'index.ts',
|
|
645
|
-
content:
|
|
676
|
+
content: header + '\n' + code,
|
|
646
677
|
};
|
|
647
678
|
}
|
|
@@ -1,19 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Custom operations generator for ORM client
|
|
2
|
+
* Custom operations generator for ORM client (Babel AST-based)
|
|
3
3
|
*
|
|
4
4
|
* Generates db.query.* and db.mutation.* namespaces for non-table operations
|
|
5
5
|
* like login, register, currentUser, etc.
|
|
6
|
-
*
|
|
7
|
-
* Example output:
|
|
8
|
-
* ```typescript
|
|
9
|
-
* // query/index.ts
|
|
10
|
-
* export function createQueryOperations(client: OrmClient) {
|
|
11
|
-
* return {
|
|
12
|
-
* currentUser: (args?: { select?: CurrentUserSelect }) =>
|
|
13
|
-
* new QueryBuilder({ ... }),
|
|
14
|
-
* };
|
|
15
|
-
* }
|
|
16
|
-
* ```
|
|
17
6
|
*/
|
|
18
7
|
import type { CleanOperation } from '../../../types/schema';
|
|
19
8
|
export interface GeneratedCustomOpsFile {
|