diff --git a/README.md b/README.md index b564308..00c6bc1 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ Our goal is to make an Angular app with a list of the past SpaceX launches along client: { service: { name: 'angular-spacex-graphql-codegen', - url: 'https://api.spacex.land/graphql/' + url: 'https://spacex-production.up.railway.app/' } } }; @@ -104,7 +104,7 @@ Our goal is to make an Angular app with a list of the past SpaceX launches along Note the first line: `query launchDetails($id: ID!)` When we generate the Angular service the query name is turned into PascalCase and GQL is appended to the end, so the service name for the launch details would be LaunchDetailsGQL. Also in the first line we define any variables we'll need to pass into the query. Please note it's import to include id in the query return so apollo can cache the data. -1. We add [Apollo Angular](https://www.apollographql.com/docs/angular/) to our app with `ng add apollo-angular`. In `src/app/graphql.module.ts` we set our API url `const uri = 'https://api.spacex.land/graphql/';`. +1. We add [Apollo Angular](https://www.apollographql.com/docs/angular/) to our app with `ng add apollo-angular`. In `src/app/graphql.module.ts` we set our API url `const uri = 'https://spacex-production.up.railway.app/';`. 1. Install Graphql Code Generator and the needed plugins `npm i --save-dev @graphql-codegen/cli @graphql-codegen/typescript @graphql-codegen/typescript-apollo-angular @graphql-codegen/typescript-operations` @@ -113,7 +113,7 @@ Our goal is to make an Angular app with a list of the past SpaceX launches along ```yml # Where to get schema data schema: - - https://api.spacex.land/graphql/ + - https://spacex-production.up.railway.app/ # The client side queries to turn into services documents: - src/**/*.graphql diff --git a/apollo.config.js b/apollo.config.js index df8508c..18561e3 100644 --- a/apollo.config.js +++ b/apollo.config.js @@ -2,7 +2,7 @@ module.exports = { client: { service: { name: 'angular-spacex-graphql-codegen', - url: 'https://api.spacex.land/graphql/' + url: 'https://spacex-production.up.railway.app/' } } }; diff --git a/codegen.yml b/codegen.yml index 2755abb..8f8cadf 100644 --- a/codegen.yml +++ b/codegen.yml @@ -1,6 +1,6 @@ # Where to get schema data schema: - - https://api.spacex.land/graphql/ + - https://spacex-production.up.railway.app/ # The client side queries to turn into services documents: - src/**/*.graphql diff --git a/package.json b/package.json index 7a08d61..21b8eba 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "scripts": { "ng": "ng", "start": "ng serve --aot", + "start:legacy": "NODE_OPTIONS=--openssl-legacy-provider ng serve --aot", "build": "ng build", "test": "ng test", "lint": "ng lint", diff --git a/src/app/graphql.module.ts b/src/app/graphql.module.ts index 3d1e086..861cba0 100644 --- a/src/app/graphql.module.ts +++ b/src/app/graphql.module.ts @@ -3,7 +3,7 @@ import {ApolloModule, APOLLO_OPTIONS} from 'apollo-angular'; import {HttpLinkModule, HttpLink} from 'apollo-angular-link-http'; import {InMemoryCache} from 'apollo-cache-inmemory'; -const uri = 'https://api.spacex.land/graphql/'; // <-- add the URL of the GraphQL server here +const uri = 'https://spacex-production.up.railway.app/'; // <-- add the URL of the GraphQL server here export function createApollo(httpLink: HttpLink) { return { link: httpLink.create({uri}), diff --git a/src/app/services/spacexGraphql.service.ts b/src/app/services/spacexGraphql.service.ts index 0dd9bdb..c401806 100644 --- a/src/app/services/spacexGraphql.service.ts +++ b/src/app/services/spacexGraphql.service.ts @@ -10,12 +10,15 @@ export type Scalars = { Int: number, Float: number, Date: any, + uuid: any, + timestamptz: any, ObjectID: any, }; + export type Address = { __typename?: 'Address', address?: Maybe, @@ -25,6 +28,7 @@ export type Address = { export type Capsule = { __typename?: 'Capsule', + dragon?: Maybe, id?: Maybe, landings?: Maybe, missions?: Maybe>>, @@ -32,7 +36,6 @@ export type Capsule = { reuse_count?: Maybe, status?: Maybe, type?: Maybe, - dragon?: Maybe, }; export type CapsuleMission = { @@ -51,6 +54,14 @@ export type CapsulesFind = { type?: Maybe, }; +/** conflict action */ +export enum Conflict_Action { + /** ignore the insert on this row */ + Ignore = 'ignore', + /** update the row with the given values */ + Update = 'update' +} + export type Core = { __typename?: 'Core', asds_attempts?: Maybe, @@ -68,8 +79,8 @@ export type Core = { export type CoreMission = { __typename?: 'CoreMission', - name?: Maybe, flight?: Maybe, + name?: Maybe, }; export type CoresFind = { @@ -162,8 +173,8 @@ export type Force = { export type HistoriesResult = { __typename?: 'HistoriesResult', - result?: Maybe, data?: Maybe>>, + result?: Maybe, }; export type History = { @@ -171,10 +182,10 @@ export type History = { details?: Maybe, event_date_unix?: Maybe, event_date_utc?: Maybe, + flight?: Maybe, id?: Maybe, links?: Maybe, title?: Maybe, - flight?: Maybe, }; export type HistoryFind = { @@ -188,8 +199,8 @@ export type Info = { __typename?: 'Info', ceo?: Maybe, coo?: Maybe, - cto_propulsion?: Maybe, cto?: Maybe, + cto_propulsion?: Maybe, employees?: Maybe, founded?: Maybe, founder?: Maybe, @@ -239,18 +250,18 @@ export type Launch = { mission_id?: Maybe>>, mission_name?: Maybe, rocket?: Maybe, + ships?: Maybe>>, static_fire_date_unix?: Maybe, static_fire_date_utc?: Maybe, telemetry?: Maybe, tentative_max_precision?: Maybe, upcoming?: Maybe, - ships?: Maybe>>, }; export type LaunchesPastResult = { __typename?: 'LaunchesPastResult', - result?: Maybe, data?: Maybe>>, + result?: Maybe, }; export type LaunchFind = { @@ -320,8 +331,8 @@ export type LaunchLinks = { __typename?: 'LaunchLinks', article_link?: Maybe, flickr_images?: Maybe>>, - mission_patch_small?: Maybe, mission_patch?: Maybe, + mission_patch_small?: Maybe, presskit?: Maybe, reddit_campaign?: Maybe, reddit_launch?: Maybe, @@ -348,9 +359,9 @@ export type LaunchRocket = { __typename?: 'LaunchRocket', fairings?: Maybe, first_stage?: Maybe, + rocket?: Maybe, rocket_name?: Maybe, rocket_type?: Maybe, - rocket?: Maybe, second_stage?: Maybe, }; @@ -390,8 +401,8 @@ export type LaunchRocketSecondStage = { export type LaunchSite = { __typename?: 'LaunchSite', site_id?: Maybe, - site_name_long?: Maybe, site_name?: Maybe, + site_name_long?: Maybe, }; export type LaunchTelemetry = { @@ -426,16 +437,16 @@ export type Mission = { id?: Maybe, manufacturers?: Maybe>>, name?: Maybe, + payloads?: Maybe>>, twitter?: Maybe, website?: Maybe, wikipedia?: Maybe, - payloads?: Maybe>>, }; export type MissionResult = { __typename?: 'MissionResult', - result?: Maybe, data?: Maybe>>, + result?: Maybe, }; export type MissionsFind = { @@ -445,6 +456,49 @@ export type MissionsFind = { payload_id?: Maybe, }; +export type Mutation = { + __typename?: 'Mutation', + /** delete data from the table: "users" */ + delete_users?: Maybe, + /** insert data into the table: "users" */ + insert_users?: Maybe, + /** update data of the table: "users" */ + update_users?: Maybe, +}; + + +export type MutationDelete_UsersArgs = { + where: Users_Bool_Exp +}; + + +export type MutationInsert_UsersArgs = { + objects: Array, + on_conflict?: Maybe +}; + + +export type MutationUpdate_UsersArgs = { + _set?: Maybe, + where: Users_Bool_Exp +}; + + +/** column ordering options */ +export enum Order_By { + /** in the ascending order, nulls last */ + Asc = 'asc', + /** in the ascending order, nulls first */ + AscNullsFirst = 'asc_nulls_first', + /** in the ascending order, nulls last */ + AscNullsLast = 'asc_nulls_last', + /** in the descending order, nulls first */ + Desc = 'desc', + /** in the descending order, nulls first */ + DescNullsFirst = 'desc_nulls_first', + /** in the descending order, nulls last */ + DescNullsLast = 'desc_nulls_last' +} export type Payload = { __typename?: 'Payload', @@ -453,8 +507,8 @@ export type Payload = { manufacturer?: Maybe, nationality?: Maybe, norad_id?: Maybe>>, - orbit_params?: Maybe, orbit?: Maybe, + orbit_params?: Maybe, payload_mass_kg?: Maybe, payload_mass_lbs?: Maybe, payload_type?: Maybe, @@ -506,43 +560,54 @@ export type PayloadsFind = { export type Query = { __typename?: 'Query', + capsule?: Maybe, capsules?: Maybe>>, capsulesPast?: Maybe>>, capsulesUpcoming?: Maybe>>, - capsule?: Maybe, company?: Maybe, + core?: Maybe, cores?: Maybe>>, coresPast?: Maybe>>, coresUpcoming?: Maybe>>, - core?: Maybe, - dragons?: Maybe>>, dragon?: Maybe, + dragons?: Maybe>>, histories?: Maybe>>, historiesResult?: Maybe, history?: Maybe, - landpads?: Maybe>>, landpad?: Maybe, + landpads?: Maybe>>, + launch?: Maybe, + launchLatest?: Maybe, + launchNext?: Maybe, launches?: Maybe>>, launchesPast?: Maybe>>, launchesPastResult?: Maybe, launchesUpcoming?: Maybe>>, - launch?: Maybe, - launchLatest?: Maybe, - launchNext?: Maybe, - launchpads?: Maybe>>, launchpad?: Maybe, + launchpads?: Maybe>>, + mission?: Maybe, missions?: Maybe>>, missionsResult?: Maybe, - mission?: Maybe, - payloads?: Maybe>>, payload?: Maybe, + payloads?: Maybe>>, roadster?: Maybe, + rocket?: Maybe, rockets?: Maybe>>, rocketsResult?: Maybe, - rocket?: Maybe, + ship?: Maybe, ships?: Maybe>>, shipsResult?: Maybe, - ship?: Maybe, + /** fetch data from the table: "users" */ + users: Array, + /** fetch aggregated fields from the table: "users" */ + users_aggregate: Users_Aggregate, + /** fetch data from the table: "users" using primary key columns */ + users_by_pk?: Maybe, +}; + + +export type QueryCapsuleArgs = { + id: Scalars['ID'] }; @@ -573,7 +638,7 @@ export type QueryCapsulesUpcomingArgs = { }; -export type QueryCapsuleArgs = { +export type QueryCoreArgs = { id: Scalars['ID'] }; @@ -605,7 +670,7 @@ export type QueryCoresUpcomingArgs = { }; -export type QueryCoreArgs = { +export type QueryDragonArgs = { id: Scalars['ID'] }; @@ -616,11 +681,6 @@ export type QueryDragonsArgs = { }; -export type QueryDragonArgs = { - id: Scalars['ID'] -}; - - export type QueryHistoriesArgs = { find?: Maybe, limit?: Maybe, @@ -644,17 +704,32 @@ export type QueryHistoryArgs = { }; +export type QueryLandpadArgs = { + id: Scalars['ID'] +}; + + export type QueryLandpadsArgs = { limit?: Maybe, offset?: Maybe }; -export type QueryLandpadArgs = { +export type QueryLaunchArgs = { id: Scalars['ID'] }; +export type QueryLaunchLatestArgs = { + offset?: Maybe +}; + + +export type QueryLaunchNextArgs = { + offset?: Maybe +}; + + export type QueryLaunchesArgs = { find?: Maybe, limit?: Maybe, @@ -691,28 +766,18 @@ export type QueryLaunchesUpcomingArgs = { }; -export type QueryLaunchArgs = { +export type QueryLaunchpadArgs = { id: Scalars['ID'] }; -export type QueryLaunchLatestArgs = { - offset?: Maybe -}; - - -export type QueryLaunchNextArgs = { - offset?: Maybe -}; - - export type QueryLaunchpadsArgs = { limit?: Maybe, offset?: Maybe }; -export type QueryLaunchpadArgs = { +export type QueryMissionArgs = { id: Scalars['ID'] }; @@ -731,7 +796,7 @@ export type QueryMissionsResultArgs = { }; -export type QueryMissionArgs = { +export type QueryPayloadArgs = { id: Scalars['ID'] }; @@ -745,7 +810,7 @@ export type QueryPayloadsArgs = { }; -export type QueryPayloadArgs = { +export type QueryRocketArgs = { id: Scalars['ID'] }; @@ -762,7 +827,7 @@ export type QueryRocketsResultArgs = { }; -export type QueryRocketArgs = { +export type QueryShipArgs = { id: Scalars['ID'] }; @@ -785,8 +850,26 @@ export type QueryShipsResultArgs = { }; -export type QueryShipArgs = { - id: Scalars['ID'] +export type QueryUsersArgs = { + distinct_on?: Maybe>, + limit?: Maybe, + offset?: Maybe, + order_by?: Maybe>, + where?: Maybe +}; + + +export type QueryUsers_AggregateArgs = { + distinct_on?: Maybe>, + limit?: Maybe, + offset?: Maybe, + order_by?: Maybe>, + where?: Maybe +}; + + +export type QueryUsers_By_PkArgs = { + id: Scalars['uuid'] }; export type Result = { @@ -849,16 +932,16 @@ export type Rocket = { export type RocketEngines = { __typename?: 'RocketEngines', - number?: Maybe, - type?: Maybe, - version?: Maybe, - layout?: Maybe, engine_loss_max?: Maybe, + layout?: Maybe, + number?: Maybe, propellant_1?: Maybe, propellant_2?: Maybe, thrust_sea_level?: Maybe, - thrust_vacuum?: Maybe, thrust_to_weight?: Maybe, + thrust_vacuum?: Maybe, + type?: Maybe, + version?: Maybe, }; export type RocketFirstStage = { @@ -873,8 +956,8 @@ export type RocketFirstStage = { export type RocketLandingLegs = { __typename?: 'RocketLandingLegs', - number?: Maybe, material?: Maybe, + number?: Maybe, }; export type RocketPayloadWeight = { @@ -896,20 +979,20 @@ export type RocketSecondStage = { export type RocketSecondStagePayloadCompositeFairing = { __typename?: 'RocketSecondStagePayloadCompositeFairing', - height?: Maybe, diameter?: Maybe, + height?: Maybe, }; export type RocketSecondStagePayloads = { __typename?: 'RocketSecondStagePayloads', - option_1?: Maybe, composite_fairing?: Maybe, + option_1?: Maybe, }; export type RocketsResult = { __typename?: 'RocketsResult', - result?: Maybe, data?: Maybe>>, + result?: Maybe, }; export type Ship = { @@ -978,8 +1061,257 @@ export type ShipsFind = { export type ShipsResult = { __typename?: 'ShipsResult', - result?: Maybe, data?: Maybe>>, + result?: Maybe, +}; + +/** expression to compare columns of type String. All fields are combined with logical 'AND'. */ +export type String_Comparison_Exp = { + _eq?: Maybe, + _gt?: Maybe, + _gte?: Maybe, + _ilike?: Maybe, + _in?: Maybe>, + _is_null?: Maybe, + _like?: Maybe, + _lt?: Maybe, + _lte?: Maybe, + _neq?: Maybe, + _nilike?: Maybe, + _nin?: Maybe>, + _nlike?: Maybe, + _nsimilar?: Maybe, + _similar?: Maybe, +}; + +export type Subscription = { + __typename?: 'Subscription', + /** fetch data from the table: "users" */ + users: Array, + /** fetch aggregated fields from the table: "users" */ + users_aggregate: Users_Aggregate, + /** fetch data from the table: "users" using primary key columns */ + users_by_pk?: Maybe, +}; + + +export type SubscriptionUsersArgs = { + distinct_on?: Maybe>, + limit?: Maybe, + offset?: Maybe, + order_by?: Maybe>, + where?: Maybe +}; + + +export type SubscriptionUsers_AggregateArgs = { + distinct_on?: Maybe>, + limit?: Maybe, + offset?: Maybe, + order_by?: Maybe>, + where?: Maybe +}; + + +export type SubscriptionUsers_By_PkArgs = { + id: Scalars['uuid'] +}; + + +/** expression to compare columns of type timestamptz. All fields are combined with logical 'AND'. */ +export type Timestamptz_Comparison_Exp = { + _eq?: Maybe, + _gt?: Maybe, + _gte?: Maybe, + _in?: Maybe>, + _is_null?: Maybe, + _lt?: Maybe, + _lte?: Maybe, + _neq?: Maybe, + _nin?: Maybe>, +}; + +/** columns and relationships of "users" */ +export type Users = { + __typename?: 'users', + id: Scalars['uuid'], + name?: Maybe, + rocket?: Maybe, + timestamp: Scalars['timestamptz'], + twitter?: Maybe, +}; + +/** aggregated selection of "users" */ +export type Users_Aggregate = { + __typename?: 'users_aggregate', + aggregate?: Maybe, + nodes: Array, +}; + +/** aggregate fields of "users" */ +export type Users_Aggregate_Fields = { + __typename?: 'users_aggregate_fields', + count?: Maybe, + max?: Maybe, + min?: Maybe, +}; + + +/** aggregate fields of "users" */ +export type Users_Aggregate_FieldsCountArgs = { + columns?: Maybe>, + distinct?: Maybe +}; + +/** order by aggregate values of table "users" */ +export type Users_Aggregate_Order_By = { + count?: Maybe, + max?: Maybe, + min?: Maybe, +}; + +/** input type for inserting array relation for remote table "users" */ +export type Users_Arr_Rel_Insert_Input = { + data: Array, + on_conflict?: Maybe, +}; + +/** Boolean expression to filter rows from the table "users". All fields are combined with a logical 'AND'. */ +export type Users_Bool_Exp = { + _and?: Maybe>>, + _not?: Maybe, + _or?: Maybe>>, + id?: Maybe, + name?: Maybe, + rocket?: Maybe, + timestamp?: Maybe, + twitter?: Maybe, +}; + +/** unique or primary key constraints on table "users" */ +export enum Users_Constraint { + Unique = 'unique', + Or = 'or', + Primary = 'primary', + Key = 'key', + Constraint = 'constraint', + UsersPkey = 'users_pkey' +} + +/** input type for inserting data into table "users" */ +export type Users_Insert_Input = { + id?: Maybe, + name?: Maybe, + rocket?: Maybe, + timestamp?: Maybe, + twitter?: Maybe, +}; + +/** aggregate max on columns */ +export type Users_Max_Fields = { + __typename?: 'users_max_fields', + name?: Maybe, + rocket?: Maybe, + timestamp?: Maybe, + twitter?: Maybe, +}; + +/** order by max() on columns of table "users" */ +export type Users_Max_Order_By = { + name?: Maybe, + rocket?: Maybe, + timestamp?: Maybe, + twitter?: Maybe, +}; + +/** aggregate min on columns */ +export type Users_Min_Fields = { + __typename?: 'users_min_fields', + name?: Maybe, + rocket?: Maybe, + timestamp?: Maybe, + twitter?: Maybe, +}; + +/** order by min() on columns of table "users" */ +export type Users_Min_Order_By = { + name?: Maybe, + rocket?: Maybe, + timestamp?: Maybe, + twitter?: Maybe, +}; + +/** response of any mutation on the table "users" */ +export type Users_Mutation_Response = { + __typename?: 'users_mutation_response', + /** number of affected rows by the mutation */ + affected_rows: Scalars['Int'], + /** data of the affected rows by the mutation */ + returning: Array, +}; + +/** input type for inserting object relation for remote table "users" */ +export type Users_Obj_Rel_Insert_Input = { + data: Users_Insert_Input, + on_conflict?: Maybe, +}; + +/** on conflict condition type for table "users" */ +export type Users_On_Conflict = { + constraint: Users_Constraint, + update_columns: Array, +}; + +/** ordering options when selecting data from "users" */ +export type Users_Order_By = { + id?: Maybe, + name?: Maybe, + rocket?: Maybe, + timestamp?: Maybe, + twitter?: Maybe, +}; + +/** select columns of table "users" */ +export enum Users_Select_Column { + Column = 'column', + Name = 'name', + Id = 'id', + Rocket = 'rocket', + Timestamp = 'timestamp', + Twitter = 'twitter' +} + +/** input type for updating data in table "users" */ +export type Users_Set_Input = { + id?: Maybe, + name?: Maybe, + rocket?: Maybe, + timestamp?: Maybe, + twitter?: Maybe, +}; + +/** update columns of table "users" */ +export enum Users_Update_Column { + Column = 'column', + Name = 'name', + Id = 'id', + Rocket = 'rocket', + Timestamp = 'timestamp', + Twitter = 'twitter' +} + + +/** expression to compare columns of type uuid. All fields are combined with logical 'AND'. */ +export type Uuid_Comparison_Exp = { + _eq?: Maybe, + _gt?: Maybe, + _gte?: Maybe, + _in?: Maybe>, + _is_null?: Maybe, + _lt?: Maybe, + _lte?: Maybe, + _neq?: Maybe, + _nin?: Maybe>, }; export type Volume = {