Skip to content

Commit 34fe442

Browse files
committed
✨ (package.json): bump version to 1.3.1 because im dumb and dont send the source files on npm package 🤡
1 parent 793c6da commit 34fe442

File tree

15 files changed

+32
-74
lines changed

15 files changed

+32
-74
lines changed

examples/advanced-graphql/src/resolvers/product.resolver.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ export class ProductResolver {
138138
if (filter.createdAt.lte) where.createdAt.lte = filter.createdAt.lte
139139
}
140140

141-
// Handle AND/OR operations
142141
if (filter.AND) {
143142
where.AND = filter.AND.map((f: any) => this.buildWhereCondition(f))
144143
}

examples/advanced-graphql/src/resolvers/tag.resolver.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ export class TagResolver {
137137
where.name = { contains: filter.name.contains || filter.name.equals }
138138
}
139139

140-
// Handle AND/OR operations
141140
if (filter.AND) {
142141
where.AND = filter.AND.map((f: any) => this.buildWhereCondition(f))
143142
}

examples/advanced-graphql/tests/advanced.test.ts

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ describe('Advanced GraphQL Features Tests', () => {
2929
})
3030

3131
beforeEach(async () => {
32-
// Clean up in correct order due to foreign key constraints
3332
await prismaClient.productTag.deleteMany()
3433
await prismaClient.review.deleteMany()
3534
await prismaClient.product.deleteMany()
@@ -66,43 +65,35 @@ describe('Advanced GraphQL Features Tests', () => {
6665
const types = result.data.__schema.types
6766
const typeNames = types.map((t: any) => t.name)
6867

69-
// Main object types
7068
expect(typeNames).toContain('Product')
7169
expect(typeNames).toContain('Review')
7270
expect(typeNames).toContain('Tag')
7371
expect(typeNames).toContain('ProductTag')
7472

75-
// Connection types
7673
expect(typeNames).toContain('ProductConnection')
7774
expect(typeNames).toContain('ReviewConnection')
7875
expect(typeNames).toContain('TagConnection')
7976

80-
// Edge types
8177
expect(typeNames).toContain('ProductEdge')
8278
expect(typeNames).toContain('ReviewEdge')
8379
expect(typeNames).toContain('TagEdge')
8480

85-
// Filter types
8681
expect(typeNames).toContain('ProductFilterInput')
8782
expect(typeNames).toContain('ReviewFilterInput')
8883
expect(typeNames).toContain('TagFilterInput')
8984

90-
// Sort types
9185
expect(typeNames).toContain('ProductSortInput')
9286
expect(typeNames).toContain('ReviewSortInput')
9387
expect(typeNames).toContain('TagSortInput')
9488

95-
// Enums
9689
expect(typeNames).toContain('ProductStatus')
9790
expect(typeNames).toContain('ReviewRating')
9891
expect(typeNames).toContain('SortDirection')
9992

100-
// Common filter types
10193
expect(typeNames).toContain('NumericFilterInput')
10294
expect(typeNames).toContain('StringFilterInput')
10395
expect(typeNames).toContain('BooleanFilterInput')
10496

105-
// Pagination types
10697
expect(typeNames).toContain('PageInfo')
10798
})
10899
})
@@ -149,7 +140,6 @@ describe('Advanced GraphQL Features Tests', () => {
149140

150141
describe('Relay Connections and Pagination', () => {
151142
test('Products connection follows Relay specification', async () => {
152-
// Create test products
153143
const products = await Promise.all([
154144
prismaClient.product.create({
155145
data: { name: 'Product A', price: 10.0, status: 'PUBLISHED' },
@@ -196,14 +186,12 @@ describe('Advanced GraphQL Features Tests', () => {
196186

197187
const connection = result.data.products
198188

199-
// Verify Relay structure
200189
expect(connection.edges).toHaveLength(2)
201190
expect(connection.totalCount).toBe(3)
202191
expect(connection.pageInfo.hasNextPage).toBe(true)
203192
expect(connection.pageInfo.startCursor).toBeDefined()
204193
expect(connection.pageInfo.endCursor).toBeDefined()
205194

206-
// Verify edges structure
207195
connection.edges.forEach((edge: any) => {
208196
expect(edge.node).toBeDefined()
209197
expect(edge.cursor).toBeDefined()
@@ -212,14 +200,12 @@ describe('Advanced GraphQL Features Tests', () => {
212200
})
213201

214202
test('Forward pagination with cursors works correctly', async () => {
215-
// Create test products
216203
await Promise.all([
217204
prismaClient.product.create({ data: { name: 'Product 1', price: 10.0, status: 'PUBLISHED' } }),
218205
prismaClient.product.create({ data: { name: 'Product 2', price: 20.0, status: 'PUBLISHED' } }),
219206
prismaClient.product.create({ data: { name: 'Product 3', price: 30.0, status: 'PUBLISHED' } }),
220207
])
221208

222-
// Get first page
223209
const firstPageResponse = await fetch(GRAPHQL_ENDPOINT, {
224210
method: 'POST',
225211
headers: { 'Content-Type': 'application/json' },
@@ -247,7 +233,6 @@ describe('Advanced GraphQL Features Tests', () => {
247233

248234
const endCursor = firstPage.data.products.pageInfo.endCursor
249235

250-
// Get second page using cursor
251236
const secondPageResponse = await fetch(GRAPHQL_ENDPOINT, {
252237
method: 'POST',
253238
headers: { 'Content-Type': 'application/json' },
@@ -356,7 +341,7 @@ describe('Advanced GraphQL Features Tests', () => {
356341

357342
const result = await response.json()
358343
expect(result.errors).toBeUndefined()
359-
expect(result.data.products.totalCount).toBe(2) // Product B (price >= 150) and Product C (published AND price <= 60)
344+
expect(result.data.products.totalCount).toBe(2)
360345
})
361346
})
362347

@@ -486,7 +471,6 @@ describe('Advanced GraphQL Features Tests', () => {
486471
data: { name: 'test-tag', color: '#FF0000' },
487472
})
488473

489-
// Assign tag to product
490474
const assignResponse = await fetch(GRAPHQL_ENDPOINT, {
491475
method: 'POST',
492476
headers: { 'Content-Type': 'application/json' },
@@ -504,7 +488,6 @@ describe('Advanced GraphQL Features Tests', () => {
504488
expect(assignResult.errors).toBeUndefined()
505489
expect(assignResult.data.assignTagToProduct).toBe(true)
506490

507-
// Verify relation exists
508491
const queryResponse = await fetch(GRAPHQL_ENDPOINT, {
509492
method: 'POST',
510493
headers: { 'Content-Type': 'application/json' },

examples/type-graphql/tests/schema-types.test.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ describe('TypeGraphQL Test Example', () => {
6666
expect(openParens).toBe(closeParens)
6767
})
6868

69-
// Filter Input Types Tests
7069
describe('Filter Input Types', () => {
7170
test('Contains base filter input types', () => {
7271
expect(schemaContent).toContain('export class NumericFilterInput')
@@ -119,7 +118,6 @@ describe('TypeGraphQL Test Example', () => {
119118
})
120119
})
121120

122-
// Sort Input Types Tests
123121
describe('Sort Input Types', () => {
124122
test('Contains SortDirection enum', () => {
125123
expect(schemaContent).toContain('export enum SortDirection')
@@ -146,7 +144,6 @@ describe('TypeGraphQL Test Example', () => {
146144
})
147145
})
148146

149-
// Pagination Input Types Tests
150147
describe('Pagination Input Types', () => {
151148
test('Contains pagination input types', () => {
152149
expect(schemaContent).toContain('export class ForwardPaginationInput')
@@ -175,7 +172,6 @@ describe('TypeGraphQL Test Example', () => {
175172
})
176173
})
177174

178-
// Connection Types Tests
179175
describe('Connection Types', () => {
180176
test('Contains PageInfo class', () => {
181177
expect(schemaContent).toContain('export class PageInfo')
@@ -224,7 +220,6 @@ describe('TypeGraphQL Test Example', () => {
224220
})
225221
})
226222

227-
// TypeScript Types Validation
228223
describe('TypeScript Types Validation', () => {
229224
test('Uses proper TypeScript number types instead of GraphQL Float', () => {
230225
const numberFieldMatches = schemaContent.match(/: number/g)
@@ -248,7 +243,6 @@ describe('TypeGraphQL Test Example', () => {
248243
})
249244
})
250245

251-
// Relations and PostCategory Tests
252246
describe('Relations and Custom Names', () => {
253247
test('PostCategory uses correct name from @@graphql.name attribute', () => {
254248
expect(schemaContent).toContain('export class PostCategory')
@@ -289,7 +283,6 @@ describe('TypeGraphQL Test Example', () => {
289283
})
290284
})
291285

292-
// Comprehensive Validation Tests
293286
describe('Comprehensive Schema Validation', () => {
294287
test('All classes have proper ObjectType or InputType decorators', () => {
295288
const classMatches = schemaContent.match(/export class \w+/g)
@@ -357,7 +350,6 @@ describe('TypeGraphQL Test Example', () => {
357350
})
358351
})
359352

360-
// Advanced Filter Tests
361353
describe('Advanced Filter Validation', () => {
362354
test('All filter inputs have AND/OR logical operators', () => {
363355
const modelFilterClasses = ['UserFilterInput', 'PostFilterInput', 'CategoryFilterInput', 'PostCategoryFilterInput', 'CommentFilterInput']
@@ -409,7 +401,6 @@ describe('TypeGraphQL Test Example', () => {
409401
})
410402
})
411403

412-
// Sort Input Validation
413404
describe('Advanced Sort Validation', () => {
414405
test('All sort inputs have proper SortDirection references', () => {
415406
const sortInputClasses = ['UserSortInput', 'PostSortInput', 'CategorySortInput', 'PostCategorySortInput', 'CommentSortInput']

package.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@hakutakuai/zenstack-graphql",
3-
"version": "1.2.2",
3+
"version": "1.3.1",
44
"description": "ZenStack plugin for generating GraphQL schemas",
55
"main": "dist/index.js",
66
"module": "index.ts",
@@ -13,10 +13,9 @@
1313
"bun": "^1.0.0"
1414
},
1515
"files": [
16-
"dist/**/*",
17-
"README.md",
18-
"LICENSE",
19-
"package.json"
16+
"**/*",
17+
"!**/*.test.{ts,js}",
18+
"!**/node_modules/**"
2019
],
2120
"publishConfig": {
2221
"access": "public"

src/generators/unified/unified-connection-generator.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ export class UnifiedConnectionGenerator extends UnifiedGeneratorBase {
1717
}
1818

1919
protected override generateForModel(model: DataModel): string | null {
20-
// Get the custom name (or model name) and pass raw name to output strategy
21-
// Let the output strategy handle the formatting via TypeFactories
2220
const customName = this.attributeProcessor.model(model).name()
2321
const connectionName = this.outputStrategy.createConnectionType(customName)
2422

src/generators/unified/unified-filter-input-generator.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ export class UnifiedFilterInputGenerator extends UnifiedGeneratorBase {
2323
protected override generateForModel(model: DataModel): string | null {
2424
const filterFields = this.getFilterableFields(model)
2525

26-
// Get the custom name (or model name) and pass raw name to output strategy
27-
// Let the output strategy handle the formatting via TypeFactories
2826
const customName = this.attributeProcessor.model(model).name()
2927

3028
if (filterFields.length === 0) {

src/generators/unified/unified-input-generator.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ export class UnifiedInputGenerator extends UnifiedGeneratorBase {
2323
private generateCreateInput(model: DataModel): string | null {
2424
try {
2525
const typeName = this.getFormattedTypeName(model)
26-
// Get the custom name or use the model name, then format it properly
2726
const customName = this.attributeProcessor.model(model).name()
2827
const inputName = this.typeFormatter.formatCreateInputTypeName(customName)
2928
const description = `Create input for ${typeName}`
@@ -45,7 +44,6 @@ export class UnifiedInputGenerator extends UnifiedGeneratorBase {
4544
private generateUpdateInput(model: DataModel): string | null {
4645
try {
4746
const typeName = this.getFormattedTypeName(model)
48-
// Get the custom name or use the model name, then format it properly
4947
const customName = this.attributeProcessor.model(model).name()
5048
const inputName = this.typeFormatter.formatUpdateInputTypeName(customName)
5149
const description = `Update input for ${typeName}`

src/generators/unified/unified-sort-input-generator.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ export class UnifiedSortInputGenerator extends UnifiedGeneratorBase {
2020
protected override generateForModel(model: DataModel): string | null {
2121
const sortFields = this.getSortableFields(model)
2222

23-
// Get the custom name (or model name) and pass raw name to output strategy
24-
// Let the output strategy handle the formatting via TypeFactories
2523
const customName = this.attributeProcessor.model(model).name()
2624
const sortInputTypeName = this.outputStrategy.createSortInputType(customName, sortFields)
2725

src/utils/schema/graphql-type-factories.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,6 @@ export class GraphQLTypeFactories {
335335

336336
const fields: Record<string, any> = {}
337337

338-
// Add basic filter fields for each model field
339338
for (const field of model.fields) {
340339
const fieldName = this.typeFormatter.formatFieldName(field.name)
341340
fields[fieldName] = {
@@ -388,7 +387,6 @@ export class GraphQLTypeFactories {
388387

389388
const fields: Record<string, any> = {}
390389

391-
// Add basic input fields for each model field
392390
for (const field of model.fields) {
393391
const fieldName = this.typeFormatter.formatFieldName(field.name)
394392
fields[fieldName] = {

0 commit comments

Comments
 (0)