Skip to content

Commit

Permalink
refactor: Prettier
Browse files Browse the repository at this point in the history
Signed-off-by: Diwank Singh Tomer <[email protected]>
  • Loading branch information
creatorrr committed Mar 1, 2021
1 parent 5e5cb95 commit b455355
Show file tree
Hide file tree
Showing 18 changed files with 241 additions and 92 deletions.
112 changes: 112 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# Generated files
/docs/
/lib/
/src/generated/

# Vim shit
*.swp

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port
1 change: 1 addition & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# codegen

Codegen outputs from our schema
36 changes: 16 additions & 20 deletions codegen.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,34 @@ const endpoint = "https://api.mauna.cloud/v1/graphql";

module.exports = {
overwrite: true,
schema: [{
[endpoint]: {
headers: {
"X-Hasura-Admin-Secret": process.env.HASURA_ADMIN_SECRET || ""
}
}
}],
schema: [
{
[endpoint]: {
headers: {
"X-Hasura-Admin-Secret": process.env.HASURA_ADMIN_SECRET || "",
},
},
},
],
documents: "./src/documents/*.graphql",
generates: {
"./src/generated/types.ts": {
plugins: [
"typescript",
"typescript-operations",
"time"
]
plugins: ["typescript", "typescript-operations", "time"],
},
"./src/generated/sdk.ts": {
config: {
pureMagicComment: true,
gqlImport: "../utils/gqlLodash#gql"
gqlImport: "../utils/gqlLodash#gql",
},
plugins: [
"typescript",
"typescript-operations",
"typescript-graphql-request",
"time"
]
"time",
],
},
"./graphql.schema.json": {
plugins: [
"introspection"
]
}
}
plugins: ["introspection"],
},
},
};
18 changes: 4 additions & 14 deletions graphql.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -44186,11 +44186,7 @@
"name": "include",
"description": "Directs the executor to include this field or fragment only when the `if` argument is true.",
"isRepeatable": false,
"locations": [
"FIELD",
"FRAGMENT_SPREAD",
"INLINE_FRAGMENT"
],
"locations": ["FIELD", "FRAGMENT_SPREAD", "INLINE_FRAGMENT"],
"args": [
{
"name": "if",
Expand All @@ -44214,11 +44210,7 @@
"name": "skip",
"description": "Directs the executor to skip this field or fragment when the `if` argument is true.",
"isRepeatable": false,
"locations": [
"FIELD",
"FRAGMENT_SPREAD",
"INLINE_FRAGMENT"
],
"locations": ["FIELD", "FRAGMENT_SPREAD", "INLINE_FRAGMENT"],
"args": [
{
"name": "if",
Expand Down Expand Up @@ -44267,9 +44259,7 @@
"name": "specifiedBy",
"description": "Exposes a URL that specifies the behaviour of this scalar.",
"isRepeatable": false,
"locations": [
"SCALAR"
],
"locations": ["SCALAR"],
"args": [
{
"name": "url",
Expand All @@ -44291,4 +44281,4 @@
}
]
}
}
}
19 changes: 19 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"@graphql-codegen/typescript-oclif": "^1.17.9",
"@graphql-codegen/typescript-operations": "^1.17.14",
"@types/lodash": "^4.14.168",
"prettier": "2.2.1",
"typedoc": "^0.20.28",
"typescript": "^4.1.x",
"valid-env": "^1.1.1"
Expand Down
8 changes: 4 additions & 4 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ import { apiEndpoint, authEndpoint } from "./config";

import type { JWT } from "./utils/auth";

export type credentials = {developerId: number, apiKey: string};
export type credentials = { developerId: number; apiKey: string };

export class Client extends GraphQLClient {
constructor(jwt: JWT) {
super(apiEndpoint, {
headers: {
authorization: `Bearer ${jwt.trim()}`
}
authorization: `Bearer ${jwt.trim()}`,
},
});
}

// TODO: Add refresh logic

static async create({developerId, apiKey}: credentials): Promise<Client> {
static async create({ developerId, apiKey }: credentials): Promise<Client> {
const [exchangeToken, nonce] = createExchangeToken(apiKey);
const authData = await requestJWT(developerId, exchangeToken);
const jwt = decodeJWT(authData, apiKey, nonce);
Expand Down
2 changes: 1 addition & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ export default {
cipherMode,
defaultIv,
ivLength,
encryptionKeyLenBytes
encryptionKeyLenBytes,
};
12 changes: 10 additions & 2 deletions src/documents/dialog.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,16 @@ query predictNextTurn($history: [String!]!, $alternatives: [String!]!) {
}
}

query matchIntent($input: String!, $intenst: [String!]!, $threshold: Float! = 0.7) {
callMatchIntent(input: $input, possible_intents: $intenst, similarity_threshold: $threshold) {
query matchIntent(
$input: String!
$intenst: [String!]!
$threshold: Float! = 0.7
) {
callMatchIntent(
input: $input
possible_intents: $intenst
similarity_threshold: $threshold
) {
matches {
intent: matched_intent
confidence: similarity
Expand Down
6 changes: 3 additions & 3 deletions src/documents/speech.graphql
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
query renderCSS($ssml: String!, $css: String) {
callCompose(
init: {styled_ssml: $ssml, voice_css: $css},
init: { styled_ssml: $ssml, voice_css: $css }
pipeline: [
{op: "callApplyVoiceCSS", transform: "r => ({text: r.ssml})"},
{op: "callTextToSpeech", transform: ""}
{ op: "callApplyVoiceCSS", transform: "r => ({text: r.ssml})" }
{ op: "callTextToSpeech", transform: "" }
]
) {
result
Expand Down
12 changes: 5 additions & 7 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Client from "./client";
import {getSdk} from "./generated/sdk";
import {withRetries} from "./utils/wrapper";
import { getSdk } from "./generated/sdk";
import { withRetries } from "./utils/wrapper";

import type {Sdk} from "./generated/sdk";
import type { Sdk } from "./generated/sdk";
import type * as types from "./generated/types";
import type { credentials } from "./client";

Expand All @@ -22,7 +22,7 @@ export class Mauna {
}

async initialize() {
const { developerId, apiKey} = this;
const { developerId, apiKey } = this;

this.client = await Client.create({ developerId, apiKey });
this._sdk = getSdk(this.client, withRetries);
Expand All @@ -40,8 +40,6 @@ export class Mauna {
}
}

export {
types
};
export { types };

export default Mauna;
Loading

0 comments on commit b455355

Please sign in to comment.