chore: configure new monorepo and build workflow

* prepare monorepo and move client to its package

* create nx workspace

* workspace cleanup and updates

* upgrade nx workspace and fix client package

* add basic codegen logic

* first working build script

* update nextjs app

* update generated code

* add koldstart core and client foundation

* add basic fetch implementation to client

* add stable diffusion example

* remove local output image

* remove keys

* remove more keys

* update client usage and samples

* remove grpc client code and dependencies

* rename base package

* remove core package

* continue package refactor

* rename koldstart apis

* refactor main function run api

* add listen function stub

* removed more koldstart references

* build workflow added

* minor doc updates - trigger workflow

* nx workflow action
This commit is contained in:
Daniel Rochetti 2023-03-29 08:49:55 -07:00 committed by GitHub
parent 506629b894
commit 6553779987
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
94 changed files with 40198 additions and 7955 deletions

13
.editorconfig Normal file
View File

@ -0,0 +1,13 @@
# Editor configuration, see http://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
max_line_length = off
trim_trailing_whitespace = false

35
.eslintrc.json Normal file
View File

@ -0,0 +1,35 @@
{
"root": true,
"ignorePatterns": ["**/*"],
"plugins": ["@nrwl/nx"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
"@nrwl/nx/enforce-module-boundaries": [
"error",
{
"enforceBuildableLibDependency": true,
"allow": [],
"depConstraints": [
{
"sourceTag": "*",
"onlyDependOnLibsWithTags": ["*"]
}
]
}
]
}
},
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nrwl/nx/typescript"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@nrwl/nx/javascript"],
"rules": {}
}
]
}

1
.gitattributes vendored Normal file
View File

@ -0,0 +1 @@
package-lock.json linguist-generated

32
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,32 @@
name: Build
on:
pull_request:
branches:
- main
- develop
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x, 18.x]
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build
uses: mansagroup/nrwl-nx-action@v3
with:
affected: 'true'
parallel: 1
targets: format,lint,build

41
.gitignore vendored
View File

@ -1 +1,42 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.
# compiled output
dist
tmp
/out-tsc
# dependencies
node_modules
# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
/typings
# System Files
.DS_Store
Thumbs.db
# Next.js
.next

4
.prettierignore Normal file
View File

@ -0,0 +1,4 @@
# Add files here to ignore them from prettier formatting
/dist
/coverage

3
.prettierrc Normal file
View File

@ -0,0 +1,3 @@
{
"singleQuote": true
}

0
apps/.gitkeep Normal file
View File

View File

@ -0,0 +1,17 @@
{
"extends": ["plugin:cypress/recommended", "../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["src/plugins/index.js"],
"rules": {
"@typescript-eslint/no-var-requires": "off",
"no-undef": "off"
}
}
]
}

View File

@ -0,0 +1,6 @@
import { defineConfig } from 'cypress';
import { nxE2EPreset } from '@nrwl/cypress/plugins/cypress-preset';
export default defineConfig({
e2e: nxE2EPreset(__dirname),
});

View File

@ -0,0 +1,30 @@
{
"name": "demo-app-e2e",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/demo-app-e2e/src",
"projectType": "application",
"targets": {
"e2e": {
"executor": "@nrwl/cypress:cypress",
"options": {
"cypressConfig": "apps/demo-app-e2e/cypress.config.ts",
"devServerTarget": "demo-app:serve:development",
"testingType": "e2e"
},
"configurations": {
"production": {
"devServerTarget": "demo-app:serve:production"
}
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["apps/demo-app-e2e/**/*.{js,ts}"]
}
}
},
"tags": [],
"implicitDependencies": ["demo-app"]
}

View File

@ -0,0 +1,13 @@
import { getGreeting } from '../support/app.po';
describe('demo-app', () => {
beforeEach(() => cy.visit('/'));
it('should display welcome message', () => {
// Custom command example, see `../support/commands.ts` file
cy.login('my-email@something.com', 'myPassword');
// Function helper example, see `../support/app.po.ts` file
getGreeting().contains('Welcome demo-app');
});
});

View File

@ -0,0 +1,4 @@
{
"name": "Using fixtures to represent data",
"email": "hello@cypress.io"
}

View File

@ -0,0 +1 @@
export const getGreeting = () => cy.get('h1');

View File

@ -0,0 +1,33 @@
// ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
// eslint-disable-next-line @typescript-eslint/no-namespace
declare namespace Cypress {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
interface Chainable<Subject> {
login(email: string, password: string): void;
}
}
//
// -- This is a parent command --
Cypress.Commands.add('login', (email, password) => {
console.log('Custom command example: Login', email, password);
});
//
// -- This is a child command --
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })

View File

@ -0,0 +1,17 @@
// ***********************************************************
// This example support/index.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************
// Import commands.js using ES2015 syntax:
import './commands';

View File

@ -0,0 +1,10 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"sourceMap": false,
"outDir": "../../dist/out-tsc",
"allowJs": true,
"types": ["cypress", "node"]
},
"include": ["src/**/*.ts", "src/**/*.js", "cypress.config.ts"]
}

View File

@ -0,0 +1,31 @@
{
"extends": [
"plugin:@nrwl/nx/react-typescript",
"next",
"next/core-web-vitals",
"../../.eslintrc.json"
],
"ignorePatterns": ["!**/*", ".next/**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
"@next/next/no-html-link-for-pages": ["error", "apps/demo-app/pages"]
}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
],
"rules": {
"@next/next/no-html-link-for-pages": "off"
},
"env": {
"jest": true
}
}

6
apps/demo-app/index.d.ts vendored Normal file
View File

@ -0,0 +1,6 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
declare module '*.svg' {
const content: any;
export const ReactComponent: any;
export default content;
}

View File

@ -0,0 +1,11 @@
/* eslint-disable */
export default {
displayName: 'demo-app',
preset: '../../jest.preset.js',
transform: {
'^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nrwl/react/plugins/jest',
'^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nrwl/next/babel'] }],
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
coverageDirectory: '../../coverage/apps/demo-app',
};

5
apps/demo-app/next-env.d.ts vendored Normal file
View File

@ -0,0 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.

View File

@ -0,0 +1,17 @@
//@ts-check
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { withNx } = require('@nrwl/next/plugins/with-nx');
/**
* @type {import('@nrwl/next/plugins/with-nx').WithNxOptions}
**/
const nextConfig = {
nx: {
// Set this to true if you would like to to use SVGR
// See: https://github.com/gregberge/svgr
svgr: false,
},
};
module.exports = withNx(nextConfig);

View File

@ -0,0 +1,18 @@
import { AppProps } from 'next/app';
import Head from 'next/head';
import './styles.css';
function CustomApp({ Component, pageProps }: AppProps) {
return (
<>
<Head>
<title>Welcome to demo-app!</title>
</Head>
<main className="app dark">
<Component {...pageProps} />
</main>
</>
);
}
export default CustomApp;

View File

@ -0,0 +1,21 @@
import {
generateImage,
GenerateImageInput,
} from '../../services/generateImage';
export default async function handler(req, res) {
if (req.method === 'POST') {
// not really type-safe, force cast because I can =P
const prompt = req.body as GenerateImageInput;
try {
const imageUrl = await generateImage(prompt);
res.status(200).json({ imageUrl });
} catch (error) {
res
.status(500)
.json({ error: 'Failed to update image', causedBy: error });
}
} else {
res.status(405).json({ error: 'Method not allowed' });
}
}

View File

@ -0,0 +1,72 @@
import { useState } from 'react';
import Image from 'next/image';
import Head from 'next/head';
import { generateImage } from '../services/generateImage';
const IMG_PLACEHOLDER = '/placeholder@2x.jpg';
export default function Diffusion() {
const [prompt, setPrompt] = useState('');
const [imageUrl, setImageUrl] = useState(IMG_PLACEHOLDER);
const handleChange = (e) => {
setPrompt(e.target.value);
};
const handleSubmit = async (e) => {
e.preventDefault();
// TODO replace this with direct serverless call once cors is solved
// const response = await fetch('/api/generateImage', {
// method: 'POST',
// headers: {
// 'Content-Type': 'application/json',
// },
// body: JSON.stringify({ prompt }),
// });
// const data = await response.json();
// setImageUrl(data.imageUrl);
const result = await generateImage({ prompt });
setImageUrl(result);
};
return (
<div className="min-h-screen dark:bg-gray-900 dark:text-white bg-white text-black">
<Head>
<title>fal-serverless diffusion</title>
</Head>
<main className="flex flex-col items-center justify-center w-full flex-1 px-20 py-10">
<h1 className="text-4xl font-semibold mb-10">
fal-serverless diffusion
</h1>
<h3 className="text-2xl">Enter a prompt to generate the image</h3>
<form onSubmit={handleSubmit} className="flex flex-col mt-8 w-full">
<input
type="text"
className="w-full bg-gray-50 border border-gray-300 text-gray-900 text-lg rounded focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
placeholder="e.g. cute panda in the style of ghibli studio"
value={prompt}
onChange={handleChange}
/>
<button
type="submit"
className="mt-4 bg-blue-500 hover:bg-blue-700 text-white font-bold text-xl py-4 px-8 mx-auto rounded focus:outline-none focus:shadow-outline"
>
Generate Image
</button>
</form>
<div className="mt-10">
<Image
src={imageUrl}
alt="Generated Image"
width={1024}
height={1024}
/>
</div>
</main>
</div>
);
}

View File

@ -0,0 +1,2 @@
.page {
}

View File

@ -0,0 +1,59 @@
import styles from './index.module.css';
import * as fal from '@fal/serverless-client';
fal.config({
credentials: {
userId: '',
keyId: '',
keySecret: '',
},
});
export async function getServerSideProps(context) {
console.log('About to call a fal serverless function from NodeJS');
const result = await fal.run(
'e300f60b-4a7c-44cd-871d-bea588ef43d6/jokes/add',
{
input: {
joke: 'fal serverless is cool, so the joke is on you!',
},
}
);
console.log(result);
const random = await fal.run(
'e300f60b-4a7c-44cd-871d-bea588ef43d6/jokes/get',
{
method: 'get',
}
);
console.log(random);
return {
props: {
random,
result,
},
};
}
export function Index(props) {
return (
<div className="container mx-auto p-4">
<h1 className="text-4xl font-bold mb-8">
Hello <code>fal serverless</code>
</h1>
<p className="text-lg">
This page can access <strong>fal serverless</strong> functions when
it&apos;s rendering.
</p>
<p>
Added joke with success?{' '}
<strong>{props.result.success.toString()}</strong>
</p>
<p>
Joke <strong>{props.random.joke}</strong>
</p>
</div>
);
}
export default Index;

View File

@ -0,0 +1,400 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
html {
-webkit-text-size-adjust: 100%;
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif,
Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;
line-height: 1.5;
tab-size: 4;
scroll-behavior: smooth;
}
body {
font-family: inherit;
line-height: inherit;
margin: 0;
}
h1,
h2,
p,
pre {
margin: 0;
}
*,
::before,
::after {
box-sizing: border-box;
border-width: 0;
border-style: solid;
border-color: currentColor;
}
h1,
h2 {
font-size: inherit;
font-weight: inherit;
}
a {
color: inherit;
text-decoration: inherit;
}
pre {
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
Liberation Mono, Courier New, monospace;
}
svg {
display: block;
vertical-align: middle;
shape-rendering: auto;
text-rendering: optimizeLegibility;
}
pre {
background-color: rgba(55, 65, 81, 1);
border-radius: 0.25rem;
color: rgba(229, 231, 235, 1);
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
Liberation Mono, Courier New, monospace;
overflow: scroll;
padding: 0.5rem 0.75rem;
}
.shadow {
box-shadow: 0 0 #0000, 0 0 #0000, 0 10px 15px -3px rgba(0, 0, 0, 0.1),
0 4px 6px -2px rgba(0, 0, 0, 0.05);
}
.wrapper {
width: 100%;
}
.container {
margin-left: auto;
margin-right: auto;
max-width: 768px;
padding-bottom: 3rem;
padding-left: 1rem;
padding-right: 1rem;
color: rgba(55, 65, 81, 1);
width: 100%;
}
#welcome {
margin-top: 2.5rem;
}
#welcome h1 {
font-size: 3rem;
font-weight: 500;
letter-spacing: -0.025em;
line-height: 1;
}
#welcome span {
display: block;
font-size: 1.875rem;
font-weight: 300;
line-height: 2.25rem;
margin-bottom: 0.5rem;
}
#hero {
align-items: center;
background-color: hsla(214, 62%, 21%, 1);
border: none;
box-sizing: border-box;
color: rgba(55, 65, 81, 1);
display: grid;
grid-template-columns: 1fr;
margin-top: 3.5rem;
}
#hero .text-container {
color: rgba(255, 255, 255, 1);
padding: 3rem 2rem;
}
#hero .text-container h2 {
font-size: 1.5rem;
line-height: 2rem;
position: relative;
}
#hero .text-container h2 svg {
color: hsla(162, 47%, 50%, 1);
height: 2rem;
left: -0.25rem;
position: absolute;
top: 0;
width: 2rem;
}
#hero .text-container h2 span {
margin-left: 2.5rem;
}
#hero .text-container a {
background-color: rgba(255, 255, 255, 1);
border-radius: 0.75rem;
color: rgba(55, 65, 81, 1);
display: inline-block;
margin-top: 1.5rem;
padding: 1rem 2rem;
text-decoration: inherit;
}
#hero .logo-container {
display: none;
justify-content: center;
padding-left: 2rem;
padding-right: 2rem;
}
#hero .logo-container svg {
color: rgba(255, 255, 255, 1);
width: 66.666667%;
}
#middle-content {
align-items: flex-start;
display: grid;
gap: 4rem;
grid-template-columns: 1fr;
margin-top: 3.5rem;
}
#learning-materials {
padding: 2.5rem 2rem;
}
#learning-materials h2 {
font-weight: 500;
font-size: 1.25rem;
letter-spacing: -0.025em;
line-height: 1.75rem;
padding-left: 1rem;
padding-right: 1rem;
}
.list-item-link {
align-items: center;
border-radius: 0.75rem;
display: flex;
margin-top: 1rem;
padding: 1rem;
transition-property: background-color, border-color, color, fill, stroke,
opacity, box-shadow, transform, filter, backdrop-filter,
-webkit-backdrop-filter;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
transition-duration: 150ms;
width: 100%;
}
.list-item-link svg:first-child {
margin-right: 1rem;
height: 1.5rem;
transition-property: background-color, border-color, color, fill, stroke,
opacity, box-shadow, transform, filter, backdrop-filter,
-webkit-backdrop-filter;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
transition-duration: 150ms;
width: 1.5rem;
}
.list-item-link > span {
flex-grow: 1;
font-weight: 400;
transition-property: background-color, border-color, color, fill, stroke,
opacity, box-shadow, transform, filter, backdrop-filter,
-webkit-backdrop-filter;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
transition-duration: 150ms;
}
.list-item-link > span > span {
color: rgba(107, 114, 128, 1);
display: block;
flex-grow: 1;
font-size: 0.75rem;
font-weight: 300;
line-height: 1rem;
transition-property: background-color, border-color, color, fill, stroke,
opacity, box-shadow, transform, filter, backdrop-filter,
-webkit-backdrop-filter;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
transition-duration: 150ms;
}
.list-item-link svg:last-child {
height: 1rem;
transition-property: all;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
transition-duration: 150ms;
width: 1rem;
}
.list-item-link:hover {
color: rgba(255, 255, 255, 1);
background-color: hsla(162, 47%, 50%, 1);
}
.list-item-link:hover > span {
}
.list-item-link:hover > span > span {
color: rgba(243, 244, 246, 1);
}
.list-item-link:hover svg:last-child {
transform: translateX(0.25rem);
}
#other-links {
}
.button-pill {
padding: 1.5rem 2rem;
transition-duration: 300ms;
transition-property: background-color, border-color, color, fill, stroke,
opacity, box-shadow, transform, filter, backdrop-filter,
-webkit-backdrop-filter;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
align-items: center;
display: flex;
}
.button-pill svg {
transition-property: background-color, border-color, color, fill, stroke,
opacity, box-shadow, transform, filter, backdrop-filter,
-webkit-backdrop-filter;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
transition-duration: 150ms;
flex-shrink: 0;
width: 3rem;
}
.button-pill > span {
letter-spacing: -0.025em;
font-weight: 400;
font-size: 1.125rem;
line-height: 1.75rem;
padding-left: 1rem;
padding-right: 1rem;
}
.button-pill span span {
display: block;
font-size: 0.875rem;
font-weight: 300;
line-height: 1.25rem;
}
.button-pill:hover svg,
.button-pill:hover {
color: rgba(255, 255, 255, 1) !important;
}
#nx-console:hover {
background-color: rgba(0, 122, 204, 1);
}
#nx-console svg {
color: rgba(0, 122, 204, 1);
}
#nx-repo:hover {
background-color: rgba(24, 23, 23, 1);
}
#nx-repo svg {
color: rgba(24, 23, 23, 1);
}
#nx-cloud {
margin-bottom: 2rem;
margin-top: 2rem;
padding: 2.5rem 2rem;
}
#nx-cloud > div {
align-items: center;
display: flex;
}
#nx-cloud > div svg {
border-radius: 0.375rem;
flex-shrink: 0;
width: 3rem;
}
#nx-cloud > div h2 {
font-size: 1.125rem;
font-weight: 400;
letter-spacing: -0.025em;
line-height: 1.75rem;
padding-left: 1rem;
padding-right: 1rem;
}
#nx-cloud > div h2 span {
display: block;
font-size: 0.875rem;
font-weight: 300;
line-height: 1.25rem;
}
#nx-cloud p {
font-size: 1rem;
line-height: 1.5rem;
margin-top: 1rem;
}
#nx-cloud pre {
margin-top: 1rem;
}
#nx-cloud a {
color: rgba(107, 114, 128, 1);
display: block;
font-size: 0.875rem;
line-height: 1.25rem;
margin-top: 1.5rem;
text-align: right;
}
#nx-cloud a:hover {
text-decoration: underline;
}
#commands {
padding: 2.5rem 2rem;
margin-top: 3.5rem;
}
#commands h2 {
font-size: 1.25rem;
font-weight: 400;
letter-spacing: -0.025em;
line-height: 1.75rem;
padding-left: 1rem;
padding-right: 1rem;
}
#commands p {
font-size: 1rem;
font-weight: 300;
line-height: 1.5rem;
margin-top: 1rem;
padding-left: 1rem;
padding-right: 1rem;
}
details {
align-items: center;
display: flex;
margin-top: 1rem;
padding-left: 1rem;
padding-right: 1rem;
width: 100%;
}
details pre > span {
color: rgba(181, 181, 181, 1);
display: block;
}
summary {
border-radius: 0.5rem;
display: flex;
font-weight: 400;
padding: 0.5rem;
cursor: pointer;
transition-property: background-color, border-color, color, fill, stroke,
opacity, box-shadow, transform, filter, backdrop-filter,
-webkit-backdrop-filter;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
transition-duration: 150ms;
}
summary:hover {
background-color: rgba(243, 244, 246, 1);
}
summary svg {
height: 1.5rem;
margin-right: 1rem;
width: 1.5rem;
}
#love {
color: rgba(107, 114, 128, 1);
font-size: 0.875rem;
line-height: 1.25rem;
margin-top: 3.5rem;
opacity: 0.6;
text-align: center;
}
#love svg {
color: rgba(252, 165, 165, 1);
width: 1.25rem;
height: 1.25rem;
display: inline;
margin-top: -0.25rem;
}
@media screen and (min-width: 768px) {
#hero {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
#hero .logo-container {
display: flex;
}
#middle-content {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
}

