@baeta/plugin-pagination 2.0.0-next.2 → 2.0.0-next.3
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/CHANGELOG.md +9 -0
- package/README.md +42 -17
- package/dist/index.d.ts +56 -56
- package/dist/index.js +81 -106
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @baeta/plugin-pagination
|
|
2
2
|
|
|
3
|
+
## 2.0.0-next.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Update generator-sdk package
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`6de5d15`](https://github.com/andreisergiu98/baeta/commit/6de5d15484d341a1717a1b2f3f45272912e6a886)]:
|
|
10
|
+
- @baeta/generator-sdk@2.0.0-next.3
|
|
11
|
+
|
|
3
12
|
## 2.0.0-next.2
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -77,43 +77,68 @@ type Query {
|
|
|
77
77
|
#### 2. Implement your resolvers
|
|
78
78
|
|
|
79
79
|
```typescript
|
|
80
|
-
import {
|
|
80
|
+
import { UserModule } from "./typedef.ts";
|
|
81
81
|
|
|
82
|
-
const { Query } =
|
|
82
|
+
const { Query } = UserModule;
|
|
83
83
|
|
|
84
|
-
Query.user(({ args }) => {
|
|
84
|
+
const userQuery = Query.user.resolve(({ args }) => {
|
|
85
85
|
return dataSource.user.find(args.where);
|
|
86
86
|
});
|
|
87
87
|
|
|
88
|
-
Query.users(() => {
|
|
88
|
+
const usersQuery = Query.users.resolve(() => {
|
|
89
89
|
return dataSource.user.findMany();
|
|
90
90
|
});
|
|
91
|
+
|
|
92
|
+
Query.$fields({
|
|
93
|
+
user: userQuery,
|
|
94
|
+
users: usersQuery,
|
|
95
|
+
});
|
|
91
96
|
```
|
|
92
97
|
|
|
93
98
|
#### 3. Add authorization
|
|
94
99
|
|
|
95
100
|
```typescript
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
Query
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
101
|
+
import { UserModule } from "./typedef.ts";
|
|
102
|
+
|
|
103
|
+
const { Query } = UserModule;
|
|
104
|
+
|
|
105
|
+
const userQuery = Query.user
|
|
106
|
+
.auth({
|
|
107
|
+
$or: {
|
|
108
|
+
isPublic: true,
|
|
109
|
+
isLoggedIn: true,
|
|
110
|
+
},
|
|
111
|
+
})
|
|
112
|
+
.resolve(async ({ args }) => {
|
|
113
|
+
// ...
|
|
114
|
+
});
|
|
104
115
|
```
|
|
105
116
|
|
|
106
117
|
#### 4. Add caching
|
|
107
118
|
|
|
108
119
|
```typescript
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
const { User, Query } = getUserModule();
|
|
120
|
+
const { Query, Mutation, User } = UserModule;
|
|
112
121
|
|
|
113
122
|
export const userCache = User.$createCache();
|
|
114
123
|
|
|
115
|
-
Query.user
|
|
116
|
-
|
|
124
|
+
const userQuery = Query.user
|
|
125
|
+
.auth({
|
|
126
|
+
// ...
|
|
127
|
+
})
|
|
128
|
+
.useCache(userCache)
|
|
129
|
+
.resolve(async ({ args }) => {
|
|
130
|
+
// ...
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
const updateUserMutation = Mutation.updateUser
|
|
134
|
+
.use(async (next) => {
|
|
135
|
+
const user = await next();
|
|
136
|
+
await userCache.save(user);
|
|
137
|
+
return user;
|
|
138
|
+
})
|
|
139
|
+
.resolve(async ({ args }) => {
|
|
140
|
+
// ...
|
|
141
|
+
});
|
|
117
142
|
```
|
|
118
143
|
|
|
119
144
|
## Compatibility
|
package/dist/index.d.ts
CHANGED
|
@@ -1,66 +1,65 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _baeta_generator_sdk0 from "@baeta/generator-sdk";
|
|
2
2
|
|
|
3
|
+
//#region index.d.ts
|
|
3
4
|
/**
|
|
4
5
|
* Configuration options for a specific pagination type
|
|
5
6
|
*/
|
|
6
7
|
interface PaginationTypeOptions {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
8
|
+
/** The GraphQL type for nodes (e.g., "User!") */
|
|
9
|
+
nodeType?: string;
|
|
10
|
+
/** The GraphQL type for cursors
|
|
11
|
+
* @defaultValue "ID!"
|
|
12
|
+
*/
|
|
13
|
+
cursorType?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Additional fields to add to the edge type
|
|
16
|
+
* @example edgeFields: ["hasPhotos: Boolean!"]
|
|
17
|
+
*/
|
|
18
|
+
edgeFields?: string[];
|
|
19
|
+
/**
|
|
20
|
+
* Additional fields to add to the connection type
|
|
21
|
+
* @example connectionFields: ["totalCount: Int!"]
|
|
22
|
+
*/
|
|
23
|
+
connectionFields?: string[];
|
|
23
24
|
}
|
|
24
25
|
/**
|
|
25
26
|
* Configuration options for the pagination plugin
|
|
26
27
|
*/
|
|
27
28
|
interface PaginationOptions<Keys extends string | number | symbol = string> {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
*/
|
|
63
|
-
moduleName?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Map of type names to their pagination configuration.
|
|
31
|
+
* @example
|
|
32
|
+
* ```typescript
|
|
33
|
+
* {
|
|
34
|
+
* // Simple configuration
|
|
35
|
+
* User: true,
|
|
36
|
+
*
|
|
37
|
+
* // Advanced configuration
|
|
38
|
+
* UserCustom: {
|
|
39
|
+
* nodeType: "User",
|
|
40
|
+
* cursorType: "UUID!",
|
|
41
|
+
* connectionFields: ["totalCount: Int!"],
|
|
42
|
+
* edgeFields: ["hasPhotos: Boolean!"]
|
|
43
|
+
* }
|
|
44
|
+
* }
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
types: { [key in Keys]?: boolean | PaginationTypeOptions };
|
|
48
|
+
/**
|
|
49
|
+
* Whether the node field should be nullable in all connections
|
|
50
|
+
* @defaultValue true
|
|
51
|
+
*/
|
|
52
|
+
nullableNode?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Additional fields to add to the PageInfo type
|
|
55
|
+
* @example ["hasMorePages: Boolean!"]
|
|
56
|
+
*/
|
|
57
|
+
pageInfoFields?: string[];
|
|
58
|
+
/**
|
|
59
|
+
* Custom name for the pagination module
|
|
60
|
+
* @defaultValue 'baeta-pagination'
|
|
61
|
+
*/
|
|
62
|
+
moduleName?: string;
|
|
64
63
|
}
|
|
65
64
|
/**
|
|
66
65
|
* A plugin that generates Relay-style pagination types for GraphQL.
|
|
@@ -69,6 +68,7 @@ interface PaginationOptions<Keys extends string | number | symbol = string> {
|
|
|
69
68
|
* @param options - Configuration options for the pagination plugin
|
|
70
69
|
* @returns A Baeta generator plugin
|
|
71
70
|
*/
|
|
72
|
-
declare function paginationPlugin<T>(options: PaginationOptions<keyof T>):
|
|
73
|
-
|
|
74
|
-
export {
|
|
71
|
+
declare function paginationPlugin<T>(options: PaginationOptions<keyof T>): _baeta_generator_sdk0.GeneratorPluginV1<unknown>;
|
|
72
|
+
//#endregion
|
|
73
|
+
export { PaginationOptions, PaginationTypeOptions, paginationPlugin };
|
|
74
|
+
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,145 +1,120 @@
|
|
|
1
|
-
// index.ts
|
|
2
1
|
import { createPluginV1, getModuleExportName } from "@baeta/generator-sdk";
|
|
3
2
|
import { join, parse } from "@baeta/util-path";
|
|
3
|
+
|
|
4
|
+
//#region index.ts
|
|
4
5
|
function printFields(fields) {
|
|
5
|
-
|
|
6
|
+
return fields.map((field) => ` ${field}`).join("\n");
|
|
6
7
|
}
|
|
7
8
|
function printType(name, fields) {
|
|
8
|
-
|
|
9
|
+
return `type ${name} {
|
|
9
10
|
${printFields(fields)}
|
|
10
11
|
}`;
|
|
11
12
|
}
|
|
12
13
|
function printTypes(types) {
|
|
13
|
-
|
|
14
|
-
`;
|
|
14
|
+
return `${types.join("\n\n")}\n`;
|
|
15
15
|
}
|
|
16
16
|
function printPageInfo(addFields = []) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
return printType("PageInfo", [
|
|
18
|
+
...addFields,
|
|
19
|
+
"hasPreviousPage: Boolean!",
|
|
20
|
+
"hasNextPage: Boolean!"
|
|
21
|
+
]);
|
|
22
22
|
}
|
|
23
23
|
function printResolversForType(module, type, fields) {
|
|
24
|
-
|
|
24
|
+
return `${type}: ${module}.${type}.$fields({
|
|
25
25
|
${fields.map((field) => printResolverForField(module, type, field)).map(indent(4)).join(",\n")}
|
|
26
26
|
})`;
|
|
27
27
|
}
|
|
28
28
|
function printResolverForField(module, type, field) {
|
|
29
|
-
|
|
29
|
+
return `${field}: ${module}.${type}.${field}.key('${field}').undefinedAsNull()`;
|
|
30
30
|
}
|
|
31
31
|
function getFieldNameFromFieldWithType(field) {
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
const [fieldName] = field.split(":");
|
|
33
|
+
return fieldName;
|
|
34
34
|
}
|
|
35
35
|
function printExport(moduleDefinitionName, moduleName, importExt, options) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const pageInfoResolver = printResolversForType(module, "PageInfo", [
|
|
39
|
-
"hasNextPage",
|
|
40
|
-
"hasPreviousPage",
|
|
41
|
-
...options.pageInfoFields?.map(getFieldNameFromFieldWithType) ?? []
|
|
42
|
-
]);
|
|
43
|
-
const typesResolvers = Object.entries(options.types).flatMap(([type, typeOptions]) => {
|
|
44
|
-
if (typeOptions == null || typeOptions === false) {
|
|
45
|
-
return [];
|
|
46
|
-
}
|
|
47
|
-
const extraEdgeFields = (typeOptions === true ? [] : typeOptions.edgeFields ?? []).map(
|
|
48
|
-
getFieldNameFromFieldWithType
|
|
49
|
-
);
|
|
50
|
-
const extraConnectionFields = (typeOptions === true ? [] : typeOptions.connectionFields ?? []).map(getFieldNameFromFieldWithType);
|
|
51
|
-
return [
|
|
52
|
-
printResolversForType(module, `${type}Connection`, [
|
|
53
|
-
"pageInfo",
|
|
54
|
-
"edges",
|
|
55
|
-
...extraConnectionFields
|
|
56
|
-
]),
|
|
57
|
-
printResolversForType(module, `${type}Edge`, ["cursor", "node", ...extraEdgeFields])
|
|
58
|
-
];
|
|
59
|
-
});
|
|
60
|
-
return `import { ${module} } from "./${typedef}";
|
|
36
|
+
const module = getModuleExportName(moduleName);
|
|
37
|
+
return `import { ${module} } from "./${parse(moduleDefinitionName).name + importExt}";
|
|
61
38
|
|
|
62
39
|
export default ${module}.$schema({
|
|
63
|
-
${[
|
|
40
|
+
${[printResolversForType(module, "PageInfo", [
|
|
41
|
+
"hasNextPage",
|
|
42
|
+
"hasPreviousPage",
|
|
43
|
+
...options.pageInfoFields?.map(getFieldNameFromFieldWithType) ?? []
|
|
44
|
+
]), ...Object.entries(options.types).flatMap(([type, typeOptions]) => {
|
|
45
|
+
if (typeOptions == null || typeOptions === false) return [];
|
|
46
|
+
const extraEdgeFields = (typeOptions === true ? [] : typeOptions.edgeFields ?? []).map(getFieldNameFromFieldWithType);
|
|
47
|
+
const extraConnectionFields = (typeOptions === true ? [] : typeOptions.connectionFields ?? []).map(getFieldNameFromFieldWithType);
|
|
48
|
+
return [printResolversForType(module, `${type}Connection`, [
|
|
49
|
+
"pageInfo",
|
|
50
|
+
"edges",
|
|
51
|
+
...extraConnectionFields
|
|
52
|
+
]), printResolversForType(module, `${type}Edge`, [
|
|
53
|
+
"cursor",
|
|
54
|
+
"node",
|
|
55
|
+
...extraEdgeFields
|
|
56
|
+
])];
|
|
57
|
+
})].map(indent(4)).join(",\n")}
|
|
64
58
|
});
|
|
65
59
|
`;
|
|
66
60
|
}
|
|
67
61
|
function indent(size) {
|
|
68
|
-
|
|
62
|
+
return (text) => text.split("\n").map((line) => " ".repeat(size) + line).join("\n");
|
|
69
63
|
}
|
|
70
64
|
function printConnectionTypes(name, typeOptions, options) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
]);
|
|
82
|
-
const edge = printType(`${name}Edge`, [
|
|
83
|
-
...edgeFields,
|
|
84
|
-
`cursor: ${cursorType}`,
|
|
85
|
-
`node: ${nodeType}${options.nullableNode === false ? "!" : ""}`
|
|
86
|
-
]);
|
|
87
|
-
return [connection, edge];
|
|
65
|
+
const { cursorType = "ID!", nodeType = name, connectionFields = [], edgeFields = [] } = typeOptions;
|
|
66
|
+
return [printType(`${name}Connection`, [
|
|
67
|
+
...connectionFields,
|
|
68
|
+
"pageInfo: PageInfo!",
|
|
69
|
+
`edges: [${name}Edge]`
|
|
70
|
+
]), printType(`${name}Edge`, [
|
|
71
|
+
...edgeFields,
|
|
72
|
+
`cursor: ${cursorType}`,
|
|
73
|
+
`node: ${nodeType}${options.nullableNode === false ? "!" : ""}`
|
|
74
|
+
])];
|
|
88
75
|
}
|
|
89
76
|
function createConnectionModuleDir(modulesDir, moduleName) {
|
|
90
|
-
|
|
77
|
+
return join(modulesDir, moduleName);
|
|
91
78
|
}
|
|
92
79
|
function createGqlFilename(moduleDir) {
|
|
93
|
-
|
|
80
|
+
return `${moduleDir}/connections.gql`;
|
|
94
81
|
}
|
|
95
82
|
function createExportFilename(moduleDir) {
|
|
96
|
-
|
|
83
|
+
return `${moduleDir}/index.ts`;
|
|
97
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* A plugin that generates Relay-style pagination types for GraphQL.
|
|
87
|
+
* See https://baeta.io/docs/plugins/pagination for more details
|
|
88
|
+
*
|
|
89
|
+
* @param options - Configuration options for the pagination plugin
|
|
90
|
+
* @returns A Baeta generator plugin
|
|
91
|
+
*/
|
|
98
92
|
function paginationPlugin(options) {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
createGqlFilename(moduleDir),
|
|
123
|
-
printTypes(types),
|
|
124
|
-
"pagination"
|
|
125
|
-
);
|
|
126
|
-
await definitionFile.write();
|
|
127
|
-
ctx.fileManager.add(definitionFile);
|
|
128
|
-
ctx.fileManager.createAndAdd(
|
|
129
|
-
createExportFilename(moduleDir),
|
|
130
|
-
printExport(
|
|
131
|
-
ctx.generatorOptions.moduleDefinitionName,
|
|
132
|
-
moduleName,
|
|
133
|
-
ctx.generatorOptions.importExtension,
|
|
134
|
-
options
|
|
135
|
-
),
|
|
136
|
-
"pagination"
|
|
137
|
-
);
|
|
138
|
-
return next();
|
|
139
|
-
}
|
|
140
|
-
});
|
|
93
|
+
const { moduleName = "baeta-pagination" } = options;
|
|
94
|
+
return createPluginV1({
|
|
95
|
+
name: "pagination",
|
|
96
|
+
actionName: "pagination connections",
|
|
97
|
+
watch: (generatorOptions, watcher) => {
|
|
98
|
+
watcher.ignore(`${createConnectionModuleDir(generatorOptions.modulesDir, moduleName)}/**`);
|
|
99
|
+
},
|
|
100
|
+
generate: async (ctx, next) => {
|
|
101
|
+
const types = [printPageInfo(options.pageInfoFields)];
|
|
102
|
+
for (const name in options.types) {
|
|
103
|
+
const typeOptions = options.types[name];
|
|
104
|
+
if (typeOptions == null || typeOptions === false) continue;
|
|
105
|
+
const connectionTypes = printConnectionTypes(name, typeOptions === true ? {} : typeOptions, options);
|
|
106
|
+
types.push(...connectionTypes);
|
|
107
|
+
}
|
|
108
|
+
const moduleDir = createConnectionModuleDir(ctx.generatorOptions.modulesDir, moduleName);
|
|
109
|
+
const definitionFile = ctx.fileManager.createAndAdd(createGqlFilename(moduleDir), printTypes(types), "pagination");
|
|
110
|
+
await definitionFile.write();
|
|
111
|
+
ctx.fileManager.add(definitionFile);
|
|
112
|
+
ctx.fileManager.createAndAdd(createExportFilename(moduleDir), printExport(ctx.generatorOptions.moduleDefinitionName, moduleName, ctx.generatorOptions.importExtension, options), "pagination");
|
|
113
|
+
return next();
|
|
114
|
+
}
|
|
115
|
+
});
|
|
141
116
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
};
|
|
117
|
+
|
|
118
|
+
//#endregion
|
|
119
|
+
export { paginationPlugin };
|
|
145
120
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../index.ts"],"sourcesContent":["import { createPluginV1, getModuleExportName } from '@baeta/generator-sdk';\nimport { join, parse } from '@baeta/util-path';\n\n/**\n * Configuration options for a specific pagination type\n */\nexport interface PaginationTypeOptions {\n\t/** The GraphQL type for nodes (e.g., \"User!\") */\n\tnodeType?: string;\n\t/** The GraphQL type for cursors\n\t * @defaultValue \"ID!\"\n\t */\n\tcursorType?: string;\n\t/**\n\t * Additional fields to add to the edge type\n\t * @example edgeFields: [\"hasPhotos: Boolean!\"]\n\t */\n\tedgeFields?: string[];\n\t/**\n\t * Additional fields to add to the connection type\n\t * @example connectionFields: [\"totalCount: Int!\"]\n\t */\n\tconnectionFields?: string[];\n}\n\n/**\n * Configuration options for the pagination plugin\n */\nexport interface PaginationOptions<Keys extends string | number | symbol = string> {\n\t/**\n\t * Map of type names to their pagination configuration.\n\t * @example\n\t * ```typescript\n\t * {\n\t * // Simple configuration\n\t * User: true,\n\t *\n\t * // Advanced configuration\n\t * UserCustom: {\n\t * nodeType: \"User\",\n\t * cursorType: \"UUID!\",\n\t * connectionFields: [\"totalCount: Int!\"],\n\t * edgeFields: [\"hasPhotos: Boolean!\"]\n\t * }\n\t * }\n\t * ```\n\t */\n\ttypes: {\n\t\t[key in Keys]?: boolean | PaginationTypeOptions;\n\t};\n\t/**\n\t * Whether the node field should be nullable in all connections\n\t * @defaultValue true\n\t */\n\tnullableNode?: boolean;\n\t/**\n\t * Additional fields to add to the PageInfo type\n\t * @example [\"hasMorePages: Boolean!\"]\n\t */\n\tpageInfoFields?: string[];\n\t/**\n\t * Custom name for the pagination module\n\t * @defaultValue 'baeta-pagination'\n\t */\n\tmoduleName?: string;\n}\n\nfunction printFields(fields: string[]) {\n\treturn fields.map((field) => ` ${field}`).join('\\n');\n}\n\nfunction printType(name: string, fields: string[]) {\n\treturn `type ${name} {\n${printFields(fields)}\n}`;\n}\n\nfunction printTypes(types: string[]) {\n\treturn `${types.join('\\n\\n')}\\n`;\n}\n\nfunction printPageInfo(addFields: string[] = []) {\n\treturn printType('PageInfo', [\n\t\t...addFields,\n\t\t'hasPreviousPage: Boolean!',\n\t\t'hasNextPage: Boolean!',\n\t]);\n}\n\nfunction printResolversForType(module: string, type: string, fields: string[]) {\n\treturn `${type}: ${module}.${type}.$fields({\n${fields\n\t.map((field) => printResolverForField(module, type, field))\n\t.map(indent(4))\n\t.join(',\\n')}\n})`;\n}\n\nfunction printResolverForField(module: string, type: string, field: string) {\n\treturn `${field}: ${module}.${type}.${field}.key('${field}').undefinedAsNull()`;\n}\n\nfunction getFieldNameFromFieldWithType(field: string) {\n\tconst [fieldName] = field.split(':');\n\treturn fieldName;\n}\n\nfunction printExport(\n\tmoduleDefinitionName: string,\n\tmoduleName: string,\n\timportExt: string,\n\toptions: PaginationOptions,\n) {\n\tconst module = getModuleExportName(moduleName);\n\tconst typedef = parse(moduleDefinitionName).name + importExt;\n\n\tconst pageInfoResolver = printResolversForType(module, 'PageInfo', [\n\t\t'hasNextPage',\n\t\t'hasPreviousPage',\n\t\t...(options.pageInfoFields?.map(getFieldNameFromFieldWithType) ?? []),\n\t]);\n\n\tconst typesResolvers = Object.entries(options.types).flatMap(([type, typeOptions]) => {\n\t\tif (typeOptions == null || typeOptions === false) {\n\t\t\treturn [];\n\t\t}\n\t\tconst extraEdgeFields = (typeOptions === true ? [] : (typeOptions.edgeFields ?? [])).map(\n\t\t\tgetFieldNameFromFieldWithType,\n\t\t);\n\t\tconst extraConnectionFields = (\n\t\t\ttypeOptions === true ? [] : (typeOptions.connectionFields ?? [])\n\t\t).map(getFieldNameFromFieldWithType);\n\t\treturn [\n\t\t\tprintResolversForType(module, `${type}Connection`, [\n\t\t\t\t'pageInfo',\n\t\t\t\t'edges',\n\t\t\t\t...extraConnectionFields,\n\t\t\t]),\n\t\t\tprintResolversForType(module, `${type}Edge`, ['cursor', 'node', ...extraEdgeFields]),\n\t\t];\n\t});\n\n\treturn `import { ${module} } from \"./${typedef}\";\n\nexport default ${module}.$schema({\n${[pageInfoResolver, ...typesResolvers].map(indent(4)).join(',\\n')}\n});\n`;\n}\n\nfunction indent(size: number) {\n\treturn (text: string) =>\n\t\ttext\n\t\t\t.split('\\n')\n\t\t\t.map((line) => ' '.repeat(size) + line)\n\t\t\t.join('\\n');\n}\n\nfunction printConnectionTypes(\n\tname: string,\n\ttypeOptions: PaginationTypeOptions,\n\toptions: PaginationOptions,\n) {\n\tconst {\n\t\tcursorType = 'ID!',\n\t\tnodeType = name,\n\t\tconnectionFields = [],\n\t\tedgeFields = [],\n\t} = typeOptions;\n\n\tconst connection = printType(`${name}Connection`, [\n\t\t...connectionFields,\n\t\t'pageInfo: PageInfo!',\n\t\t`edges: [${name}Edge]`,\n\t]);\n\n\tconst edge = printType(`${name}Edge`, [\n\t\t...edgeFields,\n\t\t`cursor: ${cursorType}`,\n\t\t`node: ${nodeType}${options.nullableNode === false ? '!' : ''}`,\n\t]);\n\n\treturn [connection, edge];\n}\n\nfunction createConnectionModuleDir(modulesDir: string, moduleName: string) {\n\treturn join(modulesDir, moduleName);\n}\n\nfunction createGqlFilename(moduleDir: string) {\n\treturn `${moduleDir}/connections.gql`;\n}\n\nfunction createExportFilename(moduleDir: string) {\n\treturn `${moduleDir}/index.ts`;\n}\n\n/**\n * A plugin that generates Relay-style pagination types for GraphQL.\n * See https://baeta.io/docs/plugins/pagination for more details\n *\n * @param options - Configuration options for the pagination plugin\n * @returns A Baeta generator plugin\n */\nexport function paginationPlugin<T>(options: PaginationOptions<keyof T>) {\n\tconst { moduleName = 'baeta-pagination' } = options;\n\n\treturn createPluginV1({\n\t\tname: 'pagination',\n\t\tactionName: 'pagination connections',\n\t\twatch: (generatorOptions, watcher) => {\n\t\t\twatcher.ignore(`${createConnectionModuleDir(generatorOptions.modulesDir, moduleName)}/**`);\n\t\t},\n\t\tgenerate: async (ctx, next) => {\n\t\t\tconst types: string[] = [printPageInfo(options.pageInfoFields)];\n\n\t\t\tfor (const name in options.types) {\n\t\t\t\tconst typeOptions = options.types[name];\n\t\t\t\tif (typeOptions == null || typeOptions === false) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst connectionTypes = printConnectionTypes(\n\t\t\t\t\tname,\n\t\t\t\t\ttypeOptions === true ? {} : typeOptions,\n\t\t\t\t\toptions,\n\t\t\t\t);\n\n\t\t\t\ttypes.push(...connectionTypes);\n\t\t\t}\n\n\t\t\tconst moduleDir = createConnectionModuleDir(ctx.generatorOptions.modulesDir, moduleName);\n\n\t\t\tconst definitionFile = ctx.fileManager.createAndAdd(\n\t\t\t\tcreateGqlFilename(moduleDir),\n\t\t\t\tprintTypes(types),\n\t\t\t\t'pagination',\n\t\t\t);\n\t\t\tawait definitionFile.write();\n\n\t\t\tctx.fileManager.add(definitionFile);\n\n\t\t\tctx.fileManager.createAndAdd(\n\t\t\t\tcreateExportFilename(moduleDir),\n\t\t\t\tprintExport(\n\t\t\t\t\tctx.generatorOptions.moduleDefinitionName,\n\t\t\t\t\tmoduleName,\n\t\t\t\t\tctx.generatorOptions.importExtension,\n\t\t\t\t\toptions,\n\t\t\t\t),\n\t\t\t\t'pagination',\n\t\t\t);\n\n\t\t\treturn next();\n\t\t},\n\t});\n}\n"],"mappings":";AAAA,SAAS,gBAAgB,2BAA2B;AACpD,SAAS,MAAM,aAAa;AAkE5B,SAAS,YAAY,QAAkB;AACtC,SAAO,OAAO,IAAI,CAAC,UAAU,KAAK,KAAK,EAAE,EAAE,KAAK,IAAI;AACrD;AAEA,SAAS,UAAU,MAAc,QAAkB;AAClD,SAAO,QAAQ,IAAI;AAAA,EAClB,YAAY,MAAM,CAAC;AAAA;AAErB;AAEA,SAAS,WAAW,OAAiB;AACpC,SAAO,GAAG,MAAM,KAAK,MAAM,CAAC;AAAA;AAC7B;AAEA,SAAS,cAAc,YAAsB,CAAC,GAAG;AAChD,SAAO,UAAU,YAAY;AAAA,IAC5B,GAAG;AAAA,IACH;AAAA,IACA;AAAA,EACD,CAAC;AACF;AAEA,SAAS,sBAAsB,QAAgB,MAAc,QAAkB;AAC9E,SAAO,GAAG,IAAI,KAAK,MAAM,IAAI,IAAI;AAAA,EAChC,OACA,IAAI,CAAC,UAAU,sBAAsB,QAAQ,MAAM,KAAK,CAAC,EACzD,IAAI,OAAO,CAAC,CAAC,EACb,KAAK,KAAK,CAAC;AAAA;AAEb;AAEA,SAAS,sBAAsB,QAAgB,MAAc,OAAe;AAC3E,SAAO,GAAG,KAAK,KAAK,MAAM,IAAI,IAAI,IAAI,KAAK,SAAS,KAAK;AAC1D;AA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A,YAAM,YAAY,0BAA0B,IAAI,iBAAiB,YAAY,UAAU;AAEvF,YAAM,iBAAiB,IAAI,YAAY;AAAA,QACtC,kBAAkB,SAAS;AAAA,QAC3B,WAAW,KAAK;AAAA,QAChB;AAAA,MACD;AACA,YAAM,eAAe,MAAM;AAE3B,UAAI,YAAY,IAAI,cAAc;AAElC,UAAI,YAAY;AAAA,QACf,qBAAqB,SAAS;AAAA,QAC9B;AAAA,UACC,IAAI,iBAAiB;AAAA,UACrB;AAAA,UACA,IAAI,iBAAiB;AAAA,UACrB;AAAA,QACD;AAAA,QACA;AAAA,MACD;AAEA,aAAO,KAAK;AAAA,IACb;AAAA,EACD,CAAC;AACF;","names":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["types: string[]"],"sources":["../index.ts"],"sourcesContent":["import { createPluginV1, getModuleExportName } from '@baeta/generator-sdk';\nimport { join, parse } from '@baeta/util-path';\n\n/**\n * Configuration options for a specific pagination type\n */\nexport interface PaginationTypeOptions {\n\t/** The GraphQL type for nodes (e.g., \"User!\") */\n\tnodeType?: string;\n\t/** The GraphQL type for cursors\n\t * @defaultValue \"ID!\"\n\t */\n\tcursorType?: string;\n\t/**\n\t * Additional fields to add to the edge type\n\t * @example edgeFields: [\"hasPhotos: Boolean!\"]\n\t */\n\tedgeFields?: string[];\n\t/**\n\t * Additional fields to add to the connection type\n\t * @example connectionFields: [\"totalCount: Int!\"]\n\t */\n\tconnectionFields?: string[];\n}\n\n/**\n * Configuration options for the pagination plugin\n */\nexport interface PaginationOptions<Keys extends string | number | symbol = string> {\n\t/**\n\t * Map of type names to their pagination configuration.\n\t * @example\n\t * ```typescript\n\t * {\n\t * // Simple configuration\n\t * User: true,\n\t *\n\t * // Advanced configuration\n\t * UserCustom: {\n\t * nodeType: \"User\",\n\t * cursorType: \"UUID!\",\n\t * connectionFields: [\"totalCount: Int!\"],\n\t * edgeFields: [\"hasPhotos: Boolean!\"]\n\t * }\n\t * }\n\t * ```\n\t */\n\ttypes: {\n\t\t[key in Keys]?: boolean | PaginationTypeOptions;\n\t};\n\t/**\n\t * Whether the node field should be nullable in all connections\n\t * @defaultValue true\n\t */\n\tnullableNode?: boolean;\n\t/**\n\t * Additional fields to add to the PageInfo type\n\t * @example [\"hasMorePages: Boolean!\"]\n\t */\n\tpageInfoFields?: string[];\n\t/**\n\t * Custom name for the pagination module\n\t * @defaultValue 'baeta-pagination'\n\t */\n\tmoduleName?: string;\n}\n\nfunction printFields(fields: string[]) {\n\treturn fields.map((field) => ` ${field}`).join('\\n');\n}\n\nfunction printType(name: string, fields: string[]) {\n\treturn `type ${name} {\n${printFields(fields)}\n}`;\n}\n\nfunction printTypes(types: string[]) {\n\treturn `${types.join('\\n\\n')}\\n`;\n}\n\nfunction printPageInfo(addFields: string[] = []) {\n\treturn printType('PageInfo', [\n\t\t...addFields,\n\t\t'hasPreviousPage: Boolean!',\n\t\t'hasNextPage: Boolean!',\n\t]);\n}\n\nfunction printResolversForType(module: string, type: string, fields: string[]) {\n\treturn `${type}: ${module}.${type}.$fields({\n${fields\n\t.map((field) => printResolverForField(module, type, field))\n\t.map(indent(4))\n\t.join(',\\n')}\n})`;\n}\n\nfunction printResolverForField(module: string, type: string, field: string) {\n\treturn `${field}: ${module}.${type}.${field}.key('${field}').undefinedAsNull()`;\n}\n\nfunction getFieldNameFromFieldWithType(field: string) {\n\tconst [fieldName] = field.split(':');\n\treturn fieldName;\n}\n\nfunction printExport(\n\tmoduleDefinitionName: string,\n\tmoduleName: string,\n\timportExt: string,\n\toptions: PaginationOptions,\n) {\n\tconst module = getModuleExportName(moduleName);\n\tconst typedef = parse(moduleDefinitionName).name + importExt;\n\n\tconst pageInfoResolver = printResolversForType(module, 'PageInfo', [\n\t\t'hasNextPage',\n\t\t'hasPreviousPage',\n\t\t...(options.pageInfoFields?.map(getFieldNameFromFieldWithType) ?? []),\n\t]);\n\n\tconst typesResolvers = Object.entries(options.types).flatMap(([type, typeOptions]) => {\n\t\tif (typeOptions == null || typeOptions === false) {\n\t\t\treturn [];\n\t\t}\n\t\tconst extraEdgeFields = (typeOptions === true ? [] : (typeOptions.edgeFields ?? [])).map(\n\t\t\tgetFieldNameFromFieldWithType,\n\t\t);\n\t\tconst extraConnectionFields = (\n\t\t\ttypeOptions === true ? [] : (typeOptions.connectionFields ?? [])\n\t\t).map(getFieldNameFromFieldWithType);\n\t\treturn [\n\t\t\tprintResolversForType(module, `${type}Connection`, [\n\t\t\t\t'pageInfo',\n\t\t\t\t'edges',\n\t\t\t\t...extraConnectionFields,\n\t\t\t]),\n\t\t\tprintResolversForType(module, `${type}Edge`, ['cursor', 'node', ...extraEdgeFields]),\n\t\t];\n\t});\n\n\treturn `import { ${module} } from \"./${typedef}\";\n\nexport default ${module}.$schema({\n${[pageInfoResolver, ...typesResolvers].map(indent(4)).join(',\\n')}\n});\n`;\n}\n\nfunction indent(size: number) {\n\treturn (text: string) =>\n\t\ttext\n\t\t\t.split('\\n')\n\t\t\t.map((line) => ' '.repeat(size) + line)\n\t\t\t.join('\\n');\n}\n\nfunction printConnectionTypes(\n\tname: string,\n\ttypeOptions: PaginationTypeOptions,\n\toptions: PaginationOptions,\n) {\n\tconst {\n\t\tcursorType = 'ID!',\n\t\tnodeType = name,\n\t\tconnectionFields = [],\n\t\tedgeFields = [],\n\t} = typeOptions;\n\n\tconst connection = printType(`${name}Connection`, [\n\t\t...connectionFields,\n\t\t'pageInfo: PageInfo!',\n\t\t`edges: [${name}Edge]`,\n\t]);\n\n\tconst edge = printType(`${name}Edge`, [\n\t\t...edgeFields,\n\t\t`cursor: ${cursorType}`,\n\t\t`node: ${nodeType}${options.nullableNode === false ? '!' : ''}`,\n\t]);\n\n\treturn [connection, edge];\n}\n\nfunction createConnectionModuleDir(modulesDir: string, moduleName: string) {\n\treturn join(modulesDir, moduleName);\n}\n\nfunction createGqlFilename(moduleDir: string) {\n\treturn `${moduleDir}/connections.gql`;\n}\n\nfunction createExportFilename(moduleDir: string) {\n\treturn `${moduleDir}/index.ts`;\n}\n\n/**\n * A plugin that generates Relay-style pagination types for GraphQL.\n * See https://baeta.io/docs/plugins/pagination for more details\n *\n * @param options - Configuration options for the pagination plugin\n * @returns A Baeta generator plugin\n */\nexport function paginationPlugin<T>(options: PaginationOptions<keyof T>) {\n\tconst { moduleName = 'baeta-pagination' } = options;\n\n\treturn createPluginV1({\n\t\tname: 'pagination',\n\t\tactionName: 'pagination connections',\n\t\twatch: (generatorOptions, watcher) => {\n\t\t\twatcher.ignore(`${createConnectionModuleDir(generatorOptions.modulesDir, moduleName)}/**`);\n\t\t},\n\t\tgenerate: async (ctx, next) => {\n\t\t\tconst types: string[] = [printPageInfo(options.pageInfoFields)];\n\n\t\t\tfor (const name in options.types) {\n\t\t\t\tconst typeOptions = options.types[name];\n\t\t\t\tif (typeOptions == null || typeOptions === false) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst connectionTypes = printConnectionTypes(\n\t\t\t\t\tname,\n\t\t\t\t\ttypeOptions === true ? {} : typeOptions,\n\t\t\t\t\toptions,\n\t\t\t\t);\n\n\t\t\t\ttypes.push(...connectionTypes);\n\t\t\t}\n\n\t\t\tconst moduleDir = createConnectionModuleDir(ctx.generatorOptions.modulesDir, moduleName);\n\n\t\t\tconst definitionFile = ctx.fileManager.createAndAdd(\n\t\t\t\tcreateGqlFilename(moduleDir),\n\t\t\t\tprintTypes(types),\n\t\t\t\t'pagination',\n\t\t\t);\n\t\t\tawait definitionFile.write();\n\n\t\t\tctx.fileManager.add(definitionFile);\n\n\t\t\tctx.fileManager.createAndAdd(\n\t\t\t\tcreateExportFilename(moduleDir),\n\t\t\t\tprintExport(\n\t\t\t\t\tctx.generatorOptions.moduleDefinitionName,\n\t\t\t\t\tmoduleName,\n\t\t\t\t\tctx.generatorOptions.importExtension,\n\t\t\t\t\toptions,\n\t\t\t\t),\n\t\t\t\t'pagination',\n\t\t\t);\n\n\t\t\treturn next();\n\t\t},\n\t});\n}\n"],"mappings":";;;;AAmEA,SAAS,YA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AAQ,OAAO;IACjC,MAAM,cAAc,QAAQ,MAAM;AAClC,QAAI,eAAe,QAAQ,gBAAgB,MAC1C;IAGD,MAAM,kBAAkB,qBACvB,MACA,gBAAgB,OAAO,EAAE,GAAG,aAC5B,QACA;AAED,UAAM,KAAK,GAAG,gBAAgB;;GAG/B,MAAM,YAAY,0BAA0B,IAAI,iBAAiB,YAAY,WAAW;GAExF,MAAM,iBAAiB,IAAI,YAAY,aACtC,kBAAkB,UAAU,EAC5B,WAAW,MAAM,EACjB,aACA;AACD,SAAM,eAAe,OAAO;AAE5B,OAAI,YAAY,IAAI,eAAe;AAEnC,OAAI,YAAY,aACf,qBAAqB,UAAU,EAC/B,YACC,IAAI,iBAAiB,sBACrB,YACA,IAAI,iBAAiB,iBACrB,QACA,EACD,aACA;AAED,UAAO,MAAM;;EAEd,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@baeta/plugin-pagination",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.3",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"baeta",
|
|
6
6
|
"graphql",
|
|
@@ -37,20 +37,20 @@
|
|
|
37
37
|
"package.json"
|
|
38
38
|
],
|
|
39
39
|
"scripts": {
|
|
40
|
-
"build": "
|
|
41
|
-
"prepack": "
|
|
42
|
-
"postpack": "
|
|
40
|
+
"build": "builder build",
|
|
41
|
+
"prepack": "builder prepare",
|
|
42
|
+
"postpack": "builder prepare --clean",
|
|
43
43
|
"types": "tsc --noEmit"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@baeta/generator-sdk": "^2.0.0-next.
|
|
46
|
+
"@baeta/generator-sdk": "^2.0.0-next.3",
|
|
47
47
|
"@baeta/util-path": "^2.0.0-next.2"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@baeta/builder": "^0.0.0",
|
|
51
51
|
"@baeta/tsconfig": "^0.0.0",
|
|
52
|
-
"@types/node": "^22.18.
|
|
53
|
-
"graphql": "^16.
|
|
52
|
+
"@types/node": "^22.18.13",
|
|
53
|
+
"graphql": "^16.12.0",
|
|
54
54
|
"typescript": "^5.9.3"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|