Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add api extractor to missing packages #1789

Merged
merged 1 commit into from
Aug 8, 2023
Merged
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
227 changes: 227 additions & 0 deletions packages/amplify-graphql-schema-generator/API.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,227 @@
## API Report File for "@aws-amplify/graphql-schema-generator"

> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).

```ts

// @public (undocumented)
export interface CustomType {
// (undocumented)
readonly kind: 'Custom';
// (undocumented)
readonly name: string;
}

// @public (undocumented)
export abstract class DataSourceAdapter {
// (undocumented)
abstract cleanup(): void;
// (undocumented)
describeTable(tableName: string): Promise<Model>;
// (undocumented)
abstract getFields(tableName: string): Promise<Field[]>;
// (undocumented)
abstract getIndexes(tableName: string): Promise<Index[]>;
// (undocumented)
getModels(): Promise<Model[]>;
// (undocumented)
abstract getPrimaryKey(tableName: string): Promise<Index | null>;
// (undocumented)
abstract getTablesList(): Promise<string[]>;
// (undocumented)
abstract initialize(): Promise<void>;
// (undocumented)
abstract mapDataType(datatype: string, nullable: boolean, tableName: string, fieldName: string, columnType: string): FieldType;
// (undocumented)
abstract test(): Promise<boolean>;
// (undocumented)
useVPC: boolean;
// (undocumented)
useVpc(vpcSchemaInspectorLambda: string, region: string): void;
// (undocumented)
vpcLambdaRegion: string | undefined;
// (undocumented)
vpcSchemaInspectorLambda: string | undefined;
}

// @public (undocumented)
export type DBEngineType = 'MySQL' | 'DynamoDB';

// @public (undocumented)
export interface DefaultType {
// (undocumented)
readonly kind: 'Scalar';
// (undocumented)
readonly name: FieldDataType;
}

// @public (undocumented)
export interface DefaultValue {
// (undocumented)
readonly kind: 'DB_GENERATED' | 'TRANSFORMER_GENERATED';
// (undocumented)
readonly value: string | number | boolean;
}

// @public (undocumented)
export class Engine {
constructor(type: DBEngineType);
// (undocumented)
type: DBEngineType;
}

// @public (undocumented)
export interface EnumType {
// (undocumented)
readonly kind: 'Enum';
// (undocumented)
name: string;
// (undocumented)
readonly values: string[];
}

// @public (undocumented)
export class Field {
constructor(name: string, type: FieldType);
// (undocumented)
default: DefaultValue | undefined;
// (undocumented)
length: number | null | undefined;
// (undocumented)
name: string;
// (undocumented)
type: FieldType;
}

// @public (undocumented)
export type FieldDataType = 'String' | 'ID' | 'Int' | 'Float' | 'AWSJSON' | 'AWSDate' | 'AWSTime' | 'AWSDateTime' | 'AWSTimestamp' | 'ENUM' | 'Boolean' | 'AWSEmail' | 'AWSPhone' | 'AWSURL' | 'AWSIPAddress';

// @public (undocumented)
export type FieldType = DefaultType | CustomType | ListType | NonNullType | EnumType;

// @public (undocumented)
export const generateGraphQLSchema: (schema: Schema) => string;

// @public (undocumented)
export const getHostVpc: (hostname: string, region: string) => Promise<VpcConfig | undefined>;

// @public (undocumented)
export class Index {
constructor(name: string);
// (undocumented)
getFields(): string[];
// (undocumented)
name: string;
// (undocumented)
setFields(fields: string[]): void;
}

// @public (undocumented)
export const invokeSchemaInspectorLambda: (funcName: any, dbConfig: any, query: any, region: any) => Promise<any>;

// @public (undocumented)
export const isComputeExpression: (value: string) => boolean;

// @public (undocumented)
export interface ListType {
// (undocumented)
readonly kind: 'List';
// (undocumented)
readonly type: FieldType;
}

// @public (undocumented)
export class Model {
constructor(name: string);
// (undocumented)
addField(field: Field): void;
// (undocumented)
addIndex(name: string, fields: string[]): void;
// (undocumented)
getFields(): Field[];
// (undocumented)
getIndexes(): Index[];
// (undocumented)
getName(): string;
// (undocumented)
getPrimaryKey(): Index | undefined;
// (undocumented)
hasField(name: string): boolean;
// (undocumented)
hasIndex(name: string): boolean;
// (undocumented)
setPrimaryKey(fields: string[]): void;
}

// @public (undocumented)
export class MySQLDataSourceAdapter extends DataSourceAdapter {
constructor(config: MySQLDataSourceConfig);
// (undocumented)
cleanup(): void;
// (undocumented)
getFields(tableName: string): Promise<Field[]>;
// (undocumented)
getIndexes(tableName: string): Promise<Index[]>;
// (undocumented)
getPrimaryKey(tableName: string): Promise<Index | null>;
// (undocumented)
getTablesList(): Promise<string[]>;
// (undocumented)
initialize(): Promise<void>;
// (undocumented)
mapDataType(datatype: string, nullable: boolean, tableName: string, fieldName: string, columntype: string): FieldType;
// (undocumented)
test(): Promise<boolean>;
}

// @public (undocumented)
export interface MySQLDataSourceConfig {
// (undocumented)
database: string;
// (undocumented)
host: string;
// (undocumented)
password: string;
// (undocumented)
port: number;
// (undocumented)
username: string;
}

// @public (undocumented)
export interface NonNullType {
// (undocumented)
readonly kind: 'NonNull';
// (undocumented)
readonly type: DefaultType | CustomType | ListType | EnumType;
}

// @public (undocumented)
export const provisionSchemaInspectorLambda: (lambdaName: string, vpc: VpcConfig, region: string) => Promise<void>;

// @public (undocumented)
export class Schema {
constructor(engine: Engine);
// (undocumented)
addModel(model: Model): void;
// (undocumented)
getEngine(): Engine;
// (undocumented)
getModels(): Model[];
// (undocumented)
hasModel(name: string): boolean;
}

// @public (undocumented)
export const sleep: (milliseconds: number) => Promise<void>;

// @public (undocumented)
export type VpcConfig = {
vpcId: string;
subnetIds: string[];
securityGroupIds: string[];
};

// (No @packageDocumentation comment for this package)

```
3 changes: 2 additions & 1 deletion packages/amplify-graphql-schema-generator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"build": "tsc && cd vpc-db-lambda && rm -rf node_modules && npm install && tsc && cp -r node_modules lib && cd lib && bestzip --force node ../../lib/rds-schema-inspector.zip ./*",
"watch": "tsc -w",
"clean": "rimraf ./lib && rimraf ./vpc-db-lambda/lib",
"test": "jest"
"test": "jest",
"extract-api": "ts-node ../../scripts/extract-api.ts"
},
"dependencies": {
"@aws-amplify/graphql-transformer-core": "1.4.0",
Expand Down
17 changes: 17 additions & 0 deletions packages/amplify-schema-validator/API.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
## API Report File for "@aws-amplify/graphql-schema-validation"

> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).