View File

@ -0,0 +1,15 @@
const { join } = require('path');
// Note: If you use library-specific PostCSS/Tailwind configuration then you should remove the `postcssConfig` build
// option from your application's configuration (i.e. project.json).
//
// See: https://nx.dev/guides/using-tailwind-css-in-react#step-4:-applying-configuration-to-libraries
module.exports = {
plugins: {
tailwindcss: {
config: join(__dirname, 'tailwind.config.js'),
},
autoprefixer: {},
},
};

View File

@ -0,0 +1,63 @@
{
"name": "demo-app",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/demo-app",
"projectType": "application",
"targets": {
"build": {
"executor": "@nrwl/next:build",
"outputs": ["{options.outputPath}"],
"defaultConfiguration": "production",
"options": {
"root": "apps/demo-app",
"outputPath": "dist/apps/demo-app"
},
"configurations": {
"development": {
"outputPath": "apps/demo-app"
},
"production": {}
}
},
"serve": {
"executor": "@nrwl/next:server",
"defaultConfiguration": "development",
"options": {
"buildTarget": "demo-app:build",
"dev": true
},
"configurations": {
"development": {
"buildTarget": "demo-app:build:development",
"dev": true
},
"production": {
"buildTarget": "demo-app:build:production",
"dev": false
}
}
},
"export": {
"executor": "@nrwl/next:export",
"options": {
"buildTarget": "demo-app:build:production"
}
},
"test": {
"executor": "@nrwl/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "apps/demo-app/jest.config.ts",
"passWithNoTests": true
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["apps/demo-app/**/*.{ts,tsx,js,jsx}"]
}
}
},
"tags": []
}

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

View File

@ -0,0 +1,29 @@
import * as fal from '@fal/serverless-client';
export type GenerateImageInput = {
prompt: string;
};
type ImageType = 'gif' | 'png' | 'jpg' | 'jpeg';
type ImageDataUri = `data:image/${ImageType};base64,${string}`;
fal.config({
credentials: {
userId: '',
keyId: '',
keySecret: '',
},
});
export async function generateImage(
input: GenerateImageInput
): Promise<ImageDataUri> {
const result = await fal.run(
'a51c0ca0-9011-4ff0-8dc1-2ac0b42a9fd0/generate',
{
input,
}
);
const data = result['raw_data'];
return `data:image/jpg;base64,${data}`;
}

View File

@ -0,0 +1,11 @@
import React from 'react';
import { render } from '@testing-library/react';
import Index from '../pages/index';
describe('Index', () => {
it('should render successfully', () => {
const { baseElement } = render(<Index />);
expect(baseElement).toBeTruthy();
});
});

View File

@ -0,0 +1,18 @@
const { createGlobPatternsForDependencies } = require('@nrwl/react/tailwind');
const { join } = require('path');
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
join(
__dirname,
'{src,pages,components}/**/*!(*.stories|*.spec).{ts,tsx,html}'
),
...createGlobPatternsForDependencies(__dirname),
],
darkMode: 'class',
theme: {
extend: {},
},
plugins: [],
};

View File

@ -0,0 +1,18 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"jsx": "preserve",
"allowJs": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": false,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"resolveJsonModule": true,
"isolatedModules": true,
"incremental": true,
"types": ["jest", "node"]
},
"include": ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx", "next-env.d.ts"],
"exclude": ["node_modules", "jest.config.ts"]
}

View File

@ -0,0 +1,21 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"types": ["jest", "node"],
"jsx": "react"
},
"include": [
"jest.config.ts",
"**/*.test.ts",
"**/*.spec.ts",
"**/*.test.tsx",
"**/*.spec.tsx",
"**/*.test.js",
"**/*.spec.js",
"**/*.test.jsx",
"**/*.spec.jsx",
"**/*.d.ts"
]
}

3
babel.config.json Normal file
View File

@ -0,0 +1,3 @@
{
"babelrcRoots": ["*"]
}

View File

@ -1,29 +0,0 @@
"use strict";
exports.__esModule = true;
var common_pb_1 = require("./proto/generated/common_pb");
var controller_pb_1 = require("./proto/generated/controller_pb");
var server_pb_1 = require("./proto/generated/server_pb");
var fs = require("fs");
var controller_grpc_pb_1 = require("./proto/generated/controller_grpc_pb");
var grpc = require("@grpc/grpc-js");
var credentials = grpc.credentials.combineChannelCredentials(grpc.credentials.createSsl(), grpc.credentials.createFromMetadataGenerator(function (_, callback) {
var md = new grpc.Metadata();
md.add("auth-key", "f2588f17f0bfc75c323dc5f9b5da83e0");
md.add("auth-key-id", "648b02a4-e2cd-430c-8bac-4ca2712dad18");
callback(null, md);
}));
var client = new controller_grpc_pb_1.IsolateControllerClient("api.shark.fal.ai", credentials);
var req = new controller_pb_1.HostedRun();
var serObj = new common_pb_1.SerializedObject();
var definition = fs.readFileSync('/Users/gorkemyurtseven/dev/koldstart-playground/koldstart-javascript/python.dump');
serObj.setMethod("dill");
serObj.setDefinition(definition);
serObj.setWasItRaised(false);
serObj.setStringizedTraceback("");
var environment = new server_pb_1.EnvironmentDefinition();
environment.setKind("virtualenv");
req.setFunction(serObj);
req.setEnvironmentsList([environment]);
client.run(req).on("data", function (data) {
console.log(data.toObject());
});

View File

@ -1,40 +0,0 @@
import { SerializedObject } from "./proto/generated/common_pb";
import { HostedRun } from "./proto/generated/controller_pb";
import { EnvironmentDefinition } from "./proto/generated/server_pb";
import * as fs from 'fs';
import { IsolateControllerClient } from "./proto/generated/controller_grpc_pb";
import * as grpc from "@grpc/grpc-js";
const credentials: grpc.ChannelCredentials = grpc.credentials.combineChannelCredentials(
grpc.credentials.createSsl(),
grpc.credentials.createFromMetadataGenerator((_, callback) => {
const md = new grpc.Metadata();
md.add("auth-key", "f2588f17f0bfc75c323dc5f9b5da83e0")
md.add("auth-key-id", "648b02a4-e2cd-430c-8bac-4ca2712dad18")
callback(null, md);
})
)
const client = new IsolateControllerClient("api.shark.fal.ai", credentials);
const req = new HostedRun();
const serObj = new SerializedObject();
let definition = fs.readFileSync('/Users/gorkemyurtseven/dev/koldstart-playground/koldstart-javascript/python.dump')
serObj.setMethod("dill");
serObj.setDefinition(definition)
serObj.setWasItRaised(false);
serObj.setStringizedTraceback("");
const environment = new EnvironmentDefinition();
environment.setKind("virtualenv");
req.setFunction(serObj);
req.setEnvironmentsList([environment]);
client.run(req).on("data", (data) => {
console.log(data.toObject());
});
koldstart("gorkemyurt/stable-diffusion").run("create me a turtle")

5
jest.config.ts Normal file
View File

@ -0,0 +1,5 @@
import { getJestProjects } from '@nrwl/jest';
export default {
projects: getJestProjects(),
};

3
jest.preset.js Normal file
View File

@ -0,0 +1,3 @@
const nxPreset = require('@nrwl/jest/preset').default;
module.exports = { ...nxPreset };

0
libs/.gitkeep Normal file
View File

3
libs/client/.babelrc Normal file
View File

@ -0,0 +1,3 @@
{
"presets": [["@nrwl/js/babel", { "useBuiltIns": "usage" }]]
}

View File

@ -0,0 +1,18 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}

11
libs/client/README.md Normal file
View File

@ -0,0 +1,11 @@
# client
This library was generated with [Nx](https://nx.dev).
## Running unit tests
Run `nx test client` to execute the unit tests via [Jest](https://jestjs.io).
## Running lint
Run `nx lint client` to execute the lint via [ESLint](https://eslint.org/).

View File

@ -0,0 +1,16 @@
/* eslint-disable */
export default {
displayName: 'client',
preset: '../../jest.preset.js',
globals: {
'ts-jest': {
tsconfig: '<rootDir>/tsconfig.spec.json',
},
},
testEnvironment: 'node',
transform: {
'^.+\\.[tj]sx?$': 'ts-jest',
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
coverageDirectory: '../../coverage/libs/client',
};

9
libs/client/package.json Normal file
View File

@ -0,0 +1,9 @@
{
"name": "@fal/serverless-client",
"version": "0.0.1",
"repository": {
"type": "git",
"url": "https://github.com/fal-ai/serverless-js",
"directory": "libs/client"
}
}

41
libs/client/project.json Normal file
View File

@ -0,0 +1,41 @@
{
"name": "client",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "libs/client/src",
"projectType": "library",
"targets": {
"build": {
"executor": "@nrwl/js:tsc",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/libs/client",
"tsConfig": "libs/client/tsconfig.lib.json",
"packageJson": "libs/client/package.json",
"main": "libs/client/src/index.ts",
"assets": ["libs/client/*.md"]
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["libs/client/**/*.ts"]
}
},
"test": {
"executor": "@nrwl/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "libs/client/jest.config.ts",
"passWithNoTests": true
},
"configurations": {
"ci": {
"ci": true,
"codeCoverage": true
}
}
}
},
"tags": []
}

29
libs/client/src/config.ts Normal file
View File

@ -0,0 +1,29 @@
export type Credentials = {
keyId: string;
keySecret: string;
userId: string;
};
export type Config = {
credentials: Credentials;
host?: string;
};
type RequiredConfig = Required<Config>;
const DEFAULT_CONFIG: Partial<Config> = {
host: 'https://gateway.shark.fal.ai',
};
let configuration: RequiredConfig | undefined = undefined;
export function config(config: Config) {
configuration = { ...config, ...DEFAULT_CONFIG } as RequiredConfig;
}
export function getConfig(): RequiredConfig {
if (typeof configuration === 'undefined') {
throw new Error('You must configure fal serverless first.');
}
return configuration;
}

139
libs/client/src/function.ts Normal file
View File

@ -0,0 +1,139 @@
import fetch from 'cross-fetch';
import { getConfig } from './config';
import { getUserAgent, isBrowser } from './runtime';
/**
* An event contract for progress updates from the server function.
*/
export interface ProgressEvent<T> {
readonly progress: number;
readonly partialData: T | undefined;
}
type RunOptions<Input> = {
readonly input?: Input;
readonly method?: 'get' | 'post' | 'put' | 'delete';
};
/**
* Runs a fal serverless function identified by its `id`.
* TODO: expand documentation and provide examples
*
* @param id the registered function id
* @returns the remote function output
*/
export async function run<Input, Output>(
id: string,
options?: RunOptions<Input>
): Promise<Output> {
const { credentials, host } = getConfig();
const method = (options.method ?? 'post').toLowerCase();
const params =
method === 'get' ? new URLSearchParams(options.input ?? {}).toString() : '';
const userAgent = isBrowser ? {} : { 'User-Agent': getUserAgent() };
const response = await fetch(
`${host}/trigger/${credentials.userId}/${id}${params}`,
{
method,
headers: {
'X-Koldstart-Key-Id': credentials.keyId,
'X-Koldstart-Key-Secret': credentials.keySecret,
Accept: 'application/json',
'Content-Type': 'application/json',
...userAgent,
},
mode: 'cors',
body:
method !== 'get' && options.input
? JSON.stringify(options.input)
: null,
}
);
// TODO move this elsewhere so it can be reused by websocket impl too
const contentType = response.headers.get('Content-Type');
if (contentType?.includes('application/json')) {
return response.json();
}
if (contentType?.includes('text/html')) {
return response.text() as Promise<Output>;
}
if (contentType?.includes('application/octet-stream')) {
return response.arrayBuffer() as Promise<Output>;
}
// TODO convert to either number or bool automatically
return response.text() as Promise<Output>;
}
/**
* Represents a result of a remote fal serverless function call.
*
* The contract allows developers to not only get the function
* result, but also track its progress and logs through event
* listeners.
*
* This flexibility enables developers to define complex / long-running functions
* but also simple ones with an unified developer experience.
*/
export interface FunctionExecution<T> {
/**
* Listens to `progress` events.
*
* @param event of type `progress`
* @param handler the callback to handle in-progress data.
*/
on(event: 'progress', handler: (info: ProgressEvent<T>) => void): void;
/**
* Listens to `cancel` events.
*
* @param event of type `cancel`.
* @param handler the callback to handle the cancellation signal.
*/
on(event: 'cancel', handler: () => void): void;
/**
* Listens to logging events.
*
* @param event of type `log`
* @param handler the callback to handle the forwarded `log`
*/
on(event: 'log', handler: (log: string) => void): void;
/**
* Signals to the server that the execution should be cancelled.
* Once the server cancels the execution sucessfully, the `cancel`
* event will be fired.
*
* @see #on(event:)
*/
cancel(): Promise<void>;
/**
* Async function that represents the final result of the function call.
*
* ```ts
* const image = await execution.result();
* ```
*
* @returns Promise<T> the final result.
* @throws in case the backing remote function raises an error.
*/
result(): Promise<T>;
}
type ListenOptions<Input> = {
readonly input?: Input;
};
/**
* TODO: document me
*
* @param id
* @param options
*/
export function listen<Input, Output>(
id: string,
options: ListenOptions<Input>
): FunctionExecution<Output> {
throw 'TODO: implement me!';
}

2
libs/client/src/index.ts Normal file
View File

@ -0,0 +1,2 @@
export { config, Credentials } from './config';
export { FunctionExecution, ProgressEvent, run } from './function';

View File

@ -0,0 +1,21 @@
/* eslint-disable @typescript-eslint/no-var-requires */
export function isBrowser(): boolean {
return (
typeof window !== 'undefined' && typeof window.document !== 'undefined'
);
}
let memoizedUserAgent: string | null = null;
export function getUserAgent(): string {
if (memoizedUserAgent !== null) {
return memoizedUserAgent;
}
const packageInfo = require('../package.json');
const os = require('os');
memoizedUserAgent = `${packageInfo.name}/${
packageInfo.version
} ${os.platform()}-${os.arch()} ${process.release.name}-${process.version}`;
return memoizedUserAgent;
}

13
libs/client/tsconfig.json Normal file
View File

@ -0,0 +1,13 @@
{
"extends": "../../tsconfig.base.json",
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
},
{
"path": "./tsconfig.spec.json"
}
]
}

View File

@ -0,0 +1,13 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "commonjs",
"outDir": "../../dist/out-tsc",
"declaration": true,
"allowJs": true,
"checkJs": false,
"types": ["node"]
},
"exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"],
"include": ["src/**/*.ts"]
}

View File

@ -0,0 +1,20 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"types": ["jest", "node"]
},
"include": [
"jest.config.ts",
"src/**/*.test.ts",
"src/**/*.spec.ts",
"src/**/*.test.tsx",
"src/**/*.spec.tsx",
"src/**/*.test.js",
"src/**/*.spec.js",
"src/**/*.test.jsx",
"src/**/*.spec.jsx",
"src/**/*.d.ts"
]
}

3
libs/codegen/.babelrc Normal file
View File

