@coherentglobal/wasm-runner 0.0.88 → 0.0.91
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/build-publish-public.yml +104 -0
- package/.github/workflows/build-publish.yml +13 -7
- package/.github/workflows/code-quality.yml +103 -0
- package/.github/workflows/pull-request.yml +14 -0
- package/.github/workflows/test-multple-browsers.yml +88 -0
- package/.github/workflows/test-mutiple-os.yml +54 -0
- package/dist/browser/template/worker.template.js +23 -5
- package/dist/browser/template/worker.template.js.map +1 -1
- package/dist/browser/template.js +1 -1
- package/dist/browser.js +6 -1
- package/dist/browser.js.map +1 -1
- package/dist/node/logger.js +1 -0
- package/dist/node/logger.js.map +1 -1
- package/dist/node/logger.ts +2 -0
- package/dist/node/mockLogger.d.ts +1 -0
- package/dist/node/mockLogger.js +11 -0
- package/dist/node/mockLogger.js.map +1 -0
- package/dist/node/template/main.template.ejs +23 -11
- package/dist/node.js +17 -2
- package/dist/node.js.map +1 -1
- package/dist/serializer/columnarSerializer.js +1 -1
- package/dist/serializer/columnarSerializer.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/utils.js +10 -0
- package/dist/utils.js.map +1 -1
- package/package.json +25 -33
- package/selenium/headless.test.js +83 -0
- package/sonar-project.properties +11 -0
- package/tsconfig.json +12 -4
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
name: Build and Publish Action
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- master
|
|
7
|
+
- main
|
|
8
|
+
tags:
|
|
9
|
+
- v[0-9]+.[0-9]+.[0-9]+
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
test:
|
|
13
|
+
name: Test
|
|
14
|
+
uses: ./.github/workflows/code-quality.yml
|
|
15
|
+
secrets:
|
|
16
|
+
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
|
|
17
|
+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
|
18
|
+
|
|
19
|
+
test-mutiple-os:
|
|
20
|
+
name: Test OS
|
|
21
|
+
uses: ./.github/workflows/test-mutiple-os.yml
|
|
22
|
+
|
|
23
|
+
test-browsers:
|
|
24
|
+
name: Test Browsers
|
|
25
|
+
uses: ./.github/workflows/test-multple-browsers.yml
|
|
26
|
+
|
|
27
|
+
publish-js-bundles:
|
|
28
|
+
needs: build-publish-public
|
|
29
|
+
name: Publish JS bundle-js
|
|
30
|
+
runs-on: ubuntu-latest
|
|
31
|
+
steps:
|
|
32
|
+
- name: Checkout
|
|
33
|
+
uses: actions/checkout@v3
|
|
34
|
+
- uses: actions/setup-node@v3
|
|
35
|
+
with:
|
|
36
|
+
node-version: 16
|
|
37
|
+
- name: Get yarn cache directory path
|
|
38
|
+
id: yarn-cache-dir-path
|
|
39
|
+
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
40
|
+
|
|
41
|
+
- name: Restore yarn cache
|
|
42
|
+
id: yarn-cache
|
|
43
|
+
uses: actions/cache@v3
|
|
44
|
+
with:
|
|
45
|
+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
|
46
|
+
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
|
|
47
|
+
restore-keys: |
|
|
48
|
+
${{ runner.os }}-yarn-
|
|
49
|
+
|
|
50
|
+
- name: Create Javascript Bundle
|
|
51
|
+
run: |
|
|
52
|
+
yarn install --frozen-lockfile
|
|
53
|
+
mkdir lib
|
|
54
|
+
yarn bundle
|
|
55
|
+
|
|
56
|
+
- name: Configure AWS Credentials
|
|
57
|
+
uses: aws-actions/configure-aws-credentials@v1
|
|
58
|
+
with:
|
|
59
|
+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
60
|
+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
61
|
+
aws-region: ${{ secrets.AWS_REGION }}
|
|
62
|
+
|
|
63
|
+
- name: Uploading JS Bundle to S3...
|
|
64
|
+
env:
|
|
65
|
+
S3_BUCKET: ${{ secrets.S3_BUCKET }}
|
|
66
|
+
run: |
|
|
67
|
+
aws s3 sync ./lib $S3_BUCKET
|
|
68
|
+
|
|
69
|
+
build-publish-public:
|
|
70
|
+
needs: [test, test-mutiple-os, test-browsers]
|
|
71
|
+
name: Build & Publish [NPM]
|
|
72
|
+
environment: PUBLIC
|
|
73
|
+
runs-on: ubuntu-latest
|
|
74
|
+
steps:
|
|
75
|
+
- name: Checkout
|
|
76
|
+
uses: actions/checkout@v3
|
|
77
|
+
|
|
78
|
+
- name: Get yarn cache directory path
|
|
79
|
+
id: yarn-cache-dir-path
|
|
80
|
+
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
81
|
+
|
|
82
|
+
- name: Restore yarn cache
|
|
83
|
+
id: yarn-cache
|
|
84
|
+
uses: actions/cache@v3
|
|
85
|
+
with:
|
|
86
|
+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
|
87
|
+
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
|
|
88
|
+
restore-keys: |
|
|
89
|
+
${{ runner.os }}-yarn-
|
|
90
|
+
|
|
91
|
+
- name: Setup Node
|
|
92
|
+
uses: actions/setup-node@v3
|
|
93
|
+
with:
|
|
94
|
+
node-version: 16
|
|
95
|
+
registry-url: 'https://registry.npmjs.org'
|
|
96
|
+
always-auth: true
|
|
97
|
+
|
|
98
|
+
- name: Install dependencies and build 🔧
|
|
99
|
+
run: yarn install && yarn run build
|
|
100
|
+
|
|
101
|
+
- name: Publish package on NPM 📦
|
|
102
|
+
run: npm publish --access public
|
|
103
|
+
env:
|
|
104
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
@@ -2,13 +2,19 @@ name: Build and Publish Action
|
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
5
|
-
branches:
|
|
5
|
+
branches:
|
|
6
6
|
- dev
|
|
7
|
-
- master
|
|
8
|
-
- v*.*.*
|
|
9
7
|
|
|
10
8
|
jobs:
|
|
9
|
+
test:
|
|
10
|
+
name: Test
|
|
11
|
+
uses: ./.github/workflows/code-quality.yml
|
|
12
|
+
secrets:
|
|
13
|
+
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
|
|
14
|
+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
|
15
|
+
|
|
11
16
|
publish-js-bundles:
|
|
17
|
+
needs: [test]
|
|
12
18
|
name: Publish JS bundle-js
|
|
13
19
|
runs-on: ubuntu-latest
|
|
14
20
|
steps:
|
|
@@ -50,7 +56,7 @@ jobs:
|
|
|
50
56
|
aws s3 sync ./lib $S3_BUCKET
|
|
51
57
|
|
|
52
58
|
build-publish:
|
|
53
|
-
needs:
|
|
59
|
+
needs: test
|
|
54
60
|
name: Build & Publish [CodeArtifact]
|
|
55
61
|
runs-on: ubuntu-latest
|
|
56
62
|
steps:
|
|
@@ -98,14 +104,14 @@ jobs:
|
|
|
98
104
|
run: yarn publish --non-interactive
|
|
99
105
|
|
|
100
106
|
build-publish-public:
|
|
101
|
-
needs: publish
|
|
107
|
+
needs: build-publish
|
|
102
108
|
name: Build & Publish [NPM]
|
|
103
109
|
environment: PUBLIC
|
|
104
110
|
runs-on: ubuntu-latest
|
|
105
111
|
steps:
|
|
106
112
|
- name: Checkout
|
|
107
113
|
uses: actions/checkout@v3
|
|
108
|
-
|
|
114
|
+
|
|
109
115
|
- name: Get yarn cache directory path
|
|
110
116
|
id: yarn-cache-dir-path
|
|
111
117
|
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
@@ -132,4 +138,4 @@ jobs:
|
|
|
132
138
|
- name: Publish package on NPM 📦
|
|
133
139
|
run: npm publish --access public
|
|
134
140
|
env:
|
|
135
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
141
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
name: Code Quality
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_call:
|
|
5
|
+
secrets:
|
|
6
|
+
SONAR_HOST_URL:
|
|
7
|
+
required: true
|
|
8
|
+
SONAR_TOKEN:
|
|
9
|
+
required: true
|
|
10
|
+
jobs:
|
|
11
|
+
code-quality:
|
|
12
|
+
name: Code Quality
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
|
|
15
|
+
permissions:
|
|
16
|
+
packages: write
|
|
17
|
+
contents: read
|
|
18
|
+
|
|
19
|
+
steps:
|
|
20
|
+
- name: Checkout
|
|
21
|
+
uses: actions/checkout@v3
|
|
22
|
+
with:
|
|
23
|
+
fetch-depth: 0
|
|
24
|
+
|
|
25
|
+
- uses: actions/setup-node@v3
|
|
26
|
+
with:
|
|
27
|
+
node-version: 16
|
|
28
|
+
|
|
29
|
+
- name: Get yarn cache directory path
|
|
30
|
+
id: yarn-cache-dir-path
|
|
31
|
+
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
32
|
+
|
|
33
|
+
- name: Restore yarn cache
|
|
34
|
+
id: yarn-cache
|
|
35
|
+
uses: actions/cache@v3
|
|
36
|
+
with:
|
|
37
|
+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
|
38
|
+
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
|
|
39
|
+
restore-keys: |
|
|
40
|
+
${{ runner.os }}-yarn-
|
|
41
|
+
|
|
42
|
+
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
|
|
43
|
+
name: List the state of node modules
|
|
44
|
+
continue-on-error: true
|
|
45
|
+
run: npm list
|
|
46
|
+
|
|
47
|
+
- name: Install dependencies and build 🔧
|
|
48
|
+
run: yarn install
|
|
49
|
+
|
|
50
|
+
- name: Run test-reports
|
|
51
|
+
run: yarn test
|
|
52
|
+
|
|
53
|
+
- name: Run coverage
|
|
54
|
+
run: |
|
|
55
|
+
mkdir .nyc_output
|
|
56
|
+
yarn cover
|
|
57
|
+
|
|
58
|
+
- name: SonarQube PR Settings
|
|
59
|
+
run: |
|
|
60
|
+
if [ -n "${{ github.event.pull_request.number }}" ]
|
|
61
|
+
then
|
|
62
|
+
cat << EOF >> sonar-project.properties
|
|
63
|
+
sonar.pullrequest.branch=${GITHUB_HEAD_REF}
|
|
64
|
+
sonar.pullrequest.key=${{ github.event.pull_request.number }}
|
|
65
|
+
sonar.projectVersion=${GITHUB_SHA}
|
|
66
|
+
sonar.host.url=${{ secrets.SONAR_HOST_URL }}
|
|
67
|
+
sonar.login=${{ secrets.SONAR_TOKEN }}
|
|
68
|
+
EOF
|
|
69
|
+
else
|
|
70
|
+
cat << EOF >> sonar-project.properties
|
|
71
|
+
sonar.branch.name=${GITHUB_REF_NAME}
|
|
72
|
+
sonar.projectVersion=${GITHUB_SHA}
|
|
73
|
+
sonar.host.url=${{ secrets.SONAR_HOST_URL }}
|
|
74
|
+
sonar.login=${{ secrets.SONAR_TOKEN }}
|
|
75
|
+
EOF
|
|
76
|
+
fi
|
|
77
|
+
mkdir -p /tmp/cache/scanner
|
|
78
|
+
|
|
79
|
+
- name: Restore Sonar cache
|
|
80
|
+
id: cache-sonar
|
|
81
|
+
uses: actions/cache@v3
|
|
82
|
+
with:
|
|
83
|
+
path: /tmp/cache/scanner
|
|
84
|
+
key: sonarcloud-scanner-v1-${{ hashFiles('**/yarn.lock') }}
|
|
85
|
+
restore-keys: sonarcloud-scanner-v1-
|
|
86
|
+
|
|
87
|
+
- name: SonarQube Scan
|
|
88
|
+
if: always()
|
|
89
|
+
continue-on-error: true
|
|
90
|
+
run: |
|
|
91
|
+
set -e
|
|
92
|
+
VERSION=4.4.0.2170
|
|
93
|
+
SCANNER_DIRECTORY=/tmp/cache/scanner
|
|
94
|
+
export SONAR_USER_HOME=$SCANNER_DIRECTORY/.sonar
|
|
95
|
+
OS="linux"
|
|
96
|
+
cat sonar-project.properties
|
|
97
|
+
if [[ ! -x "$SCANNER_DIRECTORY/sonar-scanner-$VERSION-$OS/bin/sonar-scanner" ]]; then
|
|
98
|
+
curl -o /tmp/sonar-scanner.zip -L https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$VERSION-$OS.zip
|
|
99
|
+
unzip -qq -o /tmp/sonar-scanner.zip -d $SCANNER_DIRECTORY
|
|
100
|
+
fi
|
|
101
|
+
chmod +x $SCANNER_DIRECTORY/sonar-scanner-$VERSION-$OS/bin/sonar-scanner
|
|
102
|
+
chmod +x $SCANNER_DIRECTORY/sonar-scanner-$VERSION-$OS/jre/bin/java
|
|
103
|
+
$SCANNER_DIRECTORY/sonar-scanner-$VERSION-$OS/bin/sonar-scanner
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
name: Pull Request Action
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
branches:
|
|
6
|
+
- dev
|
|
7
|
+
- main
|
|
8
|
+
jobs:
|
|
9
|
+
tests:
|
|
10
|
+
name: Test
|
|
11
|
+
uses: ./.github/workflows/code-quality.yml
|
|
12
|
+
secrets:
|
|
13
|
+
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
|
|
14
|
+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
name: Selenium Test
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_call:
|
|
5
|
+
|
|
6
|
+
jobs:
|
|
7
|
+
test:
|
|
8
|
+
name: ${{ matrix.browser }}
|
|
9
|
+
strategy:
|
|
10
|
+
fail-fast: false
|
|
11
|
+
matrix:
|
|
12
|
+
include:
|
|
13
|
+
- browser: 'chrome'
|
|
14
|
+
os: ubuntu-latest
|
|
15
|
+
- browser: 'firefox'
|
|
16
|
+
os: ubuntu-latest
|
|
17
|
+
- browser: 'edge'
|
|
18
|
+
os: windows-latest
|
|
19
|
+
- browser: 'safari'
|
|
20
|
+
os: macOS-latest
|
|
21
|
+
- browser: 'opera'
|
|
22
|
+
os: ubuntu-latest
|
|
23
|
+
runs-on: ${{ matrix.os }}
|
|
24
|
+
|
|
25
|
+
steps:
|
|
26
|
+
- name: Checkout repository
|
|
27
|
+
uses: actions/checkout@v3
|
|
28
|
+
|
|
29
|
+
- name: Setup Node.js
|
|
30
|
+
uses: actions/setup-node@v2
|
|
31
|
+
with:
|
|
32
|
+
node-version: '16'
|
|
33
|
+
|
|
34
|
+
- name: Get yarn cache directory path
|
|
35
|
+
id: yarn-cache-dir-path
|
|
36
|
+
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
37
|
+
|
|
38
|
+
- name: Restore yarn cache
|
|
39
|
+
id: yarn-cache
|
|
40
|
+
uses: actions/cache@v3
|
|
41
|
+
with:
|
|
42
|
+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
|
43
|
+
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
|
|
44
|
+
restore-keys: |
|
|
45
|
+
${{ runner.os }}-yarn-
|
|
46
|
+
|
|
47
|
+
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
|
|
48
|
+
name: List the state of node modules
|
|
49
|
+
continue-on-error: true
|
|
50
|
+
run: yarn list
|
|
51
|
+
|
|
52
|
+
- name: Install dependencies
|
|
53
|
+
run: |
|
|
54
|
+
mkdir lib
|
|
55
|
+
yarn install && yarn run build && yarn bundle
|
|
56
|
+
|
|
57
|
+
- name: Start HTTP server
|
|
58
|
+
shell: bash
|
|
59
|
+
run: |
|
|
60
|
+
DEBUG=http-server:* npx http-server -p 5500 > server.log 2>&1 &
|
|
61
|
+
echo "Waiting for server to start..."
|
|
62
|
+
i=0
|
|
63
|
+
while [ $i -lt 120 ]; do
|
|
64
|
+
if curl --output /dev/null --silent --head --fail http://localhost:5500; then
|
|
65
|
+
echo "Server is up"
|
|
66
|
+
break
|
|
67
|
+
else
|
|
68
|
+
echo "Server not up yet, retrying..."
|
|
69
|
+
sleep 1
|
|
70
|
+
i=$((i+1))
|
|
71
|
+
fi
|
|
72
|
+
done
|
|
73
|
+
if [ $i -eq 120 ]; then
|
|
74
|
+
echo "Server failed to start after 120 seconds"
|
|
75
|
+
exit 1
|
|
76
|
+
fi
|
|
77
|
+
cat server.log
|
|
78
|
+
|
|
79
|
+
- name: Install Opera
|
|
80
|
+
if: matrix.browser == 'opera'
|
|
81
|
+
run: |
|
|
82
|
+
wget -qO- https://deb.opera.com/archive.key | sudo apt-key add -
|
|
83
|
+
sudo add-apt-repository "deb [arch=i386,amd64] https://deb.opera.com/opera-stable/ stable non-free"
|
|
84
|
+
sudo apt-get update
|
|
85
|
+
sudo apt-get install opera-stable
|
|
86
|
+
|
|
87
|
+
- name: Run tests on ${{ matrix.browser }}
|
|
88
|
+
run: yarn test:${{ matrix.browser }}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
name: Test
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_call:
|
|
5
|
+
|
|
6
|
+
jobs:
|
|
7
|
+
test:
|
|
8
|
+
name: ${{ matrix.os }}
|
|
9
|
+
runs-on: ${{ matrix.os }}
|
|
10
|
+
|
|
11
|
+
strategy:
|
|
12
|
+
fail-fast: false
|
|
13
|
+
matrix:
|
|
14
|
+
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
15
|
+
node-version: [16.x]
|
|
16
|
+
|
|
17
|
+
permissions:
|
|
18
|
+
packages: write
|
|
19
|
+
contents: read
|
|
20
|
+
|
|
21
|
+
steps:
|
|
22
|
+
- name: Checkout
|
|
23
|
+
uses: actions/checkout@v3
|
|
24
|
+
with:
|
|
25
|
+
fetch-depth: 0
|
|
26
|
+
|
|
27
|
+
- name: Use Node.js ${{ matrix.node-version }}
|
|
28
|
+
uses: actions/setup-node@v3
|
|
29
|
+
with:
|
|
30
|
+
node-version: ${{ matrix.node-version }}
|
|
31
|
+
|
|
32
|
+
- name: Get yarn cache directory path
|
|
33
|
+
id: yarn-cache-dir-path
|
|
34
|
+
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
35
|
+
|
|
36
|
+
- name: Restore yarn cache
|
|
37
|
+
id: yarn-cache
|
|
38
|
+
uses: actions/cache@v3
|
|
39
|
+
with:
|
|
40
|
+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
|
41
|
+
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
|
|
42
|
+
restore-keys: |
|
|
43
|
+
${{ runner.os }}-yarn-
|
|
44
|
+
|
|
45
|
+
- if: ${{ steps.yarn-cache.outputs.cache-hit != 'true' }}
|
|
46
|
+
name: List the state of node modules
|
|
47
|
+
continue-on-error: true
|
|
48
|
+
run: yarn list
|
|
49
|
+
|
|
50
|
+
- name: Install dependencies and build 🔧
|
|
51
|
+
run: yarn install
|
|
52
|
+
|
|
53
|
+
- name: Run test-reports
|
|
54
|
+
run: yarn test
|
|
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
/* eslint-disable camelcase */
|
|
11
11
|
/* eslint-disable consistent-return */
|
|
12
12
|
/* eslint-disable no-underscore-dangle */
|
|
13
|
+
/* istanbul ignore next */
|
|
13
14
|
class MyEventEmitter {
|
|
14
15
|
constructor() {
|
|
15
16
|
this._events = {};
|
|
@@ -48,14 +49,19 @@ class MyEventEmitter {
|
|
|
48
49
|
}
|
|
49
50
|
}
|
|
50
51
|
}
|
|
52
|
+
/* istanbul ignore next */
|
|
51
53
|
var workerEventEmitter = new MyEventEmitter();
|
|
52
54
|
/* eslint-disable no-undef */
|
|
55
|
+
/* istanbul ignore next */
|
|
53
56
|
let wasm;
|
|
57
|
+
/* istanbul ignore next */
|
|
54
58
|
let wb;
|
|
59
|
+
/* istanbul ignore next */
|
|
55
60
|
var CALL_TYPE = {
|
|
56
61
|
0: "SparkService",
|
|
57
62
|
1: "ExternalApi",
|
|
58
63
|
};
|
|
64
|
+
/* istanbul ignore next */
|
|
59
65
|
var XcallResBuilder = {
|
|
60
66
|
Json: function (callType, name, status, errorCode, responseTime, data) {
|
|
61
67
|
return JSON.stringify({
|
|
@@ -71,6 +77,7 @@ var XcallResBuilder = {
|
|
|
71
77
|
},
|
|
72
78
|
XML: () => { }
|
|
73
79
|
};
|
|
80
|
+
/* istanbul ignore next */
|
|
74
81
|
function moduleInitialize() {
|
|
75
82
|
Module().then((instance) => {
|
|
76
83
|
wasm = instance;
|
|
@@ -116,9 +123,11 @@ function moduleInitialize() {
|
|
|
116
123
|
postMessage("Initialized");
|
|
117
124
|
});
|
|
118
125
|
}
|
|
126
|
+
/* istanbul ignore next */
|
|
119
127
|
moduleInitialize();
|
|
128
|
+
/* istanbul ignore next */
|
|
120
129
|
function runComputation(oEvent) {
|
|
121
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7;
|
|
130
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16;
|
|
122
131
|
return __awaiter(this, void 0, void 0, function* () {
|
|
123
132
|
if (!oEvent) {
|
|
124
133
|
return new Error("No Event was placed");
|
|
@@ -151,8 +160,16 @@ function runComputation(oEvent) {
|
|
|
151
160
|
ctx.servicemap = (_2 = (_1 = input === null || input === void 0 ? void 0 : input.request_meta) === null || _1 === void 0 ? void 0 : _1._ctx) === null || _2 === void 0 ? void 0 : _2.servicemap;
|
|
152
161
|
(_3 = input === null || input === void 0 ? void 0 : input.request_meta) === null || _3 === void 0 ? true : delete _3._ctx.servicemap;
|
|
153
162
|
}
|
|
154
|
-
|
|
155
|
-
((
|
|
163
|
+
if ((_5 = (_4 = input === null || input === void 0 ? void 0 : input.request_meta) === null || _4 === void 0 ? void 0 : _4._ctx) === null || _5 === void 0 ? void 0 : _5.xcallChainId) {
|
|
164
|
+
ctx.xcallChainId = (_7 = (_6 = input === null || input === void 0 ? void 0 : input.request_meta) === null || _6 === void 0 ? void 0 : _6._ctx) === null || _7 === void 0 ? void 0 : _7.xcallChainId;
|
|
165
|
+
(_8 = input === null || input === void 0 ? void 0 : input.request_meta) === null || _8 === void 0 ? true : delete _8._ctx.xcallChainId;
|
|
166
|
+
}
|
|
167
|
+
if ((_10 = (_9 = input === null || input === void 0 ? void 0 : input.request_meta) === null || _9 === void 0 ? void 0 : _9._ctx) === null || _10 === void 0 ? void 0 : _10.correlationId) {
|
|
168
|
+
ctx.correlationId = (_11 = input === null || input === void 0 ? void 0 : input.request_meta) === null || _11 === void 0 ? void 0 : _11._ctx.correlationId;
|
|
169
|
+
(_12 = input === null || input === void 0 ? void 0 : input.request_meta) === null || _12 === void 0 ? true : delete _12._ctx.correlationId;
|
|
170
|
+
}
|
|
171
|
+
var isMetadataSubSvc = ((_13 = input === null || input === void 0 ? void 0 : input.request_meta) === null || _13 === void 0 ? void 0 : _13.service_category) &&
|
|
172
|
+
((_14 = input === null || input === void 0 ? void 0 : input.request_meta) === null || _14 === void 0 ? void 0 : _14.service_category.split(",").some((c) => c.toLowerCase() === "metadata")) &&
|
|
156
173
|
metadata !== undefined;
|
|
157
174
|
var enc = new TextEncoder();
|
|
158
175
|
var encoded = enc.encode(inputDataFromEvent);
|
|
@@ -173,7 +190,7 @@ function runComputation(oEvent) {
|
|
|
173
190
|
if (!result.response_data) {
|
|
174
191
|
result.response_data = {};
|
|
175
192
|
}
|
|
176
|
-
var hasImageOutputs = (
|
|
193
|
+
var hasImageOutputs = (_15 = metadata === null || metadata === void 0 ? void 0 : metadata.ImageOutputs) !== null && _15 !== void 0 ? _15 : [];
|
|
177
194
|
var imageOutputs = hasImageOutputs ?
|
|
178
195
|
hasImageOutputs.reduce((prev, curr) => {
|
|
179
196
|
if (!(curr === null || curr === void 0 ? void 0 : curr.ImageName))
|
|
@@ -181,13 +198,14 @@ function runComputation(oEvent) {
|
|
|
181
198
|
prev[curr.ImageName] = (curr === null || curr === void 0 ? void 0 : curr.Base64Content) || "";
|
|
182
199
|
return prev;
|
|
183
200
|
}, {}) : {};
|
|
184
|
-
result.response_data.outputs = Object.assign(Object.assign(Object.assign({}, (
|
|
201
|
+
result.response_data.outputs = Object.assign(Object.assign(Object.assign({}, (_16 = result.response_data) === null || _16 === void 0 ? void 0 : _16.outputs), metadata === null || metadata === void 0 ? void 0 : metadata.Outputs), imageOutputs);
|
|
185
202
|
return [JSON.stringify(result), eventCallId];
|
|
186
203
|
}
|
|
187
204
|
return [result, eventCallId];
|
|
188
205
|
});
|
|
189
206
|
}
|
|
190
207
|
;
|
|
208
|
+
/* istanbul ignore next */
|
|
191
209
|
onmessage = function (oEvent) {
|
|
192
210
|
var event = oEvent;
|
|
193
211
|
var input = event.data[0];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker.template.js","sourceRoot":"","sources":["../../../src/browser/template/worker.template.js"],"names":[],"mappings":";;;;;;;;;AAAA,8BAA8B;AAC9B,sCAAsC;AACtC,yCAAyC;AACzC,MAAM,cAAc;IAClB;QACE,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QAClB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;IACxB,CAAC;IAED,EAAE,CAAC,IAAI,EAAE,QAAQ;QACf,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACvB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;SACzB;QAED,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACpC,CAAC;IAED,IAAI,CAAC,IAAI,EAAE,QAAQ;QACjB,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE;YAC3B,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;SAC7B;QAED,IAAI,CAAC,W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CAAC;SACvD;QACD,IAAI,MAAA,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,YAAY,0CAAE,IAAI,0CAAE,MAAM,EAAE;YACrC,GAAG,CAAC,OAAO,CAAC,MAAM,GAAG,MAAA,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,YAAY,0CAAE,IAAI,0CAAE,MAAM,CAAC;YAChD,MAAA,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,YAAY,0CAAE,IAAI,+CAAE,MAAM,CAAC;SAC1C;QACD,IAAI,MAAA,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,YAAY,0CAAE,IAAI,0CAAE,UAAU,EAAE;YACzC,GAAG,CAAC,UAAU,GAAG,MAAA,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,YAAY,0CAAE,IAAI,0CAAE,UAAU,CAAC;YAChD,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,YAAY,+CAAE,IAAI,CAAC,UAAU,CAAC;SAC7C;
|
|
1
|
+
{"version":3,"file":"worker.template.js","sourceRoot":"","sources":["../../../src/browser/template/worker.template.js"],"names":[],"mappings":";;;;;;;;;AAAA,8BAA8B;AAC9B,sCAAsC;AACtC,yCAAyC;AACzC,2BAA2B;AAC3B,MAAM,cAAc;IAClB;QACE,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QAClB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;IACxB,CAAC;IAED,EAAE,CAAC,IAAI,EAAE,QAAQ;QACf,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACvB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;SACzB;QAED,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACpC,CAAC;IAED,IAAI,CAAC,IAAI,EAAE,QAAQ;QACjB,IAAI,CAAC,I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AC,CAAC"}
|
package/dist/browser/template.js
CHANGED
|
@@ -7,7 +7,7 @@ function buildWorkerFN(runtime, license = "", metadata = {}) {
|
|
|
7
7
|
const metadata = ${JSON.stringify(metadata)};
|
|
8
8
|
|
|
9
9
|
const license = '${license}';
|
|
10
|
-
class MyEventEmitter{constructor(){this._events={},this._eventsOnce={}}on(e,t){this._events[e]||(this._events[e]=[]),this._events[e].push(t)}once(e,t){this._eventsOnce[e]||(this._eventsOnce[e]=[]),this._eventsOnce[e].push(t)}removeListener(e,t){if(!this._events[e]){throw new Error("Can't emit an event. Event doesn't exits."+e)}this._events[e]=this._events[e].filter((e=>e!==t))}emit(e,t){const a=e=>{e(t)};this._events[e]&&this._events[e].forEach(a),this._eventsOnce[e]&&(this._eventsOnce[e].forEach(a),this._eventsOnce[e]=[])}}var workerEventEmitter=new MyEventEmitter;let wasm,wb;var CALL_TYPE={0:"SparkService",1:"ExternalApi"},XcallResBuilder={Json:function(e,t,a,s,r,n){return JSON.stringify({metadata:{calltype:e,name:t,status:a,error_code:s,response_time:r},data:n||{}})},XML:()=>{}};function moduleInitialize(){Module().then((e=>{wasm=e,wb=e._construct();var t=new TextDecoder("utf-8"),a=(new TextEncoder,0);e.dispatch=async(s,r,n)=>{var c=new Uint8Array(e.HEAPU8.subarray(r,r+n)),i=t.decode(c).slice(),o=JSON.parse(i),
|
|
10
|
+
class MyEventEmitter{constructor(){this._events={},this._eventsOnce={}}on(e,t){this._events[e]||(this._events[e]=[]),this._events[e].push(t)}once(e,t){this._eventsOnce[e]||(this._eventsOnce[e]=[]),this._eventsOnce[e].push(t)}removeListener(e,t){if(!this._events[e]){throw new Error("Can't emit an event. Event doesn't exits."+e)}this._events[e]=this._events[e].filter((e=>e!==t))}emit(e,t){const a=e=>{e(t)};this._events[e]&&this._events[e].forEach(a),this._eventsOnce[e]&&(this._eventsOnce[e].forEach(a),this._eventsOnce[e]=[])}}var workerEventEmitter=new MyEventEmitter;let wasm,wb;var CALL_TYPE={0:"SparkService",1:"ExternalApi"},XcallResBuilder={Json:function(e,t,a,s,r,n){return JSON.stringify({metadata:{calltype:e,name:t,status:a,error_code:s,response_time:r},data:n||{}})},XML:()=>{}};function moduleInitialize(){Module().then((e=>{wasm=e,wb=e._construct();var t=new TextDecoder("utf-8"),a=(new TextEncoder,0);e.dispatch=async(s,r,n)=>{var c=new Uint8Array(e.HEAPU8.subarray(r,r+n)),i=t.decode(c).slice(),o=JSON.parse(i),_=(o.folder_name,o.service_name);if(s===a){return await new Promise(((e,t)=>{try{postMessage({requestData:o,type:"stall"});var a="xcall-loopback-result-"+_;workerEventEmitter.once(a,(t=>{var a=XcallResBuilder.Json(CALL_TYPE[0],_,202,"",0,t);e(a)}))}catch(e){t(e)}}))}},postMessage("Initialized")}))}async function runComputation(e){if(!e)return new Error("No Event was placed");var t=e.data[0],a="string"==typeof t?JSON.parse(t):t,s=e.data[1];if(void 0===wasm||void 0===wb)return new Error("WASM is not ready");a?.request_meta?._ctx?.authorization&&(ctx.headers.authorization=a?.request_meta?._ctx?.authorization,delete a?.request_meta?._ctx?.authorization),a?.request_meta?._ctx?.secretkey&&(ctx.headers.secretkey=a?.request_meta?._ctx.secretkey,delete a?.request_meta?._ctx?.secretkey),a?.request_meta?._ctx?.["x-synthetic-key"]&&(ctx.headers["x-synthetic-key"]=a?.request_meta?._ctx?.["x-synthetic-key"],delete a?.request_meta?._ctx?.["x-synthetic-key"]),a?.request_meta?._ctx?.tenant&&(ctx.headers.tenant=a?.request_meta?._ctx?.tenant,delete a?.request_meta?._ctx?.tenant),a?.request_meta?._ctx?.servicemap&&(ctx.servicemap=a?.request_meta?._ctx?.servicemap,delete a?.request_meta?._ctx.servicemap),a?.request_meta?._ctx?.xcallChainId&&(ctx.xcallChainId=a?.request_meta?._ctx?.xcallChainId,delete a?.request_meta?._ctx.xcallChainId),a?.request_meta?._ctx?.correlationId&&(ctx.correlationId=a?.request_meta?._ctx.correlationId,delete a?.request_meta?._ctx.correlationId);var r=a?.request_meta?.service_category&&a?.request_meta?.service_category.split(",").some((e=>"metadata"===e.toLowerCase()))&&void 0!==metadata,n=(new TextEncoder).encode(t),c=wasm._malloc(n.length),i=n.BYTES_PER_ELEMENT;wasm.HEAP8.set(n,c/i);var o=wasm._malloc(8),_=await wasm.ccall("node_calc_v3","number",["number","number","number","number"],[wb,c,n.length,o],{async:!0}),m=wasm.getValue(o,"i64"),u=new Uint8Array(wasm.HEAPU8.subarray(_,_+m));let l=new TextDecoder("utf-8").decode(u).slice();if(wasm._free(c),wasm._free(o),wasm._free(_),r){l=JSON.parse(l),l.response_data||(l.response_data={});var d=metadata?.ImageOutputs??[],v=d?d.reduce(((e,t)=>t?.ImageName?(e[t.ImageName]=t?.Base64Content||"",e):e),{}):{};return l.response_data.outputs={...l.response_data?.outputs,...metadata?.Outputs,...v},[JSON.stringify(l),s]}return[l,s]}moduleInitialize(),onmessage=function(e){var t=e,a=t.data[0],s=t.data[1];if("dispatch"===t.data[2]){var r=a.request.service_name,n=a.response,c="xcall-loopback-result-"+r;workerEventEmitter.emit(c,n)}else runComputation(t).then((e=>{postMessage(e)})).catch((e=>{postMessage([JSON.stringify({executeError:e.message}),s])}))};
|
|
11
11
|
|
|
12
12
|
`;
|
|
13
13
|
}
|
package/dist/browser.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -32,6 +36,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
32
36
|
};
|
|
33
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
38
|
exports.WasmRunner = exports.ColumnarSerializer = void 0;
|
|
39
|
+
/* istanbul ignore file */
|
|
35
40
|
/* eslint-disable no-undef */
|
|
36
41
|
/* eslint-disable camelcase */
|
|
37
42
|
/* eslint-disable prefer-destructuring */
|