@hotmeshio/hotmesh 0.4.0 → 0.4.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.
- package/build/modules/enums.d.ts +110 -0
- package/build/modules/enums.js +134 -0
- package/build/modules/errors.d.ts +124 -0
- package/build/modules/errors.js +191 -0
- package/build/modules/key.d.ts +66 -0
- package/build/modules/key.js +190 -0
- package/build/modules/storage.d.ts +3 -0
- package/build/modules/storage.js +5 -0
- package/build/modules/utils.d.ts +119 -0
- package/build/modules/utils.js +374 -0
- package/build/package.json +1 -1
- package/build/services/activities/activity.d.ts +104 -0
- package/build/services/activities/activity.js +549 -0
- package/build/services/activities/await.d.ts +12 -0
- package/build/services/activities/await.js +114 -0
- package/build/services/activities/cycle.d.ts +19 -0
- package/build/services/activities/cycle.js +112 -0
- package/build/services/activities/hook.d.ts +27 -0
- package/build/services/activities/hook.js +168 -0
- package/build/services/activities/index.d.ts +19 -0
- package/build/services/activities/index.js +20 -0
- package/build/services/activities/interrupt.d.ts +16 -0
- package/build/services/activities/interrupt.js +158 -0
- package/build/services/activities/signal.d.ts +20 -0
- package/build/services/activities/signal.js +134 -0
- package/build/services/activities/trigger.d.ts +37 -0
- package/build/services/activities/trigger.js +246 -0
- package/build/services/activities/worker.d.ts +12 -0
- package/build/services/activities/worker.js +106 -0
- package/build/services/collator/index.d.ts +111 -0
- package/build/services/collator/index.js +293 -0
- package/build/services/compiler/deployer.d.ts +40 -0
- package/build/services/compiler/deployer.js +488 -0
- package/build/services/compiler/index.d.ts +32 -0
- package/build/services/compiler/index.js +112 -0
- package/build/services/compiler/validator.d.ts +34 -0
- package/build/services/compiler/validator.js +147 -0
- package/build/services/connector/factory.d.ts +22 -0
- package/build/services/connector/factory.js +99 -0
- package/build/services/connector/index.d.ts +30 -0
- package/build/services/connector/index.js +54 -0
- package/build/services/connector/providers/ioredis.d.ts +9 -0
- package/build/services/connector/providers/ioredis.js +26 -0
- package/build/services/connector/providers/nats.d.ts +9 -0
- package/build/services/connector/providers/nats.js +34 -0
- package/build/services/connector/providers/postgres.d.ts +20 -0
- package/build/services/connector/providers/postgres.js +102 -0
- package/build/services/connector/providers/redis.d.ts +9 -0
- package/build/services/connector/providers/redis.js +38 -0
- package/build/services/engine/index.d.ts +264 -0
- package/build/services/engine/index.js +761 -0
- package/build/services/exporter/index.d.ts +44 -0
- package/build/services/exporter/index.js +126 -0
- package/build/services/hotmesh/index.d.ts +483 -0
- package/build/services/hotmesh/index.js +622 -0
- package/build/services/logger/index.d.ts +16 -0
- package/build/services/logger/index.js +54 -0
- package/build/services/mapper/index.d.ts +28 -0
- package/build/services/mapper/index.js +81 -0
- package/build/services/memflow/client.d.ts +108 -0
- package/build/services/memflow/client.js +372 -0
- package/build/services/memflow/connection.d.ts +23 -0
- package/build/services/memflow/connection.js +33 -0
- package/build/services/memflow/context.d.ts +143 -0
- package/build/services/memflow/context.js +299 -0
- package/build/services/memflow/exporter.d.ts +51 -0
- package/build/services/memflow/exporter.js +215 -0
- package/build/services/memflow/handle.d.ts +90 -0
- package/build/services/memflow/handle.js +176 -0
- package/build/services/memflow/index.d.ts +116 -0
- package/build/services/memflow/index.js +122 -0
- package/build/services/memflow/schemas/factory.d.ts +29 -0
- package/build/services/memflow/schemas/factory.js +2492 -0
- package/build/services/memflow/search.d.ts +142 -0
- package/build/services/memflow/search.js +320 -0
- package/build/services/memflow/worker.d.ts +124 -0
- package/build/services/memflow/worker.js +514 -0
- package/build/services/memflow/workflow/all.d.ts +7 -0
- package/build/services/memflow/workflow/all.js +15 -0
- package/build/services/memflow/workflow/common.d.ts +20 -0
- package/build/services/memflow/workflow/common.js +47 -0
- package/build/services/memflow/workflow/context.d.ts +6 -0
- package/build/services/memflow/workflow/context.js +45 -0
- package/build/services/memflow/workflow/contextMethods.d.ts +14 -0
- package/build/services/memflow/workflow/contextMethods.js +33 -0
- package/build/services/memflow/workflow/didRun.d.ts +7 -0
- package/build/services/memflow/workflow/didRun.js +22 -0
- package/build/services/memflow/workflow/emit.d.ts +11 -0
- package/build/services/memflow/workflow/emit.js +29 -0
- package/build/services/memflow/workflow/enrich.d.ts +9 -0
- package/build/services/memflow/workflow/enrich.js +17 -0
- package/build/services/memflow/workflow/execChild.d.ts +18 -0
- package/build/services/memflow/workflow/execChild.js +102 -0
- package/build/services/memflow/workflow/execHook.d.ts +65 -0
- package/build/services/memflow/workflow/execHook.js +73 -0
- package/build/services/memflow/workflow/hook.d.ts +9 -0
- package/build/services/memflow/workflow/hook.js +56 -0
- package/build/services/memflow/workflow/index.d.ts +74 -0
- package/build/services/memflow/workflow/index.js +87 -0
- package/build/services/memflow/workflow/interrupt.d.ts +9 -0
- package/build/services/memflow/workflow/interrupt.js +24 -0
- package/build/services/memflow/workflow/isSideEffectAllowed.d.ts +10 -0
- package/build/services/memflow/workflow/isSideEffectAllowed.js +33 -0
- package/build/services/memflow/workflow/proxyActivities.d.ts +20 -0
- package/build/services/memflow/workflow/proxyActivities.js +97 -0
- package/build/services/memflow/workflow/random.d.ts +6 -0
- package/build/services/memflow/workflow/random.js +16 -0
- package/build/services/memflow/workflow/searchMethods.d.ts +6 -0
- package/build/services/memflow/workflow/searchMethods.js +25 -0
- package/build/services/memflow/workflow/signal.d.ts +7 -0
- package/build/services/memflow/workflow/signal.js +28 -0
- package/build/services/memflow/workflow/sleepFor.d.ts +8 -0
- package/build/services/memflow/workflow/sleepFor.js +35 -0
- package/build/services/memflow/workflow/trace.d.ts +14 -0
- package/build/services/memflow/workflow/trace.js +33 -0
- package/build/services/memflow/workflow/waitFor.d.ts +8 -0
- package/build/services/memflow/workflow/waitFor.js +35 -0
- package/build/services/meshcall/index.d.ts +194 -0
- package/build/services/meshcall/index.js +452 -0
- package/build/services/meshcall/schemas/factory.d.ts +9 -0
- package/build/services/meshcall/schemas/factory.js +189 -0
- package/build/services/meshdata/index.d.ts +795 -0
- package/build/services/meshdata/index.js +1235 -0
- package/build/services/meshos/index.d.ts +293 -0
- package/build/services/meshos/index.js +547 -0
- package/build/services/pipe/functions/array.d.ts +17 -0
- package/build/services/pipe/functions/array.js +74 -0
- package/build/services/pipe/functions/bitwise.d.ts +9 -0
- package/build/services/pipe/functions/bitwise.js +24 -0
- package/build/services/pipe/functions/conditional.d.ts +13 -0
- package/build/services/pipe/functions/conditional.js +36 -0
- package/build/services/pipe/functions/cron.d.ts +12 -0
- package/build/services/pipe/functions/cron.js +40 -0
- package/build/services/pipe/functions/date.d.ts +58 -0
- package/build/services/pipe/functions/date.js +171 -0
- package/build/services/pipe/functions/index.d.ts +29 -0
- package/build/services/pipe/functions/index.js +30 -0
- package/build/services/pipe/functions/json.d.ts +5 -0
- package/build/services/pipe/functions/json.js +12 -0
- package/build/services/pipe/functions/logical.d.ts +5 -0
- package/build/services/pipe/functions/logical.js +12 -0
- package/build/services/pipe/functions/math.d.ts +42 -0
- package/build/services/pipe/functions/math.js +184 -0
- package/build/services/pipe/functions/number.d.ts +21 -0
- package/build/services/pipe/functions/number.js +60 -0
- package/build/services/pipe/functions/object.d.ts +25 -0
- package/build/services/pipe/functions/object.js +81 -0
- package/build/services/pipe/functions/string.d.ts +23 -0
- package/build/services/pipe/functions/string.js +69 -0
- package/build/services/pipe/functions/symbol.d.ts +12 -0
- package/build/services/pipe/functions/symbol.js +33 -0
- package/build/services/pipe/functions/unary.d.ts +7 -0
- package/build/services/pipe/functions/unary.js +18 -0
- package/build/services/pipe/index.d.ts +48 -0
- package/build/services/pipe/index.js +242 -0
- package/build/services/quorum/index.d.ts +90 -0
- package/build/services/quorum/index.js +263 -0
- package/build/services/reporter/index.d.ts +50 -0
- package/build/services/reporter/index.js +348 -0
- package/build/services/router/config/index.d.ts +11 -0
- package/build/services/router/config/index.js +36 -0
- package/build/services/router/consumption/index.d.ts +34 -0
- package/build/services/router/consumption/index.js +395 -0
- package/build/services/router/error-handling/index.d.ts +8 -0
- package/build/services/router/error-handling/index.js +98 -0
- package/build/services/router/index.d.ts +57 -0
- package/build/services/router/index.js +121 -0
- package/build/services/router/lifecycle/index.d.ts +27 -0
- package/build/services/router/lifecycle/index.js +80 -0
- package/build/services/router/telemetry/index.d.ts +11 -0
- package/build/services/router/telemetry/index.js +32 -0
- package/build/services/router/throttling/index.d.ts +23 -0
- package/build/services/router/throttling/index.js +76 -0
- package/build/services/search/factory.d.ts +7 -0
- package/build/services/search/factory.js +24 -0
- package/build/services/search/index.d.ts +23 -0
- package/build/services/search/index.js +10 -0
- package/build/services/search/providers/postgres/postgres.d.ts +25 -0
- package/build/services/search/providers/postgres/postgres.js +149 -0
- package/build/services/search/providers/redis/ioredis.d.ts +19 -0
- package/build/services/search/providers/redis/ioredis.js +121 -0
- package/build/services/search/providers/redis/redis.d.ts +19 -0
- package/build/services/search/providers/redis/redis.js +134 -0
- package/build/services/serializer/index.d.ts +42 -0
- package/build/services/serializer/index.js +282 -0
- package/build/services/store/cache.d.ts +67 -0
- package/build/services/store/cache.js +128 -0
- package/build/services/store/factory.d.ts +8 -0
- package/build/services/store/factory.js +24 -0
- package/build/services/store/index.d.ts +89 -0
- package/build/services/store/index.js +9 -0
- package/build/services/store/providers/postgres/kvsql.d.ts +168 -0
- package/build/services/store/providers/postgres/kvsql.js +198 -0
- package/build/services/store/providers/postgres/kvtables.d.ts +20 -0
- package/build/services/store/providers/postgres/kvtables.js +441 -0
- package/build/services/store/providers/postgres/kvtransaction.d.ts +36 -0
- package/build/services/store/providers/postgres/kvtransaction.js +248 -0
- package/build/services/store/providers/postgres/kvtypes/hash.d.ts +60 -0
- package/build/services/store/providers/postgres/kvtypes/hash.js +1287 -0
- package/build/services/store/providers/postgres/kvtypes/list.d.ts +33 -0
- package/build/services/store/providers/postgres/kvtypes/list.js +194 -0
- package/build/services/store/providers/postgres/kvtypes/string.d.ts +20 -0
- package/build/services/store/providers/postgres/kvtypes/string.js +115 -0
- package/build/services/store/providers/postgres/kvtypes/zset.d.ts +41 -0
- package/build/services/store/providers/postgres/kvtypes/zset.js +214 -0
- package/build/services/store/providers/postgres/postgres.d.ts +145 -0
- package/build/services/store/providers/postgres/postgres.js +1036 -0
- package/build/services/store/providers/redis/_base.d.ts +137 -0
- package/build/services/store/providers/redis/_base.js +980 -0
- package/build/services/store/providers/redis/ioredis.d.ts +20 -0
- package/build/services/store/providers/redis/ioredis.js +180 -0
- package/build/services/store/providers/redis/redis.d.ts +18 -0
- package/build/services/store/providers/redis/redis.js +199 -0
- package/build/services/store/providers/store-initializable.d.ts +5 -0
- package/build/services/store/providers/store-initializable.js +2 -0
- package/build/services/stream/factory.d.ts +8 -0
- package/build/services/stream/factory.js +37 -0
- package/build/services/stream/index.d.ts +69 -0
- package/build/services/stream/index.js +11 -0
- package/build/services/stream/providers/nats/nats.d.ts +60 -0
- package/build/services/stream/providers/nats/nats.js +225 -0
- package/build/services/stream/providers/postgres/kvtables.d.ts +3 -0
- package/build/services/stream/providers/postgres/kvtables.js +146 -0
- package/build/services/stream/providers/postgres/postgres.d.ts +107 -0
- package/build/services/stream/providers/postgres/postgres.js +519 -0
- package/build/services/stream/providers/redis/ioredis.d.ts +61 -0
- package/build/services/stream/providers/redis/ioredis.js +272 -0
- package/build/services/stream/providers/redis/redis.d.ts +61 -0
- package/build/services/stream/providers/redis/redis.js +305 -0
- package/build/services/stream/providers/stream-initializable.d.ts +4 -0
- package/build/services/stream/providers/stream-initializable.js +2 -0
- package/build/services/sub/factory.d.ts +7 -0
- package/build/services/sub/factory.js +29 -0
- package/build/services/sub/index.d.ts +22 -0
- package/build/services/sub/index.js +10 -0
- package/build/services/sub/providers/nats/nats.d.ts +19 -0
- package/build/services/sub/providers/nats/nats.js +105 -0
- package/build/services/sub/providers/postgres/postgres.d.ts +19 -0
- package/build/services/sub/providers/postgres/postgres.js +92 -0
- package/build/services/sub/providers/redis/ioredis.d.ts +17 -0
- package/build/services/sub/providers/redis/ioredis.js +81 -0
- package/build/services/sub/providers/redis/redis.d.ts +17 -0
- package/build/services/sub/providers/redis/redis.js +72 -0
- package/build/services/task/index.d.ts +36 -0
- package/build/services/task/index.js +206 -0
- package/build/services/telemetry/index.d.ts +52 -0
- package/build/services/telemetry/index.js +306 -0
- package/build/services/worker/index.d.ts +77 -0
- package/build/services/worker/index.js +197 -0
- package/package.json +1 -1
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -38
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
- package/typedoc.json +0 -47
- package/types/activity.ts +0 -268
- package/types/app.ts +0 -20
- package/types/async.ts +0 -6
- package/types/cache.ts +0 -1
- package/types/collator.ts +0 -9
- package/types/error.ts +0 -56
- package/types/exporter.ts +0 -102
- package/types/hook.ts +0 -44
- package/types/hotmesh.ts +0 -314
- package/types/index.ts +0 -306
- package/types/job.ts +0 -233
- package/types/logger.ts +0 -8
- package/types/manifest.ts +0 -70
- package/types/map.ts +0 -5
- package/types/memflow.ts +0 -645
- package/types/meshcall.ts +0 -235
- package/types/meshdata.ts +0 -278
- package/types/ms.d.ts +0 -7
- package/types/nats.ts +0 -270
- package/types/pipe.ts +0 -90
- package/types/postgres.ts +0 -114
- package/types/provider.ts +0 -161
- package/types/quorum.ts +0 -167
- package/types/redis.ts +0 -404
- package/types/serializer.ts +0 -40
- package/types/stats.ts +0 -117
- package/types/stream.ts +0 -231
- package/types/task.ts +0 -7
- package/types/telemetry.ts +0 -16
- package/types/transition.ts +0 -20
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NumberHandler = void 0;
|
|
4
|
+
class NumberHandler {
|
|
5
|
+
isFinite(input) {
|
|
6
|
+
return Number.isFinite(input);
|
|
7
|
+
}
|
|
8
|
+
isEven(input) {
|
|
9
|
+
return !isNaN(input) && input % 2 === 0;
|
|
10
|
+
}
|
|
11
|
+
isOdd(input) {
|
|
12
|
+
return !isNaN(input) && input % 2 !== 0;
|
|
13
|
+
}
|
|
14
|
+
isInteger(input) {
|
|
15
|
+
return Number.isInteger(input);
|
|
16
|
+
}
|
|
17
|
+
isNaN(input) {
|
|
18
|
+
return Number.isNaN(input);
|
|
19
|
+
}
|
|
20
|
+
parseFloat(input) {
|
|
21
|
+
return parseFloat(input);
|
|
22
|
+
}
|
|
23
|
+
parseInt(input, radix) {
|
|
24
|
+
return parseInt(input, radix);
|
|
25
|
+
}
|
|
26
|
+
toFixed(input, digits) {
|
|
27
|
+
return input.toFixed(digits);
|
|
28
|
+
}
|
|
29
|
+
toExponential(input, fractionalDigits) {
|
|
30
|
+
return input.toExponential(fractionalDigits);
|
|
31
|
+
}
|
|
32
|
+
toPrecision(input, precision) {
|
|
33
|
+
return input.toPrecision(precision);
|
|
34
|
+
}
|
|
35
|
+
gte(input, compareValue) {
|
|
36
|
+
return input >= compareValue;
|
|
37
|
+
}
|
|
38
|
+
lte(input, compareValue) {
|
|
39
|
+
return input <= compareValue;
|
|
40
|
+
}
|
|
41
|
+
gt(input, compareValue) {
|
|
42
|
+
return input > compareValue;
|
|
43
|
+
}
|
|
44
|
+
lt(input, compareValue) {
|
|
45
|
+
return input < compareValue;
|
|
46
|
+
}
|
|
47
|
+
max(...values) {
|
|
48
|
+
return Math.max(...values);
|
|
49
|
+
}
|
|
50
|
+
min(...values) {
|
|
51
|
+
return Math.min(...values);
|
|
52
|
+
}
|
|
53
|
+
pow(base, exponent) {
|
|
54
|
+
return Math.pow(base, exponent);
|
|
55
|
+
}
|
|
56
|
+
round(input) {
|
|
57
|
+
return Math.round(input);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.NumberHandler = NumberHandler;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
declare class ObjectHandler {
|
|
2
|
+
get(obj: object, prop: string | symbol): any;
|
|
3
|
+
set(obj: object, prop: string | symbol, value: any): any;
|
|
4
|
+
create(...args: any[]): object;
|
|
5
|
+
keys(obj: object): string[];
|
|
6
|
+
values(obj: object): any[];
|
|
7
|
+
entries(obj: object): [string, any][];
|
|
8
|
+
fromEntries(iterable: Iterable<[string, any]>): object;
|
|
9
|
+
assign(target: object, ...sources: object[]): object;
|
|
10
|
+
getOwnPropertyNames(obj: object): string[];
|
|
11
|
+
getOwnPropertySymbols(obj: object): symbol[];
|
|
12
|
+
getOwnPropertyDescriptor(obj: object, prop: string | symbol): PropertyDescriptor | undefined;
|
|
13
|
+
defineProperty(obj: object, prop: string | symbol, descriptor: PropertyDescriptor): object;
|
|
14
|
+
defineProperties(obj: object, props: PropertyDescriptorMap): object;
|
|
15
|
+
freeze(obj: object): object;
|
|
16
|
+
isFrozen(obj: object): boolean;
|
|
17
|
+
seal(obj: object): object;
|
|
18
|
+
isSealed(obj: object): boolean;
|
|
19
|
+
preventExtensions(obj: object): object;
|
|
20
|
+
isExtensible(obj: object): boolean;
|
|
21
|
+
hasOwnProperty(obj: object, prop: string | symbol): boolean;
|
|
22
|
+
isPrototypeOf(obj: object, prototypeObj: object): boolean;
|
|
23
|
+
propertyIsEnumerable(obj: object, prop: string | symbol): boolean;
|
|
24
|
+
}
|
|
25
|
+
export { ObjectHandler };
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ObjectHandler = void 0;
|
|
4
|
+
class ObjectHandler {
|
|
5
|
+
get(obj, prop) {
|
|
6
|
+
return obj?.[prop];
|
|
7
|
+
}
|
|
8
|
+
set(obj, prop, value) {
|
|
9
|
+
if (!obj)
|
|
10
|
+
obj = {};
|
|
11
|
+
obj[prop] = value;
|
|
12
|
+
return obj;
|
|
13
|
+
}
|
|
14
|
+
create(...args) {
|
|
15
|
+
const obj = {};
|
|
16
|
+
if (args.length === 0)
|
|
17
|
+
return obj;
|
|
18
|
+
for (let i = 0; i < args.length; i += 2) {
|
|
19
|
+
obj[args[i]] = args[i + 1];
|
|
20
|
+
}
|
|
21
|
+
return obj;
|
|
22
|
+
}
|
|
23
|
+
keys(obj) {
|
|
24
|
+
return obj && Object.keys(obj) || [];
|
|
25
|
+
}
|
|
26
|
+
values(obj) {
|
|
27
|
+
return obj && Object.values(obj) || [];
|
|
28
|
+
}
|
|
29
|
+
entries(obj) {
|
|
30
|
+
return obj && Object.entries(obj) || [];
|
|
31
|
+
}
|
|
32
|
+
fromEntries(iterable) {
|
|
33
|
+
return Object.fromEntries(iterable);
|
|
34
|
+
}
|
|
35
|
+
assign(target, ...sources) {
|
|
36
|
+
return Object.assign(target || {}, ...sources);
|
|
37
|
+
}
|
|
38
|
+
getOwnPropertyNames(obj) {
|
|
39
|
+
return Object.getOwnPropertyNames(obj || {});
|
|
40
|
+
}
|
|
41
|
+
getOwnPropertySymbols(obj) {
|
|
42
|
+
return Object.getOwnPropertySymbols(obj || {});
|
|
43
|
+
}
|
|
44
|
+
getOwnPropertyDescriptor(obj, prop) {
|
|
45
|
+
return Object.getOwnPropertyDescriptor(obj || {}, prop);
|
|
46
|
+
}
|
|
47
|
+
defineProperty(obj, prop, descriptor) {
|
|
48
|
+
return Object.defineProperty(obj, prop, descriptor);
|
|
49
|
+
}
|
|
50
|
+
defineProperties(obj, props) {
|
|
51
|
+
return Object.defineProperties(obj, props);
|
|
52
|
+
}
|
|
53
|
+
freeze(obj) {
|
|
54
|
+
return Object.freeze(obj);
|
|
55
|
+
}
|
|
56
|
+
isFrozen(obj) {
|
|
57
|
+
return Object.isFrozen(obj);
|
|
58
|
+
}
|
|
59
|
+
seal(obj) {
|
|
60
|
+
return Object.seal(obj);
|
|
61
|
+
}
|
|
62
|
+
isSealed(obj) {
|
|
63
|
+
return Object.isSealed(obj);
|
|
64
|
+
}
|
|
65
|
+
preventExtensions(obj) {
|
|
66
|
+
return Object.preventExtensions(obj);
|
|
67
|
+
}
|
|
68
|
+
isExtensible(obj) {
|
|
69
|
+
return Object.isExtensible(obj);
|
|
70
|
+
}
|
|
71
|
+
hasOwnProperty(obj, prop) {
|
|
72
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
73
|
+
}
|
|
74
|
+
isPrototypeOf(obj, prototypeObj) {
|
|
75
|
+
return Object.prototype.isPrototypeOf.call(obj, prototypeObj);
|
|
76
|
+
}
|
|
77
|
+
propertyIsEnumerable(obj, prop) {
|
|
78
|
+
return Object.prototype.propertyIsEnumerable.call(obj, prop);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
exports.ObjectHandler = ObjectHandler;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
declare class StringHandler {
|
|
2
|
+
split(input: string, delimiter: string): string[];
|
|
3
|
+
charAt(input: string, index: number): string;
|
|
4
|
+
concat(...strings: string[]): string;
|
|
5
|
+
includes(input: string, searchString: string, position?: number): boolean;
|
|
6
|
+
indexOf(input: string, searchString: string, fromIndex?: number): number;
|
|
7
|
+
lastIndexOf(input: string, searchString: string, fromIndex?: number): number;
|
|
8
|
+
slice(input: string, start?: number, end?: number): string;
|
|
9
|
+
toLowerCase(input: string): string;
|
|
10
|
+
toUpperCase(input: string): string;
|
|
11
|
+
trim(input: string): string;
|
|
12
|
+
trimStart(input: string): string;
|
|
13
|
+
trimEnd(input: string): string;
|
|
14
|
+
padStart(input: string, maxLength: number, padString?: string): string;
|
|
15
|
+
padEnd(input: string, maxLength: number, padString?: string): string;
|
|
16
|
+
replace(input: string, searchValue: string | RegExp, replaceValue: string): string;
|
|
17
|
+
search(input: string, regexp: RegExp): number;
|
|
18
|
+
substring(input: string, start: number, end?: number): string;
|
|
19
|
+
startsWith(str: string, searchString: string, position?: number): boolean;
|
|
20
|
+
endsWith(str: string, searchString: string, length?: number): boolean;
|
|
21
|
+
repeat(str: string, count: number): string;
|
|
22
|
+
}
|
|
23
|
+
export { StringHandler };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StringHandler = void 0;
|
|
4
|
+
class StringHandler {
|
|
5
|
+
split(input, delimiter) {
|
|
6
|
+
return input.split(delimiter);
|
|
7
|
+
}
|
|
8
|
+
charAt(input, index) {
|
|
9
|
+
return input.charAt(index);
|
|
10
|
+
}
|
|
11
|
+
concat(...strings) {
|
|
12
|
+
return strings.join('');
|
|
13
|
+
}
|
|
14
|
+
includes(input, searchString, position) {
|
|
15
|
+
return input.includes(searchString, position);
|
|
16
|
+
}
|
|
17
|
+
indexOf(input, searchString, fromIndex) {
|
|
18
|
+
return input.indexOf(searchString, fromIndex);
|
|
19
|
+
}
|
|
20
|
+
lastIndexOf(input, searchString, fromIndex) {
|
|
21
|
+
return input.lastIndexOf(searchString, fromIndex);
|
|
22
|
+
}
|
|
23
|
+
slice(input, start, end) {
|
|
24
|
+
return input.slice(start, end);
|
|
25
|
+
}
|
|
26
|
+
toLowerCase(input) {
|
|
27
|
+
return input.toLowerCase();
|
|
28
|
+
}
|
|
29
|
+
toUpperCase(input) {
|
|
30
|
+
return input.toUpperCase();
|
|
31
|
+
}
|
|
32
|
+
trim(input) {
|
|
33
|
+
return input.trim();
|
|
34
|
+
}
|
|
35
|
+
trimStart(input) {
|
|
36
|
+
return input.trimStart();
|
|
37
|
+
}
|
|
38
|
+
trimEnd(input) {
|
|
39
|
+
return input.trimEnd();
|
|
40
|
+
}
|
|
41
|
+
padStart(input, maxLength, padString) {
|
|
42
|
+
return input.padStart(maxLength, padString);
|
|
43
|
+
}
|
|
44
|
+
padEnd(input, maxLength, padString) {
|
|
45
|
+
return input.padEnd(maxLength, padString);
|
|
46
|
+
}
|
|
47
|
+
replace(input, searchValue, replaceValue) {
|
|
48
|
+
return input.replace(searchValue, replaceValue);
|
|
49
|
+
}
|
|
50
|
+
search(input, regexp) {
|
|
51
|
+
return input.search(regexp);
|
|
52
|
+
}
|
|
53
|
+
substring(input, start, end) {
|
|
54
|
+
return input.substring(start, end);
|
|
55
|
+
}
|
|
56
|
+
startsWith(str, searchString, position) {
|
|
57
|
+
return str.startsWith(searchString, position);
|
|
58
|
+
}
|
|
59
|
+
endsWith(str, searchString, length) {
|
|
60
|
+
return str.endsWith(searchString, length);
|
|
61
|
+
}
|
|
62
|
+
repeat(str, count) {
|
|
63
|
+
if (count < 0 || count === Infinity) {
|
|
64
|
+
throw new RangeError('Invalid repeat count. Must be a positive finite number.');
|
|
65
|
+
}
|
|
66
|
+
return str.repeat(count);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
exports.StringHandler = StringHandler;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SymbolHandler = void 0;
|
|
4
|
+
class SymbolHandler {
|
|
5
|
+
null() {
|
|
6
|
+
return null;
|
|
7
|
+
}
|
|
8
|
+
undefined() {
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
whitespace() {
|
|
12
|
+
return ' ';
|
|
13
|
+
}
|
|
14
|
+
object() {
|
|
15
|
+
return {};
|
|
16
|
+
}
|
|
17
|
+
array() {
|
|
18
|
+
return [];
|
|
19
|
+
}
|
|
20
|
+
posInfinity() {
|
|
21
|
+
return Infinity;
|
|
22
|
+
}
|
|
23
|
+
negInfinity() {
|
|
24
|
+
return -Infinity;
|
|
25
|
+
}
|
|
26
|
+
NaN() {
|
|
27
|
+
return NaN;
|
|
28
|
+
}
|
|
29
|
+
date() {
|
|
30
|
+
return new Date();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.SymbolHandler = SymbolHandler;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UnaryHandler = void 0;
|
|
4
|
+
class UnaryHandler {
|
|
5
|
+
not(value) {
|
|
6
|
+
return !value;
|
|
7
|
+
}
|
|
8
|
+
positive(value) {
|
|
9
|
+
return +value;
|
|
10
|
+
}
|
|
11
|
+
negative(value) {
|
|
12
|
+
return -value;
|
|
13
|
+
}
|
|
14
|
+
bitwise_not(value) {
|
|
15
|
+
return ~value;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.UnaryHandler = UnaryHandler;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { JobState, JobData } from '../../types/job';
|
|
2
|
+
import { PipeContext, PipeItem, PipeItems, Pipe as PipeType } from '../../types/pipe';
|
|
3
|
+
declare class Pipe {
|
|
4
|
+
rules: PipeType;
|
|
5
|
+
jobData: JobData;
|
|
6
|
+
context: PipeContext;
|
|
7
|
+
constructor(rules: PipeType, jobData: JobData, context?: PipeContext);
|
|
8
|
+
private isPipeType;
|
|
9
|
+
private isreduceType;
|
|
10
|
+
static isPipeObject(obj: {
|
|
11
|
+
[key: string]: unknown;
|
|
12
|
+
} | PipeItem): boolean;
|
|
13
|
+
static resolve(unresolved: {
|
|
14
|
+
[key: string]: unknown;
|
|
15
|
+
} | PipeItem, context: Partial<JobState>): any;
|
|
16
|
+
/**
|
|
17
|
+
* loop through each PipeItem row in this Pipe, resolving and transforming line by line
|
|
18
|
+
* @returns {any} the result of the pipe
|
|
19
|
+
*/
|
|
20
|
+
process(resolved?: unknown[] | null): any;
|
|
21
|
+
cloneUnknown<T>(value: T): T;
|
|
22
|
+
/**
|
|
23
|
+
* Transforms iterable `input` into a single value. Vars $output, $item, $key
|
|
24
|
+
* and $input are available. The final statement in the iterator (the reduction)
|
|
25
|
+
* is assumed to be the return value. A default $output object may be provided
|
|
26
|
+
* to the iterator by placing the the second cell of the preceding row. Otherwise,
|
|
27
|
+
* construct the object during first run and ensure it is the first cell of the
|
|
28
|
+
* last row of the iterator, so it is returned as the $output for the next cycle
|
|
29
|
+
* @param {unknown[]} input
|
|
30
|
+
* @returns {unknown}
|
|
31
|
+
* @private
|
|
32
|
+
*/
|
|
33
|
+
reduce(input: Array<unknown[]>): unknown;
|
|
34
|
+
private processRow;
|
|
35
|
+
static resolveFunction(functionName: string): any;
|
|
36
|
+
processCells(cells: PipeItems): unknown[];
|
|
37
|
+
private isFunction;
|
|
38
|
+
private isContextVariable;
|
|
39
|
+
private isMappable;
|
|
40
|
+
resolveCellValue(currentCell: PipeItem): unknown;
|
|
41
|
+
private getNestedProperty;
|
|
42
|
+
resolveMappableValue(currentCell: string): unknown;
|
|
43
|
+
resolveContextValue(currentCell: string): unknown;
|
|
44
|
+
resolveContextTerm(currentCell: string): string;
|
|
45
|
+
resolveFunctionTerm(currentCell: string): string;
|
|
46
|
+
resolveMapTerm(currentCell: string): string;
|
|
47
|
+
}
|
|
48
|
+
export { Pipe };
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Pipe = void 0;
|
|
7
|
+
const functions_1 = __importDefault(require("./functions"));
|
|
8
|
+
class Pipe {
|
|
9
|
+
constructor(rules, jobData, context) {
|
|
10
|
+
this.rules = rules;
|
|
11
|
+
this.jobData = jobData;
|
|
12
|
+
this.context = context;
|
|
13
|
+
}
|
|
14
|
+
isPipeType(currentRow) {
|
|
15
|
+
return !Array.isArray(currentRow) && '@pipe' in currentRow;
|
|
16
|
+
}
|
|
17
|
+
isreduceType(currentRow) {
|
|
18
|
+
return !Array.isArray(currentRow) && '@reduce' in currentRow;
|
|
19
|
+
}
|
|
20
|
+
static isPipeObject(obj) {
|
|
21
|
+
return (typeof obj === 'object' &&
|
|
22
|
+
obj !== null &&
|
|
23
|
+
!Array.isArray(obj) &&
|
|
24
|
+
'@pipe' in obj);
|
|
25
|
+
}
|
|
26
|
+
static resolve(unresolved, context) {
|
|
27
|
+
let pipe;
|
|
28
|
+
if (Pipe.isPipeObject(unresolved)) {
|
|
29
|
+
pipe = new Pipe(unresolved['@pipe'], context);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
pipe = new Pipe([[unresolved]], context);
|
|
33
|
+
}
|
|
34
|
+
return pipe.process();
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* loop through each PipeItem row in this Pipe, resolving and transforming line by line
|
|
38
|
+
* @returns {any} the result of the pipe
|
|
39
|
+
*/
|
|
40
|
+
process(resolved = null) {
|
|
41
|
+
let index = 0;
|
|
42
|
+
if (!(resolved ||
|
|
43
|
+
this.isPipeType(this.rules[0]) ||
|
|
44
|
+
this.isreduceType(this.rules[0]))) {
|
|
45
|
+
resolved = this.processCells(this.rules[0]); // Add type assertion
|
|
46
|
+
index = 1;
|
|
47
|
+
}
|
|
48
|
+
const len = this.rules.length;
|
|
49
|
+
const subPipeQueue = [];
|
|
50
|
+
for (let i = index; i < len; i++) {
|
|
51
|
+
resolved = this.processRow(this.rules[i], resolved, subPipeQueue);
|
|
52
|
+
}
|
|
53
|
+
return resolved[0];
|
|
54
|
+
}
|
|
55
|
+
cloneUnknown(value) {
|
|
56
|
+
if (value === null || typeof value !== 'object') {
|
|
57
|
+
return value;
|
|
58
|
+
}
|
|
59
|
+
if (value instanceof Date) {
|
|
60
|
+
return new Date(value.getTime());
|
|
61
|
+
}
|
|
62
|
+
if (value instanceof RegExp) {
|
|
63
|
+
return new RegExp(value);
|
|
64
|
+
}
|
|
65
|
+
if (Array.isArray(value)) {
|
|
66
|
+
return value.map((item) => this.cloneUnknown(item));
|
|
67
|
+
}
|
|
68
|
+
const clonedObj = {};
|
|
69
|
+
for (const key in value) {
|
|
70
|
+
if (Object.prototype.hasOwnProperty.call(value, key)) {
|
|
71
|
+
clonedObj[key] = this.cloneUnknown(value[key]);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return clonedObj;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Transforms iterable `input` into a single value. Vars $output, $item, $key
|
|
78
|
+
* and $input are available. The final statement in the iterator (the reduction)
|
|
79
|
+
* is assumed to be the return value. A default $output object may be provided
|
|
80
|
+
* to the iterator by placing the the second cell of the preceding row. Otherwise,
|
|
81
|
+
* construct the object during first run and ensure it is the first cell of the
|
|
82
|
+
* last row of the iterator, so it is returned as the $output for the next cycle
|
|
83
|
+
* @param {unknown[]} input
|
|
84
|
+
* @returns {unknown}
|
|
85
|
+
* @private
|
|
86
|
+
*/
|
|
87
|
+
reduce(input) {
|
|
88
|
+
let resolved = this.cloneUnknown(input[1] ?? null);
|
|
89
|
+
if (Array.isArray(input[0])) {
|
|
90
|
+
for (let index = 0; index < input[0].length; index++) {
|
|
91
|
+
this.context = {
|
|
92
|
+
$input: input[0],
|
|
93
|
+
$output: resolved,
|
|
94
|
+
$item: input[0][index],
|
|
95
|
+
$key: index.toString(),
|
|
96
|
+
$index: index,
|
|
97
|
+
};
|
|
98
|
+
resolved = this.process([resolved]);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
let index = -1;
|
|
103
|
+
for (const $key in input[0]) {
|
|
104
|
+
index++;
|
|
105
|
+
this.context = {
|
|
106
|
+
$input: input[0],
|
|
107
|
+
$output: resolved,
|
|
108
|
+
$item: input[0][$key],
|
|
109
|
+
$key,
|
|
110
|
+
$index: index,
|
|
111
|
+
};
|
|
112
|
+
resolved = this.process([resolved]);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return [resolved];
|
|
116
|
+
}
|
|
117
|
+
processRow(currentRow, resolvedPriorRow, subPipeQueue) {
|
|
118
|
+
if (resolvedPriorRow && this.isreduceType(currentRow)) {
|
|
119
|
+
//reduce the resolvedPriorRow and return the output from the reducer
|
|
120
|
+
const subPipe = new Pipe(currentRow['@reduce'], this.jobData);
|
|
121
|
+
const reduced = subPipe.reduce(resolvedPriorRow);
|
|
122
|
+
return reduced;
|
|
123
|
+
}
|
|
124
|
+
else if (this.isPipeType(currentRow)) {
|
|
125
|
+
//process subPipe and push to subPipeQueue; echo resolvedPriorRow
|
|
126
|
+
const subPipe = new Pipe(currentRow['@pipe'], this.jobData, this.context);
|
|
127
|
+
subPipeQueue.push(subPipe.process());
|
|
128
|
+
return resolvedPriorRow;
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
//pivot the subPipeQueue into the arguments array (resolvedPriorRow)
|
|
132
|
+
if (subPipeQueue.length > 0) {
|
|
133
|
+
resolvedPriorRow = [...subPipeQueue];
|
|
134
|
+
subPipeQueue.length = 0;
|
|
135
|
+
}
|
|
136
|
+
if (!resolvedPriorRow) {
|
|
137
|
+
//if no prior row, use current row as prior row
|
|
138
|
+
return [].concat(this.processCells(Array.isArray(currentRow) ? [...currentRow] : []));
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
const [functionName, ...params] = currentRow; // Add type assertion
|
|
142
|
+
//use resolved values from prior row (n - 1) as input params to cell 1 function
|
|
143
|
+
let resolvedValue;
|
|
144
|
+
if (this.isContextVariable(functionName)) {
|
|
145
|
+
resolvedValue = this.resolveContextValue(functionName);
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
resolvedValue = Pipe.resolveFunction(functionName)(...resolvedPriorRow);
|
|
149
|
+
}
|
|
150
|
+
//resolve remaining cells in row and return concatenated with resolvedValue
|
|
151
|
+
return [resolvedValue].concat(this.processCells([...params]));
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
static resolveFunction(functionName) {
|
|
156
|
+
let [prefix, suffix] = functionName.split('.');
|
|
157
|
+
prefix = prefix.substring(2);
|
|
158
|
+
suffix = suffix.substring(0, suffix.length - 1);
|
|
159
|
+
const domain = functions_1.default[prefix];
|
|
160
|
+
if (!domain) {
|
|
161
|
+
throw new Error(`Unknown domain name [${functionName}]: ${prefix}`);
|
|
162
|
+
}
|
|
163
|
+
if (!domain[suffix]) {
|
|
164
|
+
throw new Error(`Unknown domain function [${functionName}]: ${prefix}.${suffix}`);
|
|
165
|
+
}
|
|
166
|
+
return domain[suffix];
|
|
167
|
+
}
|
|
168
|
+
processCells(cells) {
|
|
169
|
+
const resolved = [];
|
|
170
|
+
if (Array.isArray(cells)) {
|
|
171
|
+
for (const currentCell of cells) {
|
|
172
|
+
resolved.push(this.resolveCellValue(currentCell));
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return resolved;
|
|
176
|
+
}
|
|
177
|
+
isFunction(currentCell) {
|
|
178
|
+
return (typeof currentCell === 'string' &&
|
|
179
|
+
currentCell.startsWith('{@') &&
|
|
180
|
+
currentCell.endsWith('}'));
|
|
181
|
+
}
|
|
182
|
+
isContextVariable(currentCell) {
|
|
183
|
+
if (typeof currentCell === 'string' && currentCell.endsWith('}')) {
|
|
184
|
+
return (currentCell.startsWith('{$item') ||
|
|
185
|
+
currentCell.startsWith('{$key') ||
|
|
186
|
+
currentCell.startsWith('{$index') ||
|
|
187
|
+
currentCell.startsWith('{$input') ||
|
|
188
|
+
currentCell.startsWith('{$output'));
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
isMappable(currentCell) {
|
|
192
|
+
return (typeof currentCell === 'string' &&
|
|
193
|
+
currentCell.startsWith('{') &&
|
|
194
|
+
currentCell.endsWith('}'));
|
|
195
|
+
}
|
|
196
|
+
resolveCellValue(currentCell) {
|
|
197
|
+
if (this.isFunction(currentCell)) {
|
|
198
|
+
const fn = Pipe.resolveFunction(currentCell);
|
|
199
|
+
return fn.call();
|
|
200
|
+
}
|
|
201
|
+
else if (this.isContextVariable(currentCell)) {
|
|
202
|
+
return this.resolveContextValue(currentCell);
|
|
203
|
+
}
|
|
204
|
+
else if (this.isMappable(currentCell)) {
|
|
205
|
+
return this.resolveMappableValue(currentCell);
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
return currentCell;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
getNestedProperty(obj, path) {
|
|
212
|
+
const pathParts = path.split('.');
|
|
213
|
+
let current = obj;
|
|
214
|
+
for (const part of pathParts) {
|
|
215
|
+
if (current === null ||
|
|
216
|
+
typeof current !== 'object' ||
|
|
217
|
+
!current.hasOwnProperty(part)) {
|
|
218
|
+
return undefined;
|
|
219
|
+
}
|
|
220
|
+
current = current[part];
|
|
221
|
+
}
|
|
222
|
+
return current;
|
|
223
|
+
}
|
|
224
|
+
resolveMappableValue(currentCell) {
|
|
225
|
+
const term = this.resolveMapTerm(currentCell);
|
|
226
|
+
return this.getNestedProperty(this.jobData, term);
|
|
227
|
+
}
|
|
228
|
+
resolveContextValue(currentCell) {
|
|
229
|
+
const term = this.resolveContextTerm(currentCell);
|
|
230
|
+
return this.getNestedProperty(this.context, term);
|
|
231
|
+
}
|
|
232
|
+
resolveContextTerm(currentCell) {
|
|
233
|
+
return currentCell.substring(1, currentCell.length - 1);
|
|
234
|
+
}
|
|
235
|
+
resolveFunctionTerm(currentCell) {
|
|
236
|
+
return currentCell.substring(2, currentCell.length - 1);
|
|
237
|
+
}
|
|
238
|
+
resolveMapTerm(currentCell) {
|
|
239
|
+
return currentCell.substring(1, currentCell.length - 1);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
exports.Pipe = Pipe;
|