21 April 2020
Composable Commerce
HTTP API
Enhancement
ExtensibilityGraphQL

Extensions can now be queried, created, updated, and deleted using the GraphQL API.

  • [GraphQL API] Added the following types to the GraphQL schema: AWSLambdaDestination, AWSLambdaDestinationInput, ActionType, AuthorizationHeader, AuthorizationHeaderInput, AzureFunctionsAuthentication, AzureFunctionsAuthenticationInput, ChangeExtensionDestination, ChangeExtensionTriggers, Extension, ExtensionDestination, ExtensionDestinationInput, ExtensionDraft, ExtensionQueryResult, ExtensionUpdateAction, HttpDestination, HttpDestinationAuthentication, HttpDestinationAuthenticationInput, HttpDestinationInput, SetExtensionKey, SetExtensionTimeoutInMs, Trigger, TriggerInput.
  • [GraphQL API] Changed the Query type:
    • Added the extensions field to the Query type.
    • Added the extension field to the Query type.
  • [GraphQL API] Changed the Mutation type:
    • Added the deleteExtension field to the Mutation type.
    • Added the updateExtension field to the Mutation type.
    • Added the createExtension field to the Mutation type.

Introduced the following changes to the GraphQL schema (in SDL format):

extend type Query {
  extension(
    "Queries with specified ID"
    id: String,

    "Queries with specified key"
    key: String): Extension
  extensions(where: String, sort: [String!], limit: Int, offset: Int): ExtensionQueryResult!
}

extend type Mutation {
  createExtension(draft: ExtensionDraft!): Extension
  deleteExtension(version: Long!,

    "Queries with specified ID"
    id: String,

    "Queries with specified key"
    key: String): Extension
  updateExtension(version: Long!, actions: [ExtensionUpdateAction!]!,

    "Queries with specified ID"
    id: String,

    "Queries with specified key"
    key: String): Extension
}

type AWSLambdaDestination implements ExtensionDestination {
  arn: String!
  accessKey: String!
  accessSecret: String!
  type: String!
}

input AWSLambdaDestinationInput {
  arn: String!
  accessKey: String!
  accessSecret: String!
}

enum ActionType {
  Update
  Create
}

type AuthorizationHeader implements HttpDestinationAuthentication {
  headerValue: String!
  type: String!
}

input AuthorizationHeaderInput {
  headerValue: String!
}

type AzureFunctionsAuthentication implements HttpDestinationAuthentication {
  key: String!
  type: String!
}

input AzureFunctionsAuthenticationInput {
  key: String!
}

input ChangeExtensionDestination {
  destination: ExtensionDestinationInput!
}

input ChangeExtensionTriggers {
  triggers: [TriggerInput!]!
}

type Extension implements Versioned {
  key: String
  destination: ExtensionDestination!
  triggers: [Trigger!]!
  timeoutInMs: Int
  id: String!
  version: Long!
  createdAt: DateTime!
  lastModifiedAt: DateTime!
  createdBy: Initiator
  lastModifiedBy: Initiator
}

interface ExtensionDestination {
  type: String!
}

input ExtensionDestinationInput {
  HTTP: HttpDestinationInput
  AWSLambda: AWSLambdaDestinationInput
}

input ExtensionDraft {
  key: String
  destination: ExtensionDestinationInput!
  triggers: [TriggerInput!]!
  timeoutInMs: Int
}

type ExtensionQueryResult {
  offset: Int!
  count: Int!
  total: Long!
  results: [Extension!]!
}

input ExtensionUpdateAction {
  changeDestination: ChangeExtensionDestination
  changeTriggers: ChangeExtensionTriggers
  setKey: SetExtensionKey
  setTimeoutInMs: SetExtensionTimeoutInMs
}

type HttpDestination implements ExtensionDestination {
  type: String!
  url: String!
  authentication: HttpDestinationAuthentication
}

interface HttpDestinationAuthentication {
  type: String!
}

input HttpDestinationAuthenticationInput {
  AuthorizationHeader: AuthorizationHeaderInput
  AzureFunctions: AzureFunctionsAuthenticationInput
}

input HttpDestinationInput {
  url: String!
  authentication: HttpDestinationAuthenticationInput
}

input SetExtensionKey {
  key: String
}

input SetExtensionTimeoutInMs {
  timeoutInMs: Int
}

input SetStoreDistributionChannels {
  channels: [ResourceIdentifierInput!]
}

type Trigger {
  resourceTypeId: String!
  actions: [ActionType!]!
}

input TriggerInput {
  resourceTypeId: String!
  actions: [ActionType!]
}