33# Activate python env
44source " bin/activate-env" > /dev/null 2>&1
55
6+ # Function to download GraphQL schema using curl and introspection
7+ download_graphql_schema () {
8+ local endpoint=" $1 "
9+ local output_file=" $2 "
10+
11+ echo " Downloading GraphQL schema from $endpoint ..."
12+
13+ curl -s -X POST " $endpoint " \
14+ -H " Content-Type: application/json" \
15+ -d ' {
16+ "query": "query IntrospectionQuery { __schema { queryType { name } mutationType { name } subscriptionType { name } types { ...FullType } directives { name description locations args { ...InputValue } } } } fragment FullType on __Type { kind name description fields(includeDeprecated: true) { name description args { ...InputValue } type { ...TypeRef } isDeprecated deprecationReason } inputFields { ...InputValue } interfaces { ...TypeRef } enumValues(includeDeprecated: true) { name description isDeprecated deprecationReason } possibleTypes { ...TypeRef } } fragment InputValue on __InputValue { name description type { ...TypeRef } defaultValue } fragment TypeRef on __Type { kind name ofType { kind name ofType { kind name ofType { kind name ofType { kind name ofType { kind name ofType { kind name ofType { kind name } } } } } } } }"
17+ }' \
18+ -o " $output_file " && echo " ✓ Schema saved to $output_file " || { echo " ✗ Failed to download schema" ; exit 1; }
19+ }
20+
621# Run server commands
722if [[ " $* " == * gen:ee* ]]; then
823 cd " ${ROOT:? } "
9- npx apollo service:download --endpoint= http://localhost:5002 /graphql/ " ${ROOT:? } /schemas/graphql-ee.json"
24+ download_graphql_schema " http://localhost:5004 /graphql/" " ${ROOT:? } /schemas/graphql-ee.json"
1025 cd -
1126elif [[ " $* " == * gen:graph* ]]; then
1227 cd " ${ROOT:? } "
13- npx apollo service:download --endpoint= http://localhost:5002 /graphql/ " ${ROOT:? } /schemas/graphql.json"
28+ download_graphql_schema " http://localhost:5004 /graphql/" " ${ROOT:? } /schemas/graphql.json"
1429 cd -
1530elif [[ " $* " == * gen:admin* ]]; then
1631 cd " ${ROOT:? } "
17- npx apollo service:download --endpoint= http://localhost:5002 /admin/graphql/ " ${ROOT:? } /schemas/graphql-admin.json"
32+ download_graphql_schema " http://localhost:5004 /admin/graphql/" " ${ROOT:? } /schemas/graphql-admin.json"
1833 cd -
1934elif [[ " $* " == * gen:platform* ]]; then
2035 cd " ${ROOT:? } "
21- npx apollo service:download --endpoint= http://0.0.0.0:5002 /admin/graphql/ " ${ROOT:? } /ee/platform/schemas/graphql-platform.json"
36+ download_graphql_schema " http://localhost:5004 /admin/graphql/" " ${ROOT:? } /ee/platform/schemas/graphql-platform.json"
2237 cd -
2338elif [[ " $* " == * gen:openapi* ]]; then
2439 cd " ${ROOT:? } "
25- curl http://localhost:5002 /shipping-openapi -o " ${ROOT:? } /schemas/openapi.yml"
40+ curl http://localhost:5004 /shipping-openapi -o " ${ROOT:? } /schemas/openapi.yml"
2641 cd -
2742elif [[ " $* " == * gen:ref* ]]; then
2843 cd " ${ROOT:? } "
29- curl http://localhost:5002 /v1/carriers > " ${ROOT:? } /apps/web/public/carrier-integrations.json"
44+ curl http://localhost:5004 /v1/carriers > " ${ROOT:? } /apps/web/public/carrier-integrations.json"
3045 cd -
3146elif [[ " $* " == * gen:ts:cli* ]]; then
3247 cd " ${ROOT:? } "
@@ -53,12 +68,12 @@ elif [[ "$*" == *build:js* ]]; then
5368else
5469 echo " Help: You can pass any of the following commands to the server"
5570 echo " -----"
56- echo " gen:ee - Generate GraphQL enterprise edition schema from localhost:5002 /graphql/"
57- echo " gen:graph - Generate standard GraphQL schema from localhost:5002 /graphql/"
58- echo " gen:admin - Generate Admin GraphQL schema from localhost:5002 /admin/graphql/"
59- echo " gen:platform - Generate Platform GraphQL schema from 0.0.0.0:5002 /admin/graphql/"
60- echo " gen:openapi - Generate OpenAPI schema from localhost:5002 /shipping-openapi"
61- echo " gen:ref - Generate carrier integrations reference file from localhost:5002 /v1/carriers"
71+ echo " gen:ee - Generate GraphQL enterprise edition schema from localhost:5004 /graphql/"
72+ echo " gen:graph - Generate standard GraphQL schema from localhost:5004 /graphql/"
73+ echo " gen:admin - Generate Admin GraphQL schema from localhost:5004 /admin/graphql/"
74+ echo " gen:platform - Generate Platform GraphQL schema from localhost:5004 /admin/graphql/"
75+ echo " gen:openapi - Generate OpenAPI schema from localhost:5004 /shipping-openapi"
76+ echo " gen:ref - Generate carrier integrations reference file from localhost:5004 /v1/carriers"
6277 echo " gen:ts:cli - Generate TypeScript fetch client from OpenAPI schema using docker"
6378 echo " build:js - Build Browser JavaScript client (runs gen:ts:cli, installs dependencies, builds with gulp)"
6479fi
0 commit comments