diff --git a/README.md b/README.md index 1b39669..e491aa5 100644 --- a/README.md +++ b/README.md @@ -243,42 +243,6 @@ To delete an enumeration and it's values migration.deleteEnumeration(apiId); ``` -## Remote Type Definitions - -Remote fields allow you to define an external resolver through the management SDK. Remote fields consist of two parts, defining any custom type that will represent the returning shape from the external resolver, defining the resolver itself. - -### Create a Remote Type Definition - -Create a sample Remote Type Definition for Github API. - -```js -migration.createRemoteTypeDefinition({ - definition: - "type Github { id: Int!, login: String!, name: String!, company: String, bio: String, blog: String, location: String }", - displayName: "Github profile", - description: "Developer's Github profile", -}); -``` - -### Update a Remote Type Definition - -To update a Remote Type Definition - -```js -migration.updateRemoteTypeDefinition({ - apiId: - ... // properties to update -}); -``` - -### Delete a Remote Type Definition - -To delete a Remote Type Definition - -```js -migration.deleteRemoteTypeDefinition(apiId); -``` - ## Models Your schema is defined by the models you create, and fields you add. @@ -410,21 +374,6 @@ model.addUnionField({ }); ``` -To create a remote field. - -```js -model.addRemoteField({ - apiId, - displayName, - remoteConfig: { - method, // one of GET (default), POST or PUT. - payloadFieldApiIds, // Array of field API IDs to send as part of request payload - returnType, // previously declared remote type definition - url, // url to fetch the remote data from - }, -}); -``` - #### Update a Field To update a field, firstly retrieve the model. diff --git a/package.json b/package.json index ab42ee0..0b5e107 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "build": "tsdx build", "test": "tsdx test", "lint": "tsdx lint --ignore-pattern src/generated/**", + "format": "tsdx lint --ignore-pattern src/generated/** --fix", "prepare": "graphql-codegen && tsdx build", "size": "size-limit", "analyze": "size-limit --why", diff --git a/src/generated/schema.ts b/src/generated/schema.ts index c16be63..6977b13 100644 --- a/src/generated/schema.ts +++ b/src/generated/schema.ts @@ -93,23 +93,32 @@ export type GraphQLUpdateFilestackSecurityOptionsPayload = { export type GraphQLContentModel = { __typename?: "ContentModel"; models: Array; + components: Array; model: GraphQLIModel; + component: GraphQLComponent; assetModel: GraphQLIModel; enumerations: Array; locales: Array; unions: Array>; stages: Array; - remoteTypeDefinitions: Array; }; export type GraphQLContentModelModelsArgs = { includeSystemModels?: Maybe; }; +export type GraphQLContentModelComponentsArgs = { + includeSystemComponents?: Maybe; +}; + export type GraphQLContentModelModelArgs = { id: Scalars["ID"]; }; +export type GraphQLContentModelComponentArgs = { + id: Scalars["ID"]; +}; + export type GraphQLContentModelEnumerationsArgs = { includeSystemEnumerations?: Maybe; }; @@ -140,7 +149,6 @@ export type GraphQLContentView = { model: GraphQLIModel; type: GraphQLContentViewType; isSystem: Scalars["Boolean"]; - createdBy?: Maybe; orderBy?: Maybe; columns: Array; viewGroup: GraphQLViewGroup; @@ -284,6 +292,7 @@ export enum GraphQLLimitType { ContentModels = "CONTENT_MODELS", ContentStages = "CONTENT_STAGES", AuditLogsRetentionPeriod = "AUDIT_LOGS_RETENTION_PERIOD", + RemoteSources = "REMOTE_SOURCES", RemoteFields = "REMOTE_FIELDS", RemoteFieldsMaxExecutionTime = "REMOTE_FIELDS_MAX_EXECUTION_TIME", RemoteFieldsMaxResponseSize = "REMOTE_FIELDS_MAX_RESPONSE_SIZE", @@ -491,6 +500,11 @@ export enum GraphQLPermissionAction { ModelRead = "MODEL_READ", ModelUpdate = "MODEL_UPDATE", ModelDelete = "MODEL_DELETE", + /** Components */ + ComponentCreate = "COMPONENT_CREATE", + ComponentRead = "COMPONENT_READ", + ComponentUpdate = "COMPONENT_UPDATE", + ComponentDelete = "COMPONENT_DELETE", /** Locales */ LocaleCreate = "LOCALE_CREATE", LocaleRead = "LOCALE_READ", @@ -511,6 +525,11 @@ export enum GraphQLPermissionAction { FieldRead = "FIELD_READ", FieldUpdate = "FIELD_UPDATE", FieldDelete = "FIELD_DELETE", + /** Remote Sources */ + RemoteSourceCreate = "REMOTE_SOURCE_CREATE", + RemoteSourceRead = "REMOTE_SOURCE_READ", + RemoteSourceUpdate = "REMOTE_SOURCE_UPDATE", + RemoteSourceDelete = "REMOTE_SOURCE_DELETE", /** PATs */ PatCreate = "PAT_CREATE", PatRead = "PAT_READ", @@ -572,6 +591,10 @@ export enum GraphQLPermissionAction { ExtensionRead = "EXTENSION_READ", ExtensionUpdate = "EXTENSION_UPDATE", ExtensionDelete = "EXTENSION_DELETE", + /** Sidebar elements */ + SidebarElementCreate = "SIDEBAR_ELEMENT_CREATE", + SidebarElementUpdate = "SIDEBAR_ELEMENT_UPDATE", + SidebarElementDelete = "SIDEBAR_ELEMENT_DELETE", } export type GraphQLPermanentAuthTokenDefaultsInput = { @@ -673,6 +696,7 @@ export enum GraphQLAuditLogResource { Extension = "EXTENSION", EnumerationValue = "ENUMERATION_VALUE", Invite = "INVITE", + Component = "COMPONENT", } export enum GraphQLAuditLogAction { @@ -715,13 +739,10 @@ export type GraphQLAuditLogsPayload = { }; export enum GraphQLLifecycleStepType { - ModelCreated = "MODEL_CREATED", - FieldCreated = "FIELD_CREATED", - WebhookCreated = "WEBHOOK_CREATED", - UserInvited = "USER_INVITED", + SchemaSetup = "SCHEMA_SETUP", ContentAdded = "CONTENT_ADDED", + ExploreContentApi = "EXPLORE_CONTENT_API", ApiPermissionsSet = "API_PERMISSIONS_SET", - SchemaSetup = "SCHEMA_SETUP", ExternalTraffic = "EXTERNAL_TRAFFIC", } @@ -794,6 +815,8 @@ export type GraphQLProject = { /** List all Permissions usable/assignable to roles in this project */ availableManagementPermissions: Array; cloningProjects: Array; + /** if this is `null` it means the project is not publicly clone-able */ + publicCloneAccess?: Maybe; }; export type GraphQLProjectExistingRoleArgs = { @@ -816,6 +839,14 @@ export type GraphQLProjectAuditLogsArgs = { orderBy?: Maybe; }; +export type GraphQLPublicCloneAccess = { + __typename?: "PublicCloneAccess"; + id: Scalars["ID"]; + enabled: Scalars["Boolean"]; + includeContent: Scalars["Boolean"]; + includeWebhooks: Scalars["Boolean"]; +}; + export type GraphQLDeleteProjectPayload = { __typename?: "DeleteProjectPayload"; deletedProjectId: Scalars["ID"]; @@ -855,6 +886,24 @@ export type GraphQLMaxComplexityPayload = { gcms?: Maybe; }; +export type GraphQL_UpdatePlanTrialInput = { + gcms?: Maybe; +}; + +export type GraphQL_UpdatePlanTrialPayload = { + __typename?: "_UpdatePlanTrialPayload"; + gcms?: Maybe; +}; + +export type GraphQL_SwitchOwnerInput = { + gcms?: Maybe; +}; + +export type GraphQL_SwitchOwnerPayload = { + __typename?: "_SwitchOwnerPayload"; + gcms?: Maybe; +}; + export type GraphQL_BookOverLimitInput = { gcms?: Maybe; }; @@ -921,6 +970,15 @@ export type GraphQLCloneProjectInput = { template: GraphQLCloneProjectTemplateInput; }; +/** This is used to clone a project that someone made publicly clone-able. */ +export type GraphQLClonePublicProjectInput = { + region: Scalars["String"]; + name: Scalars["String"]; + description?: Maybe; + /** Usually extracted from the public clone url. */ + publicCloneAccessId: Scalars["ID"]; +}; + export type GraphQLCreateProjectInput = { region: Scalars["String"]; name: Scalars["String"]; @@ -929,11 +987,18 @@ export type GraphQLCreateProjectInput = { template?: Maybe; }; +export type GraphQLUpdatePublicCloneAccessInput = { + enabled: Scalars["Boolean"]; + includeContent: Scalars["Boolean"]; + includeWebhooks: Scalars["Boolean"]; +}; + export type GraphQLUpdateProjectInput = { id: Scalars["ID"]; name?: Maybe; description?: Maybe; picture?: Maybe; + publicCloneAccess?: Maybe; }; export type GraphQLDeleteProjectInput = { @@ -965,6 +1030,7 @@ export type GraphQLEnvironmentLevelQuota = { models: GraphQLProgress; stages: GraphQLProgress; contentPermissions: GraphQLProgress; + remoteSources: GraphQLProgress; }; export type GraphQLRegion = { @@ -1503,6 +1569,111 @@ export type GraphQLMigration = { resourceId?: Maybe; }; +export enum GraphQLRemote_Graphql_Type { + Scalar = "SCALAR", + Object = "OBJECT", + Interface = "INTERFACE", + Union = "UNION", + Enum = "ENUM", + InputObject = "INPUT_OBJECT", +} + +export type GraphQLIRemoteSource = { + id: Scalars["ID"]; + createdAt: Scalars["DateTime"]; + updatedAt: Scalars["DateTime"]; + displayName: Scalars["String"]; + description?: Maybe; + prefix: Scalars["String"]; + url: Scalars["String"]; + /** + * Optional headers that will be sent to the remote source on every remote field. In case the remote field is using the same + * Header Keys, the values will be overridden + */ + headers?: Maybe; + type: GraphQLRemoteSourceType; + remoteTypeDefinitionsConnection: GraphQLRemoteTypeDefinitionsConnection; + debugEnabled: Scalars["Boolean"]; +}; + +export type GraphQLIRemoteSourceRemoteTypeDefinitionsConnectionArgs = { + remoteGraphQLTypes?: Maybe>; + isUserDefined?: Maybe; + skip?: Scalars["Int"]; + first?: Scalars["Int"]; +}; + +export type GraphQLGraphQlRemoteSource = GraphQLIRemoteSource & { + __typename?: "GraphQLRemoteSource"; + id: Scalars["ID"]; + createdAt: Scalars["DateTime"]; + updatedAt: Scalars["DateTime"]; + displayName: Scalars["String"]; + description?: Maybe; + prefix: Scalars["String"]; + url: Scalars["String"]; + headers?: Maybe; + type: GraphQLRemoteSourceType; + remoteTypeDefinitionsConnection: GraphQLRemoteTypeDefinitionsConnection; + debugEnabled: Scalars["Boolean"]; + /** + * Specific URL that will be used for introspection if the introspection is available on another url than the regular url. + * Can be ignored if the introspection url is the same as the url of the remote source. + */ + introspectionUrl?: Maybe; + /** HTTP Headers that will be used when sending the introspection only */ + introspectionHeaders?: Maybe; + /** HTTP method that will be used for introspection */ + introspectionMethod: GraphQLGraphQlRemoteSourceIntrospectionMethod; + schema: Scalars["String"]; +}; + +export type GraphQLGraphQlRemoteSourceRemoteTypeDefinitionsConnectionArgs = { + remoteGraphQLTypes?: Maybe>; + isUserDefined?: Maybe; + skip?: Scalars["Int"]; + first?: Scalars["Int"]; +}; + +export type GraphQLRestRemoteSource = GraphQLIRemoteSource & { + __typename?: "RESTRemoteSource"; + id: Scalars["ID"]; + createdAt: Scalars["DateTime"]; + updatedAt: Scalars["DateTime"]; + displayName: Scalars["String"]; + description?: Maybe; + prefix: Scalars["String"]; + url: Scalars["String"]; + headers?: Maybe; + type: GraphQLRemoteSourceType; + remoteTypeDefinitionsConnection: GraphQLRemoteTypeDefinitionsConnection; + debugEnabled: Scalars["Boolean"]; +}; + +export type GraphQLRestRemoteSourceRemoteTypeDefinitionsConnectionArgs = { + remoteGraphQLTypes?: Maybe>; + isUserDefined?: Maybe; + skip?: Scalars["Int"]; + first?: Scalars["Int"]; +}; + +export type GraphQLRemoteTypeDefinitionEdge = { + __typename?: "RemoteTypeDefinitionEdge"; + node: GraphQLRemoteTypeDefinition; +}; + +export type GraphQLRemoteTypeDefinitionsAggregate = { + __typename?: "RemoteTypeDefinitionsAggregate"; + count: Scalars["Int"]; +}; + +export type GraphQLRemoteTypeDefinitionsConnection = { + __typename?: "RemoteTypeDefinitionsConnection"; + pageInfo: GraphQLPageInfo; + edges: Array; + aggregate: GraphQLRemoteTypeDefinitionsAggregate; +}; + export type GraphQLEnvironment = { __typename?: "Environment"; id: Scalars["ID"]; @@ -1522,6 +1693,8 @@ export type GraphQLEnvironment = { contentViews: Array; viewGroups: Array; contentModel: GraphQLContentModel; + remoteSources: Array; + remoteSource: GraphQLIRemoteSource; /** @deprecated Revisions are no longer maintained */ revisionCount: Scalars["Int"]; migrations: Array; @@ -1550,6 +1723,10 @@ export type GraphQLEnvironmentContentViewsArgs = { filter?: Maybe; }; +export type GraphQLEnvironmentRemoteSourceArgs = { + prefix: Scalars["String"]; +}; + export type GraphQLEnvironmentMigrationArgs = { id: Scalars["ID"]; }; @@ -1563,7 +1740,7 @@ export type GraphQLEnvironmentExtensionArgs = { }; export type GraphQLEnvironmentDiffArgs = { - environmentId: Scalars["ID"]; + environmentName: Scalars["String"]; }; export type GraphQLPublicContentApiDefauts = { @@ -1983,6 +2160,23 @@ export type GraphQLSetUserAnalyticsInput = { hubspotutk?: Maybe; }; +export enum GraphQLTrackEvent { + CreatedContent = "CREATED_CONTENT", + UsedPlayground = "USED_PLAYGROUND", + CheckedQuickstart = "CHECKED_QUICKSTART", +} + +export type GraphQLTrackInput = { + projectId: Scalars["ID"]; + event: GraphQLTrackEvent; + meta?: Maybe; +}; + +export type GraphQLTrackPayload = { + __typename?: "TrackPayload"; + success: Scalars["Boolean"]; +}; + export type GraphQLUpdateProfileInput = { name?: Maybe; company?: Maybe; @@ -2332,7 +2526,8 @@ export enum GraphQLExtensionFieldType { Date = "DATE", Location = "LOCATION", Color = "COLOR", - Remote = "REMOTE", + Graphql = "GRAPHQL", + Rest = "REST", Enumeration = "ENUMERATION", Relation = "RELATION", Asset = "ASSET", @@ -2366,6 +2561,7 @@ export type GraphQLIExtension = { updatedBy?: Maybe; name?: Maybe; description?: Maybe; + apiId: Scalars["String"]; /** The type indicating where the source for the extension will be obtained from */ srcType: GraphQLExtensionSrcType; /** Location for the source if the source type is an external one */ @@ -2386,6 +2582,7 @@ export type GraphQLFieldExtension = GraphQLIExtension & { updatedBy?: Maybe; name?: Maybe; description?: Maybe; + apiId: Scalars["String"]; /** The type indicating where the source for the extension will be obtained from */ srcType: GraphQLExtensionSrcType; /** Location for the source if the source type is an external one */ @@ -2402,6 +2599,28 @@ export type GraphQLFieldExtension = GraphQLIExtension & { fields: Array; }; +export type GraphQLSidebarExtension = GraphQLIExtension & { + __typename?: "SidebarExtension"; + id: Scalars["ID"]; + createdAt: Scalars["DateTime"]; + updatedAt: Scalars["DateTime"]; + createdBy?: Maybe; + updatedBy?: Maybe; + name?: Maybe; + description?: Maybe; + apiId: Scalars["String"]; + /** The type indicating where the source for the extension will be obtained from */ + srcType: GraphQLExtensionSrcType; + /** Location for the source if the source type is an external one */ + src: Scalars["String"]; + environment: GraphQLEnvironment; + config: Scalars["JSON"]; + isActive: Scalars["Boolean"]; + meta?: Maybe; + neededPermissions: Array; + sidebarElements: Array; +}; + export type GraphQLCreateFieldExtensionPayload = { __typename?: "CreateFieldExtensionPayload"; createdExtension: GraphQLFieldExtension; @@ -2412,6 +2631,16 @@ export type GraphQLUpdateFieldExtensionPayload = { updatedExtension: GraphQLFieldExtension; }; +export type GraphQLCreateSidebarExtensionPayload = { + __typename?: "CreateSidebarExtensionPayload"; + createdExtension: GraphQLSidebarExtension; +}; + +export type GraphQLUpdateSidebarExtensionPayload = { + __typename?: "UpdateSidebarExtensionPayload"; + updatedExtension: GraphQLSidebarExtension; +}; + export type GraphQLDeleteExtensionPayload = { __typename?: "DeleteExtensionPayload"; deletedExtensionId: Scalars["ID"]; @@ -2421,6 +2650,7 @@ export type GraphQLCreateFieldExtensionInput = { environmentId: Scalars["ID"]; name?: Maybe; description?: Maybe; + apiId: Scalars["String"]; srcTypeId: Scalars["ID"]; src: Scalars["String"]; config: Scalars["JSON"]; @@ -2437,6 +2667,7 @@ export type GraphQLUpdateFieldExtensionInput = { extensionId: Scalars["ID"]; name?: Maybe; description?: Maybe; + apiId: Scalars["String"]; srcTypeId?: Maybe; src?: Maybe; config?: Maybe; @@ -2449,6 +2680,32 @@ export type GraphQLUpdateFieldExtensionInput = { neededPermissions?: Maybe>; }; +export type GraphQLCreateSidebarExtensionInput = { + environmentId: Scalars["ID"]; + name?: Maybe; + description?: Maybe; + apiId: Scalars["String"]; + srcTypeId: Scalars["ID"]; + src: Scalars["String"]; + config: Scalars["JSON"]; + isActive: Scalars["Boolean"]; + meta?: Maybe; + neededPermissions?: Maybe>; +}; + +export type GraphQLUpdateSidebarExtensionInput = { + extensionId: Scalars["ID"]; + name?: Maybe; + description?: Maybe; + apiId: Scalars["String"]; + srcTypeId?: Maybe; + src?: Maybe; + config?: Maybe; + isActive?: Maybe; + meta?: Maybe; + neededPermissions?: Maybe>; +}; + export type GraphQLDeleteExtensionInput = { extensionId: Scalars["ID"]; }; @@ -2547,7 +2804,7 @@ export type GraphQLFieldValidationRange = { export type GraphQLFieldValidationRegEx = { __typename?: "FieldValidationRegEx"; regex?: Maybe; - flags?: Maybe>>; + flags?: Maybe>; errorMessage?: Maybe; }; @@ -2596,7 +2853,12 @@ export type GraphQLIField = { /** @deprecated Use visibility instead */ isHidden: Scalars["Boolean"]; visibility: GraphQLVisibilityTypes; + /** + * This will throw a runtime error for fields that are on a component instead of model! + * @deprecated Use parent instead + */ model: GraphQLIModel; + parent: GraphQLIFieldParent; tableConfig: GraphQLFieldConfig; formConfig: GraphQLFieldConfig; extensions?: Maybe; @@ -2619,7 +2881,18 @@ export enum GraphQLSimpleFieldType { } export enum GraphQLRemoteFieldType { - Remote = "REMOTE", + Graphql = "GRAPHQL", + Rest = "REST", +} + +export enum GraphQLRemoteFieldApiMethod { + Get = "GET", + Post = "POST", +} + +export enum GraphQLGraphQlRemoteSourceIntrospectionMethod { + Get = "GET", + Post = "POST", } export enum GraphQLEnumerableFieldType { @@ -2631,10 +2904,18 @@ export enum GraphQLRelationalFieldType { Asset = "ASSET", } +export enum GraphQLComponentFieldType { + Component = "COMPONENT", +} + export enum GraphQLUnionFieldType { Union = "UNION", } +export enum GraphQLComponentUnionFieldType { + ComponentUnion = "COMPONENT_UNION", +} + export enum GraphQLVisibilityTypes { /** Field can be read and edited */ ReadWrite = "READ_WRITE", @@ -2669,7 +2950,12 @@ export type GraphQLSimpleField = GraphQLIField & visibility: GraphQLVisibilityTypes; isLocalized: Scalars["Boolean"]; initialValue?: Maybe; + /** + * This will throw a runtime error for fields that are on a component instead of model! + * @deprecated Use parent instead + */ model: GraphQLIModel; + parent: GraphQLIFieldParent; isTitle: Scalars["Boolean"]; tableConfig: GraphQLFieldConfig; formConfig: GraphQLFieldConfig; @@ -2687,18 +2973,43 @@ export type GraphQLRemoteTypeDefinition = { createdAt: Scalars["DateTime"]; updatedAt: Scalars["DateTime"]; apiId: Scalars["String"]; - displayName: Scalars["String"]; - description?: Maybe; - definition: Scalars["String"]; + sdl: Scalars["String"]; + graphqlType: GraphQLRemote_Graphql_Type; + isSystem: Scalars["Boolean"]; }; -export type GraphQLRemoteFieldConfig = { - __typename?: "RemoteFieldConfig"; - returnType: Scalars["String"]; - payloadFields: Array>; - url: Scalars["String"]; - method: Scalars["String"]; +export type GraphQLIRemoteFieldConfig = { + returnType: GraphQLRemoteTypeDefinition; + /** Headers that will be sent to the remote source. Those headers will override the headers defined on the remote source if setup */ + headers?: Maybe; + method: GraphQLRemoteFieldApiMethod; + cacheTTLSeconds?: Maybe; + remoteSource: GraphQLIRemoteSource; + forwardClientHeaders: Scalars["Boolean"]; +}; + +export type GraphQLGraphQlRemoteFieldConfig = GraphQLIRemoteFieldConfig & { + __typename?: "GraphQLRemoteFieldConfig"; + returnType: GraphQLRemoteTypeDefinition; + headers?: Maybe; + method: GraphQLRemoteFieldApiMethod; + cacheTTLSeconds?: Maybe; + forwardClientHeaders: Scalars["Boolean"]; + /** In case of apiType GraphQL graphqlQuery contains the GraphQL query that will be sent to the remote source */ + query?: Maybe; + operationName?: Maybe; + remoteSource: GraphQLGraphQlRemoteSource; +}; + +export type GraphQLRestRemoteFieldConfig = GraphQLIRemoteFieldConfig & { + __typename?: "RestRemoteFieldConfig"; + returnType: GraphQLRemoteTypeDefinition; headers?: Maybe; + method: GraphQLRemoteFieldApiMethod; + cacheTTLSeconds?: Maybe; + forwardClientHeaders: Scalars["Boolean"]; + path?: Maybe; + remoteSource: GraphQLRestRemoteSource; }; export type GraphQLRemoteField = GraphQLIField & { @@ -2716,12 +3027,19 @@ export type GraphQLRemoteField = GraphQLIField & { isHidden: Scalars["Boolean"]; visibility: GraphQLVisibilityTypes; isList: Scalars["Boolean"]; + isRequired: Scalars["Boolean"]; + /** + * This will throw a runtime error for fields that are on a component instead of model! + * @deprecated Use parent instead + */ model: GraphQLIModel; + parent: GraphQLIFieldParent; tableConfig: GraphQLFieldConfig; formConfig: GraphQLFieldConfig; extensions?: Maybe; meta?: Maybe; - remoteConfig: GraphQLRemoteFieldConfig; + remoteConfig: GraphQLIRemoteFieldConfig; + inputArgs?: Maybe>; }; export type GraphQLEnumerableField = GraphQLIField & @@ -2747,7 +3065,12 @@ export type GraphQLEnumerableField = GraphQLIField & visibility: GraphQLVisibilityTypes; isLocalized: Scalars["Boolean"]; initialValue?: Maybe; + /** + * This will throw a runtime error for fields that are on a component instead of model! + * @deprecated Use parent instead + */ model: GraphQLIModel; + parent: GraphQLIFieldParent; isTitle: Scalars["Boolean"]; tableConfig: GraphQLFieldConfig; formConfig: GraphQLFieldConfig; @@ -2773,7 +3096,12 @@ export type GraphQLRelationalField = GraphQLIField & /** @deprecated Use visibility instead */ isHidden: Scalars["Boolean"]; visibility: GraphQLVisibilityTypes; + /** + * This will throw a runtime error for fields that are on a component instead of model! + * @deprecated Use parent instead + */ model: GraphQLIModel; + parent: GraphQLIFieldParent; tableConfig: GraphQLFieldConfig; formConfig: GraphQLFieldConfig; relatedModel: GraphQLIModel; @@ -2799,7 +3127,12 @@ export type GraphQLUniDirectionalRelationalField = GraphQLIField & /** @deprecated Use visibility instead */ isHidden: Scalars["Boolean"]; visibility: GraphQLVisibilityTypes; + /** + * This will throw a runtime error for fields that are on a component instead of model! + * @deprecated Use parent instead + */ model: GraphQLIModel; + parent: GraphQLIFieldParent; tableConfig: GraphQLFieldConfig; formConfig: GraphQLFieldConfig; relatedModel: GraphQLIModel; @@ -2807,6 +3140,38 @@ export type GraphQLUniDirectionalRelationalField = GraphQLIField & meta?: Maybe; }; +export type GraphQLComponentField = GraphQLIField & + GraphQLIRequireableField & { + __typename?: "ComponentField"; + id: Scalars["ID"]; + createdAt: Scalars["DateTime"]; + updatedAt: Scalars["DateTime"]; + type: GraphQLComponentFieldType; + apiId: Scalars["String"]; + displayName: Scalars["String"]; + description?: Maybe; + isSystem: Scalars["Boolean"]; + isList: Scalars["Boolean"]; + isRequired: Scalars["Boolean"]; + position: Scalars["Int"]; + /** @deprecated Use visibility instead */ + isHidden: Scalars["Boolean"]; + visibility: GraphQLVisibilityTypes; + /** + * This will throw a runtime error for fields that are on a component instead of model! + * @deprecated Use parent instead + */ + model: GraphQLIModel; + parent: GraphQLIFieldParent; + hasEmptyValues: Scalars["Boolean"]; + tableConfig: GraphQLFieldConfig; + formConfig: GraphQLFieldConfig; + component: GraphQLComponent; + extensions?: Maybe; + meta?: Maybe; + }; + +/** rename to RelationUnionField maybe at some point */ export type GraphQLUnionField = GraphQLIField & GraphQLIUnionField & { __typename?: "UnionField"; @@ -2823,7 +3188,12 @@ export type GraphQLUnionField = GraphQLIField & /** @deprecated Use visibility instead */ isHidden: Scalars["Boolean"]; visibility: GraphQLVisibilityTypes; + /** + * This will throw a runtime error for fields that are on a component instead of model! + * @deprecated Use parent instead + */ model: GraphQLIModel; + parent: GraphQLIFieldParent; tableConfig: GraphQLFieldConfig; formConfig: GraphQLFieldConfig; /** True if this field is the reverse side of the initally created union field */ @@ -2833,6 +3203,37 @@ export type GraphQLUnionField = GraphQLIField & meta?: Maybe; }; +/** TODO: ModularComponentField is the name the designs use right now?! */ +export type GraphQLComponentUnionField = GraphQLIField & + GraphQLIRequireableField & { + __typename?: "ComponentUnionField"; + id: Scalars["ID"]; + createdAt: Scalars["DateTime"]; + updatedAt: Scalars["DateTime"]; + type: GraphQLComponentUnionFieldType; + apiId: Scalars["String"]; + displayName: Scalars["String"]; + description?: Maybe; + isSystem: Scalars["Boolean"]; + isList: Scalars["Boolean"]; + isRequired: Scalars["Boolean"]; + position: Scalars["Int"]; + /** @deprecated Use visibility instead */ + isHidden: Scalars["Boolean"]; + visibility: GraphQLVisibilityTypes; + /** + * This will throw a runtime error for fields that are on a component instead of model! + * @deprecated Use parent instead + */ + model: GraphQLIModel; + parent: GraphQLIFieldParent; + tableConfig: GraphQLFieldConfig; + formConfig: GraphQLFieldConfig; + components: Array; + extensions?: Maybe; + meta?: Maybe; + }; + export type GraphQLUnion = { __typename?: "Union"; id: Scalars["ID"]; @@ -2862,6 +3263,11 @@ export type GraphQLMoveFieldPayload = { movedFields: Array; }; +export type GraphQLMoveSidebarElementPayload = { + __typename?: "MoveSidebarElementPayload"; + movedSidebarElements: Array; +}; + export type GraphQLFieldValidationIntRangeInput = { min?: Maybe; max?: Maybe; @@ -2932,6 +3338,22 @@ export type GraphQLUpdateSimpleFieldInput = { embeddableModels?: Maybe; }; +export type GraphQLUpdateRemoteFieldInput = { + id: Scalars["ID"]; + apiId?: Maybe; + remoteConfig?: Maybe; + inputArgs?: Maybe; + isList?: Maybe; + isRequired?: Maybe; + displayName?: Maybe; + description?: Maybe; + visibility?: Maybe; + formConfig?: Maybe; + tableConfig?: Maybe; + extensions?: Maybe; + meta?: Maybe; +}; + export type GraphQLUpdateEnumerableFieldInput = { id: Scalars["ID"]; apiId?: Maybe; @@ -2972,6 +3394,33 @@ export type GraphQLUpdateRelationalFieldInput = { meta?: Maybe; }; +export type GraphQLUpdateComponentFieldInput = { + id: Scalars["ID"]; + apiId?: Maybe; + displayName?: Maybe; + description?: Maybe; + isList?: Maybe; + visibility?: Maybe; + isRequired?: Maybe; + tableConfig?: Maybe; + formConfig?: Maybe; + extensions?: Maybe; + meta?: Maybe; +}; + +export type GraphQLUpdateComponentUnionFieldInput = { + id: Scalars["ID"]; + components?: Maybe>; + apiId?: Maybe; + displayName?: Maybe; + description?: Maybe; + visibility?: Maybe; + tableConfig?: Maybe; + formConfig?: Maybe; + extensions?: Maybe; + meta?: Maybe; +}; + export type GraphQLCreateMemberFieldInput = { /** ID of member model to add */ modelId: Scalars["ID"]; @@ -3023,7 +3472,12 @@ export type GraphQLFieldConfigUpdateInput = { }; export type GraphQLCreateSimpleFieldInput = { - modelId: Scalars["ID"]; + modelId?: Maybe; + /** + * This can be a model or component id, modelId must be empty when parentId is used + * either modelId or parentId needs to be set and is required via validation, it will be made required. + */ + parentId?: Maybe; apiId: Scalars["String"]; type: GraphQLSimpleFieldType; displayName: Scalars["String"]; @@ -3049,74 +3503,160 @@ export type GraphQLCreateSimpleFieldInput = { }; export type GraphQLRemoteFieldConfigInput = { - /** - * GraphQL type the remote field should return. - * - * Can be any built-in scalar - * - ID - * - String - * - Boolean - * - Int - * - Float - * - * or any GraphCMS custom scalar - * - Long - * - Json - * - DateTime - * - Date - * - * or any GraphCMS type - * - Color - * - Location - * - RichText - * - * or a remote type definition - */ - returnType: Scalars["String"]; - payloadFieldIds: Array; - url: Scalars["String"]; - method: Scalars["String"]; + /** Remote Type definitions apiId of the type the remote field should return. */ + returnTypeApiId: Scalars["String"]; + headers?: Maybe; + method: GraphQLRemoteFieldApiMethod; + cacheTTLSeconds?: Maybe; + remoteSourceId: Scalars["ID"]; + /** In case of apiType GraphQL graphqlQuery contains the GraphQL query that will be sent to the remote source */ + graphQLQuery?: Maybe; + /** In case of apiType REST restPath contains the path that will be appended to the API base url */ + restPath?: Maybe; + /** If true, headers that are sent by the client will be forwarded to the remote source */ + forwardClientHeaders?: Maybe; +}; + +export type GraphQLUpdateRemoteFieldConfigInput = { + /** Remote Type definitions apiId of the type the remote field should return. */ + returnTypeApiId?: Maybe; headers?: Maybe; - requestParamFieldApiIds?: Maybe>; + method?: Maybe; + forwardClientHeaders?: Maybe; + /** In case of apiType GraphQL graphqlQuery contains the GraphQL query that will be sent to the remote source */ + graphQLQuery?: Maybe; + /** In case of apiType REST restPath contains the path that will be appended to the base url of the api */ + restPath?: Maybe; + cacheTTLSeconds?: Maybe; + remoteSourceId?: Maybe; +}; + +export type GraphQLUpsertFieldInputArgInputToCreateInput = { + remoteTypeId: Scalars["ID"]; + apiId: Scalars["String"]; + isRequired: Scalars["Boolean"]; + isList: Scalars["Boolean"]; +}; + +export type GraphQLUpsertFieldInputArgInputToUpdateInput = { + inputArgId: Scalars["ID"]; + remoteTypeId?: Maybe; + apiId?: Maybe; + isRequired?: Maybe; + isList?: Maybe; +}; + +export type GraphQLUpsertFieldInputArgInputToDeleteInput = { + inputArgId: Scalars["ID"]; +}; + +export type GraphQLUpsertFieldInputArgInput = { + fieldInputArgsToCreate?: Maybe< + Array + >; + fieldInputArgsToDelete?: Maybe< + Array + >; + fieldInputArgsToUpdate?: Maybe< + Array + >; +}; + +export type GraphQLCreateFieldInputArgInput = { + remoteTypeId: Scalars["ID"]; + apiId: Scalars["String"]; + isRequired: Scalars["Boolean"]; + isList: Scalars["Boolean"]; +}; + +export type GraphQLFieldInputArg = { + __typename?: "FieldInputArg"; + id: Scalars["ID"]; + apiId: Scalars["String"]; + isRequired: Scalars["Boolean"]; + isList: Scalars["Boolean"]; + remoteType: GraphQLRemoteTypeDefinition; +}; + +export type GraphQLBatchMigrationRemoteFieldInputArgInput = { + remoteTypeApiId: Scalars["String"]; + apiId: Scalars["String"]; + isRequired: Scalars["Boolean"]; + isList: Scalars["Boolean"]; }; export type GraphQLBatchMigrationRemoteFieldConfigInput = { - /** - * GraphQL type the remote field should return. - * - * Can be any built-in scalar - * - ID - * - String - * - Boolean - * - Int - * - Float - * - * or any GraphCMS custom scalar - * - Long - * - Json - * - DateTime - * - Date - * - * or any GraphCMS type - * - Color - * - Location - * - RichText - * - * or a remote type definition - */ - returnType: Scalars["String"]; - url: Scalars["String"]; - method: Scalars["String"]; + returnTypeApiId: Scalars["String"]; + headers?: Maybe; + method: GraphQLRemoteFieldApiMethod; + cacheTTLSeconds?: Maybe; + remoteSourcePrefix: Scalars["String"]; + /** In case of apiType GraphQL graphqlQuery contains the GraphQL query that will be sent to the remote source */ + graphQLQuery?: Maybe; + /** In case of apiType REST restPath contains the path that will be appended to the API base url */ + restPath?: Maybe; + /** If true, headers that are sent by the client will be forwarded to the remote source */ + forwardClientHeaders?: Maybe; +}; + +export type GraphQLBatchMigrationUpdateRemoteFieldConfigInput = { + returnTypeApiId?: Maybe; + remoteSourcePrefix?: Maybe; headers?: Maybe; - payloadFieldApiIds?: Maybe>; + method?: Maybe; + cacheTTLSeconds?: Maybe; + /** In case of apiType GraphQL graphqlQuery contains the GraphQL query that will be sent to the remote source */ + graphQLQuery?: Maybe; + /** In case of apiType REST restPath contains the path that will be appended to the API base url */ + restPath?: Maybe; + /** If true, headers that are sent by the client will be forwarded to the remote source */ + forwardClientHeaders?: Maybe; +}; + +export type GraphQLBatchMigrationUpsertFieldInputArgInputToCreateInput = { + remoteTypeApiId: Scalars["String"]; + apiId: Scalars["String"]; + isRequired: Scalars["Boolean"]; + isList: Scalars["Boolean"]; +}; + +export type GraphQLBatchMigrationUpsertFieldInputArgInputToUpdateInput = { + argApiId: Scalars["String"]; + remoteTypeApiId?: Maybe; + apiId?: Maybe; + isRequired?: Maybe; + isList?: Maybe; +}; + +export type GraphQLBatchMigrationUpsertFieldInputArgInputToDeleteInput = { + argApiId: Scalars["String"]; +}; + +export type GraphQLBatchMigrationUpsertFieldInputArgInput = { + fieldInputArgsToCreate?: Maybe< + Array + >; + fieldInputArgsToDelete?: Maybe< + Array + >; + fieldInputArgsToUpdate?: Maybe< + Array + >; }; export type GraphQLCreateRemoteFieldInput = { - modelId: Scalars["ID"]; + modelId?: Maybe; + /** + * This can be a model or component id, modelId must be empty when parentId is used + * either modelId or parentId needs to be set and is required via validation, it will be made required. + */ + parentId?: Maybe; apiId: Scalars["String"]; type: GraphQLRemoteFieldType; remoteConfig: GraphQLRemoteFieldConfigInput; + inputArgs?: Maybe>; isList: Scalars["Boolean"]; + isRequired: Scalars["Boolean"]; displayName: Scalars["String"]; description?: Maybe; isHidden?: Maybe; @@ -3128,7 +3668,12 @@ export type GraphQLCreateRemoteFieldInput = { }; export type GraphQLCreateEnumerableFieldInput = { - modelId: Scalars["ID"]; + modelId?: Maybe; + /** + * This can be a model or component id, modelId must be empty when parentId is used + * either modelId or parentId needs to be set and is required via validation, it will be made required. + */ + parentId?: Maybe; enumerationId: Scalars["ID"]; type: GraphQLEnumerableFieldType; apiId: Scalars["String"]; @@ -3169,7 +3714,12 @@ export type GraphQLCreateReverseRelationSide = { }; export type GraphQLCreateRelationalFieldInput = { - modelId: Scalars["ID"]; + modelId?: Maybe; + /** + * This can be a model or component id, modelId must be empty when parentId is used + * either modelId or parentId needs to be set and is required via validation, it will be made required. + */ + parentId?: Maybe; type: GraphQLRelationalFieldType; relationApiId?: Maybe; apiId: Scalars["String"]; @@ -3200,7 +3750,12 @@ export type GraphQLCreateUnionInput = { }; export type GraphQLCreateUnionFieldInput = { - modelId: Scalars["ID"]; + modelId?: Maybe; + /** + * This can be a model or component id, modelId must be empty when parentId is used + * either modelId or parentId needs to be set and is required via validation, it will be made required. + */ + parentId?: Maybe; type: GraphQLUnionFieldType; union: GraphQLCreateUnionInput; apiId: Scalars["String"]; @@ -3217,11 +3772,98 @@ export type GraphQLCreateUnionFieldInput = { position?: Maybe; }; +export type GraphQLCreateComponentFieldInput = { + /** This can be a model or component id */ + parentId: Scalars["ID"]; + apiId: Scalars["String"]; + displayName: Scalars["String"]; + description?: Maybe; + isList: Scalars["Boolean"]; + visibility?: GraphQLVisibilityTypes; + isRequired: Scalars["Boolean"]; + component: Scalars["ID"]; + tableConfig?: Maybe; + formConfig?: Maybe; + extensions?: Maybe; + meta?: Maybe; + position?: Maybe; +}; + +export type GraphQLCreateComponentUnionFieldInput = { + /** This can be a model or component id */ + parentId: Scalars["ID"]; + apiId: Scalars["String"]; + displayName: Scalars["String"]; + description?: Maybe; + isList: Scalars["Boolean"]; + visibility?: GraphQLVisibilityTypes; + components: Array; + tableConfig?: Maybe; + formConfig?: Maybe; + extensions?: Maybe; + meta?: Maybe; + position?: Maybe; +}; + export type GraphQLMoveFieldInput = { id: Scalars["ID"]; position: Scalars["Int"]; }; +export type GraphQLMoveSidebarElementInput = { + id: Scalars["ID"]; + position: Scalars["Int"]; +}; + +export type GraphQLUpdateSidebarElementInput = { + id: Scalars["ID"]; + displayName?: Maybe; + description?: Maybe; + config?: Maybe; +}; + +export type GraphQLResetSidebarElementsInput = { + modelId: Scalars["ID"]; +}; + +export type GraphQLResetSidebarElementsPayload = { + __typename?: "ResetSidebarElementsPayload"; + model?: Maybe; +}; + +export type GraphQLUpdateSidebarElementPayload = { + __typename?: "UpdateSidebarElementPayload"; + updatedSidebarElement: GraphQLISidebarElement; +}; + +export type GraphQLCreateCustomSidebarElementInput = { + modelId: Scalars["ID"]; + extensionId: Scalars["ID"]; + displayName: Scalars["String"]; + description?: Maybe; + config?: Maybe; +}; + +export type GraphQLCreateSystemSidebarElementInput = { + modelId: Scalars["ID"]; + type: GraphQLSystemSidebarElementType; + config?: Maybe; +}; + +export type GraphQLCreateSidebarElementPayload = { + __typename?: "CreateSidebarElementPayload"; + createdSidebarElement?: Maybe; +}; + +export type GraphQLDeleteSidebarElementInput = { + sidebarElementId: Scalars["ID"]; +}; + +export type GraphQLDeleteSidebarElementPayload = { + __typename?: "DeleteSidebarElementPayload"; + deletedSidebarElementId: Scalars["ID"]; +}; + export type GraphQLDeleteFieldInput = { id: Scalars["ID"]; }; @@ -3260,6 +3902,12 @@ export type GraphQLModelViewerPermission = { content: GraphQLModelViewerContentPermission; }; +export type GraphQLIFieldParent = { + id: Scalars["ID"]; + apiId: Scalars["String"]; + displayName: Scalars["String"]; +}; + export type GraphQLIModel = { id: Scalars["ID"]; createdAt: Scalars["DateTime"]; @@ -3272,13 +3920,15 @@ export type GraphQLIModel = { isLocalized: Scalars["Boolean"]; titleFields: Array; fields: Array; + field: GraphQLIField; environment: GraphQLEnvironment; contentViews: Array; /** Model has at least one document */ hasContent: Scalars["Boolean"]; isVersioned: Scalars["Boolean"]; - previewURLs: Array; viewerPermission: GraphQLModelViewerPermission; + sidebarElements: Array; + hasLocalizedComponents: Scalars["Boolean"]; }; export type GraphQLIModelFieldsArgs = { @@ -3286,135 +3936,244 @@ export type GraphQLIModelFieldsArgs = { includeApiOnlyFields?: Maybe; }; +export type GraphQLIModelFieldArgs = { + id: Scalars["ID"]; +}; + export type GraphQLIModelContentViewsArgs = { includeSystemContentViews?: Maybe; filter?: Maybe; }; -export type GraphQLModel = GraphQLIModel & { - __typename?: "Model"; +export type GraphQLSidebarElements = + | GraphQLSystemSidebarElement + | GraphQLCustomSidebarElement; + +export type GraphQLISidebarElement = { id: Scalars["ID"]; createdAt: Scalars["DateTime"]; updatedAt: Scalars["DateTime"]; - apiId: Scalars["String"]; displayName: Scalars["String"]; description?: Maybe; - isSystem: Scalars["Boolean"]; - apiIdPlural: Scalars["String"]; - /** Is true when at least one field is marked as localized */ - isLocalized: Scalars["Boolean"]; - titleFields: Array; - fields: Array; - environment: GraphQLEnvironment; - contentViews: Array; - /** Model has at least one document */ - hasContent: Scalars["Boolean"]; - isVersioned: Scalars["Boolean"]; - previewURLs: Array; - viewerPermission: GraphQLModelViewerPermission; + config?: Maybe; + position: Scalars["Int"]; + isEnabled: Scalars["Boolean"]; + model: GraphQLIModel; +}; + +export enum GraphQLSystemSidebarElementType { + Information = "INFORMATION", + Stages = "STAGES", + Localizations = "LOCALIZATIONS", + Versions = "VERSIONS", + PreviewUrls = "PREVIEW_URLS", + Releases = "RELEASES", +} + +export type GraphQLSystemSidebarElement = GraphQLISidebarElement & { + __typename?: "SystemSidebarElement"; + id: Scalars["ID"]; + createdAt: Scalars["DateTime"]; + updatedAt: Scalars["DateTime"]; + displayName: Scalars["String"]; + description?: Maybe; + config?: Maybe; + position: Scalars["Int"]; + isEnabled: Scalars["Boolean"]; + model: GraphQLIModel; + type: GraphQLSystemSidebarElementType; +}; + +export type GraphQLCustomSidebarElement = GraphQLISidebarElement & { + __typename?: "CustomSidebarElement"; + id: Scalars["ID"]; + createdAt: Scalars["DateTime"]; + updatedAt: Scalars["DateTime"]; + displayName: Scalars["String"]; + description?: Maybe; + config?: Maybe; + position: Scalars["Int"]; + isEnabled: Scalars["Boolean"]; + model: GraphQLIModel; + extension: GraphQLSidebarExtension; }; +export type GraphQLModel = GraphQLIModel & + GraphQLIFieldParent & { + __typename?: "Model"; + id: Scalars["ID"]; + createdAt: Scalars["DateTime"]; + updatedAt: Scalars["DateTime"]; + apiId: Scalars["String"]; + displayName: Scalars["String"]; + description?: Maybe; + isSystem: Scalars["Boolean"]; + apiIdPlural: Scalars["String"]; + /** Is true when at least one field is marked as localized */ + isLocalized: Scalars["Boolean"]; + titleFields: Array; + fields: Array; + field: GraphQLIField; + environment: GraphQLEnvironment; + contentViews: Array; + /** Model has at least one document */ + hasContent: Scalars["Boolean"]; + isVersioned: Scalars["Boolean"]; + viewerPermission: GraphQLModelViewerPermission; + sidebarElements: Array; + hasLocalizedComponents: Scalars["Boolean"]; + }; + export type GraphQLModelFieldsArgs = { includeHiddenFields?: Maybe; includeApiOnlyFields?: Maybe; }; +export type GraphQLModelFieldArgs = { + id: Scalars["ID"]; +}; + export type GraphQLModelContentViewsArgs = { includeSystemContentViews?: Maybe; filter?: Maybe; }; -export type GraphQLAssetModel = GraphQLIModel & { - __typename?: "AssetModel"; +export type GraphQLComponent = GraphQLIFieldParent & { + __typename?: "Component"; id: Scalars["ID"]; createdAt: Scalars["DateTime"]; updatedAt: Scalars["DateTime"]; apiId: Scalars["String"]; + apiIdPlural: Scalars["String"]; + isSystem: Scalars["Boolean"]; displayName: Scalars["String"]; description?: Maybe; - isSystem: Scalars["Boolean"]; - apiIdPlural: Scalars["String"]; + /** Is true when at least one field is marked as localized */ isLocalized: Scalars["Boolean"]; titleFields: Array; fields: Array; environment: GraphQLEnvironment; - contentViews: Array; - /** Model has at least one document */ + /** Component has at least one instance in any of its usages */ hasContent: Scalars["Boolean"]; - isVersioned: Scalars["Boolean"]; - previewURLs: Array; - viewerPermission: GraphQLModelViewerPermission; }; +export type GraphQLComponentFieldsArgs = { + includeHiddenFields?: Maybe; + includeApiOnlyFields?: Maybe; +}; + +export type GraphQLAssetModel = GraphQLIModel & + GraphQLIFieldParent & { + __typename?: "AssetModel"; + id: Scalars["ID"]; + createdAt: Scalars["DateTime"]; + updatedAt: Scalars["DateTime"]; + apiId: Scalars["String"]; + displayName: Scalars["String"]; + description?: Maybe; + isSystem: Scalars["Boolean"]; + apiIdPlural: Scalars["String"]; + isLocalized: Scalars["Boolean"]; + titleFields: Array; + fields: Array; + field: GraphQLIField; + environment: GraphQLEnvironment; + contentViews: Array; + /** Model has at least one document */ + hasContent: Scalars["Boolean"]; + isVersioned: Scalars["Boolean"]; + viewerPermission: GraphQLModelViewerPermission; + sidebarElements: Array; + hasLocalizedComponents: Scalars["Boolean"]; + }; + export type GraphQLAssetModelFieldsArgs = { includeHiddenFields?: Maybe; includeApiOnlyFields?: Maybe; }; +export type GraphQLAssetModelFieldArgs = { + id: Scalars["ID"]; +}; + export type GraphQLAssetModelContentViewsArgs = { includeSystemContentViews?: Maybe; filter?: Maybe; }; -export type GraphQLUserModel = GraphQLIModel & { - __typename?: "UserModel"; - id: Scalars["ID"]; - createdAt: Scalars["DateTime"]; - updatedAt: Scalars["DateTime"]; - apiId: Scalars["String"]; - displayName: Scalars["String"]; - description?: Maybe; - isSystem: Scalars["Boolean"]; - apiIdPlural: Scalars["String"]; - isLocalized: Scalars["Boolean"]; - titleFields: Array; - fields: Array; - environment: GraphQLEnvironment; - contentViews: Array; - /** Model has at least one document */ - hasContent: Scalars["Boolean"]; - isVersioned: Scalars["Boolean"]; - previewURLs: Array; - viewerPermission: GraphQLModelViewerPermission; -}; +export type GraphQLUserModel = GraphQLIModel & + GraphQLIFieldParent & { + __typename?: "UserModel"; + id: Scalars["ID"]; + createdAt: Scalars["DateTime"]; + updatedAt: Scalars["DateTime"]; + apiId: Scalars["String"]; + displayName: Scalars["String"]; + description?: Maybe; + isSystem: Scalars["Boolean"]; + apiIdPlural: Scalars["String"]; + isLocalized: Scalars["Boolean"]; + titleFields: Array; + fields: Array; + field: GraphQLIField; + environment: GraphQLEnvironment; + contentViews: Array; + /** Model has at least one document */ + hasContent: Scalars["Boolean"]; + isVersioned: Scalars["Boolean"]; + viewerPermission: GraphQLModelViewerPermission; + sidebarElements: Array; + hasLocalizedComponents: Scalars["Boolean"]; + }; export type GraphQLUserModelFieldsArgs = { includeHiddenFields?: Maybe; includeApiOnlyFields?: Maybe; }; +export type GraphQLUserModelFieldArgs = { + id: Scalars["ID"]; +}; + export type GraphQLUserModelContentViewsArgs = { includeSystemContentViews?: Maybe; filter?: Maybe; }; -export type GraphQLSchedulingModel = GraphQLIModel & { - __typename?: "SchedulingModel"; - id: Scalars["ID"]; - createdAt: Scalars["DateTime"]; - updatedAt: Scalars["DateTime"]; - apiId: Scalars["String"]; - displayName: Scalars["String"]; - description?: Maybe; - isSystem: Scalars["Boolean"]; - apiIdPlural: Scalars["String"]; - isLocalized: Scalars["Boolean"]; - titleFields: Array; - fields: Array; - environment: GraphQLEnvironment; - contentViews: Array; - /** Model has at least one document */ - hasContent: Scalars["Boolean"]; - isVersioned: Scalars["Boolean"]; - previewURLs: Array; - viewerPermission: GraphQLModelViewerPermission; -}; +export type GraphQLSchedulingModel = GraphQLIModel & + GraphQLIFieldParent & { + __typename?: "SchedulingModel"; + id: Scalars["ID"]; + createdAt: Scalars["DateTime"]; + updatedAt: Scalars["DateTime"]; + apiId: Scalars["String"]; + displayName: Scalars["String"]; + description?: Maybe; + isSystem: Scalars["Boolean"]; + apiIdPlural: Scalars["String"]; + isLocalized: Scalars["Boolean"]; + titleFields: Array; + fields: Array; + field: GraphQLIField; + environment: GraphQLEnvironment; + contentViews: Array; + /** Model has at least one document */ + hasContent: Scalars["Boolean"]; + isVersioned: Scalars["Boolean"]; + viewerPermission: GraphQLModelViewerPermission; + sidebarElements: Array; + hasLocalizedComponents: Scalars["Boolean"]; + }; export type GraphQLSchedulingModelFieldsArgs = { includeHiddenFields?: Maybe; includeApiOnlyFields?: Maybe; }; +export type GraphQLSchedulingModelFieldArgs = { + id: Scalars["ID"]; +}; + export type GraphQLSchedulingModelContentViewsArgs = { includeSystemContentViews?: Maybe; filter?: Maybe; @@ -3426,7 +4185,6 @@ export type GraphQLCreateModelInput = { apiIdPlural: Scalars["String"]; displayName: Scalars["String"]; description?: Maybe; - previewURLs?: Maybe>; }; export type GraphQLDuplicateModelInput = { @@ -3435,7 +4193,6 @@ export type GraphQLDuplicateModelInput = { apiIdPlural: Scalars["String"]; displayName: Scalars["String"]; description?: Maybe; - previewURLs?: Maybe>; }; export type GraphQLUpdateModelInput = { @@ -3452,22 +4209,46 @@ export type GraphQLUpdateModelInput = { apiIdPlural?: Maybe; displayName?: Maybe; description?: Maybe; - previewURLs?: Maybe>; }; export type GraphQLDeleteModelInput = { id: Scalars["ID"]; }; -export type GraphQLPreviewUrlInput = { - name: Scalars["String"]; - template: Scalars["String"]; +export type GraphQLCreateComponentInput = { + environmentId: Scalars["ID"]; + apiId: Scalars["String"]; + apiIdPlural: Scalars["String"]; + displayName: Scalars["String"]; + description?: Maybe; }; -export type GraphQLPreviewUrl = { - __typename?: "PreviewURL"; - name: Scalars["String"]; - template: Scalars["String"]; +export type GraphQLDuplicateComponentInput = { + componentId: Scalars["ID"]; + apiId: Scalars["String"]; + apiIdPlural: Scalars["String"]; + displayName: Scalars["String"]; + description?: Maybe; +}; + +export type GraphQLUpdateComponentInput = { + id: Scalars["ID"]; + /** + * Rename singular API ID to + * specified value + */ + apiId?: Maybe; + /** + * Rename plural API ID to + * specified value + */ + apiIdPlural?: Maybe; + displayName?: Maybe; + description?: Maybe; +}; + +export type GraphQLDeleteComponentInput = { + id: Scalars["ID"]; }; export type GraphQLLocale = { @@ -3657,44 +4438,71 @@ export type GraphQLDeleteEnvironmentPayload = { deletedEnvironmentId: Scalars["ID"]; }; -/** Deleting a model. */ -export type GraphQLBatchMigrationDeleteModelInput = { - apiId: Scalars["String"]; -}; - /** Creating a model. */ export type GraphQLBatchMigrationCreateModelInput = { apiId: Scalars["String"]; apiIdPlural: Scalars["String"]; displayName: Scalars["String"]; description?: Maybe; - previewURLs?: Maybe>; }; -/** Creating a remote type definition */ -export type GraphQLBatchMigrationCreateRemoteTypeDefinitionInput = { +/** Updating a model. */ +export type GraphQLBatchMigrationUpdateModelInput = { + apiId: Scalars["String"]; + newApiId?: Maybe; + apiIdPlural?: Maybe; + displayName?: Maybe; + description?: Maybe; +}; + +/** Deleting a model. */ +export type GraphQLBatchMigrationDeleteModelInput = { + apiId: Scalars["String"]; +}; + +/** Creating a component. */ +export type GraphQLBatchMigrationCreateComponentInput = { + apiId: Scalars["String"]; + apiIdPlural: Scalars["String"]; displayName: Scalars["String"]; description?: Maybe; - /** - * GraphQL type definition in SDL format - * Can be enum or object type - */ - definition: Scalars["String"]; }; -/** Updating an existing remote type definition */ -export type GraphQLBatchMigrationUpdateRemoteTypeDefinitionInput = { +/** Updating a component. */ +export type GraphQLBatchMigrationUpdateComponentInput = { apiId: Scalars["String"]; + newApiId?: Maybe; + apiIdPlural?: Maybe; displayName?: Maybe; description?: Maybe; +}; + +/** Deleting a component. */ +export type GraphQLBatchMigrationDeleteComponentInput = { + apiId: Scalars["String"]; +}; + +/** Creating a custom type definition */ +export type GraphQLBatchMigrationCreateCustomTypeDefinitionInput = { /** * GraphQL type definition in SDL format * Can be enum or object type */ - definition: Scalars["String"]; + sdl: Scalars["String"]; +}; + +/** Creating a custom input type definition */ +export type GraphQLBatchMigrationCreateCustomInputTypeDefinitionInput = { + /** GraphQL type input definition in SDL format */ + sdl: Scalars["String"]; +}; + +/** Delete an existing custom input type definition */ +export type GraphQLBatchMigrationDeleteCustomInputTypeDefinitionInput = { + apiId: Scalars["String"]; }; -/** Delete an existing remote type definition */ +/** Delete an existing custom type definition */ export type GraphQLBatchMigrationDeleteRemoteTypeDefinitionInput = { apiId: Scalars["String"]; }; @@ -3723,20 +4531,12 @@ export type GraphQLBatchMigrationCreateStageInput = { position?: Maybe; }; -/** Updating a model. */ -export type GraphQLBatchMigrationUpdateModelInput = { - apiId: Scalars["String"]; - newApiId?: Maybe; - apiIdPlural?: Maybe; - displayName?: Maybe; - description?: Maybe; - previewURLs?: Maybe>; -}; - /** Deleting a field. */ export type GraphQLBatchMigrationDeleteFieldInput = { apiId: Scalars["String"]; - modelApiId: Scalars["String"]; + /** either modelApiId or parentApiId needs to be set */ + modelApiId?: Maybe; + parentApiId?: Maybe; }; /** Creating a simple field. */ @@ -3748,7 +4548,9 @@ export type GraphQLBatchMigrationEmbeddableModelsInput = { /** Creating a simple field. */ export type GraphQLBatchMigrationCreateSimpleFieldInput = { apiId: Scalars["String"]; - modelApiId: Scalars["String"]; + /** either modelApiId or parentApiId needs to be set */ + modelApiId?: Maybe; + parentApiId?: Maybe; type: GraphQLSimpleFieldType; displayName: Scalars["String"]; description?: Maybe; @@ -3773,10 +4575,14 @@ export type GraphQLBatchMigrationCreateSimpleFieldInput = { embeddableModels?: Maybe>; }; -/** Creating a remote field. */ +/** + * """ + * Creating a remote field. + * """ + */ export type GraphQLBatchMigrationCreateRemoteFieldInput = { apiId: Scalars["String"]; - modelApiId: Scalars["String"]; + parentApiId: Scalars["String"]; type: GraphQLRemoteFieldType; displayName: Scalars["String"]; description?: Maybe; @@ -3784,17 +4590,39 @@ export type GraphQLBatchMigrationCreateRemoteFieldInput = { formRenderer?: Maybe; tableExtension?: Maybe; formExtension?: Maybe; + formConfig?: Maybe; + tableConfig?: Maybe; isList?: Maybe; - isHidden?: Maybe; + isRequired?: Maybe; visibility?: Maybe; position?: Maybe; remoteConfig: GraphQLBatchMigrationRemoteFieldConfigInput; + inputArgs?: Maybe>; +}; + +export type GraphQLBatchMigrationUpdateRemoteFieldInput = { + apiId: Scalars["String"]; + newApiId?: Maybe; + parentApiId: Scalars["String"]; + remoteConfig?: Maybe; + inputArgs?: Maybe; + isList?: Maybe; + isRequired?: Maybe; + displayName?: Maybe; + description?: Maybe; + visibility?: Maybe; + formConfig?: Maybe; + tableConfig?: Maybe; + extensions?: Maybe; + meta?: Maybe; }; /** Creating an enumerable field. */ export type GraphQLBatchMigrationCreateEnumerableFieldInput = { apiId: Scalars["String"]; - modelApiId: Scalars["String"]; + /** either modelApiId or parentApiId needs to be set */ + modelApiId?: Maybe; + parentApiId?: Maybe; enumerationApiId: Scalars["String"]; displayName: Scalars["String"]; description?: Maybe; @@ -3816,16 +4644,21 @@ export type GraphQLBatchMigrationCreateEnumerableFieldInput = { export type GraphQLBatchMigrationUpdateUnionFieldInput = { apiId: Scalars["String"]; newApiId?: Maybe; - modelApiId: Scalars["String"]; + /** either modelApiId or parentApiId needs to be set */ + modelApiId?: Maybe; + parentApiId?: Maybe; displayName?: Maybe; description?: Maybe; - reverseField: GraphQLBatchMigrationUpdateReverseUnionFieldInput; + visibility?: Maybe; + reverseField?: Maybe; }; /** Creating a union field */ export type GraphQLBatchMigrationCreateUnionFieldInput = { apiId: Scalars["String"]; - modelApiId: Scalars["String"]; + /** either modelApiId or parentApiId needs to be set */ + modelApiId?: Maybe; + parentApiId?: Maybe; displayName: Scalars["String"]; description?: Maybe; tableRenderer?: Maybe; @@ -3838,6 +4671,32 @@ export type GraphQLBatchMigrationCreateUnionFieldInput = { reverseField: GraphQLBatchMigrationCreateReverseUnionFieldInput; }; +/** updating a component-union field */ +export type GraphQLBatchMigrationUpdateComponentUnionFieldInput = { + apiId: Scalars["String"]; + newApiId?: Maybe; + parentApiId: Scalars["String"]; + displayName?: Maybe; + description?: Maybe; + componentApiIds?: Maybe>; +}; + +/** Creating a component-union field */ +export type GraphQLBatchMigrationCreateComponentUnionFieldInput = { + apiId: Scalars["String"]; + parentApiId: Scalars["String"]; + displayName: Scalars["String"]; + description?: Maybe; + tableRenderer?: Maybe; + formRenderer?: Maybe; + tableExtension?: Maybe; + formExtension?: Maybe; + isList?: Maybe; + isRequired?: Maybe; + visibility?: Maybe; + componentApiIds: Array; +}; + /** reverse field args */ export type GraphQLBatchMigrationCreateReverseUnionFieldInput = { apiId: Scalars["String"]; @@ -3857,7 +4716,9 @@ export type GraphQLBatchMigrationUpdateReverseUnionFieldInput = { /** Creating a relational field */ export type GraphQLBatchMigrationCreateRelationalFieldInput = { apiId: Scalars["String"]; - modelApiId: Scalars["String"]; + /** either modelApiId or parentApiId needs to be set */ + modelApiId?: Maybe; + parentApiId?: Maybe; type: GraphQLRelationalFieldType; displayName: Scalars["String"]; description?: Maybe; @@ -3876,6 +4737,24 @@ export type GraphQLBatchMigrationCreateRelationalFieldInput = { reverseField: GraphQLBatchMigrationCreateReverseRelationalFieldInput; }; +/** Creating a component field */ +export type GraphQLBatchMigrationCreateComponentFieldInput = { + apiId: Scalars["String"]; + /** model or content */ + parentApiId: Scalars["String"]; + displayName: Scalars["String"]; + description?: Maybe; + tableRenderer?: Maybe; + formRenderer?: Maybe; + tableExtension?: Maybe; + formExtension?: Maybe; + isList?: Maybe; + isRequired?: Maybe; + visibility?: Maybe; + componentApiId: Scalars["String"]; + position?: Maybe; +}; + /** reverse field args */ export type GraphQLBatchMigrationCreateReverseRelationalFieldInput = { apiId: Scalars["String"]; @@ -3892,7 +4771,9 @@ export type GraphQLBatchMigrationCreateReverseRelationalFieldInput = { export type GraphQLBatchMigrationUpdateRelationalFieldInput = { apiId: Scalars["String"]; newApiId?: Maybe; - modelApiId: Scalars["String"]; + /** either modelApiId or parentApiId needs to be set */ + modelApiId?: Maybe; + parentApiId?: Maybe; displayName?: Maybe; description?: Maybe; isList?: Maybe; @@ -3906,11 +4787,25 @@ export type GraphQLBatchMigrationUpdateRelationalFieldInput = { isRequired?: Maybe; }; +/** Updating component field */ +export type GraphQLBatchMigrationUpdateComponentFieldInput = { + apiId: Scalars["String"]; + newApiId?: Maybe; + parentApiId: Scalars["String"]; + displayName?: Maybe; + description?: Maybe; + isList?: Maybe; + visibility?: Maybe; + isRequired?: Maybe; +}; + /** Updating simple field */ export type GraphQLBatchMigrationUpdateSimpleFieldInput = { apiId: Scalars["String"]; newApiId?: Maybe; - modelApiId: Scalars["String"]; + /** either modelApiId or parentApiId needs to be set */ + modelApiId?: Maybe; + parentApiId?: Maybe; displayName?: Maybe; description?: Maybe; isList?: Maybe; @@ -3939,7 +4834,9 @@ export type GraphQLBatchMigrationUpdateSimpleFieldInput = { export type GraphQLBatchMigrationUpdateEnumerableFieldInput = { apiId: Scalars["String"]; newApiId?: Maybe; - modelApiId: Scalars["String"]; + /** either modelApiId or parentApiId needs to be set */ + modelApiId?: Maybe; + parentApiId?: Maybe; displayName?: Maybe; description?: Maybe; isList?: Maybe; @@ -3991,8 +4888,8 @@ export type GraphQLBatchMigrationCreateEnumerationValueInput = { /** update enumeration value */ export type GraphQLBatchMigrationUpdateEnumerationValueInput = { apiId: Scalars["String"]; - newApiId: Scalars["String"]; - displayName: Scalars["String"]; + newApiId?: Maybe; + displayName?: Maybe; }; /** Creating locale */ @@ -4017,25 +4914,92 @@ export type GraphQLBatchMigrationDeleteLocaleInput = { force?: Maybe; }; +export type GraphQLBatchMigrationCreateGraphQlRemoteSourceInput = { + displayName: Scalars["String"]; + description?: Maybe; + /** Unique prefix that will be prepended to all of the remote types. This value cannot be changed! */ + prefix: Scalars["String"]; + url: Scalars["String"]; + headers?: Maybe; + /** + * Specific URL that will be used for introspection if the introspection is available on another url than the regular url. + * Can be ignored if the introspection url is the same as the url of the remote source. + */ + introspectionUrl?: Maybe; + /** HTTP method that will be used for introspection */ + introspectionMethod: GraphQLGraphQlRemoteSourceIntrospectionMethod; + /** HTTP headers that will be used for introspection */ + introspectionHeaders?: Maybe; + /** Custom GraphQL input types that can be used as arguments in remote fields that belong to this remoteSource */ + remoteTypeDefinitions?: Maybe< + GraphQLBatchMigrationCreateRemoteTypeDefinitionInput + >; + debugEnabled?: Maybe; +}; + +export type GraphQLBatchMigrationUpdateGraphQlRemoteSourceInput = { + prefix: Scalars["String"]; + displayName?: Maybe; + description?: Maybe; + url?: Maybe; + headers?: Maybe; + introspectionUrl?: Maybe; + introspectionMethod?: Maybe; + introspectionHeaders?: Maybe; + remoteTypeDefinitionsToUpsert?: Maybe< + GraphQLBatchMigrationUpsertRemoteTypeDefinitionsInput + >; + debugEnabled?: Maybe; +}; + +export type GraphQLBatchMigrationCreateRestRemoteSourceInput = { + displayName: Scalars["String"]; + description?: Maybe; + /** Unique prefix that will be prepended to all of the remote types. This value cannot be changed! */ + prefix: Scalars["String"]; + url: Scalars["String"]; + headers?: Maybe; + /** Remote type definitions that the remote source supports or input types that can be used by any remote field of this remote source */ + remoteTypeDefinitions?: Maybe< + GraphQLBatchMigrationCreateRemoteTypeDefinitionInput + >; + debugEnabled?: Maybe; +}; + +export type GraphQLBatchMigrationUpdateRestRemoteSourceInput = { + prefix: Scalars["String"]; + displayName: Scalars["String"]; + description?: Maybe; + url?: Maybe; + headers?: Maybe; + remoteTypeDefinitionsToUpsert?: Maybe< + GraphQLBatchMigrationUpsertRemoteTypeDefinitionsInput + >; + debugEnabled?: Maybe; +}; + +export type GraphQLBatchMigrationCreateRemoteTypeDefinitionInput = { + sdl: Scalars["String"]; +}; + +export type GraphQLBatchMigrationDeleteRemoteSourceInput = { + prefix: Scalars["String"]; +}; + export type GraphQLBatchMigrationChangeInput = { /** Models */ createModel?: Maybe; updateModel?: Maybe; deleteModel?: Maybe; - /** Remote type defs */ - createRemoteTypeDefinition?: Maybe< - GraphQLBatchMigrationCreateRemoteTypeDefinitionInput - >; - updateRemoteTypeDefinition?: Maybe< - GraphQLBatchMigrationUpdateRemoteTypeDefinitionInput - >; - deleteRemoteTypeDefinition?: Maybe< - GraphQLBatchMigrationDeleteRemoteTypeDefinitionInput - >; + /** Components */ + createComponent?: Maybe; + updateComponent?: Maybe; + deleteComponent?: Maybe; /** Fields */ createSimpleField?: Maybe; - createRemoteField?: Maybe; updateSimpleField?: Maybe; + createRemoteField?: Maybe; + updateRemoteField?: Maybe; createRelationalField?: Maybe< GraphQLBatchMigrationCreateRelationalFieldInput >; @@ -4044,6 +5008,14 @@ export type GraphQLBatchMigrationChangeInput = { >; createUnionField?: Maybe; updateUnionField?: Maybe; + createComponentField?: Maybe; + updateComponentField?: Maybe; + createComponentUnionField?: Maybe< + GraphQLBatchMigrationCreateComponentUnionFieldInput + >; + updateComponentUnionField?: Maybe< + GraphQLBatchMigrationUpdateComponentUnionFieldInput + >; createEnumerableField?: Maybe< GraphQLBatchMigrationCreateEnumerableFieldInput >; @@ -4055,7 +5027,7 @@ export type GraphQLBatchMigrationChangeInput = { createEnumeration?: Maybe; updateEnumeration?: Maybe; deleteEnumeration?: Maybe; - /** State */ + /** Stage */ createStage?: Maybe; deleteStage?: Maybe; updateStage?: Maybe; @@ -4063,40 +5035,25 @@ export type GraphQLBatchMigrationChangeInput = { createLocale?: Maybe; deleteLocale?: Maybe; updateLocale?: Maybe; -}; - -export type GraphQLBatchMigrationChange = { - __typename?: "BatchMigrationChange"; - /** Models */ - createModel?: Maybe; - updateModel?: Maybe; - deleteModel?: Maybe; - /** Fields */ - createSimpleField?: Maybe; - updateSimpleField?: Maybe; - createRelationalField?: Maybe; - updateRelationalField?: Maybe; - deleteField?: Maybe; - /** Locale */ - createLocale?: Maybe; - deleteLocale?: Maybe; - updateLocale?: Maybe; -}; - -export type GraphQLExportEnvironmentInput = { - environmentId: Scalars["ID"]; -}; - -export type GraphQLExportEnvironmentPayload = { - __typename?: "ExportEnvironmentPayload"; - changes: Array; + /** Remote Sources */ + createGraphQLRemoteSource?: Maybe< + GraphQLBatchMigrationCreateGraphQlRemoteSourceInput + >; + updateGraphQLRemoteSource?: Maybe< + GraphQLBatchMigrationUpdateGraphQlRemoteSourceInput + >; + createRESTRemoteSource?: Maybe< + GraphQLBatchMigrationCreateRestRemoteSourceInput + >; + updateRESTRemoteSource?: Maybe< + GraphQLBatchMigrationUpdateRestRemoteSourceInput + >; + deleteRemoteSource?: Maybe; }; export type GraphQLDiffEnvironmentPayload = { __typename?: "DiffEnvironmentPayload"; - environmentId: Scalars["ID"]; - name?: Maybe; - changes: Array; + changes: Array; }; export type GraphQLBatchMigrationInput = { @@ -4306,43 +5263,129 @@ export type GraphQLPromoteEnvironmentPayload = { previousMasterEnvironment: GraphQLEnvironment; }; +export type GraphQLUpsertRemoteTypeDefinitionsInput = { + remoteTypeDefinitionsToCreate?: Maybe< + Array + >; + remoteTypeDefinitionsToDelete?: Maybe< + Array + >; + remoteTypeDefinitionsToUpdate?: Maybe< + Array + >; +}; + +export type GraphQLBatchMigrationUpsertRemoteTypeDefinitionsInput = { + remoteTypeDefinitionsToCreate?: Maybe< + Array + >; + remoteTypeDefinitionsToDelete?: Maybe< + Array + >; + remoteTypeDefinitionsToUpdate?: Maybe< + Array + >; +}; + +export type GraphQLUpsertRemoteTypeDefinitionToCreateInput = { + sdl: Scalars["String"]; +}; + +export type GraphQLUpsertRemoteTypeDefinitionToDeleteInput = { + id: Scalars["ID"]; +}; + +export type GraphQLUpsertRemoteTypeDefinitionToUpdateInput = { + id: Scalars["ID"]; + sdl?: Maybe; +}; + +export type GraphQLBatchMigrationUpsertRemoteTypeDefinitionToCreateInput = { + sdl: Scalars["String"]; +}; + +export type GraphQLBatchMigrationUpsertRemoteTypeDefinitionToDeleteInput = { + apiId: Scalars["String"]; +}; + +export type GraphQLBatchMigrationUpsertRemoteTypeDefinitionToUpdateInput = { + apiId: Scalars["String"]; + sdl?: Maybe; +}; + export type GraphQLCreateRemoteTypeDefinitionInput = { + sdl: Scalars["String"]; +}; + +export enum GraphQLRemoteSourceType { + Graphql = "GRAPHQL", + Rest = "REST", +} + +export type GraphQLDeleteRemoteSourceInput = { + id: Scalars["ID"]; +}; + +export type GraphQLCreateGraphQlRemoteSourceInput = { environmentId: Scalars["ID"]; displayName: Scalars["String"]; description?: Maybe; + /** Unique prefix that will be prepended to all of the remote types. This value cannot be changed! */ + prefix: Scalars["String"]; + url: Scalars["String"]; + headers?: Maybe; /** - * GraphQL type definition in SDL format - * Can be enum or object type + * Specific URL that will be used for introspection if the introspection is available on another url than the regular url. + * Can be ignored if the introspection url is the same as the url of the remote source. */ - definition: Scalars["String"]; + introspectionUrl?: Maybe; + /** HTTP method that will be used for introspection */ + introspectionMethod: GraphQLGraphQlRemoteSourceIntrospectionMethod; + /** HTTP headers that will be used for introspection */ + introspectionHeaders?: Maybe; + /** Custom GraphQL input types that can be used as arguments in remote fields that belong to this remoteSource */ + remoteTypeDefinitions?: Maybe>; + debugEnabled?: Maybe; }; -export type GraphQLUpdateRemoteTypeDefinitionInput = { +export type GraphQLUpdateGraphQlRemoteSourceInput = { id: Scalars["ID"]; displayName?: Maybe; description?: Maybe; - /** - * GraphQL type definition in SDL format - * Can be enum or object type - */ - definition?: Maybe; -}; - -export type GraphQLDeleteRemoteTypeDefinitionInput = { - id: Scalars["ID"]; -}; - -export type GraphQLEnableScheduledPublishingInput = { - projectId: Scalars["ID"]; + url?: Maybe; + headers?: Maybe; + introspectionUrl?: Maybe; + introspectionMethod?: Maybe; + introspectionHeaders?: Maybe; + remoteTypeDefinitionsToUpsert?: Maybe< + GraphQLUpsertRemoteTypeDefinitionsInput + >; + debugEnabled?: Maybe; }; -export type GraphQLMigrateRichTextEmbedsInput = { - gcms?: Maybe; +export type GraphQLCreateRestRemoteSourceInput = { + environmentId: Scalars["ID"]; + displayName: Scalars["String"]; + description?: Maybe; + /** Unique prefix that will be prepended to all of the remote types. This value cannot be changed! */ + prefix: Scalars["String"]; + url: Scalars["String"]; + headers?: Maybe; + /** Remote type definitions that the remote source supports or input types that can be used by any remote field of this remote source */ + remoteTypeDefinitions?: Maybe>; + debugEnabled?: Maybe; }; -export type GraphQLMigrationEnableSchedulingInput = { - projectId: Scalars["ID"]; - dryRun?: Maybe; +export type GraphQLUpdateRestRemoteSourceInput = { + id: Scalars["ID"]; + displayName?: Maybe; + description?: Maybe; + url?: Maybe; + headers?: Maybe; + remoteTypeDefinitionsToUpsert?: Maybe< + GraphQLUpsertRemoteTypeDefinitionsInput + >; + debugEnabled?: Maybe; }; export type GraphQLMutation = { @@ -4368,6 +5411,7 @@ export type GraphQLMutation = { updateProject: GraphQLProject; deleteProject: GraphQLDeleteProjectPayload; cloneProject: GraphQLProject; + clonePublicProject: GraphQLProject; leaveProject: GraphQLLeaveProjectPayload; createRole: GraphQLRole; updateRole: GraphQLRole; @@ -4391,6 +5435,7 @@ export type GraphQLMutation = { updateMemberRoles: GraphQLMember; removeMember: GraphQLRemoveMemberPayload; setUserAnalytics: GraphQLUserAnalytics; + track: GraphQLTrackPayload; deleteAccount: GraphQLDeleteAccountPayload; updateUserProfile: GraphQLUserViewer; createWebhook: GraphQLCreateWebhookPayload; @@ -4427,7 +5472,15 @@ export type GraphQLMutation = { >; createFieldExtension: GraphQLCreateFieldExtensionPayload; updateFieldExtension: GraphQLUpdateFieldExtensionPayload; + createSidebarExtension: GraphQLCreateSidebarExtensionPayload; + updateSidebarExtension: GraphQLUpdateSidebarExtensionPayload; deleteExtension: GraphQLDeleteExtensionPayload; + createCustomSidebarElement: GraphQLCreateSidebarElementPayload; + createSystemSidebarElement: GraphQLCreateSidebarElementPayload; + deleteSidebarElement: GraphQLDeleteSidebarElementPayload; + moveSidebarElement: GraphQLMoveSidebarElementPayload; + updateSidebarElement: GraphQLUpdateSidebarElementPayload; + resetSidebarElements: GraphQLResetSidebarElementsPayload; createStage: GraphQLAsyncOperationPayload; updateStage: GraphQLAsyncOperationPayload; deleteStage: GraphQLAsyncOperationPayload; @@ -4438,9 +5491,10 @@ export type GraphQLMutation = { duplicateModel: GraphQLAsyncOperationPayload; updateModel: GraphQLAsyncOperationPayload; deleteModel: GraphQLAsyncOperationPayload; - createRemoteTypeDefinition: GraphQLAsyncOperationPayload; - updateRemoteTypeDefinition: GraphQLAsyncOperationPayload; - deleteRemoteTypeDefinition: GraphQLAsyncOperationPayload; + createComponent: GraphQLAsyncOperationPayload; + duplicateComponent: GraphQLAsyncOperationPayload; + updateComponent: GraphQLAsyncOperationPayload; + deleteComponent: GraphQLAsyncOperationPayload; createEnumeration: GraphQLAsyncOperationPayload; deleteEnumeration: GraphQLAsyncOperationPayload; updateEnumeration: GraphQLAsyncOperationPayload; @@ -4449,14 +5503,22 @@ export type GraphQLMutation = { createEnumerableField: GraphQLAsyncOperationPayload; createRelationalField: GraphQLAsyncOperationPayload; createUnionField: GraphQLAsyncOperationPayload; + createComponentField: GraphQLAsyncOperationPayload; + createComponentUnionField: GraphQLAsyncOperationPayload; updateSimpleField: GraphQLAsyncOperationPayload; + updateRemoteField: GraphQLAsyncOperationPayload; updateEnumerableField: GraphQLAsyncOperationPayload; updateRelationalField: GraphQLAsyncOperationPayload; updateUnionField: GraphQLAsyncOperationPayload; + updateComponentField: GraphQLAsyncOperationPayload; + updateComponentUnionField: GraphQLAsyncOperationPayload; deleteField: GraphQLAsyncOperationPayload; submitBatchChanges: GraphQLAsyncOperationPayload; - exportEnvironment: GraphQLExportEnvironmentPayload; - enableScheduledPublishing: GraphQLProject; + createGraphQLRemoteSource: GraphQLAsyncOperationPayload; + updateGraphQLRemoteSource: GraphQLAsyncOperationPayload; + createRESTRemoteSource: GraphQLAsyncOperationPayload; + updateRESTRemoteSource: GraphQLAsyncOperationPayload; + deleteRemoteSource: GraphQLAsyncOperationPayload; }; export type GraphQLMutationCreateContentViewArgs = { @@ -4543,6 +5605,10 @@ export type GraphQLMutationCloneProjectArgs = { data: GraphQLCloneProjectInput; }; +export type GraphQLMutationClonePublicProjectArgs = { + data: GraphQLClonePublicProjectInput; +}; + export type GraphQLMutationLeaveProjectArgs = { data: GraphQLLeaveProjectInput; }; @@ -4635,6 +5701,10 @@ export type GraphQLMutationSetUserAnalyticsArgs = { data: GraphQLSetUserAnalyticsInput; }; +export type GraphQLMutationTrackArgs = { + data: GraphQLTrackInput; +}; + export type GraphQLMutationDeleteAccountArgs = { data?: Maybe; }; @@ -4739,10 +5809,42 @@ export type GraphQLMutationUpdateFieldExtensionArgs = { data: GraphQLUpdateFieldExtensionInput; }; +export type GraphQLMutationCreateSidebarExtensionArgs = { + data: GraphQLCreateSidebarExtensionInput; +}; + +export type GraphQLMutationUpdateSidebarExtensionArgs = { + data: GraphQLUpdateSidebarExtensionInput; +}; + export type GraphQLMutationDeleteExtensionArgs = { data: GraphQLDeleteExtensionInput; }; +export type GraphQLMutationCreateCustomSidebarElementArgs = { + data: GraphQLCreateCustomSidebarElementInput; +}; + +export type GraphQLMutationCreateSystemSidebarElementArgs = { + data: GraphQLCreateSystemSidebarElementInput; +}; + +export type GraphQLMutationDeleteSidebarElementArgs = { + data: GraphQLDeleteSidebarElementInput; +}; + +export type GraphQLMutationMoveSidebarElementArgs = { + data: GraphQLMoveSidebarElementInput; +}; + +export type GraphQLMutationUpdateSidebarElementArgs = { + data: GraphQLUpdateSidebarElementInput; +}; + +export type GraphQLMutationResetSidebarElementsArgs = { + data: GraphQLResetSidebarElementsInput; +}; + export type GraphQLMutationCreateStageArgs = { data: GraphQLCreateStageInput; }; @@ -4783,16 +5885,20 @@ export type GraphQLMutationDeleteModelArgs = { data: GraphQLDeleteModelInput; }; -export type GraphQLMutationCreateRemoteTypeDefinitionArgs = { - data: GraphQLCreateRemoteTypeDefinitionInput; +export type GraphQLMutationCreateComponentArgs = { + data: GraphQLCreateComponentInput; +}; + +export type GraphQLMutationDuplicateComponentArgs = { + data: GraphQLDuplicateComponentInput; }; -export type GraphQLMutationUpdateRemoteTypeDefinitionArgs = { - data: GraphQLUpdateRemoteTypeDefinitionInput; +export type GraphQLMutationUpdateComponentArgs = { + data: GraphQLUpdateComponentInput; }; -export type GraphQLMutationDeleteRemoteTypeDefinitionArgs = { - data: GraphQLDeleteRemoteTypeDefinitionInput; +export type GraphQLMutationDeleteComponentArgs = { + data: GraphQLDeleteComponentInput; }; export type GraphQLMutationCreateEnumerationArgs = { @@ -4827,10 +5933,22 @@ export type GraphQLMutationCreateUnionFieldArgs = { data: GraphQLCreateUnionFieldInput; }; +export type GraphQLMutationCreateComponentFieldArgs = { + data: GraphQLCreateComponentFieldInput; +}; + +export type GraphQLMutationCreateComponentUnionFieldArgs = { + data: GraphQLCreateComponentUnionFieldInput; +}; + export type GraphQLMutationUpdateSimpleFieldArgs = { data: GraphQLUpdateSimpleFieldInput; }; +export type GraphQLMutationUpdateRemoteFieldArgs = { + data: GraphQLUpdateRemoteFieldInput; +}; + export type GraphQLMutationUpdateEnumerableFieldArgs = { data: GraphQLUpdateEnumerableFieldInput; }; @@ -4843,6 +5961,14 @@ export type GraphQLMutationUpdateUnionFieldArgs = { data: GraphQLUpdateUnionFieldInput; }; +export type GraphQLMutationUpdateComponentFieldArgs = { + data: GraphQLUpdateComponentFieldInput; +}; + +export type GraphQLMutationUpdateComponentUnionFieldArgs = { + data: GraphQLUpdateComponentUnionFieldInput; +}; + export type GraphQLMutationDeleteFieldArgs = { data: GraphQLDeleteFieldInput; }; @@ -4851,12 +5977,24 @@ export type GraphQLMutationSubmitBatchChangesArgs = { data: GraphQLBatchMigrationInput; }; -export type GraphQLMutationExportEnvironmentArgs = { - data: GraphQLExportEnvironmentInput; +export type GraphQLMutationCreateGraphQlRemoteSourceArgs = { + data: GraphQLCreateGraphQlRemoteSourceInput; +}; + +export type GraphQLMutationUpdateGraphQlRemoteSourceArgs = { + data: GraphQLUpdateGraphQlRemoteSourceInput; +}; + +export type GraphQLMutationCreateRestRemoteSourceArgs = { + data: GraphQLCreateRestRemoteSourceInput; +}; + +export type GraphQLMutationUpdateRestRemoteSourceArgs = { + data: GraphQLUpdateRestRemoteSourceInput; }; -export type GraphQLMutationEnableScheduledPublishingArgs = { - data: GraphQLEnableScheduledPublishingInput; +export type GraphQLMutationDeleteRemoteSourceArgs = { + data: GraphQLDeleteRemoteSourceInput; }; export enum GraphQLMigrationOperationType { diff --git a/src/index.ts b/src/index.ts index 1d5c4d8..07c5b8d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,6 +2,9 @@ import { newMigration } from "./migration"; import { Renderer } from "./renderer"; import { RelationType } from "./util"; import { + GraphQLGraphQlRemoteSourceIntrospectionMethod, + GraphQLRemoteFieldApiMethod, + GraphQLRemoteFieldType, GraphQLSimpleFieldType, GraphQLVisibilityTypes, } from "./generated/schema"; @@ -10,6 +13,20 @@ import { */ import FieldType = GraphQLSimpleFieldType; +import RemoteFieldType = GraphQLRemoteFieldType; + import VisibilityTypes = GraphQLVisibilityTypes; -export { newMigration, FieldType, Renderer, RelationType, VisibilityTypes }; +import RemoteSourceIntrospectionMethod = GraphQLGraphQlRemoteSourceIntrospectionMethod; +import RemoteFieldApiMethod = GraphQLRemoteFieldApiMethod; + +export { + newMigration, + FieldType, + Renderer, + RelationType, + VisibilityTypes, + RemoteSourceIntrospectionMethod, + RemoteFieldType, + RemoteFieldApiMethod, +}; diff --git a/src/migration.ts b/src/migration.ts index 3db36b2..56ae6c6 100644 --- a/src/migration.ts +++ b/src/migration.ts @@ -16,9 +16,12 @@ import { GraphQLBatchMigrationUpdateEnumerationInput, GraphQLBatchMigrationCreateLocaleInput, GraphQLBatchMigrationUpdateLocaleInput, - GraphQLBatchMigrationCreateRemoteTypeDefinitionInput, - GraphQLBatchMigrationUpdateRemoteTypeDefinitionInput, GraphQLMigrationStatus, + GraphQLBatchMigrationCreateGraphQlRemoteSourceInput, + GraphQLBatchMigrationCreateRestRemoteSourceInput, + GraphQLBatchMigrationUpdateGraphQlRemoteSourceInput, + GraphQLBatchMigrationUpdateRestRemoteSourceInput, + GraphQLBatchMigrationDeleteRemoteSourceInput, } from "./generated/schema"; import { EnumerationCreate, @@ -27,10 +30,7 @@ import { } from "./enumeration"; import { Stage, StageClass } from "./stage"; import { Locale, LocaleClass } from "./locale"; -import { - RemoteTypeDefinition, - RemoteTypeDefinitionClass, -} from "./remoteTypeDef"; +import { RemoteSource, RemoteSourceClass } from "./remoteSource"; /** * @ignore @@ -125,27 +125,38 @@ interface Migration { deleteModel(apiId: string): void; /** - * Create a new remote type definition - * @param args options for the new type definition. + * Create a new GraphQL remote source + * @param args options for the new remote source. + */ + createGraphQLRemoteSource( + args: GraphQLBatchMigrationCreateGraphQlRemoteSourceInput + ): RemoteSource; + + /** + * Updates an existing GraphQL remote source + * @param args options for the new remote source. */ - createRemoteTypeDefinition( - args: GraphQLBatchMigrationCreateRemoteTypeDefinitionInput - ): RemoteTypeDefinition; + updateGraphQLRemoteSource( + args: GraphQLBatchMigrationUpdateGraphQlRemoteSourceInput + ): RemoteSource; /** - * Update an existing remote type definition - * @param args options for remote type definition to update. + * Create a new REST remote source + * @param args options for the new remote source. */ - updateRemoteTypeDefinition( - args: GraphQLBatchMigrationUpdateRemoteTypeDefinitionInput - ): RemoteTypeDefinition; + createRESTRemoteSource( + args: GraphQLBatchMigrationCreateRestRemoteSourceInput + ): RemoteSource; /** - * Delete a remote type definition - * @param apiId the `apiId` of the remote type definition to delete. + * Updates an existing REST remote source + * @param args options for the new remote source. */ - deleteRemoteTypeDefinition(apiId: string): void; + updateRESTRemoteSource( + args: GraphQLBatchMigrationUpdateRestRemoteSourceInput + ): RemoteSource; + deleteRemoteSource(args: GraphQLBatchMigrationDeleteRemoteSourceInput): void; /** * Create a new enumeration * @param args options for the new enumeration. @@ -269,31 +280,54 @@ class MigrationClass implements Migration, ChangeListener { return model; } - createRemoteTypeDefinition(args: any): RemoteTypeDefinition { - const remoteTypeDefinition = new RemoteTypeDefinitionClass( + createGraphQLRemoteSource(args: any): RemoteSource { + const remoteSource = new RemoteSourceClass( MutationMode.Create, + "GQL", args ); - this.registerChange(remoteTypeDefinition); - return remoteTypeDefinition; + this.registerChange(remoteSource); + return remoteSource; } - updateRemoteTypeDefinition(args: any): RemoteTypeDefinition { - const remoteTypeDefinition = new RemoteTypeDefinitionClass( + updateGraphQLRemoteSource(args: any): RemoteSource { + const remoteSource = new RemoteSourceClass( MutationMode.Update, + "GQL", args ); - this.registerChange(remoteTypeDefinition); - return remoteTypeDefinition; + this.registerChange(remoteSource); + return remoteSource; } - deleteRemoteTypeDefinition(apiId: string) { - const remoteTypeDefinition = new RemoteTypeDefinitionClass( + createRESTRemoteSource(args: any): RemoteSource { + const remoteSource = new RemoteSourceClass( + MutationMode.Create, + "REST", + args + ); + this.registerChange(remoteSource); + return remoteSource; + } + + updateRESTRemoteSource(args: any): RemoteSource { + const remoteSource = new RemoteSourceClass( + MutationMode.Update, + "REST", + args + ); + this.registerChange(remoteSource); + return remoteSource; + } + + deleteRemoteSource(args: any): RemoteSource { + const remoteSource = new RemoteSourceClass( MutationMode.Delete, - { apiId } + "REST", + args ); - this.registerChange(remoteTypeDefinition); - return remoteTypeDefinition; + this.registerChange(remoteSource); + return remoteSource; } createEnumeration(args: any): EnumerationCreate { diff --git a/src/model.ts b/src/model.ts index dfe261f..bc12190 100644 --- a/src/model.ts +++ b/src/model.ts @@ -14,12 +14,12 @@ import { GraphQLBatchMigrationUpdateEnumerableFieldInput, GraphQLBatchMigrationUpdateModelInput, GraphQLBatchMigrationUpdateRelationalFieldInput, + GraphQLBatchMigrationUpdateRemoteFieldInput, GraphQLBatchMigrationUpdateSimpleFieldInput, GraphQLBatchMigrationUpdateUnionFieldInput, GraphQLFieldValidationFloatRangeInput, GraphQLFieldValidationIntRangeInput, GraphQLFieldValidationRegExInput, - GraphQLRemoteFieldType, GraphQLSimpleFieldType, GraphQLSimpleFieldValidationsInput, } from "./generated/schema"; @@ -108,19 +108,6 @@ interface CreateSimpleFieldArgs */ isHidden?: GraphQLBatchMigrationCreateSimpleFieldInput["isHidden"]; } -/** - * Create Remote Field - */ -interface CreateRemoteFieldArgs - extends Omit< - GraphQLBatchMigrationCreateRemoteFieldInput, - "modelApiId" | "type" | "isHidden" - > { - /** - * @deprecated Use visibility instead. - */ - isHidden?: GraphQLBatchMigrationCreateRemoteFieldInput["isHidden"]; -} interface UpdateSimpleFieldArgs extends Omit< @@ -167,6 +154,11 @@ interface UpdateEnumerableFieldArgs isHidden?: GraphQLBatchMigrationUpdateEnumerableFieldInput["isHidden"]; } +interface CreateRemoteFieldArgs + extends Omit {} +interface UpdateRemoteFieldArgs + extends Omit {} + /** * GraphCMS Model */ @@ -177,12 +169,6 @@ interface Model { */ addSimpleField(field: CreateSimpleFieldArgs): Model; - /** - * Add a new remote field to the model. - * @param field options for the field. - */ - addRemoteField(field: CreateRemoteFieldArgs): Model; - /** * Update an existing field * @param field options for the field. @@ -232,6 +218,17 @@ interface Model { */ updateEnumerableField(field: UpdateEnumerableFieldArgs): Model; + /* Create an remote field. + * @param field options for the remote field. + */ + addRemoteField(field: CreateRemoteFieldArgs): Model; + + /** + * Update a remote field + * @param field options for the remote field. + */ + updateRemoteField(field: UpdateRemoteFieldArgs): Model; + /** * Delete a field * @param apiId the apiId of the field to delete. @@ -265,34 +262,6 @@ class ModelClass implements Model, ChangeItem { return this; } - addRemoteField(passedFieldArgs: any): Model { - const fieldArgs = { ...passedFieldArgs }; - fieldArgs.modelApiId = this.args.apiId; - fieldArgs.type = GraphQLRemoteFieldType.Remote; - if (fieldArgs.remoteConfig.headers) { - if (fieldArgs.remoteConfig.headers.constructor.name !== "Object") { - throw new Error("Headers in remote config has to be an object"); - } - for (const [k, v] of Object.entries(fieldArgs.remoteConfig.headers)) { - // wrap non-array values into arrays - fieldArgs.remoteConfig.headers[k] = Array.isArray(v) ? v : [v]; - } - } else { - fieldArgs.remoteConfig.headers = {}; - } - fieldArgs.remoteConfig.payloadFieldApiIds = - fieldArgs.remoteConfig.payloadFieldApiIds || []; - fieldArgs.remoteConfig.method = fieldArgs.remoteConfig.method || "GET"; - - const field = new Field( - fieldArgs, - MutationMode.Create, - FieldType.RemoteField - ); - this.listener.registerChange(field); - return this; - } - updateSimpleField(passedFieldArgs: any): Model { const fieldArgs = { ...passedFieldArgs }; fieldArgs.modelApiId = this.args.apiId; @@ -457,6 +426,32 @@ class ModelClass implements Model, ChangeItem { return this; } + addRemoteField(passedFieldArgs: any): Model { + const fieldArgs = { ...passedFieldArgs }; + fieldArgs.parentApiId = this.args.apiId; + + const field = new Field( + fieldArgs, + MutationMode.Create, + FieldType.RemoteField + ); + this.listener.registerChange(field); + return this; + } + + updateRemoteField(passedFieldArgs: any): Model { + const fieldArgs = { ...passedFieldArgs }; + fieldArgs.parentApiId = this.args.apiId; + + const field = new Field( + fieldArgs, + MutationMode.Update, + FieldType.RemoteField + ); + this.listener.registerChange(field); + return this; + } + deleteField(apiId: string): Model { const field = new Field( { apiId, modelApiId: this.args.apiId }, diff --git a/src/remoteSource.ts b/src/remoteSource.ts new file mode 100644 index 0000000..5e66432 --- /dev/null +++ b/src/remoteSource.ts @@ -0,0 +1,66 @@ +import { MutationMode } from "./util"; +import { ChangeItem, MigrationChange } from "./migration"; +import { + GraphQLBatchMigrationCreateGraphQlRemoteSourceInput, + GraphQLBatchMigrationUpdateGraphQlRemoteSourceInput, + GraphQLBatchMigrationCreateRestRemoteSourceInput, + GraphQLBatchMigrationUpdateRestRemoteSourceInput, +} from "./generated/schema"; + +type RemoteSourceArgs = + | GraphQLBatchMigrationCreateGraphQlRemoteSourceInput + | GraphQLBatchMigrationUpdateGraphQlRemoteSourceInput + | GraphQLBatchMigrationCreateRestRemoteSourceInput + | GraphQLBatchMigrationUpdateRestRemoteSourceInput; + +interface RemoteSource {} + +/** + * @ignore + */ +class RemoteSourceClass implements RemoteSource, ChangeItem { + constructor( + private mode: MutationMode, + private sourceType: "GQL" | "REST", + private args: RemoteSourceArgs + ) {} + + hasChanges(): boolean { + // all modes are guaranteed to have changes except Update. + if (this.mode !== MutationMode.Update) { + return true; + } + // apiId is always a requirement, length of 1 means its apiId only. + if (Object.keys(this.args).length > 1) { + return true; + } + return false; + } + + generateChange(): MigrationChange { + let action: string; + switch (this.mode) { + case MutationMode.Create: + action = + this.sourceType === "GQL" + ? "createGraphQLRemoteSource" + : "createRESTRemoteSource"; + break; + case MutationMode.Update: + action = + this.sourceType === "GQL" + ? "updateGraphQLRemoteSource" + : "updateRESTRemoteSource"; + break; + case MutationMode.Delete: + action = "deleteRemoteSource"; + break; + } + + const change: { [key: string]: any } = {}; + change[action] = this.args; + return change; + } +} + +export { RemoteSource, RemoteSourceClass }; diff --git a/src/remoteTypeDef.ts b/src/remoteTypeDef.ts deleted file mode 100644 index 1a85373..0000000 --- a/src/remoteTypeDef.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { MutationMode } from "./util"; -import { ChangeItem, MigrationChange } from "./migration"; -import { - GraphQLBatchMigrationCreateRemoteTypeDefinitionInput, - GraphQLBatchMigrationDeleteRemoteTypeDefinitionInput, - GraphQLBatchMigrationUpdateRemoteTypeDefinitionInput, -} from "./generated/schema"; - -type ModelArgs = - | GraphQLBatchMigrationCreateRemoteTypeDefinitionInput - | GraphQLBatchMigrationUpdateRemoteTypeDefinitionInput - | GraphQLBatchMigrationDeleteRemoteTypeDefinitionInput; - -/** - * GraphCMS RemoteTypeDefinition - */ -interface RemoteTypeDefinition {} - -/** - * @ignore - */ -class RemoteTypeDefinitionClass implements RemoteTypeDefinition, ChangeItem { - constructor(private mode: MutationMode, private args: ModelArgs) {} - - hasChanges(): boolean { - // all modes are guaranteed to have changes except Update. - if (this.mode !== MutationMode.Update) { - return true; - } - // apiId is always a requirement, length of 1 means its apiId only. - if (Object.keys(this.args).length > 1) { - return true; - } - return false; - } - - generateChange(): MigrationChange { - let action: string; - switch (this.mode) { - case MutationMode.Create: - action = "createRemoteTypeDefinition"; - break; - case MutationMode.Update: - action = "updateRemoteTypeDefinition"; - break; - case MutationMode.Delete: - action = "deleteRemoteTypeDefinition"; - break; - } - - const change: { [key: string]: any } = {}; - change[action] = this.args; - return change; - } -} - -export { RemoteTypeDefinition, RemoteTypeDefinitionClass };