-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: Adding preProcess support to V2 transformer
- Loading branch information
Showing
19 changed files
with
475 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Change Log | ||
|
||
All notable changes to this project will be documented in this file. | ||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. | ||
|
||
# 1.1.0 (2020-12-07) | ||
|
||
|
||
### Bug Fixes | ||
|
||
* fix winston error with 0 transports ([#5631](https://github.com/aws-amplify/amplify-cli/issues/5631)) ([4326ec6](https://github.com/aws-amplify/amplify-cli/commit/4326ec6cf2a62580cd2646241463d20d7b7fb062)) | ||
* fixed core references ([#6069](https://github.com/aws-amplify/amplify-cli/issues/6069)) ([32446ac](https://github.com/aws-amplify/amplify-cli/commit/32446ac77a5064bee928544861b8a70fba556d51)) | ||
|
||
|
||
### Features | ||
|
||
* Cloudformation logging ([#5195](https://github.com/aws-amplify/amplify-cli/issues/5195)) ([19b2165](https://github.com/aws-amplify/amplify-cli/commit/19b21651375848c0858328952852201da47b17bb)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
{ | ||
"name": "amplify-data-core", | ||
"version": "1.1.0", | ||
"description": "Amplify CLI Data Core Library", | ||
"main": "lib/index.js", | ||
"types": "lib/index.d.ts", | ||
"scripts": { | ||
"test": "jest", | ||
"build": "tsc", | ||
"watch": "tsc -w", | ||
"clean": "rimraf lib tsconfig.tsbuildinfo" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/aws-amplify/amplify-cli.git" | ||
}, | ||
"author": "", | ||
"license": "Apache-2.0", | ||
"bugs": { | ||
"url": "https://github.com/aws-amplify/amplify-cli/issues" | ||
}, | ||
"jest": { | ||
"transform": { | ||
"^.+\\.tsx?$": "ts-jest" | ||
}, | ||
"testRegex": "(/src/__tests__/.*|(\\.|/)test)\\.tsx?$", | ||
"coveragePathIgnorePatterns": [ | ||
"/node_modules/", | ||
"/templates/" | ||
], | ||
"moduleFileExtensions": [ | ||
"ts", | ||
"tsx", | ||
"js", | ||
"jsx", | ||
"json", | ||
"node" | ||
], | ||
"collectCoverage": true | ||
}, | ||
"homepage": "https://github.com/aws-amplify/amplify-cli#readme", | ||
"dependencies": { | ||
"amplify-cli-core": "2.5.0", | ||
"amplify-data-interfaces": "1.0.0", | ||
"@aws-amplify/graphql-auth-transformer": "0.7.10", | ||
"@aws-amplify/graphql-default-value-transformer": "0.5.18", | ||
"@aws-amplify/graphql-function-transformer": "0.7.12", | ||
"@aws-amplify/graphql-http-transformer": "0.8.12", | ||
"@aws-amplify/graphql-index-transformer": "0.11.3", | ||
"@aws-amplify/graphql-maps-to-transformer": "1.1.10", | ||
"@aws-amplify/graphql-model-transformer": "0.13.3", | ||
"@aws-amplify/graphql-predictions-transformer": "0.6.12", | ||
"@aws-amplify/graphql-relational-transformer": "0.7.10", | ||
"@aws-amplify/graphql-searchable-transformer": "0.13.5", | ||
"@aws-amplify/graphql-transformer-core": "0.16.3", | ||
"@aws-amplify/graphql-transformer-interfaces": "1.13.0", | ||
"immer": "^9.0.12", | ||
"fs-extra": "^10.0.1", | ||
"graphql": "^16.3.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import * as fs from 'fs-extra'; | ||
import { DocumentNode, parse } from 'graphql'; | ||
import path from 'path'; | ||
|
||
import { AmplifyDataApiProvider } from '../../amplify-data-interfaces'; | ||
import { GraphQLTransform } from '@aws-amplify/graphql-transformer-core'; | ||
|
||
export class AmplifyDataApi implements AmplifyDataApiProvider { | ||
private schema?: DocumentNode; | ||
|
||
public constructor() { | ||
this.schema = undefined; | ||
} | ||
|
||
public async readSchema(schemaPath: string): Promise<DocumentNode> { | ||
if (this.schema) { | ||
return this.schema; | ||
} | ||
|
||
const fileContentsList = new Array<Promise<Buffer>>(); | ||
|
||
const stats = fs.statSync(schemaPath); | ||
if (stats.isDirectory()) { | ||
fs.readdirSync(schemaPath).forEach(fileName => { | ||
fileContentsList.push(fs.readFile(path.join(schemaPath, fileName))); | ||
}); | ||
} else { | ||
fileContentsList.push(fs.readFile(schemaPath)); | ||
} | ||
|
||
const bufferList = await Promise.all(fileContentsList); | ||
const fullSchema = bufferList.map(buff => buff.toString()).join('\n'); | ||
const parsedSchema = parse(fullSchema);/* | ||
const transformer = {} as GraphQLTransform; // TODO: implement getTransformer(); | ||
const processedSchema = transformer.preProcess(parsedSchema); | ||
this.schema = processedSchema; | ||
return processedSchema;*/ | ||
return parsedSchema; | ||
} | ||
} |
Empty file.
10 changes: 10 additions & 0 deletions
10
packages/amplify-data-core/src/transformer-util/create-transformer.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { | ||
BelongsToTransformer, | ||
HasManyTransformer, | ||
HasOneTransformer, | ||
ManyToManyTransformer, | ||
} from '@aws-amplify/graphql-relational-transformer'; | ||
import { | ||
getAppSyncServiceExtraDirectives, | ||
GraphQLTransform, | ||
} from '@aws-amplify/graphql-transformer-core'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"extends": "../../tsconfig.base.json", | ||
"compilerOptions": { | ||
"outDir": "./lib", | ||
"rootDir": "./src", | ||
}, | ||
"references": [ | ||
{ "path": "../amplify-data-interfaces" }, | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Change Log | ||
|
||
All notable changes to this project will be documented in this file. | ||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. | ||
|
||
# 1.1.0 (2020-12-07) | ||
|
||
|
||
### Bug Fixes | ||
|
||
* fix winston error with 0 transports ([#5631](https://github.com/aws-amplify/amplify-cli/issues/5631)) ([4326ec6](https://github.com/aws-amplify/amplify-cli/commit/4326ec6cf2a62580cd2646241463d20d7b7fb062)) | ||
* fixed core references ([#6069](https://github.com/aws-amplify/amplify-cli/issues/6069)) ([32446ac](https://github.com/aws-amplify/amplify-cli/commit/32446ac77a5064bee928544861b8a70fba556d51)) | ||
|
||
|
||
### Features | ||
|
||
* Cloudformation logging ([#5195](https://github.com/aws-amplify/amplify-cli/issues/5195)) ([19b2165](https://github.com/aws-amplify/amplify-cli/commit/19b21651375848c0858328952852201da47b17bb)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{ | ||
"name": "amplify-data-interfaces", | ||
"version": "1.0.0", | ||
"description": "Amplify CLI Data Interfaces", | ||
"main": "lib/index.js", | ||
"types": "lib/index.d.ts", | ||
"scripts": { | ||
"test": "jest", | ||
"build": "tsc", | ||
"watch": "tsc -w", | ||
"clean": "rimraf lib tsconfig.tsbuildinfo" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/aws-amplify/amplify-cli.git" | ||
}, | ||
"author": "", | ||
"license": "Apache-2.0", | ||
"bugs": { | ||
"url": "https://github.com/aws-amplify/amplify-cli/issues" | ||
}, | ||
"jest": { | ||
"transform": { | ||
"^.+\\.tsx?$": "ts-jest" | ||
}, | ||
"testRegex": "(/src/__tests__/.*|(\\.|/)test)\\.tsx?$", | ||
"coveragePathIgnorePatterns": [ | ||
"/node_modules/", | ||
"/templates/" | ||
], | ||
"moduleFileExtensions": [ | ||
"ts", | ||
"tsx", | ||
"js", | ||
"jsx", | ||
"json", | ||
"node" | ||
], | ||
"collectCoverage": true | ||
}, | ||
"homepage": "https://github.com/aws-amplify/amplify-cli#readme", | ||
"dependencies": { | ||
"amplify-cli-core": "2.5.0", | ||
"@aws-amplify/graphql-auth-transformer": "0.7.10", | ||
"@aws-amplify/graphql-default-value-transformer": "0.5.18", | ||
"@aws-amplify/graphql-function-transformer": "0.7.12", | ||
"@aws-amplify/graphql-http-transformer": "0.8.12", | ||
"@aws-amplify/graphql-index-transformer": "0.11.3", | ||
"@aws-amplify/graphql-maps-to-transformer": "1.1.10", | ||
"@aws-amplify/graphql-model-transformer": "0.13.3", | ||
"@aws-amplify/graphql-predictions-transformer": "0.6.12", | ||
"@aws-amplify/graphql-relational-transformer": "0.7.10", | ||
"@aws-amplify/graphql-searchable-transformer": "0.13.5", | ||
"@aws-amplify/graphql-transformer-core": "0.16.3", | ||
"@aws-amplify/graphql-transformer-interfaces": "1.13.0", | ||
"graphql": "^16.3.0" | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
packages/amplify-data-interfaces/src/amplify-data-api-provider.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { DocumentNode } from 'graphql'; | ||
|
||
/** | ||
* The AmplifyDataApiProvider serves as a definition for the API used for external interactions with the data layer | ||
*/ | ||
export interface AmplifyDataApiProvider { | ||
readSchema: (path: string) => Promise<DocumentNode>; | ||
// getRemovedTables: (referencedTables: string[]) => string[]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { AmplifyDataApiProvider } from './amplify-data-api-provider'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"extends": "../../tsconfig.base.json", | ||
"compilerOptions": { | ||
"outDir": "./lib", | ||
"rootDir": "./src", | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.