@ -0,0 +1,3 @@
{
"presets": [["@nrwl/js/babel", { "useBuiltIns": "usage" }]]
}

View File

@ -0,0 +1,18 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}

11
libs/codegen/README.md Normal file
View File

@ -0,0 +1,11 @@
# codegen
This library was generated with [Nx](https://nx.dev).
## Running unit tests
Run `nx test codegen` to execute the unit tests via [Jest](https://jestjs.io).
## Running lint
Run `nx lint codegen` to execute the lint via [ESLint](https://eslint.org/).

23
libs/codegen/bin/dev Executable file
View File

@ -0,0 +1,23 @@
#!/usr/bin/env node
const oclif = require("@oclif/core");
const path = require("path");
// Get project config
const project = path.join(__dirname, "..", "tsconfig.lib.json");
process.env.TS_NODE_PROJECT = project;
// In dev mode -> use ts-node and dev plugins
process.env.NODE_ENV = "development";
// Register ts-node and path mapping
require("ts-node").register({ project, esm: true });
require("tsconfig-paths").register();
// In dev mode, always show stack traces
oclif.settings.debug = true;
// Start the CLI
oclif.run()
.then(oclif.flush)
.catch(oclif.Errors.handle);

8
libs/codegen/bin/run Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/env node
const oclif = require("@oclif/core");
oclif
.run()
.then(require("@oclif/core/flush"))
.catch(require("@oclif/core/handle"));

View File

@ -0,0 +1,16 @@
/* eslint-disable */
export default {
displayName: 'codegen',
preset: '../../jest.preset.js',
globals: {
'ts-jest': {
tsconfig: '<rootDir>/tsconfig.spec.json',
},
},
testEnvironment: 'node',
transform: {
'^.+\\.[tj]sx?$': 'ts-jest',
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
coverageDirectory: '../../coverage/libs/codegen',
};

27
libs/codegen/package.json Normal file
View File

@ -0,0 +1,27 @@
{
"name": "@fal/serverless-codegen",
"version": "0.0.1",
"bin": {
"ksjs": "./bin/run"
},
"files": [
"/bin",
"/dist",
"/npm-shrinkwrap.json",
"/oclif.manifest.json"
],
"oclif": {
"bin": "ksjs",
"dirname": "ksjs",
"commands": "./src/commands",
"plugins": [
"@oclif/plugin-help"
],
"topicSeparator": ":",
"topics": {
"generate": {
"description": "Command used to generate source files based on fal serverless metadata."
}
}
}
}

41
libs/codegen/project.json Normal file
View File

@ -0,0 +1,41 @@
{
"name": "codegen",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "libs/codegen/src",
"projectType": "library",
"targets": {
"build": {
"executor": "@nrwl/js:tsc",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/libs/codegen",
"tsConfig": "libs/codegen/tsconfig.lib.json",
"packageJson": "libs/codegen/package.json",
"main": "libs/codegen/src/index.ts",
"assets": ["libs/codegen/*.md"]
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["libs/codegen/**/*.ts"]
}
},
"test": {
"executor": "@nrwl/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "libs/codegen/jest.config.ts",
"passWithNoTests": true
},
"configurations": {
"ci": {
"ci": true,
"codeCoverage": true
}
}
}
},
"tags": []
}

View File

@ -0,0 +1,95 @@
import { Command, Flags } from '@oclif/core';
import { camelCase, paramCase } from 'change-case';
import { execSync } from 'child_process';
import { watch as watchFiles } from 'chokidar';
import * as glob from 'fast-glob';
import { ensureDir, readJSONSync, writeFileSync } from 'fs-extra';
import * as path from 'path';
import { generateFunction } from '../../generators/generateFunction';
import { IsolateFunctionMetadata } from '../../types';
export default class GenerateFunctionCommand extends Command {
static description =
'Generate fal serverless functions from a path containing Python files';
// static examples = ['$ ksjs generate:functions'];
static flags = {
include: Flags.string({
char: 'i',
description: 'A path pattern (accepts pattern matching/glob)',
required: true,
}),
out: Flags.string({
char: 'o',
description: 'The output directory',
required: true,
}),
python: Flags.string({
char: 'p',
description: 'Path to a python environment',
required: false,
default: null,
}),
watch: Flags.boolean({
char: 'w',
description: 'Watch for changes and regenerate code',
required: false,
default: false,
}),
};
async run(): Promise<void> {
const { flags } = await this.parse(GenerateFunctionCommand);
const { include, out, python, watch } = flags;
const commands: string[] = [];
if (python !== null) {
commands.push('source ' + python + '/bin/activate');
}
const tmp = 'tmp/.fal/serverless/generated';
await ensureDir(tmp);
commands.push(
`koldstart generate metadata --include="${include}" --out="${tmp}"`
);
const executeCommand = () => {
execSync(commands.join(' && '), {
shell: 'bash',
});
};
const generateFiles = async () => {
// NOTE: this can be improved, a lot!
console.log('Generating files...');
const metadataFiles = await glob(`${tmp}/**/*.json`);
for (const metadataFile of metadataFiles) {
const metadata = readJSONSync(metadataFile) as IsolateFunctionMetadata;
const sourceCode = generateFunction(metadata);
const folder = paramCase(
path.parse(path.relative(tmp, metadataFile)).dir
);
const filename = `${camelCase(metadata.name)}.ts`;
const outputPath = path.join(out, folder);
await ensureDir(outputPath);
writeFileSync(path.join(outputPath, filename), sourceCode);
}
};
executeCommand();
if (watch) {
const watcher = watchFiles(include);
watcher.on('all', async () => {
// TODO update only changed files
executeCommand();
await generateFiles();
});
} else {
await generateFiles();
}
return;
}
}

View File

@ -0,0 +1,106 @@
import { camelCase, pascalCase } from 'change-case';
import * as prettier from 'prettier';
import {
FunctionDeclarationStructure,
ImportDeclarationStructure,
InterfaceDeclarationStructure,
ParameterDeclarationStructure,
Project,
PropertySignatureStructure,
SourceFileStructure,
StatementStructures,
StructureKind,
} from 'ts-morph';
import { IsolateFunctionMetadata, IsolateFunctionParameter } from '../types';
const CORE_TYPES = {
str: 'string',
} as const;
function generateProperty(
param: IsolateFunctionParameter
): PropertySignatureStructure {
return {
kind: StructureKind.PropertySignature,
name: param.name,
isReadonly: true,
type: CORE_TYPES[param.type],
hasQuestionToken: !param.is_required,
};
}
export function generateFunction(metadata: IsolateFunctionMetadata): string {
const identifier = camelCase(metadata.name);
const typename = pascalCase(metadata.name);
const members: StatementStructures[] = [];
members.push({
kind: StructureKind.ImportDeclaration,
namedImports: ['run'],
moduleSpecifier: '@fal/serverless-client',
} as ImportDeclarationStructure);
members.push({
kind: StructureKind.ImportDeclaration,
namedImports: ['credentials'],
moduleSpecifier: '../../credentials',
} as ImportDeclarationStructure);
const inputTypename = `${typename}Input`;
const parameters: ParameterDeclarationStructure[] = [];
if (metadata.parameters && metadata.parameters.length > 0) {
const inputType = {
kind: StructureKind.Interface,
name: inputTypename,
properties: metadata.parameters.map(generateProperty),
} as InterfaceDeclarationStructure;
members.push(inputType);
parameters.push({
kind: StructureKind.Parameter,
name: 'input',
type: inputTypename,
});
}
const onData: ParameterDeclarationStructure = {
kind: StructureKind.Parameter,
name: 'onData',
type: '(data: string) => void',
};
parameters.push(onData);
const isolatedFunction: FunctionDeclarationStructure = {
kind: StructureKind.Function,
isExported: true,
name: identifier,
parameters: parameters,
// returnType: metadata.return_type
// ? CORE_TYPES[metadata.return_type]
// : undefined,
statements: (writer) => {
writer.write('return run(').block(() => {
writer.writeLine(`host: '${metadata.config.host}'`);
writer.writeLine('credentials');
writer.writeLine(`environmentKind: '${metadata.config.env_kind}'`);
writer.writeLine(
`requirements: ${JSON.stringify(metadata.config.requirements)}`
);
writer.writeLine(`definition: '${metadata.definition}'`);
});
writer.writeLine(', onData);');
},
};
members.push(isolatedFunction);
const project = new Project();
const source: SourceFileStructure = {
kind: StructureKind.SourceFile,
statements: members,
};
const filepath = `src/${identifier}.ts`;
const file = project.createSourceFile(filepath, source);
return prettier.format(file.print(), {
filepath,
});
}

View File

@ -0,0 +1 @@
export { run } from '@oclif/core';

19
libs/codegen/src/types.ts Normal file
View File

@ -0,0 +1,19 @@
export type IsolateFunctionConfig = {
env_kind: string;
requirements: string[];
host: string;
};
export type IsolateFunctionParameter = {
name: string;
is_required: boolean;
type: string;
};
export type IsolateFunctionMetadata = {
name: string;
parameters: IsolateFunctionParameter[];
return_type: string;
definition: string;
config: IsolateFunctionConfig;
};

View File

@ -0,0 +1,13 @@
{
"extends": "../../tsconfig.base.json",
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
},
{
"path": "./tsconfig.spec.json"
}
]
}

View File

@ -0,0 +1,11 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "commonjs",
"outDir": "../../dist/out-tsc",
"declaration": true,
"types": ["node"]
},
"exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"],
"include": ["src/**/*.ts"]
}

View File

@ -0,0 +1,20 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"types": ["jest", "node"]
},
"include": [
"jest.config.ts",
"src/**/*.test.ts",
"src/**/*.spec.ts",
"src/**/*.test.tsx",
"src/**/*.spec.tsx",
"src/**/*.test.js",
"src/**/*.spec.js",
"src/**/*.test.jsx",
"src/**/*.spec.jsx",
"src/**/*.d.ts"
]
}

60
migrations.json Normal file
View File

@ -0,0 +1,60 @@
{
"migrations": [
{
"version": "15.7.0-beta.0",
"description": "Split global configuration files into individual project.json files. This migration has been added automatically to the beginning of your migration set to retroactively make them work with the new version of Nx.",
"cli": "nx",
"implementation": "./src/migrations/update-15-7-0/split-configuration-into-project-json-files",
"package": "@nrwl/workspace",
"name": "15-7-0-split-configuration-into-project-json-files"
},
{
"cli": "nx",
"version": "15.5.0-beta.0",
"description": "Update to Cypress v12. Cypress 12 contains a handful of breaking changes that might causes tests to start failing that nx cannot directly fix. Read more Cypress 12 changes: https://docs.cypress.io/guides/references/migration-guide#Migrating-to-Cypress-12-0.This migration will only run if you are already using Cypress v11.",
"factory": "./src/migrations/update-15-5-0/update-to-cypress-12",
"package": "@nrwl/cypress",
"name": "update-to-cypress-12"
},
{
"version": "15.7.0-beta.0",
"description": "Split global configuration files (e.g., workspace.json) into individual project.json files.",
"cli": "nx",
"implementation": "./src/migrations/update-15-7-0/split-configuration-into-project-json-files",
"package": "@nrwl/workspace",
"name": "15-7-0-split-configuration-into-project-json-files"
},
{
"cli": "nx",
"version": "15.3.0-beta.0",
"description": "Update projects using @nrwl/web:rollup to @nrwl/rollup:rollup for build.",
"factory": "./src/migrations/update-15-3-0/update-rollup-executor",
"package": "@nrwl/react",
"name": "update-rollup-executor"
},
{
"cli": "nx",
"version": "15.3.0-beta.0",
"description": "Install new dependencies for React projects using Webpack or Rollup.",
"factory": "./src/migrations/update-15-3-0/install-webpack-rollup-dependencies",
"package": "@nrwl/react",
"name": "install-webpack-rollup-dependencies"
},
{
"cli": "nx",
"version": "15.6.3-beta.0",
"description": "Creates or updates webpack.config.js file with the new options for webpack.",
"factory": "./src/migrations/update-15-6-3/webpack-config-setup",
"package": "@nrwl/react",
"name": "react-webpack-config-setup"
},
{
"cli": "nx",
"version": "15.5.4-beta.0",
"description": "Update `@nrwl/web/babel` preset to `@nrwl/js/babel` for projects that have a .babelrc file.",
"factory": "./src/migrations/update-15-5-4/update-babel-preset",
"package": "@nrwl/web",
"name": "update-babel-preset"
}
]
}

53
nx.json Normal file
View File

@ -0,0 +1,53 @@
{
"$schema": "./node_modules/nx/schemas/nx-schema.json",
"npmScope": "@fal/serverless",
"tasksRunnerOptions": {
"default": {
"runner": "@nrwl/nx-cloud",
"options": {
"cacheableOperations": ["build", "lint", "test", "e2e"],
"accessToken": "NmRkNDcxMzQtZWMxNi00OTk1LTkzOTItOGI0OGZkOTQyMDM0fHJlYWQtd3JpdGU="
}
}
},
"targetDefaults": {
"build": {
"dependsOn": ["^build"],
"inputs": ["production", "^production"]
},
"test": {
"inputs": ["default", "^production", "{workspaceRoot}/jest.preset.js"]
},
"e2e": {
"inputs": ["default", "^production"]
},
"lint": {
"inputs": ["default", "{workspaceRoot}/.eslintrc.json"]
}
},
"namedInputs": {
"default": ["{projectRoot}/**/*", "sharedGlobals"],
"production": [
"default",
"!{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)",
"!{projectRoot}/tsconfig.spec.json",
"!{projectRoot}/jest.config.[jt]s",
"!{projectRoot}/.eslintrc.json"
],
"sharedGlobals": ["{workspaceRoot}/babel.config.json"]
},
"generators": {
"@nrwl/react": {
"application": {
"babel": true
}
},
"@nrwl/next": {
"application": {
"style": "css",
"linter": "eslint"
}
}
},
"defaultProject": "demo-app"
}

38692
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,26 +1,75 @@
{
"name": "javascript",
"version": "1.0.0",
"description": "",
"main": "example.js",
"name": "@fal/serverless",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"start": "nx serve",
"build": "nx build",
"test": "nx test"
},
"keywords": [],
"author": "",
"license": "ISC",
"private": true,
"dependencies": {
"@bufbuild/buf": "^1.14.0-1",
"@grpc/grpc-js": "^1.8.10",
"@improbable-eng/grpc-web": "^0.15.0",
"@types/node": "^18.14.0",
"fs": "^0.0.1-security",
"install": "^0.13.0",
"npm": "^9.5.0",
"ts-protoc-gen": "^0.15.0"
"@nrwl/next": "15.7.2",
"@oclif/core": "^2.3.0",
"@oclif/plugin-help": "^5.2.5",
"change-case": "^4.1.2",
"chokidar": "^3.5.3",
"core-js": "^3.6.5",
"cross-fetch": "^3.1.5",
"fast-glob": "^3.2.12",
"js-base64": "^3.7.5",
"next": "13.1.1",
"react": "18.2.0",
"react-dom": "18.2.0",
"regenerator-runtime": "0.13.7",
"ts-morph": "^17.0.1",
"tslib": "^2.3.0"
},
"devDependencies": {
"grpc_tools_node_protoc_ts": "^5.3.3",
"grpc-tools": "^1.12.4"
"@nrwl/cli": "15.7.2",
"@nrwl/cypress": "15.7.2",
"@nrwl/eslint-plugin-nx": "15.7.2",
"@nrwl/jest": "15.7.2",
"@nrwl/js": "15.7.2",
"@nrwl/linter": "15.7.2",
"@nrwl/node": "15.7.2",
"@nrwl/nx-cloud": "15.1.0",
"@nrwl/react": "15.7.2",
"@nrwl/web": "15.7.2",
"@nrwl/workspace": "15.7.2",
"@testing-library/react": "13.4.0",
"@types/google-protobuf": "^3.15.6",
"@types/jest": "28.1.1",
"@types/node": "16.11.7",
"@types/react": "18.0.20",
"@types/react-dom": "18.0.6",
"@typescript-eslint/eslint-plugin": "^5.55.0",
"@typescript-eslint/parser": "^5.55.0",
"autoprefixer": "10.4.13",
"babel-jest": "28.1.1",
"cypress": "^11.0.0",
"eslint": "^8.36.0",
"eslint-config-next": "^13.1.1",
"eslint-config-prettier": "^8.1.0",
"eslint-plugin-cypress": "^2.12.1",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsx-a11y": "^6.6.1",
"eslint-plugin-react": "^7.31.8",
"eslint-plugin-react-hooks": "^4.6.0",
"fs-extra": "^11.1.0",
"jest": "28.1.1",
"jest-environment-jsdom": "28.1.1",
"nx": "15.7.2",
"organize-imports-cli": "^0.10.0",
"postcss": "8.4.19",
"prettier": "^2.6.2",
"react-test-renderer": "18.2.0",
"semantic-release": "^21.0.0",
"tailwindcss": "3.2.4",
"ts-jest": "28.0.5",
"ts-node": "^10.9.1",
"ts-protoc-gen": "^0.15.0",
"tsconfig-paths": "^4.1.2",
"typescript": "^4.9.5"
}
}

View File

