@hotmeshio/hotmesh 0.1.15 → 0.1.16

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.
Files changed (134) hide show
  1. package/README.md +623 -209
  2. package/build/index.d.ts +14 -3
  3. package/build/index.js +17 -4
  4. package/build/modules/enums.d.ts +12 -12
  5. package/build/modules/enums.js +15 -25
  6. package/build/modules/errors.d.ts +16 -16
  7. package/build/modules/errors.js +28 -28
  8. package/build/modules/key.d.ts +0 -37
  9. package/build/modules/key.js +4 -45
  10. package/build/modules/utils.d.ts +7 -15
  11. package/build/modules/utils.js +21 -44
  12. package/build/package.json +18 -15
  13. package/build/services/activities/activity.d.ts +0 -31
  14. package/build/services/activities/activity.js +1 -50
  15. package/build/services/activities/await.js +0 -4
  16. package/build/services/activities/cycle.d.ts +0 -7
  17. package/build/services/activities/cycle.js +1 -16
  18. package/build/services/activities/hook.d.ts +0 -6
  19. package/build/services/activities/hook.js +2 -12
  20. package/build/services/activities/interrupt.js +0 -8
  21. package/build/services/activities/signal.d.ts +0 -6
  22. package/build/services/activities/signal.js +0 -15
  23. package/build/services/activities/trigger.d.ts +4 -5
  24. package/build/services/activities/trigger.js +22 -16
  25. package/build/services/activities/worker.js +0 -4
  26. package/build/services/collator/index.d.ts +0 -70
  27. package/build/services/collator/index.js +1 -91
  28. package/build/services/compiler/deployer.js +6 -38
  29. package/build/services/compiler/index.d.ts +0 -15
  30. package/build/services/compiler/index.js +0 -20
  31. package/build/services/compiler/validator.d.ts +0 -3
  32. package/build/services/compiler/validator.js +0 -25
  33. package/build/services/connector/clients/ioredis.js +0 -2
  34. package/build/services/connector/clients/redis.js +0 -2
  35. package/build/services/connector/index.js +0 -2
  36. package/build/services/engine/index.d.ts +1 -10
  37. package/build/services/engine/index.js +1 -48
  38. package/build/services/exporter/index.d.ts +0 -27
  39. package/build/services/exporter/index.js +0 -33
  40. package/build/services/hotmesh/index.d.ts +8 -4
  41. package/build/services/hotmesh/index.js +20 -19
  42. package/build/services/logger/index.js +0 -2
  43. package/build/services/mapper/index.d.ts +0 -14
  44. package/build/services/mapper/index.js +0 -14
  45. package/build/services/meshcall/index.d.ts +21 -0
  46. package/build/services/meshcall/index.js +202 -0
  47. package/build/services/meshcall/schemas/factory.d.ts +2 -0
  48. package/build/services/meshcall/schemas/factory.js +179 -0
  49. package/build/services/meshdata/index.d.ts +75 -0
  50. package/build/services/meshdata/index.js +541 -0
  51. package/build/services/meshflow/client.d.ts +18 -0
  52. package/build/services/{durable → meshflow}/client.js +9 -40
  53. package/build/services/{durable → meshflow}/connection.d.ts +2 -1
  54. package/build/services/{durable → meshflow}/connection.js +1 -0
  55. package/build/services/meshflow/exporter.d.ts +29 -0
  56. package/build/services/{durable → meshflow}/exporter.js +0 -29
  57. package/build/services/meshflow/handle.d.ts +22 -0
  58. package/build/services/{durable → meshflow}/handle.js +0 -46
  59. package/build/services/meshflow/index.d.ts +17 -0
  60. package/build/services/meshflow/index.js +23 -0
  61. package/build/services/meshflow/schemas/factory.d.ts +4 -0
  62. package/build/services/{durable → meshflow}/schemas/factory.js +2 -30
  63. package/build/services/meshflow/search.d.ts +23 -0
  64. package/build/services/{durable → meshflow}/search.js +0 -99
  65. package/build/services/{durable → meshflow}/worker.d.ts +3 -2
  66. package/build/services/{durable → meshflow}/worker.js +23 -39
  67. package/build/services/meshflow/workflow.d.ts +27 -0
  68. package/build/services/{durable → meshflow}/workflow.js +27 -169
  69. package/build/services/pipe/functions/date.d.ts +0 -7
  70. package/build/services/pipe/functions/date.js +0 -7
  71. package/build/services/pipe/functions/math.js +0 -2
  72. package/build/services/pipe/index.d.ts +0 -15
  73. package/build/services/pipe/index.js +2 -23
  74. package/build/services/quorum/index.d.ts +1 -7
  75. package/build/services/quorum/index.js +0 -21
  76. package/build/services/reporter/index.d.ts +0 -5
  77. package/build/services/reporter/index.js +0 -9
  78. package/build/services/router/index.d.ts +0 -9
  79. package/build/services/router/index.js +2 -30
  80. package/build/services/serializer/index.js +6 -23
  81. package/build/services/store/cache.d.ts +0 -19
  82. package/build/services/store/cache.js +0 -19
  83. package/build/services/store/clients/ioredis.d.ts +0 -6
  84. package/build/services/store/clients/ioredis.js +0 -7
  85. package/build/services/store/clients/redis.d.ts +0 -6
  86. package/build/services/store/clients/redis.js +0 -6
  87. package/build/services/store/index.d.ts +0 -55
  88. package/build/services/store/index.js +14 -87
  89. package/build/services/stream/clients/ioredis.js +1 -4
  90. package/build/services/task/index.d.ts +0 -9
  91. package/build/services/task/index.js +0 -31
  92. package/build/services/telemetry/index.d.ts +0 -7
  93. package/build/services/telemetry/index.js +1 -13
  94. package/build/services/worker/index.d.ts +1 -4
  95. package/build/services/worker/index.js +0 -6
  96. package/build/types/activity.d.ts +0 -81
  97. package/build/types/error.d.ts +5 -5
  98. package/build/types/exporter.d.ts +1 -14
  99. package/build/types/hotmesh.d.ts +4 -12
  100. package/build/types/hotmesh.js +0 -3
  101. package/build/types/index.d.ts +5 -3
  102. package/build/types/index.js +1 -1
  103. package/build/types/job.d.ts +1 -95
  104. package/build/types/meshcall.d.ts +54 -0
  105. package/build/types/meshdata.d.ts +59 -0
  106. package/build/types/meshdata.js +2 -0
  107. package/build/types/meshflow.d.ts +202 -0
  108. package/build/types/meshflow.js +2 -0
  109. package/build/types/pipe.d.ts +0 -65
  110. package/build/types/quorum.d.ts +0 -12
  111. package/build/types/redis.d.ts +0 -6
  112. package/build/types/stream.d.ts +0 -59
  113. package/build/types/stream.js +0 -4
  114. package/index.ts +22 -3
  115. package/package.json +18 -15
  116. package/typedoc.json +38 -0
  117. package/types/error.ts +5 -5
  118. package/types/exporter.ts +1 -1
  119. package/types/hotmesh.ts +3 -2
  120. package/types/index.ts +25 -7
  121. package/types/job.ts +19 -1
  122. package/types/meshcall.ts +123 -0
  123. package/types/meshdata.ts +273 -0
  124. package/types/{durable.ts → meshflow.ts} +33 -9
  125. package/build/services/durable/client.d.ts +0 -49
  126. package/build/services/durable/exporter.d.ts +0 -51
  127. package/build/services/durable/handle.d.ts +0 -58
  128. package/build/services/durable/index.d.ts +0 -19
  129. package/build/services/durable/index.js +0 -25
  130. package/build/services/durable/schemas/factory.d.ts +0 -33
  131. package/build/services/durable/search.d.ts +0 -120
  132. package/build/services/durable/workflow.d.ts +0 -143
  133. package/build/types/durable.d.ts +0 -467
  134. /package/build/types/{durable.js → meshcall.js} +0 -0
