-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add flag to the published cubes metadata (cc:isHiddenCube)
- Loading branch information
Showing
4 changed files
with
36 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import type { Context } from 'barnard59-core/lib/Pipeline' | ||
import $rdf from 'rdf-ext' | ||
import through2 from 'through2' | ||
import clownface from 'clownface' | ||
import { cc } from '@cube-creator/core/namespace' | ||
|
||
export function inject(this: Pick<Context, 'variables'>) { | ||
const isHiddenCube = this.variables.get('isHiddenCube') | ||
const cubeNamespace = this.variables.get('namespace') | ||
const revision = this.variables.get('revision') | ||
|
||
const cubeId = $rdf.namedNode(`${cubeNamespace}/${revision}`) | ||
|
||
const dataset = $rdf.dataset() | ||
clownface({ dataset }) | ||
.node(cubeId) | ||
.addOut(cc.isHiddenCube, !!isHiddenCube) | ||
|
||
return through2.obj( | ||
(chunk, enc, cb) => cb(null, chunk), | ||
function (done) { | ||
dataset.forEach(this.push.bind(this)) | ||
done() | ||
}) | ||
} |
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