Skip to content

Commit

Permalink
fix: fix typescript issue
Browse files Browse the repository at this point in the history
  • Loading branch information
nichenqin committed Dec 8, 2022
1 parent b619d7a commit 82c02f5
Show file tree
Hide file tree
Showing 17 changed files with 33 additions and 28 deletions.
1 change: 1 addition & 0 deletions packages/core/field/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { createNumberFieldSchema } from './number-field.type'
import { createTextFieldSchema } from './text-field.type'

export * from './field.constant'
export * from './field.factory'
export * from './field.type'
export * from './value-objects'
Expand Down
1 change: 0 additions & 1 deletion packages/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ export * from './table.command-bus'
export * from './table.query-bus'
export * from './table.query-model'
export * from './table.repository'
export * from './table.type'
4 changes: 2 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
"scripts": {
"build": "tsup",
"coverage": "vitest run --coverage",
"dev": "tsup --watch",
"dev": "tsup --watch --onSuccess \"tsc --emitDeclarationOnly --declaration\"",
"prebuild": "rimraf dist",
"test": "vitest run",
"test:watch": "vitest"
},
"types": "./dist/index"
"types": "./dist/index.d.ts"
}
2 changes: 1 addition & 1 deletion packages/core/table.query-model.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Option } from 'oxide.ts'
import type { ITableSpec } from './specifications'
import type { IQueryTable } from './table.type'
import type { IQueryTable } from './table'

export interface ITableQueryModel {
findOne(spec: ITableSpec): Promise<Option<IQueryTable>>
Expand Down
2 changes: 1 addition & 1 deletion packages/core/table.schema.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { z } from 'zod'
import { createTableCommandInput } from './commands'
import { querySchemaSchema } from './field'
import type { IQueryTable } from './table.type'
import type { IQueryTable } from './table'
import { createViewInput_internal, queryViews } from './view'

export const createTableInput_internal = createTableCommandInput.merge(
Expand Down
14 changes: 12 additions & 2 deletions packages/core/table.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
import { filter, map, pipe, toArray } from '@fxts/core'
import type { ICreateRecordInput } from './commands'
import type { ICreateFieldsSchema_internal, ICreateFieldValueSchema_internal } from './field'
import type { ICreateFieldsSchema_internal, ICreateFieldValueSchema_internal, IQuerySchemaSchema } from './field'
import { createFieldValueSchema_internal } from './field'
import { Record } from './record'
import type { ICreateTableInput_internal } from './table.schema'
import type { IQueryTable } from './table.type'
import { TableId, TableSchema } from './value-objects'
import { TableName } from './value-objects/table-name.vo'
import type { IQueryView } from './view'
import { defaultViewDiaplyType, View } from './view'
import { Views } from './view/views'

/**
* QueryTable
*/
export interface IQueryTable {
id: string
name: string
schema: IQuerySchemaSchema
views?: IQueryView[]
}

export class Table {
public id: TableId
public name: TableName
Expand Down
9 changes: 0 additions & 9 deletions packages/core/table.type.ts

This file was deleted.

1 change: 1 addition & 0 deletions packages/core/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ export default defineConfig({
splitting: true,
sourcemap: true,
clean: false,
dts: true,
})
2 changes: 1 addition & 1 deletion packages/domain/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"scripts": {
"build": "tsup",
"coverage": "vitest run --coverage",
"dev": "tsup --watch",
"dev": "tsup --watch --onSuccess \"tsc --emitDeclarationOnly --declaration\"",
"prebuild": "rimraf dist",
"test": "vitest run",
"test:watch": "vitest"
Expand Down
1 change: 1 addition & 0 deletions packages/domain/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ export default defineConfig({
splitting: true,
sourcemap: true,
clean: false,
dts: true,
})
2 changes: 1 addition & 1 deletion packages/repositories/in-memory-repository/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"scripts": {
"build": "tsup",
"coverage": "vitest run --coverage",
"dev": "tsup --watch",
"dev": "tsup --watch --onSuccess \"tsc --emitDeclarationOnly --declaration\"",
"prebuild": "rimraf dist",
"test": "vitest run",
"test:watch": "vitest"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export class TableInMemoryMapper {
id: t.id,
name: t.name,
schema: t.schema,
defaultView: t.defaultView,
views: t.views,
})
return Ok(table)
}
Expand All @@ -24,10 +24,10 @@ export class TableInMemoryMapper {
type: c.type,
required: c.required,
})),
defaultView: {
name: t.defaultView.name.unpack(),
displayType: t.defaultView.displayType,
},
views: t.views.views.map((v) => ({
name: v.name.unpack(),
displayType: v.displayType,
})),
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ export type TableInMemory = {
id: string
name: string
schema: FieldInMemory[]
defaultView: ViewInMemory
views: ViewInMemory[]
}
1 change: 1 addition & 0 deletions packages/repositories/in-memory-repository/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ export default defineConfig({
sourcemap: true,
clean: false,
format: 'esm',
dts: true,
})
4 changes: 2 additions & 2 deletions packages/trpc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
"scripts": {
"build": "tsup",
"coverage": "vitest run --coverage",
"dev": "tsup --watch",
"dev": "tsup --watch --onSuccess \"tsc --emitDeclarationOnly --declaration\"",
"prebuild": "rimraf dist",
"test": "vitest run",
"test:watch": "vitest"
},
"types": "./dist/index"
"types": "./dist/index.d.ts"
}
4 changes: 2 additions & 2 deletions packages/trpc/router/table.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import type { ITableCommandBus, ITableQueryBus } from '@egodb/core'
import {
CreateTableCommand,
createTableCommandInput,
Expand All @@ -10,14 +9,15 @@ import {
getTablesQueryOutput,
getTablesQuerySchema,
} from '@egodb/core'
import type { ICommandBus, IQueryBus } from '@egodb/domain'
import type { publicProcedure } from '../trpc'
import { router } from '../trpc'

const TAG_TABLE = 'table'
const tags = [TAG_TABLE]

export const createTableRouter =
(procedure: typeof publicProcedure) => (commandBus: ITableCommandBus, queryBus: ITableQueryBus) =>
(procedure: typeof publicProcedure) => (commandBus: ICommandBus, queryBus: IQueryBus) =>
router({
get: procedure
.meta({ openapi: { method: 'GET', path: '/table.get', tags } })
Expand Down
1 change: 1 addition & 0 deletions packages/trpc/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ export default defineConfig({
splitting: true,
sourcemap: true,
clean: false,
dts: true,
})

0 comments on commit 82c02f5

Please sign in to comment.