Skip to content

Commit

Permalink
Merge pull request #666 from terascope/add-short-id-to-index
Browse files Browse the repository at this point in the history
Add short id to index
  • Loading branch information
ciorg authored Oct 18, 2022
2 parents 8d5282a + 8b95223 commit 6e2a738
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 4 deletions.
2 changes: 1 addition & 1 deletion asset/asset.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "standard",
"version": "0.17.0",
"version": "0.17.1",
"description": "Teraslice standard processor asset bundle"
}
2 changes: 1 addition & 1 deletion asset/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "standard",
"version": "0.17.0",
"version": "0.17.1",
"description": "Teraslice standard processor asset bundle",
"license": "MIT",
"private": true,
Expand Down
2 changes: 1 addition & 1 deletion asset/src/add_short_id/processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { UniqueIdOpConfig } from './interfaces';
* uses https://www.npmjs.com/package/short-unique-id to build the id
*/

export default class AddUniqueId extends MapProcessor<OpConfig> {
export default class AddShortId extends MapProcessor<OpConfig> {
uniqueId: ShortUniqueId;

constructor(context: WorkerContext, opConfig: UniqueIdOpConfig, exConfig: ExecutionConfig) {
Expand Down
7 changes: 7 additions & 0 deletions asset/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import AccumulateSchema from './accumulate/schema';
import AccumulateByKey from './accumulate_by_key/processor';
import AccumulateByKeySchema from './accumulate_by_key/schema';

import AddShortId from './add_short_id/processor';
import AddShortIdSchema from './add_short_id/schema';

import DataGeneratorFetcher from './data_generator/fetcher';
import DataGeneratorSchema from './data_generator/schema';
import DataGeneratorSlicer from './data_generator/slicer';
Expand Down Expand Up @@ -77,6 +80,10 @@ export const ASSETS = {
Processor: AccumulateByKey,
Schema: AccumulateByKeySchema
},
add_short_id: {
Processor: AddShortId,
Schema: AddShortIdSchema
},
data_generator: {
Fetcher: DataGeneratorFetcher,
Schema: DataGeneratorSchema,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "standard-assets-bundle",
"version": "0.17.0",
"version": "0.17.1",
"description": "Teraslice standard processor asset bundle",
"private": true,
"workspaces": [
Expand Down
25 changes: 25 additions & 0 deletions test/index-spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import path from 'path';
import fs from 'fs';
import processors = require('../asset/src');

const assetDir = path.join(__dirname, '..', 'asset', 'src');

describe('index', () => {
it('should export every processor', () => {
const processorDirs = fs.readdirSync(assetDir, { withFileTypes: true })
.filter((i) => isProcessor(i.name))
.map((i) => i.name);

for (const p of processorDirs) {
expect(p in processors.ASSETS).toBe(true);
}
});
});

function isProcessor(dirName: string) {
try {
return fs.readdirSync(path.join(assetDir, dirName)).includes('processor.ts');
} catch (e) {
return false;
}
}

0 comments on commit 6e2a738

Please sign in to comment.