Skip to content

Commit 44f8eb7

Browse files
authored
Merge pull request #401 from constructive-io/feat/sep-types
Feat/sep types
2 parents e4d5396 + 32758e5 commit 44f8eb7

39 files changed

Lines changed: 3254 additions & 7509 deletions

File tree

graphile/graphile-settings/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@
2828
"test": "jest",
2929
"test:watch": "jest --watch"
3030
},
31-
"dependencies": {
32-
"@graphile-contrib/pg-many-to-many": "^1.0.2",
33-
"@pgpmjs/env": "workspace:^",
31+
"dependencies": {
32+
"@graphile-contrib/pg-many-to-many": "^1.0.2",
33+
"@launchql/env": "workspace:^",
34+
"@launchql/types": "workspace:^",
3435
"@pgpmjs/types": "workspace:^",
3536
"cors": "^2.8.5",
3637
"express": "^5.1.0",

graphile/graphile-settings/src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import PgManyToMany from '@graphile-contrib/pg-many-to-many';
2-
import { getEnvOptions } from '@pgpmjs/env';
3-
import { PgpmOptions } from '@pgpmjs/types';
2+
import { getEnvOptions } from '@launchql/env';
3+
import { LaunchQLOptions } from '@launchql/types';
44
import PgPostgis from 'graphile-postgis';
55
import FulltextFilterPlugin from 'graphile-plugin-fulltext-filter';
66
import { NodePlugin, Plugin } from 'graphile-build';
@@ -19,7 +19,7 @@ import CustomPgTypeMappingsPlugin from 'graphile-pg-type-mappings';
1919
import UploadPostGraphilePlugin, { Uploader } from 'graphile-upload-plugin';
2020

2121
export const getGraphileSettings = (
22-
rawOpts: PgpmOptions
22+
rawOpts: LaunchQLOptions
2323
): PostGraphileOptions => {
2424
const opts = getEnvOptions(rawOpts);
2525

graphile/graphile-test/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,10 @@
3333
"graphql-tag": "2.12.6",
3434
"makage": "^0.1.8"
3535
},
36-
"dependencies": {
37-
"@pgpmjs/types": "workspace:^",
36+
"dependencies": {
37+
"@launchql/env": "workspace:^",
38+
"@launchql/types": "workspace:^",
39+
"@pgpmjs/types": "workspace:^",
3840
"graphql": "15.10.1",
3941
"mock-req": "^0.2.0",
4042
"pg": "^8.16.3",

graphile/graphile-test/src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { GraphileOptions } from '@pgpmjs/types';
1+
import type { GraphileOptions } from '@launchql/types';
22
import { DocumentNode, GraphQLError } from 'graphql';
33

44
export interface GraphQLQueryOptions<TVariables = Record<string, any>> {

graphile/graphile-upload-plugin/__tests__/plugin.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { join } from 'path';
33
import { createReadStream, writeFileSync, unlinkSync } from 'fs';
44
import { tmpdir } from 'os';
55
import { S3Client } from '@aws-sdk/client-s3';
6-
import { getEnvOptions } from '@pgpmjs/env';
6+
import { getEnvOptions } from '@launchql/env';
77
import { createS3Bucket } from '@launchql/s3-utils';
88
import { getConnections, snapshot, seed } from 'graphile-test';
99
import type { PgTestClient } from 'pgsql-test/test-client';

graphile/graphile-upload-plugin/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@
3737
"bugs": {
3838
"url": "https://github.com/constructive-io/constructive/issues"
3939
},
40-
"devDependencies": {
41-
"@aws-sdk/client-s3": "^3.948.0",
42-
"@launchql/s3-utils": "workspace:^",
43-
"@pgpmjs/env": "workspace:^",
40+
"devDependencies": {
41+
"@aws-sdk/client-s3": "^3.948.0",
42+
"@launchql/env": "workspace:^",
43+
"@launchql/s3-utils": "workspace:^",
4444
"@types/pg": "^8.16.0",
4545
"graphile-test": "workspace:^",
4646
"graphql-tag": "^2.12.6",

packages/cli/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@
4545
"pg": "^8.16.3",
4646
"ts-node": "^10.9.2"
4747
},
48-
"dependencies": {
49-
"@launchql/codegen": "workspace:^",
50-
"@launchql/explorer": "workspace:^",
51-
"@launchql/server": "workspace:^",
52-
"@pgpmjs/core": "workspace:^",
53-
"@pgpmjs/env": "workspace:^",
48+
"dependencies": {
49+
"@launchql/codegen": "workspace:^",
50+
"@launchql/env": "workspace:^",
51+
"@launchql/explorer": "workspace:^",
52+
"@launchql/server": "workspace:^",
53+
"@pgpmjs/core": "workspace:^",
5454
"@pgpmjs/logger": "workspace:^",
5555
"@pgpmjs/server-utils": "workspace:^",
5656
"@pgpmjs/types": "workspace:^",

packages/cli/src/commands/explorer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getEnvOptions } from '@pgpmjs/env';
1+
import { getEnvOptions } from '@launchql/env';
22
import { LaunchQLExplorer as explorer } from '@launchql/explorer';
33
import { Logger } from '@pgpmjs/logger';
44
import { PgpmOptions } from '@pgpmjs/types';

packages/cli/src/commands/server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getEnvOptions } from '@pgpmjs/env';
1+
import { getEnvOptions } from '@launchql/env';
22
import { Logger } from '@pgpmjs/logger';
33
import { LaunchQLServer as server } from '@launchql/server';
44
import { PgpmOptions } from '@pgpmjs/types';

packages/env/src/env.ts

Lines changed: 4 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ const parseEnvBoolean = (val?: string): boolean | undefined => {
1010
return ['true', '1', 'yes'].includes(val.toLowerCase());
1111
};
1212

13+
/**
14+
* Parse core PGPM environment variables.
15+
* GraphQL-related env vars (GRAPHILE_*, FEATURES_*, API_*) are handled by @launchql/env.
16+
*/
1317
export const getEnvVars = (): PgpmOptions => {
1418
const {
1519
PGROOTDATABASE,
@@ -33,19 +37,6 @@ export const getEnvVars = (): PgpmOptions => {
3337
PGPASSWORD,
3438
PGDATABASE,
3539

36-
GRAPHILE_SCHEMA,
37-
38-
FEATURES_SIMPLE_INFLECTION,
39-
FEATURES_OPPOSITE_BASE_NAMES,
40-
FEATURES_POSTGIS,
41-
API_ENABLE_META,
42-
API_IS_PUBLIC,
43-
API_EXPOSED_SCHEMAS,
44-
API_META_SCHEMAS,
45-
API_ANON_ROLE,
46-
API_ROLE_NAME,
47-
API_DEFAULT_DATABASE_ID,
48-
4940
BUCKET_NAME,
5041
AWS_REGION,
5142
AWS_ACCESS_KEY,
@@ -90,27 +81,6 @@ export const getEnvVars = (): PgpmOptions => {
9081
...(PGPASSWORD && { password: PGPASSWORD }),
9182
...(PGDATABASE && { database: PGDATABASE }),
9283
},
93-
graphile: {
94-
...(GRAPHILE_SCHEMA && {
95-
schema: GRAPHILE_SCHEMA.includes(',')
96-
? GRAPHILE_SCHEMA.split(',').map(s => s.trim())
97-
: GRAPHILE_SCHEMA
98-
}),
99-
},
100-
features: {
101-
...(FEATURES_SIMPLE_INFLECTION && { simpleInflection: parseEnvBoolean(FEATURES_SIMPLE_INFLECTION) }),
102-
...(FEATURES_OPPOSITE_BASE_NAMES && { oppositeBaseNames: parseEnvBoolean(FEATURES_OPPOSITE_BASE_NAMES) }),
103-
...(FEATURES_POSTGIS && { postgis: parseEnvBoolean(FEATURES_POSTGIS) }),
104-
},
105-
api: {
106-
...(API_ENABLE_META && { enableMetaApi: parseEnvBoolean(API_ENABLE_META) }),
107-
...(API_IS_PUBLIC && { isPublic: parseEnvBoolean(API_IS_PUBLIC) }),
108-
...(API_EXPOSED_SCHEMAS && { exposedSchemas: API_EXPOSED_SCHEMAS.split(',').map(s => s.trim()) }),
109-
...(API_META_SCHEMAS && { metaSchemas: API_META_SCHEMAS.split(',').map(s => s.trim()) }),
110-
...(API_ANON_ROLE && { anonRole: API_ANON_ROLE }),
111-
...(API_ROLE_NAME && { roleName: API_ROLE_NAME }),
112-
...(API_DEFAULT_DATABASE_ID && { defaultDatabaseId: API_DEFAULT_DATABASE_ID }),
113-
},
11484
cdn: {
11585
...(BUCKET_NAME && { bucketName: BUCKET_NAME }),
11686
...(AWS_REGION && { awsRegion: AWS_REGION }),

0 commit comments

Comments
 (0)