Update pg-promise to the latest version 🚀 (#5857)
* fix(package): update pg-promise to version 9.0.0 * chore(package): update lockfile package-lock.json * remove es6 generators
This commit is contained in:
committed by
peril-parse-community[bot]
parent
8c321ed750
commit
80bb2b6389
28
package-lock.json
generated
28
package-lock.json
generated
@@ -2082,9 +2082,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"assert-options": {
|
"assert-options": {
|
||||||
"version": "0.1.3",
|
"version": "0.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/assert-options/-/assert-options-0.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/assert-options/-/assert-options-0.4.0.tgz",
|
||||||
"integrity": "sha512-DXrZ5WkCv/igD+H8OmeUTl9k0pBhYSTdyA7DRZoSJERCzQ8Z2v85yDjkhYVnHUOeCXGfCNKaogRbLWQsIQbtpg=="
|
"integrity": "sha512-HukncCp5jpMpKE4vcxH/YrmoJUDTtjpITOdw2OR1yDjhbecUf6EJn/xRPN73ykuvDGRLmAD7OL92zhvMO3nnTA=="
|
||||||
},
|
},
|
||||||
"assert-plus": {
|
"assert-plus": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
@@ -8959,9 +8959,9 @@
|
|||||||
"integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns="
|
"integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns="
|
||||||
},
|
},
|
||||||
"pg": {
|
"pg": {
|
||||||
"version": "7.11.0",
|
"version": "7.12.0",
|
||||||
"resolved": "https://registry.npmjs.org/pg/-/pg-7.11.0.tgz",
|
"resolved": "https://registry.npmjs.org/pg/-/pg-7.12.0.tgz",
|
||||||
"integrity": "sha512-YO4V7vCmEMGoF390LJaFaohWNKaA2ayoQOEZmiHVcAUF+YsRThpf/TaKCgSvsSE7cDm37Q/Cy3Gz41xiX/XjTw==",
|
"integrity": "sha512-q54Ic0oBXfDZMwheP8ALeUX32TUXvF7SNgAlZjyhkDuFCJkQCgcLBz0Be5uOrAj3ljSok/CI9lRbYzEko0z1Zw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"buffer-writer": "2.0.0",
|
"buffer-writer": "2.0.0",
|
||||||
"packet-reader": "1.0.0",
|
"packet-reader": "1.0.0",
|
||||||
@@ -8995,18 +8995,18 @@
|
|||||||
"integrity": "sha512-8aZ9xdx7Pe/ppFYVOqvU5KgmM6ttXjaBlsl9Y8yzrUH4xSNVucJKKOwm4Y4H+LCvzZGjZIm4Rkf2Ajt5ixtkBQ=="
|
"integrity": "sha512-8aZ9xdx7Pe/ppFYVOqvU5KgmM6ttXjaBlsl9Y8yzrUH4xSNVucJKKOwm4Y4H+LCvzZGjZIm4Rkf2Ajt5ixtkBQ=="
|
||||||
},
|
},
|
||||||
"pg-pool": {
|
"pg-pool": {
|
||||||
"version": "2.0.6",
|
"version": "2.0.7",
|
||||||
"resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-2.0.6.tgz",
|
"resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-2.0.7.tgz",
|
||||||
"integrity": "sha512-hod2zYQxM8Gt482q+qONGTYcg/qVcV32VHVPtktbBJs0us3Dj7xibISw0BAAXVMCzt8A/jhfJvpZaxUlqtqs0g=="
|
"integrity": "sha512-UiJyO5B9zZpu32GSlP0tXy8J2NsJ9EFGFfz5v6PSbdz/1hBLX1rNiiy5+mAm5iJJYwfCv4A0EBcQLGWwjbpzZw=="
|
||||||
},
|
},
|
||||||
"pg-promise": {
|
"pg-promise": {
|
||||||
"version": "8.7.5",
|
"version": "9.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/pg-promise/-/pg-promise-8.7.5.tgz",
|
"resolved": "https://registry.npmjs.org/pg-promise/-/pg-promise-9.0.0.tgz",
|
||||||
"integrity": "sha512-r/OmS1b1i0nA0KHqlbcAoMLoNo3EGUdcZxaseyXnHrzepcS8ciK516Lw6/lIb6AeWI85ZOBSNdiPlw22xoFx3A==",
|
"integrity": "sha512-l8ZKzbxqBHSg+Z1Q1AXv+nPfK0OEpBiqOqIQyQdrfUPyjT2fHwkB+kQCzZ+4Phjh5Z2sAa8la4sRHvEke/P//g==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"assert-options": "0.1.3",
|
"assert-options": "0.4.0",
|
||||||
"manakin": "0.5.2",
|
"manakin": "0.5.2",
|
||||||
"pg": "7.11.0",
|
"pg": "7.12.0",
|
||||||
"pg-minify": "1.4.1",
|
"pg-minify": "1.4.1",
|
||||||
"spex": "2.2.0"
|
"spex": "2.2.0"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
"mongodb": "3.2.7",
|
"mongodb": "3.2.7",
|
||||||
"node-rsa": "1.0.5",
|
"node-rsa": "1.0.5",
|
||||||
"parse": "2.5.1",
|
"parse": "2.5.1",
|
||||||
"pg-promise": "8.7.5",
|
"pg-promise": "9.0.0",
|
||||||
"redis": "2.8.0",
|
"redis": "2.8.0",
|
||||||
"semver": "6.3.0",
|
"semver": "6.3.0",
|
||||||
"subscriptions-transport-ws": "0.9.16",
|
"subscriptions-transport-ws": "0.9.16",
|
||||||
|
|||||||
@@ -830,15 +830,15 @@ export class PostgresStorageAdapter implements StorageAdapter {
|
|||||||
|
|
||||||
setClassLevelPermissions(className: string, CLPs: any) {
|
setClassLevelPermissions(className: string, CLPs: any) {
|
||||||
const self = this;
|
const self = this;
|
||||||
return this._client.task('set-class-level-permissions', function*(t) {
|
return this._client.task('set-class-level-permissions', async (t) => {
|
||||||
yield self._ensureSchemaCollectionExists(t);
|
await self._ensureSchemaCollectionExists(t);
|
||||||
const values = [
|
const values = [
|
||||||
className,
|
className,
|
||||||
'schema',
|
'schema',
|
||||||
'classLevelPermissions',
|
'classLevelPermissions',
|
||||||
JSON.stringify(CLPs),
|
JSON.stringify(CLPs),
|
||||||
];
|
];
|
||||||
yield t.none(
|
await t.none(
|
||||||
`UPDATE "_SCHEMA" SET $2:name = json_object_set_key($2:name, $3::text, $4::jsonb) WHERE "className"=$1`,
|
`UPDATE "_SCHEMA" SET $2:name = json_object_set_key($2:name, $3::text, $4::jsonb) WHERE "className"=$1`,
|
||||||
values
|
values
|
||||||
);
|
);
|
||||||
@@ -895,15 +895,15 @@ export class PostgresStorageAdapter implements StorageAdapter {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return conn.tx('set-indexes-with-schema-format', function*(t) {
|
return conn.tx('set-indexes-with-schema-format', async (t) => {
|
||||||
if (insertedIndexes.length > 0) {
|
if (insertedIndexes.length > 0) {
|
||||||
yield self.createIndexes(className, insertedIndexes, t);
|
await self.createIndexes(className, insertedIndexes, t);
|
||||||
}
|
}
|
||||||
if (deletedIndexes.length > 0) {
|
if (deletedIndexes.length > 0) {
|
||||||
yield self.dropIndexes(className, deletedIndexes, t);
|
await self.dropIndexes(className, deletedIndexes, t);
|
||||||
}
|
}
|
||||||
yield self._ensureSchemaCollectionExists(t);
|
await self._ensureSchemaCollectionExists(t);
|
||||||
yield t.none(
|
await t.none(
|
||||||
'UPDATE "_SCHEMA" SET $2:name = json_object_set_key($2:name, $3::text, $4::jsonb) WHERE "className"=$1',
|
'UPDATE "_SCHEMA" SET $2:name = json_object_set_key($2:name, $3::text, $4::jsonb) WHERE "className"=$1',
|
||||||
[className, 'schema', 'indexes', JSON.stringify(existingIndexes)]
|
[className, 'schema', 'indexes', JSON.stringify(existingIndexes)]
|
||||||
);
|
);
|
||||||
@@ -991,17 +991,17 @@ export class PostgresStorageAdapter implements StorageAdapter {
|
|||||||
const values = [className, ...valuesArray];
|
const values = [className, ...valuesArray];
|
||||||
|
|
||||||
debug(qs, values);
|
debug(qs, values);
|
||||||
return conn.task('create-table', function*(t) {
|
return conn.task('create-table', async (t) => {
|
||||||
try {
|
try {
|
||||||
yield self._ensureSchemaCollectionExists(t);
|
await self._ensureSchemaCollectionExists(t);
|
||||||
yield t.none(qs, values);
|
await t.none(qs, values);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error.code !== PostgresDuplicateRelationError) {
|
if (error.code !== PostgresDuplicateRelationError) {
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
// ELSE: Table already exists, must have been created by a different request. Ignore the error.
|
// ELSE: Table already exists, must have been created by a different request. Ignore the error.
|
||||||
}
|
}
|
||||||
yield t.tx('create-table-tx', tx => {
|
await t.tx('create-table-tx', tx => {
|
||||||
return tx.batch(
|
return tx.batch(
|
||||||
relations.map(fieldName => {
|
relations.map(fieldName => {
|
||||||
return tx.none(
|
return tx.none(
|
||||||
@@ -1019,8 +1019,8 @@ export class PostgresStorageAdapter implements StorageAdapter {
|
|||||||
conn = conn || this._client;
|
conn = conn || this._client;
|
||||||
const self = this;
|
const self = this;
|
||||||
|
|
||||||
return conn.tx('schema-upgrade', function*(t) {
|
return conn.tx('schema-upgrade', async (t) => {
|
||||||
const columns = yield t.map(
|
const columns = await t.map(
|
||||||
'SELECT column_name FROM information_schema.columns WHERE table_name = $<className>',
|
'SELECT column_name FROM information_schema.columns WHERE table_name = $<className>',
|
||||||
{ className },
|
{ className },
|
||||||
a => a.column_name
|
a => a.column_name
|
||||||
@@ -1036,7 +1036,7 @@ export class PostgresStorageAdapter implements StorageAdapter {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
yield t.batch(newColumns);
|
await t.batch(newColumns);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1050,10 +1050,10 @@ export class PostgresStorageAdapter implements StorageAdapter {
|
|||||||
debug('addFieldIfNotExists', { className, fieldName, type });
|
debug('addFieldIfNotExists', { className, fieldName, type });
|
||||||
conn = conn || this._client;
|
conn = conn || this._client;
|
||||||
const self = this;
|
const self = this;
|
||||||
return conn.tx('add-field-if-not-exists', function*(t) {
|
return conn.tx('add-field-if-not-exists', async (t) => {
|
||||||
if (type.type !== 'Relation') {
|
if (type.type !== 'Relation') {
|
||||||
try {
|
try {
|
||||||
yield t.none(
|
await t.none(
|
||||||
'ALTER TABLE $<className:name> ADD COLUMN $<fieldName:name> $<postgresType:raw>',
|
'ALTER TABLE $<className:name> ADD COLUMN $<fieldName:name> $<postgresType:raw>',
|
||||||
{
|
{
|
||||||
className,
|
className,
|
||||||
@@ -1063,7 +1063,7 @@ export class PostgresStorageAdapter implements StorageAdapter {
|
|||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error.code === PostgresRelationDoesNotExistError) {
|
if (error.code === PostgresRelationDoesNotExistError) {
|
||||||
return yield self.createClass(
|
return await self.createClass(
|
||||||
className,
|
className,
|
||||||
{ fields: { [fieldName]: type } },
|
{ fields: { [fieldName]: type } },
|
||||||
t
|
t
|
||||||
@@ -1075,13 +1075,13 @@ export class PostgresStorageAdapter implements StorageAdapter {
|
|||||||
// Column already exists, created by other request. Carry on to see if it's the right type.
|
// Column already exists, created by other request. Carry on to see if it's the right type.
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
yield t.none(
|
await t.none(
|
||||||
'CREATE TABLE IF NOT EXISTS $<joinTable:name> ("relatedId" varChar(120), "owningId" varChar(120), PRIMARY KEY("relatedId", "owningId") )',
|
'CREATE TABLE IF NOT EXISTS $<joinTable:name> ("relatedId" varChar(120), "owningId" varChar(120), PRIMARY KEY("relatedId", "owningId") )',
|
||||||
{ joinTable: `_Join:${fieldName}:${className}` }
|
{ joinTable: `_Join:${fieldName}:${className}` }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = yield t.any(
|
const result = await t.any(
|
||||||
'SELECT "schema" FROM "_SCHEMA" WHERE "className" = $<className> and ("schema"::json->\'fields\'->$<fieldName>) is not null',
|
'SELECT "schema" FROM "_SCHEMA" WHERE "className" = $<className> and ("schema"::json->\'fields\'->$<fieldName>) is not null',
|
||||||
{ className, fieldName }
|
{ className, fieldName }
|
||||||
);
|
);
|
||||||
@@ -1090,7 +1090,7 @@ export class PostgresStorageAdapter implements StorageAdapter {
|
|||||||
throw 'Attempted to add a field that already exists';
|
throw 'Attempted to add a field that already exists';
|
||||||
} else {
|
} else {
|
||||||
const path = `{fields,${fieldName}}`;
|
const path = `{fields,${fieldName}}`;
|
||||||
yield t.none(
|
await t.none(
|
||||||
'UPDATE "_SCHEMA" SET "schema"=jsonb_set("schema", $<path>, $<type>) WHERE "className"=$<className>',
|
'UPDATE "_SCHEMA" SET "schema"=jsonb_set("schema", $<path>, $<type>) WHERE "className"=$<className>',
|
||||||
{ path, type, className }
|
{ path, type, className }
|
||||||
);
|
);
|
||||||
@@ -1120,9 +1120,9 @@ export class PostgresStorageAdapter implements StorageAdapter {
|
|||||||
debug('deleteAllClasses');
|
debug('deleteAllClasses');
|
||||||
|
|
||||||
return this._client
|
return this._client
|
||||||
.task('delete-all-classes', function*(t) {
|
.task('delete-all-classes', async (t) => {
|
||||||
try {
|
try {
|
||||||
const results = yield t.any('SELECT * FROM "_SCHEMA"');
|
const results = await t.any('SELECT * FROM "_SCHEMA"');
|
||||||
const joins = results.reduce((list: Array<string>, schema: any) => {
|
const joins = results.reduce((list: Array<string>, schema: any) => {
|
||||||
return list.concat(joinTablesForSchema(schema.schema));
|
return list.concat(joinTablesForSchema(schema.schema));
|
||||||
}, []);
|
}, []);
|
||||||
@@ -1142,7 +1142,7 @@ export class PostgresStorageAdapter implements StorageAdapter {
|
|||||||
query: 'DROP TABLE IF EXISTS $<className:name>',
|
query: 'DROP TABLE IF EXISTS $<className:name>',
|
||||||
values: { className },
|
values: { className },
|
||||||
}));
|
}));
|
||||||
yield t.tx(tx => tx.none(helpers.concat(queries)));
|
await t.tx(tx => tx.none(helpers.concat(queries)));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error.code !== PostgresRelationDoesNotExistError) {
|
if (error.code !== PostgresRelationDoesNotExistError) {
|
||||||
throw error;
|
throw error;
|
||||||
@@ -1190,13 +1190,13 @@ export class PostgresStorageAdapter implements StorageAdapter {
|
|||||||
})
|
})
|
||||||
.join(', DROP COLUMN');
|
.join(', DROP COLUMN');
|
||||||
|
|
||||||
return this._client.tx('delete-fields', function*(t) {
|
return this._client.tx('delete-fields', async (t) => {
|
||||||
yield t.none(
|
await t.none(
|
||||||
'UPDATE "_SCHEMA" SET "schema"=$<schema> WHERE "className"=$<className>',
|
'UPDATE "_SCHEMA" SET "schema"=$<schema> WHERE "className"=$<className>',
|
||||||
{ schema, className }
|
{ schema, className }
|
||||||
);
|
);
|
||||||
if (values.length > 1) {
|
if (values.length > 1) {
|
||||||
yield t.none(`ALTER TABLE $1:name DROP COLUMN ${columns}`, values);
|
await t.none(`ALTER TABLE $1:name DROP COLUMN ${columns}`, values);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -1206,9 +1206,9 @@ export class PostgresStorageAdapter implements StorageAdapter {
|
|||||||
// rejection reason are TBD.
|
// rejection reason are TBD.
|
||||||
getAllClasses() {
|
getAllClasses() {
|
||||||
const self = this;
|
const self = this;
|
||||||
return this._client.task('get-all-classes', function*(t) {
|
return this._client.task('get-all-classes', async (t) => {
|
||||||
yield self._ensureSchemaCollectionExists(t);
|
await self._ensureSchemaCollectionExists(t);
|
||||||
return yield t.map('SELECT * FROM "_SCHEMA"', null, row =>
|
return await t.map('SELECT * FROM "_SCHEMA"', null, row =>
|
||||||
toParseSchema({ className: row.className, ...row.schema })
|
toParseSchema({ className: row.className, ...row.schema })
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user