Skip to content

Commit 687d71b

Browse files
authored
Merge pull request #764 from constructive-io/devin/1772430816-cleanup-graphql-reexports
refactor: remove duplicative re-exports and options from graphql packages
2 parents f61fbea + 8e5e528 commit 687d71b

13 files changed

Lines changed: 2620 additions & 7868 deletions

File tree

graphql/env/src/index.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,3 @@
1-
// Re-export core env utilities from @pgpmjs/env
2-
export {
3-
loadConfigSync,
4-
loadConfigFileSync,
5-
loadConfigSyncFromDir,
6-
resolvePgpmPath,
7-
getConnEnvOptions,
8-
getDeploymentEnvOptions,
9-
getNodeEnv
10-
} from '@pgpmjs/env';
11-
121
// Export Constructive-specific env functions
132
export { getEnvOptions, getConstructiveEnvOptions } from './merge';
143
export { getGraphQLEnvVars } from './env';
15-
16-
// Re-export types for convenience
17-
export type { ConstructiveOptions, ConstructiveGraphQLOptions } from '@constructive-io/graphql-types';
18-
export { constructiveDefaults, constructiveGraphqlDefaults } from '@constructive-io/graphql-types';

graphql/server/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
"@constructive-io/url-domains": "workspace:^",
4747
"@graphile-contrib/pg-many-to-many": "2.0.0-rc.1",
4848
"@graphile/simplify-inflection": "8.0.0-rc.3",
49+
"@pgpmjs/env": "workspace:^",
4950
"@pgpmjs/logger": "workspace:^",
5051
"@pgpmjs/server-utils": "workspace:^",
5152
"@pgpmjs/types": "workspace:^",

graphql/server/src/index.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
export * from './server';
22

3-
// Export options module - types, defaults, type guards, and utility functions
4-
export * from './options';
5-
63
// Export middleware for use in testing packages
74
export { createApiMiddleware, getSubdomain, getApiConfig } from './middleware/api';
85
export { createAuthenticateMiddleware } from './middleware/auth';

graphql/server/src/middleware/api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getNodeEnv } from '@constructive-io/graphql-env';
1+
import { getNodeEnv } from '@pgpmjs/env';
22
import { Logger } from '@pgpmjs/logger';
33
import { svcCache } from '@pgpmjs/server-utils';
44
import { parseUrl } from '@constructive-io/url-domains';

graphql/server/src/middleware/auth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getNodeEnv } from '@constructive-io/graphql-env';
1+
import { getNodeEnv } from '@pgpmjs/env';
22
import { Logger } from '@pgpmjs/logger';
33
import { PgpmOptions } from '@pgpmjs/types';
44
import { NextFunction, Request, RequestHandler, Response } from 'express';

graphql/server/src/middleware/debug-memory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getNodeEnv } from '@constructive-io/graphql-env';
1+
import { getNodeEnv } from '@pgpmjs/env';
22
import { Logger } from '@pgpmjs/logger';
33
import { svcCache } from '@pgpmjs/server-utils';
44
import type { RequestHandler } from 'express';

graphql/server/src/middleware/error-handler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getNodeEnv } from '@constructive-io/graphql-env';
1+
import { getNodeEnv } from '@pgpmjs/env';
22
import { Logger } from '@pgpmjs/logger';
33
import type { ErrorRequestHandler, NextFunction, Request, Response } from 'express';
44

graphql/server/src/middleware/graphile.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import crypto from 'node:crypto';
2-
import { getNodeEnv } from '@constructive-io/graphql-env';
2+
import { getNodeEnv } from '@pgpmjs/env';
33
import type { ConstructiveOptions } from '@constructive-io/graphql-types';
44
import { Logger } from '@pgpmjs/logger';
55
import type { NextFunction, Request, RequestHandler, Response } from 'express';

graphql/server/src/options.ts

Lines changed: 0 additions & 298 deletions
This file was deleted.

graphql/server/src/server.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import { graphile } from './middleware/graphile';
2323
import { multipartBridge } from './middleware/multipart-bridge';
2424
import { createUploadAuthenticateMiddleware, uploadRoute } from './middleware/upload';
2525
import { debugMemory } from './middleware/debug-memory';
26-
import { normalizeServerOptions } from './options';
2726

2827
const log = new Logger('server');
2928

@@ -49,14 +48,8 @@ const log = new Logger('server');
4948
* ```
5049
*/
5150
export const GraphQLServer = (rawOpts: ConstructiveOptions | PgpmOptions = {}) => {
52-
// Normalize options to ConstructiveOptions with defaults applied
53-
const normalizedOpts = normalizeServerOptions(rawOpts as ConstructiveOptions);
54-
55-
// Apply environment variable overrides via getEnvOptions
56-
// Cast to PgpmOptions for backward compatibility with getEnvOptions
57-
const envOptions = getEnvOptions(normalizedOpts as PgpmOptions);
58-
59-
const app = new Server(envOptions);
51+
const opts = getEnvOptions(rawOpts);
52+
const app = new Server(opts);
6053
app.addEventListener();
6154
app.listen();
6255
};

0 commit comments

Comments
 (0)