Skip to content

Commit

Permalink
feat(compress-stringify): Add pipelines-base-url.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
thewtex committed Jan 18, 2023
1 parent 05f2fd6 commit 04bf847
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/compress-stringify/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"author": "",
"license": "Apache-2.0",
"dependencies": {
"itk-wasm": "^1.0.0-b.54"
"itk-wasm": "^1.0.0-b.55"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^24.0.0",
Expand Down
8 changes: 4 additions & 4 deletions packages/compress-stringify/typescript/pnpm-lock.yaml

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

Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {

import CompressStringifyOptions from './CompressStringifyOptions.js'
import CompressStringifyResult from './CompressStringifyResult.js'
import { getPipelinesBaseUrl } from './pipelines-base-url.js'

/**
* Given a binary, compress and optionally base64 encode.
Expand Down Expand Up @@ -52,7 +53,7 @@ async function compressStringify(
returnValue,
stderr,
outputs
} = await runPipeline(webWorker, pipelinePath, args, desiredOutputs, inputs)
} = await runPipeline(webWorker, pipelinePath, args, desiredOutputs, inputs, getPipelinesBaseUrl())
if (returnValue !== 0) {
throw new Error(stderr)
}
Expand Down
2 changes: 1 addition & 1 deletion packages/compress-stringify/typescript/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

export * from './pipelines-base-url.js'

import CompressStringifyResult from './CompressStringifyResult.js'
export type { CompressStringifyResult }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {

import ParseStringDecompressOptions from './ParseStringDecompressOptions.js'
import ParseStringDecompressResult from './ParseStringDecompressResult.js'
import { getPipelinesBaseUrl } from './pipelines-base-url.js'

/**
* Given a binary or string produced with CompressedStringify, decompress and optionally base64 decode.
Expand Down Expand Up @@ -46,7 +47,7 @@ async function parseStringDecompress(
returnValue,
stderr,
outputs
} = await runPipeline(webWorker, pipelinePath, args, desiredOutputs, inputs)
} = await runPipeline(webWorker, pipelinePath, args, desiredOutputs, inputs, getPipelinesBaseUrl())
if (returnValue !== 0) {
throw new Error(stderr)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
let pipelinesBaseUrl: string | URL = new URL('/pipelines', document.location.origin).href

export function setPipelinesBaseUrl(baseUrl: string | URL) {
pipelinesBaseUrl = baseUrl
}

export function getPipelinesBaseUrl() {
return pipelinesBaseUrl
}

0 comments on commit 04bf847

Please sign in to comment.