```ts

// @public (undocumented)
export const validateSchema: (schemaString: string) => void;

// Warning: (ae-forgotten-export) The symbol "ValidateSchemaProps" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export const validateSchemaWithContext: (schemaString: string, props: ValidateSchemaProps) => void;

// (No @packageDocumentation comment for this package)

```
44 changes: 44 additions & 0 deletions packages/amplify-schema-validator/api-extractor.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"mainEntryPointFilePath": "<projectFolder>/dist/index.d.ts",
"bundledPackages": [],
"newlineKind": "lf",

"apiReport": {
"enabled": true,
"reportFileName": "API.md",
"reportFolder": "<projectFolder>/"
},

"docModel": {
"enabled": false
},

"dtsRollup": {
"enabled": false
},

"tsdocMetadata": {
"enabled": false
},

"messages": {
"compilerMessageReporting": {
"default": {
"logLevel": "none"
}
},

"extractorMessageReporting": {
"default": {
"logLevel": "none"
}
},

"tsdocMessageReporting": {
"default": {
"logLevel": "none"
}
}
}
}
3 changes: 2 additions & 1 deletion packages/amplify-schema-validator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"build": "tsc && yarn size",
"clean": "rimraf -rf build node_modules dist coverage",
"test": "jest --coverage",
"size": "size-limit"
"size": "size-limit",
"extract-api": "ts-node ../../scripts/extract-api.ts"
},
"devDependencies": {
"@size-limit/preset-small-lib": "6.0.4",
Expand Down
14 changes: 10 additions & 4 deletions scripts/extract-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,18 @@ const configTemplatePath = path.join(__dirname, 'api-extractor.json');
const extractApi = (packagePath: string): void => {
const hasTypeScript = fs.pathExistsSync(path.join(packagePath, 'tsconfig.json'));
const hasEntryPoint = fs.pathExistsSync(path.join(packagePath, 'lib', 'index.js'));
if (!hasTypeScript || !hasEntryPoint) {
const pkgConfigPath = path.join(packagePath, 'api-extractor.json');
const hasApiExtractorFile = fs.pathExistsSync(pkgConfigPath);

if (!hasTypeScript || !(hasEntryPoint || hasApiExtractorFile)) {
console.log(`Skipping ${packagePath}`);
return;
}
console.log(`Extracting ${packagePath}`);

const pkgConfigPath = path.join(packagePath, 'api-extractor.json');
fs.copySync(configTemplatePath, pkgConfigPath);
if (!hasApiExtractorFile) {
fs.copySync(configTemplatePath, pkgConfigPath);
}
try {
const extractorConfig = ExtractorConfig.loadFileAndPrepare(pkgConfigPath);
Extractor.invoke(extractorConfig, {
Expand All @@ -26,7 +30,9 @@ const extractApi = (packagePath: string): void => {
if (fs.pathExistsSync(tmpPath)) {
fs.removeSync(tmpPath);
}
fs.removeSync(pkgConfigPath);
if (!hasApiExtractorFile) {
fs.removeSync(pkgConfigPath);
}
}
};

Expand Down