Socket
Socket
Sign inDemoInstall

@dataplan/pg

Package Overview
Dependencies
Maintainers
1
Versions
72
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dataplan/pg - npm Package Compare versions

Comparing version 0.0.1-beta.12 to 0.0.1-beta.13

dist/pgServices.d.ts

39

CHANGELOG.md
# @dataplan/pg
## 0.0.1-beta.13
### Patch Changes
- [#1817](https://github.com/graphile/crystal/pull/1817)
[`f305c3278`](https://github.com/graphile/crystal/commit/f305c327848eb7baef46c5384a7cc5af6f79db8d)
Thanks [@benjie](https://github.com/benjie)! - Add support for limiting
polymorphic plans (only some of them, specifically `pgUnionAll()` right now)
to limit the types of their results; exposed via an experimental 'only'
argument on fields, for example
`allApplications(only: [GcpApplication, AwsApplication])` would limit the type
of applications returned to only be the two specified.
- [#1877](https://github.com/graphile/crystal/pull/1877)
[`8a0cdb95f`](https://github.com/graphile/crystal/commit/8a0cdb95f200b28b0ea1ab5caa12b23dce5f374f)
Thanks [@benjie](https://github.com/benjie)! - Move 'declare global' out of
'interfaces.ts' and into 'index.ts' or equivalent. Should make TypeScript more
aware of these types.
- [#1879](https://github.com/graphile/crystal/pull/1879)
[`dbd91fdd8`](https://github.com/graphile/crystal/commit/dbd91fdd836f041b6e2ff9d358c6a6f521f43914)
Thanks [@benjie](https://github.com/benjie)! - Move PgContextPlugin from
graphile-build-pg into @dataplan/pg so it can be used after schema export
without needing dependency on graphile-build-pg
- [#1884](https://github.com/graphile/crystal/pull/1884)
[`c66c3527c`](https://github.com/graphile/crystal/commit/c66c3527ce2bb38afa37242ecb5a22247efd6db9)
Thanks [@benjie](https://github.com/benjie)! - List codecs can now have names.
- Updated dependencies
[[`3fdc2bce4`](https://github.com/graphile/crystal/commit/3fdc2bce42418773f808c5b8309dfb361cd95ce9),
[`aeef362b5`](https://github.com/graphile/crystal/commit/aeef362b5744816f01e4a6f714bbd77f92332bc5),
[`8a76db07f`](https://github.com/graphile/crystal/commit/8a76db07f4c110cecc6225504f9a05ccbcbc7b92),
[`8a0cdb95f`](https://github.com/graphile/crystal/commit/8a0cdb95f200b28b0ea1ab5caa12b23dce5f374f),
[`1c9f1c0ed`](https://github.com/graphile/crystal/commit/1c9f1c0edf4e621a5b6345d3a41527a18143c6ae)]:
- grafast@0.1.1-beta.2
- graphile-config@0.0.1-beta.5
- @dataplan/json@0.0.1-beta.11
## 0.0.1-beta.12

@@ -4,0 +43,0 @@

2

dist/adaptors/pg.d.ts

@@ -48,3 +48,3 @@ /**

}
export declare function createWithPgClient(options: PgAdaptorOptions, variant?: "SUPERUSER" | string | null): WithPgClient<NodePostgresPgClient>;
export declare function createWithPgClient(options?: PgAdaptorOptions, variant?: "SUPERUSER" | string | null): WithPgClient<NodePostgresPgClient>;
/**

@@ -51,0 +51,0 @@ * This class provides helpers for Postgres' LISTEN/NOTIFY pub/sub

@@ -275,3 +275,3 @@ "use strict";

exports.makeWithPgClientViaPgClientAlreadyInTransaction = makeWithPgClientViaPgClientAlreadyInTransaction;
function createWithPgClient(options, variant) {
function createWithPgClient(options = Object.create(null), variant) {
if (variant === "SUPERUSER") {

@@ -310,2 +310,4 @@ if (options.superuserPool) {

exports.createWithPgClient = createWithPgClient;
// This is here as a TypeScript assertion, to ensure we conform to PgAdaptor
const _testValidAdaptor = createWithPgClient;
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));

@@ -578,6 +580,8 @@ /**

const Pool = pg.Pool ?? pg.default?.Pool;
const pool = options.pool ??
new Pool({
connectionString,
});
const releasers = [];
let pool = options.pool;
if (!pool) {
pool = new Pool({ connectionString });
releasers.push(() => pool.end());
}
if (!options.pool) {

@@ -594,3 +598,7 @@ // If you pass your own pool, you're responsible for doing this yourself

}
const pgSubscriber = options.pgSubscriber ?? (pubsub ? new PgSubscriber(pool) : null);
let pgSubscriber = options.pgSubscriber ?? null;
if (!pgSubscriber && pubsub) {
pgSubscriber = new PgSubscriber(pool);
releasers.push(() => pgSubscriber.release?.());
}
const service = {

@@ -610,2 +618,8 @@ name,

},
async release() {
// Release in reverse order
for (const releaser of [...releasers].reverse()) {
await releaser();
}
},
};

@@ -612,0 +626,0 @@ return service;

@@ -130,3 +130,3 @@ /// <reference types="node" />

*/
export declare function listOfCodec<TInnerCodec extends PgCodec<string, any, any, any, undefined, any, any>>(listedCodec: TInnerCodec, config?: {
export declare function listOfCodec<TInnerCodec extends PgCodec<string, any, any, any, undefined, any, any>, TName extends string = `${TInnerCodec extends PgCodec<infer UName, any, any, any, any, any, any> ? UName : never}[]`>(listedCodec: TInnerCodec, config?: {
description?: string;

@@ -136,3 +136,4 @@ extensions?: Partial<PgCodecExtensions>;

identifier?: SQL;
}): PgCodec<`${TInnerCodec extends PgCodec<infer UName, any, any, any, any, any, any> ? UName : never}[]`, undefined, // Array has no attributes
name?: TName;
}): PgCodec<TName, undefined, // Array has no attributes
string, TInnerCodec extends PgCodec<any, any, any, infer UFromJs, undefined, any, any> ? UFromJs[] : any[], TInnerCodec, undefined, undefined>;

@@ -139,0 +140,0 @@ /**

@@ -301,5 +301,5 @@ "use strict";

}
const { description, extensions, identifier = (0, pg_sql2_1.default) `${listedCodec.sqlType}[]`, typeDelim = `,`, } = config ?? {};
const { description, extensions, identifier = (0, pg_sql2_1.default) `${listedCodec.sqlType}[]`, typeDelim = `,`, name = `${innerCodec.name}[]`, } = config ?? {};
const listCodec = {
name: `${innerCodec.name}[]`,
name,
sqlType: identifier,

@@ -306,0 +306,0 @@ fromPg: (value) => (0, postgres_array_1.parse)(value)

@@ -0,1 +1,3 @@

import type { GrafastSubscriber } from "grafast";
import type { PgAdaptorOptions } from "./adaptors/pg.js";
import { domainOfCodec, enumCodec, getCodecByPgCatalogTypeName, getInnerCodec, isEnumCodec, listOfCodec, ObjectFromPgCodecAttributes, PgCodecAttribute, PgCodecAttributeExtensions, PgCodecAttributes, PgCodecAttributeVia, PgCodecAttributeViaExplicit, PgEnumCodecSpec, PgRecordTypeCodecSpec, rangeOfCodec, recordCodec, TYPES } from "./codecs.js";

@@ -11,2 +13,5 @@ import { PgBox, PgCircle, PgHStore, PgInterval, PgLine, PgLseg, PgPath, PgPoint, PgPolygon } from "./codecUtils/index.js";

import { PgLockableParameter, PgLockCallback } from "./pgLocker.js";
import type { PgAdaptor } from "./pgServices.js";
import { getWithPgClientFromPgService, withPgClientFromPgService, withSuperuserPgClientFromPgService } from "./pgServices.js";
import { PgContextPlugin } from "./plugins/PgContextPlugin.js";
import { pgClassExpression, PgClassExpressionStep } from "./steps/pgClassExpression.js";

@@ -29,3 +34,3 @@ import { PgConditionCapableParentStep, PgConditionStep, PgConditionStepExtensions, PgHavingConditionSpec, PgWhereConditionSpec, pgWhereConditionSpecListToSQL } from "./steps/pgCondition.js";

import { assertPgClassSingleStep } from "./utils.js";
export { assertPgClassSingleStep, digestsFromArgumentSpecs, domainOfCodec, enumCodec, getCodecByPgCatalogTypeName, getInnerCodec, GetPgCodecAttributes, GetPgRegistryCodecRelations, GetPgRegistryCodecs, GetPgRegistrySources, GetPgResourceAttributes, GetPgResourceCodec, GetPgResourceRegistry, GetPgResourceRelations, GetPgResourceUniques, isEnumCodec, KeysOfType, listOfCodec, makePgResourceOptions, MakePgServiceOptions, makeRegistry, makeRegistryBuilder, ObjectFromPgCodecAttributes, PgBooleanFilterStep, PgBox, PgCircle, pgClassExpression, PgClassExpressionStep, PgClassFilterStep, PgClassSingleStep, PgClient, PgClientQuery, PgClientResult, PgCodec, PgCodecAnyScalar, PgCodecAttribute, PgCodecAttributeExtensions, PgCodecAttributes, PgCodecAttributeVia, PgCodecAttributeViaExplicit, PgCodecExtensions, PgCodecList, PgCodecPolymorphism, PgCodecPolymorphismRelational, PgCodecPolymorphismRelationalTypeSpec, PgCodecPolymorphismSingle, PgCodecPolymorphismSingleTypeAttributeSpec, PgCodecPolymorphismSingleTypeSpec, PgCodecPolymorphismUnion, PgCodecRef, PgCodecRefExtensions, PgCodecRefPath, PgCodecRefPathEntry, PgCodecRefs, PgCodecRelation, PgCodecRelationConfig, PgCodecRelationExtensions, PgCodecWithAttributes, PgConditionCapableParentStep, PgConditionLikeStep, PgConditionStep, PgConditionStepExtensions, PgCursorStep, PgDecode, pgDeleteSingle, PgDeleteSingleStep, PgEncode, PgEnumCodec, PgEnumCodecSpec, PgEnumValue, PgExecutor, PgExecutorContext, PgExecutorContextPlans, PgExecutorInput, PgExecutorMutationOptions, PgExecutorOptions, PgFunctionResourceOptions, PgGroupSpec, PgHavingConditionSpec, PgHStore, pgInsertSingle, PgInsertSingleStep, PgInterval, PgLine, PgLockableParameter, PgLockCallback, PgLseg, PgManyFilterStep, PgOrderSpec, PgOrFilterStep, pgPageInfo, PgPageInfoStep, PgPath, PgPoint, PgPolygon, pgPolymorphic, PgPolymorphicStep, PgPolymorphicTypeMap, PgRecordTypeCodecSpec, PgRefDefinition, PgRefDefinitionExtensions, PgRefDefinitions, PgRegistry, PgRegistryBuilder, PgResource, PgResourceExtensions, PgResourceOptions, PgResourceParameter, PgResourceUnique, PgResourceUniqueExtensions, pgSelect, PgSelectArgumentDigest, PgSelectArgumentSpec, pgSelectFromRecord, pgSelectFromRecords, PgSelectIdentifierSpec, PgSelectMode, PgSelectOptions, PgSelectParsedCursorStep, pgSelectSingleFromRecord, PgSelectSinglePlanOptions, PgSelectSingleStep, PgSelectStep, pgSingleTablePolymorphic, PgSingleTablePolymorphicStep, PgTempTableStep, PgTypedExecutableStep, pgUnionAll, PgUnionAllSingleStep, PgUnionAllStep, PgUnionAllStepCondition, PgUnionAllStepConfig, PgUnionAllStepConfigAttributes, PgUnionAllStepMember, PgUnionAllStepOrder, pgUpdateSingle, PgUpdateSingleStep, pgValidateParsedCursor, PgValidateParsedCursorStep, PgWhereConditionSpec, pgWhereConditionSpecListToSQL, PlanByUniques, rangeOfCodec, recordCodec, sqlFromArgDigests, toPg, ToPgStep, TuplePlanMap, TYPES, WithPgClient, withPgClient, WithPgClientStep, WithPgClientStepCallback, withPgClientTransaction, };
export { assertPgClassSingleStep, digestsFromArgumentSpecs, domainOfCodec, enumCodec, getCodecByPgCatalogTypeName, getInnerCodec, GetPgCodecAttributes, GetPgRegistryCodecRelations, GetPgRegistryCodecs, GetPgRegistrySources, GetPgResourceAttributes, GetPgResourceCodec, GetPgResourceRegistry, GetPgResourceRelations, GetPgResourceUniques, getWithPgClientFromPgService, isEnumCodec, KeysOfType, listOfCodec, makePgResourceOptions, MakePgServiceOptions, makeRegistry, makeRegistryBuilder, ObjectFromPgCodecAttributes, PgAdaptor, PgBooleanFilterStep, PgBox, PgCircle, pgClassExpression, PgClassExpressionStep, PgClassFilterStep, PgClassSingleStep, PgClient, PgClientQuery, PgClientResult, PgCodec, PgCodecAnyScalar, PgCodecAttribute, PgCodecAttributeExtensions, PgCodecAttributes, PgCodecAttributeVia, PgCodecAttributeViaExplicit, PgCodecExtensions, PgCodecList, PgCodecPolymorphism, PgCodecPolymorphismRelational, PgCodecPolymorphismRelationalTypeSpec, PgCodecPolymorphismSingle, PgCodecPolymorphismSingleTypeAttributeSpec, PgCodecPolymorphismSingleTypeSpec, PgCodecPolymorphismUnion, PgCodecRef, PgCodecRefExtensions, PgCodecRefPath, PgCodecRefPathEntry, PgCodecRefs, PgCodecRelation, PgCodecRelationConfig, PgCodecRelationExtensions, PgCodecWithAttributes, PgConditionCapableParentStep, PgConditionLikeStep, PgConditionStep, PgConditionStepExtensions, PgContextPlugin, PgCursorStep, PgDecode, pgDeleteSingle, PgDeleteSingleStep, PgEncode, PgEnumCodec, PgEnumCodecSpec, PgEnumValue, PgExecutor, PgExecutorContext, PgExecutorContextPlans, PgExecutorInput, PgExecutorMutationOptions, PgExecutorOptions, PgFunctionResourceOptions, PgGroupSpec, PgHavingConditionSpec, PgHStore, pgInsertSingle, PgInsertSingleStep, PgInterval, PgLine, PgLockableParameter, PgLockCallback, PgLseg, PgManyFilterStep, PgOrderSpec, PgOrFilterStep, pgPageInfo, PgPageInfoStep, PgPath, PgPoint, PgPolygon, pgPolymorphic, PgPolymorphicStep, PgPolymorphicTypeMap, PgRecordTypeCodecSpec, PgRefDefinition, PgRefDefinitionExtensions, PgRefDefinitions, PgRegistry, PgRegistryBuilder, PgResource, PgResourceExtensions, PgResourceOptions, PgResourceParameter, PgResourceUnique, PgResourceUniqueExtensions, pgSelect, PgSelectArgumentDigest, PgSelectArgumentSpec, pgSelectFromRecord, pgSelectFromRecords, PgSelectIdentifierSpec, PgSelectMode, PgSelectOptions, PgSelectParsedCursorStep, pgSelectSingleFromRecord, PgSelectSinglePlanOptions, PgSelectSingleStep, PgSelectStep, pgSingleTablePolymorphic, PgSingleTablePolymorphicStep, PgTempTableStep, PgTypedExecutableStep, pgUnionAll, PgUnionAllSingleStep, PgUnionAllStep, PgUnionAllStepCondition, PgUnionAllStepConfig, PgUnionAllStepConfigAttributes, PgUnionAllStepMember, PgUnionAllStepOrder, pgUpdateSingle, PgUpdateSingleStep, pgValidateParsedCursor, PgValidateParsedCursorStep, PgWhereConditionSpec, pgWhereConditionSpecListToSQL, PlanByUniques, rangeOfCodec, recordCodec, sqlFromArgDigests, toPg, ToPgStep, TuplePlanMap, TYPES, WithPgClient, withPgClient, withPgClientFromPgService, WithPgClientStep, WithPgClientStepCallback, withPgClientTransaction, withSuperuserPgClientFromPgService, };
export {

@@ -43,2 +48,79 @@ /** @deprecated Use Pg prefix */

export { version } from "./version.js";
declare global {
namespace GraphileConfig {
interface PgServiceConfiguration<TAdaptor extends keyof GraphileConfig.PgDatabaseAdaptorOptions = keyof GraphileConfig.PgDatabaseAdaptorOptions> {
name: string;
schemas?: string[];
adaptor: TAdaptor;
adaptorSettings?: GraphileConfig.PgDatabaseAdaptorOptions[TAdaptor];
/** The key on 'context' where the withPgClient function will be sourced */
withPgClientKey: KeysOfType<Grafast.Context & object, WithPgClient>;
/** Return settings to set in the session */
pgSettings?: (requestContext: Grafast.RequestContext) => {
[key: string]: string;
} | null;
/** Settings to set in the session that performs introspection (during gather phase) */
pgSettingsForIntrospection?: {
[key: string]: string;
} | null;
/** The key on 'context' where the pgSettings for this DB will be sourced */
pgSettingsKey?: KeysOfType<Grafast.Context & object, {
[key: string]: string;
} | null | undefined>;
/** The GrafastSubscriber to use for subscriptions */
pgSubscriber?: GrafastSubscriber<Record<string, string>> | null;
/** Where on the context should the PgSubscriber be stored? */
pgSubscriberKey?: KeysOfType<Grafast.Context & object, GrafastSubscriber<any> | null | undefined>;
/**
* Call this when you no longer need this service configuration any more;
* releases any created resources (e.g. connection pools).
*/
release?: () => void | PromiseLike<void>;
}
interface Preset {
pgServices?: ReadonlyArray<PgServiceConfiguration>;
}
interface PgDatabaseAdaptorOptions {
"@dataplan/pg/adaptors/pg": PgAdaptorOptions;
}
}
namespace DataplanPg {
interface PgConditionStepExtensions {
}
/**
* Custom metadata for a codec
*/
interface PgCodecExtensions {
oid?: string;
pg?: {
serviceName: string;
schemaName: string;
name: string;
};
listItemNonNull?: boolean;
isEnumTableEnum?: boolean;
}
/**
* Extra metadata you can attach to a unique constraint.
*/
interface PgResourceUniqueExtensions {
}
/**
* Space for extra metadata about this resource
*/
interface PgResourceExtensions {
}
interface PgResourceParameterExtensions {
variant?: string;
}
interface PgCodecRefExtensions {
}
interface PgCodecAttributeExtensions {
}
interface PgRefDefinitionExtensions {
}
interface PgCodecRelationExtensions {
}
}
}
//# sourceMappingURL=index.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.toPg = exports.sqlFromArgDigests = exports.recordCodec = exports.rangeOfCodec = exports.pgWhereConditionSpecListToSQL = exports.PgValidateParsedCursorStep = exports.pgValidateParsedCursor = exports.PgUpdateSingleStep = exports.pgUpdateSingle = exports.PgUnionAllStep = exports.PgUnionAllSingleStep = exports.pgUnionAll = exports.PgTempTableStep = exports.PgSingleTablePolymorphicStep = exports.pgSingleTablePolymorphic = exports.PgSelectStep = exports.PgSelectSingleStep = exports.pgSelectSingleFromRecord = exports.pgSelectFromRecords = exports.pgSelectFromRecord = exports.pgSelect = exports.PgResource = exports.PgPolymorphicStep = exports.pgPolymorphic = exports.PgPageInfoStep = exports.pgPageInfo = exports.PgOrFilterStep = exports.PgManyFilterStep = exports.PgInsertSingleStep = exports.pgInsertSingle = exports.PgExecutor = exports.PgDeleteSingleStep = exports.pgDeleteSingle = exports.PgCursorStep = exports.PgConditionStep = exports.PgClassFilterStep = exports.PgClassExpressionStep = exports.pgClassExpression = exports.PgBooleanFilterStep = exports.makeRegistryBuilder = exports.makeRegistry = exports.makePgResourceOptions = exports.listOfCodec = exports.isEnumCodec = exports.getInnerCodec = exports.getCodecByPgCatalogTypeName = exports.enumCodec = exports.domainOfCodec = exports.digestsFromArgumentSpecs = exports.assertPgClassSingleStep = void 0;
exports.version = exports.TempTableStep = exports.OrFilterStep = exports.ManyFilterStep = exports.ClassFilterStep = exports.BooleanFilterStep = exports.withPgClientTransaction = exports.WithPgClientStep = exports.withPgClient = exports.TYPES = exports.ToPgStep = void 0;
exports.recordCodec = exports.rangeOfCodec = exports.pgWhereConditionSpecListToSQL = exports.PgValidateParsedCursorStep = exports.pgValidateParsedCursor = exports.PgUpdateSingleStep = exports.pgUpdateSingle = exports.PgUnionAllStep = exports.PgUnionAllSingleStep = exports.pgUnionAll = exports.PgTempTableStep = exports.PgSingleTablePolymorphicStep = exports.pgSingleTablePolymorphic = exports.PgSelectStep = exports.PgSelectSingleStep = exports.pgSelectSingleFromRecord = exports.pgSelectFromRecords = exports.pgSelectFromRecord = exports.pgSelect = exports.PgResource = exports.PgPolymorphicStep = exports.pgPolymorphic = exports.PgPageInfoStep = exports.pgPageInfo = exports.PgOrFilterStep = exports.PgManyFilterStep = exports.PgInsertSingleStep = exports.pgInsertSingle = exports.PgExecutor = exports.PgDeleteSingleStep = exports.pgDeleteSingle = exports.PgCursorStep = exports.PgContextPlugin = exports.PgConditionStep = exports.PgClassFilterStep = exports.PgClassExpressionStep = exports.pgClassExpression = exports.PgBooleanFilterStep = exports.makeRegistryBuilder = exports.makeRegistry = exports.makePgResourceOptions = exports.listOfCodec = exports.isEnumCodec = exports.getWithPgClientFromPgService = exports.getInnerCodec = exports.getCodecByPgCatalogTypeName = exports.enumCodec = exports.domainOfCodec = exports.digestsFromArgumentSpecs = exports.assertPgClassSingleStep = void 0;
exports.version = exports.TempTableStep = exports.OrFilterStep = exports.ManyFilterStep = exports.ClassFilterStep = exports.BooleanFilterStep = exports.withSuperuserPgClientFromPgService = exports.withPgClientTransaction = exports.WithPgClientStep = exports.withPgClientFromPgService = exports.withPgClient = exports.TYPES = exports.ToPgStep = exports.toPg = exports.sqlFromArgDigests = void 0;
const grafast_1 = require("grafast");

@@ -35,2 +35,8 @@ const codecs_js_1 = require("./codecs.js");

Object.defineProperty(exports, "OrFilterStep", { enumerable: true, get: function () { return pgOrFilter_js_1.PgOrFilterStep; } });
const pgServices_js_1 = require("./pgServices.js");
Object.defineProperty(exports, "getWithPgClientFromPgService", { enumerable: true, get: function () { return pgServices_js_1.getWithPgClientFromPgService; } });
Object.defineProperty(exports, "withPgClientFromPgService", { enumerable: true, get: function () { return pgServices_js_1.withPgClientFromPgService; } });
Object.defineProperty(exports, "withSuperuserPgClientFromPgService", { enumerable: true, get: function () { return pgServices_js_1.withSuperuserPgClientFromPgService; } });
const PgContextPlugin_js_1 = require("./plugins/PgContextPlugin.js");
Object.defineProperty(exports, "PgContextPlugin", { enumerable: true, get: function () { return PgContextPlugin_js_1.PgContextPlugin; } });
const pgClassExpression_js_1 = require("./steps/pgClassExpression.js");

@@ -147,2 +153,6 @@ Object.defineProperty(exports, "pgClassExpression", { enumerable: true, get: function () { return pgClassExpression_js_1.pgClassExpression; } });

WithPgClientStep: withPgClient_js_1.WithPgClientStep,
getWithPgClientFromPgService: pgServices_js_1.getWithPgClientFromPgService,
withPgClientFromPgService: pgServices_js_1.withPgClientFromPgService,
withSuperuserPgClientFromPgService: pgServices_js_1.withSuperuserPgClientFromPgService,
PgContextPlugin: PgContextPlugin_js_1.PgContextPlugin,
});

@@ -149,0 +159,0 @@ var version_js_1 = require("./version.js");

@@ -1,7 +0,6 @@

import type { ExecutableStep, GrafastSubscriber, ModifierStep } from "grafast";
import type { ExecutableStep, ModifierStep } from "grafast";
import type { SQL, SQLRawValue } from "pg-sql2";
import type { PgAdaptorOptions } from "./adaptors/pg.js";
import type { PgCodecAttributes } from "./codecs.js";
import type { PgCodecRefs, PgResource, PgResourceOptions, PgResourceParameter, PgResourceUnique } from "./datasource.js";
import type { PgExecutor, WithPgClient } from "./executor.js";
import type { PgExecutor } from "./executor.js";
import type { PgDeleteSingleStep } from "./steps/pgDeleteSingle.js";

@@ -29,2 +28,3 @@ import type { PgInsertSingleStep } from "./steps/pgInsertSingle.js";

graphqlType?: string;
sourceGraphqlType?: string;
singular?: boolean;

@@ -271,74 +271,2 @@ description?: string;

}[keyof TObject];
declare global {
namespace GraphileConfig {
interface PgServiceConfiguration<TAdaptor extends keyof GraphileConfig.PgDatabaseAdaptorOptions = keyof GraphileConfig.PgDatabaseAdaptorOptions> {
name: string;
schemas?: string[];
adaptor: TAdaptor;
adaptorSettings?: GraphileConfig.PgDatabaseAdaptorOptions[TAdaptor];
/** The key on 'context' where the withPgClient function will be sourced */
withPgClientKey: KeysOfType<Grafast.Context & object, WithPgClient>;
/** Return settings to set in the session */
pgSettings?: (requestContext: Grafast.RequestContext) => {
[key: string]: string;
} | null;
/** Settings to set in the session that performs introspection (during gather phase) */
pgSettingsForIntrospection?: {
[key: string]: string;
} | null;
/** The key on 'context' where the pgSettings for this DB will be sourced */
pgSettingsKey?: KeysOfType<Grafast.Context & object, {
[key: string]: string;
} | null | undefined>;
/** The GrafastSubscriber to use for subscriptions */
pgSubscriber?: GrafastSubscriber<Record<string, string>> | null;
/** Where on the context should the PgSubscriber be stored? */
pgSubscriberKey?: KeysOfType<Grafast.Context & object, GrafastSubscriber<any> | null | undefined>;
}
interface Preset {
pgServices?: ReadonlyArray<PgServiceConfiguration>;
}
interface PgDatabaseAdaptorOptions {
"@dataplan/pg/adaptors/pg": PgAdaptorOptions;
}
}
namespace DataplanPg {
interface PgConditionStepExtensions {
}
/**
* Custom metadata for a codec
*/
interface PgCodecExtensions {
oid?: string;
pg?: {
serviceName: string;
schemaName: string;
name: string;
};
listItemNonNull?: boolean;
isEnumTableEnum?: boolean;
}
/**
* Extra metadata you can attach to a unique constraint.
*/
interface PgResourceUniqueExtensions {
}
/**
* Space for extra metadata about this resource
*/
interface PgResourceExtensions {
}
interface PgResourceParameterExtensions {
variant?: string;
}
interface PgCodecRefExtensions {
}
interface PgCodecAttributeExtensions {
}
interface PgRefDefinitionExtensions {
}
interface PgCodecRelationExtensions {
}
}
}
export interface MakePgServiceOptions extends Partial<Pick<GraphileConfig.PgServiceConfiguration, "name" | "pgSettings" | "pgSettingsForIntrospection" | "withPgClientKey" | "pgSettingsKey" | "pgSubscriber" | "pgSubscriberKey">> {

@@ -345,0 +273,0 @@ connectionString?: string;

@@ -162,2 +162,3 @@ import type { __InputStaticLeafStep, ConnectionCapableStep, ConnectionStep, EdgeCapableStep, ExecutionExtra, GrafastResultsList, GrafastValuesList, InputStep, PolymorphicStep } from "grafast";

private memberDigests;
private _limitToTypes;
constructor(cloneFrom: PgUnionAllStep<TAttributes, TTypeNames>, mode?: PgUnionAllMode);

@@ -221,2 +222,4 @@ constructor(spec: PgUnionAllStepConfig<TAttributes, TTypeNames>);

getOrderByWithoutType(): ReadonlyArray<PgOrderFragmentSpec>;
/** @experimental */
limitToTypes(types: readonly string[]): void;
optimize(): this | import("grafast").ConstantStep<never[]>;

@@ -223,0 +226,0 @@ finalize(): void;

@@ -221,2 +221,5 @@ "use strict";

this.memberDigests = cloneDigests(cloneFrom.memberDigests);
this._limitToTypes = cloneFrom._limitToTypes
? [...cloneFrom._limitToTypes]
: undefined;
cloneFrom.dependencies.forEach((planId, idx) => {

@@ -948,3 +951,15 @@ const myIdx = this.addDependency(cloneFrom.getDep(idx), true);

}
/** @experimental */
limitToTypes(types) {
if (!this._limitToTypes) {
this._limitToTypes = [...types];
}
else {
this._limitToTypes = this._limitToTypes.filter((t) => types.includes(t));
}
}
optimize() {
if (this._limitToTypes) {
this.memberDigests = this.memberDigests.filter((d) => this._limitToTypes.includes(d.member.typeName));
}
if (this.memberDigests.length === 0) {

@@ -951,0 +966,0 @@ // We have no implementations, we'll never return anything

@@ -1,2 +0,2 @@

export declare const version = "0.0.1-beta.12";
export declare const version = "0.0.1-beta.13";
//# sourceMappingURL=version.d.ts.map

@@ -5,3 +5,3 @@ "use strict";

// This file is autogenerated by /scripts/postversion.mjs
exports.version = "0.0.1-beta.12";
exports.version = "0.0.1-beta.13";
//# sourceMappingURL=version.js.map
{
"name": "@dataplan/pg",
"version": "0.0.1-beta.12",
"version": "0.0.1-beta.13",
"description": "PostgreSQL step classes for Grafast",

@@ -67,5 +67,5 @@ "type": "commonjs",

"peerDependencies": {
"@dataplan/json": "^0.0.1-beta.10",
"grafast": "^0.1.1-beta.1",
"graphile-config": "^0.0.1-beta.4",
"@dataplan/json": "^0.0.1-beta.11",
"grafast": "^0.1.1-beta.2",
"graphile-config": "^0.0.1-beta.5",
"pg": "^8.7.1",

@@ -93,4 +93,4 @@ "pg-sql2": "^5.0.0-beta.4"

"glob": "^10.3.4",
"grafserv": "0.1.1-beta.3",
"graphile-export": "0.0.2-beta.6",
"grafserv": "0.1.1-beta.4",
"graphile-export": "0.0.2-beta.7",
"graphql": "16.1.0-experimental-stream-defer.6",

@@ -97,0 +97,0 @@ "iterall": "^1.3.0",

@@ -29,5 +29,4 @@ # @dataplan/pg

<td align="center"><a href="https://www.netflix.com/"><img src="https://graphile.org/images/sponsors/Netflix.png" width="90" height="90" alt="Netflix" /><br />Netflix</a> *</td>
<td align="center"><a href=""><img src="https://graphile.org/images/sponsors/chadf.png" width="90" height="90" alt="Chad Furman" /><br />Chad Furman</a> *</td>
<td align="center"><a href="https://stellate.co/"><img src="https://graphile.org/images/sponsors/Stellate.png" width="90" height="90" alt="Stellate" /><br />Stellate</a> *</td>
</tr><tr>
<td align="center"><a href="https://stellate.co/"><img src="https://graphile.org/images/sponsors/Stellate.png" width="90" height="90" alt="Stellate" /><br />Stellate</a> *</td>
<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>

@@ -34,0 +33,0 @@ <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>

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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc