Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions codebuild_specs/e2e_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2039,38 +2039,38 @@ batch:
depend-on:
- publish_to_local_registry
- identifier: >-
AuthV2ExhaustiveT2B_AuthV2ExhaustiveT2D_AuthV2ExhaustiveT2C_RelationalWithAuthV2Redacted_RelationalWithAuthV2NonRedacted
AuthV2ExhaustiveT2B_AuthV2ExhaustiveT2D_AuthV2ExhaustiveT2C_SequenceTransformer_RelationalWithAuthV2Redacted
buildspec: codebuild_specs/graphql_e2e_tests.yml
env:
compute-type: BUILD_GENERAL1_LARGE
variables:
NODE_OPTIONS: '--max-old-space-size=14848'
TEST_SUITE: >-
src/__tests__/AuthV2ExhaustiveT2B.test.ts|src/__tests__/AuthV2ExhaustiveT2D.test.ts|src/__tests__/AuthV2ExhaustiveT2C.test.ts|src/__tests__/RelationalWithAuthV2Redacted.e2e.test.ts|src/__tests__/RelationalWithAuthV2NonRedacted.e2e.test.ts
src/__tests__/AuthV2ExhaustiveT2B.test.ts|src/__tests__/AuthV2ExhaustiveT2D.test.ts|src/__tests__/AuthV2ExhaustiveT2C.test.ts|src/__tests__/SequenceTransformer.e2e.test.ts|src/__tests__/RelationalWithAuthV2Redacted.e2e.test.ts
CLI_REGION: eu-north-1
depend-on:
- publish_to_local_registry
- identifier: >-
AuthV2TransformerIAM_AuthV2ExhaustiveT3D_AuthV2ExhaustiveT3C_AuthV2ExhaustiveT3B_AuthV2ExhaustiveT3A
RelationalWithAuthV2NonRedacted_AuthV2TransformerIAM_AuthV2ExhaustiveT3D_AuthV2ExhaustiveT3C_AuthV2ExhaustiveT3B
buildspec: codebuild_specs/graphql_e2e_tests.yml
env:
compute-type: BUILD_GENERAL1_LARGE
variables:
NODE_OPTIONS: '--max-old-space-size=14848'
TEST_SUITE: >-
src/__tests__/AuthV2TransformerIAM.test.ts|src/__tests__/AuthV2ExhaustiveT3D.test.ts|src/__tests__/AuthV2ExhaustiveT3C.test.ts|src/__tests__/AuthV2ExhaustiveT3B.test.ts|src/__tests__/AuthV2ExhaustiveT3A.test.ts
src/__tests__/RelationalWithAuthV2NonRedacted.e2e.test.ts|src/__tests__/AuthV2TransformerIAM.test.ts|src/__tests__/AuthV2ExhaustiveT3D.test.ts|src/__tests__/AuthV2ExhaustiveT3C.test.ts|src/__tests__/AuthV2ExhaustiveT3B.test.ts
CLI_REGION: eu-south-1
depend-on:
- publish_to_local_registry
- identifier: >-
SearchableModelTransformerV2_SearchableWithAuthV2WithFF_SearchableWithAuthV2
AuthV2ExhaustiveT3A_SearchableModelTransformerV2_SearchableWithAuthV2WithFF_SearchableWithAuthV2
buildspec: codebuild_specs/graphql_e2e_tests.yml
env:
compute-type: BUILD_GENERAL1_LARGE
variables:
NODE_OPTIONS: '--max-old-space-size=14848'
TEST_SUITE: >-
src/__tests__/SearchableModelTransformerV2.e2e.test.ts|src/__tests__/SearchableWithAuthV2WithFF.e2e.test.ts|src/__tests__/SearchableWithAuthV2.e2e.test.ts
src/__tests__/AuthV2ExhaustiveT3A.test.ts|src/__tests__/SearchableModelTransformerV2.e2e.test.ts|src/__tests__/SearchableWithAuthV2WithFF.e2e.test.ts|src/__tests__/SearchableWithAuthV2.e2e.test.ts
CLI_REGION: eu-west-3
depend-on:
- publish_to_local_registry
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ export { PrimaryKeyDirective } from './primary-key';
export { RefersToDirective } from './refers-to';
export { SearchableDirective } from './searchable';
export { SqlDirective } from './sql';
export { SequenceDirective } from './sequence';
13 changes: 13 additions & 0 deletions packages/amplify-graphql-directives/src/directives/sequence.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Directive } from './directive';

const name = 'sequence';
const definition = /* GraphQL */ `
directive @${name} on FIELD_DEFINITION
`;
const defaults = {};

export const SequenceDirective: Directive = {
name,
definition,
defaults,
};
2 changes: 2 additions & 0 deletions packages/amplify-graphql-directives/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import {
SearchableDirectiveV1,
SqlDirective,
VersionedDirectiveV1,
SequenceDirective,
} from './directives';

export const AppSyncDirectives: readonly Directive[] = [
Expand All @@ -53,6 +54,7 @@ export const V2Directives: readonly Directive[] = [
AuthDirective,
BelongsToDirective,
DefaultDirective,
SequenceDirective,
DeprecatedDirective,
ConversationDirective,
FunctionDirective,
Expand Down
13 changes: 13 additions & 0 deletions packages/amplify-graphql-sequence-transformer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# GraphQL @sequence Transformer

# Reference Documentation

### @sequence

The `@sequence` directive allows you to define a field as sequence

#### Definition

```graphql
directive @sequence on FIELD_DEFINITION
```
68 changes: 68 additions & 0 deletions packages/amplify-graphql-sequence-transformer/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"name": "@aws-amplify/graphql-sequence-transformer",
"version": "1.0.0",
"main": "lib/index.js",
"repository": {
"type": "git",
"url": "https://github.com/aws-amplify/amplify-category-api.git",
"directory": "packages/amplify-graphql-sequence-transformer"
},
"author": "Amazon Web Services",
"license": "Apache-2.0",
"private": false,
"scripts": {
"build": "tsc",
"ss": "jest --update-snapshot",
"watch": "tsc -w",
"clean": "rimraf ./lib",
"test": "jest",
"test-watch": "jest --watch",
"extract-api": "ts-node ../../scripts/extract-api.ts"
},
"jest": {
"transform": {
"^.+\\.tsx?$": "ts-jest"
},
"testEnvironmentOptions": {
"url": "http://localhost"
},
"testRegex": "(src/__tests__/.*\\.(test|spec))\\.(jsx?|tsx?)$",
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jsx",
"json",
"node"
],
"collectCoverage": true,
"coverageProvider": "v8",
"coverageThreshold": {
"global": {
"branches": 90,
"functions": 90,
"lines": 90
}
},
"coverageReporters": [
"clover",
"text"
],
"collectCoverageFrom": [
"src/**/*.ts"
],
"coveragePathIgnorePatterns": [
"/__tests__/",
"index.ts",
"types.ts"
],
"snapshotFormat": {
"escapeString": true,
"printBasicPrototype": true
}
},
"dependencies": {
"@aws-amplify/graphql-directives": "^2.1.0",
"@aws-amplify/graphql-transformer-core": "^3.1.0"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,223 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`SequenceTransformer: should successfully transform simple valid schema 1`] = `
"type CoffeeQueue {
id: ID!
orderNumber: Int!
name: String
}

input ModelStringInput {
ne: String
eq: String
le: String
lt: String
ge: String
gt: String
contains: String
notContains: String
between: [String]
beginsWith: String
attributeExists: Boolean
attributeType: ModelAttributeTypes
size: ModelSizeInput
}

input ModelIntInput {
ne: Int
eq: Int
le: Int
lt: Int
ge: Int
gt: Int
between: [Int]
attributeExists: Boolean
attributeType: ModelAttributeTypes
}

input ModelFloatInput {
ne: Float
eq: Float
le: Float
lt: Float
ge: Float
gt: Float
between: [Float]
attributeExists: Boolean
attributeType: ModelAttributeTypes
}

input ModelBooleanInput {
ne: Boolean
eq: Boolean
attributeExists: Boolean
attributeType: ModelAttributeTypes
}

input ModelIDInput {
ne: ID
eq: ID
le: ID
lt: ID
ge: ID
gt: ID
contains: ID
notContains: ID
between: [ID]
beginsWith: ID
attributeExists: Boolean
attributeType: ModelAttributeTypes
size: ModelSizeInput
}

input ModelSubscriptionStringInput {
ne: String
eq: String
le: String
lt: String
ge: String
gt: String
contains: String
notContains: String
between: [String]
beginsWith: String
in: [String]
notIn: [String]
}

input ModelSubscriptionIntInput {
ne: Int
eq: Int
le: Int
lt: Int
ge: Int
gt: Int
between: [Int]
in: [Int]
notIn: [Int]
}

input ModelSubscriptionFloatInput {
ne: Float
eq: Float
le: Float
lt: Float
ge: Float
gt: Float
between: [Float]
in: [Float]
notIn: [Float]
}

input ModelSubscriptionBooleanInput {
ne: Boolean
eq: Boolean
}

input ModelSubscriptionIDInput {
ne: ID
eq: ID
le: ID
lt: ID
ge: ID
gt: ID
contains: ID
notContains: ID
between: [ID]
beginsWith: ID
in: [ID]
notIn: [ID]
}

enum ModelAttributeTypes {
binary
binarySet
bool
list
map
number
numberSet
string
stringSet
_null
}

input ModelSizeInput {
ne: Int
eq: Int
le: Int
lt: Int
ge: Int
gt: Int
between: [Int]
}

enum ModelSortDirection {
ASC
DESC
}

type ModelCoffeeQueueConnection {
items: [CoffeeQueue]!
nextToken: String
}

input ModelCoffeeQueueFilterInput {
id: ModelIDInput
orderNumber: ModelIntInput
name: ModelStringInput
and: [ModelCoffeeQueueFilterInput]
or: [ModelCoffeeQueueFilterInput]
not: ModelCoffeeQueueFilterInput
}

type Query {
getCoffeeQueue(id: ID!): CoffeeQueue
listCoffeeQueues(id: ID, filter: ModelCoffeeQueueFilterInput, limit: Int, nextToken: String, sortDirection: ModelSortDirection): ModelCoffeeQueueConnection
}

input ModelCoffeeQueueConditionInput {
orderNumber: ModelIntInput
name: ModelStringInput
and: [ModelCoffeeQueueConditionInput]
or: [ModelCoffeeQueueConditionInput]
not: ModelCoffeeQueueConditionInput
}

input CreateCoffeeQueueInput {
id: ID
orderNumber: Int
name: String
}

input UpdateCoffeeQueueInput {
id: ID!
orderNumber: Int
name: String
}

input DeleteCoffeeQueueInput {
id: ID!
}

type Mutation {
createCoffeeQueue(input: CreateCoffeeQueueInput!, condition: ModelCoffeeQueueConditionInput): CoffeeQueue
updateCoffeeQueue(input: UpdateCoffeeQueueInput!, condition: ModelCoffeeQueueConditionInput): CoffeeQueue
deleteCoffeeQueue(input: DeleteCoffeeQueueInput!, condition: ModelCoffeeQueueConditionInput): CoffeeQueue
}

input ModelSubscriptionCoffeeQueueFilterInput {
id: ModelSubscriptionIDInput
orderNumber: ModelSubscriptionIntInput
name: ModelSubscriptionStringInput
and: [ModelSubscriptionCoffeeQueueFilterInput]
or: [ModelSubscriptionCoffeeQueueFilterInput]
}

type Subscription {
onCreateCoffeeQueue(filter: ModelSubscriptionCoffeeQueueFilterInput): CoffeeQueue @aws_subscribe(mutations: [\\"createCoffeeQueue\\"])
onUpdateCoffeeQueue(filter: ModelSubscriptionCoffeeQueueFilterInput): CoffeeQueue @aws_subscribe(mutations: [\\"updateCoffeeQueue\\"])
onDeleteCoffeeQueue(filter: ModelSubscriptionCoffeeQueueFilterInput): CoffeeQueue @aws_subscribe(mutations: [\\"deleteCoffeeQueue\\"])
}
"
`;
Loading