From 85611e77afbf35417c825be4954129742de1cb12 Mon Sep 17 00:00:00 2001 From: Tobias Herber <22559657+herber@users.noreply.github.com> Date: Sun, 28 Dec 2025 19:19:47 +0100 Subject: [PATCH 1/3] Add readme --- README.md | 432 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 431 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 06063ab..01f764e 100644 --- a/README.md +++ b/README.md @@ -1 +1,431 @@ -# function-bay \ No newline at end of file +# Function Bay + +Function Bay is a serverless function deployment and orchestration service that wraps cloud function providers (like AWS Lambda) to provide a unified API for deploying, versioning, invoking, and managing serverless functions. + +## Features + +- **Multi-Provider Support**: Currently supports AWS Lambda with extensible architecture for additional providers +- **Function Management**: Define, version, and manage serverless functions with configurations +- **Deployment Orchestration**: Automated deployment workflows with build tracking and logging via Forge +- **Runtime Support**: Multiple runtime environments including Node.js, Python, Ruby, and Java +- **Function Invocation**: Direct function invocation with payload support and detailed logging +- **Version Control**: Track and manage different versions of your functions +- **Instance Isolation**: Multi-tenant support with instance-based resource isolation +- **Configuration Management**: Memory, timeout, and environment variable configuration per deployment + +## Quick Start + +### Using Docker Compose + +Create a `docker-compose.yml` file: + +```yaml +version: '3.8' + +services: + postgres: + image: postgres:16-alpine + environment: + POSTGRES_USER: function-bay + POSTGRES_PASSWORD: function-bay + POSTGRES_DB: function-bay + volumes: + - postgres_data:/var/lib/postgresql/data + networks: + - function-bay-network + + redis: + image: redis:7-alpine + networks: + - function-bay-network + + object-storage: + image: ghcr.io/metorial/object-storage:latest + ports: + - "52010:52010" + volumes: + - object-store-data:/app/data + environment: + RUST_LOG: info + OBJECT_STORE__SERVER__HOST: 0.0.0.0 + OBJECT_STORE__SERVER__PORT: 52010 + OBJECT_STORE__BACKEND__TYPE: local + networks: + - function-bay-network + + forge: + image: ghcr.io/metorial/forge:latest + ports: + - "52020:52020" + environment: + DATABASE_URL: postgresql://function-bay:function-bay@postgres:5432/forge + REDIS_URL: redis://redis:6379/0 + ENCRYPTION_KEY: ${ENCRYPTION_KEY} + DEFAULT_PROVIDER: aws.code-build + OBJECT_STORAGE_URL: http://object-storage:52010 + LOG_BUCKET_NAME: logs + ARTIFACT_BUCKET_NAME: artifacts + CODE_BUILD_AWS_REGION: ${CODE_BUILD_AWS_REGION} + CODE_BUILD_AWS_ACCESS_KEY_ID: ${CODE_BUILD_AWS_ACCESS_KEY_ID} + CODE_BUILD_AWS_SECRET_ACCESS_KEY: ${CODE_BUILD_AWS_SECRET_ACCESS_KEY} + CODE_BUILD_PROJECT_NAME: ${CODE_BUILD_PROJECT_NAME} + CODE_BUILD_ROLE_ARN: ${CODE_BUILD_ROLE_ARN} + depends_on: + - postgres + - redis + - object-storage + networks: + - function-bay-network + + function-bay: + image: ghcr.io/metorial/function-bay:latest + ports: + - "52030:52030" + environment: + DATABASE_URL: postgresql://function-bay:function-bay@postgres:5432/function-bay + REDIS_URL: redis://redis:6379/0 + ENCRYPTION_KEY: ${ENCRYPTION_KEY} + DEFAULT_PROVIDER: ${DEFAULT_PROVIDER} + OBJECT_STORAGE_URL: http://object-storage:52010 + BUNDLE_BUCKET_NAME: bundles + FORGE_API_URL: http://forge:52020/metorial-forge + LAMBDA_AWS_REGION: ${LAMBDA_AWS_REGION} + LAMBDA_AWS_ACCESS_KEY_ID: ${LAMBDA_AWS_ACCESS_KEY_ID} + LAMBDA_AWS_SECRET_ACCESS_KEY: ${LAMBDA_AWS_SECRET_ACCESS_KEY} + LAMBDA_ROLE_ARN: ${LAMBDA_ROLE_ARN} + depends_on: + - postgres + - redis + - object-storage + - forge + networks: + - function-bay-network + +volumes: + postgres_data: + object-store-data: + +networks: + function-bay-network: + driver: bridge +``` + +Create a `.env` file: + +```bash +# Generate a random 32-character encryption key +ENCRYPTION_KEY=your-32-character-encryption-key + +# Default provider (aws.lambda or gcp.cloud-functions or azure.functions) +DEFAULT_PROVIDER=aws.lambda + +# AWS Lambda Configuration +LAMBDA_AWS_REGION=us-east-1 +LAMBDA_AWS_ACCESS_KEY_ID=your-access-key +LAMBDA_AWS_SECRET_ACCESS_KEY=your-secret-key +LAMBDA_ROLE_ARN=arn:aws:iam::account:role/your-lambda-role + +# AWS CodeBuild Configuration (for Forge) +CODE_BUILD_AWS_REGION=us-east-1 +CODE_BUILD_AWS_ACCESS_KEY_ID=your-access-key +CODE_BUILD_AWS_SECRET_ACCESS_KEY=your-secret-key +CODE_BUILD_PROJECT_NAME=your-project-name +CODE_BUILD_ROLE_ARN=arn:aws:iam::account:role/your-codebuild-role +``` + +Start the services: + +```bash +docker-compose up -d +``` + +The Function Bay service will be available at `http://localhost:52030` + +## TypeScript Client + +### Installation + +```bash +npm install @metorial-services/function-bay-client +yarn add @metorial-services/function-bay-client +bun add @metorial-services/function-bay-client +``` + +### Basic Usage + +```typescript +import { createFunctionBayClient } from '@metorial-services/function-bay-client'; + +let client = createFunctionBayClient({ + endpoint: 'http://localhost:52030', +}); +``` + +### Core API Examples + +#### 1. Instance Management + +Instances represent isolated tenants or projects: + +```typescript +// Create/update an instance +let instance = await client.instance.upsert({ + name: 'My Project', + identifier: 'my-project', +}); + +// Get an instance +let retrievedInstance = await client.instance.get({ + instanceId: instance.id, +}); +``` + +#### 2. Runtime Management + +List available runtimes for your functions: + +```typescript +// List available runtimes +let runtimes = await client.runtime.list({ + instanceId: instance.id, + limit: 10, + order: 'desc', +}); + +// Get a specific runtime +let runtime = await client.runtime.get({ + runtimeId: runtimes.items[0].id, +}); + +console.log('Runtime:', runtime.identifier); +console.log('Specification:', runtime.specification); +``` + +#### 3. Function Management + +Functions define serverless function resources: + +```typescript +// Create/update a function +let func = await client.function.upsert({ + instanceId: instance.id, + name: 'My API Handler', + identifier: 'api-handler', +}); + +// List functions +let functions = await client.function.list({ + instanceId: instance.id, + limit: 10, + order: 'desc', +}); + +// Get a specific function +let functionDetails = await client.function.get({ + instanceId: instance.id, + functionId: func.id, +}); + +// Update a function +let updated = await client.function.update({ + instanceId: instance.id, + functionId: func.id, + name: 'Updated API Handler', +}); +``` + +#### 4. Function Deployments + +Deploy function code with specific runtime and configuration: + +```typescript +// Create a deployment +let deployment = await client.functionDeployment.create({ + instanceId: instance.id, + functionId: func.id, + name: 'v1.0.0', + runtime: { + identifier: 'nodejs', + version: '24.x', + }, + config: { + memorySizeMb: 512, + timeoutSeconds: 30, + }, + env: { + NODE_ENV: 'production', + API_KEY: 'your-api-key', + }, + files: [ + { + filename: 'index.js', + content: ` + export const handler = async (event) => { + return { + statusCode: 200, + body: JSON.stringify({ message: 'Hello from Function Bay!' }), + }; + }; + `, + encoding: 'utf-8', + }, + { + filename: 'package.json', + content: JSON.stringify({ + name: 'my-function', + type: 'module', + }), + encoding: 'utf-8', + }, + ], +}); + +console.log('Deployment ID:', deployment.id); +console.log('Status:', deployment.status); + +// List deployments +let deployments = await client.functionDeployment.list({ + instanceId: instance.id, + functionId: func.id, + limit: 20, + order: 'desc', +}); + +// Get deployment details +let deploymentDetails = await client.functionDeployment.get({ + instanceId: instance.id, + functionId: func.id, + functionDeploymentId: deployment.id, +}); + +console.log('Deployment:', deploymentDetails); +console.log('Runtime:', deploymentDetails.runtime); +console.log('Version:', deploymentDetails.version); +``` + +#### 5. Accessing Deployment Logs + +Retrieve build and deployment logs: + +```typescript +// Get all deployment step outputs +let outputs = await client.functionDeployment.getOutput({ + instanceId: instance.id, + functionId: func.id, + functionDeploymentId: deployment.id, +}); + +for (let output of outputs) { + console.log(`Step: ${output.name}`); + console.log(`Status: ${output.status}`); + console.log(`Type: ${output.type}`); + console.log('Logs:'); + for (let log of output.logs) { + console.log(` [${new Date(log.timestamp)}] ${log.message}`); + } + console.log('---'); +} +``` + +#### 6. Function Versions + +List and manage deployed function versions: + +```typescript +// List function versions +let versions = await client.functionVersion.list({ + instanceId: instance.id, + functionId: func.id, + limit: 10, + order: 'desc', +}); + +for (let version of versions.items) { + console.log('Version:', version.name); + console.log('Is Current:', version.isCurrent); + console.log('Runtime:', version.runtime.specification); + console.log('Configuration:', version.configuration); +} + +// Get a specific version +let version = await client.functionVersion.get({ + instanceId: instance.id, + functionId: func.id, + functionVersionId: versions.items[0].id, +}); +``` + +#### 7. Invoking Functions + +Execute deployed functions with custom payloads: + +```typescript +// Invoke a function +let invocation = await client.function.invoke({ + instanceId: instance.id, + functionId: func.id, + payload: { + action: 'process', + data: { userId: '123', operation: 'update' }, + }, +}); + +if (invocation.type === 'success') { + console.log('Result:', invocation.result); +} else { + console.error('Error:', invocation.error); +} +``` + +#### 8. Function Invocation History + +View invocation logs and metrics: + +```typescript +// List function invocations +let invocations = await client.functionInvocation.list({ + instanceId: instance.id, + functionId: func.id, + limit: 20, + order: 'desc', +}); + +for (let inv of invocations.items) { + console.log('Invocation ID:', inv.id); + console.log('Status:', inv.status); + console.log('Compute Time:', inv.computeTimeMs, 'ms'); + console.log('Billed Time:', inv.billedTimeMs, 'ms'); + console.log('Logs:', inv.logs); + if (inv.error) { + console.log('Error:', inv.error); + } +} + +// Get detailed invocation information +let invocationDetails = await client.functionInvocation.get({ + instanceId: instance.id, + functionId: func.id, + functionInvocationId: invocations.items[0].id, +}); + +console.log('Full invocation details:', invocationDetails); +console.log('Function Version:', invocationDetails.functionVersionId); +``` + +#### 9. Provider Information + +```typescript +// Get the default provider configuration +let provider = await client.provider.getDefault(); + +console.log('Provider:', provider.identifier); +console.log('Provider ID:', provider.id); +``` + +## License + +This project is licensed under the Apache License 2.0. + +
+ Built with ❤️ by Metorial +
From 31dbf757eddb1add674a750eb5ddcf252893e618 Mon Sep 17 00:00:00 2001 From: Tobias Herber <22559657+herber@users.noreply.github.com> Date: Sun, 28 Dec 2025 19:19:56 +0100 Subject: [PATCH 2/3] Add ts client --- clients/typescript/.gitignore | 34 +++++++++++++++ clients/typescript/README.md | 21 ++++++++++ .../dts-bundle-generator.config.json | 20 +++++++++ clients/typescript/package.json | 42 +++++++++++++++++++ clients/typescript/src/index.ts | 5 +++ clients/typescript/tsconfig.dts.json | 15 +++++++ clients/typescript/tsconfig.json | 36 ++++++++++++++++ 7 files changed, 173 insertions(+) create mode 100644 clients/typescript/.gitignore create mode 100644 clients/typescript/README.md create mode 100644 clients/typescript/dts-bundle-generator.config.json create mode 100644 clients/typescript/package.json create mode 100644 clients/typescript/src/index.ts create mode 100644 clients/typescript/tsconfig.dts.json create mode 100644 clients/typescript/tsconfig.json diff --git a/clients/typescript/.gitignore b/clients/typescript/.gitignore new file mode 100644 index 0000000..a14702c --- /dev/null +++ b/clients/typescript/.gitignore @@ -0,0 +1,34 @@ +# dependencies (bun install) +node_modules + +# output +out +dist +*.tgz + +# code coverage +coverage +*.lcov + +# logs +logs +_.log +report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json + +# dotenv environment variable files +.env +.env.development.local +.env.test.local +.env.production.local +.env.local + +# caches +.eslintcache +.cache +*.tsbuildinfo + +# IntelliJ based IDEs +.idea + +# Finder (MacOS) folder config +.DS_Store diff --git a/clients/typescript/README.md b/clients/typescript/README.md new file mode 100644 index 0000000..3e14303 --- /dev/null +++ b/clients/typescript/README.md @@ -0,0 +1,21 @@ +# Metorial Function Bay Client + +A client library for interacting with the Metorial Function Bay platform using TypeScript. + +## Usage + +```ts +import { createFunctionBayClient } from '@lowerdeck/forge-client'; + +let forge = createFunctionBayClient({ + endpoint: '...' +}); +``` + +## License + +This project is licensed under the Apache License 2.0. + +
+ Built with ❤️ by Metorial +
diff --git a/clients/typescript/dts-bundle-generator.config.json b/clients/typescript/dts-bundle-generator.config.json new file mode 100644 index 0000000..591df27 --- /dev/null +++ b/clients/typescript/dts-bundle-generator.config.json @@ -0,0 +1,20 @@ +{ + "compilationOptions": { + "preferredConfigPath": "./tsconfig.dts.json" + }, + "entries": [ + { + "filePath": "./src/index.ts", + "outFile": "./dist/index.d.ts", + "noCheck": true, + "libraries": { + "inlinedLibraries": [ + "@lowerdeck/rpc-client", + "@lowerdeck/rpc-server", + "@lowerdeck/validation", + "object-storage-client" + ] + } + } + ] +} \ No newline at end of file diff --git a/clients/typescript/package.json b/clients/typescript/package.json new file mode 100644 index 0000000..c07b80a --- /dev/null +++ b/clients/typescript/package.json @@ -0,0 +1,42 @@ +{ + "name": "@metorial-services/function-bay-client", + "version": "1.0.0", + "publishConfig": { + "access": "public" + }, + "files": [ + "src/**", + "dist/**", + "README.md", + "package.json" + ], + "author": "Tobias Herber", + "license": "Apache 2", + "type": "module", + "source": "src/index.ts", + "exports": { + "types": "./dist/index.d.ts", + "require": "./dist/index.cjs", + "import": "./dist/index.module.js", + "default": "./dist/index.module.js" + }, + "main": "./dist/index.cjs", + "module": "./dist/index.module.js", + "types": "dist/index.d.ts", + "unpkg": "./dist/index.umd.js", + "scripts": { + "test": "vitest run --passWithNoTests", + "lint": "prettier src/**/*.ts --check", + "build": "rm -rf ./dist && microbundle && dts-bundle-generator --config dts-bundle-generator.config.json", + "prepublish": "bun run build" + }, + "dependencies": { + "@lowerdeck/rpc-client": "^1.0.2" + }, + "devDependencies": { + "dts-bundle-generator": "^9.5.1", + "microbundle": "^0.15.1", + "typescript": "^5.8.3", + "vitest": "^3.1.2" + } +} \ No newline at end of file diff --git a/clients/typescript/src/index.ts b/clients/typescript/src/index.ts new file mode 100644 index 0000000..6a3efeb --- /dev/null +++ b/clients/typescript/src/index.ts @@ -0,0 +1,5 @@ +import { createClient } from '@lowerdeck/rpc-client'; +import { ClientOpts } from '@lowerdeck/rpc-client/dist/shared/clientBuilder'; +import type { FunctionBayClient } from '../../../service/src/controllers'; + +export let createFunctionBayClient = (o: ClientOpts) => createClient(o); diff --git a/clients/typescript/tsconfig.dts.json b/clients/typescript/tsconfig.dts.json new file mode 100644 index 0000000..40ffb71 --- /dev/null +++ b/clients/typescript/tsconfig.dts.json @@ -0,0 +1,15 @@ +{ + "$schema": "https://json.schemastore.org/tsconfig", + "extends": "./tsconfig.json", + "compilerOptions": { + "skipLibCheck": true, + "noEmit": true, + "skipDefaultLibCheck": true, + "types": [] + }, + "exclude": [ + "dist", + "node_modules", + "../../node_modules/bun-types" + ] +} diff --git a/clients/typescript/tsconfig.json b/clients/typescript/tsconfig.json new file mode 100644 index 0000000..1835d16 --- /dev/null +++ b/clients/typescript/tsconfig.json @@ -0,0 +1,36 @@ +{ + "$schema": "https://json.schemastore.org/tsconfig", + "display": "Default", + "include": [ + "src" + ], + "compilerOptions": { + "outDir": "dist", + "composite": false, + "declaration": true, + "declarationMap": true, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "inlineSources": false, + "isolatedModules": true, + "moduleResolution": "node", + "module": "esnext", + "lib": [ + "ESNext", + "DOM", + "DOM.Iterable" + ], + "target": "ESNext", + "noUnusedLocals": false, + "noUnusedParameters": false, + "preserveWatchOutput": true, + "skipLibCheck": true, + "strict": true, + "downlevelIteration": true, + "resolveJsonModule": true, + }, + "exclude": [ + "dist", + "node_modules" + ] +} \ No newline at end of file From 62d17a86178af157c30590d3480895b37aa52aa6 Mon Sep 17 00:00:00 2001 From: Tobias Herber <22559657+herber@users.noreply.github.com> Date: Sun, 28 Dec 2025 19:20:06 +0100 Subject: [PATCH 3/3] Fix types --- bun.lock | 21 +++++++++++++++++++++ service/src/controllers/function.ts | 16 ---------------- service/src/forge.ts | 2 +- service/src/providers/_lib.ts | 3 ++- service/src/providers/aws-lambda/runtime.ts | 2 +- service/src/queues/build.ts | 2 +- service/src/services/function.ts | 10 ---------- 7 files changed, 26 insertions(+), 30 deletions(-) diff --git a/bun.lock b/bun.lock index 0c73e35..c7174d7 100644 --- a/bun.lock +++ b/bun.lock @@ -13,6 +13,19 @@ "typescript": "5.8.2", }, }, + "clients/typescript": { + "name": "@metorial-services/function-bay-client", + "version": "1.0.0", + "dependencies": { + "@lowerdeck/rpc-client": "^1.0.2", + }, + "devDependencies": { + "dts-bundle-generator": "^9.5.1", + "microbundle": "^0.15.1", + "typescript": "^5.8.3", + "vitest": "^3.1.2", + }, + }, "packages/build": { "name": "@function-bay/build", "version": "1.0.0", @@ -561,6 +574,8 @@ "@metorial-services/forge-client": ["@metorial-services/forge-client@1.0.0", "", { "dependencies": { "@lowerdeck/rpc-client": "^1.0.2" } }, "sha512-NrF0toUFs1W5v1gqzS+tK2EJzmuOhWroOsvnm29Mhf+OuYpE+YJDbMQEtlS+VhplYTruujOIz4GeRHwgvpzG5g=="], + "@metorial-services/function-bay-client": ["@metorial-services/function-bay-client@workspace:clients/typescript"], + "@mrleebo/prisma-ast": ["@mrleebo/prisma-ast@0.12.1", "", { "dependencies": { "chevrotain": "^10.5.0", "lilconfig": "^2.1.0" } }, "sha512-JwqeCQ1U3fvccttHZq7Tk0m/TMC6WcFAQZdukypW3AzlJYKYTGNVd1ANU2GuhKnv4UQuOFj3oAl0LLG/gxFN1w=="], "@msgpackr-extract/msgpackr-extract-darwin-arm64": ["@msgpackr-extract/msgpackr-extract-darwin-arm64@3.0.3", "", { "os": "darwin", "cpu": "arm64" }, "sha512-QZHtlVgbAdy2zAqNA9Gu1UpIuI8Xvsd1v8ic6B2pZmeFnFcMWiPLfWXh7TVw4eGEZ/C9TH281KwhVoeQUKbyjw=="], @@ -1007,6 +1022,8 @@ "dotenv": ["dotenv@16.6.1", "", {}, "sha512-uBq4egWHTcTt33a72vpSG0z3HnPuIl6NqYcTrKEg2azoEyl2hpW0zqlxysq2pK9HlDIHyHyakeYaYnSAwd8bow=="], + "dts-bundle-generator": ["dts-bundle-generator@9.5.1", "", { "dependencies": { "typescript": ">=5.0.2", "yargs": "^17.6.0" }, "bin": { "dts-bundle-generator": "dist/bin/dts-bundle-generator.js" } }, "sha512-DxpJOb2FNnEyOzMkG11sxO2dmxPjthoVWxfKqWYJ/bI/rT1rvTMktF5EKjAYrRZu6Z6t3NhOUZ0sZ5ZXevOfbA=="], + "dunder-proto": ["dunder-proto@1.0.1", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.1", "es-errors": "^1.3.0", "gopd": "^1.2.0" } }, "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A=="], "duplexer": ["duplexer@0.1.1", "", {}, "sha512-sxNZ+ljy+RA1maXoUReeqBBpBC6RLKmg5ewzV+x+mSETmWNoKdZN6vcQjpFROemza23hGFskJtFNoUWUaQ+R4Q=="], @@ -1881,6 +1898,8 @@ "@lowerdeck/redis/p-queue": ["p-queue@9.0.1", "", { "dependencies": { "eventemitter3": "^5.0.1", "p-timeout": "^7.0.0" } }, "sha512-RhBdVhSwJb7Ocn3e8ULk4NMwBEuOxe+1zcgphUy9c2e5aR/xbEsdVXxHJ3lynw6Qiqu7OINEyHlZkiblEpaq7w=="], + "@metorial-services/function-bay-client/typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="], + "@mrleebo/prisma-ast/lilconfig": ["lilconfig@2.1.0", "", {}, "sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ=="], "@prisma/dev/std-env": ["std-env@3.9.0", "", {}, "sha512-UGvjygr6F6tpH7o2qyqR6QYpwraIjKSdtzyBdyytFOHmPZY917kwdwLG0RbOjWOnKmnm3PeHjaoLLMie7kPLQw=="], @@ -1927,6 +1946,8 @@ "cssnano/yaml": ["yaml@1.10.2", "", {}, "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg=="], + "dts-bundle-generator/typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="], + "figures/escape-string-regexp": ["escape-string-regexp@1.0.5", "", {}, "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg=="], "filelist/minimatch": ["minimatch@5.1.6", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g=="], diff --git a/service/src/controllers/function.ts b/service/src/controllers/function.ts index 5ebf3f5..783bc90 100644 --- a/service/src/controllers/function.ts +++ b/service/src/controllers/function.ts @@ -69,22 +69,6 @@ export let functionController = app.controller({ ) .do(async ctx => functionPresenter(ctx.function)), - delete: functionApp - .handler() - .input( - v.object({ - instanceId: v.string(), - functionId: v.string() - }) - ) - .do(async ctx => { - let func = await functionService.deleteFunction({ - function: ctx.function - }); - - return functionPresenter(func); - }), - update: functionApp .handler() .input( diff --git a/service/src/forge.ts b/service/src/forge.ts index 17a66ed..36c64ba 100644 --- a/service/src/forge.ts +++ b/service/src/forge.ts @@ -6,7 +6,7 @@ import { db } from './db'; import { env } from './env'; import { snowflake } from './id'; -export let forge = createForgeClient({ +export let forge: ReturnType = createForgeClient({ endpoint: env.forge.FORGE_API_URL }); diff --git a/service/src/providers/_lib.ts b/service/src/providers/_lib.ts index 793d821..e0d25b2 100644 --- a/service/src/providers/_lib.ts +++ b/service/src/providers/_lib.ts @@ -13,7 +13,8 @@ import type { import type { ForgeWorkflowStep } from '../forge'; export interface ProviderRuntimeResult { - runtime: FunctionBayRuntimeConfig; + runtime: Runtime; + spec: FunctionBayRuntimeSpec; layer: FunctionBayLayer; workflow: ForgeWorkflowStep[]; identifier: string; diff --git a/service/src/providers/aws-lambda/runtime.ts b/service/src/providers/aws-lambda/runtime.ts index 0e6bc20..540f155 100644 --- a/service/src/providers/aws-lambda/runtime.ts +++ b/service/src/providers/aws-lambda/runtime.ts @@ -29,7 +29,7 @@ export let getRuntime = async ( spec: FunctionBayRuntimeSpec ): Promise<{ runtime: Runtime; - spec: FunctionBayRuntimeConfig; + spec: FunctionBayRuntimeSpec; layer: FunctionBayLayer; workflow: ForgeWorkflowStep[]; identifier: string; diff --git a/service/src/queues/build.ts b/service/src/queues/build.ts index 64a9fab..8aabf59 100644 --- a/service/src/queues/build.ts +++ b/service/src/queues/build.ts @@ -414,7 +414,7 @@ let uploadBundleQueueProcessor = uploadBundleQueue.process(async data => { await storage.putObject( bucket, storageKey, - await fetch(data.outputUrl).then(res => Readable.fromWeb(res.body!) as any), + await fetch(data.outputUrl).then(res => Readable.fromWeb(res.body! as any) as any), 'application/zip' ); diff --git a/service/src/services/function.ts b/service/src/services/function.ts index 9e9a7a4..48f5667 100644 --- a/service/src/services/function.ts +++ b/service/src/services/function.ts @@ -81,16 +81,6 @@ class functionServiceImpl { include }); } - - async deleteFunction(d: { function: Function }) { - throw new Error('Not implemented'); - - return await db.function.update({ - where: { oid: d.function.oid }, - data: { status: 'deleted' }, - include - }); - } } export let functionService = Service.create(