@ -1,46 +0,0 @@
syntax = "proto3";
message SerializedObject {
// The serialization method used to serialize the the raw_object. Must be
// present in the environment that is running the agent itself.
string method = 1;
// The Python object serialized with the method above.
bytes definition = 2;
// A flag indicating whether the given object was raised (e.g. an exception
// that was captured) or not.
bool was_it_raised = 3;
// The stringized version of the traceback, if it was raised.
optional string stringized_traceback = 4;
}
message PartialRunResult {
// A flag indicating whether the run has completed.
bool is_complete = 1;
// A list of logs collected during this partial execution. It does
// not include old logs.
repeated Log logs = 2;
// The result of the run, if it is complete.
optional SerializedObject result = 3;
}
message Log {
string message = 1;
LogSource source = 2;
LogLevel level = 3;
}
enum LogSource {
BUILDER = 0;
BRIDGE = 1;
USER = 2;
}
enum LogLevel {
TRACE = 0;
DEBUG = 1;
INFO = 2;
WARNING = 3;
ERROR = 4;
STDOUT = 5;
STDERR = 6;
}

View File

@ -1,198 +0,0 @@
syntax = "proto3";
import "common.proto";
import "server.proto";
import "google/protobuf/timestamp.proto";
package controller;
service IsolateController {
// Run the given function on the specified environment. Streams logs
// and the result originating from that function.
rpc Run (HostedRun) returns (stream HostedRunResult) {}
// Run the given function in parallel with the given inputs
rpc Map (HostedMap) returns (stream HostedRunResult) {}
// Schedule the given function to be run with the specified cron.
rpc Schedule (HostedRunCron) returns (ScheduleInfo) {}
// List scheduled runs.
rpc ListScheduledRuns (ListScheduledRunsRequest) returns (ListScheduledRunsResponse) {}
// Cancel a scheduled run.
rpc CancelScheduledRun (CancelScheduledRunRequest) returns (CancelScheduledRunResponse) {}
// List all the activations of one scheduled run.
rpc ListScheduledRunActivations (ListScheduledRunActivationsRequest) returns (ListScheduledRunActivationsResponse) {}
// Get logs from a particular activation of a scheduled run.
rpc GetScheduledActivationLogs (GetScheduledActivationLogsRequest) returns (GetScheduledActivationLogsResponse) {}
// Creates an authentication key for a user
rpc CreateUserKey (CreateUserKeyRequest) returns (CreateUserKeyResponse) {}
// Lists the user's authentication keys
rpc ListUserKeys (ListUserKeysRequest) returns (ListUserKeysResponse) {}
// Revokes an authentication key for a user
rpc RevokeUserKey (RevokeUserKeyRequest) returns (RevokeUserKeyResponse) {}
}
message HostedMap {
// Environment definitions.
repeated EnvironmentDefinition environments = 1;
// Machine requirements
optional MachineRequirements machine_requirements = 2;
// Function to run.
SerializedObject function = 3;
// Inputs to the function
repeated SerializedObject inputs = 4;
}
message HostedRun {
// Environment definitions.
repeated EnvironmentDefinition environments = 1;
// Machine requirements
optional MachineRequirements machine_requirements = 2;
// Function to run.
SerializedObject function = 3;
// Optional setup function to pass as the first argument to the function.
optional SerializedObject setup_func = 4;
}
message HostedRunCron {
// Environment definitions.
repeated EnvironmentDefinition environments = 1;
// Machine requirements
optional MachineRequirements machine_requirements = 2;
// Function to run.
SerializedObject function = 3;
// cron string to represent the run schedule
string cron = 4;
}
message CancelScheduledRunRequest {
// The id of the scheduled run to cancel.
string run_id = 1;
}
message CancelScheduledRunResponse {
// Empty. For future use.
}
message ListScheduledRunsRequest {
// Empty. For future use.
}
message ListScheduledRunActivationsRequest {
// The id of the scheduled run to list activations for.
string run_id = 1;
}
message ListScheduledRunActivationsResponse {
// The list of activations (which correspond to timestamps)
repeated string activation_ids = 1;
}
message ListScheduledRunsResponse {
repeated ScheduleInfo scheduled_runs = 1;
}
message GetScheduledActivationLogsRequest {
// The id of the scheduled run to get.
string run_id = 1;
// The id of the activation to get logs for.
string activation_id = 2;
}
message GetScheduledActivationLogsResponse {
// All the logs from this activation (the format is TBD, currently raw strings).
bytes raw_logs = 1;
}
message CreateUserKeyRequest {
// Empty. For future use.
}
message CreateUserKeyResponse {
string key_secret = 1;
string key_id = 2;
optional string description = 3;
}
message ListUserKeysRequest {
// Empty. For future use.
}
message ListUserKeysResponse {
repeated UserKeyInfo user_keys = 1;
}
message RevokeUserKeyRequest {
string key_id = 1;
}
message RevokeUserKeyResponse {
// Empty. For future use.
}
message UserKeyInfo {
string key_id = 1;
google.protobuf.Timestamp created_at = 2;
}
message ScheduleInfo {
// Unique run id / token.
string run_id = 1;
enum State {
// The run has been scheduled.
SCHEDULED = 0;
// The run has failed because of isolate.
INTERNAL_FAILURE = 1;
// The run has been cancelled.
CANCELLED = 2;
}
// The state of the run.
State state = 2;
// Cron string to represent the run schedule.
string cron = 3;
}
message HostedRunResult {
// Unique run id / token.
string run_id = 1;
// Optionally the status of the current run (in terms of
// fal cloud).
optional HostedRunStatus status = 2;
// The most recent logs from the run.
repeated Log logs = 3;
// The result of the run, if it is complete (indicated by
// status.is_complete).
optional SerializedObject return_value = 4;
}
message HostedRunStatus {
enum State {
// The run is in progress.
IN_PROGRESS = 0;
// The run has completed successfully.
SUCCESS = 1;
// The run has failed because of isolate.
INTERNAL_FAILURE = 2;
// TODO: probably QUEUED, etc.
}
// The state of the run.
State state = 1;
// TODO: probably a free form struct for more detailed
// information (how it crashed, position in queue, etc).
}
message MachineRequirements {
// Machine type. It is not an enum because we want to be able
// to dynamically add new machine types without regenerating
// both the client and the server. Validation is done at the
// server side.
string machine_type = 1;
optional int32 keep_alive = 2;
}

View File

@ -1 +0,0 @@
// GENERATED CODE -- NO SERVICES IN PROTO

View File

@ -1,114 +0,0 @@
// package:
// file: common.proto
/* tslint:disable */
/* eslint-disable */
import * as jspb from "google-protobuf";
export class SerializedObject extends jspb.Message {
getMethod(): string;
setMethod(value: string): SerializedObject;
getDefinition(): Uint8Array | string;
getDefinition_asU8(): Uint8Array;
getDefinition_asB64(): string;
setDefinition(value: Uint8Array | string): SerializedObject;
getWasItRaised(): boolean;
setWasItRaised(value: boolean): SerializedObject;
hasStringizedTraceback(): boolean;
clearStringizedTraceback(): void;
getStringizedTraceback(): string | undefined;
setStringizedTraceback(value: string): SerializedObject;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): SerializedObject.AsObject;
static toObject(includeInstance: boolean, msg: SerializedObject): SerializedObject.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: SerializedObject, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): SerializedObject;
static deserializeBinaryFromReader(message: SerializedObject, reader: jspb.BinaryReader): SerializedObject;
}
export namespace SerializedObject {
export type AsObject = {
method: string,
definition: Uint8Array | string,
wasItRaised: boolean,
stringizedTraceback?: string,
}
}
export class PartialRunResult extends jspb.Message {
getIsComplete(): boolean;
setIsComplete(value: boolean): PartialRunResult;
clearLogsList(): void;
getLogsList(): Array<Log>;
setLogsList(value: Array<Log>): PartialRunResult;
addLogs(value?: Log, index?: number): Log;
hasResult(): boolean;
clearResult(): void;
getResult(): SerializedObject | undefined;
setResult(value?: SerializedObject): PartialRunResult;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): PartialRunResult.AsObject;
static toObject(includeInstance: boolean, msg: PartialRunResult): PartialRunResult.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: PartialRunResult, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): PartialRunResult;
static deserializeBinaryFromReader(message: PartialRunResult, reader: jspb.BinaryReader): PartialRunResult;
}
export namespace PartialRunResult {
export type AsObject = {
isComplete: boolean,
logsList: Array<Log.AsObject>,
result?: SerializedObject.AsObject,
}
}
export class Log extends jspb.Message {
getMessage(): string;
setMessage(value: string): Log;
getSource(): LogSource;
setSource(value: LogSource): Log;
getLevel(): LogLevel;
setLevel(value: LogLevel): Log;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): Log.AsObject;
static toObject(includeInstance: boolean, msg: Log): Log.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: Log, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): Log;
static deserializeBinaryFromReader(message: Log, reader: jspb.BinaryReader): Log;
}
export namespace Log {
export type AsObject = {
message: string,
source: LogSource,
level: LogLevel,
}
}
export enum LogSource {
BUILDER = 0,
BRIDGE = 1,
USER = 2,
}
export enum LogLevel {
TRACE = 0,
DEBUG = 1,
INFO = 2,
WARNING = 3,
ERROR = 4,
STDOUT = 5,
STDERR = 6,
}

View File

@ -1,801 +0,0 @@
// source: common.proto
/**
* @fileoverview
* @enhanceable
* @suppress {missingRequire} reports error on implicit type usages.
* @suppress {messageConventions} JS Compiler reports an error if a variable or
* field starts with 'MSG_' and isn't a translatable message.
* @public
*/
// GENERATED CODE -- DO NOT EDIT!
/* eslint-disable */
// @ts-nocheck
var jspb = require('google-protobuf');
var goog = jspb;
var global = Function('return this')();
goog.exportSymbol('proto.Log', null, global);
goog.exportSymbol('proto.LogLevel', null, global);
goog.exportSymbol('proto.LogSource', null, global);
goog.exportSymbol('proto.PartialRunResult', null, global);
goog.exportSymbol('proto.SerializedObject', null, global);
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.SerializedObject = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.SerializedObject, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.SerializedObject.displayName = 'proto.SerializedObject';
}
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.PartialRunResult = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, proto.PartialRunResult.repeatedFields_, null);
};
goog.inherits(proto.PartialRunResult, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.PartialRunResult.displayName = 'proto.PartialRunResult';
}
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.Log = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.Log, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.Log.displayName = 'proto.Log';
}
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.SerializedObject.prototype.toObject = function(opt_includeInstance) {
return proto.SerializedObject.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.SerializedObject} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.SerializedObject.toObject = function(includeInstance, msg) {
var f, obj = {
method: jspb.Message.getFieldWithDefault(msg, 1, ""),
definition: msg.getDefinition_asB64(),
wasItRaised: jspb.Message.getBooleanFieldWithDefault(msg, 3, false),
stringizedTraceback: jspb.Message.getFieldWithDefault(msg, 4, "")
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.SerializedObject}
*/
proto.SerializedObject.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.SerializedObject;
return proto.SerializedObject.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.SerializedObject} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.SerializedObject}
*/
proto.SerializedObject.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {string} */ (reader.readString());
msg.setMethod(value);
break;
case 2:
var value = /** @type {!Uint8Array} */ (reader.readBytes());
msg.setDefinition(value);
break;
case 3:
var value = /** @type {boolean} */ (reader.readBool());
msg.setWasItRaised(value);
break;
case 4:
var value = /** @type {string} */ (reader.readString());
msg.setStringizedTraceback(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.SerializedObject.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.SerializedObject.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.SerializedObject} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.SerializedObject.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getMethod();
if (f.length > 0) {
writer.writeString(
1,
f
);
}
f = message.getDefinition_asU8();
if (f.length > 0) {
writer.writeBytes(
2,
f
);
}
f = message.getWasItRaised();
if (f) {
writer.writeBool(
3,
f
);
}
f = /** @type {string} */ (jspb.Message.getField(message, 4));
if (f != null) {
writer.writeString(
4,
f
);
}
};
/**
* optional string method = 1;
* @return {string}
*/
proto.SerializedObject.prototype.getMethod = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
};
/**
* @param {string} value
* @return {!proto.SerializedObject} returns this
*/
proto.SerializedObject.prototype.setMethod = function(value) {
return jspb.Message.setProto3StringField(this, 1, value);
};
/**
* optional bytes definition = 2;
* @return {!(string|Uint8Array)}
*/
proto.SerializedObject.prototype.getDefinition = function() {
return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
};
/**
* optional bytes definition = 2;
* This is a type-conversion wrapper around `getDefinition()`
* @return {string}
*/
proto.SerializedObject.prototype.getDefinition_asB64 = function() {
return /** @type {string} */ (jspb.Message.bytesAsB64(
this.getDefinition()));
};
/**
* optional bytes definition = 2;
* Note that Uint8Array is not supported on all browsers.
* @see http://caniuse.com/Uint8Array
* This is a type-conversion wrapper around `getDefinition()`
* @return {!Uint8Array}
*/
proto.SerializedObject.prototype.getDefinition_asU8 = function() {
return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8(
this.getDefinition()));
};
/**
* @param {!(string|Uint8Array)} value
* @return {!proto.SerializedObject} returns this
*/
proto.SerializedObject.prototype.setDefinition = function(value) {
return jspb.Message.setProto3BytesField(this, 2, value);
};
/**
* optional bool was_it_raised = 3;
* @return {boolean}
*/
proto.SerializedObject.prototype.getWasItRaised = function() {
return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false));
};
/**
* @param {boolean} value
* @return {!proto.SerializedObject} returns this
*/
proto.SerializedObject.prototype.setWasItRaised = function(value) {
return jspb.Message.setProto3BooleanField(this, 3, value);
};
/**
* optional string stringized_traceback = 4;
* @return {string}
*/
proto.SerializedObject.prototype.getStringizedTraceback = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, ""));
};
/**
* @param {string} value
* @return {!proto.SerializedObject} returns this
*/
proto.SerializedObject.prototype.setStringizedTraceback = function(value) {
return jspb.Message.setField(this, 4, value);
};
/**
* Clears the field making it undefined.
* @return {!proto.SerializedObject} returns this
*/
proto.SerializedObject.prototype.clearStringizedTraceback = function() {
return jspb.Message.setField(this, 4, undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.SerializedObject.prototype.hasStringizedTraceback = function() {
return jspb.Message.getField(this, 4) != null;
};
/**
* List of repeated fields within this message type.
* @private {!Array<number>}
* @const
*/
proto.PartialRunResult.repeatedFields_ = [2];
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.PartialRunResult.prototype.toObject = function(opt_includeInstance) {
return proto.PartialRunResult.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.PartialRunResult} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.PartialRunResult.toObject = function(includeInstance, msg) {
var f, obj = {
isComplete: jspb.Message.getBooleanFieldWithDefault(msg, 1, false),
logsList: jspb.Message.toObjectList(msg.getLogsList(),
proto.Log.toObject, includeInstance),
result: (f = msg.getResult()) && proto.SerializedObject.toObject(includeInstance, f)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.PartialRunResult}
*/
proto.PartialRunResult.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.PartialRunResult;
return proto.PartialRunResult.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.PartialRunResult} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.PartialRunResult}
*/
proto.PartialRunResult.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {boolean} */ (reader.readBool());
msg.setIsComplete(value);
break;
case 2:
var value = new proto.Log;
reader.readMessage(value,proto.Log.deserializeBinaryFromReader);
msg.addLogs(value);
break;
case 3:
var value = new proto.SerializedObject;
reader.readMessage(value,proto.SerializedObject.deserializeBinaryFromReader);
msg.setResult(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.PartialRunResult.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.PartialRunResult.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.PartialRunResult} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.PartialRunResult.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getIsComplete();
if (f) {
writer.writeBool(
1,
f
);
}
f = message.getLogsList();
if (f.length > 0) {
writer.writeRepeatedMessage(
2,
f,
proto.Log.serializeBinaryToWriter
);
}
f = message.getResult();
if (f != null) {
writer.writeMessage(
3,
f,
proto.SerializedObject.serializeBinaryToWriter
);
}
};
/**
* optional bool is_complete = 1;
* @return {boolean}
*/
proto.PartialRunResult.prototype.getIsComplete = function() {
return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 1, false));
};
/**
* @param {boolean} value
* @return {!proto.PartialRunResult} returns this
*/
proto.PartialRunResult.prototype.setIsComplete = function(value) {
return jspb.Message.setProto3BooleanField(this, 1, value);
};
/**
* repeated Log logs = 2;
* @return {!Array<!proto.Log>}
*/
proto.PartialRunResult.prototype.getLogsList = function() {
return /** @type{!Array<!proto.Log>} */ (
jspb.Message.getRepeatedWrapperField(this, proto.Log, 2));
};
/**
* @param {!Array<!proto.Log>} value
* @return {!proto.PartialRunResult} returns this
*/
proto.PartialRunResult.prototype.setLogsList = function(value) {
return jspb.Message.setRepeatedWrapperField(this, 2, value);
};
/**
* @param {!proto.Log=} opt_value
* @param {number=} opt_index
* @return {!proto.Log}
*/
proto.PartialRunResult.prototype.addLogs = function(opt_value, opt_index) {
return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.Log, opt_index);
};
/**
* Clears the list making it empty but non-null.
* @return {!proto.PartialRunResult} returns this
*/
proto.PartialRunResult.prototype.clearLogsList = function() {
return this.setLogsList([]);
};
/**
* optional SerializedObject result = 3;
* @return {?proto.SerializedObject}
*/
proto.PartialRunResult.prototype.getResult = function() {
return /** @type{?proto.SerializedObject} */ (
jspb.Message.getWrapperField(this, proto.SerializedObject, 3));
};
/**
* @param {?proto.SerializedObject|undefined} value
* @return {!proto.PartialRunResult} returns this
*/
proto.PartialRunResult.prototype.setResult = function(value) {
return jspb.Message.setWrapperField(this, 3, value);
};
/**
* Clears the message field making it undefined.
* @return {!proto.PartialRunResult} returns this
*/
proto.PartialRunResult.prototype.clearResult = function() {
return this.setResult(undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.PartialRunResult.prototype.hasResult = function() {
return jspb.Message.getField(this, 3) != null;
};
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.Log.prototype.toObject = function(opt_includeInstance) {
return proto.Log.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.Log} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.Log.toObject = function(includeInstance, msg) {
var f, obj = {
message: jspb.Message.getFieldWithDefault(msg, 1, ""),
source: jspb.Message.getFieldWithDefault(msg, 2, 0),
level: jspb.Message.getFieldWithDefault(msg, 3, 0)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.Log}
*/
proto.Log.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.Log;
return proto.Log.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.Log} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.Log}
*/
proto.Log.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {string} */ (reader.readString());
msg.setMessage(value);
break;
case 2:
var value = /** @type {!proto.LogSource} */ (reader.readEnum());
msg.setSource(value);
break;
case 3:
var value = /** @type {!proto.LogLevel} */ (reader.readEnum());
msg.setLevel(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.Log.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.Log.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.Log} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.Log.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getMessage();
if (f.length > 0) {
writer.writeString(
1,
f
);
}
f = message.getSource();
if (f !== 0.0) {
writer.writeEnum(
2,
f
);
}
f = message.getLevel();
if (f !== 0.0) {
writer.writeEnum(
3,
f
);
}
};
/**
* optional string message = 1;
* @return {string}
*/
proto.Log.prototype.getMessage = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
};
/**
* @param {string} value
* @return {!proto.Log} returns this
*/
proto.Log.prototype.setMessage = function(value) {
return jspb.Message.setProto3StringField(this, 1, value);
};
/**
* optional LogSource source = 2;
* @return {!proto.LogSource}
*/
proto.Log.prototype.getSource = function() {
return /** @type {!proto.LogSource} */ (jspb.Message.getFieldWithDefault(this, 2, 0));
};
/**
* @param {!proto.LogSource} value
* @return {!proto.Log} returns this
*/
proto.Log.prototype.setSource = function(value) {
return jspb.Message.setProto3EnumField(this, 2, value);
};
/**
* optional LogLevel level = 3;
* @return {!proto.LogLevel}
*/
proto.Log.prototype.getLevel = function() {
return /** @type {!proto.LogLevel} */ (jspb.Message.getFieldWithDefault(this, 3, 0));
};
/**
* @param {!proto.LogLevel} value
* @return {!proto.Log} returns this
*/
proto.Log.prototype.setLevel = function(value) {
return jspb.Message.setProto3EnumField(this, 3, value);
};
/**
* @enum {number}
*/
proto.LogSource = {
BUILDER: 0,
BRIDGE: 1,
USER: 2
};
/**
* @enum {number}
*/
proto.LogLevel = {
TRACE: 0,
DEBUG: 1,
INFO: 2,
WARNING: 3,
ERROR: 4,
STDOUT: 5,
STDERR: 6
};
goog.object.extend(exports, proto);

