strata.foundation.core 0.0.0-snapshot.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,24 @@
1
+ import { ICompletionStage } from "./ICompletionStage";
2
+ import { Observable } from "rxjs";
3
+ import { CompletionContext } from "./CompletionContext";
4
+ import { CompletionError } from "./CompletionError";
5
+ export declare class CompletableObservable<T> implements ICompletionStage<T> {
6
+ private observable;
7
+ protected constructor(observable: Observable<T> | Observable<CompletionContext<T>>, hasContext?: boolean);
8
+ thenApply<U>(func: (input: T) => U): ICompletionStage<U>;
9
+ thenCompose<U>(func: (input: T) => ICompletionStage<U>): ICompletionStage<U>;
10
+ thenAccept(consumer: (input: T) => void, handler?: (error: Error) => void): ICompletionStage<T>;
11
+ exceptionally(func: (error: Error) => T): ICompletionStage<T>;
12
+ subscribe(consumer?: (result: T) => void, handler?: (error: CompletionError) => void): void;
13
+ static fromResult<U>(result: U): ICompletionStage<U>;
14
+ static fromObservable<U>(observable: Observable<U>): ICompletionStage<U>;
15
+ static fromPromise<U>(promise: Promise<U>): ICompletionStage<U>;
16
+ static fromError<U>(error: Error): ICompletionStage<U>;
17
+ static supplyAsync<U>(supplier: () => U): ICompletionStage<U>;
18
+ private initializeObservable;
19
+ private doApply;
20
+ private doCompose;
21
+ private doAccept;
22
+ private doExceptionally;
23
+ private toObservable;
24
+ }
@@ -0,0 +1,129 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CompletableObservable = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const CompletionContext_1 = require("./CompletionContext");
7
+ const CompletionError_1 = require("./CompletionError");
8
+ class CompletableObservable {
9
+ observable;
10
+ constructor(observable, hasContext = false) {
11
+ if (hasContext)
12
+ this.observable = observable;
13
+ else
14
+ this.observable = this.initializeObservable(observable);
15
+ }
16
+ thenApply(func) {
17
+ return new CompletableObservable(this
18
+ .observable
19
+ .pipe((0, operators_1.map)(context => this.doApply(context, func))), true);
20
+ }
21
+ thenCompose(func) {
22
+ return new CompletableObservable(this
23
+ .observable
24
+ .pipe((0, operators_1.mergeMap)(context => this.toObservable(this.doCompose(func, context))
25
+ .pipe((0, operators_1.map)(context => context)))), true);
26
+ }
27
+ thenAccept(consumer, handler) {
28
+ return new CompletableObservable(this
29
+ .observable
30
+ .pipe((0, operators_1.map)(context => this.doAccept(context, consumer, handler))), true);
31
+ }
32
+ exceptionally(func) {
33
+ return new CompletableObservable(this
34
+ .observable
35
+ .pipe((0, operators_1.map)(context => this.doExceptionally(context, func))), true);
36
+ }
37
+ subscribe(consumer, handler) {
38
+ if (consumer == null)
39
+ consumer = result => { };
40
+ if (handler == null)
41
+ handler = error => { };
42
+ this
43
+ .observable
44
+ .subscribe(context => {
45
+ if (context.hasError())
46
+ handler(context.getError());
47
+ else
48
+ consumer(context.getResult());
49
+ }, error => handler(error));
50
+ }
51
+ static fromResult(result) {
52
+ return new CompletableObservable((0, rxjs_1.of)(result), false);
53
+ }
54
+ static fromObservable(observable) {
55
+ return new CompletableObservable(observable, false);
56
+ }
57
+ static fromPromise(promise) {
58
+ return new CompletableObservable((0, rxjs_1.from)(promise), false);
59
+ }
60
+ static fromError(error) {
61
+ return new CompletableObservable(new rxjs_1.Observable(observer => observer.next(CompletionContext_1.CompletionContext.ofError(new CompletionError_1.CompletionError(error)))), true);
62
+ }
63
+ static supplyAsync(supplier) {
64
+ return new CompletableObservable(new rxjs_1.Observable(observer => observer.next(supplier())), false);
65
+ }
66
+ initializeObservable(input) {
67
+ return input.pipe((0, operators_1.map)(value => CompletionContext_1.CompletionContext.ofResult(value)));
68
+ }
69
+ doApply(context, func) {
70
+ console.log("doApply");
71
+ if (context.hasError())
72
+ return CompletionContext_1.CompletionContext.ofError(context.getError());
73
+ try {
74
+ return CompletionContext_1.CompletionContext.ofResult(func(context.getResult()));
75
+ }
76
+ catch (e) {
77
+ console.log("Caught exception in doApply");
78
+ return CompletionContext_1.CompletionContext.ofError(new CompletionError_1.CompletionError(e));
79
+ }
80
+ }
81
+ doCompose(func, context) {
82
+ console.log("doCompose");
83
+ if (context.hasError())
84
+ return CompletionContext_1.CompletionContext.ofError(context.getError());
85
+ try {
86
+ return CompletionContext_1.CompletionContext.ofResult(func(context.getResult()));
87
+ }
88
+ catch (e) {
89
+ console.log("Caught exception in doCompose");
90
+ return CompletionContext_1.CompletionContext.ofError(e);
91
+ }
92
+ }
93
+ doAccept(context, consumer, handler) {
94
+ console.log("doAccept");
95
+ if (context.hasError()) {
96
+ if (handler != null) {
97
+ try {
98
+ handler(context.getError());
99
+ }
100
+ catch (e) {
101
+ console.log("Caught exception in doAccept");
102
+ return context.setError(new CompletionError_1.CompletionError(e));
103
+ }
104
+ }
105
+ }
106
+ else {
107
+ try {
108
+ consumer(context.getResult());
109
+ }
110
+ catch (e) {
111
+ return context.setError(new CompletionError_1.CompletionError(e));
112
+ }
113
+ }
114
+ return context;
115
+ }
116
+ doExceptionally(context, func) {
117
+ console.log("doExceptionally");
118
+ if (context.hasError())
119
+ return CompletionContext_1.CompletionContext.ofResult(func(context.getError()));
120
+ return context;
121
+ }
122
+ toObservable(input) {
123
+ if (input.hasResult())
124
+ return input.getResult().observable;
125
+ return this.observable.pipe((0, operators_1.map)((context, ignore) => CompletionContext_1.CompletionContext.ofError(input.getError())));
126
+ }
127
+ }
128
+ exports.CompletableObservable = CompletableObservable;
129
+ //# sourceMappingURL=CompletableObservable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CompletableObservable.js","sourceRoot":"","sources":["../../../main/typescript/Concurrent/CompletableObservable.ts"],"names":[],"mappings":";;;AACA,+BAAwC;AACxC,8CAA4C;AAC5C,2DAAsD;AACtD,uDAAkD;AAElD,MACM,qBAAqB;IAGf,UAAU,CAAmC;IAErD,YACI,UAA0D,EAC1D,aAAsB,KAAK;QAE3B,IAAI,UAAU;YACV,IAAI,CAAC,UAAU,GAAqC,UAAU,CAAC;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> {
3
+ private result;
4
+ private error;
5
+ protected constructor(result: T, error: CompletionError);
6
+ setResult(result: T): CompletionContext<T>;
7
+ clearResult(): CompletionContext<T>;
8
+ setError(error: CompletionError): CompletionContext<T>;
9
+ clearError(): CompletionContext<T>;
10
+ getResult(): T;
11
+ getError(): CompletionError;
12
+ hasResult(): boolean;
13
+ hasError(): boolean;
14
+ combine(other: CompletionContext<T>, combiner: (x: T, y: T) => T): CompletionContext<T>;
15
+ accept(consumer: (context: CompletionContext<T>) => void): CompletionContext<T>;
16
+ static empty<T>(): CompletionContext<T>;
17
+ static ofResult<T>(result: T): CompletionContext<T>;
18
+ static ofError<T>(error: CompletionError): CompletionContext<T>;
19
+ }
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CompletionContext = void 0;
4
+ const CompletionError_1 = require("./CompletionError");
5
+ class CompletionContext {
6
+ result;
7
+ error;
8
+ constructor(result, error) {
9
+ this.result = result;
10
+ this.error = error;
11
+ }
12
+ setResult(result) {
13
+ this.result = result;
14
+ return this;
15
+ }
16
+ clearResult() {
17
+ this.result = null;
18
+ return this;
19
+ }
20
+ setError(error) {
21
+ this.error = error;
22
+ return this;
23
+ }
24
+ clearError() {
25
+ this.error = null;
26
+ return this;
27
+ }
28
+ getResult() {
29
+ return this.result;
30
+ }
31
+ getError() {
32
+ return this.error;
33
+ }
34
+ hasResult() {
35
+ return this.result != null;
36
+ }
37
+ hasError() {
38
+ return this.error != null;
39
+ }
40
+ combine(other, combiner) {
41
+ if (this.hasError() || other.hasError()) {
42
+ let x = this.getError();
43
+ let y = other.getError();
44
+ if (x != null && y != null)
45
+ return new CompletionContext(combiner(this.getResult(), other.getResult()), new CompletionError_1.CompletionError([x.getCause(), y.getCause()]));
46
+ else if (x != null)
47
+ return new CompletionContext(combiner(this.getResult(), other.getResult()), x);
48
+ else
49
+ return new CompletionContext(combiner(this.getResult(), other.getResult()), y);
50
+ }
51
+ else {
52
+ return CompletionContext.ofResult(combiner(this.getResult(), other.getResult()));
53
+ }
54
+ }
55
+ accept(consumer) {
56
+ consumer(this);
57
+ return this;
58
+ }
59
+ static empty() {
60
+ return new CompletionContext(null, null);
61
+ }
62
+ static ofResult(result) {
63
+ return new CompletionContext(result, null);
64
+ }
65
+ static ofError(error) {
66
+ return new CompletionContext(null, error);
67
+ }
68
+ }
69
+ exports.CompletionContext = CompletionContext;
70
+ //# sourceMappingURL=CompletionContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CompletionContext.js","sourceRoot":"","sources":["../../../main/typescript/Concurrent/CompletionContext.ts"],"names":[],"mappings":";;;AAAA,uDAAkD;AAElD,MACM,iBAAiB;IAEX,MAAM,CAAI;IACV,KAAK,CAAkB;IAE/B,YAAsB,MAAS,EAAC,KAAsB;QAElD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACvB,CAAC;IAED,SAAS,CAAC,MAAS;QAEf,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,WAAW;QAEP,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,QAAQ,CAAC,KAAsB;QAE3B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,UAAU;QAEN,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,SAAS;QAEL,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAED,QAAQ;QAEJ,OAAO,IAAI,CAAC,KAAK,CAAC;IACtB,CAAC;IAED,SAAS;QAEL,OAAO,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC;IAC/B,CAAC;IAED,QAAQ;QAEJ,OAAO,IAAI,CAAC,KAAK,IAAI,IAAI,CA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M,EAAC,IAAI,CAAC,CAAC;IACjD,CAAC;IAED,MAAM,CAAC,OAAO,CAAI,KAAsB;QAEpC,OAAO,IAAI,iBAAiB,CAAI,IAAI,EAAC,KAAK,CAAC,CAAC;IAChD,CAAC;CACJ;AAvGD,8CAuGC"}
@@ -0,0 +1,5 @@
1
+ export declare class CompletionError extends Error {
2
+ private readonly itsCause;
3
+ constructor(cause: any);
4
+ getCause(): any;
5
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CompletionError = void 0;
4
+ class CompletionError extends Error {
5
+ itsCause;
6
+ constructor(cause) {
7
+ super(cause instanceof Error ? cause.message : cause.toString());
8
+ this.itsCause = cause;
9
+ }
10
+ getCause() {
11
+ return this.itsCause;
12
+ }
13
+ }
14
+ exports.CompletionError = CompletionError;
15
+ //# sourceMappingURL=CompletionError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CompletionError.js","sourceRoot":"","sources":["../../../main/typescript/Concurrent/CompletionError.ts"],"names":[],"mappings":";;;AAAA,MACM,eACF,SAAQ,KAAK;IAEI,QAAQ,CAAM;IAE/B,YAAY,KAAU;QAElB,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;QACjE,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;IAC1B,CAAC;IAED,QAAQ;QAEJ,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;CACJ;AAhBD,0CAgBC"}
@@ -0,0 +1,7 @@
1
+ export interface ICompletionStage<T> {
2
+ thenApply<U>(func: (input: T) => U): ICompletionStage<U>;
3
+ thenCompose<U>(func: (input: T) => ICompletionStage<U>): ICompletionStage<U>;
4
+ thenAccept(consumer: (result: T) => void, handler?: (error: Error) => void): ICompletionStage<T>;
5
+ exceptionally(func: (error: Error) => T): ICompletionStage<T>;
6
+ subscribe(consumer?: (result: T) => void, handler?: (error: Error) => void): void;
7
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=ICompletionStage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ICompletionStage.js","sourceRoot":"","sources":["../../../main/typescript/Concurrent/ICompletionStage.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ export { ICompletionStage } from './ICompletionStage';
2
+ export { CompletableObservable } from './CompletableObservable';
3
+ export { CompletionContext } from './CompletionContext';
4
+ export { CompletionError } from './CompletionError';
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CompletionError = exports.CompletionContext = exports.CompletableObservable = void 0;
4
+ var CompletableObservable_1 = require("./CompletableObservable");
5
+ Object.defineProperty(exports, "CompletableObservable", { enumerable: true, get: function () { return CompletableObservable_1.CompletableObservable; } });
6
+ var CompletionContext_1 = require("./CompletionContext");
7
+ Object.defineProperty(exports, "CompletionContext", { enumerable: true, get: function () { return CompletionContext_1.CompletionContext; } });
8
+ var CompletionError_1 = require("./CompletionError");
9
+ Object.defineProperty(exports, "CompletionError", { enumerable: true, get: function () { return CompletionError_1.CompletionError; } });
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../main/typescript/Concurrent/index.ts"],"names":[],"mappings":";;;AACA,iEAA8D;AAAtD,8HAAA,qBAAqB,OAAA;AAC7B,yDAAsD;AAA9C,sHAAA,iBAAiB,OAAA;AACzB,qDAAkD;AAA1C,kHAAA,eAAe,OAAA"}
@@ -0,0 +1,12 @@
1
+ export interface IMultiMap<K, V> {
2
+ put(key: K, value: V): IMultiMap<K, V>;
3
+ remove(key: K): IMultiMap<K, V>;
4
+ remove(key: K, value: V): IMultiMap<K, V>;
5
+ get(key: K): Array<V>;
6
+ getAt(key: K, index: number): V;
7
+ getCardinality(key: K): number;
8
+ getKeys(): Array<K>;
9
+ getValues(): Array<Array<V>>;
10
+ containsKey(key: K): boolean;
11
+ containsValue(key: K, value: V): boolean;
12
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=IMultiMap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IMultiMap.js","sourceRoot":"","sources":["../../../main/typescript/Container/IMultiMap.ts"],"names":[],"mappings":""}
@@ -0,0 +1,15 @@
1
+ import { IMultiMap } from "./IMultiMap";
2
+ export declare class MultiMap<K, V> implements IMultiMap<K, V> {
3
+ private imp;
4
+ constructor();
5
+ put(key: K, value: V): IMultiMap<K, V>;
6
+ remove(key: K): IMultiMap<K, V>;
7
+ remove(key: K, value: V): IMultiMap<K, V>;
8
+ get(key: K): Array<V>;
9
+ getAt(key: K, index: number): V;
10
+ getCardinality(key: K): number;
11
+ getKeys(): Array<K>;
12
+ getValues(): Array<Array<V>>;
13
+ containsKey(key: K): boolean;
14
+ containsValue(key: K, value: V): boolean;
15
+ }
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MultiMap = void 0;
4
+ class MultiMap {
5
+ imp;
6
+ constructor() {
7
+ this.imp = new Map();
8
+ }
9
+ put(key, value) {
10
+ if (key == null)
11
+ throw new Error("key is null");
12
+ if (!this.imp.has(key))
13
+ this.imp.set(key, new Array());
14
+ this.imp.get(key).push(value);
15
+ return this;
16
+ }
17
+ remove(key, value) {
18
+ if (value) {
19
+ if (this.imp.has(key)) {
20
+ let values = this.imp.get(key);
21
+ values.slice(values.indexOf(value), 1);
22
+ }
23
+ }
24
+ else {
25
+ if (this.imp.has(key))
26
+ this.imp.delete(key);
27
+ }
28
+ return this;
29
+ }
30
+ get(key) {
31
+ return this.imp.get(key);
32
+ }
33
+ getAt(key, index) {
34
+ return this.imp.get(key)[index];
35
+ }
36
+ getCardinality(key) {
37
+ return this.imp.get(key).length;
38
+ }
39
+ getKeys() {
40
+ return Array.from(this.imp.keys());
41
+ }
42
+ getValues() {
43
+ return Array.from(this.imp.values());
44
+ }
45
+ containsKey(key) {
46
+ return this.imp.has(key);
47
+ }
48
+ containsValue(key, value) {
49
+ if (this.containsKey(key))
50
+ return this.get(key).includes(value);
51
+ return false;
52
+ }
53
+ }
54
+ exports.MultiMap = MultiMap;
55
+ //# sourceMappingURL=MultiMap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MultiMap.js","sourceRoot":"","sources":["../../../main/typescript/Container/MultiMap.ts"],"names":[],"mappings":";;;AAEA,MACM,QAAQ;IAGF,GAAG,CAAkB;IAE7B;QAEI,IAAI,CAAC,GAAG,GAAG,IAAI,GAAG,EAAc,CAAC;IACrC,CAAC;IAED,GAAG,CAAC,GAAM,EAAE,KAAQ;QAEhB,IAAK,GAAG,IAAI,IAAI;YACZ,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC;QAEnC,IAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAE,GAAG,CAAE;YACrB,IAAI,CAAC,GAAG,CAAC,GAAG,CAAE,GAAG,EAAC,IAAI,KAAK,EAAK,CAAE,CAAC;QAEvC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAE,GAAG,CAAE,CAAC,IAAI,CAAE,KAAK,CAAE,CAAC;QAClC,OAAO,IAAI,CAAC;IAChB,CAAC;IAID,MAAM,CAAC,GAAM,EAAE,KAAS;QAEpB,IAAI,KAAK,EACT;YACI,IAAK,IAAI,CAAC,GAAG,CAAC,GAAG,CAAE,GAAG,CAAE,EACxB;gBACI,IAAI,MAAM,GAAa,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;gBAEzC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAC,CAAC,CAAC,CAAC;aACzC;SACJ;aAED;YACI,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC;gBACjB,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;SAC5B;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,GAAG,CAAC,GAAM;QAEN,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IAED,KAAK,CAAC,GAAM,EAAE,KAAa;QAEvB,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;IAED,cAAc,CAAC,GAAM;QAEjB,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,CAAC;IAED,OAAO;QAEH,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;IACvC,CAAC;IAED,SAAS;QAEL,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;IACzC,CAAC;IAED,WAAW,CAAC,GAAM;QAEd,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IAED,aAAa,CAAC,GAAM,EAAE,KAAQ;QAE1B,IAAI,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC;YACrB,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAEzC,OAAO,KAAK,CAAC;IACjB,CAAC;CAEJ;AAnFD,4BAmFC"}
@@ -0,0 +1,2 @@
1
+ export { IMultiMap } from './IMultiMap';
2
+ export { MultiMap } from './MultiMap';
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MultiMap = void 0;
4
+ var MultiMap_1 = require("./MultiMap");
5
+ Object.defineProperty(exports, "MultiMap", { enumerable: true, get: function () { return MultiMap_1.MultiMap; } });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../main/typescript/Container/index.ts"],"names":[],"mappings":";;;AACA,uCAAoC;AAA5B,oGAAA,QAAQ,OAAA"}
package/package.json ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "strata.foundation.core",
3
+ "version": "0.0.0-snapshot.1",
4
+ "license": "Apache-2.0",
5
+ "scripts": {
6
+ "increment-major": "npm version major",
7
+ "increment-minor": "npm version minor",
8
+ "increment-patch": "npm version patch"
9
+ }
10
+ }