@@ -0,0 +1,179 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getWorkflowYAML = exports.VERSION = void 0;
4
+ const key_1 = require("../../../modules/key");
5
+ exports.VERSION = '1';
6
+ const getWorkflowYAML = (appId = key_1.HMNS, version = exports.VERSION) => {
7
+ return `app:
8
+ id: ${appId}
9
+ version: '${version}'
10
+ graphs:
11
+ - subscribes: ${appId}.call
12
+
13
+ expire: '{trigger.output.data.expire}'
14
+
15
+ input:
16
+ schema:
17
+ type: object
18
+ properties:
19
+ id:
20
+ type: string
21
+ description: unique id for this workflow
22
+ expire:
23
+ type: number
24
+ description: time in seconds to expire the completed job and remove it from the cache
25
+ topic:
26
+ type: string
27
+ description: topic assigned to locate the worker
28
+ args:
29
+ type: array
30
+ description: arguments to pass to the worker function
31
+ items:
32
+ type: any
33
+
34
+ output:
35
+ schema:
36
+ type: object
37
+ properties:
38
+ response:
39
+ type: any
40
+
41
+ activities:
42
+ trigger:
43
+ type: trigger
44
+
45
+ stats:
46
+ id: '{$self.input.data.id}'
47
+
48
+ worker:
49
+ type: worker
50
+ topic: '{trigger.output.data.topic}'
51
+ input:
52
+ schema:
53
+ type: object
54
+ properties:
55
+ args:
56
+ type: any
57
+ maps:
58
+ args: '{trigger.output.data.args}'
59
+ output:
60
+ schema:
61
+ type: object
62
+ properties:
63
+ response:
64
+ type: any
65
+ job:
66
+ maps:
67
+ response: '{$self.output.data.response}'
68
+
69
+ transitions:
70
+ trigger:
71
+ - to: worker
72
+
73
+ - subscribes: ${appId}.cron
74
+
75
+ expire: 120
76
+
77
+ input:
78
+ schema:
79
+ type: object
80
+ properties:
81
+ id:
82
+ type: string
83
+ description: unique id for this workflow
84
+ delay:
85
+ type: number
86
+ description: time in seconds to sleep before invoking the first cycle
87
+ interval:
88
+ type: number
89
+ description: time in seconds to sleep before the next cycle
90
+ topic:
91
+ type: string
92
+ description: topic assigned to locate the worker
93
+ args:
94
+ type: array
95
+ description: arguments to pass to the worker function
96
+ items:
97
+ type: any
98
+ maxCycles:
99
+ type: number
100
+ description: maximum number of cycles to run before stopping
101
+ maxDuration:
102
+ type: integer
103
+ description: timevalue (GMT) ceiling. If the current time exceeds this value, the cron will stop.
104
+ example: 1630000000000
105
+
106
+ output:
107
+ schema:
108
+ type: object
109
+ properties:
110
+ response:
111
+ type: any
112
+
113
+ activities:
114
+ trigger_cron:
115
+ type: trigger
116
+ stats:
117
+ id: '{$self.input.data.id}'
118
+
119
+ cycle_hook_cron:
120
+ type: hook
121
+ output:
122
+ schema:
123
+ type: object
124
+ properties:
125
+ sleepSeconds:
126
+ type: number
127
+ maps:
128
+ sleepSeconds:
129
+ '@pipe':
130
+ - ['{trigger_cron.output.data.delay}', '{@symbol.undefined}']
131
+ - ['{@conditional.nullish}']
132
+ iterationCount: 1
133
+
134
+ sleep_cron:
135
+ type: hook
136
+ sleep: '{cycle_hook_cron.output.data.sleepSeconds}'
137
+
138
+ worker_cron:
139
+ type: worker
140
+ topic: '{trigger_cron.output.data.topic}'
141
+ input:
142
+ schema:
143
+ type: object
144
+ properties:
145
+ args:
146
+ type: any
147
+ maps:
148
+ args: '{trigger_cron.output.data.args}'
149
+
150
+ cycle_cron:
151
+ type: cycle
152
+ ancestor: cycle_hook_cron
153
+ input:
154
+ maps:
155
+ sleepSeconds: '{trigger_cron.output.data.interval}'
156
+ iterationCount:
157
+ '@pipe':
158
+ - ['{cycle_hook_cron.output.data.iterationCount}', 1]
159
+ - ['{@math.add}']
160
+
161
+ transitions:
162
+ trigger_cron:
163
+ - to: cycle_hook_cron
164
+ cycle_hook_cron:
165
+ - to: sleep_cron
166
+ sleep_cron:
167
+ - to: worker_cron
168
+ worker_cron:
169
+ - to: cycle_cron
170
+ conditions:
171
+ match:
172
+ - expected: true
173
+ actual:
174
+ '@pipe':
175
+ - ['{cycle_hook_cron.output.data.iterationCount}', '{trigger_cron.output.data.maxCycles}']
176
+ - ['{@conditional.less_than}']
177
+ `;
178
+ };
179
+ exports.getWorkflowYAML = getWorkflowYAML;
@@ -0,0 +1,75 @@
1
+ import { HotMesh } from '../hotmesh';
2
+ import { WorkflowOptions, WorkflowSearchOptions, FindJobsOptions, FindOptions, FindWhereOptions, SearchResults, FindWhereQuery } from '../../types/meshflow';
3
+ import { CallOptions, ConnectionInput, ConnectOptions, ExecInput, HookInput } from '../../types/meshdata';
4
+ import { RedisClass, RedisOptions } from '../../types/redis';
5
+ import { StringAnyType, StringStringType } from '../../types/serializer';
6
+ import { JobInterruptOptions, JobOutput } from '../../types/job';
7
+ import { QuorumMessage, QuorumMessageCallback, QuorumProfile, RollCallOptions, SubscriptionOptions, ThrottleOptions } from '../../types/quorum';
8
+ import { MeshFlowJobExport, ExportOptions } from '../../types/exporter';
9
+ declare class MeshData {
10
+ connectionSignatures: StringStringType;
11
+ redisOptions: RedisOptions;
12
+ redisClass: RedisClass;
13
+ instances: Map<string, (Promise<HotMesh> | HotMesh)>;
14
+ search: WorkflowSearchOptions;
15
+ static workflow: {
16
+ sleep: typeof import("../meshflow/workflow").WorkflowService.sleepFor;
17
+ sleepFor: typeof import("../meshflow/workflow").WorkflowService.sleepFor;
18
+ signal: typeof import("../meshflow/workflow").WorkflowService.signal;
19
+ hook: typeof import("../meshflow/workflow").WorkflowService.hook;
20
+ waitForSignal: typeof import("../meshflow/workflow").WorkflowService.waitFor;
21
+ waitFor: typeof import("../meshflow/workflow").WorkflowService.waitFor;
22
+ getHotMesh: typeof import("../meshflow/workflow").WorkflowService.getHotMesh;
23
+ random: typeof import("../meshflow/workflow").WorkflowService.random;
24
+ search: typeof import("../meshflow/workflow").WorkflowService.search;
25
+ getContext: typeof import("../meshflow/workflow").WorkflowService.getContext;
26
+ once: typeof import("../meshflow/workflow").WorkflowService.once;
27
+ interrupt: (entity: string, id: string, options?: JobInterruptOptions) => Promise<void>;
28
+ execChild: <T>(options?: Partial<WorkflowOptions>) => Promise<T>;
29
+ executeChild: <T_1>(options?: Partial<WorkflowOptions>) => Promise<T_1>;
30
+ startChild: (options?: Partial<WorkflowOptions>) => Promise<string>;
31
+ };
32
+ constructor(redisClass: Partial<RedisClass>, redisOptions: Partial<RedisOptions>, search?: WorkflowSearchOptions);
33
+ validate(entity: string): void;
34
+ getConnection(): Promise<import("../../types/meshflow").ConnectionConfig>;
35
+ getClient(): import("../meshflow/client").ClientService;
36
+ safeKey(key: string): string;
37
+ arrayToHash(input: [number, ...Array<string | string[]>]): StringStringType[];
38
+ toString(value: any): string | undefined;
39
+ static mintGuid(entity: string, id?: string): string;
40
+ getHotMesh(namespace?: string): Promise<HotMesh>;
41
+ mintKey(entity: string, workflowId: string, namespace?: string): Promise<string>;
42
+ mesh: {
43
+ sub: (callback: QuorumMessageCallback, options?: SubscriptionOptions) => Promise<void>;
44
+ pub: (message: QuorumMessage, options?: SubscriptionOptions) => Promise<void>;
45
+ unsub: (callback: QuorumMessageCallback, options?: SubscriptionOptions) => Promise<void>;
46
+ };
47
+ connect<T>({ entity, target, options }: ConnectionInput<T>): Promise<boolean>;
48
+ bindCallOptions(args: any[], options: ConnectOptions, callOptions?: CallOptions): StringAnyType;
49
+ pauseForTTL<T>(result: T, options: CallOptions): Promise<void>;
50
+ publishDone<T>(result: T, hotMesh: HotMesh, options: CallOptions): Promise<void>;
51
+ flush(entity: string, id: string, namespace?: string): Promise<string | void>;
52
+ interrupt(entity: string, id: string, options?: JobInterruptOptions, namespace?: string): Promise<void>;
53
+ signal(guid: string, payload: StringAnyType, namespace?: string): Promise<string>;
54
+ rollCall(options?: RollCallOptions): Promise<QuorumProfile[]>;
55
+ throttle(options: ThrottleOptions): Promise<boolean>;
56
+ hook({ entity, id, hookEntity, hookArgs, options }: HookInput): Promise<string>;
57
+ exec<T>({ entity, args, options }: ExecInput): Promise<T>;
58
+ info(entity: string, id: string, options?: CallOptions): Promise<JobOutput>;
59
+ export(entity: string, id: string, options?: ExportOptions, namespace?: string): Promise<MeshFlowJobExport>;
60
+ get(entity: string, id: string, options?: CallOptions): Promise<StringAnyType>;
61
+ all(entity: string, id: string, options?: CallOptions): Promise<StringAnyType>;
62
+ raw(entity: string, id: string, options?: CallOptions): Promise<StringAnyType>;
63
+ set(entity: string, id: string, options?: CallOptions): Promise<number>;
64
+ incr(entity: string, id: string, field: string, amount: number, options?: CallOptions): Promise<number>;
65
+ del(entity: string, id: string, options: CallOptions): Promise<number>;
66
+ findJobs(options?: FindJobsOptions): Promise<[string, string[]]>;
67
+ find(entity: string, options: FindOptions, ...args: string[]): Promise<string[] | [number] | Array<string | number | string[]>>;
68
+ findWhere(entity: string, options: FindWhereOptions): Promise<SearchResults | number>;
69
+ generateSearchQuery(query: FindWhereQuery[] | string, search?: WorkflowSearchOptions): string;
70
+ createSearchIndex(entity: string, options?: CallOptions, searchOptions?: WorkflowSearchOptions): Promise<void>;
71
+ listSearchIndexes(): Promise<string[]>;
72
+ static proxyActivities: typeof import("../meshflow/workflow").WorkflowService.proxyActivities;
73
+ static shutdown(): Promise<void>;
74
+ }
75
+ export { MeshData };