View File

@ -1,193 +0,0 @@
// package: controller
// file: controller.proto
/* tslint:disable */
/* eslint-disable */
import * as grpc from "@grpc/grpc-js";
import * as controller_pb from "./controller_pb";
import * as common_pb from "./common_pb";
import * as server_pb from "./server_pb";
import * as google_protobuf_timestamp_pb from "google-protobuf/google/protobuf/timestamp_pb";
interface IIsolateControllerService extends grpc.ServiceDefinition<grpc.UntypedServiceImplementation> {
run: IIsolateControllerService_IRun;
map: IIsolateControllerService_IMap;
schedule: IIsolateControllerService_ISchedule;
listScheduledRuns: IIsolateControllerService_IListScheduledRuns;
cancelScheduledRun: IIsolateControllerService_ICancelScheduledRun;
listScheduledRunActivations: IIsolateControllerService_IListScheduledRunActivations;
getScheduledActivationLogs: IIsolateControllerService_IGetScheduledActivationLogs;
createUserKey: IIsolateControllerService_ICreateUserKey;
listUserKeys: IIsolateControllerService_IListUserKeys;
revokeUserKey: IIsolateControllerService_IRevokeUserKey;
}
interface IIsolateControllerService_IRun extends grpc.MethodDefinition<controller_pb.HostedRun, controller_pb.HostedRunResult> {
path: "/controller.IsolateController/Run";
requestStream: false;
responseStream: true;
requestSerialize: grpc.serialize<controller_pb.HostedRun>;
requestDeserialize: grpc.deserialize<controller_pb.HostedRun>;
responseSerialize: grpc.serialize<controller_pb.HostedRunResult>;
responseDeserialize: grpc.deserialize<controller_pb.HostedRunResult>;
}
interface IIsolateControllerService_IMap extends grpc.MethodDefinition<controller_pb.HostedMap, controller_pb.HostedRunResult> {
path: "/controller.IsolateController/Map";
requestStream: false;
responseStream: true;
requestSerialize: grpc.serialize<controller_pb.HostedMap>;
requestDeserialize: grpc.deserialize<controller_pb.HostedMap>;
responseSerialize: grpc.serialize<controller_pb.HostedRunResult>;
responseDeserialize: grpc.deserialize<controller_pb.HostedRunResult>;
}
interface IIsolateControllerService_ISchedule extends grpc.MethodDefinition<controller_pb.HostedRunCron, controller_pb.ScheduleInfo> {
path: "/controller.IsolateController/Schedule";
requestStream: false;
responseStream: false;
requestSerialize: grpc.serialize<controller_pb.HostedRunCron>;
requestDeserialize: grpc.deserialize<controller_pb.HostedRunCron>;
responseSerialize: grpc.serialize<controller_pb.ScheduleInfo>;
responseDeserialize: grpc.deserialize<controller_pb.ScheduleInfo>;
}
interface IIsolateControllerService_IListScheduledRuns extends grpc.MethodDefinition<controller_pb.ListScheduledRunsRequest, controller_pb.ListScheduledRunsResponse> {
path: "/controller.IsolateController/ListScheduledRuns";
requestStream: false;
responseStream: false;
requestSerialize: grpc.serialize<controller_pb.ListScheduledRunsRequest>;
requestDeserialize: grpc.deserialize<controller_pb.ListScheduledRunsRequest>;
responseSerialize: grpc.serialize<controller_pb.ListScheduledRunsResponse>;
responseDeserialize: grpc.deserialize<controller_pb.ListScheduledRunsResponse>;
}
interface IIsolateControllerService_ICancelScheduledRun extends grpc.MethodDefinition<controller_pb.CancelScheduledRunRequest, controller_pb.CancelScheduledRunResponse> {
path: "/controller.IsolateController/CancelScheduledRun";
requestStream: false;
responseStream: false;
requestSerialize: grpc.serialize<controller_pb.CancelScheduledRunRequest>;
requestDeserialize: grpc.deserialize<controller_pb.CancelScheduledRunRequest>;
responseSerialize: grpc.serialize<controller_pb.CancelScheduledRunResponse>;
responseDeserialize: grpc.deserialize<controller_pb.CancelScheduledRunResponse>;
}
interface IIsolateControllerService_IListScheduledRunActivations extends grpc.MethodDefinition<controller_pb.ListScheduledRunActivationsRequest, controller_pb.ListScheduledRunActivationsResponse> {
path: "/controller.IsolateController/ListScheduledRunActivations";
requestStream: false;
responseStream: false;
requestSerialize: grpc.serialize<controller_pb.ListScheduledRunActivationsRequest>;
requestDeserialize: grpc.deserialize<controller_pb.ListScheduledRunActivationsRequest>;
responseSerialize: grpc.serialize<controller_pb.ListScheduledRunActivationsResponse>;
responseDeserialize: grpc.deserialize<controller_pb.ListScheduledRunActivationsResponse>;
}
interface IIsolateControllerService_IGetScheduledActivationLogs extends grpc.MethodDefinition<controller_pb.GetScheduledActivationLogsRequest, controller_pb.GetScheduledActivationLogsResponse> {
path: "/controller.IsolateController/GetScheduledActivationLogs";
requestStream: false;
responseStream: false;
requestSerialize: grpc.serialize<controller_pb.GetScheduledActivationLogsRequest>;
requestDeserialize: grpc.deserialize<controller_pb.GetScheduledActivationLogsRequest>;
responseSerialize: grpc.serialize<controller_pb.GetScheduledActivationLogsResponse>;
responseDeserialize: grpc.deserialize<controller_pb.GetScheduledActivationLogsResponse>;
}
interface IIsolateControllerService_ICreateUserKey extends grpc.MethodDefinition<controller_pb.CreateUserKeyRequest, controller_pb.CreateUserKeyResponse> {
path: "/controller.IsolateController/CreateUserKey";
requestStream: false;
responseStream: false;
requestSerialize: grpc.serialize<controller_pb.CreateUserKeyRequest>;
requestDeserialize: grpc.deserialize<controller_pb.CreateUserKeyRequest>;
responseSerialize: grpc.serialize<controller_pb.CreateUserKeyResponse>;
responseDeserialize: grpc.deserialize<controller_pb.CreateUserKeyResponse>;
}
interface IIsolateControllerService_IListUserKeys extends grpc.MethodDefinition<controller_pb.ListUserKeysRequest, controller_pb.ListUserKeysResponse> {
path: "/controller.IsolateController/ListUserKeys";
requestStream: false;
responseStream: false;
requestSerialize: grpc.serialize<controller_pb.ListUserKeysRequest>;
requestDeserialize: grpc.deserialize<controller_pb.ListUserKeysRequest>;
responseSerialize: grpc.serialize<controller_pb.ListUserKeysResponse>;
responseDeserialize: grpc.deserialize<controller_pb.ListUserKeysResponse>;
}
interface IIsolateControllerService_IRevokeUserKey extends grpc.MethodDefinition<controller_pb.RevokeUserKeyRequest, controller_pb.RevokeUserKeyResponse> {
path: "/controller.IsolateController/RevokeUserKey";
requestStream: false;
responseStream: false;
requestSerialize: grpc.serialize<controller_pb.RevokeUserKeyRequest>;
requestDeserialize: grpc.deserialize<controller_pb.RevokeUserKeyRequest>;
responseSerialize: grpc.serialize<controller_pb.RevokeUserKeyResponse>;
responseDeserialize: grpc.deserialize<controller_pb.RevokeUserKeyResponse>;
}
export const IsolateControllerService: IIsolateControllerService;
export interface IIsolateControllerServer extends grpc.UntypedServiceImplementation {
run: grpc.handleServerStreamingCall<controller_pb.HostedRun, controller_pb.HostedRunResult>;
map: grpc.handleServerStreamingCall<controller_pb.HostedMap, controller_pb.HostedRunResult>;
schedule: grpc.handleUnaryCall<controller_pb.HostedRunCron, controller_pb.ScheduleInfo>;
listScheduledRuns: grpc.handleUnaryCall<controller_pb.ListScheduledRunsRequest, controller_pb.ListScheduledRunsResponse>;
cancelScheduledRun: grpc.handleUnaryCall<controller_pb.CancelScheduledRunRequest, controller_pb.CancelScheduledRunResponse>;
listScheduledRunActivations: grpc.handleUnaryCall<controller_pb.ListScheduledRunActivationsRequest, controller_pb.ListScheduledRunActivationsResponse>;
getScheduledActivationLogs: grpc.handleUnaryCall<controller_pb.GetScheduledActivationLogsRequest, controller_pb.GetScheduledActivationLogsResponse>;
createUserKey: grpc.handleUnaryCall<controller_pb.CreateUserKeyRequest, controller_pb.CreateUserKeyResponse>;
listUserKeys: grpc.handleUnaryCall<controller_pb.ListUserKeysRequest, controller_pb.ListUserKeysResponse>;
revokeUserKey: grpc.handleUnaryCall<controller_pb.RevokeUserKeyRequest, controller_pb.RevokeUserKeyResponse>;
}
export interface IIsolateControllerClient {
run(request: controller_pb.HostedRun, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<controller_pb.HostedRunResult>;
run(request: controller_pb.HostedRun, metadata?: grpc.Metadata, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<controller_pb.HostedRunResult>;
map(request: controller_pb.HostedMap, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<controller_pb.HostedRunResult>;
map(request: controller_pb.HostedMap, metadata?: grpc.Metadata, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<controller_pb.HostedRunResult>;
schedule(request: controller_pb.HostedRunCron, callback: (error: grpc.ServiceError | null, response: controller_pb.ScheduleInfo) => void): grpc.ClientUnaryCall;
schedule(request: controller_pb.HostedRunCron, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: controller_pb.ScheduleInfo) => void): grpc.ClientUnaryCall;
schedule(request: controller_pb.HostedRunCron, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: controller_pb.ScheduleInfo) => void): grpc.ClientUnaryCall;
listScheduledRuns(request: controller_pb.ListScheduledRunsRequest, callback: (error: grpc.ServiceError | null, response: controller_pb.ListScheduledRunsResponse) => void): grpc.ClientUnaryCall;
listScheduledRuns(request: controller_pb.ListScheduledRunsRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: controller_pb.ListScheduledRunsResponse) => void): grpc.ClientUnaryCall;
listScheduledRuns(request: controller_pb.ListScheduledRunsRequest, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: controller_pb.ListScheduledRunsResponse) => void): grpc.ClientUnaryCall;
cancelScheduledRun(request: controller_pb.CancelScheduledRunRequest, callback: (error: grpc.ServiceError | null, response: controller_pb.CancelScheduledRunResponse) => void): grpc.ClientUnaryCall;
cancelScheduledRun(request: controller_pb.CancelScheduledRunRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: controller_pb.CancelScheduledRunResponse) => void): grpc.ClientUnaryCall;
cancelScheduledRun(request: controller_pb.CancelScheduledRunRequest, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: controller_pb.CancelScheduledRunResponse) => void): grpc.ClientUnaryCall;
listScheduledRunActivations(request: controller_pb.ListScheduledRunActivationsRequest, callback: (error: grpc.ServiceError | null, response: controller_pb.ListScheduledRunActivationsResponse) => void): grpc.ClientUnaryCall;
listScheduledRunActivations(request: controller_pb.ListScheduledRunActivationsRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: controller_pb.ListScheduledRunActivationsResponse) => void): grpc.ClientUnaryCall;
listScheduledRunActivations(request: controller_pb.ListScheduledRunActivationsRequest, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: controller_pb.ListScheduledRunActivationsResponse) => void): grpc.ClientUnaryCall;
getScheduledActivationLogs(request: controller_pb.GetScheduledActivationLogsRequest, callback: (error: grpc.ServiceError | null, response: controller_pb.GetScheduledActivationLogsResponse) => void): grpc.ClientUnaryCall;
getScheduledActivationLogs(request: controller_pb.GetScheduledActivationLogsRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: controller_pb.GetScheduledActivationLogsResponse) => void): grpc.ClientUnaryCall;
getScheduledActivationLogs(request: controller_pb.GetScheduledActivationLogsRequest, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: controller_pb.GetScheduledActivationLogsResponse) => void): grpc.ClientUnaryCall;
createUserKey(request: controller_pb.CreateUserKeyRequest, callback: (error: grpc.ServiceError | null, response: controller_pb.CreateUserKeyResponse) => void): grpc.ClientUnaryCall;
createUserKey(request: controller_pb.CreateUserKeyRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: controller_pb.CreateUserKeyResponse) => void): grpc.ClientUnaryCall;
createUserKey(request: controller_pb.CreateUserKeyRequest, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: controller_pb.CreateUserKeyResponse) => void): grpc.ClientUnaryCall;
listUserKeys(request: controller_pb.ListUserKeysRequest, callback: (error: grpc.ServiceError | null, response: controller_pb.ListUserKeysResponse) => void): grpc.ClientUnaryCall;
listUserKeys(request: controller_pb.ListUserKeysRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: controller_pb.ListUserKeysResponse) => void): grpc.ClientUnaryCall;
listUserKeys(request: controller_pb.ListUserKeysRequest, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: controller_pb.ListUserKeysResponse) => void): grpc.ClientUnaryCall;
revokeUserKey(request: controller_pb.RevokeUserKeyRequest, callback: (error: grpc.ServiceError | null, response: controller_pb.RevokeUserKeyResponse) => void): grpc.ClientUnaryCall;
revokeUserKey(request: controller_pb.RevokeUserKeyRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: controller_pb.RevokeUserKeyResponse) => void): grpc.ClientUnaryCall;
revokeUserKey(request: controller_pb.RevokeUserKeyRequest, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: controller_pb.RevokeUserKeyResponse) => void): grpc.ClientUnaryCall;
}
export class IsolateControllerClient extends grpc.Client implements IIsolateControllerClient {
constructor(address: string, credentials: grpc.ChannelCredentials, options?: Partial<grpc.ClientOptions>);
public run(request: controller_pb.HostedRun, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<controller_pb.HostedRunResult>;
public run(request: controller_pb.HostedRun, metadata?: grpc.Metadata, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<controller_pb.HostedRunResult>;
public map(request: controller_pb.HostedMap, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<controller_pb.HostedRunResult>;
public map(request: controller_pb.HostedMap, metadata?: grpc.Metadata, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<controller_pb.HostedRunResult>;
public schedule(request: controller_pb.HostedRunCron, callback: (error: grpc.ServiceError | null, response: controller_pb.ScheduleInfo) => void): grpc.ClientUnaryCall;
public schedule(request: controller_pb.HostedRunCron, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: controller_pb.ScheduleInfo) => void): grpc.ClientUnaryCall;
public schedule(request: controller_pb.HostedRunCron, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: controller_pb.ScheduleInfo) => void): grpc.ClientUnaryCall;
public listScheduledRuns(request: controller_pb.ListScheduledRunsRequest, callback: (error: grpc.ServiceError | null, response: controller_pb.ListScheduledRunsResponse) => void): grpc.ClientUnaryCall;
public listScheduledRuns(request: controller_pb.ListScheduledRunsRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: controller_pb.ListScheduledRunsResponse) => void): grpc.ClientUnaryCall;
public listScheduledRuns(request: controller_pb.ListScheduledRunsRequest, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: controller_pb.ListScheduledRunsResponse) => void): grpc.ClientUnaryCall;
public cancelScheduledRun(request: controller_pb.CancelScheduledRunRequest, callback: (error: grpc.ServiceError | null, response: controller_pb.CancelScheduledRunResponse) => void): grpc.ClientUnaryCall;
public cancelScheduledRun(request: controller_pb.CancelScheduledRunRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: controller_pb.CancelScheduledRunResponse) => void): grpc.ClientUnaryCall;
public cancelScheduledRun(request: controller_pb.CancelScheduledRunRequest, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: controller_pb.CancelScheduledRunResponse) => void): grpc.ClientUnaryCall;
public listScheduledRunActivations(request: controller_pb.ListScheduledRunActivationsRequest, callback: (error: grpc.ServiceError | null, response: controller_pb.ListScheduledRunActivationsResponse) => void): grpc.ClientUnaryCall;
public listScheduledRunActivations(request: controller_pb.ListScheduledRunActivationsRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: controller_pb.ListScheduledRunActivationsResponse) => void): grpc.ClientUnaryCall;
public listScheduledRunActivations(request: controller_pb.ListScheduledRunActivationsRequest, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: controller_pb.ListScheduledRunActivationsResponse) => void): grpc.ClientUnaryCall;
public getScheduledActivationLogs(request: controller_pb.GetScheduledActivationLogsRequest, callback: (error: grpc.ServiceError | null, response: controller_pb.GetScheduledActivationLogsResponse) => void): grpc.ClientUnaryCall;
public getScheduledActivationLogs(request: controller_pb.GetScheduledActivationLogsRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: controller_pb.GetScheduledActivationLogsResponse) => void): grpc.ClientUnaryCall;
public getScheduledActivationLogs(request: controller_pb.GetScheduledActivationLogsRequest, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: controller_pb.GetScheduledActivationLogsResponse) => void): grpc.ClientUnaryCall;
public createUserKey(request: controller_pb.CreateUserKeyRequest, callback: (error: grpc.ServiceError | null, response: controller_pb.CreateUserKeyResponse) => void): grpc.ClientUnaryCall;
public createUserKey(request: controller_pb.CreateUserKeyRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: controller_pb.CreateUserKeyResponse) => void): grpc.ClientUnaryCall;
public createUserKey(request: controller_pb.CreateUserKeyRequest, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: controller_pb.CreateUserKeyResponse) => void): grpc.ClientUnaryCall;
public listUserKeys(request: controller_pb.ListUserKeysRequest, callback: (error: grpc.ServiceError | null, response: controller_pb.ListUserKeysResponse) => void): grpc.ClientUnaryCall;
public listUserKeys(request: controller_pb.ListUserKeysRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: controller_pb.ListUserKeysResponse) => void): grpc.ClientUnaryCall;
public listUserKeys(request: controller_pb.ListUserKeysRequest, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: controller_pb.ListUserKeysResponse) => void): grpc.ClientUnaryCall;
public revokeUserKey(request: controller_pb.RevokeUserKeyRequest, callback: (error: grpc.ServiceError | null, response: controller_pb.RevokeUserKeyResponse) => void): grpc.ClientUnaryCall;
public revokeUserKey(request: controller_pb.RevokeUserKeyRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: controller_pb.RevokeUserKeyResponse) => void): grpc.ClientUnaryCall;
public revokeUserKey(request: controller_pb.RevokeUserKeyRequest, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: controller_pb.RevokeUserKeyResponse) => void): grpc.ClientUnaryCall;
}

