@hatchet-dev/typescript-sdk 1.34.0-alpha.1 → 1.34.0
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/README.md +1 -0
- package/clients/admin/rpc.d.ts +1 -1
- package/clients/admin/rpc.js +3 -3
- package/clients/admin/trigger-request.d.ts +18 -0
- package/clients/admin/trigger-request.js +66 -0
- package/clients/event/event-client.d.ts +4 -17
- package/clients/event/event-client.js +5 -43
- package/clients/event/rpc.d.ts +22 -3
- package/clients/event/rpc.js +66 -3
- package/clients/transport/fetch-transport.d.ts +73 -0
- package/clients/transport/fetch-transport.js +152 -0
- package/clients/transport/grpc-target.js +48 -3
- package/clients/transport/index.d.ts +2 -1
- package/clients/transport/index.js +6 -1
- package/clients/transport/node-transport.js +1 -2
- package/clients/transport/transport.d.ts +6 -0
- package/clients/transport/transport.js +7 -0
- package/clients/transport/ts-proto-client.js +16 -2
- package/core/client.d.ts +102 -0
- package/core/client.js +250 -0
- package/core/features/events.d.ts +25 -0
- package/core/features/events.js +57 -0
- package/core/features/logs.d.ts +26 -0
- package/core/features/logs.js +51 -0
- package/core/features/rate-limits.d.ts +19 -0
- package/core/features/rate-limits.js +30 -0
- package/core/features/runs.d.ts +33 -0
- package/core/features/runs.js +84 -0
- package/core/features/streams.d.ts +11 -0
- package/core/features/streams.js +23 -0
- package/core/features/workflows.d.ts +22 -0
- package/core/features/workflows.js +46 -0
- package/core/index.d.ts +42 -4
- package/core/index.js +79 -5
- package/core/logger.d.ts +19 -0
- package/core/logger.js +45 -0
- package/core/run-detail.d.ts +14 -0
- package/core/run-detail.js +79 -0
- package/core/run-ref.d.ts +63 -0
- package/core/run-ref.js +217 -0
- package/core/types.d.ts +182 -0
- package/core/types.js +2 -0
- package/dist/check-edge-entry.mjs +72 -14
- package/dist/check-edge-entry.test.ts +57 -0
- package/package.json +5 -2
- package/protoc/v1/streams.d.ts +79 -0
- package/protoc/v1/streams.js +511 -0
- package/protoc-es/v1/streams_pb.d.ts +133 -0
- package/protoc-es/v1/streams_pb.js +41 -0
- package/scripts/check-edge-entry.mjs +72 -14
- package/scripts/check-edge-entry.test.ts +57 -0
- package/util/batch.js +2 -1
- package/util/config-loader/token.d.ts +5 -0
- package/util/config-loader/token.js +8 -0
- package/util/errors/bulk-trigger-partial-error.d.ts +17 -0
- package/util/errors/bulk-trigger-partial-error.js +55 -0
- package/v1/client/admin.d.ts +4 -54
- package/v1/client/admin.js +9 -72
- package/v1/client/client.d.ts +14 -1
- package/v1/client/client.js +18 -0
- package/v1/client/features/index.d.ts +1 -0
- package/v1/client/features/index.js +1 -0
- package/v1/client/features/runs.d.ts +9 -27
- package/v1/client/features/runs.js +10 -55
- package/v1/client/features/streams.d.ts +47 -0
- package/v1/client/features/streams.js +210 -0
- package/v1/examples/durable-streams/publish-latency.d.ts +15 -0
- package/v1/examples/durable-streams/publish-latency.js +50 -0
- package/v1/examples/durable_callback_ordering/workflow.js +5 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.measurePublishLatency = measurePublishLatency;
|
|
13
|
+
exports.formatPublishLatency = formatPublishLatency;
|
|
14
|
+
const perf_hooks_1 = require("perf_hooks");
|
|
15
|
+
function percentile(sorted, p) {
|
|
16
|
+
return sorted[Math.min(sorted.length - 1, Math.floor(sorted.length * p))];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Times `count` sequential publishes, after `warmupCount` unmeasured ones
|
|
20
|
+
* absorb connection setup and topic creation.
|
|
21
|
+
*/
|
|
22
|
+
function measurePublishLatency(hatchet_1, topic_1, payload_1, count_1) {
|
|
23
|
+
return __awaiter(this, arguments, void 0, function* (hatchet, topic, payload, count, warmupCount = 5) {
|
|
24
|
+
for (let i = 0; i < warmupCount; i += 1) {
|
|
25
|
+
yield hatchet.streams.publish(topic, payload);
|
|
26
|
+
}
|
|
27
|
+
const durationsMs = [];
|
|
28
|
+
const start = perf_hooks_1.performance.now();
|
|
29
|
+
for (let i = 0; i < count; i += 1) {
|
|
30
|
+
const before = perf_hooks_1.performance.now();
|
|
31
|
+
yield hatchet.streams.publish(topic, payload);
|
|
32
|
+
durationsMs.push(perf_hooks_1.performance.now() - before);
|
|
33
|
+
}
|
|
34
|
+
const totalMs = perf_hooks_1.performance.now() - start;
|
|
35
|
+
const sorted = [...durationsMs].sort((a, b) => a - b);
|
|
36
|
+
return {
|
|
37
|
+
count,
|
|
38
|
+
avgMs: durationsMs.reduce((sum, d) => sum + d, 0) / count,
|
|
39
|
+
p50Ms: percentile(sorted, 0.5),
|
|
40
|
+
p99Ms: percentile(sorted, 0.99),
|
|
41
|
+
maxMs: sorted[sorted.length - 1],
|
|
42
|
+
throughputPerSec: (count / totalMs) * 1000,
|
|
43
|
+
};
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
function formatPublishLatency(stats) {
|
|
47
|
+
const fmt = (ms) => ms.toFixed(2);
|
|
48
|
+
return (`avg=${fmt(stats.avgMs)}ms p50=${fmt(stats.p50Ms)}ms p99=${fmt(stats.p99Ms)}ms ` +
|
|
49
|
+
`max=${fmt(stats.maxMs)}ms throughput=${fmt(stats.throughputPerSec)}/s`);
|
|
50
|
+
}
|
|
@@ -69,11 +69,15 @@ exports.callbackOrderingMid = hatchet_client_1.hatchet.durableTask({
|
|
|
69
69
|
};
|
|
70
70
|
}),
|
|
71
71
|
});
|
|
72
|
+
// The root is never evicted. The ordering property under test lives in the
|
|
73
|
+
// mids, and the worker evicts one waiting run per server round trip, oldest
|
|
74
|
+
// wait first: evictable roots register before every mid and would consume the
|
|
75
|
+
// sweep for as long as it takes to ack all of them before any mid is reached.
|
|
72
76
|
exports.callbackOrderingRoot = hatchet_client_1.hatchet.durableTask({
|
|
73
77
|
name: `${WORKFLOW_PREFIX}-root`,
|
|
74
78
|
executionTimeout: '10m',
|
|
75
79
|
retries: 0,
|
|
76
|
-
evictionPolicy:
|
|
80
|
+
evictionPolicy: { ttl: undefined, allowCapacityEviction: false, priority: 0 },
|
|
77
81
|
fn: (input, ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
78
82
|
var _a;
|
|
79
83
|
const durables = (_a = input.durables) !== null && _a !== void 0 ? _a : exports.ROOT_DEFAULTS.durables;
|
package/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const HATCHET_VERSION = "1.34.0
|
|
1
|
+
export declare const HATCHET_VERSION = "1.34.0";
|
package/version.js
CHANGED