@databases/pg-config
Advanced tools
Comparing version 3.0.0 to 3.1.0-canary-1685
@@ -5,3 +5,3 @@ "use strict"; | ||
test('get root config', () => { | ||
expect(__1.getPgConfigSync()).toEqual({ | ||
expect((0, __1.getPgConfigSync)()).toEqual({ | ||
connectionStringEnvironmentVariable: 'PG_URL', | ||
@@ -29,5 +29,9 @@ test: { | ||
schemaTypeName: 'DatabaseSchema', | ||
schemaObjectFileName: 'index.ts', | ||
schemaObjectName: 'databaseSchema', | ||
serializeValueFileName: 'index.ts', | ||
serializeValueTypeName: 'serializeValue', | ||
tableFileName: '{{ TABLE_NAME }}.ts', | ||
tableReExportFileName: 'index.ts', | ||
tableInsertParametersReExportFileName: 'index.ts', | ||
tableInsertParametersFileName: '{{ TABLE_NAME }}.ts', | ||
@@ -42,3 +46,3 @@ tableInsertParametersTypeName: '{{ TABLE_NAME | pascal-case }}_InsertParameters', | ||
test('valid config', () => { | ||
expect(__1.readPgConfigSync(__dirname + '/fixtures/empty.json')).toEqual({ | ||
expect((0, __1.readPgConfigSync)(__dirname + '/fixtures/empty.json')).toEqual({ | ||
connectionStringEnvironmentVariable: 'DATABASE_URL', | ||
@@ -66,5 +70,9 @@ test: { | ||
schemaTypeName: 'DatabaseSchema', | ||
schemaObjectFileName: 'index.ts', | ||
schemaObjectName: 'databaseSchema', | ||
serializeValueFileName: 'index.ts', | ||
serializeValueTypeName: 'serializeValue', | ||
tableFileName: '{{ TABLE_NAME }}.ts', | ||
tableReExportFileName: 'index.ts', | ||
tableInsertParametersReExportFileName: 'index.ts', | ||
tableInsertParametersFileName: '{{ TABLE_NAME }}.ts', | ||
@@ -77,3 +85,3 @@ tableInsertParametersTypeName: '{{ TABLE_NAME | pascal-case }}_InsertParameters', | ||
}); | ||
expect(__1.readPgConfigSync(__dirname + '/fixtures/override.json')).toEqual({ | ||
expect((0, __1.readPgConfigSync)(__dirname + '/fixtures/override.json')).toEqual({ | ||
connectionStringEnvironmentVariable: 'PG_CONNECTION', | ||
@@ -101,5 +109,9 @@ test: { | ||
schemaTypeName: 'DatabaseSchema', | ||
schemaObjectFileName: 'index.ts', | ||
schemaObjectName: 'databaseSchema', | ||
serializeValueFileName: 'index.ts', | ||
serializeValueTypeName: 'serializeValue', | ||
tableFileName: '{{ TABLE_NAME }}.ts', | ||
tableReExportFileName: 'index.ts', | ||
tableInsertParametersReExportFileName: 'index.ts', | ||
tableInsertParametersFileName: '{{ TABLE_NAME }}.ts', | ||
@@ -118,3 +130,3 @@ tableInsertParametersTypeName: '{{ TABLE_NAME | pascal-case }}_InsertParameters', | ||
test('invalid config', () => { | ||
expect(() => __1.readPgConfigSync(__dirname + '/fixtures/invalid.json')) | ||
expect(() => (0, __1.readPgConfigSync)(__dirname + '/fixtures/invalid.json')) | ||
.toThrowErrorMatchingInlineSnapshot(` | ||
@@ -121,0 +133,0 @@ "Unable to assign {connectionStringEnvironmentVariable: 10} to { connectionStringEnvironmentVariable: string | undefined; migrationsDirectory: string | undefined; test: TestConfig | undefined; types: TypesConfig | undefined; } |
@@ -154,2 +154,10 @@ import * as ft from 'funtypes'; | ||
/** | ||
* Also re-export the table record type from this file. | ||
* Set this to `null` or to the same value as `tableFileName` | ||
* to disable this feature. | ||
* | ||
* @default "index.ts" | ||
*/ | ||
tableReExportFileName: string | null; | ||
/** | ||
* What should TypeScript types for table insert parameters be called | ||
@@ -167,2 +175,10 @@ * | ||
/** | ||
* Also re-export the table insert parameters type from this file. | ||
* Set this to `null` or to the same value as `tableFileName` | ||
* to disable this feature. | ||
* | ||
* @default "index.ts" | ||
*/ | ||
tableInsertParametersReExportFileName: string | null; | ||
/** | ||
* What should the main generated "schema" type be called | ||
@@ -180,2 +196,14 @@ * | ||
/** | ||
* What should the generated "schema" object type be called | ||
* | ||
* @default "databaseSchema" | ||
*/ | ||
schemaObjectName: string; | ||
/** | ||
* What filename do you want to use for the generated "schema" object | ||
* | ||
* @default "index.ts" | ||
*/ | ||
schemaObjectFileName: string; | ||
/** | ||
* What should the generated "serializeValue" function be called | ||
@@ -182,0 +210,0 @@ * |
@@ -72,6 +72,10 @@ "use strict"; | ||
tableFileName: withDefault(ft.String, `{{ TABLE_NAME }}.ts`), | ||
tableReExportFileName: withDefault(ft.Union(ft.String, ft.Null), 'index.ts'), | ||
tableInsertParametersTypeName: withDefault(ft.String, `{{ TABLE_NAME | pascal-case }}_InsertParameters`), | ||
tableInsertParametersFileName: withDefault(ft.String, `{{ TABLE_NAME }}.ts`), | ||
tableInsertParametersReExportFileName: withDefault(ft.Union(ft.String, ft.Null), 'index.ts'), | ||
schemaTypeName: withDefault(ft.String, `DatabaseSchema`), | ||
schemaFileName: withDefault(ft.String, `index.ts`), | ||
schemaObjectName: withDefault(ft.String, `databaseSchema`), | ||
schemaObjectFileName: withDefault(ft.String, `index.ts`), | ||
serializeValueTypeName: withDefault(ft.String, `serializeValue`), | ||
@@ -78,0 +82,0 @@ serializeValueFileName: withDefault(ft.String, `index.ts`), |
{ | ||
"name": "@databases/pg-config", | ||
"version": "3.0.0", | ||
"version": "3.1.0-canary-1685", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
528
74632
2