-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e5e479b
commit 801e4af
Showing
6 changed files
with
46 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import * as pkg from 'pkg' | ||
import { Function } from 'synapse:srl/compute' | ||
import { test, expectEqual } from 'synapse:test' | ||
|
||
const client = pkg.createClient() | ||
|
||
const fn = new Function(async (key: string) => { | ||
return client.get(key) | ||
}) | ||
|
||
test('client puts and gets', async () => { | ||
await client.put('foo', 'bar') | ||
expectEqual(await fn('foo'), 'bar') | ||
}) | ||
|
||
// !commands | ||
// (cd pkg && synapse deploy) | ||
// synapse test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"dependencies": { | ||
"pkg": "file:pkg" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Bucket } from 'synapse:srl/storage' | ||
|
||
const b = new Bucket() | ||
|
||
export function createClient() { | ||
function get(key: string) { | ||
return b.get(key, 'utf-8') | ||
} | ||
|
||
function put(key: string, data: string) { | ||
return b.put(key, data) | ||
} | ||
|
||
return { get, put } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"exports": "./main.ts" | ||
} |