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",
"version": "0.14.14",
"version": "0.14.13",
"description": "The framework library that lifts up your code.",
"main": "lib/index.js",
"types": "lib/index.d.ts",

View File

@ -92,8 +92,5 @@ export class CoreIDLoginProvider extends OAuth2LoginProvider<OAuth2LoginProvider
user.email = data.email
user.tagline = data.tagline
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 {
return Boolean(
(typeof what === 'object' || typeof what === 'function')
typeof what === 'object'
&& what !== null
&& hasOwnProperty(what, 'awareOfContainerLifecycle')
&& what.awareOfContainerLifecycle,

View File

@ -544,7 +544,7 @@ export class PostgreSQLDialect extends SQLDialect {
return parts.join('\n')
}
public renderAlterTable(builder: TableBuilder): Maybe<string> {
public renderAlterTable(builder: TableBuilder): string {
const alters: string[] = []
const columns = builder.getColumns()
@ -628,10 +628,6 @@ export class PostgreSQLDialect extends SQLDialect {
alters.push(` RENAME TO "${builder.getRename()}"`)
}
if ( !alters.length ) {
return undefined
}
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 {AppClass} from '../../lifecycle/AppClass'
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. */
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.
* @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.
@ -314,10 +314,7 @@ export abstract class SQLDialect extends AppClass {
if ( !builder.isExisting() && builder.isDirty() ) {
parts.push(this.renderCreateTable(builder))
} else if ( builder.isExisting() && builder.isDirty() ) {
const alterTable = this.renderAlterTable(builder)
if ( alterTable ) {
parts.push(alterTable)
}
parts.push(this.renderAlterTable(builder))
}
// Render the various schema queries as a single transaction

View File

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

View File

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