Skip to content

Merge #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 179 commits into from
Jul 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
179 commits
Select commit Hold shift + click to select a range
ea38578
Publish js-docker-isolation-provider at deepf in DockerHub.
Konard Feb 12, 2022
b1da169
Actions Enabled.
Konard Feb 12, 2022
b0cf987
gql tag available in handler
ivansglazunov Feb 12, 2022
5507705
0.0.2
ivansglazunov Feb 12, 2022
68ff95c
0.0.3
ivansglazunov Feb 12, 2022
a5288a6
0.0.4
ivansglazunov Feb 13, 2022
b178cff
Update dockerize.yaml
Menzorg Feb 18, 2022
2ff7037
h 13 dl 55
ivansglazunov Mar 1, 2022
231031d
update versions
ivansglazunov Mar 1, 2022
bcccb7a
http-call route is added. https://github.com/deep-foundation/deeplink…
Konard May 9, 2022
113763e
Typo repair. https://github.com/deep-foundation/deeplinks/issues/64
Konard May 9, 2022
a95cf82
Parsing of options is enabled. https://github.com/deep-foundation/dee…
Konard May 9, 2022
d279c30
dl 0.0.67
ivansglazunov May 24, 2022
04ac916
Merge branch 'main' of https://github.com/deep-foundation/js-docker-i…
ivansglazunov May 24, 2022
30ae5d1
dl 0.0.68
ivansglazunov May 25, 2022
346cc9c
Create LICENSE
Konard Jun 15, 2022
502b552
0.0.5
ivansglazunov Jun 25, 2022
6bb4b0a
passport
ivansglazunov Jul 8, 2022
65592dc
fix
ivansglazunov Jul 8, 2022
8e53e81
passport-google-oidc
ivansglazunov Jul 8, 2022
fbc977c
passport-local
ivansglazunov Jul 8, 2022
26633b2
npm
ivansglazunov Jul 8, 2022
b8bf980
fix token and linkId
ivansglazunov Jul 11, 2022
6587e71
temporary ivansglazunov branch
ivansglazunov Jul 11, 2022
c3abd72
update dl
ivansglazunov Jul 11, 2022
fb7b5ba
update dl
ivansglazunov Jul 12, 2022
17c41fe
dl 0.0.71
ivansglazunov Jul 12, 2022
c1a7d45
dl 0.0.72
ivansglazunov Jul 12, 2022
e22fc1b
axios
ivansglazunov Jul 26, 2022
e1d7fc2
react and typescript dep
ivansglazunov Jul 29, 2022
4591462
add crypto to package.json
suenot Jul 31, 2022
7f95165
Merge pull request #1 from suenot/patch-1
Konard Jul 31, 2022
df60327
rebuild package-lock.json
suenot Jul 31, 2022
f7d467a
Merge pull request #2 from suenot/main
Konard Jul 31, 2022
5f49a2b
remove crypto and resore lock.json
Menzorg Aug 1, 2022
b6de4af
gql-handlers deps install
Menzorg Aug 10, 2022
ae63c05
dl 0.0.93
ivansglazunov Aug 15, 2022
7e4a63b
dl 0.0.93
ivansglazunov Aug 15, 2022
8d7f28d
decodeURI options
Menzorg Aug 17, 2022
17e3742
http server for provider
Menzorg Aug 17, 2022
c8e7949
0.0.7
ivansglazunov Oct 19, 2022
0f6bd0d
0.0.7
ivansglazunov Oct 19, 2022
e237546
0.0.8
ivansglazunov Oct 19, 2022
7900077
mathjs
ivansglazunov Dec 5, 2022
a07d4d8
rm passport-esia-esm
ivansglazunov Dec 5, 2022
f6982f4
update
ivansglazunov Feb 2, 2023
ee14cf9
npm install firebase-admin
FreePhoenix888 Feb 7, 2023
4493c65
deeplinks updated to 0.0.108
Konard Feb 11, 2023
b466156
npm install openai
FreePhoenix888 Feb 11, 2023
7c83d2e
@google-cloud/speech && key.json
Romanxz Feb 23, 2023
49aef06
dockerfile copy key.json
Romanxz Feb 23, 2023
2d2be57
@deep-foundation/deeplinks is updated to 0.0.109 version.
Konard Feb 24, 2023
f7c1ddb
google auth env
Romanxz Feb 25, 2023
908b89c
npm install @google-cloud/vision
FreePhoenix888 Mar 2, 2023
6f0e15d
npm install @google-cloud/language
FreePhoenix888 Mar 2, 2023
0a8fdcc
Update openai
FreePhoenix888 Mar 7, 2023
0ab8dfa
Merge branch 'main' of https://github.com/deep-foundation/js-docker-i…
FreePhoenix888 Mar 7, 2023
81c48f9
remove gcloud-speech auth key && env from dockerfile && install gclou…
Romanxz Mar 26, 2023
c439df0
npm install @deep-foundation/deeplinks@latest
FreePhoenix888 Apr 6, 2023
fa6df7f
Add .nvmrc
FreePhoenix888 Apr 7, 2023
83baa3b
discord.js
Romanxz Apr 8, 2023
d103183
convert-audio package installed
Romanxz Apr 19, 2023
ab67b9b
syntetic require
Konard Apr 23, 2023
7039d33
convert-audio is disabled
Konard Apr 23, 2023
636bd77
ffmpeg package
Romanxz Apr 23, 2023
9b956fc
Merge branch 'main' of https://github.com/deep-foundation/js-docker-i…
Romanxz Apr 23, 2023
a8cbd9a
fluent-ffmpeg
Romanxz Apr 23, 2023
e29ffbc
ffmpeg addons
Romanxz Apr 23, 2023
3f275c6
+music-metadata package
Romanxz May 5, 2023
e1cc55c
require patch for music-metadata
Romanxz May 5, 2023
efafea3
replace music-metadata for music-metadata-browser
Romanxz May 5, 2023
85c75c8
music-metadata is added
Konard May 8, 2023
a706ba4
Attempt to repair.
Konard May 8, 2023
9a3cc8b
Another attempt.
Konard May 8, 2023
ed0e641
Attempt to fix
Konard May 8, 2023
5151ced
revert changes.
Konard May 8, 2023
4e72e0e
npm install puppeteer
FreePhoenix888 May 10, 2023
3b822b5
npm install assert
FreePhoenix888 May 11, 2023
7ee169a
gpt-3-encoder package is added
Konard May 19, 2023
fd7a058
nodemailer is installed
Konard May 28, 2023
2e20ab1
npm i
Konard May 28, 2023
17b3712
Update dockerize.yaml
Konard May 28, 2023
69a71df
Update dockerize.yaml
Konard May 28, 2023
79d97f7
Node version is updated to 16.20 in GitHub Actions
Konard May 28, 2023
78e4d35
It is unsafe to publish dockers on pull requests.
Konard Jun 1, 2023
c841641
npm i log
FreePhoenix888 Jun 13, 2023
8b2cfce
"typescript": "^5.0.4"
FreePhoenix888 Jun 15, 2023
32331a8
npm i pretty-format
FreePhoenix888 Jun 19, 2023
9909896
Update .nvmrc
FreePhoenix888 Jul 1, 2023
5ffabfb
`npm i @octokit/graphql`
FreePhoenix888 Jul 7, 2023
4abe94d
Change node version from 16.18 to 18.16.1
FreePhoenix888 Jul 8, 2023
73f402e
passport-telegram dependency is added.
Konard Jul 8, 2023
fc87d83
passport-telegram dependency is removed.
Konard Jul 8, 2023
1f3fc1d
Add/update workflow file .github/workflows/npm-build.yml
FreePhoenix888 Jul 11, 2023
b68d85a
npm i midjourney
FreePhoenix888 Jul 11, 2023
5da3931
@deep-foundation/deeplinks is updated from 0.0.130 to 0.0.212
Konard Jul 11, 2023
514f807
attempt to change into esm modules
Konard Jul 12, 2023
7ddff07
attempt to fix
Konard Jul 12, 2023
31d6e43
attempt to fix
Konard Jul 12, 2023
295e9d3
deep.import demo
Konard Jul 12, 2023
e06169a
require restored
Konard Jul 12, 2023
ec951c9
@deep-foundation/deeplinks from 0.0.212 to 0.0.213.
Konard Jul 12, 2023
0fc0aa0
qrcode,jsqr, jimp packages are added.
Konard Jul 22, 2023
4f81b15
urlencoded & json limit 50mb
Romanxz Jul 28, 2023
bcd928c
body-parser limits
Romanxz Jul 28, 2023
020007a
deeplinks updated
Konard Jul 30, 2023
2d965f0
add rss-parser
CEHR2005 Aug 4, 2023
3d33dfc
Merge pull request #12 from CEHR2005/main
Konard Aug 4, 2023
1237052
deeplinks is updated
Konard Aug 4, 2023
24a8807
inner errors support
Konard Aug 4, 2023
8c7fc17
feat: package telegram
L4legenda Aug 5, 2023
ee1709e
Merge pull request #13 from L4legenda/main
Konard Aug 5, 2023
28fd8d7
update ts-node to 10.9.1 and npm run dev from node_modules
suenot Aug 13, 2023
99c9d26
Update nodemon.json
suenot Aug 13, 2023
217ba83
Merge pull request #16 from suenot/main
FreePhoenix888 Aug 13, 2023
23b283d
deeplinks is updated.
Konard Aug 15, 2023
75f541b
deeplinks is updated
Konard Aug 15, 2023
2976d34
deeplinks is updated.
Konard Aug 15, 2023
8034faf
npm i @freephoenix888/recursive-object-map
FreePhoenix888 Aug 22, 2023
c1961e7
deeplinks is updated
Konard Aug 23, 2023
70fe5ca
No need to explicitly add deep.import anymore.
Konard Aug 25, 2023
109cdbf
deep.import repair.
Konard Aug 26, 2023
440d975
Merge branch 'main' of https://github.com/deep-foundation/js-docker-i…
Konard Aug 26, 2023
502d16e
deeplinks is updated
Konard Aug 28, 2023
6f5875f
npm i compromise
ivansglazunov Sep 2, 2023
80f0899
node version is updated to 18
Konard Sep 2, 2023
0799260
dl295
Konard Sep 6, 2023
aeb55b1
c3.7
Konard Sep 6, 2023
7d4ffde
npm i case-anything
FreePhoenix888 Sep 19, 2023
d02bff8
"@deep-foundation/npm-automation": "^18.1.10"
FreePhoenix888 Sep 20, 2023
87574cf
"@deep-foundation/npm-automation": "^18.1.10"
FreePhoenix888 Sep 20, 2023
f80f93d
Update midjourney
FreePhoenix888 Sep 28, 2023
ff21929
ru-compromise is added
Konard Oct 4, 2023
c393690
unsafe.hasura draft
Konard Oct 9, 2023
3934e2b
Fix https://github.com/deep-foundation/js-docker-isolation-provider/i…
Konard Oct 9, 2023
ac536d5
az library is added
Konard Oct 12, 2023
01fa730
GitPod badge is added
Konard Oct 22, 2023
517ae21
deeplinks is updated to 0.0.320
Konard Oct 22, 2023
66b1f59
an attempt to enable deep.unsafe
Konard Oct 22, 2023
519c410
Added i18next for pluralize
Nov 13, 2023
0113614
Merge pull request #24 from trooper2003/main
Konard Nov 15, 2023
74212ba
Update README.md
Konard Nov 15, 2023
41eb78b
Update README.md
Konard Nov 15, 2023
8d498db
added vk-io
Prinz-Eugen-Deep Nov 24, 2023
be89e30
Merge pull request #26 from Prinz-Eugen-Deep/main
Konard Nov 24, 2023
e5a3395
add i18n-browser-languagedetector
trooper2003 Dec 11, 2023
155f7d0
Merge pull request #28 from trooper2003/main
flakeed Dec 11, 2023
7f9609e
Merge pull request #1 from deep-foundation/main
trooper2003 Dec 14, 2023
8b6c1dd
add react-i18next
trooper2003 Dec 14, 2023
121d7d9
Merge pull request #29 from trooper2003/main
flakeed Dec 14, 2023
6c2cc6f
npm i react-calendar-timeline
FreePhoenix888 Jan 8, 2024
88241e8
npm i @pbe/react-yandex-maps
FreePhoenix888 Jan 8, 2024
33bd6cc
+package tinkoff-sdk-grpc-js
suenot Jan 9, 2024
479f50e
Merge pull request #30 from suenot/main
FreePhoenix888 Jan 9, 2024
c99e531
add @likissdmd/warframe-market-prime-trash-buyer dependecy
LiKissDmd Jan 25, 2024
0ef9914
Merge pull request #31 from LiKissDmd/main
FreePhoenix888 Jan 25, 2024
bd22854
Update @deep-foundation/deeplinks version
Konard Jan 25, 2024
642b22c
add material ui
LiKissDmd Jan 26, 2024
f4981ef
Merge pull request #32 from LiKissDmd/feature/add_material_ui
FreePhoenix888 Jan 26, 2024
1039ff6
npm install discord.js@latest
FreePhoenix888 Feb 28, 2024
27d5852
Update @deep-foundation/deeplinks to 0.0.333
Konard Mar 11, 2024
218e8e7
Update README.md
Konard Mar 15, 2024
93525c0
Add GitPod support
Konard Mar 23, 2024
5b0d412
Fix https://github.com/deep-foundation/js-docker-isolation-provider/i…
Konard Mar 23, 2024
332aefc
Update README.md
Konard Mar 23, 2024
bde8c1c
Install zod
FreePhoenix888 Apr 23, 2024
b59e529
Apply gitpod-update-force
Konard May 5, 2024
11cd0a3
0.0.10 form-data for axios file loading
ivansglazunov May 18, 2024
9534460
0.0.11
ivansglazunov Jun 24, 2024
e6effa8
0.0.12
ivansglazunov Jun 26, 2024
9b2c681
0.0.13
ivansglazunov Jun 26, 2024
eaabebe
0.0.14
ivansglazunov Jun 26, 2024
c54b974
0.0.15
ivansglazunov Jun 26, 2024
6f6c945
0.0.16
ivansglazunov Jun 26, 2024
9906403
0.0.17
ivansglazunov Jun 29, 2024
0711847
0.0.18
ivansglazunov Jun 30, 2024
8004052
0.0.19
ivansglazunov Jun 30, 2024
6363e70
better deeplinks select errors
ivansglazunov Jul 3, 2024
4684205
0.0.20
ivansglazunov Jul 8, 2024
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
15 changes: 9 additions & 6 deletions .github/workflows/dockerize.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ name: Deploy deepRunnerJs
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
defaults:
run:
Expand All @@ -16,19 +14,24 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '14.15'
node-version: 18
- name: Install latest npm
run: npm install -g npm@latest
- name: build
run: npm ci && npm run package:build
- name: Display npm log
if: ${{ failure() }}
run: cat /home/runner/.npm/_logs/*-debug.log
- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_TEST_USERNAME }}
password: ${{ secrets.DOCKER_TEST_PASSWORD }}
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: konard/deep-runner-js
images: deepf/js-docker-isolation-provider
- name: build docker image and push
id: docker_build
uses: docker/build-push-action@v2
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/npm-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Npm Build

on:
pull_request:
types: [opened, reopened, edited, synchronize]
workflow_dispatch:

jobs:
main:
uses: deep-foundation/workflows/.github/workflows/npm-build.yml@main
2 changes: 2 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tasks:
- init: npm ci
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:14.15-stretch
FROM node:18

COPY package.json .
COPY index.js .
Expand All @@ -7,4 +7,7 @@ COPY index.ts .
COPY node_modules ./node_modules
COPY imports ./imports

RUN apt-get update
RUN apt-get install ffmpeg -y

ENTRYPOINT ["node", "index.js"]
24 changes: 24 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.

In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to <https://unlicense.org>
60 changes: 59 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,59 @@
# deepRunnerJs
[![Gitpod](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/deep-foundation/js-docker-isolation-provider)

# js-docker-isolation-provider

## HTTP routes

- `/healthz` - GET - 200 - Health check endpoint
- Response:
- `{}`
- `/init` - GET - 200 - Initialization endpoint
- Response:
- `{}`
- `/call` - GET - 200 - Call executable code of handler in this isolation provider (it used in HandleInsert, HandleUpdate, HandleDelete and so on)
- Request:
- body:
- params:
- jwt: STRING - Deeplinks send this token, for create gql and deep client
- secret: STRING - Secret to access Hasura in unsafe mode (if package/user are allowed to use it by permissions)
- code: STRING - Code of handler
- data: {} - Data for handler execution from deeplinks
> If this is type handler
- oldLink - from deeplinks, link before transaction
- newLink - from deeplinks, link after transaction
- promiseId - from deeplinks, promise id
- Response:
- `{ resolved?: any; rejected?: any; }` - If resolved or rejected is not null, then it's result of execution
- `/http-call` - GET - 200 - Call executable code of handler in this isolation provider to produce the http responce (it is used in HandleRoute)
- Request:
- Headers:
- `deep-call-options`
- jwt: STRING - Deeplinks send this token, for create gql and deep client
- secret: STRING - Secret to access Hasura in unsafe mode (if package/user are allowed to use it by permissions)
- code: STRING - Code of handler
- data: {} - Data for handler execution from deeplinks
> If this is type handler
- oldLink - from deeplinks, link before transaction
- newLink - from deeplinks, link after transaction
- promiseId - from deeplinks, promise id
- Responce:
- Http responce generated by code if execution is successful
- `{ rejected: any; }` - on error

## Diagnostics

### Logs

#### Get container logs to console:

```bash
docker logs $(docker ps -a -q --filter "ancestor=deepf/js-docker-isolation-provider:main")
```

#### Get container logs to file:

Sometimes console cannot output the full logs so it might be helpful to store the entire container's logs as file. It can be done like this:

```bash
docker logs $(docker ps -a -q --filter "ancestor=deepf/js-docker-isolation-provider:main") > log.txt
```
124 changes: 93 additions & 31 deletions index.ts
Original file line number Diff line number Diff line change
@@ -1,56 +1,118 @@
import express from 'express';
import { generateApolloClient } from "@deep-foundation/hasura/client";
import { DeepClient } from "@deep-foundation/deeplinks/imports/client";
import memoize from 'lodash/memoize'
import { generateApolloClient } from "@deep-foundation/hasura/client.js";
import { HasuraApi } from '@deep-foundation/hasura/api.js';
import { DeepClient, parseJwt } from "@deep-foundation/deeplinks/imports/client.js";
import { gql } from '@apollo/client/index.js';
import { serializeError } from 'serialize-error';
import memoize from 'lodash/memoize.js';
import http from 'http';
// import { parseStream, parseFile } from 'music-metadata';
import { createRequire } from 'node:module';
import bodyParser from 'body-parser';
const require = createRequire(import.meta.url);

const memoEval = memoize(eval);

const app = express();
let initiated;

const GQL_URN = process.env.GQL_URN || 'localhost:3006/gql';
const GQL_URN = process.env.GQL_URN || 'host.docker.internal:3006/gql';
const GQL_SSL = process.env.GQL_SSL || 0;

const toJSON = (data) => JSON.stringify(data, Object.getOwnPropertyNames(data), 2);
const DEEPLINKS_HASURA_PATH = process.env.DEEPLINKS_HASURA_PATH || 'host.docker.internal:8080';
const DEEPLINKS_HASURA_SSL = !!(+process.env.DEEPLINKS_HASURA_SSL || 0);

const requireWrapper = (id: string) => {
// if (id === 'music-metadata') {
// return { parseStream, parseFile };
// }
return require(id);
}

DeepClient.resolveDependency = requireWrapper;

const makeFunction = (code: string) => {
const fn = memoEval(code);
if (typeof fn !== 'function')
{
throw new Error("Executed handler's code didn't return a function.");
}
return fn;
}

const makeDeepClient = (token: string, path?: string, ssl?: boolean, secret?: string) => {
if (!token) throw new Error('No token provided');
const decoded = parseJwt(token);
const linkId = decoded?.userId;
const apolloClient = generateApolloClient({
path: GQL_URN,
ssl: !!+GQL_SSL,
token,
});

const unsafe: any = {};
if (secret) {
unsafe.hasura = new HasuraApi({
path,
ssl,
secret,
});
}

const deepClient = new DeepClient({ apolloClient, linkId, token, unsafe }) as any;
return deepClient;
}

const execute = async (args, options) => {
const { jwt, secret, code, data, path, ssl } = options;
const fn = makeFunction(code);
const deep = makeDeepClient(jwt, path, ssl, secret);
// await supports both sync and async functions the same way
const result = await fn(...args, { data, deep, gql, require: requireWrapper });
return result;
}

app.use(bodyParser.json({limit: '50mb'}));
app.use(bodyParser.urlencoded({limit: '50mb', extended: true}));

app.use(express.json());
app.get('/healthz', (req, res) => {
res.json({});
});

app.post('/init', (req, res) => {
res.json({});
});
app.post('/call', async (req, res) => {
try
{
console.log({ body: req?.body });
const token = req?.body?.params?.jwt;
if (!token) throw new Error('No token provided');
initiated = memoEval(req?.body?.params?.code);
if (typeof initiated !== 'function')
{
throw new Error("Executed handler's code didn't return a function.");
}

const apolloClient = generateApolloClient({
path: GQL_URN,
ssl: !!+GQL_SSL,
token,
});

const deepClient = new DeepClient({ apolloClient });
const result = await initiated({ deep: deepClient }); // Supports both sync and async functions the same way
app.post('/call', async (req, res) => {
try {
const options = req?.body?.params || {};
console.log('call options', options);
const result = await execute([], options);
console.log('call result', result);
res.json({ resolved: result });
}
catch(rejected)
{
const processedRejection = JSON.parse(toJSON(rejected));
console.log('rejected: ', processedRejection);
const processedRejection = serializeError(rejected);
console.log('rejected', processedRejection);
res.json({ rejected: processedRejection });
}
});

app.listen(process.env.PORT, () => {
console.log(`Listening ${process.env.PORT} port`);
});
app.use('/http-call', async (req, res, next) => {
try {
const options = JSON.parse(decodeURI(`${req.headers['deep-call-options']}`) || '{}');
console.log('http call options', options);
const result = await execute([req, res, next], options);
console.log('http call result', result);
return result;
}
catch(rejected)
{
const processedRejection = serializeError(rejected);
console.log('rejected', processedRejection);
res.json({ rejected: processedRejection }); // TODO: Do we need to send json to client? HTTP respone may not expect json output.
}
});

http.createServer({ maxHeaderSize: 10*1024*1024*1024 }, app).listen(process.env.PORT);
console.log(`Listening ${process.env.PORT} port`);
12 changes: 12 additions & 0 deletions key.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"type": "service_account",
"project_id": "deep-sound-handler",
"private_key_id": "c03fd7ed391b0e82a666f6b88089e3b145c33879",
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCljHCNaHpGK/AS\n4iE9+h+eAL93H3HKLchrz3hADZjHwNetquySoh71g3zcXhKqmQWbD6o3pw4+tAsJ\nHfecgjAlxvmZ8wNbycgfnT6u2iM2fCUhwuxy2WYURHAGTqupAkkZIGksLDSBYQqH\nrqx7l142JnaJdqeYm4YjRdNO8X3ROcQcSlJflK4yBozFq2QyNJLHZMpL+1bCY88Q\nhIKEqXWbVT2iWTAtJPwZqdbRyIr/vjnk63fNuEmNy1VFW1Q6hR2wA3WyY2Re5nKG\nxMQuBpJSfrZn5mJlodPkKpPUP4Jtkn9kfT0O5Fk5nxVA5XIa8kjVHEXzVmrQYbrv\n5VEsKF71AgMBAAECggEAGxYueESm9QJNZpmPPNfHApA2w6Pmd2EkUNeCYmCXJd/c\nqjK0QI28KQmZjWjq/vTIoQVgIXj48LN+tsArenUmsZer0U+cthD+6IVO80cHyeto\nG+0LyQLfG+PSvIV0utN/6FeQPcUB1kVtdqPS3un2ZT/H11gNtf+EZBMRrvH+VxQs\nGyNDQeO9tMhrOxeOyYrZg8KBa+1K9yucBKgQUvjOFTL7jSLXq7ODCs1joUNy17ZD\nOK2H40dp+ul5b9BeA58zwDygHhh1DKgfXef0KjhfzuKQG6wXs0DUXvdG/S6QTnX/\nmZ5qP06/FFlaIVppYJIOrdG5eCtyRfitSWhSgcmPJQKBgQDYC03dSS8gS26GWGgV\nlWnyh7XXVtMx2M/i9cx6/zkXp0p1y+aZoU20CumlTXPbGbIGy5JbRSGmeGCszrZo\nTWA75Yj4lkDR0NjkcfpdvdIe3zjsWuo9N6gNJV5zCSjib9O+YZ5BbcHUoChlaLYz\nG7Uzpszp1jB3xg9AyMfpf+1IcwKBgQDEKmcwLwjcjYRsnmyiveOxNWSsR9CsN/1q\np1WS5XTs9Tv3gtTt6WweGoi/dKTOMNeVRR1pxSxYHJ2e2/hFAAwLUjFUoFvj6htO\nShfqxGtQA+RWCrAxg59mD5I8JFDdm/NGbYP0czOaOhnUbSUVDQ0dNJpjflEsqXeF\n9+bOr6So9wKBgDf2NaUsX9itsWN7Yvq0SU1ZefDdvLccwjy4Ds+NbOyDmPYKayFA\ndzA742m+NlR6w3KfKLobnivQ4rngkb9Sy6q4OlKqGQBAaO5D1+aQVO1KRSR0KFjT\nIeTF2UFTDhQZg2+9OZEZLSw2kEA0b32tn7JRcqLfqI5d73WIjMAfMwehAoGAImv+\nZ2oZd/otPpIeJgCEL9harhB8AXxhr5FlZr104w+1Uh1XF9hZ7H5jeJUTRkszyTGz\nk5fRzDRZREL9Mb5sXqAxn9Pzy+6MlBRUVhHZctT8AE0n1chu9A3Pb1ZACmMPMVCO\nUxrT90AywB/W3fbIUlOks8i6nceu/YcerS4NCskCgYBCusqLkGStC9Tw7R1xX+ey\nDkA5sGNfHIV18PQH1l0R1MNf1cXjxkBvt4aVTO5iqcLfr/LCGwYQJn/CXuBkS2Tv\njKOAdmkFVGe1DdMLXDbhHKwduHnqgAkEyWu0Jw+lPHvziTmcJy2t3m9Lcm9srgEu\nKE9c9B+zjkFrG8NTrLAhbQ==\n-----END PRIVATE KEY-----\n",
"client_email": "deep-sound-handler@deep-sound-handler.iam.gserviceaccount.com",
"client_id": "100687498969961716359",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/deep-sound-handler%40deep-sound-handler.iam.gserviceaccount.com"
}
6 changes: 3 additions & 3 deletions local/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '3.6'
version: '3.7'
services:
deep-runner-js:
image: konard/deep-runner-js:main
js-docker-isolation-provider:
image: deepf/js-docker-isolation-provider:main
networks:
- deep
ports:
Expand Down
2 changes: 1 addition & 1 deletion nodemon.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"watch": ["imports", "index.ts"],
"ext": "ts",
"exec": "ts-node ./index.ts"
"exec": "npx ts-node --esm ./index.ts"
}
Loading
Loading