Skip to content

Commit f22a414

Browse files
committed
ci: Format code
1 parent aedb880 commit f22a414

File tree

8 files changed

+13
-24
lines changed

8 files changed

+13
-24
lines changed

examples/blueprint.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import { writeFile } from 'node:fs/promises'
22
import { join } from 'node:path'
33

4+
import { createBlueprint, TypesModuleSchema } from '@seamapi/blueprint'
45
import type { Builder, Command, Describe, Handler } from 'landlubber'
56
import { mkdirp } from 'mkdirp'
67

7-
import { createBlueprint, TypesModuleSchema } from '@seamapi/blueprint'
8-
98
interface Options {
109
moduleName: string
1110
}

src/lib/blueprint.ts

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -570,9 +570,7 @@ const getNamespacePath = (path: string, paths: OpenapiPaths): string | null => {
570570

571571
// An endpoint is a route that ends without further paths. i.e., ends in
572572
// a letter (not slash).
573-
const endpoints = pathKeys.filter((key) => {
574-
return new RegExp(`^/${[...namespace, part].join('/')}/\\w+$`).test(key)
575-
})
573+
const endpoints = pathKeys.filter((key) => new RegExp(`^/${[...namespace, part].join('/')}/\\w+$`).test(key))
576574

577575
if (endpoints.length === 0) {
578576
namespace.push(part)
@@ -857,7 +855,7 @@ const createRequestBody = (
857855
return []
858856
}
859857

860-
const requestBody = operation.requestBody
858+
const {requestBody} = operation
861859
const jsonSchema = requestBody.content?.['application/json']?.schema
862860
if (jsonSchema == null) return []
863861

@@ -877,8 +875,7 @@ const createParameters = (
877875
properties: Record<string, OpenapiSchema>,
878876
path: string,
879877
requiredParameters: string[] = [],
880-
): Parameter[] => {
881-
return Object.entries(properties)
878+
): Parameter[] => Object.entries(properties)
882879
.map(([name, property]) => {
883880
// Don't flatten discriminated arrays as they are handled separately in createParameter
884881
if (
@@ -904,7 +901,6 @@ const createParameters = (
904901
.map(([name, property]) =>
905902
createParameter(name, property, path, requiredParameters),
906903
)
907-
}
908904

909905
const createParameter = (
910906
name: string,
@@ -1323,7 +1319,7 @@ const createResponse = (
13231319
typeof schema.properties === 'object' &&
13241320
schema.properties !== null
13251321
) {
1326-
const properties = schema.properties
1322+
const {properties} = schema
13271323

13281324
if (!(responseKey in properties)) {
13291325
throw new Error(
@@ -1406,8 +1402,7 @@ export const createProperties = (
14061402
properties: Record<string, OpenapiSchema>,
14071403
parentPaths: string[],
14081404
propertyGroups: PropertyGroup[],
1409-
): Property[] => {
1410-
return Object.entries(properties)
1405+
): Property[] => Object.entries(properties)
14111406
.map(([name, property]) => {
14121407
// Don't flatten discriminated arrays as they are handled separately in createProperty
14131408
if (
@@ -1433,7 +1428,6 @@ export const createProperties = (
14331428
.map(([name, prop]) =>
14341429
createProperty(name, prop, parentPaths, propertyGroups),
14351430
)
1436-
}
14371431

14381432
const createProperty = (
14391433
name: string,

src/lib/openapi/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export * from './find-common-openapi-schema-properties.js'
22
export * from './schemas.js'
3-
export * from './types.js'
3+
export type * from './types.js'

src/lib/openapi/schemas.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ const commonPropertyFields = {
115115
'x-variant-groups': VariantGroupSchema,
116116
}
117117

118-
export const PropertySchema: z.ZodSchema<any> = z.union([
118+
export const PropertySchema: z.ZodSchema = z.union([
119119
z.object({
120120
type: z.enum(['string', 'number', 'integer', 'boolean', 'array', 'object']),
121121
...commonPropertyFields,

src/lib/samples/json.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,4 @@ export const createJsonResponse = (
2323
export const createJsonResourceData = (
2424
{ properties }: ResourceSampleDefinition,
2525
_context: ResourceSampleContext,
26-
): string => {
27-
return JSON.stringify(properties)
28-
}
26+
): string => JSON.stringify(properties)

test/blueprint.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import test from 'ava'
2-
31
import { createBlueprint, TypesModuleSchema } from '@seamapi/blueprint'
2+
import test from 'ava'
43

54
import * as types from './fixtures/types/index.js'
65

test/fixtures/types/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as schemas from './schemas.js'
33
export { schemas }
44

55
export { default as codeSampleDefinitions } from './code-sample-definitions.js'
6-
export * from './model-types.js'
6+
export type * from './model-types.js'
77
export { default as openapi } from './openapi.js'
88
export { default as resourceSampleDefinitions } from './resource-sample-definitions.js'
9-
export * from './route-types.js'
9+
export type * from './route-types.js'

test/seam-blueprint.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1+
import { createBlueprint, TypesModuleSchema } from '@seamapi/blueprint'
12
import * as types from '@seamapi/types/connect'
23
import test from 'ava'
34

4-
import { createBlueprint, TypesModuleSchema } from '@seamapi/blueprint'
5-
65
test('createBlueprint', async (t) => {
76
const typesModule = TypesModuleSchema.parse(types)
87
const blueprint = await createBlueprint(typesModule)

0 commit comments

Comments
 (0)