Skip to content

Commit

Permalink
[all] Add command prepare and fix builids
Browse files Browse the repository at this point in the history
  • Loading branch information
smialy committed Nov 10, 2018
1 parent 36639b7 commit e3f0926
Show file tree
Hide file tree
Showing 23 changed files with 131 additions and 84 deletions.
3 changes: 2 additions & 1 deletion packages/sjs-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"build:exts": "renamer --path-element ext --find js --replace mjs dist/esm/*",
"test": "qunit --require ts-node/register tests/*",
"karma": "karma start --single-run",
"lint": "eslint tests && tslint src/*"
"lint": "eslint tests && tslint src/*",
"prepare": "npm run build"
},
"files": [
"README.md",
Expand Down
3 changes: 2 additions & 1 deletion packages/sjs-di/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"build:exts": "renamer --path-element ext --find js --replace mjs dist/esm/*",
"test": "qunit --require ts-node/register tests/*",
"karma": "karma start --single-run",
"lint": "eslint tests && tslint src/*"
"lint": "eslint tests && tslint src/*",
"prepare": "npm run build"
},
"files": [
"README.md",
Expand Down
3 changes: 2 additions & 1 deletion packages/sjs-dom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"build:clean": "rm -rf dist/ && rm -rf types",
"build:tsc": "tsc && tsc -p tsconfig.esm.json",
"build:exts": "renamer --path-element ext --find js --replace mjs dist/esm/*",
"lint": "tslint src/*"
"lint": "tslint src/*",
"prepare": "npm run build"
},
"files": [
"README.md",
Expand Down
3 changes: 2 additions & 1 deletion packages/sjs-events/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"build:exts": "renamer --path-element ext --find js --replace mjs dist/esm/*",
"test": "qunit --require ts-node/register tests/*",
"karma": "karma start --single-run",
"lint": "eslint tests && tslint src/*"
"lint": "eslint tests && tslint src/*",
"prepare": "npm run build"
},
"files": [
"README.md",
Expand Down
3 changes: 2 additions & 1 deletion packages/sjs-logging/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"build:exts": "renamer --path-element ext --find js --replace mjs dist/esm/*",
"test": "qunit --require ts-node/register tests/*",
"karma": "karma start --single-run",
"lint": "eslint tests && tslint src/*"
"lint": "eslint tests && tslint src/*",
"prepare": "npm run build"
},
"files": [
"README.md",
Expand Down
10 changes: 5 additions & 5 deletions packages/sjs-logging/types/consts.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export declare type LevelsType = {
export interface ILevelsType {
[key: string]: number;
};
export declare const LEVELS: LevelsType;
export interface LevelsNamesType {
}
export declare const LEVELS: ILevelsType;
export interface ILevelsNamesType {
[index: number]: string;
}
export declare const LEVEL_NAMES: LevelsNamesType;
export declare const LEVEL_NAMES: ILevelsNamesType;
20 changes: 2 additions & 18 deletions packages/sjs-logging/types/filter.d.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
import { IRecord, IFilter } from './interfaces';
export interface FilterFunction {
(record: IRecord): boolean;
}
import { IFilter, IRecord } from './interfaces';
export declare type FilterFunction = (record: IRecord) => boolean;
export declare type FilterType = FilterFunction & IFilter;
/**
* Base class for all filters
*/
export declare class Filter implements IFilter {
private _name;
constructor(name: string);
/**
* @param {Record} record
* @abstract
*/
filter(record: IRecord): boolean;
}
Expand All @@ -21,17 +15,7 @@ export declare class Filter implements IFilter {
export declare class Filterer {
private _filters;
constructor();
/**
* @param {Filter} filter
*/
addFilter(filter: FilterType): boolean;
/**
* @param {Filter} filter
*/
removeFilter(filter: FilterType): void;
/**
* @param {Record} record
* @return {boolean}
*/
filter(record: IRecord): boolean;
}
23 changes: 0 additions & 23 deletions packages/sjs-logging/types/handler.d.ts

This file was deleted.

8 changes: 1 addition & 7 deletions packages/sjs-logging/types/handlers.d.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
import { IRecord, IHandler } from './interfaces';
import { Filterer } from './filter';
import { IHandler, IRecord } from './interfaces';
export declare abstract class Handler extends Filterer implements IHandler {
level: number;
/**
* @param {number} [level=LEVELS.NOTSET]
*/
constructor(level?: number);
setLevel(level: number): void;
/**
* @param {Record} record
*/
handle(record: IRecord): boolean;
emit(record: IRecord): void;
flush(): void;
Expand Down
2 changes: 1 addition & 1 deletion packages/sjs-logging/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Manager } from './manager';
import { Logger } from './logger';
import { Manager } from './manager';
declare const logger: Logger;
export default logger;
export declare function getLogger(name: string): Logger;
Expand Down
10 changes: 5 additions & 5 deletions packages/sjs-logging/types/logger.d.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { IHandler, IRecord } from './interfaces';
import { Filterer } from './filter';
import { IHandler, IRecord } from './interfaces';
export declare class Logger extends Filterer {
private level;
private propagate;
private _handlers;
name: string;
manager?: any;
parent?: Logger;
private level;
private propagate;
private _handlers;
/**
* @param {string} name
* @param {number} [level=LEVELS.NOTSET] level
Expand All @@ -26,7 +26,7 @@ export declare class Logger extends Filterer {
* @return {boolean}
*/
hasHandlers(): number;
getHandlers(): Array<IHandler>;
getHandlers(): IHandler[];
/**
*
* @param {string} msg
Expand Down
2 changes: 1 addition & 1 deletion packages/sjs-logging/types/manager.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Logger } from './logger';
export declare class Manager {
disable: number;
private _loggers;
private _root;
disable: number;
constructor(root?: null, level?: number);
setDisable(level: number): void;
/**
Expand Down
3 changes: 2 additions & 1 deletion packages/sjs-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"build:exts": "renamer --path-element ext --find js --replace mjs dist/esm/*",
"test": "qunit --require ts-node/register tests/*",
"karma": "karma start --single-run",
"lint": "eslint tests && tslint src/*"
"lint": "eslint tests && tslint src/*",
"prepare": "npm run build"
},
"files": [
"README.md",
Expand Down
14 changes: 0 additions & 14 deletions packages/sjs-query/types/criterias.d.ts

This file was deleted.

2 changes: 1 addition & 1 deletion packages/sjs-query/types/filters.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export declare class Filter {
* @param {Array} list
* @return {Array}
*/
filter(list: Array<any>): Array<any>;
filter(list: any[]): any[];
tostring(): string;
eq(params: any): boolean;
lte(params: any): boolean;
Expand Down
1 change: 0 additions & 1 deletion packages/sjs-query/types/squery.d.ts

This file was deleted.

3 changes: 2 additions & 1 deletion packages/sjs-sm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"build:exts": "renamer --path-element ext --find js --replace mjs dist/esm/*",
"test": "qunit --require ts-node/register tests/*",
"karma": "karma start --single-run",
"lint": "eslint tests && tslint src/*"
"lint": "eslint tests && tslint src/*",
"prepare": "npm run build"
},
"files": [
"README.md",
Expand Down
3 changes: 2 additions & 1 deletion packages/sjs-stream/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"build:clean": "rm -rf dist/ && rm -rf types",
"build:tsc": "tsc && tsc -p tsconfig.esm.json",
"build:exts": "renamer --path-element ext --find js --replace mjs dist/esm/*",
"lint": "tslint src/*"
"lint": "tslint src/*",
"prepare": "npm run build"
},
"files": [
"README.md",
Expand Down
23 changes: 23 additions & 0 deletions packages/sjs-stream/types/controller.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { IControlerSubscribe, IControllerOptions, IObserverListener, IStream, IStreamSubscription } from './interfaces';
export declare class StreamController<T> implements IControlerSubscribe<T> {
private _state;
private _subscription;
private _options;
constructor(options?: IControllerOptions);
add(value: T): void;
addError(error: any): void;
close(): void;
readonly stream: IStream<T>;
_subscribe(listener: IObserverListener<T>): IStreamSubscription;
}
export declare class EventController<T> implements IControlerSubscribe<T> {
private _state;
private _subscriptions;
private _options;
constructor(options: IControllerOptions);
add(value: T): void;
addError(error: any): void;
close(): void;
readonly stream: IStream<T>;
_subscribe(listener: IObserverListener<T>): IStreamSubscription;
}
11 changes: 11 additions & 0 deletions packages/sjs-stream/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { EventController, StreamController } from './controller';
import { IStream } from './interfaces';
import { Stream } from './stream';
export { Stream, StreamController, EventController, };
export declare function fromItem(input: any): IStream<{}> | undefined;
export declare function fromFunction<T>(subscriber: (controller: StreamController<T>) => void): IStream<T>;
export declare function fromObservable<T>(input: any): IStream<T>;
export declare function fromArray<T>(array: ArrayLike<T>): IStream<{}>;
export declare function fromPromise<T>(promise: Promise<T>): IStream<{}>;
export declare function fromIterator<T>(items: Iterable<T>): IStream<{}>;
export declare function fromEvents(element: HTMLElement, eventName: string): IStream<{}>;
39 changes: 39 additions & 0 deletions packages/sjs-stream/types/interfaces.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
declare global {
interface ISymbolConstructor {
readonly observable: symbol;
}
}
export interface IObserver<T> {
next(value: T): void;
error(error: any): void;
complete(): void;
}
export declare type ISubscriberFunction<T> = ((observer: IObserver<T>) => (() => void) | IStreamSubscription);
export interface IObserverListener<T> {
onData(value: T): void;
onError(error: any): void;
onComplete(): void;
}
export interface IStreamSubscription {
cancel(): void;
}
export interface IStream<T> {
listen(onData?: (value: T) => void, onError?: (error: any) => void, onComplete?: () => void): IStreamSubscription;
listen(listener?: IObserverListener<T>): IStreamSubscription;
map(fn: () => void): IStream<T>;
filter(fn: () => void): IStream<T>;
pipe(...fns: Array<() => void>): IStream<T>;
}
export interface IControllerOptions {
onListen?: () => void;
onCancel?: () => void;
}
export interface IController<T> {
stream: IStream<T>;
add(value: T): void;
addError(error: any): void;
close(): void;
}
export interface IControlerSubscribe<T> extends IController<T> {
_subscribe(listener: IObserverListener<T>): IStreamSubscription;
}
21 changes: 21 additions & 0 deletions packages/sjs-stream/types/stream.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { IObserverListener, IStream, IStreamSubscription } from './interfaces';
export declare class BufferStreamSubscription<T> implements IStreamSubscription {
private _listener;
private _cancelHandler?;
private _state;
private _buff;
constructor(_listener: IObserverListener<T>, _cancelHandler?: ((sub: any) => void) | undefined);
_addData(data: T): void;
_addError(error: any): void;
_close(): void;
_flush(): void;
cancel(): void;
}
export declare abstract class Stream<T> implements IStream<T> {
listen(listener?: IObserverListener<T>): IStreamSubscription;
listen(onData?: (value: T) => void, onError?: (error: any) => void, onComplete?: () => void): IStreamSubscription;
_createSubscription(listener: IObserverListener<T>): IStreamSubscription;
map(fn: () => void): IStream<T>;
filter(fn: () => void): IStream<T>;
pipe(...fns: Array<() => void>): IStream<T>;
}
5 changes: 5 additions & 0 deletions packages/sjs-stream/types/utils.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { IObserverListener } from './interfaces';
export declare const noop: () => void;
export declare function toObserver<T>(onData?: IObserverListener<T> | ((value: T) => void), onError?: (error: any) => void, onComplete?: () => void): IObserverListener<T>;
export declare function runMethod(method?: (inputs?: any[]) => void, ...args: any[]): void;
export declare function enqueue(fn: () => void): void;

0 comments on commit e3f0926

Please sign in to comment.