diff --git a/__fixtures__/output/schemas/actions_public.ts b/__fixtures__/output/schemas/actions_public.ts index 4f96634c6..2ed706091 100644 --- a/__fixtures__/output/schemas/actions_public.ts +++ b/__fixtures__/output/schemas/actions_public.ts @@ -1,4 +1,4 @@ -import { UUID, Timestamp } from "./_common"; +import { Timestamp,UUID } from "./_common"; export interface ast_actions { id: number; database_id: UUID; diff --git a/__fixtures__/output/schemas/collections_public.ts b/__fixtures__/output/schemas/collections_public.ts index 9d18118e2..bbfa44718 100644 --- a/__fixtures__/output/schemas/collections_public.ts +++ b/__fixtures__/output/schemas/collections_public.ts @@ -1,4 +1,4 @@ -import { UUID, Timestamp } from "./_common"; +import { Timestamp,UUID } from "./_common"; export interface check_constraint { id: UUID; database_id: UUID; diff --git a/__fixtures__/output/schemas/db_migrate.ts b/__fixtures__/output/schemas/db_migrate.ts index 4dbc778e1..967e3d0c6 100644 --- a/__fixtures__/output/schemas/db_migrate.ts +++ b/__fixtures__/output/schemas/db_migrate.ts @@ -1,4 +1,4 @@ -import { UUID, Timestamp } from "./_common"; +import { Timestamp,UUID } from "./_common"; export interface migrate_files { id: UUID; database_id: UUID | null; diff --git a/__fixtures__/output/schemas/objects_private.ts b/__fixtures__/output/schemas/objects_private.ts index 139cfb315..fba8b2b4c 100644 --- a/__fixtures__/output/schemas/objects_private.ts +++ b/__fixtures__/output/schemas/objects_private.ts @@ -1,4 +1,4 @@ -import { UUID, Timestamp } from "./_common"; +import { Timestamp,UUID } from "./_common"; export interface object { id: UUID; database_id: UUID; diff --git a/__fixtures__/output/schemas/txs_public.ts b/__fixtures__/output/schemas/txs_public.ts index 4f7ae4910..8db70fba9 100644 --- a/__fixtures__/output/schemas/txs_public.ts +++ b/__fixtures__/output/schemas/txs_public.ts @@ -1,4 +1,4 @@ -import { UUID, Timestamp } from "./_common"; +import { Timestamp,UUID } from "./_common"; export interface commit { id: UUID; message: string | null; diff --git a/__fixtures__/stage/extensions/@pgpm/base32/__tests__/base32.decode.test.ts b/__fixtures__/stage/extensions/@pgpm/base32/__tests__/base32.decode.test.ts index 13d30b244..72a61539e 100644 --- a/__fixtures__/stage/extensions/@pgpm/base32/__tests__/base32.decode.test.ts +++ b/__fixtures__/stage/extensions/@pgpm/base32/__tests__/base32.decode.test.ts @@ -1,5 +1,5 @@ -import { getConnections, PgTestClient } from 'pgsql-test'; import cases from 'jest-in-case'; +import { getConnections, PgTestClient } from 'pgsql-test'; let pg: PgTestClient; let teardown: () => Promise; diff --git a/__fixtures__/stage/extensions/@pgpm/base32/__tests__/base32.encode.test.ts b/__fixtures__/stage/extensions/@pgpm/base32/__tests__/base32.encode.test.ts index c807f5356..f474d3b82 100644 --- a/__fixtures__/stage/extensions/@pgpm/base32/__tests__/base32.encode.test.ts +++ b/__fixtures__/stage/extensions/@pgpm/base32/__tests__/base32.encode.test.ts @@ -1,5 +1,5 @@ -import { getConnections, PgTestClient } from 'pgsql-test'; import cases from 'jest-in-case'; +import { getConnections, PgTestClient } from 'pgsql-test'; let pg: PgTestClient; let teardown: () => Promise; diff --git a/__fixtures__/stage/extensions/@pgpm/totp/__tests__/algo.test.ts b/__fixtures__/stage/extensions/@pgpm/totp/__tests__/algo.test.ts index 44e3a97c9..d480c3d07 100644 --- a/__fixtures__/stage/extensions/@pgpm/totp/__tests__/algo.test.ts +++ b/__fixtures__/stage/extensions/@pgpm/totp/__tests__/algo.test.ts @@ -1,5 +1,5 @@ -import { getConnections, PgTestClient } from 'pgsql-test'; import cases from 'jest-in-case'; +import { getConnections, PgTestClient } from 'pgsql-test'; let pg: PgTestClient; let teardown: () => Promise; diff --git a/functions/send-email-link/src/index.ts b/functions/send-email-link/src/index.ts index 47c35c1ec..c7613ca7b 100644 --- a/functions/send-email-link/src/index.ts +++ b/functions/send-email-link/src/index.ts @@ -1,9 +1,9 @@ import app from '@constructive-io/knative-job-fn'; -import { GraphQLClient } from 'graphql-request'; -import gql from 'graphql-tag'; import { generate } from '@launchql/mjml'; import { send } from '@launchql/postmaster'; import { parseEnvBoolean } from '@pgpmjs/env'; +import { GraphQLClient } from 'graphql-request'; +import gql from 'graphql-tag'; const isDryRun = parseEnvBoolean(process.env.SEND_EMAIL_LINK_DRY_RUN) ?? false; @@ -269,7 +269,7 @@ export const sendEmailLink = async ( }); if (isDryRun) { - // eslint-disable-next-line no-console + console.log('[send-email-link] DRY RUN email (skipping send)', { email_type: params.email_type, email: params.email, @@ -326,7 +326,7 @@ if (require.main === module) { const port = Number(process.env.PORT ?? 8080); // @constructive-io/knative-job-fn exposes a .listen method that delegates to the Express app (app as any).listen(port, () => { - // eslint-disable-next-line no-console + console.log(`[send-email-link] listening on port ${port}`); }); } diff --git a/functions/simple-email/src/index.ts b/functions/simple-email/src/index.ts index fdafb116f..a73a1df1b 100644 --- a/functions/simple-email/src/index.ts +++ b/functions/simple-email/src/index.ts @@ -1,6 +1,6 @@ import app from '@constructive-io/knative-job-fn'; -import { parseEnvBoolean } from '@pgpmjs/env'; import { send as sendEmail } from '@launchql/postmaster'; +import { parseEnvBoolean } from '@pgpmjs/env'; type SimpleEmailPayload = { to: string; @@ -62,7 +62,7 @@ app.post('*', async (req: any, res: any, next: any) => { }; if (isDryRun) { - // eslint-disable-next-line no-console + console.log('[simple-email] DRY RUN email (no send)', logContext); } else { // Send via the Postmaster package (Mailgun or configured provider) @@ -75,7 +75,7 @@ app.post('*', async (req: any, res: any, next: any) => { ...(replyTo && { replyTo }) }); - // eslint-disable-next-line no-console + console.log('[simple-email] Sent email', logContext); } @@ -93,7 +93,7 @@ if (require.main === module) { const port = Number(process.env.PORT ?? 8080); // @constructive-io/knative-job-fn exposes a .listen method that delegates to the underlying Express app (app as any).listen(port, () => { - // eslint-disable-next-line no-console + console.log(`[simple-email] listening on port ${port}`); }); } diff --git a/graphile/graphile-i18n/__tests__/plugin.test.ts b/graphile/graphile-i18n/__tests__/plugin.test.ts index 89d756105..0b6be5b83 100644 --- a/graphile/graphile-i18n/__tests__/plugin.test.ts +++ b/graphile/graphile-i18n/__tests__/plugin.test.ts @@ -1,11 +1,13 @@ import '../test-utils/env'; -import { join } from 'path'; + +import type { GraphQLQueryFn } from 'graphile-test'; import { getConnections, snapshot } from 'graphile-test'; +import { join } from 'path'; import { seed } from 'pgsql-test'; import type { PgTestClient } from 'pgsql-test/test-client'; -import type { GraphQLQueryFn } from 'graphile-test'; -import { GetProjectsAndLanguages } from '../test-utils/queries'; + import LangPlugin, { additionalGraphQLContextFromRequest } from '../src'; +import { GetProjectsAndLanguages } from '../test-utils/queries'; const SCHEMA = process.env.SCHEMA ?? 'app_public'; const sql = (f: string) => join(__dirname, '../sql', f); diff --git a/graphile/graphile-i18n/src/index.ts b/graphile/graphile-i18n/src/index.ts index 3f7d2f2a9..5df713509 100644 --- a/graphile/graphile-i18n/src/index.ts +++ b/graphile/graphile-i18n/src/index.ts @@ -1,13 +1,12 @@ import LangPlugin from './plugin'; -export { LangPlugin, type LangPluginOptions } from './plugin'; +export { env } from './env'; export { additionalGraphQLContextFromRequest, - makeLanguageDataLoaderForTable, type I18nGraphQLContext, type I18nRequestLike, - type LanguageDataLoaderFactory -} from './middleware'; -export { env } from './env'; + type LanguageDataLoaderFactory, + makeLanguageDataLoaderForTable} from './middleware'; +export { LangPlugin, type LangPluginOptions } from './plugin'; export default LangPlugin; diff --git a/graphile/graphile-i18n/src/middleware.ts b/graphile/graphile-i18n/src/middleware.ts index 4039a9b51..8a73f4bbe 100644 --- a/graphile/graphile-i18n/src/middleware.ts +++ b/graphile/graphile-i18n/src/middleware.ts @@ -1,7 +1,7 @@ +import langParser from 'accept-language-parser'; import DataLoader from 'dataloader'; import type { IncomingHttpHeaders } from 'http'; import type { PoolClient } from 'pg'; -import langParser from 'accept-language-parser'; import env from './env'; diff --git a/graphile/graphile-many-to-many/__tests__/queries.test.ts b/graphile/graphile-many-to-many/__tests__/queries.test.ts index 70eeb2ed8..da1511387 100644 --- a/graphile/graphile-many-to-many/__tests__/queries.test.ts +++ b/graphile/graphile-many-to-many/__tests__/queries.test.ts @@ -1,9 +1,9 @@ import '../test-utils/env'; import { existsSync, promises as fs, readdirSync } from 'fs'; -import { join } from 'path'; -import { getConnections } from 'graphile-test'; import type { GraphQLQueryFn } from 'graphile-test'; +import { getConnections } from 'graphile-test'; +import { join } from 'path'; import { seed } from 'pgsql-test'; import type { PgTestClient } from 'pgsql-test/test-client'; @@ -104,9 +104,9 @@ describe.each(fixtureSets.map(({ schema, fixtures }) => [schema, fixtures] as co const normalizedResult = JSON.parse(JSON.stringify(result)); if (normalizedResult.errors) { // surface underlying errors in case snapshots hide details - /* eslint-disable no-console */ + console.log(normalizedResult.errors.map((error: any) => error.originalError ?? error)); - /* eslint-enable no-console */ + } expect(normalizedResult).toMatchSnapshot(); }); diff --git a/graphile/graphile-many-to-many/__tests__/schema.test.ts b/graphile/graphile-many-to-many/__tests__/schema.test.ts index d842d7d75..76050802a 100644 --- a/graphile/graphile-many-to-many/__tests__/schema.test.ts +++ b/graphile/graphile-many-to-many/__tests__/schema.test.ts @@ -1,15 +1,15 @@ import '../test-utils/env'; import { existsSync } from 'fs'; -import { join } from 'path'; -import { getIntrospectionQuery, buildClientSchema, printSchema } from 'graphql'; -import { lexicographicSortSchema } from 'graphql/utilities'; import { PgConnectionArgCondition } from 'graphile-build-pg'; -import type { PostGraphileOptions } from 'postgraphile'; -import { getConnections } from 'graphile-test'; import type { GraphQLQueryFn } from 'graphile-test'; +import { getConnections } from 'graphile-test'; +import { buildClientSchema, getIntrospectionQuery, printSchema } from 'graphql'; +import { lexicographicSortSchema } from 'graphql/utilities'; +import { join } from 'path'; import { seed } from 'pgsql-test'; import type { PgTestClient } from 'pgsql-test/test-client'; +import type { PostGraphileOptions } from 'postgraphile'; import PgManyToManyPlugin from '../src'; diff --git a/graphile/graphile-many-to-many/src/createManyToManyConnectionType.ts b/graphile/graphile-many-to-many/src/createManyToManyConnectionType.ts index 5bc808bce..f0d1c565e 100644 --- a/graphile/graphile-many-to-many/src/createManyToManyConnectionType.ts +++ b/graphile/graphile-many-to-many/src/createManyToManyConnectionType.ts @@ -2,10 +2,10 @@ import type { Build } from 'graphile-build'; import type { PgClass } from 'graphile-build-pg'; import type { GraphQLFieldConfigMap, - GraphQLObjectType, - GraphQLResolveInfo, GraphQLNamedType, GraphQLNullableType, + GraphQLObjectType, + GraphQLResolveInfo, GraphQLType } from 'graphql'; diff --git a/graphile/graphile-meta-schema/__tests__/index.test.ts b/graphile/graphile-meta-schema/__tests__/index.test.ts index b6a0ea7c4..9941a171b 100644 --- a/graphile/graphile-meta-schema/__tests__/index.test.ts +++ b/graphile/graphile-meta-schema/__tests__/index.test.ts @@ -1,9 +1,11 @@ import '../test-utils/env'; + import PgManyToMany from '@graphile-contrib/pg-many-to-many'; +import { getConnections, type GraphQLQueryFn,seed, snapshot } from 'graphile-test'; import { join } from 'path'; -import { getConnections, snapshot, seed, type GraphQLQueryFn } from 'graphile-test'; import type { PgTestClient } from 'pgsql-test/test-client'; +import { PgMetaschemaPlugin } from '../src'; import { GetBelongsToRelations, GetHasManyRelations, @@ -13,7 +15,6 @@ import { GetMetaSchema, GetMetaSchemaUnion } from '../test-utils/queries'; -import { PgMetaschemaPlugin } from '../src'; const SCHEMA = process.env.SCHEMA ?? 'app_meta'; const sql = (file: string) => join(__dirname, '../sql', file); diff --git a/graphile/graphile-pg-type-mappings/__tests__/plugin.test.ts b/graphile/graphile-pg-type-mappings/__tests__/plugin.test.ts index 064d04eac..6224b5e70 100644 --- a/graphile/graphile-pg-type-mappings/__tests__/plugin.test.ts +++ b/graphile/graphile-pg-type-mappings/__tests__/plugin.test.ts @@ -1,8 +1,9 @@ -import { join } from 'path'; import { getConnections, GraphQLQueryFn } from 'graphile-test'; +import gql from 'graphql-tag'; +import { join } from 'path'; import { seed } from 'pgsql-test'; import type { PgTestClient } from 'pgsql-test/test-client'; -import gql from 'graphql-tag'; + import CustomPgTypeMappingsPlugin from '../src'; const SCHEMA = 'public'; diff --git a/graphile/graphile-plugin-connection-filter-postgis/__tests__/integration/queries.test.ts b/graphile/graphile-plugin-connection-filter-postgis/__tests__/integration/queries.test.ts index e7d79cd3e..4d5abdde1 100644 --- a/graphile/graphile-plugin-connection-filter-postgis/__tests__/integration/queries.test.ts +++ b/graphile/graphile-plugin-connection-filter-postgis/__tests__/integration/queries.test.ts @@ -1,11 +1,11 @@ import { readdirSync } from 'fs'; import { readFile } from 'fs/promises'; -import { join } from 'path'; +import ConnectionFilterPlugin from 'graphile-plugin-connection-filter'; +import PostgisPlugin from 'graphile-postgis'; import type { GraphQLQueryFnObj } from 'graphile-test'; import { getConnectionsObject, seed, snapshot } from 'graphile-test'; +import { join } from 'path'; import type { PgTestClient } from 'pgsql-test/test-client'; -import PostgisPlugin from 'graphile-postgis'; -import ConnectionFilterPlugin from 'graphile-plugin-connection-filter'; import PostgisConnectionFilterPlugin from '../../src'; diff --git a/graphile/graphile-plugin-connection-filter-postgis/__tests__/integration/schema/defaultOptions.test.ts b/graphile/graphile-plugin-connection-filter-postgis/__tests__/integration/schema/defaultOptions.test.ts index d351b2eb2..80cc6a9e3 100644 --- a/graphile/graphile-plugin-connection-filter-postgis/__tests__/integration/schema/defaultOptions.test.ts +++ b/graphile/graphile-plugin-connection-filter-postgis/__tests__/integration/schema/defaultOptions.test.ts @@ -1,13 +1,13 @@ +import ConnectionFilterPlugin from 'graphile-plugin-connection-filter'; +import PostgisPlugin from 'graphile-postgis'; import { join } from 'path'; import { Pool } from 'pg'; +import { getConnections, seed } from 'pgsql-test'; +import type { PgTestClient } from 'pgsql-test/test-client'; import { createPostGraphileSchema, type PostGraphileOptions, } from 'postgraphile'; -import { getConnections, seed } from 'pgsql-test'; -import type { PgTestClient } from 'pgsql-test/test-client'; -import PostgisPlugin from 'graphile-postgis'; -import ConnectionFilterPlugin from 'graphile-plugin-connection-filter'; import PostgisConnectionFilterPlugin from '../../../src'; import { printSchemaOrdered } from '../../../test-utils/printSchema'; diff --git a/graphile/graphile-plugin-connection-filter/__tests__/integration/queries.test.ts b/graphile/graphile-plugin-connection-filter/__tests__/integration/queries.test.ts index 85ee9ffb7..a0a1b269a 100644 --- a/graphile/graphile-plugin-connection-filter/__tests__/integration/queries.test.ts +++ b/graphile/graphile-plugin-connection-filter/__tests__/integration/queries.test.ts @@ -2,11 +2,11 @@ import '../../test-utils/env'; import { readdirSync } from 'fs'; import { readFile } from 'fs/promises'; -import { join } from 'path'; import type { Plugin } from 'graphile-build'; import { PgConnectionArgCondition } from 'graphile-build-pg'; import type { GraphQLQueryFnObj } from 'graphile-test'; import { getConnectionsObject, seed, snapshot } from 'graphile-test'; +import { join } from 'path'; import type { PgTestClient } from 'pgsql-test/test-client'; import type { PostGraphileOptions } from 'postgraphile'; diff --git a/graphile/graphile-plugin-connection-filter/__tests__/integration/schema/addConnectionFilterOperator.test.ts b/graphile/graphile-plugin-connection-filter/__tests__/integration/schema/addConnectionFilterOperator.test.ts index 289a907ba..b4279d7d7 100644 --- a/graphile/graphile-plugin-connection-filter/__tests__/integration/schema/addConnectionFilterOperator.test.ts +++ b/graphile/graphile-plugin-connection-filter/__tests__/integration/schema/addConnectionFilterOperator.test.ts @@ -1,16 +1,17 @@ import '../../../test-utils/env'; + +import { PgConnectionArgCondition } from 'graphile-build-pg'; import { join } from 'path'; import { Pool } from 'pg'; -import { PgConnectionArgCondition } from 'graphile-build-pg'; +import { getConnections, seed } from 'pgsql-test'; +import type { PgTestClient } from 'pgsql-test/test-client'; import { createPostGraphileSchema, type PostGraphileOptions, } from 'postgraphile'; -import { getConnections, seed } from 'pgsql-test'; -import type { PgTestClient } from 'pgsql-test/test-client'; -import CustomOperatorsPlugin from '../../../test-utils/customOperatorsPlugin'; import ConnectionFilterPlugin from '../../../src/index'; +import CustomOperatorsPlugin from '../../../test-utils/customOperatorsPlugin'; import { printSchemaOrdered } from '../../../test-utils/printSchema'; const SCHEMA = process.env.SCHEMA ?? 'p'; diff --git a/graphile/graphile-plugin-connection-filter/__tests__/integration/schema/allowedFieldTypes.test.ts b/graphile/graphile-plugin-connection-filter/__tests__/integration/schema/allowedFieldTypes.test.ts index 011147945..6e28d4b9f 100644 --- a/graphile/graphile-plugin-connection-filter/__tests__/integration/schema/allowedFieldTypes.test.ts +++ b/graphile/graphile-plugin-connection-filter/__tests__/integration/schema/allowedFieldTypes.test.ts @@ -1,13 +1,14 @@ import '../../../test-utils/env'; + +import { PgConnectionArgCondition } from 'graphile-build-pg'; import { join } from 'path'; import { Pool } from 'pg'; -import { PgConnectionArgCondition } from 'graphile-build-pg'; +import { getConnections, seed } from 'pgsql-test'; +import type { PgTestClient } from 'pgsql-test/test-client'; import { createPostGraphileSchema, type PostGraphileOptions, } from 'postgraphile'; -import { getConnections, seed } from 'pgsql-test'; -import type { PgTestClient } from 'pgsql-test/test-client'; import ConnectionFilterPlugin from '../../../src/index'; import { printSchemaOrdered } from '../../../test-utils/printSchema'; diff --git a/graphile/graphile-plugin-connection-filter/__tests__/integration/schema/allowedOperators.test.ts b/graphile/graphile-plugin-connection-filter/__tests__/integration/schema/allowedOperators.test.ts index 1fdbb0d03..f08cf6601 100644 --- a/graphile/graphile-plugin-connection-filter/__tests__/integration/schema/allowedOperators.test.ts +++ b/graphile/graphile-plugin-connection-filter/__tests__/integration/schema/allowedOperators.test.ts @@ -1,13 +1,14 @@ import '../../../test-utils/env'; + +import { PgConnectionArgCondition } from 'graphile-build-pg'; import { join } from 'path'; import { Pool } from 'pg'; -import { PgConnectionArgCondition } from 'graphile-build-pg'; +import { getConnections, seed } from 'pgsql-test'; +import type { PgTestClient } from 'pgsql-test/test-client'; import { createPostGraphileSchema, type PostGraphileOptions, } from 'postgraphile'; -import { getConnections, seed } from 'pgsql-test'; -import type { PgTestClient } from 'pgsql-test/test-client'; import ConnectionFilterPlugin from '../../../src/index'; import { printSchemaOrdered } from '../../../test-utils/printSchema'; diff --git a/graphile/graphile-plugin-connection-filter/__tests__/integration/schema/arraysFalse.test.ts b/graphile/graphile-plugin-connection-filter/__tests__/integration/schema/arraysFalse.test.ts index 7754581e2..00f6c1f71 100644 --- a/graphile/graphile-plugin-connection-filter/__tests__/integration/schema/arraysFalse.test.ts +++ b/graphile/graphile-plugin-connection-filter/__tests__/integration/schema/arraysFalse.test.ts @@ -1,13 +1,14 @@ import '../../../test-utils/env'; + +import { PgConnectionArgCondition } from 'graphile-build-pg'; import { join } from 'path'; import { Pool } from 'pg'; -import { PgConnectionArgCondition } from 'graphile-build-pg'; +import { getConnections, seed } from 'pgsql-test'; +import type { PgTestClient } from 'pgsql-test/test-client'; import { createPostGraphileSchema, type PostGraphileOptions, } from 'postgraphile'; -import { getConnections, seed } from 'pgsql-test'; -import type { PgTestClient } from 'pgsql-test/test-client'; import ConnectionFilterPlugin from '../../../src/index'; import { printSchemaOrdered } from '../../../test-utils/printSchema'; diff --git a/graphile/graphile-plugin-connection-filter/__tests__/integration/schema/computedColumnsFalse.test.ts b/graphile/graphile-plugin-connection-filter/__tests__/integration/schema/computedColumnsFalse.test.ts index b13972549..a14ba42fa 100644 --- a/graphile/graphile-plugin-connection-filter/__tests__/integration/schema/computedColumnsFalse.test.ts +++ b/graphile/graphile-plugin-connection-filter/__tests__/integration/schema/computedColumnsFalse.test.ts @@ -1,13 +1,14 @@ import '../../../test-utils/env'; + +import { PgConnectionArgCondition } from 'graphile-build-pg'; import { join } from 'path'; import { Pool } from 'pg'; -import { PgConnectionArgCondition } from 'graphile-build-pg'; +import { getConnections, seed } from 'pgsql-test'; +import type { PgTestClient } from 'pgsql-test/test-client'; import { createPostGraphileSchema, type PostGraphileOptions, } from 'postgraphile'; -import { getConnections, seed } from 'pgsql-test'; -import type { PgTestClient } from 'pgsql-test/test-client'; import ConnectionFilterPlugin from '../../../src/index'; import { printSchemaOrdered } from '../../../test-utils/printSchema'; diff --git a/graphile/graphile-plugin-connection-filter/__tests__/integration/schema/defaultOptions.test.ts b/graphile/graphile-plugin-connection-filter/__tests__/integration/schema/defaultOptions.test.ts index 70848afd8..6c621de0e 100644 --- a/graphile/graphile-plugin-connection-filter/__tests__/integration/schema/defaultOptions.test.ts +++ b/graphile/graphile-plugin-connection-filter/__tests__/integration/schema/defaultOptions.test.ts @@ -1,13 +1,14 @@ import '../../../test-utils/env'; + +import { PgConnectionArgCondition } from 'graphile-build-pg'; import { join } from 'path'; import { Pool } from 'pg'; -import { PgConnectionArgCondition } from 'graphile-build-pg'; +import { getConnections, seed } from 'pgsql-test'; +import type { PgTestClient } from 'pgsql-test/test-client'; import { createPostGraphileSchema, type PostGraphileOptions, } from 'postgraphile'; -import { getConnections, seed } from 'pgsql-test'; -import type { PgTestClient } from 'pgsql-test/test-client'; import ConnectionFilterPlugin from '../../../src/index'; import { printSchemaOrdered } from '../../../test-utils/printSchema'; diff --git a/graphile/graphile-plugin-connection-filter/__tests__/integration/schema/ignoreIndexesFalse.test.ts b/graphile/graphile-plugin-connection-filter/__tests__/integration/schema/ignoreIndexesFalse.test.ts index e0dfbd01e..bbd11018e 100644 --- a/graphile/graphile-plugin-connection-filter/__tests__/integration/schema/ignoreIndexesFalse.test.ts +++ b/graphile/graphile-plugin-connection-filter/__tests__/integration/schema/ignoreIndexesFalse.test.ts @@ -1,13 +1,14 @@ import '../../../test-utils/env'; + +import { PgConnectionArgCondition } from 'graphile-build-pg'; import { join } from 'path'; import { Pool } from 'pg'; -import { PgConnectionArgCondition } from 'graphile-build-pg'; +import { getConnections, seed } from 'pgsql-test'; +import type { PgTestClient } from 'pgsql-test/test-client'; import { createPostGraphileSchema, type PostGraphileOptions, } from 'postgraphile'; -import { getConnections, seed } from 'pgsql-test'; -import type { PgTestClient } from 'pgsql-test/test-client'; import ConnectionFilterPlugin from '../../../src/index'; import { printSchemaOrdered } from '../../../test-utils/printSchema'; diff --git a/graphile/graphile-plugin-connection-filter/__tests__/integration/schema/logicalOperatorsFalse.test.ts b/graphile/graphile-plugin-connection-filter/__tests__/integration/schema/logicalOperatorsFalse.test.ts index 6cc9ef6c8..253c30513 100644 --- a/graphile/graphile-plugin-connection-filter/__tests__/integration/schema/logicalOperatorsFalse.test.ts +++ b/graphile/graphile-plugin-connection-filter/__tests__/integration/schema/logicalOperatorsFalse.test.ts @@ -1,13 +1,14 @@ import '../../../test-utils/env'; + +import { PgConnectionArgCondition } from 'graphile-build-pg'; import { join } from 'path'; import { Pool } from 'pg'; -import { PgConnectionArgCondition } from 'graphile-build-pg'; +import { getConnections, seed } from 'pgsql-test'; +import type { PgTestClient } from 'pgsql-test/test-client'; import { createPostGraphileSchema, type PostGraphileOptions, } from 'postgraphile'; -import { getConnections, seed } from 'pgsql-test'; -import type { PgTestClient } from 'pgsql-test/test-client'; import ConnectionFilterPlugin from '../../../src/index'; import { printSchemaOrdered } from '../../../test-utils/printSchema'; diff --git a/graphile/graphile-plugin-connection-filter/__tests__/integration/schema/operatorNames.test.ts b/graphile/graphile-plugin-connection-filter/__tests__/integration/schema/operatorNames.test.ts index 094e62a7d..fd22cbe90 100644 --- a/graphile/graphile-plugin-connection-filter/__tests__/integration/schema/operatorNames.test.ts +++ b/graphile/graphile-plugin-connection-filter/__tests__/integration/schema/operatorNames.test.ts @@ -1,13 +1,14 @@ import '../../../test-utils/env'; + +import { PgConnectionArgCondition } from 'graphile-build-pg'; import { join } from 'path'; import { Pool } from 'pg'; -import { PgConnectionArgCondition } from 'graphile-build-pg'; +import { getConnections, seed } from 'pgsql-test'; +import type { PgTestClient } from 'pgsql-test/test-client'; import { createPostGraphileSchema, type PostGraphileOptions, } from 'postgraphile'; -import { getConnections, seed } from 'pgsql-test'; -import type { PgTestClient } from 'pgsql-test/test-client'; import ConnectionFilterPlugin from '../../../src/index'; import { printSchemaOrdered } from '../../../test-utils/printSchema'; diff --git a/graphile/graphile-plugin-connection-filter/__tests__/integration/schema/relationsTrue.test.ts b/graphile/graphile-plugin-connection-filter/__tests__/integration/schema/relationsTrue.test.ts index 2973e6f2c..6ea153027 100644 --- a/graphile/graphile-plugin-connection-filter/__tests__/integration/schema/relationsTrue.test.ts +++ b/graphile/graphile-plugin-connection-filter/__tests__/integration/schema/relationsTrue.test.ts @@ -1,13 +1,14 @@ import '../../../test-utils/env'; + +import { PgConnectionArgCondition } from 'graphile-build-pg'; import { join } from 'path'; import { Pool } from 'pg'; -import { PgConnectionArgCondition } from 'graphile-build-pg'; +import { getConnections, seed } from 'pgsql-test'; +import type { PgTestClient } from 'pgsql-test/test-client'; import { createPostGraphileSchema, type PostGraphileOptions, } from 'postgraphile'; -import { getConnections, seed } from 'pgsql-test'; -import type { PgTestClient } from 'pgsql-test/test-client'; import ConnectionFilterPlugin from '../../../src/index'; import { printSchemaOrdered } from '../../../test-utils/printSchema'; diff --git a/graphile/graphile-plugin-connection-filter/__tests__/integration/schema/relationsWithListInflectors.test.ts b/graphile/graphile-plugin-connection-filter/__tests__/integration/schema/relationsWithListInflectors.test.ts index 8fdd7ce5e..91feae3ac 100644 --- a/graphile/graphile-plugin-connection-filter/__tests__/integration/schema/relationsWithListInflectors.test.ts +++ b/graphile/graphile-plugin-connection-filter/__tests__/integration/schema/relationsWithListInflectors.test.ts @@ -1,14 +1,15 @@ import '../../../test-utils/env'; + +import PgSimplify from '@graphile-contrib/pg-simplify-inflector'; +import { PgConnectionArgCondition } from 'graphile-build-pg'; import { join } from 'path'; import { Pool } from 'pg'; -import { PgConnectionArgCondition } from 'graphile-build-pg'; +import { getConnections, seed } from 'pgsql-test'; +import type { PgTestClient } from 'pgsql-test/test-client'; import { createPostGraphileSchema, type PostGraphileOptions, } from 'postgraphile'; -import { getConnections, seed } from 'pgsql-test'; -import type { PgTestClient } from 'pgsql-test/test-client'; -import PgSimplify from '@graphile-contrib/pg-simplify-inflector'; import ConnectionFilterPlugin from '../../../src/index'; import { printSchemaOrdered } from '../../../test-utils/printSchema'; diff --git a/graphile/graphile-plugin-connection-filter/__tests__/integration/schema/setofFunctionsFalse.test.ts b/graphile/graphile-plugin-connection-filter/__tests__/integration/schema/setofFunctionsFalse.test.ts index 729d2dfa0..fd1ededc9 100644 --- a/graphile/graphile-plugin-connection-filter/__tests__/integration/schema/setofFunctionsFalse.test.ts +++ b/graphile/graphile-plugin-connection-filter/__tests__/integration/schema/setofFunctionsFalse.test.ts @@ -1,13 +1,14 @@ import '../../../test-utils/env'; + +import { PgConnectionArgCondition } from 'graphile-build-pg'; import { join } from 'path'; import { Pool } from 'pg'; -import { PgConnectionArgCondition } from 'graphile-build-pg'; +import { getConnections, seed } from 'pgsql-test'; +import type { PgTestClient } from 'pgsql-test/test-client'; import { createPostGraphileSchema, type PostGraphileOptions, } from 'postgraphile'; -import { getConnections, seed } from 'pgsql-test'; -import type { PgTestClient } from 'pgsql-test/test-client'; import ConnectionFilterPlugin from '../../../src/index'; import { printSchemaOrdered } from '../../../test-utils/printSchema'; diff --git a/graphile/graphile-plugin-connection-filter/__tests__/integration/schema/useCustomNetworkScalars.test.ts b/graphile/graphile-plugin-connection-filter/__tests__/integration/schema/useCustomNetworkScalars.test.ts index 8494802b9..503479105 100644 --- a/graphile/graphile-plugin-connection-filter/__tests__/integration/schema/useCustomNetworkScalars.test.ts +++ b/graphile/graphile-plugin-connection-filter/__tests__/integration/schema/useCustomNetworkScalars.test.ts @@ -1,13 +1,14 @@ import '../../../test-utils/env'; + +import { PgConnectionArgCondition } from 'graphile-build-pg'; import { join } from 'path'; import { Pool } from 'pg'; -import { PgConnectionArgCondition } from 'graphile-build-pg'; +import { getConnections, seed } from 'pgsql-test'; +import type { PgTestClient } from 'pgsql-test/test-client'; import { createPostGraphileSchema, type PostGraphileOptions, } from 'postgraphile'; -import { getConnections, seed } from 'pgsql-test'; -import type { PgTestClient } from 'pgsql-test/test-client'; import ConnectionFilterPlugin from '../../../src/index'; import { printSchemaOrdered } from '../../../test-utils/printSchema'; diff --git a/graphile/graphile-plugin-connection-filter/src/PgConnectionArgFilterColumnsPlugin.ts b/graphile/graphile-plugin-connection-filter/src/PgConnectionArgFilterColumnsPlugin.ts index a75e694b4..157f8708c 100644 --- a/graphile/graphile-plugin-connection-filter/src/PgConnectionArgFilterColumnsPlugin.ts +++ b/graphile/graphile-plugin-connection-filter/src/PgConnectionArgFilterColumnsPlugin.ts @@ -1,5 +1,6 @@ import type { Plugin } from 'graphile-build'; import type { PgAttribute } from 'graphile-build-pg'; + import { ConnectionFilterResolver } from './PgConnectionArgFilterPlugin'; const PgConnectionArgFilterColumnsPlugin: Plugin = (builder) => { diff --git a/graphile/graphile-plugin-connection-filter/src/PgConnectionArgFilterLogicalOperatorsPlugin.ts b/graphile/graphile-plugin-connection-filter/src/PgConnectionArgFilterLogicalOperatorsPlugin.ts index b9520bc5a..c0ac68a0c 100644 --- a/graphile/graphile-plugin-connection-filter/src/PgConnectionArgFilterLogicalOperatorsPlugin.ts +++ b/graphile/graphile-plugin-connection-filter/src/PgConnectionArgFilterLogicalOperatorsPlugin.ts @@ -1,5 +1,6 @@ import type { Plugin } from 'graphile-build'; import type { QueryBuilder, SQL } from 'graphile-build-pg'; + import { ConnectionFilterResolver } from './PgConnectionArgFilterPlugin'; const PgConnectionArgFilterLogicalOperatorsPlugin: Plugin = (builder) => { diff --git a/graphile/graphile-plugin-connection-filter/src/index.ts b/graphile/graphile-plugin-connection-filter/src/index.ts index 329d74c98..2219d62a1 100644 --- a/graphile/graphile-plugin-connection-filter/src/index.ts +++ b/graphile/graphile-plugin-connection-filter/src/index.ts @@ -4,8 +4,8 @@ import type { Plugin } from 'graphile-build'; import ConnectionArgFilterPlugin from './ConnectionArgFilterPlugin'; import PgConnectionArgFilterBackwardRelationsPlugin from './PgConnectionArgFilterBackwardRelationsPlugin'; import PgConnectionArgFilterColumnsPlugin from './PgConnectionArgFilterColumnsPlugin'; -import PgConnectionArgFilterComputedColumnsPlugin from './PgConnectionArgFilterComputedColumnsPlugin'; import PgConnectionArgFilterCompositeTypeColumnsPlugin from './PgConnectionArgFilterCompositeTypeColumnsPlugin'; +import PgConnectionArgFilterComputedColumnsPlugin from './PgConnectionArgFilterComputedColumnsPlugin'; import PgConnectionArgFilterForwardRelationsPlugin from './PgConnectionArgFilterForwardRelationsPlugin'; import PgConnectionArgFilterLogicalOperatorsPlugin from './PgConnectionArgFilterLogicalOperatorsPlugin'; import PgConnectionArgFilterOperatorsPlugin from './PgConnectionArgFilterOperatorsPlugin'; diff --git a/graphile/graphile-plugin-connection-filter/test-utils/customOperatorsPlugin.ts b/graphile/graphile-plugin-connection-filter/test-utils/customOperatorsPlugin.ts index f46796852..093bfa28f 100644 --- a/graphile/graphile-plugin-connection-filter/test-utils/customOperatorsPlugin.ts +++ b/graphile/graphile-plugin-connection-filter/test-utils/customOperatorsPlugin.ts @@ -1,4 +1,4 @@ -import type { SchemaBuilder, Plugin } from 'graphile-build'; +import type { Plugin,SchemaBuilder } from 'graphile-build'; import type { SQL } from 'graphile-build-pg'; import type { GraphQLScalarType } from 'graphql'; diff --git a/graphile/graphile-plugin-fulltext-filter/__tests__/fulltext.test.ts b/graphile/graphile-plugin-fulltext-filter/__tests__/fulltext.test.ts index eed573d89..bc638871f 100644 --- a/graphile/graphile-plugin-fulltext-filter/__tests__/fulltext.test.ts +++ b/graphile/graphile-plugin-fulltext-filter/__tests__/fulltext.test.ts @@ -1,9 +1,9 @@ +import ConnectionFilterPlugin from 'graphile-plugin-connection-filter'; import type { GraphQLQueryFnObj, GraphQLTestContext } from 'graphile-test'; import { getConnectionsObject, seed } from 'graphile-test'; import { buildClientSchema, getIntrospectionQuery } from 'graphql'; import { join } from 'path'; import type { PgTestClient } from 'pgsql-test/test-client'; -import ConnectionFilterPlugin from 'graphile-plugin-connection-filter'; import PostGraphileFulltextFilterPlugin from '../src'; diff --git a/graphile/graphile-plugin-fulltext-filter/src/index.ts b/graphile/graphile-plugin-fulltext-filter/src/index.ts index 7ca981811..9385720a9 100644 --- a/graphile/graphile-plugin-fulltext-filter/src/index.ts +++ b/graphile/graphile-plugin-fulltext-filter/src/index.ts @@ -1,6 +1,6 @@ -import { Tsquery } from 'pg-tsquery'; -import { omit } from 'graphile-build-pg'; import type { Plugin } from 'graphile-build'; +import { omit } from 'graphile-build-pg'; +import { Tsquery } from 'pg-tsquery'; const tsquery = new Tsquery(); @@ -26,7 +26,7 @@ const PostGraphileFulltextFilterPlugin: Plugin = (builder) => { const columnName = attr.kind === 'procedure' ? attr.name.substring(table.name.length + 1) - : this._columnName(attr, { skipRowId: true }); // eslint-disable-line no-underscore-dangle + : this._columnName(attr, { skipRowId: true }); return this.constantCase( `${columnName}_rank_${ascending ? 'asc' : 'desc'}` ); diff --git a/graphile/graphile-postgis/__tests__/integration/queries.test.ts b/graphile/graphile-postgis/__tests__/integration/queries.test.ts index eb95f1f04..f8ae604bf 100644 --- a/graphile/graphile-postgis/__tests__/integration/queries.test.ts +++ b/graphile/graphile-postgis/__tests__/integration/queries.test.ts @@ -1,7 +1,8 @@ import '../../test-utils/env'; + import { readdirSync, readFileSync } from 'fs'; +import { getConnections, type GraphQLQueryFn,seed, snapshot } from 'graphile-test'; import { join } from 'path'; -import { getConnections, seed, snapshot, type GraphQLQueryFn } from 'graphile-test'; import type { PgTestClient } from 'pgsql-test/test-client'; import PostgisPlugin from '../../src'; diff --git a/graphile/graphile-postgis/__tests__/schema.test.ts b/graphile/graphile-postgis/__tests__/schema.test.ts index 5896d3220..7679df9bf 100644 --- a/graphile/graphile-postgis/__tests__/schema.test.ts +++ b/graphile/graphile-postgis/__tests__/schema.test.ts @@ -1,4 +1,5 @@ import '../test-utils/env'; + import type { GraphQLQueryFn } from 'graphile-test'; import type { PgTestClient } from 'pgsql-test/test-client'; diff --git a/graphile/graphile-postgis/src/PostgisRegisterTypesPlugin.ts b/graphile/graphile-postgis/src/PostgisRegisterTypesPlugin.ts index 5b01f55f7..23159156d 100644 --- a/graphile/graphile-postgis/src/PostgisRegisterTypesPlugin.ts +++ b/graphile/graphile-postgis/src/PostgisRegisterTypesPlugin.ts @@ -3,16 +3,16 @@ import type { PgType } from 'graphile-build-pg'; import type { SQL } from 'graphile-build-pg/node8plus/QueryBuilder'; import type { GraphQLInterfaceType, - GraphQLOutputType, GraphQLObjectType, + GraphQLOutputType, GraphQLScalarType, GraphQLSchemaConfig } from 'graphql'; import { GisSubtype } from './constants'; import makeGeoJSONType from './makeGeoJSONType'; -import { getGISTypeDetails, getGISTypeModifier, getGISTypeName } from './utils'; import type { GisFieldValue, GisGraphQLType, GisTypeDetails, PostgisBuild } from './types'; +import { getGISTypeDetails, getGISTypeModifier, getGISTypeName } from './utils'; const SUBTYPES: GisSubtype[] = [ GisSubtype.Point, diff --git a/graphile/graphile-postgis/src/Postgis_GeometryCollection_GeometriesPlugin.ts b/graphile/graphile-postgis/src/Postgis_GeometryCollection_GeometriesPlugin.ts index 034c2b428..717db8e65 100644 --- a/graphile/graphile-postgis/src/Postgis_GeometryCollection_GeometriesPlugin.ts +++ b/graphile/graphile-postgis/src/Postgis_GeometryCollection_GeometriesPlugin.ts @@ -1,10 +1,10 @@ +import type { GeometryCollection } from 'geojson'; import type { Build, Plugin } from 'graphile-build'; import type { GraphQLFieldConfigMap } from 'graphql'; -import type { GeometryCollection } from 'geojson'; import { GisSubtype } from './constants'; -import { getGISTypeName } from './utils'; import type { GisFieldValue, GisScope, PostgisBuild } from './types'; +import { getGISTypeName } from './utils'; const PostgisGeometryCollectionGeometriesPlugin: Plugin = (builder) => { builder.hook( diff --git a/graphile/graphile-postgis/src/Postgis_LineString_PointsPlugin.ts b/graphile/graphile-postgis/src/Postgis_LineString_PointsPlugin.ts index 74817e1dc..172b10a94 100644 --- a/graphile/graphile-postgis/src/Postgis_LineString_PointsPlugin.ts +++ b/graphile/graphile-postgis/src/Postgis_LineString_PointsPlugin.ts @@ -1,10 +1,10 @@ +import type { LineString, Point as GeoPoint } from 'geojson'; import type { Build, Plugin } from 'graphile-build'; import type { GraphQLFieldConfigMap } from 'graphql'; -import type { LineString, Point as GeoPoint } from 'geojson'; import { GisSubtype } from './constants'; -import { getGISTypeName } from './utils'; import type { GisFieldValue, GisGraphQLType, GisScope, PostgisBuild } from './types'; +import { getGISTypeName } from './utils'; const PostgisLineStringPointsPlugin: Plugin = (builder) => { builder.hook( diff --git a/graphile/graphile-postgis/src/Postgis_MultiLineString_LineStringsPlugin.ts b/graphile/graphile-postgis/src/Postgis_MultiLineString_LineStringsPlugin.ts index e68fb5817..c6a494b1f 100644 --- a/graphile/graphile-postgis/src/Postgis_MultiLineString_LineStringsPlugin.ts +++ b/graphile/graphile-postgis/src/Postgis_MultiLineString_LineStringsPlugin.ts @@ -1,10 +1,10 @@ +import type { LineString, MultiLineString } from 'geojson'; import type { Build, Plugin } from 'graphile-build'; import type { GraphQLFieldConfigMap } from 'graphql'; -import type { LineString, MultiLineString } from 'geojson'; import { GisSubtype } from './constants'; -import { getGISTypeName } from './utils'; import type { GisFieldValue, GisGraphQLType, GisScope, PostgisBuild } from './types'; +import { getGISTypeName } from './utils'; const PostgisMultiLineStringLineStringsPlugin: Plugin = (builder) => { builder.hook( diff --git a/graphile/graphile-postgis/src/Postgis_MultiPoint_PointsPlugin.ts b/graphile/graphile-postgis/src/Postgis_MultiPoint_PointsPlugin.ts index b8539f95b..342f16eb2 100644 --- a/graphile/graphile-postgis/src/Postgis_MultiPoint_PointsPlugin.ts +++ b/graphile/graphile-postgis/src/Postgis_MultiPoint_PointsPlugin.ts @@ -1,10 +1,10 @@ +import type { MultiPoint, Point as GeoPoint } from 'geojson'; import type { Build, Plugin } from 'graphile-build'; import type { GraphQLFieldConfigMap } from 'graphql'; -import type { MultiPoint, Point as GeoPoint } from 'geojson'; import { GisSubtype } from './constants'; -import { getGISTypeName } from './utils'; import type { GisFieldValue, GisGraphQLType, GisScope, PostgisBuild } from './types'; +import { getGISTypeName } from './utils'; const PostgisMultiPointPointsPlugin: Plugin = (builder) => { builder.hook( diff --git a/graphile/graphile-postgis/src/Postgis_MultiPolygon_PolygonsPlugin.ts b/graphile/graphile-postgis/src/Postgis_MultiPolygon_PolygonsPlugin.ts index bbeea0f44..cc336f3cf 100644 --- a/graphile/graphile-postgis/src/Postgis_MultiPolygon_PolygonsPlugin.ts +++ b/graphile/graphile-postgis/src/Postgis_MultiPolygon_PolygonsPlugin.ts @@ -1,10 +1,10 @@ +import type { MultiPolygon, Polygon } from 'geojson'; import type { Build, Plugin } from 'graphile-build'; import type { GraphQLFieldConfigMap } from 'graphql'; -import type { MultiPolygon, Polygon } from 'geojson'; import { GisSubtype } from './constants'; -import { getGISTypeName } from './utils'; import type { GisFieldValue, GisGraphQLType, GisScope, PostgisBuild } from './types'; +import { getGISTypeName } from './utils'; const PostgisMultiPolygonPolygonsPlugin: Plugin = (builder) => { builder.hook( diff --git a/graphile/graphile-postgis/src/Postgis_Point_LatitudeLongitudePlugin.ts b/graphile/graphile-postgis/src/Postgis_Point_LatitudeLongitudePlugin.ts index 3830d6021..a44e0d7ad 100644 --- a/graphile/graphile-postgis/src/Postgis_Point_LatitudeLongitudePlugin.ts +++ b/graphile/graphile-postgis/src/Postgis_Point_LatitudeLongitudePlugin.ts @@ -1,6 +1,6 @@ +import type { Point } from 'geojson'; import type { Build, Plugin } from 'graphile-build'; import type { GraphQLFieldConfigMap } from 'graphql'; -import type { Point } from 'geojson'; import { GisSubtype } from './constants'; import type { GisFieldValue, GisScope, PostgisBuild } from './types'; diff --git a/graphile/graphile-postgis/src/Postgis_Polygon_RingsPlugin.ts b/graphile/graphile-postgis/src/Postgis_Polygon_RingsPlugin.ts index 3ddc2c14e..ea95bc7ff 100644 --- a/graphile/graphile-postgis/src/Postgis_Polygon_RingsPlugin.ts +++ b/graphile/graphile-postgis/src/Postgis_Polygon_RingsPlugin.ts @@ -1,10 +1,10 @@ +import type { LineString, Polygon } from 'geojson'; import type { Build, Plugin } from 'graphile-build'; import type { GraphQLFieldConfigMap } from 'graphql'; -import type { LineString, Polygon } from 'geojson'; import { GisSubtype } from './constants'; -import { getGISTypeName } from './utils'; import type { GisFieldValue, GisGraphQLType, GisScope, PostgisBuild } from './types'; +import { getGISTypeName } from './utils'; const PostgisPolygonRingsPlugin: Plugin = (builder) => { builder.hook( diff --git a/graphile/graphile-postgis/src/index.ts b/graphile/graphile-postgis/src/index.ts index bd472a833..9b187d6d4 100644 --- a/graphile/graphile-postgis/src/index.ts +++ b/graphile/graphile-postgis/src/index.ts @@ -1,9 +1,5 @@ import type { Plugin } from 'graphile-build'; -import PostgisExtensionDetectionPlugin from './PostgisExtensionDetectionPlugin'; -import PostgisInflectionPlugin from './PostgisInflectionPlugin'; -import PostgisRegisterTypesPlugin from './PostgisRegisterTypesPlugin'; -import PostgisVersionPlugin from './PostgisVersionPlugin'; import Postgis_GeometryCollection_GeometriesPlugin from './Postgis_GeometryCollection_GeometriesPlugin'; import Postgis_LineString_PointsPlugin from './Postgis_LineString_PointsPlugin'; import Postgis_MultiLineString_LineStringsPlugin from './Postgis_MultiLineString_LineStringsPlugin'; @@ -11,6 +7,10 @@ import Postgis_MultiPoint_PointsPlugin from './Postgis_MultiPoint_PointsPlugin'; import Postgis_MultiPolygon_PolygonsPlugin from './Postgis_MultiPolygon_PolygonsPlugin'; import Postgis_Point_LatitudeLongitudePlugin from './Postgis_Point_LatitudeLongitudePlugin'; import Postgis_Polygon_RingsPlugin from './Postgis_Polygon_RingsPlugin'; +import PostgisExtensionDetectionPlugin from './PostgisExtensionDetectionPlugin'; +import PostgisInflectionPlugin from './PostgisInflectionPlugin'; +import PostgisRegisterTypesPlugin from './PostgisRegisterTypesPlugin'; +import PostgisVersionPlugin from './PostgisVersionPlugin'; const PostgisPlugin: Plugin = async (builder, options) => { await PostgisVersionPlugin(builder, options); @@ -41,17 +41,16 @@ const PostgisPlugin: Plugin = async (builder, options) => { }; export { - PostgisExtensionDetectionPlugin, - PostgisInflectionPlugin, - PostgisRegisterTypesPlugin, - PostgisVersionPlugin, Postgis_GeometryCollection_GeometriesPlugin, Postgis_LineString_PointsPlugin, Postgis_MultiLineString_LineStringsPlugin, Postgis_MultiPoint_PointsPlugin, Postgis_MultiPolygon_PolygonsPlugin, Postgis_Point_LatitudeLongitudePlugin, - Postgis_Polygon_RingsPlugin -}; + Postgis_Polygon_RingsPlugin, + PostgisExtensionDetectionPlugin, + PostgisInflectionPlugin, + PostgisRegisterTypesPlugin, + PostgisVersionPlugin}; export default PostgisPlugin; diff --git a/graphile/graphile-postgis/src/types.ts b/graphile/graphile-postgis/src/types.ts index 15e2a7ea2..8c4cb5528 100644 --- a/graphile/graphile-postgis/src/types.ts +++ b/graphile/graphile-postgis/src/types.ts @@ -1,3 +1,4 @@ +import type { Geometry } from 'geojson'; import type { Build, Inflection } from 'graphile-build'; import type { PgExtension, PgIntrospectionResultsByKind, PgType } from 'graphile-build-pg'; import type { SQL } from 'graphile-build-pg/node8plus/QueryBuilder'; @@ -8,7 +9,6 @@ import type { GraphQLOutputType, GraphQLType } from 'graphql'; -import type { Geometry } from 'geojson'; import type { GisSubtype } from './constants'; diff --git a/graphile/graphile-postgis/test-utils/helpers.ts b/graphile/graphile-postgis/test-utils/helpers.ts index 7688ece13..b3f93f2f2 100644 --- a/graphile/graphile-postgis/test-utils/helpers.ts +++ b/graphile/graphile-postgis/test-utils/helpers.ts @@ -1,15 +1,14 @@ +import type { GraphQLQueryFn } from 'graphile-test'; +import { getConnections, seed } from 'graphile-test'; +import type { GraphQLSchema } from 'graphql'; import { buildASTSchema, buildClientSchema, getIntrospectionQuery, + type IntrospectionQuery, parse, - printSchema, - type IntrospectionQuery -} from 'graphql'; + printSchema} from 'graphql'; import { join } from 'path'; -import type { GraphQLSchema } from 'graphql'; -import type { GraphQLQueryFn } from 'graphile-test'; -import { getConnections, seed } from 'graphile-test'; import PostgisPlugin from '../src'; diff --git a/graphile/graphile-search-plugin/__tests__/plugin.test.ts b/graphile/graphile-search-plugin/__tests__/plugin.test.ts index bfc840d60..39ef992a1 100644 --- a/graphile/graphile-search-plugin/__tests__/plugin.test.ts +++ b/graphile/graphile-search-plugin/__tests__/plugin.test.ts @@ -1,18 +1,20 @@ import '../test-utils/env'; -import { getConnections, snapshot, seed, GraphQLQueryFn } from 'graphile-test'; + +import ConnectionFilterPlugin from 'graphile-plugin-connection-filter'; +// @ts-ignore +import FulltextFilterPlugin from 'graphile-plugin-fulltext-filter'; +import PgSimpleInflector from 'graphile-simple-inflector'; +import { getConnections, GraphQLQueryFn,seed, snapshot } from 'graphile-test'; import { join } from 'path'; import type { PgTestClient } from 'pgsql-test/test-client'; + +import { PgSearchPlugin } from '../src'; import { GoalsSearchViaCondition, - GoalsSearchViaFilter, GoalsSearchViaCondition2, + GoalsSearchViaFilter, GoalsSearchViaFilter2 } from '../test-utils/queries'; -import { PgSearchPlugin } from '../src'; -import PgSimpleInflector from 'graphile-simple-inflector'; -import ConnectionFilterPlugin from 'graphile-plugin-connection-filter'; -// @ts-ignore -import FulltextFilterPlugin from 'graphile-plugin-fulltext-filter'; const SCHEMA = 'app_public'; const sql = (f: string) => join(__dirname, '../sql', f); diff --git a/graphile/graphile-settings/src/index.ts b/graphile/graphile-settings/src/index.ts index 35264135d..4ecd0e6db 100644 --- a/graphile/graphile-settings/src/index.ts +++ b/graphile/graphile-settings/src/index.ts @@ -1,22 +1,21 @@ -import PgManyToMany from '@graphile-contrib/pg-many-to-many'; import { getEnvOptions } from '@constructive-io/graphql-env'; import { ConstructiveOptions } from '@constructive-io/graphql-types'; -import PgPostgis from 'graphile-postgis'; -import FulltextFilterPlugin from 'graphile-plugin-fulltext-filter'; +import PgManyToMany from '@graphile-contrib/pg-many-to-many'; import { NodePlugin, Plugin } from 'graphile-build'; import { additionalGraphQLContextFromRequest as langAdditional, LangPlugin } from 'graphile-i18n'; import PgMetaschema from 'graphile-meta-schema'; -import PgSearch from 'graphile-search-plugin'; -import PgSimpleInflector from 'graphile-simple-inflector'; -import { PostGraphileOptions } from 'postgraphile'; +import CustomPgTypeMappingsPlugin from 'graphile-pg-type-mappings'; import ConnectionFilterPlugin from 'graphile-plugin-connection-filter'; import PgPostgisFilter from 'graphile-plugin-connection-filter-postgis'; - -import CustomPgTypeMappingsPlugin from 'graphile-pg-type-mappings'; +import FulltextFilterPlugin from 'graphile-plugin-fulltext-filter'; +import PgPostgis from 'graphile-postgis'; +import PgSearch from 'graphile-search-plugin'; +import PgSimpleInflector from 'graphile-simple-inflector'; import UploadPostGraphilePlugin, { Uploader } from 'graphile-upload-plugin'; +import { PostGraphileOptions } from 'postgraphile'; export const getGraphileSettings = ( rawOpts: ConstructiveOptions diff --git a/graphile/graphile-simple-inflector/__tests__/index.test.ts b/graphile/graphile-simple-inflector/__tests__/index.test.ts index e193486e4..299935f86 100644 --- a/graphile/graphile-simple-inflector/__tests__/index.test.ts +++ b/graphile/graphile-simple-inflector/__tests__/index.test.ts @@ -1,5 +1,6 @@ import '../test-utils/env'; -import { GraphQLQueryFn, getConnections, seed, snapshot } from 'graphile-test'; + +import { getConnections, GraphQLQueryFn, seed, snapshot } from 'graphile-test'; import { join } from 'path'; import type { PgTestClient } from 'pgsql-test/test-client'; diff --git a/graphile/graphile-simple-inflector/src/index.ts b/graphile/graphile-simple-inflector/src/index.ts index 73a42d70d..4bccbd8d7 100644 --- a/graphile/graphile-simple-inflector/src/index.ts +++ b/graphile/graphile-simple-inflector/src/index.ts @@ -147,7 +147,7 @@ export const PgSimpleInflector: Plugin = ( pgOmitListSuffix !== true && pgOmitListSuffix !== false ) { - // eslint-disable-next-line no-console + console.warn( 'You can simplify the inflector further by adding `{graphileBuildOptions: {pgOmitListSuffix: true}}` to the options passed to PostGraphile, however be aware that doing so will mean that later enabling relay connections will be a breaking change. To dismiss this message, set `pgOmitListSuffix` to false instead.' ); diff --git a/graphile/graphile-test/__tests__/graphile-test.graphile-tx.test.ts b/graphile/graphile-test/__tests__/graphile-test.graphile-tx.test.ts index 7639fdc1f..ae9430733 100644 --- a/graphile/graphile-test/__tests__/graphile-test.graphile-tx.test.ts +++ b/graphile/graphile-test/__tests__/graphile-test.graphile-tx.test.ts @@ -5,9 +5,9 @@ import { join } from 'path'; import { seed } from 'pgsql-test'; import type { PgTestClient } from 'pgsql-test/test-client'; -import { snapshot } from '../src/utils'; import { getConnections } from '../src/get-connections'; import type { GraphQLQueryFn } from '../src/types'; +import { snapshot } from '../src/utils'; import { logDbSessionInfo } from '../test-utils/utils'; const schemas = ['app_public']; diff --git a/graphile/graphile-test/__tests__/graphile-test.graphql.test.ts b/graphile/graphile-test/__tests__/graphile-test.graphql.test.ts index 9aeb72cb1..16c03fe1c 100644 --- a/graphile/graphile-test/__tests__/graphile-test.graphql.test.ts +++ b/graphile/graphile-test/__tests__/graphile-test.graphql.test.ts @@ -5,9 +5,9 @@ import { join } from 'path'; import { seed } from 'pgsql-test'; import type { PgTestClient } from 'pgsql-test/test-client'; -import { snapshot } from '../src/utils'; import { getConnections } from '../src/get-connections'; import type { GraphQLQueryFn } from '../src/types'; +import { snapshot } from '../src/utils'; import { logDbSessionInfo } from '../test-utils/utils'; const schemas = ['app_public']; diff --git a/graphile/graphile-test/__tests__/graphile-test.roles.test.ts b/graphile/graphile-test/__tests__/graphile-test.roles.test.ts index 5a1f0b959..4d6e3d6ed 100644 --- a/graphile/graphile-test/__tests__/graphile-test.roles.test.ts +++ b/graphile/graphile-test/__tests__/graphile-test.roles.test.ts @@ -5,9 +5,9 @@ import { join } from 'path'; import { seed } from 'pgsql-test'; import type { PgTestClient } from 'pgsql-test/test-client'; -import { snapshot } from '../src/utils'; import { getConnections } from '../src/get-connections'; import type { GraphQLQueryFn } from '../src/types'; +import { snapshot } from '../src/utils'; import { logDbSessionInfo } from '../test-utils/utils'; const schemas = ['app_public']; diff --git a/graphile/graphile-test/__tests__/graphile-test.test.ts b/graphile/graphile-test/__tests__/graphile-test.test.ts index 729355721..fff69b5dd 100644 --- a/graphile/graphile-test/__tests__/graphile-test.test.ts +++ b/graphile/graphile-test/__tests__/graphile-test.test.ts @@ -4,9 +4,9 @@ import { join } from 'path'; import { seed } from 'pgsql-test'; import type { PgTestClient } from 'pgsql-test/test-client'; -import { snapshot } from '../src/utils'; import { getConnections } from '../src/get-connections'; import type { GraphQLQueryFn } from '../src/types'; +import { snapshot } from '../src/utils'; import { IntrospectionQuery } from '../test-utils/queries'; import { logDbSessionInfo } from '../test-utils/utils'; diff --git a/graphile/graphile-test/__tests__/graphile-test.types.positional.test.ts b/graphile/graphile-test/__tests__/graphile-test.types.positional.test.ts index f651e80b8..da44f3696 100644 --- a/graphile/graphile-test/__tests__/graphile-test.types.positional.test.ts +++ b/graphile/graphile-test/__tests__/graphile-test.types.positional.test.ts @@ -4,9 +4,9 @@ import { join } from 'path'; import { seed } from 'pgsql-test'; import type { PgTestClient } from 'pgsql-test/test-client'; -import { snapshot } from '../src/utils'; import { getConnections } from '../src/get-connections'; import type { GraphQLQueryFn } from '../src/types'; +import { snapshot } from '../src/utils'; const schemas = ['app_public']; const sql = (f: string) => join(__dirname, '/../sql', f); diff --git a/graphile/graphile-test/__tests__/graphile-test.types.positional.unwrapped.test.ts b/graphile/graphile-test/__tests__/graphile-test.types.positional.unwrapped.test.ts index eff7f6cef..e83040696 100644 --- a/graphile/graphile-test/__tests__/graphile-test.types.positional.unwrapped.test.ts +++ b/graphile/graphile-test/__tests__/graphile-test.types.positional.unwrapped.test.ts @@ -4,9 +4,9 @@ import { join } from 'path'; import { seed } from 'pgsql-test'; import type { PgTestClient } from 'pgsql-test/test-client'; -import { snapshot } from '../src/utils'; import { getConnectionsUnwrapped } from '../src/get-connections'; import type { GraphQLQueryUnwrappedFn } from '../src/types'; +import { snapshot } from '../src/utils'; const schemas = ['app_public']; const sql = (f: string) => join(__dirname, '/../sql', f); diff --git a/graphile/graphile-test/__tests__/graphile-test.types.test.ts b/graphile/graphile-test/__tests__/graphile-test.types.test.ts index d2865867d..23fd41792 100644 --- a/graphile/graphile-test/__tests__/graphile-test.types.test.ts +++ b/graphile/graphile-test/__tests__/graphile-test.types.test.ts @@ -4,9 +4,9 @@ import { join } from 'path'; import { seed } from 'pgsql-test'; import type { PgTestClient } from 'pgsql-test/test-client'; -import { snapshot } from '../src/utils'; import { getConnectionsObject } from '../src/get-connections'; import type { GraphQLQueryFnObj } from '../src/types'; +import { snapshot } from '../src/utils'; const schemas = ['app_public']; const sql = (f: string) => join(__dirname, '/../sql', f); diff --git a/graphile/graphile-test/__tests__/graphile-test.types.unwrapped.test.ts b/graphile/graphile-test/__tests__/graphile-test.types.unwrapped.test.ts index 81a84eeb4..be170b8a1 100644 --- a/graphile/graphile-test/__tests__/graphile-test.types.unwrapped.test.ts +++ b/graphile/graphile-test/__tests__/graphile-test.types.unwrapped.test.ts @@ -4,9 +4,9 @@ import { join } from 'path'; import { seed } from 'pgsql-test'; import type { PgTestClient } from 'pgsql-test/test-client'; -import { snapshot } from '../src/utils'; import { getConnectionsObjectUnwrapped } from '../src/get-connections'; import type { GraphQLQueryUnwrappedFnObj } from '../src/types'; +import { snapshot } from '../src/utils'; const schemas = ['app_public']; const sql = (f: string) => join(__dirname, '/../sql', f); diff --git a/graphile/graphile-upload-plugin/__tests__/plugin.test.ts b/graphile/graphile-upload-plugin/__tests__/plugin.test.ts index bdce280de..aac509fe5 100644 --- a/graphile/graphile-upload-plugin/__tests__/plugin.test.ts +++ b/graphile/graphile-upload-plugin/__tests__/plugin.test.ts @@ -1,13 +1,15 @@ import '../test-utils/env'; -import { join } from 'path'; -import { createReadStream, writeFileSync, unlinkSync } from 'fs'; -import { tmpdir } from 'os'; + import { S3Client } from '@aws-sdk/client-s3'; import { getEnvOptions } from '@constructive-io/graphql-env'; import { createS3Bucket } from '@constructive-io/s3-utils'; -import { getConnections, snapshot, seed } from 'graphile-test'; -import type { PgTestClient } from 'pgsql-test/test-client'; +import { createReadStream, unlinkSync,writeFileSync } from 'fs'; import type { GraphQLQueryFn } from 'graphile-test'; +import { getConnections, seed,snapshot } from 'graphile-test'; +import { tmpdir } from 'os'; +import { join } from 'path'; +import type { PgTestClient } from 'pgsql-test/test-client'; + import UploadPostGraphilePlugin, { Uploader } from '../src'; // Suppress PostgreSQL NOTICE messages (they're expected when roles don't exist yet) @@ -15,21 +17,22 @@ import UploadPostGraphilePlugin, { Uploader } from '../src'; if (typeof process !== 'undefined') { process.env.PGOPTIONS = '-c client_min_messages=warning'; } +import gql from 'graphql-tag'; + import { - IntrospectUploadScalar, - GetCreateUserInput, - GetCreateDocumentInput, - GetCreateProductInput, - GetCreateProfileInput, - CreateUserWithAvatar, - UpdateUserAvatar, CreateDocumentWithUpload, - UpdateDocumentWithUpload, CreateMediaWithUpload, CreateProductWithUpload, CreateProfileWithUpload, + CreateUserWithAvatar, + GetCreateDocumentInput, + GetCreateProductInput, + GetCreateProfileInput, + GetCreateUserInput, + IntrospectUploadScalar, + UpdateDocumentWithUpload, + UpdateUserAvatar, } from '../test-utils/queries'; -import gql from 'graphql-tag'; const SCHEMA = process.env.SCHEMA ?? 'app_public'; const sql = (f: string) => join(__dirname, '../sql', f); diff --git a/graphile/graphile-upload-plugin/src/index.ts b/graphile/graphile-upload-plugin/src/index.ts index 0e9b2ee7c..bdc3f2fa5 100644 --- a/graphile/graphile-upload-plugin/src/index.ts +++ b/graphile/graphile-upload-plugin/src/index.ts @@ -1,16 +1,16 @@ import UploadPostGraphilePlugin, { type FileUpload, + type UploadFieldDefinition, type UploadPluginInfo, type UploadResolver, - type UploadFieldDefinition, } from './plugin'; export { - UploadPostGraphilePlugin, type FileUpload, + type UploadFieldDefinition, type UploadPluginInfo, + UploadPostGraphilePlugin, type UploadResolver, - type UploadFieldDefinition, }; export { Uploader, type UploaderOptions } from './resolvers/upload'; diff --git a/graphile/graphile-upload-plugin/src/plugin.ts b/graphile/graphile-upload-plugin/src/plugin.ts index afcd160dd..98de431f2 100644 --- a/graphile/graphile-upload-plugin/src/plugin.ts +++ b/graphile/graphile-upload-plugin/src/plugin.ts @@ -248,7 +248,7 @@ const UploadPostGraphilePlugin: Plugin = ( if (obj[key] instanceof Promise) { if (uploadResolversByFieldName[key]) { const upload = await obj[key]; - // eslint-disable-next-line require-atomic-updates + obj[originals[key]] = await uploadResolversByFieldName[key]( upload, args, diff --git a/graphql/codegen/__tests__/gql.mutations.test.ts b/graphql/codegen/__tests__/gql.mutations.test.ts index 03287cc68..5c27937ba 100644 --- a/graphql/codegen/__tests__/gql.mutations.test.ts +++ b/graphql/codegen/__tests__/gql.mutations.test.ts @@ -1,5 +1,6 @@ import { print } from 'graphql' -import { createOne, patchOne, deleteOne, createMutation, MutationSpec } from '../src' + +import { createMutation, createOne, deleteOne, MutationSpec,patchOne } from '../src' describe('gql mutation builders', () => { it('createMutation: builds non-null vars and selects scalar outputs', () => { diff --git a/graphql/codegen/src/codegen.ts b/graphql/codegen/src/codegen.ts index 8e1bfb7ff..2e119e3e9 100644 --- a/graphql/codegen/src/codegen.ts +++ b/graphql/codegen/src/codegen.ts @@ -1,19 +1,20 @@ import { promises as fs } from 'fs' -import { join, dirname, isAbsolute, resolve } from 'path' -import { buildSchema, buildClientSchema, graphql, getIntrospectionQuery, print } from 'graphql' +import { buildClientSchema, buildSchema, getIntrospectionQuery, graphql, print } from 'graphql' +import { dirname, isAbsolute, join, resolve } from 'path' const inflection: any = require('inflection') -import { generate as generateGql, GqlMap } from './gql' -import { parseGraphQuery } from 'introspectron' -import { defaultGraphQLCodegenOptions, GraphQLCodegenOptions, mergeGraphQLCodegenOptions } from './options' +import generate from '@babel/generator' +import { parse } from '@babel/parser' +import * as t from '@babel/types' import { codegen as runCoreCodegen } from '@graphql-codegen/core' import * as typescriptPlugin from '@graphql-codegen/typescript' -import * as typescriptOperationsPlugin from '@graphql-codegen/typescript-operations' import * as typescriptGraphqlRequestPlugin from '@graphql-codegen/typescript-graphql-request' +import * as typescriptOperationsPlugin from '@graphql-codegen/typescript-operations' import * as typescriptReactQueryPlugin from '@graphql-codegen/typescript-react-query' import { GraphQLClient } from 'graphql-request' -import { parse } from '@babel/parser' -import generate from '@babel/generator' -import * as t from '@babel/types' +import { parseGraphQuery } from 'introspectron' + +import { generate as generateGql, GqlMap } from './gql' +import { defaultGraphQLCodegenOptions, GraphQLCodegenOptions, mergeGraphQLCodegenOptions } from './options' function addDocumentNodeImport(code: string): string { const ast = parse(code, { diff --git a/graphql/codegen/src/index.ts b/graphql/codegen/src/index.ts index e1c679be9..56e057e46 100644 --- a/graphql/codegen/src/index.ts +++ b/graphql/codegen/src/index.ts @@ -1,3 +1,3 @@ -export * from './gql' export * from './codegen' +export * from './gql' export * from './options' diff --git a/graphql/env/src/index.ts b/graphql/env/src/index.ts index e88ecd170..b3e25f6e8 100644 --- a/graphql/env/src/index.ts +++ b/graphql/env/src/index.ts @@ -1,18 +1,17 @@ // Re-export core env utilities from @pgpmjs/env export { - loadConfigSync, - loadConfigFileSync, - loadConfigSyncFromDir, - resolvePgpmPath, getConnEnvOptions, getDeploymentEnvOptions, - getNodeEnv -} from '@pgpmjs/env'; + getNodeEnv, + loadConfigFileSync, + loadConfigSync, + loadConfigSyncFromDir, + resolvePgpmPath} from '@pgpmjs/env'; // Export Constructive-specific env functions -export { getEnvOptions, getConstructiveEnvOptions } from './merge'; export { getGraphQLEnvVars } from './env'; +export { getConstructiveEnvOptions,getEnvOptions } from './merge'; // Re-export types for convenience -export type { ConstructiveOptions, ConstructiveGraphQLOptions } from '@constructive-io/graphql-types'; +export type { ConstructiveGraphQLOptions,ConstructiveOptions } from '@constructive-io/graphql-types'; export { constructiveDefaults, constructiveGraphqlDefaults } from '@constructive-io/graphql-types'; diff --git a/graphql/env/src/merge.ts b/graphql/env/src/merge.ts index d82352f75..3d1d409dd 100644 --- a/graphql/env/src/merge.ts +++ b/graphql/env/src/merge.ts @@ -1,6 +1,7 @@ -import deepmerge from 'deepmerge'; -import { ConstructiveOptions, constructiveGraphqlDefaults } from '@constructive-io/graphql-types'; +import { constructiveGraphqlDefaults,ConstructiveOptions } from '@constructive-io/graphql-types'; import { getEnvOptions as getPgpmEnvOptions, loadConfigSync } from '@pgpmjs/env'; +import deepmerge from 'deepmerge'; + import { getGraphQLEnvVars } from './env'; /** diff --git a/graphql/explorer/src/server.ts b/graphql/explorer/src/server.ts index 47bc2a4d8..a223d5bef 100644 --- a/graphql/explorer/src/server.ts +++ b/graphql/explorer/src/server.ts @@ -1,7 +1,7 @@ import { getEnvOptions } from '@constructive-io/graphql-env'; +import { middleware as parseDomains } from '@constructive-io/url-domains'; import { cors, healthz, poweredBy } from '@pgpmjs/server-utils'; import { PgpmOptions } from '@pgpmjs/types'; -import { middleware as parseDomains } from '@constructive-io/url-domains'; import express, { Express, NextFunction, Request, Response } from 'express'; import { GraphileCache, graphileCache } from 'graphile-cache'; import graphqlUpload from 'graphql-upload'; diff --git a/graphql/explorer/src/settings.ts b/graphql/explorer/src/settings.ts index bb3cbbef8..1da2b6964 100644 --- a/graphql/explorer/src/settings.ts +++ b/graphql/explorer/src/settings.ts @@ -1,5 +1,5 @@ -import { ConstructiveOptions } from '@constructive-io/graphql-types'; import { getEnvOptions } from '@constructive-io/graphql-env'; +import { ConstructiveOptions } from '@constructive-io/graphql-types'; import { getGraphileSettings as getSettings } from 'graphile-settings'; import { PostGraphileOptions } from 'postgraphile'; diff --git a/graphql/react/__tests__/basic.test.tsx b/graphql/react/__tests__/basic.test.tsx index d0090efc6..681218ba8 100644 --- a/graphql/react/__tests__/basic.test.tsx +++ b/graphql/react/__tests__/basic.test.tsx @@ -1,16 +1,18 @@ // @ts-nocheck jest.setTimeout(20000); -import React from 'react'; -import { render, cleanup } from '@testing-library/react'; import '@testing-library/jest-dom/extend-expect'; + +import { cleanup,render } from '@testing-library/react'; +import React from 'react'; +import { QueryClient,QueryClientProvider } from 'react-query'; +import { useQuery } from 'react-query'; + import { LqlProvider, - useGraphqlClient, useConstructiveQuery, + useGraphqlClient, useTableRowsPaginated } from '../src'; -import { QueryClientProvider, QueryClient } from 'react-query'; -import { useQuery } from 'react-query'; const TESTING_URL = process.env.TESTING_URL; if (!TESTING_URL) { diff --git a/graphql/react/src/index.ts b/graphql/react/src/index.ts index 6f9f53c06..87b02526a 100644 --- a/graphql/react/src/index.ts +++ b/graphql/react/src/index.ts @@ -1,7 +1,7 @@ -export * from './use-graphql-client'; +export * from './context'; +export * from './provider'; export * from './use-constructive-client'; +export * from './use-graphql-client'; export * from './use-introspection'; export * from './use-schema-meta'; export * from './use-table-rows'; -export * from './provider'; -export * from './context'; diff --git a/graphql/react/src/provider.tsx b/graphql/react/src/provider.tsx index c78d51090..f593acae7 100644 --- a/graphql/react/src/provider.tsx +++ b/graphql/react/src/provider.tsx @@ -1,5 +1,6 @@ // @ts-nocheck import React from 'react'; + import { getLqlContext } from './context'; export const LqlProvider = ({ endpointUrl, children }) => { diff --git a/graphql/react/src/use-constructive-client.ts b/graphql/react/src/use-constructive-client.ts index 6f6451b48..0a9882db6 100644 --- a/graphql/react/src/use-constructive-client.ts +++ b/graphql/react/src/use-constructive-client.ts @@ -1,5 +1,6 @@ +import { MetaObject,QueryBuilder } from '@constructive-io/graphql-query'; import { useMemo } from 'react'; -import { QueryBuilder, MetaObject } from '@constructive-io/graphql-query'; + import { useIntrospection } from './use-introspection'; import { useSchemaMeta } from './use-schema-meta'; diff --git a/graphql/react/src/use-graphql-client.ts b/graphql/react/src/use-graphql-client.ts index a1abe5d98..f3ca72ae0 100644 --- a/graphql/react/src/use-graphql-client.ts +++ b/graphql/react/src/use-graphql-client.ts @@ -1,6 +1,7 @@ // @ts-nocheck -import { useState, useMemo, useContext } from 'react'; import { GraphQLClient } from 'graphql-request'; +import { useContext,useMemo, useState } from 'react'; + import { getLqlContext } from './context'; export const useGraphqlClient = () => { diff --git a/graphql/react/src/use-introspection.ts b/graphql/react/src/use-introspection.ts index 97df5d7d5..5e835e663 100644 --- a/graphql/react/src/use-introspection.ts +++ b/graphql/react/src/use-introspection.ts @@ -1,7 +1,8 @@ -import { useEffect } from 'react'; -import { useQuery } from 'react-query'; // @ts-ignore import { IntrospectionQuery, parseGraphQuery } from 'introspectron'; +import { useEffect } from 'react'; +import { useQuery } from 'react-query'; + import { useGraphqlClient } from './use-graphql-client'; const noop = () => {}; diff --git a/graphql/react/src/use-schema-meta.ts b/graphql/react/src/use-schema-meta.ts index 8d6b1fdf6..937ca1ac8 100644 --- a/graphql/react/src/use-schema-meta.ts +++ b/graphql/react/src/use-schema-meta.ts @@ -1,7 +1,8 @@ // @ts-nocheck -import { useEffect } from 'react'; import { gql } from 'graphql-request'; +import { useEffect } from 'react'; import { useQuery } from 'react-query'; + import { useGraphqlClient } from './use-graphql-client'; const fieldFragment = ` diff --git a/graphql/react/src/use-table-rows.ts b/graphql/react/src/use-table-rows.ts index ef173bf00..68cc8b90d 100644 --- a/graphql/react/src/use-table-rows.ts +++ b/graphql/react/src/use-table-rows.ts @@ -1,13 +1,14 @@ // @ts-nocheck import { useMemo } from 'react'; import { - useQuery, useInfiniteQuery, useMutation, + useQuery, useQueryClient } from 'react-query'; -import { useGraphqlClient } from './use-graphql-client'; + import { useConstructiveQuery } from './use-constructive-client'; +import { useGraphqlClient } from './use-graphql-client'; const noop = () => {}; export function useTableRowsPaginated(options = {}) { diff --git a/graphql/server/__tests__/schema.test.ts b/graphql/server/__tests__/schema.test.ts index d8d09f0ea..6d003fb10 100644 --- a/graphql/server/__tests__/schema.test.ts +++ b/graphql/server/__tests__/schema.test.ts @@ -1,14 +1,14 @@ process.env.LOG_SCOPE = 'graphile-test'; -import { join } from 'path'; import express from 'express'; -import { postgraphile } from 'postgraphile'; // @ts-ignore import { getGraphileSettings } from 'graphile-settings'; +import { getConnections,seed } from 'graphile-test'; +import { join } from 'path'; import { getPgPool } from 'pg-cache'; +import { postgraphile } from 'postgraphile'; import { buildSchemaSDL, fetchEndpointSchemaSDL } from '../src/schema'; -import { seed, getConnections } from 'graphile-test'; jest.setTimeout(30000); diff --git a/graphql/server/src/index.ts b/graphql/server/src/index.ts index 466859838..d7dbc63cf 100644 --- a/graphql/server/src/index.ts +++ b/graphql/server/src/index.ts @@ -1,2 +1,2 @@ -export * from './server'; -export * from './schema'; \ No newline at end of file +export * from './schema'; +export * from './server'; \ No newline at end of file diff --git a/graphql/server/src/middleware/api.ts b/graphql/server/src/middleware/api.ts index 37648d153..dd946a310 100644 --- a/graphql/server/src/middleware/api.ts +++ b/graphql/server/src/middleware/api.ts @@ -1,3 +1,5 @@ +import './types'; // for Request type + import { getNodeEnv } from '@constructive-io/graphql-env'; import { svcCache } from '@pgpmjs/server-utils'; import { PgpmOptions } from '@pgpmjs/types'; @@ -14,7 +16,6 @@ import errorPage404Message from '../errors/404-message'; */ import { ApiStructure, Domain, SchemaNode, Service, Site } from '../types'; import { ApiByNameQuery, ApiQuery, ListOfAllDomainsOfDb } from './gql'; -import './types'; // for Request type const transformServiceToApi = (svc: Service): ApiStructure => { const api = svc.data.api; diff --git a/graphql/server/src/middleware/auth.ts b/graphql/server/src/middleware/auth.ts index f5a907b1d..4d7c7813b 100644 --- a/graphql/server/src/middleware/auth.ts +++ b/graphql/server/src/middleware/auth.ts @@ -1,8 +1,9 @@ +import './types'; // for Request type + import { PgpmOptions } from '@pgpmjs/types'; import { NextFunction, Request, RequestHandler, Response } from 'express'; import { getPgPool } from 'pg-cache'; import pgQueryContext from 'pg-query-context'; -import './types'; // for Request type export const createAuthenticateMiddleware = ( opts: PgpmOptions diff --git a/graphql/server/src/middleware/cors.ts b/graphql/server/src/middleware/cors.ts index f7980f72f..00564d320 100644 --- a/graphql/server/src/middleware/cors.ts +++ b/graphql/server/src/middleware/cors.ts @@ -1,8 +1,10 @@ +import './types'; // for Request type + import { parseUrl } from '@constructive-io/url-domains'; import corsPlugin from 'cors'; import type { Request, RequestHandler } from 'express'; + import { CorsModuleData } from '../types'; -import './types'; // for Request type /** * Unified CORS middleware for Constructive API diff --git a/graphql/server/src/middleware/flush.ts b/graphql/server/src/middleware/flush.ts index bf7bb79c3..6b493a521 100644 --- a/graphql/server/src/middleware/flush.ts +++ b/graphql/server/src/middleware/flush.ts @@ -1,10 +1,11 @@ +import './types'; // for Request type + import { ConstructiveOptions } from '@constructive-io/graphql-types'; import { Logger } from '@pgpmjs/logger'; import { svcCache } from '@pgpmjs/server-utils'; import { NextFunction,Request, Response } from 'express'; import { graphileCache } from 'graphile-cache'; import { getPgPool } from 'pg-cache'; -import './types'; // for Request type const log = new Logger('flush'); diff --git a/graphql/server/src/middleware/graphile.ts b/graphql/server/src/middleware/graphile.ts index 5ac769791..b11a87164 100644 --- a/graphql/server/src/middleware/graphile.ts +++ b/graphql/server/src/middleware/graphile.ts @@ -1,3 +1,5 @@ +import './types'; // for Request type + import { ConstructiveOptions } from '@constructive-io/graphql-types'; import { NextFunction, Request, RequestHandler, Response } from 'express'; import { graphileCache } from 'graphile-cache'; @@ -5,7 +7,6 @@ import { getGraphileSettings as getSettings } from 'graphile-settings'; import type { IncomingMessage } from 'http'; import { getPgPool } from 'pg-cache'; import { postgraphile, PostGraphileOptions } from 'postgraphile'; -import './types'; // for Request type import PublicKeySignature, { PublicKeyChallengeConfig, diff --git a/graphql/server/src/schema.ts b/graphql/server/src/schema.ts index 1f02f6067..2c6cd3e01 100644 --- a/graphql/server/src/schema.ts +++ b/graphql/server/src/schema.ts @@ -1,9 +1,10 @@ -import { printSchema, GraphQLSchema, getIntrospectionQuery, buildClientSchema } from 'graphql' +import * as http from 'node:http' +import * as https from 'node:https' + import { getGraphileSettings } from 'graphile-settings' +import { buildClientSchema,getIntrospectionQuery, GraphQLSchema, printSchema } from 'graphql' import { getPgPool } from 'pg-cache' import { createPostGraphileSchema, PostGraphileOptions } from 'postgraphile' -import * as http from 'node:http' -import * as https from 'node:https' export type BuildSchemaOptions = { database?: string; diff --git a/graphql/server/src/scripts/create-bucket.ts b/graphql/server/src/scripts/create-bucket.ts index 8b2272220..79a9e5a57 100644 --- a/graphql/server/src/scripts/create-bucket.ts +++ b/graphql/server/src/scripts/create-bucket.ts @@ -2,8 +2,8 @@ // Avoid strict type coupling between different @aws-sdk/client-s3 versions import { S3Client } from '@aws-sdk/client-s3'; -import { createS3Bucket } from '@constructive-io/s3-utils'; import { getEnvOptions } from '@constructive-io/graphql-env'; +import { createS3Bucket } from '@constructive-io/s3-utils'; (async () => { try { diff --git a/graphql/server/src/server.ts b/graphql/server/src/server.ts index aa64a778f..bec332c95 100644 --- a/graphql/server/src/server.ts +++ b/graphql/server/src/server.ts @@ -1,8 +1,8 @@ import { getEnvOptions } from '@constructive-io/graphql-env'; +import { middleware as parseDomains } from '@constructive-io/url-domains'; import { Logger } from '@pgpmjs/logger'; import { healthz, poweredBy, trustProxy } from '@pgpmjs/server-utils'; import { PgpmOptions } from '@pgpmjs/types'; -import { middleware as parseDomains } from '@constructive-io/url-domains'; import express, { Express, RequestHandler } from 'express'; // @ts-ignore import graphqlUpload from 'graphql-upload'; diff --git a/graphql/test/__tests__/graphile-test.graphile-tx.test.ts b/graphql/test/__tests__/graphile-test.graphile-tx.test.ts index 2ce421db8..82ad030b2 100644 --- a/graphql/test/__tests__/graphile-test.graphile-tx.test.ts +++ b/graphql/test/__tests__/graphile-test.graphile-tx.test.ts @@ -1,13 +1,13 @@ process.env.LOG_SCOPE = 'graphile-test'; +import type { GraphQLQueryFn } from 'graphile-test'; import gql from 'graphql-tag'; import { join } from 'path'; import { seed } from 'pgsql-test'; import type { PgTestClient } from 'pgsql-test/test-client'; -import { snapshot } from '../src/utils'; import { getConnections } from '../src/get-connections'; -import type { GraphQLQueryFn } from 'graphile-test'; +import { snapshot } from '../src/utils'; import { logDbSessionInfo } from '../test-utils/utils'; const schemas = ['app_public']; diff --git a/graphql/test/__tests__/graphile-test.graphql.test.ts b/graphql/test/__tests__/graphile-test.graphql.test.ts index 5570584b4..247615f29 100644 --- a/graphql/test/__tests__/graphile-test.graphql.test.ts +++ b/graphql/test/__tests__/graphile-test.graphql.test.ts @@ -1,13 +1,13 @@ process.env.LOG_SCOPE = 'graphile-test'; +import type { GraphQLQueryFn } from 'graphile-test'; import gql from 'graphql-tag'; import { join } from 'path'; import { seed } from 'pgsql-test'; import type { PgTestClient } from 'pgsql-test/test-client'; -import { snapshot } from '../src/utils'; import { getConnections } from '../src/get-connections'; -import type { GraphQLQueryFn } from 'graphile-test'; +import { snapshot } from '../src/utils'; import { logDbSessionInfo } from '../test-utils/utils'; const schemas = ['app_public']; diff --git a/graphql/test/__tests__/graphile-test.plugins.test.ts b/graphql/test/__tests__/graphile-test.plugins.test.ts index 7318863a8..9fd216f62 100644 --- a/graphql/test/__tests__/graphile-test.plugins.test.ts +++ b/graphql/test/__tests__/graphile-test.plugins.test.ts @@ -1,12 +1,12 @@ process.env.LOG_SCOPE = 'graphile-test'; +import type { GraphQLQueryFn } from 'graphile-test'; import gql from 'graphql-tag'; import { join } from 'path'; import { seed } from 'pgsql-test'; import type { PgTestClient } from 'pgsql-test/test-client'; import { getConnections } from '../src/get-connections'; -import type { GraphQLQueryFn } from 'graphile-test'; import { IntrospectionQuery } from '../test-utils/queries'; const schemas = ['app_public']; diff --git a/graphql/test/__tests__/graphile-test.roles.test.ts b/graphql/test/__tests__/graphile-test.roles.test.ts index 1b45bba95..755708c0d 100644 --- a/graphql/test/__tests__/graphile-test.roles.test.ts +++ b/graphql/test/__tests__/graphile-test.roles.test.ts @@ -1,13 +1,13 @@ process.env.LOG_SCOPE = 'graphile-test'; +import type { GraphQLQueryFn } from 'graphile-test'; import gql from 'graphql-tag'; import { join } from 'path'; import { seed } from 'pgsql-test'; import type { PgTestClient } from 'pgsql-test/test-client'; -import { snapshot } from '../src/utils'; import { getConnections } from '../src/get-connections'; -import type { GraphQLQueryFn } from 'graphile-test'; +import { snapshot } from '../src/utils'; import { logDbSessionInfo } from '../test-utils/utils'; const schemas = ['app_public']; diff --git a/graphql/test/__tests__/graphile-test.test.ts b/graphql/test/__tests__/graphile-test.test.ts index 087e8cc33..62bbed1b7 100644 --- a/graphql/test/__tests__/graphile-test.test.ts +++ b/graphql/test/__tests__/graphile-test.test.ts @@ -1,12 +1,12 @@ process.env.LOG_SCOPE = 'graphile-test'; +import type { GraphQLQueryFn } from 'graphile-test'; import { join } from 'path'; import { seed } from 'pgsql-test'; import type { PgTestClient } from 'pgsql-test/test-client'; -import { snapshot } from '../src/utils'; import { getConnections } from '../src/get-connections'; -import type { GraphQLQueryFn } from 'graphile-test'; +import { snapshot } from '../src/utils'; import { IntrospectionQuery } from '../test-utils/queries'; import { logDbSessionInfo } from '../test-utils/utils'; diff --git a/graphql/test/__tests__/graphile-test.types.positional.test.ts b/graphql/test/__tests__/graphile-test.types.positional.test.ts index f4c94afe4..c4571c6f8 100644 --- a/graphql/test/__tests__/graphile-test.types.positional.test.ts +++ b/graphql/test/__tests__/graphile-test.types.positional.test.ts @@ -1,12 +1,12 @@ process.env.LOG_SCOPE = 'graphile-test'; +import type { GraphQLQueryFn } from 'graphile-test'; import { join } from 'path'; import { seed } from 'pgsql-test'; import type { PgTestClient } from 'pgsql-test/test-client'; -import { snapshot } from '../src/utils'; import { getConnections } from '../src/get-connections'; -import type { GraphQLQueryFn } from 'graphile-test'; +import { snapshot } from '../src/utils'; const schemas = ['app_public']; const sql = (f: string) => join(__dirname, '/../sql', f); diff --git a/graphql/test/__tests__/graphile-test.types.positional.unwrapped.test.ts b/graphql/test/__tests__/graphile-test.types.positional.unwrapped.test.ts index d39136f2f..8dd1f8443 100644 --- a/graphql/test/__tests__/graphile-test.types.positional.unwrapped.test.ts +++ b/graphql/test/__tests__/graphile-test.types.positional.unwrapped.test.ts @@ -1,12 +1,12 @@ process.env.LOG_SCOPE = 'graphile-test'; +import type { GraphQLQueryUnwrappedFn } from 'graphile-test'; import { join } from 'path'; import { seed } from 'pgsql-test'; import type { PgTestClient } from 'pgsql-test/test-client'; -import { snapshot } from '../src/utils'; import { getConnectionsUnwrapped } from '../src/get-connections'; -import type { GraphQLQueryUnwrappedFn } from 'graphile-test'; +import { snapshot } from '../src/utils'; const schemas = ['app_public']; const sql = (f: string) => join(__dirname, '/../sql', f); diff --git a/graphql/test/__tests__/graphile-test.types.test.ts b/graphql/test/__tests__/graphile-test.types.test.ts index 938b84a68..b91149b01 100644 --- a/graphql/test/__tests__/graphile-test.types.test.ts +++ b/graphql/test/__tests__/graphile-test.types.test.ts @@ -1,12 +1,12 @@ process.env.LOG_SCOPE = 'graphile-test'; +import type { GraphQLQueryFnObj } from 'graphile-test'; import { join } from 'path'; import { seed } from 'pgsql-test'; import type { PgTestClient } from 'pgsql-test/test-client'; -import { snapshot } from '../src/utils'; import { getConnectionsObject } from '../src/get-connections'; -import type { GraphQLQueryFnObj } from 'graphile-test'; +import { snapshot } from '../src/utils'; const schemas = ['app_public']; const sql = (f: string) => join(__dirname, '/../sql', f); diff --git a/graphql/test/__tests__/graphile-test.types.unwrapped.test.ts b/graphql/test/__tests__/graphile-test.types.unwrapped.test.ts index e1975aa64..42a52b961 100644 --- a/graphql/test/__tests__/graphile-test.types.unwrapped.test.ts +++ b/graphql/test/__tests__/graphile-test.types.unwrapped.test.ts @@ -1,12 +1,12 @@ process.env.LOG_SCOPE = 'graphile-test'; +import type { GraphQLQueryUnwrappedFnObj } from 'graphile-test'; import { join } from 'path'; import { seed } from 'pgsql-test'; import type { PgTestClient } from 'pgsql-test/test-client'; -import { snapshot } from '../src/utils'; import { getConnectionsObjectUnwrapped } from '../src/get-connections'; -import type { GraphQLQueryUnwrappedFnObj } from 'graphile-test'; +import { snapshot } from '../src/utils'; const schemas = ['app_public']; const sql = (f: string) => join(__dirname, '/../sql', f); diff --git a/graphql/test/src/get-connections.ts b/graphql/test/src/get-connections.ts index d72ed2e47..d5e072e61 100644 --- a/graphql/test/src/get-connections.ts +++ b/graphql/test/src/get-connections.ts @@ -1,9 +1,3 @@ -import type { GetConnectionOpts, GetConnectionResult } from 'pgsql-test'; -import { getConnections as getPgConnections } from 'pgsql-test'; -import type { SeedAdapter } from 'pgsql-test/seed/types'; -import type { PgTestClient } from 'pgsql-test/test-client'; - -import { GraphQLTest } from './graphile-test'; import type { GetConnectionsInput, GraphQLQueryFn, @@ -13,6 +7,12 @@ import type { GraphQLQueryUnwrappedFnObj, GraphQLResponse } from 'graphile-test'; +import type { GetConnectionOpts, GetConnectionResult } from 'pgsql-test'; +import { getConnections as getPgConnections } from 'pgsql-test'; +import type { SeedAdapter } from 'pgsql-test/seed/types'; +import type { PgTestClient } from 'pgsql-test/test-client'; + +import { GraphQLTest } from './graphile-test'; // Core unwrapping utility const unwrap = (res: GraphQLResponse): T => { diff --git a/graphql/test/src/graphile-test.ts b/graphql/test/src/graphile-test.ts index 7cae97231..e3c52de8a 100644 --- a/graphql/test/src/graphile-test.ts +++ b/graphql/test/src/graphile-test.ts @@ -1,9 +1,9 @@ -import type { GraphQLQueryOptions, GraphQLTestContext, GetConnectionsInput } from 'graphile-test'; import { getGraphileSettings } from 'graphile-settings'; +import type { GetConnectionsInput,GraphQLQueryOptions, GraphQLTestContext } from 'graphile-test'; +import { runGraphQLInContext } from 'graphile-test/context'; import type { GraphQLSchema } from 'graphql'; import type { GetConnectionOpts, GetConnectionResult } from 'pgsql-test'; import { createPostGraphileSchema, PostGraphileOptions } from 'postgraphile'; -import { runGraphQLInContext } from 'graphile-test/context'; export const GraphQLTest = ( input: GetConnectionsInput & GetConnectionOpts, diff --git a/graphql/test/src/index.ts b/graphql/test/src/index.ts index dbea2fa5e..5b7de8640 100644 --- a/graphql/test/src/index.ts +++ b/graphql/test/src/index.ts @@ -1,16 +1,16 @@ // Re-export types and utilities from graphile-test (but not get-connections functions) export { - type GraphQLQueryOptions, - type GraphQLTestContext, type GetConnectionsInput, - type GraphQLResponse, type GraphQLQueryFn, type GraphQLQueryFnObj, + type GraphQLQueryOptions, type GraphQLQueryUnwrappedFn, type GraphQLQueryUnwrappedFnObj, + type GraphQLResponse, + type GraphQLTestContext, } from 'graphile-test'; // Override with our custom implementations that use graphile-settings -export { GraphQLTest } from './graphile-test'; export * from './get-connections'; +export { GraphQLTest } from './graphile-test'; export { seed, snapshot } from 'pgsql-test'; \ No newline at end of file diff --git a/graphql/types/src/constructive.ts b/graphql/types/src/constructive.ts index 4a5ce4c52..c9d5adb75 100644 --- a/graphql/types/src/constructive.ts +++ b/graphql/types/src/constructive.ts @@ -1,23 +1,22 @@ -import deepmerge from 'deepmerge'; -import { PgConfig } from 'pg-env'; import { - PgpmOptions, - pgpmDefaults, - PgTestConnectionOptions, - DeploymentOptions, - ServerOptions, CDNOptions, + DeploymentOptions, + JobsConfig, MigrationOptions, - JobsConfig -} from '@pgpmjs/types'; + pgpmDefaults, + PgpmOptions, + PgTestConnectionOptions, + ServerOptions} from '@pgpmjs/types'; +import deepmerge from 'deepmerge'; +import { PgConfig } from 'pg-env'; + import { - GraphileOptions, - GraphileFeatureOptions, + apiDefaults, ApiOptions, graphileDefaults, graphileFeatureDefaults, - apiDefaults -} from './graphile'; + GraphileFeatureOptions, + GraphileOptions} from './graphile'; /** * GraphQL-specific options for Constructive diff --git a/graphql/types/src/index.ts b/graphql/types/src/index.ts index 135921df2..c725317c9 100644 --- a/graphql/types/src/index.ts +++ b/graphql/types/src/index.ts @@ -3,18 +3,16 @@ export * from '@pgpmjs/types'; // Export GraphQL/Graphile specific types export { - GraphileOptions, - GraphileFeatureOptions, + apiDefaults, ApiOptions, graphileDefaults, graphileFeatureDefaults, - apiDefaults -} from './graphile'; + GraphileFeatureOptions, + GraphileOptions} from './graphile'; // Export Constructive combined types export { - ConstructiveGraphQLOptions, - ConstructiveOptions, + constructiveDefaults, constructiveGraphqlDefaults, - constructiveDefaults -} from './constructive'; + ConstructiveGraphQLOptions, + ConstructiveOptions} from './constructive'; diff --git a/jobs/job-pg/src/index.ts b/jobs/job-pg/src/index.ts index 45e41aa20..b5552c120 100644 --- a/jobs/job-pg/src/index.ts +++ b/jobs/job-pg/src/index.ts @@ -1,7 +1,7 @@ -/* eslint-disable no-console */ + -import { Pool, PoolConfig } from 'pg'; import { getJobPgConfig } from '@constructive-io/job-utils'; +import { Pool, PoolConfig } from 'pg'; // k8s only does SIGINT // other events are bad for babel-watch diff --git a/jobs/job-scheduler/src/index.ts b/jobs/job-scheduler/src/index.ts index a3d8df160..93befd8d8 100644 --- a/jobs/job-scheduler/src/index.ts +++ b/jobs/job-scheduler/src/index.ts @@ -1,9 +1,9 @@ -import * as jobs from '@constructive-io/job-utils'; +import poolManager from '@constructive-io/job-pg'; import type { PgClientLike } from '@constructive-io/job-utils'; +import * as jobs from '@constructive-io/job-utils'; +import { Logger } from '@pgpmjs/logger'; import schedule from 'node-schedule'; -import poolManager from '@constructive-io/job-pg'; import type { Pool, PoolClient } from 'pg'; -import { Logger } from '@pgpmjs/logger'; export interface ScheduledJobRow { id: number | string; diff --git a/jobs/job-scheduler/src/run.ts b/jobs/job-scheduler/src/run.ts index ae4bda1f8..3b4bf22e5 100644 --- a/jobs/job-scheduler/src/run.ts +++ b/jobs/job-scheduler/src/run.ts @@ -1,11 +1,11 @@ #!/usr/bin/env node -import Scheduler from './index'; import poolManager from '@constructive-io/job-pg'; import { - getSchedulerHostname, - getJobSupported -} from '@constructive-io/job-utils'; + getJobSupported, + getSchedulerHostname} from '@constructive-io/job-utils'; + +import Scheduler from './index'; const pgPool = poolManager.getPool(); diff --git a/jobs/job-utils/src/index.ts b/jobs/job-utils/src/index.ts index ab8b70f04..c3b92197a 100644 --- a/jobs/job-utils/src/index.ts +++ b/jobs/job-utils/src/index.ts @@ -1,30 +1,27 @@ +import { Logger } from '@pgpmjs/logger'; import type { - FailJobParams, CompleteJobParams, + FailJobParams, GetJobParams, GetScheduledJobParams, - RunScheduledJobParams, + ReleaseJobsParams, ReleaseScheduledJobsParams, - ReleaseJobsParams -} from '@pgpmjs/types'; + RunScheduledJobParams} from '@pgpmjs/types'; import { - getJobSchema, + getCallbackBaseUrl, + getJobConnectionString, + getJobGatewayConfig, + getJobGatewayDevMap, getJobPgConfig, getJobPool, - getJobConnectionString, + getJobsCallbackPort, + getJobSchema, getJobSupportAny, getJobSupported, - getWorkerHostname, + getNodeEnvironment, getSchedulerHostname, - getJobGatewayConfig, - getJobGatewayDevMap, - getJobsCallbackPort, - getCallbackBaseUrl, - getNodeEnvironment -} from './runtime'; - -import { Logger } from '@pgpmjs/logger'; + getWorkerHostname} from './runtime'; const log = new Logger('jobs:core'); @@ -33,20 +30,19 @@ export type PgClientLike = { }; export { - getJobSchema, + getCallbackBaseUrl, + getJobConnectionString, + getJobGatewayConfig, + getJobGatewayDevMap, getJobPgConfig, getJobPool, - getJobConnectionString, + getJobsCallbackPort, + getJobSchema, getJobSupportAny, getJobSupported, - getWorkerHostname, + getNodeEnvironment, getSchedulerHostname, - getJobGatewayConfig, - getJobGatewayDevMap, - getJobsCallbackPort, - getCallbackBaseUrl, - getNodeEnvironment -}; + getWorkerHostname}; const JOBS_SCHEMA = getJobSchema(); diff --git a/jobs/job-utils/src/runtime.ts b/jobs/job-utils/src/runtime.ts index 689d14bbe..d91853e1c 100644 --- a/jobs/job-utils/src/runtime.ts +++ b/jobs/job-utils/src/runtime.ts @@ -1,9 +1,9 @@ import { getEnvOptions, getNodeEnv, parseEnvBoolean } from '@pgpmjs/env'; -import { defaultPgConfig, getPgEnvVars, type PgConfig } from 'pg-env'; -import { getPgPool } from 'pg-cache'; -import type { Pool } from 'pg'; import type { PgpmOptions } from '@pgpmjs/types'; import { jobsDefaults } from '@pgpmjs/types'; +import type { Pool } from 'pg'; +import { getPgPool } from 'pg-cache'; +import { defaultPgConfig, getPgEnvVars, type PgConfig } from 'pg-env'; type Maybe = T | null | undefined; diff --git a/jobs/job-worker/src/index.ts b/jobs/job-worker/src/index.ts index 6e3598e00..20dacff53 100644 --- a/jobs/job-worker/src/index.ts +++ b/jobs/job-worker/src/index.ts @@ -1,7 +1,7 @@ -import pg from 'pg'; -import type { Pool, PoolClient } from 'pg'; -import * as jobs from '@constructive-io/job-utils'; import type { PgClientLike } from '@constructive-io/job-utils'; +import * as jobs from '@constructive-io/job-utils'; +import type { Pool, PoolClient } from 'pg'; +import pg from 'pg'; const pgPoolConfig = { connectionString: jobs.getJobConnectionString() @@ -37,7 +37,7 @@ export type TaskHandler = ( job: JobRow ) => Promise | void; -/* eslint-disable no-console */ + export default class Worker { tasks: Record; diff --git a/jobs/job-worker/src/run.ts b/jobs/job-worker/src/run.ts index 358d44938..2581fa130 100644 --- a/jobs/job-worker/src/run.ts +++ b/jobs/job-worker/src/run.ts @@ -1,4 +1,4 @@ -import Worker, { WorkerContext, JobRow } from './index'; +import Worker, { JobRow,WorkerContext } from './index'; const worker = new Worker({ tasks: { diff --git a/jobs/knative-job-fn/src/index.ts b/jobs/knative-job-fn/src/index.ts index 77befd2b1..76490b302 100644 --- a/jobs/knative-job-fn/src/index.ts +++ b/jobs/knative-job-fn/src/index.ts @@ -1,9 +1,10 @@ -import express from 'express'; -import bodyParser from 'body-parser'; import http from 'node:http'; import https from 'node:https'; import { URL } from 'node:url'; +import bodyParser from 'body-parser'; +import express from 'express'; + type JobCallbackStatus = 'success' | 'error'; type JobContext = { @@ -43,7 +44,7 @@ app.use((req: any, res: any, next: any) => { body = undefined; } - // eslint-disable-next-line no-console + console.log('[knative-job-fn] Incoming job request', { method: req.method, path: req.originalUrl || req.url, @@ -152,7 +153,7 @@ const sendJobCallback = async ( } try { - // eslint-disable-next-line no-console + console.log('[knative-job-fn] Sending job callback', { status, target: normalizeCallbackUrl(callbackUrl), @@ -162,7 +163,7 @@ const sendJobCallback = async ( }); await postJson(target, headers, body); } catch (err) { - // eslint-disable-next-line no-console + console.error('[knative-job-fn] Failed to POST job callback', { target, status, @@ -190,7 +191,7 @@ app.use((req: any, res: any, next: any) => { // If an error handler already sent a callback, skip. if (res.locals.jobCallbackSent) return; res.locals.jobCallbackSent = true; - // eslint-disable-next-line no-console + console.log('[knative-job-fn] Function completed', { workerId: ctx.workerId, jobId: ctx.jobId, @@ -212,7 +213,7 @@ export default { // NOTE Remember that Express middleware executes in order. // You should define error handlers last, after all other middleware. // Otherwise, your error handler won't get called - // eslint-disable-next-line no-unused-vars + app.use(async (error: any, req: any, res: any, next: any) => { res.set({ 'Content-Type': 'application/json', @@ -227,7 +228,7 @@ export default { await sendJobCallback(ctx, 'error', error?.message); } } catch (err) { - // eslint-disable-next-line no-console + console.error('[knative-job-fn] Failed to send error callback', err); } @@ -251,7 +252,7 @@ export default { }; } - // eslint-disable-next-line no-console + console.error('[knative-job-fn] Function error', { headers, path: req.originalUrl || req.url, diff --git a/jobs/knative-job-server/src/index.ts b/jobs/knative-job-server/src/index.ts index 10109a871..21cc5c973 100644 --- a/jobs/knative-job-server/src/index.ts +++ b/jobs/knative-job-server/src/index.ts @@ -1,8 +1,8 @@ -import express from 'express'; +import poolManager from '@constructive-io/job-pg'; +import * as jobs from '@constructive-io/job-utils'; import bodyParser from 'body-parser'; +import express from 'express'; import type { Pool, PoolClient } from 'pg'; -import * as jobs from '@constructive-io/job-utils'; -import poolManager from '@constructive-io/job-pg'; type JobRequestBody = { message?: string; diff --git a/jobs/knative-job-server/src/run.ts b/jobs/knative-job-server/src/run.ts index 5eed56f4e..b9550d809 100755 --- a/jobs/knative-job-server/src/run.ts +++ b/jobs/knative-job-server/src/run.ts @@ -1,13 +1,14 @@ #!/usr/bin/env node -import server from './index'; import poolManager from '@constructive-io/job-pg'; import { getJobsCallbackPort } from '@constructive-io/job-utils'; +import server from './index'; + const pgPool = poolManager.getPool(); const port = getJobsCallbackPort(); server(pgPool).listen(port, () => { - // eslint-disable-next-line no-console + console.log(`listening ON ${port}`); }); diff --git a/jobs/knative-job-service/src/run.ts b/jobs/knative-job-service/src/run.ts index 33caf9737..7153731bd 100755 --- a/jobs/knative-job-service/src/run.ts +++ b/jobs/knative-job-service/src/run.ts @@ -1,29 +1,29 @@ #!/usr/bin/env node -import Scheduler from '@constructive-io/job-scheduler'; -import Worker from '@constructive-io/knative-job-worker'; -import server from '@constructive-io/knative-job-server'; import poolManager from '@constructive-io/job-pg'; -import { Client } from 'pg'; -import retry from 'async-retry'; +import Scheduler from '@constructive-io/job-scheduler'; import { getJobPgConfig, + getJobsCallbackPort, getJobSchema, + getJobSupported, getSchedulerHostname, getWorkerHostname, - getJobSupported, - getJobsCallbackPort, } from '@constructive-io/job-utils'; +import server from '@constructive-io/knative-job-server'; +import Worker from '@constructive-io/knative-job-worker'; +import retry from 'async-retry'; +import { Client } from 'pg'; export const startJobsServices = () => { - // eslint-disable-next-line no-console + console.log('starting jobs services...'); const pgPool = poolManager.getPool(); const app = server(pgPool); const callbackPort = getJobsCallbackPort(); const httpServer = app.listen(callbackPort, () => { - // eslint-disable-next-line no-console + console.log(`[cb] listening ON ${callbackPort}`); const tasks = getJobSupported(); @@ -48,7 +48,7 @@ export const startJobsServices = () => { }; export const waitForJobsPrereqs = async (): Promise => { - // eslint-disable-next-line no-console + console.log('waiting for jobs prereqs'); let client: Client | null = null; try { @@ -64,7 +64,7 @@ export const waitForJobsPrereqs = async (): Promise => { const schema = getJobSchema(); await client.query(`SELECT * FROM "${schema}".jobs LIMIT 1;`); } catch (error) { - // eslint-disable-next-line no-console + console.log(error); throw new Error('jobs server boot failed...'); } finally { @@ -75,7 +75,7 @@ export const waitForJobsPrereqs = async (): Promise => { }; export const bootJobs = async (): Promise => { - // eslint-disable-next-line no-console + console.log('attempting to boot jobs'); await retry( async () => { diff --git a/jobs/knative-job-worker/__tests__/worker.integration.test.ts b/jobs/knative-job-worker/__tests__/worker.integration.test.ts index 68ceff214..82f9b931c 100644 --- a/jobs/knative-job-worker/__tests__/worker.integration.test.ts +++ b/jobs/knative-job-worker/__tests__/worker.integration.test.ts @@ -21,10 +21,11 @@ jest.mock('@constructive-io/job-pg', () => ({ } })); +import * as jobUtils from '@constructive-io/job-utils'; import path from 'path'; import { getConnections, seed } from 'pgsql-test'; import type { PgTestClient } from 'pgsql-test/test-client'; -import * as jobUtils from '@constructive-io/job-utils'; + import Worker from '../src'; let db: PgTestClient; diff --git a/jobs/knative-job-worker/src/index.ts b/jobs/knative-job-worker/src/index.ts index 6599aab29..9547b87d9 100644 --- a/jobs/knative-job-worker/src/index.ts +++ b/jobs/knative-job-worker/src/index.ts @@ -1,8 +1,9 @@ import poolManager from '@constructive-io/job-pg'; -import * as jobs from '@constructive-io/job-utils'; import type { PgClientLike } from '@constructive-io/job-utils'; -import type { Pool, PoolClient } from 'pg'; +import * as jobs from '@constructive-io/job-utils'; import { Logger } from '@pgpmjs/logger'; +import type { Pool, PoolClient } from 'pg'; + import { request as req } from './req'; export interface JobRow { diff --git a/jobs/knative-job-worker/src/req.ts b/jobs/knative-job-worker/src/req.ts index 0fe4e63a5..af3b79a41 100644 --- a/jobs/knative-job-worker/src/req.ts +++ b/jobs/knative-job-worker/src/req.ts @@ -1,4 +1,3 @@ -import requestLib from 'request'; import { getCallbackBaseUrl, getJobGatewayConfig, @@ -6,6 +5,7 @@ import { getNodeEnvironment } from '@constructive-io/job-utils'; import { Logger } from '@pgpmjs/logger'; +import requestLib from 'request'; const log = new Logger('jobs:req'); diff --git a/jobs/knative-job-worker/src/run.ts b/jobs/knative-job-worker/src/run.ts index 3b2668b29..538b8e61c 100755 --- a/jobs/knative-job-worker/src/run.ts +++ b/jobs/knative-job-worker/src/run.ts @@ -1,11 +1,11 @@ #!/usr/bin/env node -import Worker from './index'; import poolManager from '@constructive-io/job-pg'; import { - getWorkerHostname, - getJobSupported -} from '@constructive-io/job-utils'; + getJobSupported, + getWorkerHostname} from '@constructive-io/job-utils'; + +import Worker from './index'; const pgPool = poolManager.getPool(); diff --git a/packages/cli/__tests__/codegen.test.ts b/packages/cli/__tests__/codegen.test.ts index e6e32ad67..e9d645330 100644 --- a/packages/cli/__tests__/codegen.test.ts +++ b/packages/cli/__tests__/codegen.test.ts @@ -1,5 +1,6 @@ -import path from 'path' import type { ParsedArgs } from 'minimist' +import path from 'path' + import codegenCommand from '../src/commands/codegen' jest.mock('@constructive-io/graphql-codegen', () => { diff --git a/packages/cli/__tests__/get-graphql-schema.test.ts b/packages/cli/__tests__/get-graphql-schema.test.ts index 587ddfa27..7bd818a49 100644 --- a/packages/cli/__tests__/get-graphql-schema.test.ts +++ b/packages/cli/__tests__/get-graphql-schema.test.ts @@ -1,6 +1,7 @@ import fs from 'fs'; import os from 'os'; import path from 'path'; + import runGetGraphqlSchema from '../src/commands/get-graphql-schema'; jest.mock('@constructive-io/graphql-server', () => ({ diff --git a/packages/cli/__tests__/init.templates.test.ts b/packages/cli/__tests__/init.templates.test.ts index 237ef63ae..8c02d5f3d 100644 --- a/packages/cli/__tests__/init.templates.test.ts +++ b/packages/cli/__tests__/init.templates.test.ts @@ -1,11 +1,10 @@ jest.setTimeout(30000); +import { scaffoldTemplate } from '@pgpmjs/core'; import fs from 'fs'; import os from 'os'; import path from 'path'; -import { scaffoldTemplate } from '@pgpmjs/core'; - const TEMPLATE_REPO = 'https://github.com/constructive-io/pgpm-boilerplates.git'; describe('Template scaffolding', () => { diff --git a/packages/cli/src/commands/codegen.ts b/packages/cli/src/commands/codegen.ts index b3fd5a93a..82e05da94 100644 --- a/packages/cli/src/commands/codegen.ts +++ b/packages/cli/src/commands/codegen.ts @@ -1,10 +1,10 @@ +import { defaultGraphQLCodegenOptions, GraphQLCodegenOptions,mergeGraphQLCodegenOptions, runCodegen } from '@constructive-io/graphql-codegen' +import { fetchEndpointSchemaSDL } from '@constructive-io/graphql-server' +import { promises as fs } from 'fs' import { CLIOptions, Inquirerer } from 'inquirerer' +import yaml from 'js-yaml' import { ParsedArgs } from 'minimist' -import { promises as fs } from 'fs' import { join } from 'path' -import yaml from 'js-yaml' -import { runCodegen, defaultGraphQLCodegenOptions, mergeGraphQLCodegenOptions, GraphQLCodegenOptions } from '@constructive-io/graphql-codegen' -import { fetchEndpointSchemaSDL } from '@constructive-io/graphql-server' const usage = ` Constructive GraphQL Codegen: diff --git a/packages/cli/src/commands/get-graphql-schema.ts b/packages/cli/src/commands/get-graphql-schema.ts index eb189f9ca..638e7cb55 100644 --- a/packages/cli/src/commands/get-graphql-schema.ts +++ b/packages/cli/src/commands/get-graphql-schema.ts @@ -1,7 +1,7 @@ +import { buildSchemaSDL, fetchEndpointSchemaSDL } from '@constructive-io/graphql-server' +import { promises as fs } from 'fs' import { CLIOptions, Inquirerer } from 'inquirerer' import { ParsedArgs } from 'minimist' -import { promises as fs } from 'fs' -import { buildSchemaSDL, fetchEndpointSchemaSDL } from '@constructive-io/graphql-server' const usage = ` Constructive Get GraphQL Schema: diff --git a/packages/cli/src/commands/server.ts b/packages/cli/src/commands/server.ts index f2e7b8a2c..0e7d3aed6 100644 --- a/packages/cli/src/commands/server.ts +++ b/packages/cli/src/commands/server.ts @@ -1,6 +1,6 @@ import { getEnvOptions } from '@constructive-io/graphql-env'; -import { Logger } from '@pgpmjs/logger'; import { GraphQLServer as server } from '@constructive-io/graphql-server'; +import { Logger } from '@pgpmjs/logger'; import { PgpmOptions } from '@pgpmjs/types'; import { CLIOptions, Inquirerer, OptionValue,Question } from 'inquirerer'; import { getPgPool } from 'pg-cache'; diff --git a/packages/cli/src/utils/index.ts b/packages/cli/src/utils/index.ts index a141a6c51..8c0dd24aa 100644 --- a/packages/cli/src/utils/index.ts +++ b/packages/cli/src/utils/index.ts @@ -1,3 +1,3 @@ +export { usageText } from './display'; export { extractFirst } from 'pgpm'; export { cliExitWithError } from 'pgpm'; -export { usageText } from './display'; diff --git a/packages/cli/test-utils/cli.ts b/packages/cli/test-utils/cli.ts index e09059fd4..c78343fb3 100644 --- a/packages/cli/test-utils/cli.ts +++ b/packages/cli/test-utils/cli.ts @@ -1,7 +1,7 @@ +import { cleanAnsi } from 'clean-ansi'; import { CLIOptions } from 'inquirerer'; import readline from 'readline'; import { Readable, Transform, Writable } from 'stream'; -import { cleanAnsi } from 'clean-ansi'; export const KEY_SEQUENCES = { ENTER: '\u000d', diff --git a/packages/cli/test-utils/fixtures.ts b/packages/cli/test-utils/fixtures.ts index 3eb7d1e53..67761b46d 100644 --- a/packages/cli/test-utils/fixtures.ts +++ b/packages/cli/test-utils/fixtures.ts @@ -1,9 +1,9 @@ +import { DEFAULT_TEMPLATE_REPO } from '@pgpmjs/core'; import fs from 'fs'; import { Inquirerer } from 'inquirerer'; import { ParsedArgs } from 'minimist'; import os from 'os'; import path from 'path'; -import { DEFAULT_TEMPLATE_REPO } from '@pgpmjs/core'; import { commands } from '../src/commands'; import { setupTests, TestEnvironment } from './cli'; diff --git a/packages/cli/test-utils/index.ts b/packages/cli/test-utils/index.ts index 05adba257..f44de4421 100644 --- a/packages/cli/test-utils/index.ts +++ b/packages/cli/test-utils/index.ts @@ -1,5 +1,5 @@ export * from './cli'; export * from './CLIDeployTestFixture'; export * from './fixtures'; -export * from './TestDatabase'; export * from './init-argv'; +export * from './TestDatabase'; diff --git a/packages/cli/test-utils/init-argv.ts b/packages/cli/test-utils/init-argv.ts index b214b6ec2..02b4ae1f0 100644 --- a/packages/cli/test-utils/init-argv.ts +++ b/packages/cli/test-utils/init-argv.ts @@ -1,5 +1,5 @@ -import { ParsedArgs } from 'minimist'; import { DEFAULT_TEMPLATE_REPO } from '@pgpmjs/core'; +import { ParsedArgs } from 'minimist'; export const addInitDefaults = (argv: ParsedArgs): ParsedArgs => { const baseName = (argv.moduleName as string) || (argv.name as string) || 'module'; diff --git a/packages/csv-to-pg/__tests__/csv2pg.test.ts b/packages/csv-to-pg/__tests__/csv2pg.test.ts index a01136074..65157375c 100644 --- a/packages/csv-to-pg/__tests__/csv2pg.test.ts +++ b/packages/csv-to-pg/__tests__/csv2pg.test.ts @@ -1,10 +1,11 @@ // @ts-nocheck -import { parse, parseTypes } from '../src'; +import { nodes } from '@pgsql/utils'; +import cases from 'jest-in-case'; import { resolve } from 'path'; import { deparse } from 'pgsql-deparser'; -import { InsertOne, InsertMany } from '../src/utils'; -import cases from 'jest-in-case'; -import { nodes } from '@pgsql/utils'; + +import { parse, parseTypes } from '../src'; +import { InsertMany,InsertOne } from '../src/utils'; const zips = resolve(__dirname + '/../__fixtures__/zip.csv'); const withHeaders = resolve(__dirname + '/../__fixtures__/headers.csv'); diff --git a/packages/csv-to-pg/__tests__/export.test.ts b/packages/csv-to-pg/__tests__/export.test.ts index ab7912d34..75d849710 100644 --- a/packages/csv-to-pg/__tests__/export.test.ts +++ b/packages/csv-to-pg/__tests__/export.test.ts @@ -1,10 +1,11 @@ // @ts-nocheck -import { parse, parseTypes } from '../src'; import { resolve } from 'path'; import { deparse } from 'pgsql-deparser'; -import { InsertOne, InsertMany } from '../src/utils'; + +import { parse, parseTypes } from '../src'; import { Parser } from '../src/parser'; +import { InsertMany,InsertOne } from '../src/utils'; const testCase = resolve(__dirname + '/../__fixtures__/test-case.csv'); diff --git a/packages/csv-to-pg/src/cli.ts b/packages/csv-to-pg/src/cli.ts index c7f6c1a80..98552a0f4 100644 --- a/packages/csv-to-pg/src/cli.ts +++ b/packages/csv-to-pg/src/cli.ts @@ -1,10 +1,11 @@ #!/usr/bin/env node +import { writeFileSync } from 'fs'; import { CLI, type CommandHandler } from 'inquirerer'; +import { dirname } from 'path'; + import { readConfig } from './parse'; import { Parser } from './parser'; import { normalizePath } from './utils'; -import { dirname } from 'path'; -import { writeFileSync } from 'fs'; interface ConfigFile { input?: string; diff --git a/packages/csv-to-pg/src/parse.ts b/packages/csv-to-pg/src/parse.ts index dbef40690..9b1bd465b 100644 --- a/packages/csv-to-pg/src/parse.ts +++ b/packages/csv-to-pg/src/parse.ts @@ -1,12 +1,13 @@ +import type { Node } from '@pgsql/types'; +import { ast, nodes } from '@pgsql/utils'; import csv from 'csv-parser'; import { createReadStream, readFileSync } from 'fs'; import { load as parseYAML } from 'js-yaml'; -import { ast, nodes } from '@pgsql/utils'; -import type { Node } from '@pgsql/types'; + import { + getRelatedField, makeBoundingBox, makeLocation, - getRelatedField, wrapValue } from './utils'; diff --git a/packages/csv-to-pg/src/parser.ts b/packages/csv-to-pg/src/parser.ts index 1487a42ef..609467b90 100644 --- a/packages/csv-to-pg/src/parser.ts +++ b/packages/csv-to-pg/src/parser.ts @@ -1,7 +1,8 @@ import { readFileSync } from 'fs'; -import { parse, parseTypes } from './index'; import { deparse } from 'pgsql-deparser'; -import { InsertOne, InsertMany } from './utils'; + +import { parse, parseTypes } from './index'; +import { InsertMany,InsertOne } from './utils'; interface ParserConfig { schema?: string; diff --git a/packages/csv-to-pg/src/utils.ts b/packages/csv-to-pg/src/utils.ts index 0da82d11e..5ad2b2160 100644 --- a/packages/csv-to-pg/src/utils.ts +++ b/packages/csv-to-pg/src/utils.ts @@ -1,5 +1,5 @@ -import { ast, nodes } from '@pgsql/utils'; import type { Node } from '@pgsql/types'; +import { ast, nodes } from '@pgsql/utils'; import { join, resolve } from 'path'; export const normalizePath = (path: string, cwd?: string): string => diff --git a/pgpm/cli/src/commands.ts b/pgpm/cli/src/commands.ts index 9be4235a9..df02b56f5 100644 --- a/pgpm/cli/src/commands.ts +++ b/pgpm/cli/src/commands.ts @@ -19,13 +19,13 @@ import kill from './commands/kill'; import migrate from './commands/migrate'; import _package from './commands/package'; import plan from './commands/plan'; -import updateCmd from './commands/update'; -import upgradeModules from './commands/upgrade-modules'; import remove from './commands/remove'; import renameCmd from './commands/rename'; import revert from './commands/revert'; import tag from './commands/tag'; import testPackages from './commands/test-packages'; +import updateCmd from './commands/update'; +import upgradeModules from './commands/upgrade-modules'; import verify from './commands/verify'; import { extractFirst, usageText } from './utils'; import { cliExitWithError } from './utils/cli-error'; diff --git a/pgpm/cli/src/commands/cache.ts b/pgpm/cli/src/commands/cache.ts index 32f4f5fae..1a6b49655 100644 --- a/pgpm/cli/src/commands/cache.ts +++ b/pgpm/cli/src/commands/cache.ts @@ -1,5 +1,6 @@ -import { CLIOptions, Inquirerer } from 'inquirerer'; import { CacheManager } from 'create-gen-app'; +import { CLIOptions, Inquirerer } from 'inquirerer'; + import { cliExitWithError } from '../utils/cli-error'; const cacheUsageText = ` diff --git a/pgpm/cli/src/commands/init/module.ts b/pgpm/cli/src/commands/init/module.ts index 2c693f059..b17a4c8c2 100644 --- a/pgpm/cli/src/commands/init/module.ts +++ b/pgpm/cli/src/commands/init/module.ts @@ -1,9 +1,8 @@ -import fs from 'fs'; -import path from 'path'; - import { DEFAULT_TEMPLATE_REPO, DEFAULT_TEMPLATE_TOOL_NAME, PgpmPackage, sluggify } from '@pgpmjs/core'; import { errors } from '@pgpmjs/types'; +import fs from 'fs'; import { Inquirerer, OptionValue, Question } from 'inquirerer'; +import path from 'path'; const DEFAULT_MOTD = ` | _ _ diff --git a/pgpm/cli/src/commands/init/workspace.ts b/pgpm/cli/src/commands/init/workspace.ts index dacf9d3c3..5a4b35488 100644 --- a/pgpm/cli/src/commands/init/workspace.ts +++ b/pgpm/cli/src/commands/init/workspace.ts @@ -1,8 +1,7 @@ -import fs from 'fs'; -import path from 'path'; - import { DEFAULT_TEMPLATE_REPO, DEFAULT_TEMPLATE_TOOL_NAME, scaffoldTemplate, sluggify } from '@pgpmjs/core'; +import fs from 'fs'; import { Inquirerer, Question, registerDefaultResolver } from 'inquirerer'; +import path from 'path'; const DEFAULT_MOTD = ` | _ _ diff --git a/pgpm/cli/src/commands/test-packages.ts b/pgpm/cli/src/commands/test-packages.ts index b60b04ed5..c4d2417a3 100644 --- a/pgpm/cli/src/commands/test-packages.ts +++ b/pgpm/cli/src/commands/test-packages.ts @@ -1,11 +1,11 @@ import { PgpmPackage } from '@pgpmjs/core'; import { getEnvOptions } from '@pgpmjs/env'; import { Logger } from '@pgpmjs/logger'; -import path from 'path'; import { CLIOptions, Inquirerer } from 'inquirerer'; import { ParsedArgs } from 'minimist'; -import { getPgEnvOptions } from 'pg-env'; +import path from 'path'; import { getPgPool } from 'pg-cache'; +import { getPgEnvOptions } from 'pg-env'; const log = new Logger('test-packages'); diff --git a/pgpm/cli/src/commands/update.ts b/pgpm/cli/src/commands/update.ts index 258aafde7..a108ed754 100644 --- a/pgpm/cli/src/commands/update.ts +++ b/pgpm/cli/src/commands/update.ts @@ -1,9 +1,10 @@ -import { findAndRequirePackageJson } from 'find-and-require-package-json'; import { Logger } from '@pgpmjs/logger'; -import { CLIOptions, Inquirerer } from 'inquirerer'; import { spawn } from 'child_process'; -import { fetchLatestVersion } from '../utils/npm-version'; +import { findAndRequirePackageJson } from 'find-and-require-package-json'; +import { CLIOptions, Inquirerer } from 'inquirerer'; + import { cliExitWithError } from '../utils/cli-error'; +import { fetchLatestVersion } from '../utils/npm-version'; const log = new Logger('update'); diff --git a/pgpm/cli/src/commands/upgrade-modules.ts b/pgpm/cli/src/commands/upgrade-modules.ts index 17debcfd4..d1c19ca3a 100644 --- a/pgpm/cli/src/commands/upgrade-modules.ts +++ b/pgpm/cli/src/commands/upgrade-modules.ts @@ -2,6 +2,7 @@ import { PgpmPackage } from '@pgpmjs/core'; import { Logger } from '@pgpmjs/logger'; import { CLIOptions, Inquirerer, OptionValue, Question } from 'inquirerer'; import { ParsedArgs } from 'minimist'; + import { fetchLatestVersion } from '../utils/npm-version'; const log = new Logger('upgrade-modules'); diff --git a/pgpm/cli/src/utils/index.ts b/pgpm/cli/src/utils/index.ts index fb956c353..0498c35d8 100644 --- a/pgpm/cli/src/utils/index.ts +++ b/pgpm/cli/src/utils/index.ts @@ -1,8 +1,8 @@ export * from './argv'; -export * from './database'; -export * from './display'; export * from './cli-error'; +export * from './database'; export * from './deployed-changes'; +export * from './display'; export * from './module-utils'; export * from './npm-version'; export * from './package-alias'; diff --git a/pgpm/cli/src/utils/update-check.ts b/pgpm/cli/src/utils/update-check.ts index a9f05e751..9fd77dad3 100644 --- a/pgpm/cli/src/utils/update-check.ts +++ b/pgpm/cli/src/utils/update-check.ts @@ -1,13 +1,13 @@ -import { findAndRequirePackageJson } from 'find-and-require-package-json'; import { Logger } from '@pgpmjs/logger'; import { - UpdateCheckConfig, UPDATE_CHECK_APPSTASH_KEY, UPDATE_CHECK_TTL_MS, - UPDATE_PACKAGE_NAME -} from '@pgpmjs/types'; + UPDATE_PACKAGE_NAME, + UpdateCheckConfig} from '@pgpmjs/types'; +import { findAndRequirePackageJson } from 'find-and-require-package-json'; + import { compareVersions, fetchLatestVersion } from './npm-version'; -import { readUpdateConfig, shouldCheck, writeUpdateConfig, UpdateConfigOptions } from './update-config'; +import { readUpdateConfig, shouldCheck, UpdateConfigOptions,writeUpdateConfig } from './update-config'; export interface CheckForUpdatesOptions extends UpdateConfigOptions { pkgName?: string; diff --git a/pgpm/cli/src/utils/update-config.ts b/pgpm/cli/src/utils/update-config.ts index affa22779..150673b2c 100644 --- a/pgpm/cli/src/utils/update-config.ts +++ b/pgpm/cli/src/utils/update-config.ts @@ -1,7 +1,7 @@ +import { UPDATE_CHECK_APPSTASH_KEY,UpdateCheckConfig } from '@pgpmjs/types'; +import { appstash, resolve as resolveAppstash } from 'appstash'; import fs from 'fs'; import path from 'path'; -import { appstash, resolve as resolveAppstash } from 'appstash'; -import { UpdateCheckConfig, UPDATE_CHECK_APPSTASH_KEY } from '@pgpmjs/types'; export interface UpdateConfigOptions { toolName?: string; diff --git a/pgpm/core/__tests__/core/add-functionality.test.ts b/pgpm/core/__tests__/core/add-functionality.test.ts index fca192318..ea1f298ee 100644 --- a/pgpm/core/__tests__/core/add-functionality.test.ts +++ b/pgpm/core/__tests__/core/add-functionality.test.ts @@ -1,8 +1,9 @@ +import { existsSync,mkdirSync, readFileSync, writeFileSync } from 'fs'; +import * as fs from 'fs'; +import { basename, join } from 'path'; + import { PgpmPackage } from '../../src/core/class/pgpm'; import { TestFixture } from '../../test-utils'; -import { readFileSync, writeFileSync, mkdirSync, existsSync } from 'fs'; -import { basename, join } from 'path'; -import * as fs from 'fs'; describe('Add functionality', () => { let fixture: TestFixture; diff --git a/pgpm/core/__tests__/core/analyze-module.test.ts b/pgpm/core/__tests__/core/analyze-module.test.ts index 2124aa0a8..f92f3e44d 100644 --- a/pgpm/core/__tests__/core/analyze-module.test.ts +++ b/pgpm/core/__tests__/core/analyze-module.test.ts @@ -1,8 +1,9 @@ import fs from 'fs'; import path from 'path'; -import { TestFixture } from '../../test-utils'; + import { parsePlanFile } from '../../src/files/plan/parser'; import { writePlanFile } from '../../src/files/plan/writer'; +import { TestFixture } from '../../test-utils'; let fixture: TestFixture; diff --git a/pgpm/core/__tests__/core/constructive-project.test.ts b/pgpm/core/__tests__/core/constructive-project.test.ts index fea6c4d59..cc3d45e43 100644 --- a/pgpm/core/__tests__/core/constructive-project.test.ts +++ b/pgpm/core/__tests__/core/constructive-project.test.ts @@ -1,4 +1,4 @@ -import { PgpmPackage, PackageContext } from '../../src/core/class/pgpm'; +import { PackageContext,PgpmPackage } from '../../src/core/class/pgpm'; import { TestFixture } from '../../test-utils'; let fixture: TestFixture; diff --git a/pgpm/core/__tests__/core/rename-module.test.ts b/pgpm/core/__tests__/core/rename-module.test.ts index 845a19aca..943b50396 100644 --- a/pgpm/core/__tests__/core/rename-module.test.ts +++ b/pgpm/core/__tests__/core/rename-module.test.ts @@ -1,5 +1,6 @@ import fs from 'fs'; import path from 'path'; + import { TestFixture } from '../../test-utils'; let fixture: TestFixture; diff --git a/pgpm/core/__tests__/files/extension/reader.test.ts b/pgpm/core/__tests__/files/extension/reader.test.ts index ee9c6af9a..9453f7b87 100644 --- a/pgpm/core/__tests__/files/extension/reader.test.ts +++ b/pgpm/core/__tests__/files/extension/reader.test.ts @@ -1,6 +1,7 @@ import fs from 'fs'; import os from 'os'; import path from 'path'; + import { getInstalledExtensions } from '../../../src/files/extension/reader'; describe('getInstalledExtensions', () => { diff --git a/pgpm/core/__tests__/files/extension/writer.test.ts b/pgpm/core/__tests__/files/extension/writer.test.ts index 960bf6972..589a2e5bb 100644 --- a/pgpm/core/__tests__/files/extension/writer.test.ts +++ b/pgpm/core/__tests__/files/extension/writer.test.ts @@ -1,8 +1,9 @@ import fs from 'fs'; import os from 'os'; import path from 'path'; -import { writeExtensions, generateControlFileContent } from '../../../src/files/extension/writer'; + import { getInstalledExtensions } from '../../../src/files/extension/reader'; +import { generateControlFileContent,writeExtensions } from '../../../src/files/extension/writer'; describe('extension writer', () => { let tempDir: string; diff --git a/pgpm/core/__tests__/files/plan/writer.test.ts b/pgpm/core/__tests__/files/plan/writer.test.ts index 41b4ade9c..049daea84 100644 --- a/pgpm/core/__tests__/files/plan/writer.test.ts +++ b/pgpm/core/__tests__/files/plan/writer.test.ts @@ -1,6 +1,7 @@ import fs from 'fs'; import os from 'os'; import path from 'path'; + import { writeSqitchPlan } from '../../../src/files/plan/writer'; import { SqitchRow } from '../../../src/files/types'; diff --git a/pgpm/core/__tests__/migrate/tag-fallback.test.ts b/pgpm/core/__tests__/migrate/tag-fallback.test.ts index cea5c587d..e260213b0 100644 --- a/pgpm/core/__tests__/migrate/tag-fallback.test.ts +++ b/pgpm/core/__tests__/migrate/tag-fallback.test.ts @@ -1,4 +1,4 @@ -import { mkdtempSync, writeFileSync, mkdirSync } from 'fs'; +import { mkdirSync,mkdtempSync, writeFileSync } from 'fs'; import { tmpdir } from 'os'; import { join } from 'path'; diff --git a/pgpm/core/__tests__/projects/clear-functionality.test.ts b/pgpm/core/__tests__/projects/clear-functionality.test.ts index 2814b36ed..be5469a42 100644 --- a/pgpm/core/__tests__/projects/clear-functionality.test.ts +++ b/pgpm/core/__tests__/projects/clear-functionality.test.ts @@ -1,8 +1,9 @@ import fs from 'fs'; import path from 'path'; + import { PgpmPackage } from '../../src/core/class/pgpm'; -import { TestFixture } from '../../test-utils/TestFixture'; import { parsePlanFile } from '../../src/files/plan/parser'; +import { TestFixture } from '../../test-utils/TestFixture'; describe('Clear Functionality', () => { let fixture: TestFixture; diff --git a/pgpm/core/__tests__/projects/forked-deployment-scenarios.test.ts b/pgpm/core/__tests__/projects/forked-deployment-scenarios.test.ts index 9d0f7b81b..4afff18ef 100644 --- a/pgpm/core/__tests__/projects/forked-deployment-scenarios.test.ts +++ b/pgpm/core/__tests__/projects/forked-deployment-scenarios.test.ts @@ -2,6 +2,7 @@ process.env.CONSTRUCTIVE_DEBUG = 'true'; import { readFileSync, writeFileSync } from 'fs'; import { join } from 'path'; + import { TestDatabase } from '../../test-utils'; import { CoreDeployTestFixture } from '../../test-utils/CoreDeployTestFixture'; diff --git a/pgpm/core/__tests__/projects/remove-functionality.test.ts b/pgpm/core/__tests__/projects/remove-functionality.test.ts index fbd26aab8..b00982125 100644 --- a/pgpm/core/__tests__/projects/remove-functionality.test.ts +++ b/pgpm/core/__tests__/projects/remove-functionality.test.ts @@ -1,5 +1,6 @@ import fs from 'fs'; import path from 'path'; + import { PgpmPackage } from '../../src/core/class/pgpm'; import { TestFixture } from '../../test-utils/TestFixture'; diff --git a/pgpm/core/__tests__/projects/stage-workspace.test.ts b/pgpm/core/__tests__/projects/stage-workspace.test.ts index f66db24d4..c6cb22b7d 100644 --- a/pgpm/core/__tests__/projects/stage-workspace.test.ts +++ b/pgpm/core/__tests__/projects/stage-workspace.test.ts @@ -1,7 +1,7 @@ -import { PgpmPackage, PackageContext } from '../../src/core/class/pgpm'; -import { TestFixture } from '../../test-utils/TestFixture'; -import { CoreDeployTestFixture } from '../../test-utils/CoreDeployTestFixture'; +import { PackageContext,PgpmPackage } from '../../src/core/class/pgpm'; import { TestDatabase } from '../../test-utils'; +import { CoreDeployTestFixture } from '../../test-utils/CoreDeployTestFixture'; +import { TestFixture } from '../../test-utils/TestFixture'; describe('Staging Fixture Tests', () => { let fixture: TestFixture; diff --git a/pgpm/core/__tests__/projects/tag-functionality.test.ts b/pgpm/core/__tests__/projects/tag-functionality.test.ts index 8ee6b2fb9..9654f948b 100644 --- a/pgpm/core/__tests__/projects/tag-functionality.test.ts +++ b/pgpm/core/__tests__/projects/tag-functionality.test.ts @@ -1,10 +1,11 @@ process.env.CONSTRUCTIVE_DEBUG = 'true'; -import { TestDatabase } from '../../test-utils'; -import { teardownPgPools } from 'pg-cache'; import { readFileSync } from 'fs'; -import { PgpmPackage } from '../../src/core/class/pgpm'; import { join } from 'path'; +import { teardownPgPools } from 'pg-cache'; + +import { PgpmPackage } from '../../src/core/class/pgpm'; +import { TestDatabase } from '../../test-utils'; import { CoreDeployTestFixture } from '../../test-utils/CoreDeployTestFixture'; describe('Tag functionality with CoreDeployTestFixture', () => { diff --git a/pgpm/core/__tests__/resolution/dependency-resolution-basic.test.ts b/pgpm/core/__tests__/resolution/dependency-resolution-basic.test.ts index d325d3dd2..fdbcd83e0 100644 --- a/pgpm/core/__tests__/resolution/dependency-resolution-basic.test.ts +++ b/pgpm/core/__tests__/resolution/dependency-resolution-basic.test.ts @@ -1,5 +1,5 @@ -import { resolveExtensionDependencies, resolveDependencies } from '../../src/resolution/deps'; import { PgpmPackage } from '../../src/core/class/pgpm'; +import { resolveDependencies,resolveExtensionDependencies } from '../../src/resolution/deps'; import { TestFixture } from '../../test-utils'; let fixture: TestFixture; diff --git a/pgpm/core/__tests__/resolution/header-format-compatibility.test.ts b/pgpm/core/__tests__/resolution/header-format-compatibility.test.ts index fea09ee29..089edadf6 100644 --- a/pgpm/core/__tests__/resolution/header-format-compatibility.test.ts +++ b/pgpm/core/__tests__/resolution/header-format-compatibility.test.ts @@ -1,7 +1,8 @@ +import { mkdirSync,writeFileSync } from 'fs'; +import { join } from 'path'; + import { resolveDependencies } from '../../src/resolution/deps'; import { TestFixture } from '../../test-utils'; -import { writeFileSync, mkdirSync } from 'fs'; -import { join } from 'path'; describe('Header format compatibility', () => { let fixture: TestFixture; diff --git a/pgpm/core/__tests__/roles/roles-sql-generators.test.ts b/pgpm/core/__tests__/roles/roles-sql-generators.test.ts index 47455f0e8..dedbfda3f 100644 --- a/pgpm/core/__tests__/roles/roles-sql-generators.test.ts +++ b/pgpm/core/__tests__/roles/roles-sql-generators.test.ts @@ -1,7 +1,7 @@ import { generateCreateBaseRolesSQL, - generateCreateUserSQL, generateCreateTestUsersSQL, + generateCreateUserSQL, generateRemoveUserSQL } from '../../src/roles'; diff --git a/pgpm/core/__tests__/workspace/module-utilities.test.ts b/pgpm/core/__tests__/workspace/module-utilities.test.ts index 736594e02..f5d7fdc89 100644 --- a/pgpm/core/__tests__/workspace/module-utilities.test.ts +++ b/pgpm/core/__tests__/workspace/module-utilities.test.ts @@ -1,9 +1,9 @@ +import { PgpmPackage } from '../../src/core/class/pgpm'; import { getExtensionsAndModules, getExtensionsAndModulesChanges, latestChange } from '../../src/modules/modules'; -import { PgpmPackage } from '../../src/core/class/pgpm'; import { TestFixture } from '../../test-utils'; let fixture: TestFixture; diff --git a/pgpm/core/src/core/class/pgpm.ts b/pgpm/core/src/core/class/pgpm.ts index 033611dfb..de425d95c 100644 --- a/pgpm/core/src/core/class/pgpm.ts +++ b/pgpm/core/src/core/class/pgpm.ts @@ -1,7 +1,6 @@ import { loadConfigSyncFromDir, resolvePgpmPath,walkUp } from '@pgpmjs/env'; import { Logger } from '@pgpmjs/logger'; import { errors, PgpmOptions, PgpmWorkspaceConfig } from '@pgpmjs/types'; -import yanse from 'yanse'; import { execSync } from 'child_process'; import fs from 'fs'; import * as glob from 'glob'; @@ -10,15 +9,10 @@ import { parse } from 'parse-package-name'; import path, { dirname, resolve } from 'path'; import { getPgPool } from 'pg-cache'; import { PgConfig } from 'pg-env'; +import yanse from 'yanse'; -import { DEFAULT_TEMPLATE_REPO, DEFAULT_TEMPLATE_TTL_MS, DEFAULT_TEMPLATE_TOOL_NAME, scaffoldTemplate } from '../template-scaffold'; import { getAvailableExtensions } from '../../extensions/extensions'; import { generatePlan, writePlan, writePlanFile } from '../../files'; -import { Tag, ExtendedPlanFile, Change } from '../../files/types'; -import { parsePlanFile } from '../../files/plan/parser'; -import { isValidTagName, isValidChangeName, parseReference } from '../../files/plan/validators'; -import { getNow as getPlanTimestamp } from '../../files/plan/generator'; -import { resolveTagToChangeName } from '../../resolution/resolve'; import { ExtensionInfo, getExtensionInfo, @@ -28,6 +22,11 @@ import { writeExtensions, } from '../../files'; import { generateControlFileContent, writeExtensionMakefile } from '../../files/extension/writer'; +import { getNow as getPlanTimestamp } from '../../files/plan/generator'; +import { parsePlanFile } from '../../files/plan/parser'; +import { isValidChangeName, isValidTagName, parseReference } from '../../files/plan/validators'; +import { Change,ExtendedPlanFile, Tag } from '../../files/types'; +import { PackageAnalysisIssue, PackageAnalysisResult, RenameOptions } from '../../files/types'; import { PgpmMigrate } from '../../migrate/client'; import { getExtensionsAndModules, @@ -37,10 +36,10 @@ import { ModuleMap } from '../../modules/modules'; import { packageModule } from '../../packaging/package'; -import { resolveExtensionDependencies, resolveDependencies } from '../../resolution/deps'; -import { PackageAnalysisIssue, PackageAnalysisResult, RenameOptions } from '../../files/types'; - +import { resolveDependencies,resolveExtensionDependencies } from '../../resolution/deps'; +import { resolveTagToChangeName } from '../../resolution/resolve'; import { parseTarget } from '../../utils/target-utils'; +import { DEFAULT_TEMPLATE_REPO, DEFAULT_TEMPLATE_TOOL_NAME, DEFAULT_TEMPLATE_TTL_MS, scaffoldTemplate } from '../template-scaffold'; const logger = new Logger('pgpm'); diff --git a/pgpm/core/src/core/template-scaffold.ts b/pgpm/core/src/core/template-scaffold.ts index 99ba29f95..f20088aab 100644 --- a/pgpm/core/src/core/template-scaffold.ts +++ b/pgpm/core/src/core/template-scaffold.ts @@ -1,14 +1,14 @@ +import { CacheManager, GitCloner, Templatizer } from 'create-gen-app'; import fs from 'fs'; import os from 'os'; import path from 'path'; -import { CacheManager, GitCloner, Templatizer } from 'create-gen-app'; -import { BoilerplateQuestion } from './boilerplate-types'; import { readBoilerplateConfig, readBoilerplatesConfig, resolveBoilerplateBaseDir, } from './boilerplate-scanner'; +import { BoilerplateQuestion } from './boilerplate-types'; export type TemplateKind = 'workspace' | 'module'; diff --git a/pgpm/core/src/files/plan/parser.ts b/pgpm/core/src/files/plan/parser.ts index eb1d43f12..1c08f19f3 100644 --- a/pgpm/core/src/files/plan/parser.ts +++ b/pgpm/core/src/files/plan/parser.ts @@ -1,8 +1,8 @@ +import { errors } from '@pgpmjs/types'; import { readFileSync } from 'fs'; import { Change, ExtendedPlanFile, ParseError, ParseResult,PlanFile, Tag } from '../types'; import { isValidChangeName, isValidDependency, isValidTagName, parseReference } from './validators'; -import { errors } from '@pgpmjs/types'; /** * Parse a Sqitch plan file with full validation diff --git a/pgpm/core/src/files/plan/writer.ts b/pgpm/core/src/files/plan/writer.ts index 47d3b2418..6df0750ac 100644 --- a/pgpm/core/src/files/plan/writer.ts +++ b/pgpm/core/src/files/plan/writer.ts @@ -1,7 +1,7 @@ import fs from 'fs'; import path from 'path'; -import { Change, PlanFile, SqitchRow, Tag, ExtendedPlanFile } from '../types'; +import { Change, ExtendedPlanFile,PlanFile, SqitchRow, Tag } from '../types'; export interface PlanWriteOptions { outdir: string; diff --git a/pgpm/core/src/index.ts b/pgpm/core/src/index.ts index 1010463fc..5fed75528 100644 --- a/pgpm/core/src/index.ts +++ b/pgpm/core/src/index.ts @@ -1,4 +1,7 @@ +export * from './core/boilerplate-scanner'; +export * from './core/boilerplate-types'; export * from './core/class/pgpm'; +export * from './core/template-scaffold'; export * from './export/export-meta'; export * from './export/export-migrations'; export * from './extensions/extensions'; @@ -9,16 +12,12 @@ export * from './resolution/deps'; export * from './resolution/resolve'; export * from './workspace/paths'; export * from './workspace/utils'; -export * from './core/template-scaffold'; -export * from './core/boilerplate-types'; -export * from './core/boilerplate-scanner'; // Export package-files functionality (now integrated into core) export * from './files'; +export { PgpmInit } from './init/client'; export { cleanSql } from './migrate/clean'; export { PgpmMigrate } from './migrate/client'; -export { PgpmInit } from './init/client'; -export * from './roles'; export { DeployOptions, DeployResult, @@ -31,3 +30,4 @@ export { VerifyResult} from './migrate/types'; export { hashFile, hashString } from './migrate/utils/hash'; export { executeQuery,TransactionContext, TransactionOptions, withTransaction } from './migrate/utils/transaction'; +export * from './roles'; diff --git a/pgpm/core/src/init/client.ts b/pgpm/core/src/init/client.ts index de933356c..c1c0f96e1 100644 --- a/pgpm/core/src/init/client.ts +++ b/pgpm/core/src/init/client.ts @@ -3,10 +3,11 @@ import { RoleMapping, TestUserCredentials } from '@pgpmjs/types'; import { Pool } from 'pg'; import { getPgPool } from 'pg-cache'; import { PgConfig } from 'pg-env'; + import { generateCreateBaseRolesSQL, - generateCreateUserSQL, generateCreateTestUsersSQL, + generateCreateUserSQL, generateRemoveUserSQL } from '../roles'; diff --git a/pgpm/core/src/modules/modules.ts b/pgpm/core/src/modules/modules.ts index 642e017b6..026f61f7c 100644 --- a/pgpm/core/src/modules/modules.ts +++ b/pgpm/core/src/modules/modules.ts @@ -1,6 +1,7 @@ -import { getLatestChange, Module } from '../files'; import { errors } from '@pgpmjs/types'; +import { getLatestChange, Module } from '../files'; + export type ModuleMap = Record; /** diff --git a/pgpm/core/src/resolution/deps.ts b/pgpm/core/src/resolution/deps.ts index 5e44922bf..ddec33554 100644 --- a/pgpm/core/src/resolution/deps.ts +++ b/pgpm/core/src/resolution/deps.ts @@ -1,3 +1,4 @@ +import { errors } from '@pgpmjs/types'; import { readFileSync } from 'fs'; import { sync as glob } from 'glob'; import { join,relative } from 'path'; @@ -5,7 +6,6 @@ import { join,relative } from 'path'; import { PgpmPackage } from '../core/class/pgpm'; import { parsePlanFile } from '../files/plan/parser'; import { ExtendedPlanFile } from '../files/types'; -import { errors } from '@pgpmjs/types'; /** * Represents a dependency graph where keys are module identifiers diff --git a/pgpm/core/src/resolution/resolve.ts b/pgpm/core/src/resolution/resolve.ts index 504f9416c..3d12c95f1 100644 --- a/pgpm/core/src/resolution/resolve.ts +++ b/pgpm/core/src/resolution/resolve.ts @@ -1,9 +1,9 @@ +import { errors } from '@pgpmjs/types'; import { readFileSync } from 'fs'; import { getChanges, getExtensionName } from '../files'; import { parsePlanFile } from '../files/plan/parser'; import { resolveDependencies } from './deps'; -import { errors } from '@pgpmjs/types'; /** * Resolves SQL scripts for deployment or reversion. diff --git a/pgpm/core/src/workspace/utils.ts b/pgpm/core/src/workspace/utils.ts index f0bda19c0..57dfa0fc9 100644 --- a/pgpm/core/src/workspace/utils.ts +++ b/pgpm/core/src/workspace/utils.ts @@ -1,6 +1,6 @@ +import { errors } from '@pgpmjs/types'; import { existsSync } from 'fs'; import { dirname, resolve } from 'path'; -import { errors } from '@pgpmjs/types'; /** * Recursively walks up directories to find a specific file (sync version). diff --git a/pgpm/env/__tests__/merge.test.ts b/pgpm/env/__tests__/merge.test.ts index 2409a578a..e645e6903 100644 --- a/pgpm/env/__tests__/merge.test.ts +++ b/pgpm/env/__tests__/merge.test.ts @@ -1,6 +1,7 @@ -import { getConnEnvOptions } from '../src/merge'; import { pgpmDefaults } from '@pgpmjs/types'; +import { getConnEnvOptions } from '../src/merge'; + describe('getConnEnvOptions', () => { describe('roles resolution', () => { it('should always return roles with default values when no overrides provided', () => { diff --git a/pgpm/env/src/config.ts b/pgpm/env/src/config.ts index 686a92837..76f08b35d 100644 --- a/pgpm/env/src/config.ts +++ b/pgpm/env/src/config.ts @@ -1,6 +1,7 @@ +import { PgpmOptions } from '@pgpmjs/types'; import * as fs from 'fs'; import * as path from 'path'; -import { PgpmOptions } from '@pgpmjs/types'; + import { walkUp } from './utils'; /** diff --git a/pgpm/env/src/index.ts b/pgpm/env/src/index.ts index 8fc394671..784810bb6 100644 --- a/pgpm/env/src/index.ts +++ b/pgpm/env/src/index.ts @@ -1,6 +1,5 @@ -export { getEnvOptions, getConnEnvOptions, getDeploymentEnvOptions } from './merge'; -export { loadConfigSync, loadConfigSyncFromDir, loadConfigFileSync, resolvePgpmPath } from './config'; +export { loadConfigFileSync, loadConfigSync, loadConfigSyncFromDir, resolvePgpmPath } from './config'; export { getEnvVars, getNodeEnv, parseEnvBoolean } from './env'; +export { getConnEnvOptions, getDeploymentEnvOptions,getEnvOptions } from './merge'; export { walkUp } from './utils'; - -export type { PgpmOptions, PgTestConnectionOptions, DeploymentOptions } from '@pgpmjs/types'; +export type { DeploymentOptions,PgpmOptions, PgTestConnectionOptions } from '@pgpmjs/types'; diff --git a/pgpm/env/src/merge.ts b/pgpm/env/src/merge.ts index 2f19791a9..2f4590722 100644 --- a/pgpm/env/src/merge.ts +++ b/pgpm/env/src/merge.ts @@ -1,5 +1,6 @@ +import { DeploymentOptions,pgpmDefaults, PgpmOptions, PgTestConnectionOptions } from '@pgpmjs/types'; import deepmerge from 'deepmerge'; -import { pgpmDefaults, PgpmOptions, PgTestConnectionOptions, DeploymentOptions } from '@pgpmjs/types'; + import { loadConfigSync } from './config'; import { getEnvVars } from './env'; diff --git a/pgpm/types/src/index.ts b/pgpm/types/src/index.ts index 767794b62..003725216 100644 --- a/pgpm/types/src/index.ts +++ b/pgpm/types/src/index.ts @@ -1,5 +1,5 @@ export * from './error'; export * from './error-factory'; -export * from './pgpm'; export * from './jobs'; +export * from './pgpm'; export * from './update'; diff --git a/pgpm/types/src/pgpm.ts b/pgpm/types/src/pgpm.ts index 1b701e6ae..f5f345b26 100644 --- a/pgpm/types/src/pgpm.ts +++ b/pgpm/types/src/pgpm.ts @@ -1,5 +1,6 @@ import { execSync } from 'child_process'; import { PgConfig } from 'pg-env'; + import { JobsConfig } from './jobs'; /** diff --git a/postgres/drizzle-orm-test/__tests__/drizzle-seed.test.ts b/postgres/drizzle-orm-test/__tests__/drizzle-seed.test.ts index 2c448e66e..ac9b906ed 100644 --- a/postgres/drizzle-orm-test/__tests__/drizzle-seed.test.ts +++ b/postgres/drizzle-orm-test/__tests__/drizzle-seed.test.ts @@ -1,11 +1,12 @@ process.env.LOG_SCOPE = 'drizzle-orm-test'; -import { writeFileSync, mkdirSync } from 'fs'; -import { join } from 'path'; -import { tmpdir } from 'os'; -import { drizzle } from 'drizzle-orm/node-postgres'; -import { pgTable, pgSchema, uuid, text, serial, integer } from 'drizzle-orm/pg-core'; import { eq } from 'drizzle-orm'; +import { drizzle } from 'drizzle-orm/node-postgres'; +import { integer,pgSchema, pgTable, serial, text, uuid } from 'drizzle-orm/pg-core'; +import { mkdirSync,writeFileSync } from 'fs'; +import { tmpdir } from 'os'; +import { join } from 'path'; import { seed } from 'pgsql-test'; + import { getConnections, PgTestClient } from '../src'; let pg: PgTestClient; diff --git a/postgres/introspectron/src/introspectGql.ts b/postgres/introspectron/src/introspectGql.ts index 9a087bd3f..56e000daf 100644 --- a/postgres/introspectron/src/introspectGql.ts +++ b/postgres/introspectron/src/introspectGql.ts @@ -1,5 +1,5 @@ -import gql from 'graphql-tag'; import { DocumentNode } from 'graphql'; +import gql from 'graphql-tag'; export const IntrospectionQuery: DocumentNode = gql` query IntrospectionQuery { diff --git a/postgres/pg-ast/src/asts.ts b/postgres/pg-ast/src/asts.ts index e816d9065..490afb0a1 100644 --- a/postgres/pg-ast/src/asts.ts +++ b/postgres/pg-ast/src/asts.ts @@ -3,8 +3,8 @@ * DO NOT MODIFY IT BY HAND. Instead, modify the source proto file, * and run the pg-proto-parser generate command to regenerate this file. */ +import { A_ArrayExpr, A_Const, A_Expr, A_Indices, A_Indirection, A_Star, AccessPriv, Aggref, Alias, AlterCollationStmt, AlterDatabaseRefreshCollStmt, AlterDatabaseSetStmt, AlterDatabaseStmt, AlterDefaultPrivilegesStmt, AlterDomainStmt, AlterEnumStmt, AlterEventTrigStmt, AlterExtensionContentsStmt, AlterExtensionStmt, AlterFdwStmt, AlterForeignServerStmt, AlterFunctionStmt, AlternativeSubPlan, AlterObjectDependsStmt, AlterObjectSchemaStmt, AlterOperatorStmt, AlterOpFamilyStmt, AlterOwnerStmt, AlterPolicyStmt, AlterPublicationStmt, AlterRoleSetStmt, AlterRoleStmt, AlterSeqStmt, AlterStatsStmt, AlterSubscriptionStmt, AlterSystemStmt, AlterTableCmd, AlterTableMoveAllStmt, AlterTableSpaceOptionsStmt, AlterTableStmt, AlterTSConfigurationStmt, AlterTSDictionaryStmt, AlterTypeStmt, AlterUserMappingStmt, ArrayCoerceExpr, ArrayExpr, BitString, Boolean, BooleanTest, BoolExpr, CallContext, CallStmt, CaseExpr, CaseTestExpr, CaseWhen, CheckPointStmt, ClosePortalStmt, ClusterStmt, CoalesceExpr, CoerceToDomain, CoerceToDomainValue, CoerceViaIO, CollateClause, CollateExpr, ColumnDef, ColumnRef, CommentStmt, CommonTableExpr, CompositeTypeStmt, Constraint, ConstraintsSetStmt, ConvertRowtypeExpr, CopyStmt, CreateAmStmt, CreateCastStmt, CreateConversionStmt, CreatedbStmt, CreateDomainStmt, CreateEnumStmt, CreateEventTrigStmt, CreateExtensionStmt, CreateFdwStmt, CreateForeignServerStmt, CreateForeignTableStmt, CreateFunctionStmt, CreateOpClassItem, CreateOpClassStmt, CreateOpFamilyStmt, CreatePLangStmt, CreatePolicyStmt, CreatePublicationStmt, CreateRangeStmt, CreateRoleStmt, CreateSchemaStmt, CreateSeqStmt, CreateStatsStmt, CreateStmt, CreateSubscriptionStmt, CreateTableAsStmt, CreateTableSpaceStmt, CreateTransformStmt, CreateTrigStmt, CreateUserMappingStmt, CTECycleClause, CTESearchClause, CurrentOfExpr, DeallocateStmt, DeclareCursorStmt, DefElem, DefineStmt, DeleteStmt, DiscardStmt, DistinctExpr, DoStmt, DropdbStmt, DropOwnedStmt, DropRoleStmt, DropStmt, DropSubscriptionStmt, DropTableSpaceStmt, DropUserMappingStmt, ExecuteStmt, ExplainStmt, FetchStmt, FieldSelect, FieldStore, Float, FromExpr, FuncCall, FuncExpr, FunctionParameter, GrantRoleStmt, GrantStmt, GroupingFunc, GroupingSet, ImportForeignSchemaStmt, IndexElem, IndexStmt, InferClause, InferenceElem, InlineCodeBlock, InsertStmt, Integer, IntList, IntoClause, JoinExpr, JsonAggConstructor, JsonArgument, JsonArrayAgg, JsonArrayConstructor, JsonArrayQueryConstructor, JsonBehavior, JsonConstructorExpr, JsonExpr, JsonFormat, JsonFuncExpr, JsonIsPredicate, JsonKeyValue, JsonObjectAgg, JsonObjectConstructor, JsonOutput, JsonParseExpr, JsonReturning, JsonScalarExpr, JsonSerializeExpr, JsonTable, JsonTableColumn, JsonTablePath, JsonTablePathScan, JsonTablePathSpec, JsonTableSiblingJoin, JsonValueExpr, List, ListenStmt, LoadStmt, LockingClause, LockStmt, MergeAction, MergeStmt, MergeSupportFunc, MergeWhenClause, MinMaxExpr, MultiAssignRef, NamedArgExpr, NextValueExpr, NotifyStmt, NullIfExpr, NullTest, ObjectWithArgs, OidList, OnConflictClause, OnConflictExpr, OpExpr, Param, ParamRef, ParseResult, PartitionBoundSpec, PartitionCmd, PartitionElem, PartitionRangeDatum, PartitionSpec, PLAssignStmt, PrepareStmt, PublicationObjSpec, PublicationTable, Query, RangeFunction, RangeSubselect, RangeTableFunc, RangeTableFuncCol, RangeTableSample, RangeTblEntry, RangeTblFunction, RangeTblRef, RangeVar, RawStmt, ReassignOwnedStmt, RefreshMatViewStmt, ReindexStmt, RelabelType, RenameStmt, ReplicaIdentityStmt, ResTarget, ReturnStmt, RoleSpec, RowCompareExpr, RowExpr, RowMarkClause, RTEPermissionInfo, RuleStmt, ScalarArrayOpExpr, ScanResult, ScanToken,SecLabelStmt, SelectStmt, SetOperationStmt, SetToDefault, SinglePartitionSpec, SortBy, SortGroupClause, SQLValueFunction, StatsElem, String, SubLink, SubPlan, SubscriptingRef, TableFunc, TableLikeClause, TableSampleClause, TargetEntry, TransactionStmt, TriggerTransition, TruncateStmt, TypeCast, TypeName, UnlistenStmt, UpdateStmt, VacuumRelation, VacuumStmt, Var, VariableSetStmt, VariableShowStmt, ViewStmt, WindowClause, WindowDef, WindowFunc, WindowFuncRunCondition, WithCheckOption, WithClause, XmlExpr, XmlSerialize } from "@pgsql/types"; import _o from "nested-obj"; -import { ParseResult, ScanResult, Integer, Float, Boolean, String, BitString, List, OidList, IntList, A_Const, Alias, RangeVar, TableFunc, IntoClause, Var, Param, Aggref, GroupingFunc, WindowFunc, WindowFuncRunCondition, MergeSupportFunc, SubscriptingRef, FuncExpr, NamedArgExpr, OpExpr, DistinctExpr, NullIfExpr, ScalarArrayOpExpr, BoolExpr, SubLink, SubPlan, AlternativeSubPlan, FieldSelect, FieldStore, RelabelType, CoerceViaIO, ArrayCoerceExpr, ConvertRowtypeExpr, CollateExpr, CaseExpr, CaseWhen, CaseTestExpr, ArrayExpr, RowExpr, RowCompareExpr, CoalesceExpr, MinMaxExpr, SQLValueFunction, XmlExpr, JsonFormat, JsonReturning, JsonValueExpr, JsonConstructorExpr, JsonIsPredicate, JsonBehavior, JsonExpr, JsonTablePath, JsonTablePathScan, JsonTableSiblingJoin, NullTest, BooleanTest, MergeAction, CoerceToDomain, CoerceToDomainValue, SetToDefault, CurrentOfExpr, NextValueExpr, InferenceElem, TargetEntry, RangeTblRef, JoinExpr, FromExpr, OnConflictExpr, Query, TypeName, ColumnRef, ParamRef, A_Expr, TypeCast, CollateClause, RoleSpec, FuncCall, A_Star, A_Indices, A_Indirection, A_ArrayExpr, ResTarget, MultiAssignRef, SortBy, WindowDef, RangeSubselect, RangeFunction, RangeTableFunc, RangeTableFuncCol, RangeTableSample, ColumnDef, TableLikeClause, IndexElem, DefElem, LockingClause, XmlSerialize, PartitionElem, PartitionSpec, PartitionBoundSpec, PartitionRangeDatum, SinglePartitionSpec, PartitionCmd, RangeTblEntry, RTEPermissionInfo, RangeTblFunction, TableSampleClause, WithCheckOption, SortGroupClause, GroupingSet, WindowClause, RowMarkClause, WithClause, InferClause, OnConflictClause, CTESearchClause, CTECycleClause, CommonTableExpr, MergeWhenClause, TriggerTransition, JsonOutput, JsonArgument, JsonFuncExpr, JsonTablePathSpec, JsonTable, JsonTableColumn, JsonKeyValue, JsonParseExpr, JsonScalarExpr, JsonSerializeExpr, JsonObjectConstructor, JsonArrayConstructor, JsonArrayQueryConstructor, JsonAggConstructor, JsonObjectAgg, JsonArrayAgg, RawStmt, InsertStmt, DeleteStmt, UpdateStmt, MergeStmt, SelectStmt, SetOperationStmt, ReturnStmt, PLAssignStmt, CreateSchemaStmt, AlterTableStmt, ReplicaIdentityStmt, AlterTableCmd, AlterCollationStmt, AlterDomainStmt, GrantStmt, ObjectWithArgs, AccessPriv, GrantRoleStmt, AlterDefaultPrivilegesStmt, CopyStmt, VariableSetStmt, VariableShowStmt, CreateStmt, Constraint, CreateTableSpaceStmt, DropTableSpaceStmt, AlterTableSpaceOptionsStmt, AlterTableMoveAllStmt, CreateExtensionStmt, AlterExtensionStmt, AlterExtensionContentsStmt, CreateFdwStmt, AlterFdwStmt, CreateForeignServerStmt, AlterForeignServerStmt, CreateForeignTableStmt, CreateUserMappingStmt, AlterUserMappingStmt, DropUserMappingStmt, ImportForeignSchemaStmt, CreatePolicyStmt, AlterPolicyStmt, CreateAmStmt, CreateTrigStmt, CreateEventTrigStmt, AlterEventTrigStmt, CreatePLangStmt, CreateRoleStmt, AlterRoleStmt, AlterRoleSetStmt, DropRoleStmt, CreateSeqStmt, AlterSeqStmt, DefineStmt, CreateDomainStmt, CreateOpClassStmt, CreateOpClassItem, CreateOpFamilyStmt, AlterOpFamilyStmt, DropStmt, TruncateStmt, CommentStmt, SecLabelStmt, DeclareCursorStmt, ClosePortalStmt, FetchStmt, IndexStmt, CreateStatsStmt, StatsElem, AlterStatsStmt, CreateFunctionStmt, FunctionParameter, AlterFunctionStmt, DoStmt, InlineCodeBlock, CallStmt, CallContext, RenameStmt, AlterObjectDependsStmt, AlterObjectSchemaStmt, AlterOwnerStmt, AlterOperatorStmt, AlterTypeStmt, RuleStmt, NotifyStmt, ListenStmt, UnlistenStmt, TransactionStmt, CompositeTypeStmt, CreateEnumStmt, CreateRangeStmt, AlterEnumStmt, ViewStmt, LoadStmt, CreatedbStmt, AlterDatabaseStmt, AlterDatabaseRefreshCollStmt, AlterDatabaseSetStmt, DropdbStmt, AlterSystemStmt, ClusterStmt, VacuumStmt, VacuumRelation, ExplainStmt, CreateTableAsStmt, RefreshMatViewStmt, CheckPointStmt, DiscardStmt, LockStmt, ConstraintsSetStmt, ReindexStmt, CreateConversionStmt, CreateCastStmt, CreateTransformStmt, PrepareStmt, ExecuteStmt, DeallocateStmt, DropOwnedStmt, ReassignOwnedStmt, AlterTSDictionaryStmt, AlterTSConfigurationStmt, PublicationTable, PublicationObjSpec, CreatePublicationStmt, AlterPublicationStmt, CreateSubscriptionStmt, AlterSubscriptionStmt, DropSubscriptionStmt, ScanToken } from "@pgsql/types"; export default { parseResult(_p?: ParseResult): ParseResult { const _j = {} as ParseResult; diff --git a/postgres/pg-ast/src/wrapped.ts b/postgres/pg-ast/src/wrapped.ts index a8bff0279..d39ed5cd4 100644 --- a/postgres/pg-ast/src/wrapped.ts +++ b/postgres/pg-ast/src/wrapped.ts @@ -3,8 +3,8 @@ * DO NOT MODIFY IT BY HAND. Instead, modify the source proto file, * and run the pg-proto-parser generate command to regenerate this file. */ +import { A_ArrayExpr, A_Const, A_Expr, A_Indices, A_Indirection, A_Star, AccessPriv, Aggref, Alias, AlterCollationStmt, AlterDatabaseRefreshCollStmt, AlterDatabaseSetStmt, AlterDatabaseStmt, AlterDefaultPrivilegesStmt, AlterDomainStmt, AlterEnumStmt, AlterEventTrigStmt, AlterExtensionContentsStmt, AlterExtensionStmt, AlterFdwStmt, AlterForeignServerStmt, AlterFunctionStmt, AlternativeSubPlan, AlterObjectDependsStmt, AlterObjectSchemaStmt, AlterOperatorStmt, AlterOpFamilyStmt, AlterOwnerStmt, AlterPolicyStmt, AlterPublicationStmt, AlterRoleSetStmt, AlterRoleStmt, AlterSeqStmt, AlterStatsStmt, AlterSubscriptionStmt, AlterSystemStmt, AlterTableCmd, AlterTableMoveAllStmt, AlterTableSpaceOptionsStmt, AlterTableStmt, AlterTSConfigurationStmt, AlterTSDictionaryStmt, AlterTypeStmt, AlterUserMappingStmt, ArrayCoerceExpr, ArrayExpr, BitString, Boolean, BooleanTest, BoolExpr, CallContext, CallStmt, CaseExpr, CaseTestExpr, CaseWhen, CheckPointStmt, ClosePortalStmt, ClusterStmt, CoalesceExpr, CoerceToDomain, CoerceToDomainValue, CoerceViaIO, CollateClause, CollateExpr, ColumnDef, ColumnRef, CommentStmt, CommonTableExpr, CompositeTypeStmt, Constraint, ConstraintsSetStmt, ConvertRowtypeExpr, CopyStmt, CreateAmStmt, CreateCastStmt, CreateConversionStmt, CreatedbStmt, CreateDomainStmt, CreateEnumStmt, CreateEventTrigStmt, CreateExtensionStmt, CreateFdwStmt, CreateForeignServerStmt, CreateForeignTableStmt, CreateFunctionStmt, CreateOpClassItem, CreateOpClassStmt, CreateOpFamilyStmt, CreatePLangStmt, CreatePolicyStmt, CreatePublicationStmt, CreateRangeStmt, CreateRoleStmt, CreateSchemaStmt, CreateSeqStmt, CreateStatsStmt, CreateStmt, CreateSubscriptionStmt, CreateTableAsStmt, CreateTableSpaceStmt, CreateTransformStmt, CreateTrigStmt, CreateUserMappingStmt, CTECycleClause, CTESearchClause, CurrentOfExpr, DeallocateStmt, DeclareCursorStmt, DefElem, DefineStmt, DeleteStmt, DiscardStmt, DistinctExpr, DoStmt, DropdbStmt, DropOwnedStmt, DropRoleStmt, DropStmt, DropSubscriptionStmt, DropTableSpaceStmt, DropUserMappingStmt, ExecuteStmt, ExplainStmt, FetchStmt, FieldSelect, FieldStore, Float, FromExpr, FuncCall, FuncExpr, FunctionParameter, GrantRoleStmt, GrantStmt, GroupingFunc, GroupingSet, ImportForeignSchemaStmt, IndexElem, IndexStmt, InferClause, InferenceElem, InlineCodeBlock, InsertStmt, Integer, IntList, IntoClause, JoinExpr, JsonAggConstructor, JsonArgument, JsonArrayAgg, JsonArrayConstructor, JsonArrayQueryConstructor, JsonBehavior, JsonConstructorExpr, JsonExpr, JsonFormat, JsonFuncExpr, JsonIsPredicate, JsonKeyValue, JsonObjectAgg, JsonObjectConstructor, JsonOutput, JsonParseExpr, JsonReturning, JsonScalarExpr, JsonSerializeExpr, JsonTable, JsonTableColumn, JsonTablePath, JsonTablePathScan, JsonTablePathSpec, JsonTableSiblingJoin, JsonValueExpr, List, ListenStmt, LoadStmt, LockingClause, LockStmt, MergeAction, MergeStmt, MergeSupportFunc, MergeWhenClause, MinMaxExpr, MultiAssignRef, NamedArgExpr, NextValueExpr, NotifyStmt, NullIfExpr, NullTest, ObjectWithArgs, OidList, OnConflictClause, OnConflictExpr, OpExpr, Param, ParamRef, ParseResult, PartitionBoundSpec, PartitionCmd, PartitionElem, PartitionRangeDatum, PartitionSpec, PLAssignStmt, PrepareStmt, PublicationObjSpec, PublicationTable, Query, RangeFunction, RangeSubselect, RangeTableFunc, RangeTableFuncCol, RangeTableSample, RangeTblEntry, RangeTblFunction, RangeTblRef, RangeVar, RawStmt, ReassignOwnedStmt, RefreshMatViewStmt, ReindexStmt, RelabelType, RenameStmt, ReplicaIdentityStmt, ResTarget, ReturnStmt, RoleSpec, RowCompareExpr, RowExpr, RowMarkClause, RTEPermissionInfo, RuleStmt, ScalarArrayOpExpr, ScanResult, ScanToken,SecLabelStmt, SelectStmt, SetOperationStmt, SetToDefault, SinglePartitionSpec, SortBy, SortGroupClause, SQLValueFunction, StatsElem, String, SubLink, SubPlan, SubscriptingRef, TableFunc, TableLikeClause, TableSampleClause, TargetEntry, TransactionStmt, TriggerTransition, TruncateStmt, TypeCast, TypeName, UnlistenStmt, UpdateStmt, VacuumRelation, VacuumStmt, Var, VariableSetStmt, VariableShowStmt, ViewStmt, WindowClause, WindowDef, WindowFunc, WindowFuncRunCondition, WithCheckOption, WithClause, XmlExpr, XmlSerialize } from "@pgsql/types"; import _o from "nested-obj"; -import { ParseResult, ScanResult, Integer, Float, Boolean, String, BitString, List, OidList, IntList, A_Const, Alias, RangeVar, TableFunc, IntoClause, Var, Param, Aggref, GroupingFunc, WindowFunc, WindowFuncRunCondition, MergeSupportFunc, SubscriptingRef, FuncExpr, NamedArgExpr, OpExpr, DistinctExpr, NullIfExpr, ScalarArrayOpExpr, BoolExpr, SubLink, SubPlan, AlternativeSubPlan, FieldSelect, FieldStore, RelabelType, CoerceViaIO, ArrayCoerceExpr, ConvertRowtypeExpr, CollateExpr, CaseExpr, CaseWhen, CaseTestExpr, ArrayExpr, RowExpr, RowCompareExpr, CoalesceExpr, MinMaxExpr, SQLValueFunction, XmlExpr, JsonFormat, JsonReturning, JsonValueExpr, JsonConstructorExpr, JsonIsPredicate, JsonBehavior, JsonExpr, JsonTablePath, JsonTablePathScan, JsonTableSiblingJoin, NullTest, BooleanTest, MergeAction, CoerceToDomain, CoerceToDomainValue, SetToDefault, CurrentOfExpr, NextValueExpr, InferenceElem, TargetEntry, RangeTblRef, JoinExpr, FromExpr, OnConflictExpr, Query, TypeName, ColumnRef, ParamRef, A_Expr, TypeCast, CollateClause, RoleSpec, FuncCall, A_Star, A_Indices, A_Indirection, A_ArrayExpr, ResTarget, MultiAssignRef, SortBy, WindowDef, RangeSubselect, RangeFunction, RangeTableFunc, RangeTableFuncCol, RangeTableSample, ColumnDef, TableLikeClause, IndexElem, DefElem, LockingClause, XmlSerialize, PartitionElem, PartitionSpec, PartitionBoundSpec, PartitionRangeDatum, SinglePartitionSpec, PartitionCmd, RangeTblEntry, RTEPermissionInfo, RangeTblFunction, TableSampleClause, WithCheckOption, SortGroupClause, GroupingSet, WindowClause, RowMarkClause, WithClause, InferClause, OnConflictClause, CTESearchClause, CTECycleClause, CommonTableExpr, MergeWhenClause, TriggerTransition, JsonOutput, JsonArgument, JsonFuncExpr, JsonTablePathSpec, JsonTable, JsonTableColumn, JsonKeyValue, JsonParseExpr, JsonScalarExpr, JsonSerializeExpr, JsonObjectConstructor, JsonArrayConstructor, JsonArrayQueryConstructor, JsonAggConstructor, JsonObjectAgg, JsonArrayAgg, RawStmt, InsertStmt, DeleteStmt, UpdateStmt, MergeStmt, SelectStmt, SetOperationStmt, ReturnStmt, PLAssignStmt, CreateSchemaStmt, AlterTableStmt, ReplicaIdentityStmt, AlterTableCmd, AlterCollationStmt, AlterDomainStmt, GrantStmt, ObjectWithArgs, AccessPriv, GrantRoleStmt, AlterDefaultPrivilegesStmt, CopyStmt, VariableSetStmt, VariableShowStmt, CreateStmt, Constraint, CreateTableSpaceStmt, DropTableSpaceStmt, AlterTableSpaceOptionsStmt, AlterTableMoveAllStmt, CreateExtensionStmt, AlterExtensionStmt, AlterExtensionContentsStmt, CreateFdwStmt, AlterFdwStmt, CreateForeignServerStmt, AlterForeignServerStmt, CreateForeignTableStmt, CreateUserMappingStmt, AlterUserMappingStmt, DropUserMappingStmt, ImportForeignSchemaStmt, CreatePolicyStmt, AlterPolicyStmt, CreateAmStmt, CreateTrigStmt, CreateEventTrigStmt, AlterEventTrigStmt, CreatePLangStmt, CreateRoleStmt, AlterRoleStmt, AlterRoleSetStmt, DropRoleStmt, CreateSeqStmt, AlterSeqStmt, DefineStmt, CreateDomainStmt, CreateOpClassStmt, CreateOpClassItem, CreateOpFamilyStmt, AlterOpFamilyStmt, DropStmt, TruncateStmt, CommentStmt, SecLabelStmt, DeclareCursorStmt, ClosePortalStmt, FetchStmt, IndexStmt, CreateStatsStmt, StatsElem, AlterStatsStmt, CreateFunctionStmt, FunctionParameter, AlterFunctionStmt, DoStmt, InlineCodeBlock, CallStmt, CallContext, RenameStmt, AlterObjectDependsStmt, AlterObjectSchemaStmt, AlterOwnerStmt, AlterOperatorStmt, AlterTypeStmt, RuleStmt, NotifyStmt, ListenStmt, UnlistenStmt, TransactionStmt, CompositeTypeStmt, CreateEnumStmt, CreateRangeStmt, AlterEnumStmt, ViewStmt, LoadStmt, CreatedbStmt, AlterDatabaseStmt, AlterDatabaseRefreshCollStmt, AlterDatabaseSetStmt, DropdbStmt, AlterSystemStmt, ClusterStmt, VacuumStmt, VacuumRelation, ExplainStmt, CreateTableAsStmt, RefreshMatViewStmt, CheckPointStmt, DiscardStmt, LockStmt, ConstraintsSetStmt, ReindexStmt, CreateConversionStmt, CreateCastStmt, CreateTransformStmt, PrepareStmt, ExecuteStmt, DeallocateStmt, DropOwnedStmt, ReassignOwnedStmt, AlterTSDictionaryStmt, AlterTSConfigurationStmt, PublicationTable, PublicationObjSpec, CreatePublicationStmt, AlterPublicationStmt, CreateSubscriptionStmt, AlterSubscriptionStmt, DropSubscriptionStmt, ScanToken } from "@pgsql/types"; export default { parseResult(_p?: ParseResult): { ParseResult: ParseResult; diff --git a/postgres/pg-cache/src/pg.ts b/postgres/pg-cache/src/pg.ts index 5bd9d3727..ada917f19 100644 --- a/postgres/pg-cache/src/pg.ts +++ b/postgres/pg-cache/src/pg.ts @@ -1,6 +1,6 @@ +import { Logger } from '@pgpmjs/logger'; import pg from 'pg'; import { getPgEnvOptions, PgConfig } from 'pg-env'; -import { Logger } from '@pgpmjs/logger'; import { pgCache } from './lru'; diff --git a/postgres/pgsql-test/__tests__/postgres-test.seed-methods.test.ts b/postgres/pgsql-test/__tests__/postgres-test.seed-methods.test.ts index 550e86e62..5623b7b69 100644 --- a/postgres/pgsql-test/__tests__/postgres-test.seed-methods.test.ts +++ b/postgres/pgsql-test/__tests__/postgres-test.seed-methods.test.ts @@ -1,7 +1,8 @@ process.env.LOG_SCOPE = 'pgsql-test'; -import { writeFileSync, mkdirSync } from 'fs'; -import { join } from 'path'; +import { mkdirSync,writeFileSync } from 'fs'; import { tmpdir } from 'os'; +import { join } from 'path'; + import { seed } from '../src'; import { getConnections } from '../src/connect'; import { PgTestClient } from '../src/test-client'; diff --git a/postgres/pgsql-test/__tests__/utils.test.ts b/postgres/pgsql-test/__tests__/utils.test.ts index 9f75dda8c..1a9c5d465 100644 --- a/postgres/pgsql-test/__tests__/utils.test.ts +++ b/postgres/pgsql-test/__tests__/utils.test.ts @@ -1,13 +1,12 @@ import { - snapshot, + IdHash, prune, pruneDates, - pruneIds, + pruneHashes, pruneIdArrays, + pruneIds, pruneUUIDs, - pruneHashes, - IdHash -} from '../src/utils'; + snapshot} from '../src/utils'; describe('snapshot utilities', () => { describe('pruneDates', () => { diff --git a/postgres/pgsql-test/src/connect.ts b/postgres/pgsql-test/src/connect.ts index 9f82b4512..f122dd8a1 100644 --- a/postgres/pgsql-test/src/connect.ts +++ b/postgres/pgsql-test/src/connect.ts @@ -2,7 +2,6 @@ import { getConnEnvOptions } from '@pgpmjs/env'; import { PgTestConnectionOptions } from '@pgpmjs/types'; import { randomUUID } from 'crypto'; import { teardownPgPools } from 'pg-cache'; - import { getPgEnvOptions, PgConfig, diff --git a/postgres/pgsql-test/src/seed/json.ts b/postgres/pgsql-test/src/seed/json.ts index c580d6ed7..b1ec93bd6 100644 --- a/postgres/pgsql-test/src/seed/json.ts +++ b/postgres/pgsql-test/src/seed/json.ts @@ -1,4 +1,5 @@ import type { Client } from 'pg'; + import { SeedAdapter, SeedContext } from './types'; export interface JsonSeedMap { [table: string]: Record[]; diff --git a/postgres/pgsql-test/src/test-client.ts b/postgres/pgsql-test/src/test-client.ts index 20593a372..c27dde546 100644 --- a/postgres/pgsql-test/src/test-client.ts +++ b/postgres/pgsql-test/src/test-client.ts @@ -1,12 +1,13 @@ +import { AuthOptions, PgTestClientContext,PgTestConnectionOptions } from '@pgpmjs/types'; import { Client, QueryResult } from 'pg'; import { PgConfig } from 'pg-env'; -import { AuthOptions, PgTestConnectionOptions, PgTestClientContext } from '@pgpmjs/types'; -import { getRoleName } from './roles'; + import { generateContextStatements } from './context-utils'; +import { getRoleName } from './roles'; +import { type CsvSeedMap,loadCsvMap } from './seed/csv'; import { insertJson, type JsonSeedMap } from './seed/json'; -import { loadCsvMap, type CsvSeedMap } from './seed/csv'; -import { loadSqlFiles } from './seed/sql'; import { deployPgpm } from './seed/pgpm'; +import { loadSqlFiles } from './seed/sql'; export type PgTestClientOpts = { deferConnect?: boolean; diff --git a/postgres/supabase-test/src/connect.ts b/postgres/supabase-test/src/connect.ts index cefd52425..9c96894df 100644 --- a/postgres/supabase-test/src/connect.ts +++ b/postgres/supabase-test/src/connect.ts @@ -1,11 +1,10 @@ +import type { PgTestConnectionOptions } from '@pgpmjs/types'; import deepmerge from 'deepmerge'; import { getPgEnvVars, PgConfig } from 'pg-env'; import { - getConnections as getPgConnections, type GetConnectionOpts, - type GetConnectionResult -} from 'pgsql-test'; -import type { PgTestConnectionOptions } from '@pgpmjs/types'; + type GetConnectionResult, + getConnections as getPgConnections} from 'pgsql-test'; /** * Supabase default connection options diff --git a/postgres/supabase-test/src/index.ts b/postgres/supabase-test/src/index.ts index 6dd9ae370..00faf9b58 100644 --- a/postgres/supabase-test/src/index.ts +++ b/postgres/supabase-test/src/index.ts @@ -5,8 +5,8 @@ export * from 'pgsql-test'; export * from './helpers'; // Export Supabase-specific getConnections with defaults baked in -export { getConnections } from './connect'; export type { GetConnectionOpts, GetConnectionResult } from './connect'; +export { getConnections } from './connect'; // Re-export snapshot utility export { snapshot } from 'pgsql-test'; diff --git a/sandbox/my-third/__tests__/deploy-fast.test.ts b/sandbox/my-third/__tests__/deploy-fast.test.ts index 767195213..422739a1b 100644 --- a/sandbox/my-third/__tests__/deploy-fast.test.ts +++ b/sandbox/my-third/__tests__/deploy-fast.test.ts @@ -1,8 +1,8 @@ import { deployFast, PgpmPackage } from '@pgpmjs/core'; -import { resolve } from 'path'; import { getEnvOptions } from '@pgpmjs/env'; -import { randomUUID } from 'crypto'; import { execSync } from 'child_process'; +import { randomUUID } from 'crypto'; +import { resolve } from 'path'; import { getPgPool } from 'pg-cache'; it('Constructive', async () => { diff --git a/sandbox/my-third/__tests__/deploy-introspect.test.ts b/sandbox/my-third/__tests__/deploy-introspect.test.ts index 714d0d87f..1a904e8d4 100644 --- a/sandbox/my-third/__tests__/deploy-introspect.test.ts +++ b/sandbox/my-third/__tests__/deploy-introspect.test.ts @@ -1,8 +1,8 @@ import { deployFast, PgpmPackage } from '@pgpmjs/core'; import { getEnvOptions } from '@pgpmjs/env'; -import { getPgPool } from 'pg-cache'; -import { randomUUID } from 'crypto'; import { execSync } from 'child_process'; +import { randomUUID } from 'crypto'; +import { getPgPool } from 'pg-cache'; it('GraphQL query', async () => { const newDb = 'db-constructive-'+randomUUID(); diff --git a/sandbox/my-third/__tests__/deploy-massive.test.ts b/sandbox/my-third/__tests__/deploy-massive.test.ts index 2979e8c19..30c0a4237 100644 --- a/sandbox/my-third/__tests__/deploy-massive.test.ts +++ b/sandbox/my-third/__tests__/deploy-massive.test.ts @@ -1,7 +1,7 @@ import { deployFast, PgpmPackage } from '@pgpmjs/core'; import { getEnvOptions } from '@pgpmjs/env'; -import { randomUUID } from 'crypto'; import { execSync } from 'child_process'; +import { randomUUID } from 'crypto'; it('dashboard', async () => { const project = new PgpmPackage(process.env.CONSTRUCTIVE_DASHBOARD); diff --git a/sandbox/my-third/__tests__/deploy-stream.test.ts b/sandbox/my-third/__tests__/deploy-stream.test.ts index 9611f83a3..c6fa42ef8 100644 --- a/sandbox/my-third/__tests__/deploy-stream.test.ts +++ b/sandbox/my-third/__tests__/deploy-stream.test.ts @@ -1,8 +1,8 @@ import { deployStream, PgpmPackage } from '@pgpmjs/core'; -import { resolve } from 'path'; import { getEnvOptions } from '@pgpmjs/env'; -import { randomUUID } from 'crypto'; import { execSync } from 'child_process'; +import { randomUUID } from 'crypto'; +import { resolve } from 'path'; import { getPgPool } from 'pg-cache'; it('Constructive', async () => { diff --git a/sandbox/my-third/__tests__/deploy.test.ts b/sandbox/my-third/__tests__/deploy.test.ts index 51b878cc0..2ad93e9de 100644 --- a/sandbox/my-third/__tests__/deploy.test.ts +++ b/sandbox/my-third/__tests__/deploy.test.ts @@ -1,8 +1,8 @@ import { deploy, PgpmPackage } from '@pgpmjs/core'; -import { resolve } from 'path'; import { getEnvOptions } from '@pgpmjs/env'; -import { randomUUID } from 'crypto'; import { execSync } from 'child_process'; +import { randomUUID } from 'crypto'; +import { resolve } from 'path'; it('Constructive', async () => { const project = new PgpmPackage(resolve(__dirname+'/../')); diff --git a/sandbox/ollama/__tests__/pgvector.test.ts b/sandbox/ollama/__tests__/pgvector.test.ts index 14ee01725..b98e1d200 100644 --- a/sandbox/ollama/__tests__/pgvector.test.ts +++ b/sandbox/ollama/__tests__/pgvector.test.ts @@ -1,7 +1,8 @@ process.env.LOG_SCOPE = 'ollama'; jest.setTimeout(60000); -import { PgTestClient, getConnections } from 'pgsql-test'; +import { getConnections,PgTestClient } from 'pgsql-test'; + import { OllamaClient } from '../src/utils/ollama'; let pg: PgTestClient; diff --git a/sandbox/ollama/__tests__/rag.test.ts b/sandbox/ollama/__tests__/rag.test.ts index 39c720c42..a1cade1eb 100644 --- a/sandbox/ollama/__tests__/rag.test.ts +++ b/sandbox/ollama/__tests__/rag.test.ts @@ -1,9 +1,10 @@ process.env.LOG_SCOPE = 'ollama'; jest.setTimeout(60000); -import { PgTestClient, getConnections } from 'pgsql-test'; -import { OllamaClient } from '../src/utils/ollama'; import fetch from 'cross-fetch'; +import { getConnections,PgTestClient } from 'pgsql-test'; + +import { OllamaClient } from '../src/utils/ollama'; let pg: PgTestClient; let teardown: () => Promise; diff --git a/sandbox/ollama/src/services/rag.service.ts b/sandbox/ollama/src/services/rag.service.ts index 5466ab74d..3195677af 100644 --- a/sandbox/ollama/src/services/rag.service.ts +++ b/sandbox/ollama/src/services/rag.service.ts @@ -1,4 +1,5 @@ import { Pool } from 'pg'; + import { OllamaClient } from '../utils/ollama'; interface Document { diff --git a/streaming/s3-streamer/__tests__/uploads.test.ts b/streaming/s3-streamer/__tests__/uploads.test.ts index e75b9c64e..31732c74e 100644 --- a/streaming/s3-streamer/__tests__/uploads.test.ts +++ b/streaming/s3-streamer/__tests__/uploads.test.ts @@ -1,6 +1,6 @@ import { S3Client } from '@aws-sdk/client-s3'; -import { getEnvOptions } from '@pgpmjs/env'; import { createS3Bucket } from '@constructive-io/s3-utils'; +import { getEnvOptions } from '@pgpmjs/env'; import { createReadStream } from 'fs'; import { sync as glob } from 'glob'; import { basename } from 'path'; diff --git a/streaming/upload-names/src/index.ts b/streaming/upload-names/src/index.ts index f42a7484b..d6c794e05 100644 --- a/streaming/upload-names/src/index.ts +++ b/streaming/upload-names/src/index.ts @@ -1,4 +1,5 @@ import { basename, extname } from 'path'; + import slugify from './slugify'; interface Options {