pg-introspection
Advanced tools
Comparing version 0.0.1-beta.5 to 0.0.1-beta.6
# pg-introspection | ||
## 0.0.1-beta.6 | ||
### Patch Changes | ||
- [#1927](https://github.com/graphile/crystal/pull/1927) | ||
[`00d32d887`](https://github.com/graphile/crystal/commit/00d32d887a6ae01374a4fda1babab7c8f14832c0) | ||
Thanks [@benjie](https://github.com/benjie)! - Excludes table constraints on | ||
tables from extensions if configured to not include extensions. | ||
- [#1927](https://github.com/graphile/crystal/pull/1927) | ||
[`c62eee10b`](https://github.com/graphile/crystal/commit/c62eee10b445f9455bf2a0524ad2b828bdf4ffa6) | ||
Thanks [@benjie](https://github.com/benjie)! - Add pg_am to pg-introspection | ||
to enable determining index access method | ||
## 0.0.1-beta.5 | ||
@@ -4,0 +18,0 @@ |
@@ -23,3 +23,3 @@ "use strict"; | ||
const entry = collection[i]; | ||
if (toDelete.has(entry[attr])) { | ||
if (entry[attr] != null && toDelete.has(entry[attr])) { | ||
collection.splice(i, 1); | ||
@@ -58,2 +58,4 @@ } | ||
del(extensionClassOids, introspection.attributes, "attrelid"); | ||
del(extensionClassOids, introspection.constraints, "conrelid"); | ||
del(extensionClassOids, introspection.constraints, "confrelid"); | ||
del(extensionClassOids, introspection.types, "typrelid"); | ||
@@ -164,2 +166,5 @@ } | ||
entity.getInherited = memo(() => introspection.inherits.filter((inh) => inh.inhrelid === entity._id)); | ||
entity.getAccessMethod = memo(() => entity.relam != null | ||
? introspection.am.find((am) => am._id === entity.relam) | ||
: undefined); | ||
}); | ||
@@ -166,0 +171,0 @@ introspection.indexes.forEach((entity) => { |
@@ -101,2 +101,3 @@ import type { Introspection, PgAttribute, PgAuthMembers, PgClass, PgConstraint, PgDatabase, PgDepend, PgDescription, PgEnum, PgExtension, PgIndex, PgInherits, PgLanguage, PgNamespace, PgProc, PgProcArgument, PgRange, PgRoles, PgType } from "./introspection.js"; | ||
getInherited(): PgInherits[]; | ||
getAccessMethod(): PgAm | undefined; | ||
} | ||
@@ -103,0 +104,0 @@ interface PgIndex { |
@@ -1084,2 +1084,17 @@ type PgOid = string; | ||
/** | ||
* The catalog pg_am stores information about relation access methods. There is one row for each access method | ||
* supported by the system. Currently, only tables and indexes have access methods. The requirements for table and | ||
* index access methods are discussed in detail in [tableam] and [indexam] respectively. | ||
*/ | ||
export interface PgAm { | ||
/** Row identifier */ | ||
_id: PgOid; | ||
/** Name of the access method */ | ||
amname: PgName | null; | ||
/** OID of a handler function that is responsible for supplying information about the access method */ | ||
amhandler: PgOid | null; | ||
/** t = table (including materialized views), i = index. */ | ||
amtype: string | null; | ||
} | ||
/** | ||
* This type contains a description of everything we care about in the database. | ||
@@ -1105,2 +1120,3 @@ */ | ||
descriptions: Array<PgDescription>; | ||
am: Array<PgAm>; | ||
/** | ||
@@ -1127,3 +1143,3 @@ * Catalogs such as pg_class, pg_attribute, etc have oids; this loopup lets us | ||
*/ | ||
export type PgEntity = PgDatabase | PgNamespace | PgClass | PgAttribute | PgConstraint | PgProc | PgRoles | PgAuthMembers | PgType | PgEnum | PgExtension | PgIndex | PgInherits | PgLanguage | PgRange | PgDepend | PgDescription; | ||
export type PgEntity = PgDatabase | PgNamespace | PgClass | PgAttribute | PgConstraint | PgProc | PgRoles | PgAuthMembers | PgType | PgEnum | PgExtension | PgIndex | PgInherits | PgLanguage | PgRange | PgDepend | PgDescription | PgAm; | ||
/** | ||
@@ -1130,0 +1146,0 @@ * Builds a PostgreSQL introspection SQL query to return an object with the same shape as `Introspection` above. |
@@ -133,2 +133,8 @@ "use strict"; | ||
) | ||
), | ||
am as ( | ||
select pg_am.oid as _id, * | ||
from pg_catalog.pg_am | ||
where true | ||
) | ||
@@ -187,2 +193,5 @@ select json_build_object( | ||
'am', | ||
(select coalesce((select json_agg(row_to_json(am) order by amname) from am), '[]'::json)), | ||
'catalog_by_oid', | ||
@@ -189,0 +198,0 @@ ( |
{ | ||
"name": "pg-introspection", | ||
"version": "0.0.1-beta.5", | ||
"version": "0.0.1-beta.6", | ||
"description": "Strongly typed PostgreSQL introspection library", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -32,4 +32,3 @@ # pg-introspection | ||
</tr><tr> | ||
<td align="center"><a href="https://www.accenture.com/"><img src="https://graphile.org/images/sponsors/accenture.svg" width="90" height="90" alt="Accenture" /><br />Accenture</a> *</td> | ||
<td align="center"><a href="https://microteam.io/"><img src="https://graphile.org/images/sponsors/micro.png" width="90" height="90" alt="We Love Micro" /><br />We Love Micro</a> *</td> | ||
<td align="center"><a href="https://gosteelhead.com/"><img src="https://graphile.org/images/sponsors/steelhead.svg" width="90" height="90" alt="Steelhead" /><br />Steelhead</a> *</td> | ||
</tr></table> | ||
@@ -36,0 +35,0 @@ |
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
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
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
194824
28
2955
101