Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
432 changes: 431 additions & 1 deletion README.md

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions bun.lock

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

34 changes: 34 additions & 0 deletions clients/typescript/.gitignore
Original file line number Diff line number Diff line change
@@ -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
21 changes: 21 additions & 0 deletions clients/typescript/README.md
Original file line number Diff line number Diff line change
@@ -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.

<div align="center">
<sub>Built with ❤️ by <a href="https://metorial.com">Metorial</a></sub>
</div>
20 changes: 20 additions & 0 deletions clients/typescript/dts-bundle-generator.config.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
}
]
}
42 changes: 42 additions & 0 deletions clients/typescript/package.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
5 changes: 5 additions & 0 deletions clients/typescript/src/index.ts
Original file line number Diff line number Diff line change
@@ -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<FunctionBayClient>(o);
15 changes: 15 additions & 0 deletions clients/typescript/tsconfig.dts.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
36 changes: 36 additions & 0 deletions clients/typescript/tsconfig.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
16 changes: 0 additions & 16 deletions service/src/controllers/function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion service/src/forge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { db } from './db';
import { env } from './env';
import { snowflake } from './id';

export let forge = createForgeClient({
export let forge: ReturnType<typeof createForgeClient> = createForgeClient({
endpoint: env.forge.FORGE_API_URL
});

Expand Down
3 changes: 2 additions & 1 deletion service/src/providers/_lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion service/src/providers/aws-lambda/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export let getRuntime = async (
spec: FunctionBayRuntimeSpec
): Promise<{
runtime: Runtime;
spec: FunctionBayRuntimeConfig;
spec: FunctionBayRuntimeSpec;
layer: FunctionBayLayer;
workflow: ForgeWorkflowStep[];
identifier: string;
Expand Down
2 changes: 1 addition & 1 deletion service/src/queues/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
);

Expand Down
10 changes: 0 additions & 10 deletions service/src/services/function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down