in scripts/generate-manifest.js [70:127]
function generateVectorManifest(sources, opts) {
opts = {
version: 'v0',
production: false,
hostname: constants.VECTOR_STAGING_HOST,
fieldInfo: null,
dataDir: 'data',
...opts,
};
const isDateVersion = checkDateVersion(opts.version);
// Get the Semantic Version (in case it is date based)
const manifestVersion = coerceToSemVer(opts.version);
const layers = [];
const uniqueProperties = [];
for (const source of orderBy(sources, ['weight', 'name'], ['desc', 'asc'])) {
if (!semver.validRange(source.versions)) {
throw new Error(`Invalid versions specified for ${source.name}`);
}
if ((!opts.production ||
(opts.production && source.production)) &&
semver.satisfies(manifestVersion, source.versions)) {
switch (semver.major(manifestVersion)) {
case 1:
uniqueProperties.push('name', 'id');
layers.push(manifestLayerV1(source, opts.hostname, { manifestVersion }));
break;
case 2:
uniqueProperties.push('name', 'id');
layers.push(manifestLayerV2(source, opts.hostname, { manifestVersion }));
break;
case 6:
case 7:
case 8:
case 9: // v6, v7, v8, v9 manifest schema are the same
uniqueProperties.push('layer_id');
layers.push(manifestLayerV6(source, opts.hostname, { manifestVersion, fieldInfo: opts.fieldInfo, dataDir: opts.dataDir }));
break;
default:
throw new Error(`Unable to get a manifest for version ${manifestVersion}`);
}
}
}
for (const prop of uniqueProperties) {
throwIfDuplicates(layers, prop);
}
const manifest = {
version: isDateVersion
// Get the Date Version
? coerceToDateSemver(opts.version)?.date
// Get the Semantic Version
: `${semver.major(manifestVersion)}.${semver.minor(manifestVersion)}`,
layers: layers,
};
return manifest;
}