View File

@ -1,344 +0,0 @@
// GENERATED CODE -- DO NOT EDIT!
'use strict';
var grpc = require("@grpc/grpc-js");
var controller_pb = require('./controller_pb.js');
var common_pb = require('./common_pb.js');
var server_pb = require('./server_pb.js');
var google_protobuf_timestamp_pb = require('google-protobuf/google/protobuf/timestamp_pb.js');
function serialize_controller_CancelScheduledRunRequest(arg) {
if (!(arg instanceof controller_pb.CancelScheduledRunRequest)) {
throw new Error('Expected argument of type controller.CancelScheduledRunRequest');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_controller_CancelScheduledRunRequest(buffer_arg) {
return controller_pb.CancelScheduledRunRequest.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_controller_CancelScheduledRunResponse(arg) {
if (!(arg instanceof controller_pb.CancelScheduledRunResponse)) {
throw new Error('Expected argument of type controller.CancelScheduledRunResponse');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_controller_CancelScheduledRunResponse(buffer_arg) {
return controller_pb.CancelScheduledRunResponse.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_controller_CreateUserKeyRequest(arg) {
if (!(arg instanceof controller_pb.CreateUserKeyRequest)) {
throw new Error('Expected argument of type controller.CreateUserKeyRequest');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_controller_CreateUserKeyRequest(buffer_arg) {
return controller_pb.CreateUserKeyRequest.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_controller_CreateUserKeyResponse(arg) {
if (!(arg instanceof controller_pb.CreateUserKeyResponse)) {
throw new Error('Expected argument of type controller.CreateUserKeyResponse');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_controller_CreateUserKeyResponse(buffer_arg) {
return controller_pb.CreateUserKeyResponse.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_controller_GetScheduledActivationLogsRequest(arg) {
if (!(arg instanceof controller_pb.GetScheduledActivationLogsRequest)) {
throw new Error('Expected argument of type controller.GetScheduledActivationLogsRequest');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_controller_GetScheduledActivationLogsRequest(buffer_arg) {
return controller_pb.GetScheduledActivationLogsRequest.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_controller_GetScheduledActivationLogsResponse(arg) {
if (!(arg instanceof controller_pb.GetScheduledActivationLogsResponse)) {
throw new Error('Expected argument of type controller.GetScheduledActivationLogsResponse');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_controller_GetScheduledActivationLogsResponse(buffer_arg) {
return controller_pb.GetScheduledActivationLogsResponse.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_controller_HostedMap(arg) {
if (!(arg instanceof controller_pb.HostedMap)) {
throw new Error('Expected argument of type controller.HostedMap');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_controller_HostedMap(buffer_arg) {
return controller_pb.HostedMap.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_controller_HostedRun(arg) {
if (!(arg instanceof controller_pb.HostedRun)) {
throw new Error('Expected argument of type controller.HostedRun');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_controller_HostedRun(buffer_arg) {
return controller_pb.HostedRun.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_controller_HostedRunCron(arg) {
if (!(arg instanceof controller_pb.HostedRunCron)) {
throw new Error('Expected argument of type controller.HostedRunCron');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_controller_HostedRunCron(buffer_arg) {
return controller_pb.HostedRunCron.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_controller_HostedRunResult(arg) {
if (!(arg instanceof controller_pb.HostedRunResult)) {
throw new Error('Expected argument of type controller.HostedRunResult');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_controller_HostedRunResult(buffer_arg) {
return controller_pb.HostedRunResult.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_controller_ListScheduledRunActivationsRequest(arg) {
if (!(arg instanceof controller_pb.ListScheduledRunActivationsRequest)) {
throw new Error('Expected argument of type controller.ListScheduledRunActivationsRequest');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_controller_ListScheduledRunActivationsRequest(buffer_arg) {
return controller_pb.ListScheduledRunActivationsRequest.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_controller_ListScheduledRunActivationsResponse(arg) {
if (!(arg instanceof controller_pb.ListScheduledRunActivationsResponse)) {
throw new Error('Expected argument of type controller.ListScheduledRunActivationsResponse');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_controller_ListScheduledRunActivationsResponse(buffer_arg) {
return controller_pb.ListScheduledRunActivationsResponse.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_controller_ListScheduledRunsRequest(arg) {
if (!(arg instanceof controller_pb.ListScheduledRunsRequest)) {
throw new Error('Expected argument of type controller.ListScheduledRunsRequest');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_controller_ListScheduledRunsRequest(buffer_arg) {
return controller_pb.ListScheduledRunsRequest.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_controller_ListScheduledRunsResponse(arg) {
if (!(arg instanceof controller_pb.ListScheduledRunsResponse)) {
throw new Error('Expected argument of type controller.ListScheduledRunsResponse');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_controller_ListScheduledRunsResponse(buffer_arg) {
return controller_pb.ListScheduledRunsResponse.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_controller_ListUserKeysRequest(arg) {
if (!(arg instanceof controller_pb.ListUserKeysRequest)) {
throw new Error('Expected argument of type controller.ListUserKeysRequest');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_controller_ListUserKeysRequest(buffer_arg) {
return controller_pb.ListUserKeysRequest.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_controller_ListUserKeysResponse(arg) {
if (!(arg instanceof controller_pb.ListUserKeysResponse)) {
throw new Error('Expected argument of type controller.ListUserKeysResponse');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_controller_ListUserKeysResponse(buffer_arg) {
return controller_pb.ListUserKeysResponse.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_controller_RevokeUserKeyRequest(arg) {
if (!(arg instanceof controller_pb.RevokeUserKeyRequest)) {
throw new Error('Expected argument of type controller.RevokeUserKeyRequest');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_controller_RevokeUserKeyRequest(buffer_arg) {
return controller_pb.RevokeUserKeyRequest.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_controller_RevokeUserKeyResponse(arg) {
if (!(arg instanceof controller_pb.RevokeUserKeyResponse)) {
throw new Error('Expected argument of type controller.RevokeUserKeyResponse');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_controller_RevokeUserKeyResponse(buffer_arg) {
return controller_pb.RevokeUserKeyResponse.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_controller_ScheduleInfo(arg) {
if (!(arg instanceof controller_pb.ScheduleInfo)) {
throw new Error('Expected argument of type controller.ScheduleInfo');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_controller_ScheduleInfo(buffer_arg) {
return controller_pb.ScheduleInfo.deserializeBinary(new Uint8Array(buffer_arg));
}
var IsolateControllerService = exports.IsolateControllerService = {
// Run the given function on the specified environment. Streams logs
// and the result originating from that function.
run: {
path: '/controller.IsolateController/Run',
requestStream: false,
responseStream: true,
requestType: controller_pb.HostedRun,
responseType: controller_pb.HostedRunResult,
requestSerialize: serialize_controller_HostedRun,
requestDeserialize: deserialize_controller_HostedRun,
responseSerialize: serialize_controller_HostedRunResult,
responseDeserialize: deserialize_controller_HostedRunResult,
},
// Run the given function in parallel with the given inputs
map: {
path: '/controller.IsolateController/Map',
requestStream: false,
responseStream: true,
requestType: controller_pb.HostedMap,
responseType: controller_pb.HostedRunResult,
requestSerialize: serialize_controller_HostedMap,
requestDeserialize: deserialize_controller_HostedMap,
responseSerialize: serialize_controller_HostedRunResult,
responseDeserialize: deserialize_controller_HostedRunResult,
},
// Schedule the given function to be run with the specified cron.
schedule: {
path: '/controller.IsolateController/Schedule',
requestStream: false,
responseStream: false,
requestType: controller_pb.HostedRunCron,
responseType: controller_pb.ScheduleInfo,
requestSerialize: serialize_controller_HostedRunCron,
requestDeserialize: deserialize_controller_HostedRunCron,
responseSerialize: serialize_controller_ScheduleInfo,
responseDeserialize: deserialize_controller_ScheduleInfo,
},
// List scheduled runs.
listScheduledRuns: {
path: '/controller.IsolateController/ListScheduledRuns',
requestStream: false,
responseStream: false,
requestType: controller_pb.ListScheduledRunsRequest,
responseType: controller_pb.ListScheduledRunsResponse,
requestSerialize: serialize_controller_ListScheduledRunsRequest,
requestDeserialize: deserialize_controller_ListScheduledRunsRequest,
responseSerialize: serialize_controller_ListScheduledRunsResponse,
responseDeserialize: deserialize_controller_ListScheduledRunsResponse,
},
// Cancel a scheduled run.
cancelScheduledRun: {
path: '/controller.IsolateController/CancelScheduledRun',
requestStream: false,
responseStream: false,
requestType: controller_pb.CancelScheduledRunRequest,
responseType: controller_pb.CancelScheduledRunResponse,
requestSerialize: serialize_controller_CancelScheduledRunRequest,
requestDeserialize: deserialize_controller_CancelScheduledRunRequest,
responseSerialize: serialize_controller_CancelScheduledRunResponse,
responseDeserialize: deserialize_controller_CancelScheduledRunResponse,
},
// List all the activations of one scheduled run.
listScheduledRunActivations: {
path: '/controller.IsolateController/ListScheduledRunActivations',
requestStream: false,
responseStream: false,
requestType: controller_pb.ListScheduledRunActivationsRequest,
responseType: controller_pb.ListScheduledRunActivationsResponse,
requestSerialize: serialize_controller_ListScheduledRunActivationsRequest,
requestDeserialize: deserialize_controller_ListScheduledRunActivationsRequest,
responseSerialize: serialize_controller_ListScheduledRunActivationsResponse,
responseDeserialize: deserialize_controller_ListScheduledRunActivationsResponse,
},
// Get logs from a particular activation of a scheduled run.
getScheduledActivationLogs: {
path: '/controller.IsolateController/GetScheduledActivationLogs',
requestStream: false,
responseStream: false,
requestType: controller_pb.GetScheduledActivationLogsRequest,
responseType: controller_pb.GetScheduledActivationLogsResponse,
requestSerialize: serialize_controller_GetScheduledActivationLogsRequest,
requestDeserialize: deserialize_controller_GetScheduledActivationLogsRequest,
responseSerialize: serialize_controller_GetScheduledActivationLogsResponse,
responseDeserialize: deserialize_controller_GetScheduledActivationLogsResponse,
},
// Creates an authentication key for a user
createUserKey: {
path: '/controller.IsolateController/CreateUserKey',
requestStream: false,
responseStream: false,
requestType: controller_pb.CreateUserKeyRequest,
responseType: controller_pb.CreateUserKeyResponse,
requestSerialize: serialize_controller_CreateUserKeyRequest,
requestDeserialize: deserialize_controller_CreateUserKeyRequest,
responseSerialize: serialize_controller_CreateUserKeyResponse,
responseDeserialize: deserialize_controller_CreateUserKeyResponse,
},
// Lists the user's authentication keys
listUserKeys: {
path: '/controller.IsolateController/ListUserKeys',
requestStream: false,
responseStream: false,
requestType: controller_pb.ListUserKeysRequest,
responseType: controller_pb.ListUserKeysResponse,
requestSerialize: serialize_controller_ListUserKeysRequest,
requestDeserialize: deserialize_controller_ListUserKeysRequest,
responseSerialize: serialize_controller_ListUserKeysResponse,
responseDeserialize: deserialize_controller_ListUserKeysResponse,
},
// Revokes an authentication key for a user
revokeUserKey: {
path: '/controller.IsolateController/RevokeUserKey',
requestStream: false,
responseStream: false,
requestType: controller_pb.RevokeUserKeyRequest,
responseType: controller_pb.RevokeUserKeyResponse,
requestSerialize: serialize_controller_RevokeUserKeyRequest,
requestDeserialize: deserialize_controller_RevokeUserKeyRequest,
responseSerialize: serialize_controller_RevokeUserKeyResponse,
responseDeserialize: deserialize_controller_RevokeUserKeyResponse,
},
};
exports.IsolateControllerClient = grpc.makeGenericClientConstructor(IsolateControllerService);

View File

@ -1,560 +0,0 @@
// package: controller
// file: controller.proto
/* tslint:disable */
/* eslint-disable */
import * as jspb from "google-protobuf";
import * as common_pb from "./common_pb";
import * as server_pb from "./server_pb";
import * as google_protobuf_timestamp_pb from "google-protobuf/google/protobuf/timestamp_pb";
export class HostedMap extends jspb.Message {
clearEnvironmentsList(): void;
getEnvironmentsList(): Array<server_pb.EnvironmentDefinition>;
setEnvironmentsList(value: Array<server_pb.EnvironmentDefinition>): HostedMap;
addEnvironments(value?: server_pb.EnvironmentDefinition, index?: number): server_pb.EnvironmentDefinition;
hasMachineRequirements(): boolean;
clearMachineRequirements(): void;
getMachineRequirements(): MachineRequirements | undefined;
setMachineRequirements(value?: MachineRequirements): HostedMap;
hasFunction(): boolean;
clearFunction(): void;
getFunction(): common_pb.SerializedObject | undefined;
setFunction(value?: common_pb.SerializedObject): HostedMap;
clearInputsList(): void;
getInputsList(): Array<common_pb.SerializedObject>;
setInputsList(value: Array<common_pb.SerializedObject>): HostedMap;
addInputs(value?: common_pb.SerializedObject, index?: number): common_pb.SerializedObject;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): HostedMap.AsObject;
static toObject(includeInstance: boolean, msg: HostedMap): HostedMap.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: HostedMap, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): HostedMap;
static deserializeBinaryFromReader(message: HostedMap, reader: jspb.BinaryReader): HostedMap;
}
export namespace HostedMap {
export type AsObject = {
environmentsList: Array<server_pb.EnvironmentDefinition.AsObject>,
machineRequirements?: MachineRequirements.AsObject,
pb_function?: common_pb.SerializedObject.AsObject,
inputsList: Array<common_pb.SerializedObject.AsObject>,
}
}
export class HostedRun extends jspb.Message {
clearEnvironmentsList(): void;
getEnvironmentsList(): Array<server_pb.EnvironmentDefinition>;
setEnvironmentsList(value: Array<server_pb.EnvironmentDefinition>): HostedRun;
addEnvironments(value?: server_pb.EnvironmentDefinition, index?: number): server_pb.EnvironmentDefinition;
hasMachineRequirements(): boolean;
clearMachineRequirements(): void;
getMachineRequirements(): MachineRequirements | undefined;
setMachineRequirements(value?: MachineRequirements): HostedRun;
hasFunction(): boolean;
clearFunction(): void;
getFunction(): common_pb.SerializedObject | undefined;
setFunction(value?: common_pb.SerializedObject): HostedRun;
hasSetupFunc(): boolean;
clearSetupFunc(): void;
getSetupFunc(): common_pb.SerializedObject | undefined;
setSetupFunc(value?: common_pb.SerializedObject): HostedRun;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): HostedRun.AsObject;
static toObject(includeInstance: boolean, msg: HostedRun): HostedRun.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: HostedRun, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): HostedRun;
static deserializeBinaryFromReader(message: HostedRun, reader: jspb.BinaryReader): HostedRun;
}
export namespace HostedRun {
export type AsObject = {
environmentsList: Array<server_pb.EnvironmentDefinition.AsObject>,
machineRequirements?: MachineRequirements.AsObject,
pb_function?: common_pb.SerializedObject.AsObject,
setupFunc?: common_pb.SerializedObject.AsObject,
}
}
export class HostedRunCron extends jspb.Message {
clearEnvironmentsList(): void;
getEnvironmentsList(): Array<server_pb.EnvironmentDefinition>;
setEnvironmentsList(value: Array<server_pb.EnvironmentDefinition>): HostedRunCron;
addEnvironments(value?: server_pb.EnvironmentDefinition, index?: number): server_pb.EnvironmentDefinition;
hasMachineRequirements(): boolean;
clearMachineRequirements(): void;
getMachineRequirements(): MachineRequirements | undefined;
setMachineRequirements(value?: MachineRequirements): HostedRunCron;
hasFunction(): boolean;
clearFunction(): void;
getFunction(): common_pb.SerializedObject | undefined;
setFunction(value?: common_pb.SerializedObject): HostedRunCron;
getCron(): string;
setCron(value: string): HostedRunCron;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): HostedRunCron.AsObject;
static toObject(includeInstance: boolean, msg: HostedRunCron): HostedRunCron.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: HostedRunCron, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): HostedRunCron;
static deserializeBinaryFromReader(message: HostedRunCron, reader: jspb.BinaryReader): HostedRunCron;
}
export namespace HostedRunCron {
export type AsObject = {
environmentsList: Array<server_pb.EnvironmentDefinition.AsObject>,
machineRequirements?: MachineRequirements.AsObject,
pb_function?: common_pb.SerializedObject.AsObject,
cron: string,
}
}
export class CancelScheduledRunRequest extends jspb.Message {
getRunId(): string;
setRunId(value: string): CancelScheduledRunRequest;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): CancelScheduledRunRequest.AsObject;
static toObject(includeInstance: boolean, msg: CancelScheduledRunRequest): CancelScheduledRunRequest.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: CancelScheduledRunRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): CancelScheduledRunRequest;
static deserializeBinaryFromReader(message: CancelScheduledRunRequest, reader: jspb.BinaryReader): CancelScheduledRunRequest;
}
export namespace CancelScheduledRunRequest {
export type AsObject = {
runId: string,
}
}
export class CancelScheduledRunResponse extends jspb.Message {
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): CancelScheduledRunResponse.AsObject;
static toObject(includeInstance: boolean, msg: CancelScheduledRunResponse): CancelScheduledRunResponse.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: CancelScheduledRunResponse, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): CancelScheduledRunResponse;
static deserializeBinaryFromReader(message: CancelScheduledRunResponse, reader: jspb.BinaryReader): CancelScheduledRunResponse;
}
export namespace CancelScheduledRunResponse {
export type AsObject = {
}
}
export class ListScheduledRunsRequest extends jspb.Message {
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): ListScheduledRunsRequest.AsObject;
static toObject(includeInstance: boolean, msg: ListScheduledRunsRequest): ListScheduledRunsRequest.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: ListScheduledRunsRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): ListScheduledRunsRequest;
static deserializeBinaryFromReader(message: ListScheduledRunsRequest, reader: jspb.BinaryReader): ListScheduledRunsRequest;
}
export namespace ListScheduledRunsRequest {
export type AsObject = {
}
}
export class ListScheduledRunActivationsRequest extends jspb.Message {
getRunId(): string;
setRunId(value: string): ListScheduledRunActivationsRequest;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): ListScheduledRunActivationsRequest.AsObject;
static toObject(includeInstance: boolean, msg: ListScheduledRunActivationsRequest): ListScheduledRunActivationsRequest.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: ListScheduledRunActivationsRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): ListScheduledRunActivationsRequest;
static deserializeBinaryFromReader(message: ListScheduledRunActivationsRequest, reader: jspb.BinaryReader): ListScheduledRunActivationsRequest;
}
export namespace ListScheduledRunActivationsRequest {
export type AsObject = {
runId: string,
}
}
export class ListScheduledRunActivationsResponse extends jspb.Message {
clearActivationIdsList(): void;
getActivationIdsList(): Array<string>;
setActivationIdsList(value: Array<string>): ListScheduledRunActivationsResponse;
addActivationIds(value: string, index?: number): string;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): ListScheduledRunActivationsResponse.AsObject;
static toObject(includeInstance: boolean, msg: ListScheduledRunActivationsResponse): ListScheduledRunActivationsResponse.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: ListScheduledRunActivationsResponse, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): ListScheduledRunActivationsResponse;
static deserializeBinaryFromReader(message: ListScheduledRunActivationsResponse, reader: jspb.BinaryReader): ListScheduledRunActivationsResponse;
}
export namespace ListScheduledRunActivationsResponse {
export type AsObject = {
activationIdsList: Array<string>,
}
}
export class ListScheduledRunsResponse extends jspb.Message {
clearScheduledRunsList(): void;
getScheduledRunsList(): Array<ScheduleInfo>;
setScheduledRunsList(value: Array<ScheduleInfo>): ListScheduledRunsResponse;
addScheduledRuns(value?: ScheduleInfo, index?: number): ScheduleInfo;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): ListScheduledRunsResponse.AsObject;
static toObject(includeInstance: boolean, msg: ListScheduledRunsResponse): ListScheduledRunsResponse.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: ListScheduledRunsResponse, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): ListScheduledRunsResponse;
static deserializeBinaryFromReader(message: ListScheduledRunsResponse, reader: jspb.BinaryReader): ListScheduledRunsResponse;
}
export namespace ListScheduledRunsResponse {
export type AsObject = {
scheduledRunsList: Array<ScheduleInfo.AsObject>,
}
}
export class GetScheduledActivationLogsRequest extends jspb.Message {
getRunId(): string;
setRunId(value: string): GetScheduledActivationLogsRequest;
getActivationId(): string;
setActivationId(value: string): GetScheduledActivationLogsRequest;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): GetScheduledActivationLogsRequest.AsObject;
static toObject(includeInstance: boolean, msg: GetScheduledActivationLogsRequest): GetScheduledActivationLogsRequest.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: GetScheduledActivationLogsRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): GetScheduledActivationLogsRequest;
static deserializeBinaryFromReader(message: GetScheduledActivationLogsRequest, reader: jspb.BinaryReader): GetScheduledActivationLogsRequest;
}
export namespace GetScheduledActivationLogsRequest {
export type AsObject = {
runId: string,
activationId: string,
}
}
export class GetScheduledActivationLogsResponse extends jspb.Message {
getRawLogs(): Uint8Array | string;
getRawLogs_asU8(): Uint8Array;
getRawLogs_asB64(): string;
setRawLogs(value: Uint8Array | string): GetScheduledActivationLogsResponse;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): GetScheduledActivationLogsResponse.AsObject;
static toObject(includeInstance: boolean, msg: GetScheduledActivationLogsResponse): GetScheduledActivationLogsResponse.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: GetScheduledActivationLogsResponse, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): GetScheduledActivationLogsResponse;
static deserializeBinaryFromReader(message: GetScheduledActivationLogsResponse, reader: jspb.BinaryReader): GetScheduledActivationLogsResponse;
}
export namespace GetScheduledActivationLogsResponse {
export type AsObject = {
rawLogs: Uint8Array | string,
}
}
export class CreateUserKeyRequest extends jspb.Message {
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): CreateUserKeyRequest.AsObject;
static toObject(includeInstance: boolean, msg: CreateUserKeyRequest): CreateUserKeyRequest.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: CreateUserKeyRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): CreateUserKeyRequest;
static deserializeBinaryFromReader(message: CreateUserKeyRequest, reader: jspb.BinaryReader): CreateUserKeyRequest;
}
export namespace CreateUserKeyRequest {
export type AsObject = {
}
}
export class CreateUserKeyResponse extends jspb.Message {
getKeySecret(): string;
setKeySecret(value: string): CreateUserKeyResponse;
getKeyId(): string;
setKeyId(value: string): CreateUserKeyResponse;
hasDescription(): boolean;
clearDescription(): void;
getDescription(): string | undefined;
setDescription(value: string): CreateUserKeyResponse;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): CreateUserKeyResponse.AsObject;
static toObject(includeInstance: boolean, msg: CreateUserKeyResponse): CreateUserKeyResponse.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: CreateUserKeyResponse, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): CreateUserKeyResponse;
static deserializeBinaryFromReader(message: CreateUserKeyResponse, reader: jspb.BinaryReader): CreateUserKeyResponse;
}
export namespace CreateUserKeyResponse {
export type AsObject = {
keySecret: string,
keyId: string,
description?: string,
}
}
export class ListUserKeysRequest extends jspb.Message {
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): ListUserKeysRequest.AsObject;
static toObject(includeInstance: boolean, msg: ListUserKeysRequest): ListUserKeysRequest.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: ListUserKeysRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): ListUserKeysRequest;
static deserializeBinaryFromReader(message: ListUserKeysRequest, reader: jspb.BinaryReader): ListUserKeysRequest;
}
export namespace ListUserKeysRequest {
export type AsObject = {
}
}
export class ListUserKeysResponse extends jspb.Message {
clearUserKeysList(): void;
getUserKeysList(): Array<UserKeyInfo>;
setUserKeysList(value: Array<UserKeyInfo>): ListUserKeysResponse;
addUserKeys(value?: UserKeyInfo, index?: number): UserKeyInfo;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): ListUserKeysResponse.AsObject;
static toObject(includeInstance: boolean, msg: ListUserKeysResponse): ListUserKeysResponse.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: ListUserKeysResponse, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): ListUserKeysResponse;
static deserializeBinaryFromReader(message: ListUserKeysResponse, reader: jspb.BinaryReader): ListUserKeysResponse;
}
export namespace ListUserKeysResponse {
export type AsObject = {
userKeysList: Array<UserKeyInfo.AsObject>,
}
}
export class RevokeUserKeyRequest extends jspb.Message {
getKeyId(): string;
setKeyId(value: string): RevokeUserKeyRequest;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): RevokeUserKeyRequest.AsObject;
static toObject(includeInstance: boolean, msg: RevokeUserKeyRequest): RevokeUserKeyRequest.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: RevokeUserKeyRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): RevokeUserKeyRequest;
static deserializeBinaryFromReader(message: RevokeUserKeyRequest, reader: jspb.BinaryReader): RevokeUserKeyRequest;
}
export namespace RevokeUserKeyRequest {
export type AsObject = {
keyId: string,
}
}
export class RevokeUserKeyResponse extends jspb.Message {
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): RevokeUserKeyResponse.AsObject;
static toObject(includeInstance: boolean, msg: RevokeUserKeyResponse): RevokeUserKeyResponse.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: RevokeUserKeyResponse, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): RevokeUserKeyResponse;
static deserializeBinaryFromReader(message: RevokeUserKeyResponse, reader: jspb.BinaryReader): RevokeUserKeyResponse;
}
export namespace RevokeUserKeyResponse {
export type AsObject = {
}
}
export class UserKeyInfo extends jspb.Message {
getKeyId(): string;
setKeyId(value: string): UserKeyInfo;
hasCreatedAt(): boolean;
clearCreatedAt(): void;
getCreatedAt(): google_protobuf_timestamp_pb.Timestamp | undefined;
setCreatedAt(value?: google_protobuf_timestamp_pb.Timestamp): UserKeyInfo;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): UserKeyInfo.AsObject;
static toObject(includeInstance: boolean, msg: UserKeyInfo): UserKeyInfo.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: UserKeyInfo, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): UserKeyInfo;
static deserializeBinaryFromReader(message: UserKeyInfo, reader: jspb.BinaryReader): UserKeyInfo;
}
export namespace UserKeyInfo {
export type AsObject = {
keyId: string,
createdAt?: google_protobuf_timestamp_pb.Timestamp.AsObject,
}
}
export class ScheduleInfo extends jspb.Message {
getRunId(): string;
setRunId(value: string): ScheduleInfo;
getState(): ScheduleInfo.State;
setState(value: ScheduleInfo.State): ScheduleInfo;
getCron(): string;
setCron(value: string): ScheduleInfo;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): ScheduleInfo.AsObject;
static toObject(includeInstance: boolean, msg: ScheduleInfo): ScheduleInfo.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: ScheduleInfo, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): ScheduleInfo;
static deserializeBinaryFromReader(message: ScheduleInfo, reader: jspb.BinaryReader): ScheduleInfo;
}
export namespace ScheduleInfo {
export type AsObject = {
runId: string,
state: ScheduleInfo.State,
cron: string,
}
export enum State {
SCHEDULED = 0,
INTERNAL_FAILURE = 1,
CANCELLED = 2,
}
}
export class HostedRunResult extends jspb.Message {
getRunId(): string;
setRunId(value: string): HostedRunResult;
hasStatus(): boolean;
clearStatus(): void;
getStatus(): HostedRunStatus | undefined;
setStatus(value?: HostedRunStatus): HostedRunResult;
clearLogsList(): void;
getLogsList(): Array<common_pb.Log>;
setLogsList(value: Array<common_pb.Log>): HostedRunResult;
addLogs(value?: common_pb.Log, index?: number): common_pb.Log;
hasReturnValue(): boolean;
clearReturnValue(): void;
getReturnValue(): common_pb.SerializedObject | undefined;
setReturnValue(value?: common_pb.SerializedObject): HostedRunResult;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): HostedRunResult.AsObject;
static toObject(includeInstance: boolean, msg: HostedRunResult): HostedRunResult.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: HostedRunResult, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): HostedRunResult;
static deserializeBinaryFromReader(message: HostedRunResult, reader: jspb.BinaryReader): HostedRunResult;
}
export namespace HostedRunResult {
export type AsObject = {
runId: string,
status?: HostedRunStatus.AsObject,
logsList: Array<common_pb.Log.AsObject>,
returnValue?: common_pb.SerializedObject.AsObject,
}
}
export class HostedRunStatus extends jspb.Message {
getState(): HostedRunStatus.State;
setState(value: HostedRunStatus.State): HostedRunStatus;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): HostedRunStatus.AsObject;
static toObject(includeInstance: boolean, msg: HostedRunStatus): HostedRunStatus.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: HostedRunStatus, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): HostedRunStatus;
static deserializeBinaryFromReader(message: HostedRunStatus, reader: jspb.BinaryReader): HostedRunStatus;
}
export namespace HostedRunStatus {
export type AsObject = {
state: HostedRunStatus.State,
}
export enum State {
IN_PROGRESS = 0,
SUCCESS = 1,
INTERNAL_FAILURE = 2,
}
}
export class MachineRequirements extends jspb.Message {
getMachineType(): string;
setMachineType(value: string): MachineRequirements;
hasKeepAlive(): boolean;
clearKeepAlive(): void;
getKeepAlive(): number | undefined;
setKeepAlive(value: number): MachineRequirements;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): MachineRequirements.AsObject;
static toObject(includeInstance: boolean, msg: MachineRequirements): MachineRequirements.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: MachineRequirements, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): MachineRequirements;
static deserializeBinaryFromReader(message: MachineRequirements, reader: jspb.BinaryReader): MachineRequirements;
}
export namespace MachineRequirements {
export type AsObject = {
machineType: string,
keepAlive?: number,
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,41 +0,0 @@
// package:
// file: server.proto
/* tslint:disable */
/* eslint-disable */
import * as grpc from "@grpc/grpc-js";
import * as server_pb from "./server_pb";
import * as common_pb from "./common_pb";
import * as google_protobuf_struct_pb from "google-protobuf/google/protobuf/struct_pb";
interface IIsolateService extends grpc.ServiceDefinition<grpc.UntypedServiceImplementation> {
run: IIsolateService_IRun;
}
interface IIsolateService_IRun extends grpc.MethodDefinition<server_pb.BoundFunction, common_pb.PartialRunResult> {
path: "/Isolate/Run";
requestStream: false;
responseStream: true;
requestSerialize: grpc.serialize<server_pb.BoundFunction>;
requestDeserialize: grpc.deserialize<server_pb.BoundFunction>;
responseSerialize: grpc.serialize<common_pb.PartialRunResult>;
responseDeserialize: grpc.deserialize<common_pb.PartialRunResult>;
}
export const IsolateService: IIsolateService;
export interface IIsolateServer extends grpc.UntypedServiceImplementation {
run: grpc.handleServerStreamingCall<server_pb.BoundFunction, common_pb.PartialRunResult>;
}
export interface IIsolateClient {
run(request: server_pb.BoundFunction, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<common_pb.PartialRunResult>;
run(request: server_pb.BoundFunction, metadata?: grpc.Metadata, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<common_pb.PartialRunResult>;
}
export class IsolateClient extends grpc.Client implements IIsolateClient {
constructor(address: string, credentials: grpc.ChannelCredentials, options?: Partial<grpc.ClientOptions>);
public run(request: server_pb.BoundFunction, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<common_pb.PartialRunResult>;
public run(request: server_pb.BoundFunction, metadata?: grpc.Metadata, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<common_pb.PartialRunResult>;
}

View File

@ -1,48 +0,0 @@
// GENERATED CODE -- DO NOT EDIT!
'use strict';
var grpc = require('grpc');
var server_pb = require('./server_pb.js');
var common_pb = require('./common_pb.js');
var google_protobuf_struct_pb = require('google-protobuf/google/protobuf/struct_pb.js');
function serialize_BoundFunction(arg) {
if (!(arg instanceof server_pb.BoundFunction)) {
throw new Error('Expected argument of type BoundFunction');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_BoundFunction(buffer_arg) {
return server_pb.BoundFunction.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_PartialRunResult(arg) {
if (!(arg instanceof common_pb.PartialRunResult)) {
throw new Error('Expected argument of type PartialRunResult');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_PartialRunResult(buffer_arg) {
return common_pb.PartialRunResult.deserializeBinary(new Uint8Array(buffer_arg));
}
var IsolateService = exports.IsolateService = {
// Run the given function on the specified environment. Streams logs
// and the result originating from that function.
run: {
path: '/Isolate/Run',
requestStream: false,
responseStream: true,
requestType: server_pb.BoundFunction,
responseType: common_pb.PartialRunResult,
requestSerialize: serialize_BoundFunction,
requestDeserialize: deserialize_BoundFunction,
responseSerialize: serialize_PartialRunResult,
responseDeserialize: deserialize_PartialRunResult,
},
};
exports.IsolateClient = grpc.makeGenericClientConstructor(IsolateService);

View File

@ -1,72 +0,0 @@
// package:
// file: server.proto
/* tslint:disable */
/* eslint-disable */
import * as jspb from "google-protobuf";
import * as common_pb from "./common_pb";
import * as google_protobuf_struct_pb from "google-protobuf/google/protobuf/struct_pb";
export class BoundFunction extends jspb.Message {
clearEnvironmentsList(): void;
getEnvironmentsList(): Array<EnvironmentDefinition>;
setEnvironmentsList(value: Array<EnvironmentDefinition>): BoundFunction;
addEnvironments(value?: EnvironmentDefinition, index?: number): EnvironmentDefinition;
hasFunction(): boolean;
clearFunction(): void;
getFunction(): common_pb.SerializedObject | undefined;
setFunction(value?: common_pb.SerializedObject): BoundFunction;
hasSetupFunc(): boolean;
clearSetupFunc(): void;
getSetupFunc(): common_pb.SerializedObject | undefined;
setSetupFunc(value?: common_pb.SerializedObject): BoundFunction;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): BoundFunction.AsObject;
static toObject(includeInstance: boolean, msg: BoundFunction): BoundFunction.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: BoundFunction, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): BoundFunction;
static deserializeBinaryFromReader(message: BoundFunction, reader: jspb.BinaryReader): BoundFunction;
}
export namespace BoundFunction {
export type AsObject = {
environmentsList: Array<EnvironmentDefinition.AsObject>,
pb_function?: common_pb.SerializedObject.AsObject,
setupFunc?: common_pb.SerializedObject.AsObject,
}
}
export class EnvironmentDefinition extends jspb.Message {
getKind(): string;
setKind(value: string): EnvironmentDefinition;
hasConfiguration(): boolean;
clearConfiguration(): void;
getConfiguration(): google_protobuf_struct_pb.Struct | undefined;
setConfiguration(value?: google_protobuf_struct_pb.Struct): EnvironmentDefinition;
getForce(): boolean;
setForce(value: boolean): EnvironmentDefinition;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): EnvironmentDefinition.AsObject;
static toObject(includeInstance: boolean, msg: EnvironmentDefinition): EnvironmentDefinition.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: EnvironmentDefinition, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): EnvironmentDefinition;
static deserializeBinaryFromReader(message: EnvironmentDefinition, reader: jspb.BinaryReader): EnvironmentDefinition;
}
export namespace EnvironmentDefinition {
export type AsObject = {
kind: string,
configuration?: google_protobuf_struct_pb.Struct.AsObject,
force: boolean,
}
}

View File

@ -1,539 +0,0 @@
// source: server.proto
/**
* @fileoverview
* @enhanceable
* @suppress {missingRequire} reports error on implicit type usages.
* @suppress {messageConventions} JS Compiler reports an error if a variable or
* field starts with 'MSG_' and isn't a translatable message.
* @public
*/
// GENERATED CODE -- DO NOT EDIT!
/* eslint-disable */
// @ts-nocheck
var jspb = require('google-protobuf');
var goog = jspb;
var global = Function('return this')();
var common_pb = require('./common_pb.js');
goog.object.extend(proto, common_pb);
var google_protobuf_struct_pb = require('google-protobuf/google/protobuf/struct_pb.js');
goog.object.extend(proto, google_protobuf_struct_pb);
goog.exportSymbol('proto.BoundFunction', null, global);
goog.exportSymbol('proto.EnvironmentDefinition', null, global);
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.BoundFunction = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, proto.BoundFunction.repeatedFields_, null);
};
goog.inherits(proto.BoundFunction, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.BoundFunction.displayName = 'proto.BoundFunction';
}
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.EnvironmentDefinition = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.EnvironmentDefinition, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.EnvironmentDefinition.displayName = 'proto.EnvironmentDefinition';
}
/**
* List of repeated fields within this message type.
* @private {!Array<number>}
* @const
*/
proto.BoundFunction.repeatedFields_ = [1];
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.BoundFunction.prototype.toObject = function(opt_includeInstance) {
return proto.BoundFunction.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.BoundFunction} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.BoundFunction.toObject = function(includeInstance, msg) {
var f, obj = {
environmentsList: jspb.Message.toObjectList(msg.getEnvironmentsList(),
proto.EnvironmentDefinition.toObject, includeInstance),
pb_function: (f = msg.getFunction()) && common_pb.SerializedObject.toObject(includeInstance, f),
setupFunc: (f = msg.getSetupFunc()) && common_pb.SerializedObject.toObject(includeInstance, f)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.BoundFunction}
*/
proto.BoundFunction.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.BoundFunction;
return proto.BoundFunction.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.BoundFunction} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.BoundFunction}
*/
proto.BoundFunction.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = new proto.EnvironmentDefinition;
reader.readMessage(value,proto.EnvironmentDefinition.deserializeBinaryFromReader);
msg.addEnvironments(value);
break;
case 2:
var value = new common_pb.SerializedObject;
reader.readMessage(value,common_pb.SerializedObject.deserializeBinaryFromReader);
msg.setFunction(value);
break;
case 3:
var value = new common_pb.SerializedObject;
reader.readMessage(value,common_pb.SerializedObject.deserializeBinaryFromReader);
msg.setSetupFunc(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.BoundFunction.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.BoundFunction.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.BoundFunction} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.BoundFunction.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getEnvironmentsList();
if (f.length > 0) {
writer.writeRepeatedMessage(
1,
f,
proto.EnvironmentDefinition.serializeBinaryToWriter
);
}
f = message.getFunction();
if (f != null) {
writer.writeMessage(
2,
f,
common_pb.SerializedObject.serializeBinaryToWriter
);
}
f = message.getSetupFunc();
if (f != null) {
writer.writeMessage(
3,
f,
common_pb.SerializedObject.serializeBinaryToWriter
);
}
};
/**
* repeated EnvironmentDefinition environments = 1;
* @return {!Array<!proto.EnvironmentDefinition>}
*/
proto.BoundFunction.prototype.getEnvironmentsList = function() {
return /** @type{!Array<!proto.EnvironmentDefinition>} */ (
jspb.Message.getRepeatedWrapperField(this, proto.EnvironmentDefinition, 1));
};
/**
* @param {!Array<!proto.EnvironmentDefinition>} value
* @return {!proto.BoundFunction} returns this
*/
proto.BoundFunction.prototype.setEnvironmentsList = function(value) {
return jspb.Message.setRepeatedWrapperField(this, 1, value);
};
/**
* @param {!proto.EnvironmentDefinition=} opt_value
* @param {number=} opt_index
* @return {!proto.EnvironmentDefinition}
*/
proto.BoundFunction.prototype.addEnvironments = function(opt_value, opt_index) {
return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.EnvironmentDefinition, opt_index);
};
/**
* Clears the list making it empty but non-null.
* @return {!proto.BoundFunction} returns this
*/
proto.BoundFunction.prototype.clearEnvironmentsList = function() {
return this.setEnvironmentsList([]);
};
/**
* optional SerializedObject function = 2;
* @return {?proto.SerializedObject}
*/
proto.BoundFunction.prototype.getFunction = function() {
return /** @type{?proto.SerializedObject} */ (
jspb.Message.getWrapperField(this, common_pb.SerializedObject, 2));
};
/**
* @param {?proto.SerializedObject|undefined} value
* @return {!proto.BoundFunction} returns this
*/
proto.BoundFunction.prototype.setFunction = function(value) {
return jspb.Message.setWrapperField(this, 2, value);
};
/**
* Clears the message field making it undefined.
* @return {!proto.BoundFunction} returns this
*/
proto.BoundFunction.prototype.clearFunction = function() {
return this.setFunction(undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.BoundFunction.prototype.hasFunction = function() {
return jspb.Message.getField(this, 2) != null;
};
/**
* optional SerializedObject setup_func = 3;
* @return {?proto.SerializedObject}
*/
proto.BoundFunction.prototype.getSetupFunc = function() {
return /** @type{?proto.SerializedObject} */ (
jspb.Message.getWrapperField(this, common_pb.SerializedObject, 3));
};
/**
* @param {?proto.SerializedObject|undefined} value
* @return {!proto.BoundFunction} returns this
*/
proto.BoundFunction.prototype.setSetupFunc = function(value) {
return jspb.Message.setWrapperField(this, 3, value);
};
/**
* Clears the message field making it undefined.
* @return {!proto.BoundFunction} returns this
*/
proto.BoundFunction.prototype.clearSetupFunc = function() {
return this.setSetupFunc(undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.BoundFunction.prototype.hasSetupFunc = function() {
return jspb.Message.getField(this, 3) != null;
};
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.EnvironmentDefinition.prototype.toObject = function(opt_includeInstance) {
return proto.EnvironmentDefinition.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.EnvironmentDefinition} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.EnvironmentDefinition.toObject = function(includeInstance, msg) {
var f, obj = {
kind: jspb.Message.getFieldWithDefault(msg, 1, ""),
configuration: (f = msg.getConfiguration()) && google_protobuf_struct_pb.Struct.toObject(includeInstance, f),
force: jspb.Message.getBooleanFieldWithDefault(msg, 3, false)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.EnvironmentDefinition}
*/
proto.EnvironmentDefinition.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.EnvironmentDefinition;
return proto.EnvironmentDefinition.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.EnvironmentDefinition} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.EnvironmentDefinition}
*/
proto.EnvironmentDefinition.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {string} */ (reader.readString());
msg.setKind(value);
break;
case 2:
var value = new google_protobuf_struct_pb.Struct;
reader.readMessage(value,google_protobuf_struct_pb.Struct.deserializeBinaryFromReader);
msg.setConfiguration(value);
break;
case 3:
var value = /** @type {boolean} */ (reader.readBool());
msg.setForce(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.EnvironmentDefinition.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.EnvironmentDefinition.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.EnvironmentDefinition} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.EnvironmentDefinition.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getKind();
if (f.length > 0) {
writer.writeString(
1,
f
);
}
f = message.getConfiguration();
if (f != null) {
writer.writeMessage(
2,
f,
google_protobuf_struct_pb.Struct.serializeBinaryToWriter
);
}
f = message.getForce();
if (f) {
writer.writeBool(
3,
f
);
}
};
/**
* optional string kind = 1;
* @return {string}
*/
proto.EnvironmentDefinition.prototype.getKind = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
};
/**
* @param {string} value
* @return {!proto.EnvironmentDefinition} returns this
*/
proto.EnvironmentDefinition.prototype.setKind = function(value) {
return jspb.Message.setProto3StringField(this, 1, value);
};
/**
* optional google.protobuf.Struct configuration = 2;
* @return {?proto.google.protobuf.Struct}
*/
proto.EnvironmentDefinition.prototype.getConfiguration = function() {
return /** @type{?proto.google.protobuf.Struct} */ (
jspb.Message.getWrapperField(this, google_protobuf_struct_pb.Struct, 2));
};
/**
* @param {?proto.google.protobuf.Struct|undefined} value
* @return {!proto.EnvironmentDefinition} returns this
*/
proto.EnvironmentDefinition.prototype.setConfiguration = function(value) {
return jspb.Message.setWrapperField(this, 2, value);
};
/**
* Clears the message field making it undefined.
* @return {!proto.EnvironmentDefinition} returns this
*/
proto.EnvironmentDefinition.prototype.clearConfiguration = function() {
return this.setConfiguration(undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.EnvironmentDefinition.prototype.hasConfiguration = function() {
return jspb.Message.getField(this, 2) != null;
};
/**
* optional bool force = 3;
* @return {boolean}
*/
proto.EnvironmentDefinition.prototype.getForce = function() {
return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false));
};
/**
* @param {boolean} value
* @return {!proto.EnvironmentDefinition} returns this
*/
proto.EnvironmentDefinition.prototype.setForce = function(value) {
return jspb.Message.setProto3BooleanField(this, 3, value);
};
goog.object.extend(exports, proto);

View File

@ -1,25 +0,0 @@
syntax = "proto3";
import "common.proto";
import "google/protobuf/struct.proto";
service Isolate {
// Run the given function on the specified environment. Streams logs
// and the result originating from that function.
rpc Run (BoundFunction) returns (stream PartialRunResult) {}
}
message BoundFunction {
repeated EnvironmentDefinition environments = 1;
SerializedObject function = 2;
optional SerializedObject setup_func = 3;
}
message EnvironmentDefinition {
// Kind of the isolate environment.
string kind = 1;
// A free-form definition of environment properties.
google.protobuf.Struct configuration = 2;
// Whether to force-create this environment or not.
bool force = 3;
}

Binary file not shown.

View File

@ -1,30 +0,0 @@
from pathlib import Path
from dill import dumps
from koldstart import isolated, KoldstartHost, CloudKeyCredentials
import os
from isolate.connections.common import serialize_object
test_cloud = KoldstartHost(
url=os.environ["KOLDSTART_HOST"],
credentials=CloudKeyCredentials(
key_id=os.environ["KOLDSTART_KEY_ID"],
key_secret=os.environ["KOLDSTART_KEY_SECRET"],
),
)
def stable_diffusion():
print("this is happening from proto update")
# @isolated(host=test_cloud)
def buff():
print("this is happening from proto update")
path = Path(
"/Users/gorkemyurtseven/dev/koldstart-playground/koldstart-javascript/python.dump"
).expanduser()
with open(path, "wb") as f:
print(serialize_object("dill", buff))
f.write(serialize_object("dill", buff))

View File

12
tools/tsconfig.tools.json Normal file
View File

@ -0,0 +1,12 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"outDir": "../dist/out-tsc/tools",
"rootDir": ".",
"module": "commonjs",
"target": "es5",
"types": ["node"],
"importHelpers": false
},
"include": ["**/*.ts"]
}

23
tsconfig.base.json Normal file
View File

@ -0,0 +1,23 @@
{
"compileOnSave": false,
"compilerOptions": {
"rootDir": ".",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"importHelpers": true,
"target": "es2015",
"module": "esnext",
"lib": ["es2017", "dom"],
"skipLibCheck": true,
"skipDefaultLibCheck": true,
"baseUrl": ".",
"paths": {
"@fal/serverless-client": ["libs/client/src/index.ts"],
"@fal/serverless-codegen": ["libs/codegen/src/index.ts"]
}
},
"exclude": ["node_modules", "tmp"]
}