This file contains hidden or 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
import * as z from "zod"; | |
/** | |
* This function converts a JSON schema into a Zod schema. | |
* | |
* @param schema The JSON schema to be converted. The schema should follow the JSON Schema Draft 7 specification. | |
* | |
* Example: | |
* schema: { | |
* $schema: "http://json-schema.org/draft-07/schema#", | |
* title: "Complex Example", |
This file contains hidden or 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
import { | |
createParser, | |
ParsedEvent, | |
ReconnectInterval, | |
} from "eventsource-parser"; | |
import { Procedure } from "./procedure"; | |
import openai, { ChatCompletionRequestMessage } from "@acme/openai"; | |
import _ from "lodash"; | |
export type Message = Omit<ChatCompletionRequestMessage, "role"> & { |
This file contains hidden or 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
export const generateFilter = (filterParams) => { | |
const IDL_DEFINATION = { | |
name: "vote", | |
type: { | |
kind: "struct", | |
fields: [ | |
{ | |
name: "proposalId", | |
type: "u64", | |
}, |
This file contains hidden or 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
const createDisctionaryOfColumns = (tableDefination) => { | |
return tableDefination.split(',').reduce((prev,column) => { | |
const part = column.trim().split(/\s+/); | |
console.log(part) | |
const cName = part[0]; | |
const type = part[1]; | |
prev[cName]= type; | |
return prev; | |
}, {}) | |
} |
This file contains hidden or 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
const REQUEST = 'REQUEST' | |
const SUCCESS = 'SUCCESS' | |
const FAILURE = 'FAILURE' | |
function action(type, payload = {}) { | |
return {type, ...payload} | |
} | |
const listJDs = { | |
request: () => action(ActionTypes.LIST_JDS[REQUEST]), |
This file contains hidden or 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
const winston = require('winston'); | |
const logger = winston.createLogger({ | |
level: 'debug', | |
// (typeof(process.env.NODE_ENV) === 'string' && process.env.NODE_ENV.startsWith('prod')) | |
// ? 'info' | |
// : 'debug', | |
format: winston.format.combine( | |
winston.format.timestamp(), | |
winston.format.splat(), |
This file contains hidden or 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
import React from 'react'; | |
import { Form, Input, Button, Col, Icon } from 'antd'; | |
import { Logger } from 'aws-amplify'; | |
import { intlShape, injectIntl } from 'react-intl'; | |
import styled from 'styled-components'; | |
import * as t from '../../i18n'; | |
const logger = new Logger('Form:Login', 'DEBUG'); |
This file contains hidden or 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
import React from 'react'; | |
import { Button, Icon, message } from 'antd'; | |
import { navigateTo } from 'gatsby-link'; | |
import { Auth, Logger } from 'aws-amplify'; | |
import { LoginForm } from '../../Form' | |
const logger = new Logger('Auth:Login'); | |
class Login extends React.Component { | |
state = { status: 'idle' } |
This file contains hidden or 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
import Amplify, { Auth } from 'aws-amplify'; | |
import { withAuthenticator } from 'aws-amplify-react/dist/Auth'; | |
import AWSAppSyncClient from 'aws-appsync'; | |
import { ApolloProvider } from 'react-apollo'; | |
const client = new AWSAppSyncClient({ | |
url: 'https://xxxx.appsync-api.us-east-1.amazonaws.com/graphql', | |
region: 'us-east-1', | |
auth: { | |
// AWS Cognito User Pool | |
type: AUTH_TYPE.AMAZON_COGNITO_USER_POOLS, |
This file contains hidden or 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
const GET_JOB = gql` | |
query GetJobById($Id: String!) { | |
Job(Id: $Id) { | |
images { | |
url | |
id | |
} | |
isLiked @client | |
} | |
} |
NewerOlder