Compare commits

..

No commits in common. "master" and "0.14.13" have entirely different histories.

7 changed files with 9 additions and 31 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@extollo/lib", "name": "@extollo/lib",
"version": "0.14.14", "version": "0.14.13",
"description": "The framework library that lifts up your code.", "description": "The framework library that lifts up your code.",
"main": "lib/index.js", "main": "lib/index.js",
"types": "lib/index.d.ts", "types": "lib/index.d.ts",

View File

@ -92,8 +92,5 @@ export class CoreIDLoginProvider extends OAuth2LoginProvider<OAuth2LoginProvider
user.email = data.email user.email = data.email
user.tagline = data.tagline user.tagline = data.tagline
user.photoUrl = data.profile_photo user.photoUrl = data.profile_photo
if ( typeof user.save === 'function' ) {
user.save()
}
} }
} }

View File

@ -48,7 +48,7 @@ export interface AwareOfContainerLifecycle {
export function isAwareOfContainerLifecycle(what: unknown): what is AwareOfContainerLifecycle { export function isAwareOfContainerLifecycle(what: unknown): what is AwareOfContainerLifecycle {
return Boolean( return Boolean(
(typeof what === 'object' || typeof what === 'function') typeof what === 'object'
&& what !== null && what !== null
&& hasOwnProperty(what, 'awareOfContainerLifecycle') && hasOwnProperty(what, 'awareOfContainerLifecycle')
&& what.awareOfContainerLifecycle, && what.awareOfContainerLifecycle,

View File

@ -544,7 +544,7 @@ export class PostgreSQLDialect extends SQLDialect {
return parts.join('\n') return parts.join('\n')
} }
public renderAlterTable(builder: TableBuilder): Maybe<string> { public renderAlterTable(builder: TableBuilder): string {
const alters: string[] = [] const alters: string[] = []
const columns = builder.getColumns() const columns = builder.getColumns()
@ -628,10 +628,6 @@ export class PostgreSQLDialect extends SQLDialect {
alters.push(` RENAME TO "${builder.getRename()}"`) alters.push(` RENAME TO "${builder.getRename()}"`)
} }
if ( !alters.length ) {
return undefined
}
return 'ALTER TABLE ' + builder.name + '\n' + alters.join(',\n') return 'ALTER TABLE ' + builder.name + '\n' + alters.join(',\n')
} }

View File

@ -2,7 +2,7 @@ import {Constraint, QuerySource} from '../types'
import {AbstractBuilder} from '../builder/AbstractBuilder' import {AbstractBuilder} from '../builder/AbstractBuilder'
import {AppClass} from '../../lifecycle/AppClass' import {AppClass} from '../../lifecycle/AppClass'
import {ColumnBuilder, IndexBuilder, TableBuilder} from '../schema/TableBuilder' import {ColumnBuilder, IndexBuilder, TableBuilder} from '../schema/TableBuilder'
import {Collectable, Collection, Maybe} from '../../util' import {Collectable, Collection} from '../../util'
/** A scalar value which can be interpolated safely into an SQL query. */ /** A scalar value which can be interpolated safely into an SQL query. */
export type ScalarEscapeValue = null | undefined | string | number | boolean | Date | QuerySafeValue; export type ScalarEscapeValue = null | undefined | string | number | boolean | Date | QuerySafeValue;
@ -198,7 +198,7 @@ export abstract class SQLDialect extends AppClass {
* Given a table schema-builder, render an `ALTER TABLE...` query. * Given a table schema-builder, render an `ALTER TABLE...` query.
* @param builder * @param builder
*/ */
public abstract renderAlterTable(builder: TableBuilder): Maybe<string>; public abstract renderAlterTable(builder: TableBuilder): string;
/** /**
* Given a table schema-builder, render a `DROP TABLE...` query. * Given a table schema-builder, render a `DROP TABLE...` query.
@ -314,10 +314,7 @@ export abstract class SQLDialect extends AppClass {
if ( !builder.isExisting() && builder.isDirty() ) { if ( !builder.isExisting() && builder.isDirty() ) {
parts.push(this.renderCreateTable(builder)) parts.push(this.renderCreateTable(builder))
} else if ( builder.isExisting() && builder.isDirty() ) { } else if ( builder.isExisting() && builder.isDirty() ) {
const alterTable = this.renderAlterTable(builder) parts.push(this.renderAlterTable(builder))
if ( alterTable ) {
parts.push(alterTable)
}
} }
// Render the various schema queries as a single transaction // Render the various schema queries as a single transaction

View File

@ -223,16 +223,7 @@ export class ColumnBuilder extends SchemaBuilderBase {
* @param type * @param type
*/ */
public type(type: FieldType): this { public type(type: FieldType): this {
if ( if ( this.targetType === type ) {
this.targetType === type
|| (
this.existsInSchema
&& (
(this.targetType === FieldType.integer && type === FieldType.serial)
|| (this.targetType === FieldType.bigint && type === FieldType.bigserial)
)
)
) {
return this return this
} }

View File

@ -43,8 +43,7 @@ export class AsyncCollection<T> {
if ( typeof key !== 'function' ) { if ( typeof key !== 'function' ) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment // eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore // @ts-ignore
await callback(items.map(x => x[key])) key = x => x[key]
return
} }
await callback(items.map(key)) await callback(items.map(key))
@ -57,9 +56,7 @@ export class AsyncCollection<T> {
if ( typeof key !== 'function' ) { if ( typeof key !== 'function' ) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment // eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore // @ts-ignore
await callback(items.map(x => x[key]).map(x => Number(x)) key = x => x[key]
.all())
return
} }
await callback(items.map(key).map(x => Number(x)) await callback(items.map(key).map(x => Number(x))