Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
buildId: string;
onDiagnostic?: DiagnosticHandler;
}) {
const deviceJSPipeline: Stream[] = [
// TODO: remove is-defined assertion ('!')
buildComponent({
projectConfig,
onDiagnostic,
component: ComponentType.DEVICE,
})!,
];
const processedJS = new playbackStream({ objectMode: true });
deviceJSPipeline.push(processedJS);
return multistream.obj([
// Sequence the build process: wait until compilation finishes
// before building the resources for each component.
new pumpify.obj(
...deviceJSPipeline,
// We don't want to send the JS file downstream directly. It will
// be played back into the individual device component pipelines.
dropStream.obj(),
),
...projectConfig.buildTargets.map((family) =>
lazyObjectReadable(() => {
const { platform, displayName, maxDeviceBundleSize } = buildTargets[
family
];
onDiagnostic({
messageText: `Building app for ${displayName}`,
category: DiagnosticCategory.Message,
}
// options.zoom===0 is a temp workaround because the info data used to be stored in the zoom=0,idx=1
if (end < blockEnd || options.zoom === 0) {
conds += ' AND idx < ?';
params.push(end);
}
let query = 'SELECT ' + fields + ' FROM ' + self.table + ' WHERE ' + conds;
return self.client.stream(query, params, {prepare: true, autoPage: true});
};
let ms;
if (self.blocksize) {
let blockIdx = Math.floor(start / self.blocksize),
toBlockIdx = Math.floor((end - 1) / self.blocksize);
ms = multistream.obj(cb => {
if (blockIdx > toBlockIdx) {
cb();
} else {
try {
let bi = blockIdx++;
cb(null, createStream(bi * self.blocksize, Math.min(maxEnd, (bi + 1) * self.blocksize)));
} catch (err) {
cb(err);
}
}
});
} else {
ms = createStream(0, maxEnd);
}
return promistreamus(ms, value => {
const executeStrategy = (strategy, opts, store) => {
const streamFactories = strategy.paths.map(
(path) => generateStreamFactoryForPath(store, strategy, path),
);
let multiStream = multistream.obj(streamFactories);
if (opts.offset || opts.limit) {
let multiIterator = AsyncIterator.wrap(multiStream);
if (opts.offset) {
multiIterator = multiIterator.skip(opts.offset);
}
if (opts.limit) {
multiIterator = multiIterator.take(opts.limit);
}
multiStream = utils.createIteratorStream(multiIterator);
}
return multiStream;
};
() =>
new pumpify.obj(
multistream.obj(components),
makeCompanionManifest({
projectConfig,
buildId,
hasSettings: !!settings,
}),
zip('companion.zip'),
gulpSetProperty({
componentBundle: { type: 'companion' },
}),
sourceMaps.emitter,
),
);
Readrc.prototype.feeds = function () {
return multistream.obj(this._feeds)
}
var streams = Object.keys(this.dbs).map(function (key) {
return function () {
var transform = new Transform({objectMode: true})
transform._transform = function (nodes, enc, next) {
function transform (node) {
return {node: node, dbKey: key}
}
if (Array.isArray(nodes)) this.push(nodes.map(transform))
else this.push(transform(nodes))
next()
}
return self.dbs[key].db.createReadStream(prefix).pipe(transform)
}
})
return multistream.obj(streams)
}
conds += ' AND idx >= ?';
params.push(start);
}
if (end < blockEnd) {
conds += ' AND idx < ?';
params.push(end);
}
var query = 'SELECT ' + fields + ' FROM ' + self.table + ' WHERE ' + conds;
return self.client.stream(query, params, {prepare: true, autoPage: true});
};
var ms;
if (self.blocksize) {
var blockIdx = Math.floor(start / self.blocksize);
var toBlockIdx = Math.floor((end - 1) / self.blocksize);
ms = multistream.obj(function() {
if (blockIdx > toBlockIdx) return false;
var s = createStream(blockIdx * self.blocksize,
Math.min(maxEnd, (blockIdx + 1) * self.blocksize));
blockIdx++;
return s;
});
} else {
ms = createStream(0, maxEnd);
}
return promistreamus(ms, function(value) {
if ((dateBefore !== false && value.wt >= dateBefore) ||
(dateFrom !== false && value.wt < dateFrom) ||
(options.smallerThan && value.tile.length >= options.smallerThan) ||
(options.biggerThan && value.tile.length < options.biggerThan)
) {
onDiagnostic: addDiagnosticTarget(DiagnosticTarget.App, onDiagnostic),
}),
),
);
}
const companion = buildCompanion({
projectConfig,
buildId,
onDiagnostic: addDiagnosticTarget(DiagnosticTarget.Companion, onDiagnostic),
});
if (companion) components.push(companion);
return new pumpify.obj(
multistream.obj(components),
appPackageManifest({
projectConfig,
buildId,
}),
zip('app.fba'),
);
}