@flowrensic/temporal-flowrensic-node-sdk 0.0.0-stage → 0.6.63
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 +149 -2
- package/dist/cjs/ci.d.ts +47 -0
- package/dist/cjs/ci.d.ts.map +1 -0
- package/dist/cjs/ci.js +70 -0
- package/dist/cjs/ci.js.map +1 -0
- package/dist/cjs/client-interceptor.d.ts +46 -0
- package/dist/cjs/client-interceptor.d.ts.map +1 -0
- package/dist/cjs/client-interceptor.js +129 -0
- package/dist/cjs/client-interceptor.js.map +1 -0
- package/dist/cjs/client.d.ts +44 -0
- package/dist/cjs/client.d.ts.map +1 -0
- package/dist/cjs/client.js +77 -0
- package/dist/cjs/client.js.map +1 -0
- package/dist/cjs/gen/flowrensic/v1/activity_metrics_pb.d.ts +702 -0
- package/dist/cjs/gen/flowrensic/v1/activity_metrics_pb.d.ts.map +1 -0
- package/dist/cjs/gen/flowrensic/v1/activity_metrics_pb.js +123 -0
- package/dist/cjs/gen/flowrensic/v1/activity_metrics_pb.js.map +1 -0
- package/dist/cjs/gen/flowrensic/v1/catalog_pb.d.ts +314 -0
- package/dist/cjs/gen/flowrensic/v1/catalog_pb.d.ts.map +1 -0
- package/dist/cjs/gen/flowrensic/v1/catalog_pb.js +92 -0
- package/dist/cjs/gen/flowrensic/v1/catalog_pb.js.map +1 -0
- package/dist/cjs/gen/flowrensic/v1/catch_up_pb.d.ts +180 -0
- package/dist/cjs/gen/flowrensic/v1/catch_up_pb.d.ts.map +1 -0
- package/dist/cjs/gen/flowrensic/v1/catch_up_pb.js +29 -0
- package/dist/cjs/gen/flowrensic/v1/catch_up_pb.js.map +1 -0
- package/dist/cjs/gen/flowrensic/v1/client_calls_pb.d.ts +216 -0
- package/dist/cjs/gen/flowrensic/v1/client_calls_pb.d.ts.map +1 -0
- package/dist/cjs/gen/flowrensic/v1/client_calls_pb.js +69 -0
- package/dist/cjs/gen/flowrensic/v1/client_calls_pb.js.map +1 -0
- package/dist/cjs/gen/flowrensic/v1/cost_pb.d.ts +257 -0
- package/dist/cjs/gen/flowrensic/v1/cost_pb.d.ts.map +1 -0
- package/dist/cjs/gen/flowrensic/v1/cost_pb.js +54 -0
- package/dist/cjs/gen/flowrensic/v1/cost_pb.js.map +1 -0
- package/dist/cjs/gen/flowrensic/v1/deploy_pb.d.ts +222 -0
- package/dist/cjs/gen/flowrensic/v1/deploy_pb.d.ts.map +1 -0
- package/dist/cjs/gen/flowrensic/v1/deploy_pb.js +53 -0
- package/dist/cjs/gen/flowrensic/v1/deploy_pb.js.map +1 -0
- package/dist/cjs/gen/flowrensic/v1/ephemeral_run_pb.d.ts +850 -0
- package/dist/cjs/gen/flowrensic/v1/ephemeral_run_pb.d.ts.map +1 -0
- package/dist/cjs/gen/flowrensic/v1/ephemeral_run_pb.js +170 -0
- package/dist/cjs/gen/flowrensic/v1/ephemeral_run_pb.js.map +1 -0
- package/dist/cjs/gen/flowrensic/v1/finding_pb.d.ts +896 -0
- package/dist/cjs/gen/flowrensic/v1/finding_pb.d.ts.map +1 -0
- package/dist/cjs/gen/flowrensic/v1/finding_pb.js +451 -0
- package/dist/cjs/gen/flowrensic/v1/finding_pb.js.map +1 -0
- package/dist/cjs/gen/flowrensic/v1/job_pb.d.ts +104 -0
- package/dist/cjs/gen/flowrensic/v1/job_pb.d.ts.map +1 -0
- package/dist/cjs/gen/flowrensic/v1/job_pb.js +28 -0
- package/dist/cjs/gen/flowrensic/v1/job_pb.js.map +1 -0
- package/dist/cjs/gen/flowrensic/v1/load_pb.d.ts +333 -0
- package/dist/cjs/gen/flowrensic/v1/load_pb.d.ts.map +1 -0
- package/dist/cjs/gen/flowrensic/v1/load_pb.js +53 -0
- package/dist/cjs/gen/flowrensic/v1/load_pb.js.map +1 -0
- package/dist/cjs/gen/flowrensic/v1/page_pb.d.ts +67 -0
- package/dist/cjs/gen/flowrensic/v1/page_pb.d.ts.map +1 -0
- package/dist/cjs/gen/flowrensic/v1/page_pb.js +22 -0
- package/dist/cjs/gen/flowrensic/v1/page_pb.js.map +1 -0
- package/dist/cjs/gen/flowrensic/v1/remediation_pb.d.ts +395 -0
- package/dist/cjs/gen/flowrensic/v1/remediation_pb.d.ts.map +1 -0
- package/dist/cjs/gen/flowrensic/v1/remediation_pb.js +103 -0
- package/dist/cjs/gen/flowrensic/v1/remediation_pb.js.map +1 -0
- package/dist/cjs/gen/flowrensic/v1/replay_pb.d.ts +805 -0
- package/dist/cjs/gen/flowrensic/v1/replay_pb.d.ts.map +1 -0
- package/dist/cjs/gen/flowrensic/v1/replay_pb.js +179 -0
- package/dist/cjs/gen/flowrensic/v1/replay_pb.js.map +1 -0
- package/dist/cjs/gen/flowrensic/v1/server_config_pb.d.ts +220 -0
- package/dist/cjs/gen/flowrensic/v1/server_config_pb.d.ts.map +1 -0
- package/dist/cjs/gen/flowrensic/v1/server_config_pb.js +44 -0
- package/dist/cjs/gen/flowrensic/v1/server_config_pb.js.map +1 -0
- package/dist/cjs/gen/flowrensic/v1/services_pb.d.ts +561 -0
- package/dist/cjs/gen/flowrensic/v1/services_pb.d.ts.map +1 -0
- package/dist/cjs/gen/flowrensic/v1/services_pb.js +59 -0
- package/dist/cjs/gen/flowrensic/v1/services_pb.js.map +1 -0
- package/dist/cjs/gen/flowrensic/v1/stored_data_pb.d.ts +120 -0
- package/dist/cjs/gen/flowrensic/v1/stored_data_pb.d.ts.map +1 -0
- package/dist/cjs/gen/flowrensic/v1/stored_data_pb.js +33 -0
- package/dist/cjs/gen/flowrensic/v1/stored_data_pb.js.map +1 -0
- package/dist/cjs/gen/flowrensic/v1/workflow_history_pb.d.ts +204 -0
- package/dist/cjs/gen/flowrensic/v1/workflow_history_pb.d.ts.map +1 -0
- package/dist/cjs/gen/flowrensic/v1/workflow_history_pb.js +135 -0
- package/dist/cjs/gen/flowrensic/v1/workflow_history_pb.js.map +1 -0
- package/dist/cjs/gen/flowrensic/v1/workflow_types_pb.d.ts +505 -0
- package/dist/cjs/gen/flowrensic/v1/workflow_types_pb.d.ts.map +1 -0
- package/dist/cjs/gen/flowrensic/v1/workflow_types_pb.js +56 -0
- package/dist/cjs/gen/flowrensic/v1/workflow_types_pb.js.map +1 -0
- package/dist/cjs/index.d.ts +29 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +49 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/interceptor-names.d.ts +11 -0
- package/dist/cjs/interceptor-names.d.ts.map +1 -0
- package/dist/cjs/interceptor-names.js +27 -0
- package/dist/cjs/interceptor-names.js.map +1 -0
- package/dist/cjs/interceptor.d.ts +39 -0
- package/dist/cjs/interceptor.d.ts.map +1 -0
- package/dist/cjs/interceptor.js +113 -0
- package/dist/cjs/interceptor.js.map +1 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/query-sink.d.ts +31 -0
- package/dist/cjs/query-sink.d.ts.map +1 -0
- package/dist/cjs/query-sink.js +64 -0
- package/dist/cjs/query-sink.js.map +1 -0
- package/dist/cjs/replay.d.ts +119 -0
- package/dist/cjs/replay.d.ts.map +1 -0
- package/dist/cjs/replay.js +204 -0
- package/dist/cjs/replay.js.map +1 -0
- package/dist/cjs/sink.d.ts +79 -0
- package/dist/cjs/sink.d.ts.map +1 -0
- package/dist/cjs/sink.js +320 -0
- package/dist/cjs/sink.js.map +1 -0
- package/dist/cjs/telemetry.d.ts +128 -0
- package/dist/cjs/telemetry.d.ts.map +1 -0
- package/dist/cjs/telemetry.js +420 -0
- package/dist/cjs/telemetry.js.map +1 -0
- package/dist/cjs/workflow.d.ts +15 -0
- package/dist/cjs/workflow.d.ts.map +1 -0
- package/dist/cjs/workflow.js +39 -0
- package/dist/cjs/workflow.js.map +1 -0
- package/dist/esm/ci.d.ts +47 -0
- package/dist/esm/ci.d.ts.map +1 -0
- package/dist/esm/ci.js +64 -0
- package/dist/esm/ci.js.map +1 -0
- package/dist/esm/client-interceptor.d.ts +46 -0
- package/dist/esm/client-interceptor.d.ts.map +1 -0
- package/dist/esm/client-interceptor.js +124 -0
- package/dist/esm/client-interceptor.js.map +1 -0
- package/dist/esm/client.d.ts +44 -0
- package/dist/esm/client.d.ts.map +1 -0
- package/dist/esm/client.js +69 -0
- package/dist/esm/client.js.map +1 -0
- package/dist/esm/gen/flowrensic/v1/activity_metrics_pb.d.ts +702 -0
- package/dist/esm/gen/flowrensic/v1/activity_metrics_pb.d.ts.map +1 -0
- package/dist/esm/gen/flowrensic/v1/activity_metrics_pb.js +120 -0
- package/dist/esm/gen/flowrensic/v1/activity_metrics_pb.js.map +1 -0
- package/dist/esm/gen/flowrensic/v1/catalog_pb.d.ts +314 -0
- package/dist/esm/gen/flowrensic/v1/catalog_pb.d.ts.map +1 -0
- package/dist/esm/gen/flowrensic/v1/catalog_pb.js +89 -0
- package/dist/esm/gen/flowrensic/v1/catalog_pb.js.map +1 -0
- package/dist/esm/gen/flowrensic/v1/catch_up_pb.d.ts +180 -0
- package/dist/esm/gen/flowrensic/v1/catch_up_pb.d.ts.map +1 -0
- package/dist/esm/gen/flowrensic/v1/catch_up_pb.js +26 -0
- package/dist/esm/gen/flowrensic/v1/catch_up_pb.js.map +1 -0
- package/dist/esm/gen/flowrensic/v1/client_calls_pb.d.ts +216 -0
- package/dist/esm/gen/flowrensic/v1/client_calls_pb.d.ts.map +1 -0
- package/dist/esm/gen/flowrensic/v1/client_calls_pb.js +66 -0
- package/dist/esm/gen/flowrensic/v1/client_calls_pb.js.map +1 -0
- package/dist/esm/gen/flowrensic/v1/cost_pb.d.ts +257 -0
- package/dist/esm/gen/flowrensic/v1/cost_pb.d.ts.map +1 -0
- package/dist/esm/gen/flowrensic/v1/cost_pb.js +51 -0
- package/dist/esm/gen/flowrensic/v1/cost_pb.js.map +1 -0
- package/dist/esm/gen/flowrensic/v1/deploy_pb.d.ts +222 -0
- package/dist/esm/gen/flowrensic/v1/deploy_pb.d.ts.map +1 -0
- package/dist/esm/gen/flowrensic/v1/deploy_pb.js +50 -0
- package/dist/esm/gen/flowrensic/v1/deploy_pb.js.map +1 -0
- package/dist/esm/gen/flowrensic/v1/ephemeral_run_pb.d.ts +850 -0
- package/dist/esm/gen/flowrensic/v1/ephemeral_run_pb.d.ts.map +1 -0
- package/dist/esm/gen/flowrensic/v1/ephemeral_run_pb.js +167 -0
- package/dist/esm/gen/flowrensic/v1/ephemeral_run_pb.js.map +1 -0
- package/dist/esm/gen/flowrensic/v1/finding_pb.d.ts +896 -0
- package/dist/esm/gen/flowrensic/v1/finding_pb.d.ts.map +1 -0
- package/dist/esm/gen/flowrensic/v1/finding_pb.js +448 -0
- package/dist/esm/gen/flowrensic/v1/finding_pb.js.map +1 -0
- package/dist/esm/gen/flowrensic/v1/job_pb.d.ts +104 -0
- package/dist/esm/gen/flowrensic/v1/job_pb.d.ts.map +1 -0
- package/dist/esm/gen/flowrensic/v1/job_pb.js +25 -0
- package/dist/esm/gen/flowrensic/v1/job_pb.js.map +1 -0
- package/dist/esm/gen/flowrensic/v1/load_pb.d.ts +333 -0
- package/dist/esm/gen/flowrensic/v1/load_pb.d.ts.map +1 -0
- package/dist/esm/gen/flowrensic/v1/load_pb.js +50 -0
- package/dist/esm/gen/flowrensic/v1/load_pb.js.map +1 -0
- package/dist/esm/gen/flowrensic/v1/page_pb.d.ts +67 -0
- package/dist/esm/gen/flowrensic/v1/page_pb.d.ts.map +1 -0
- package/dist/esm/gen/flowrensic/v1/page_pb.js +19 -0
- package/dist/esm/gen/flowrensic/v1/page_pb.js.map +1 -0
- package/dist/esm/gen/flowrensic/v1/remediation_pb.d.ts +395 -0
- package/dist/esm/gen/flowrensic/v1/remediation_pb.d.ts.map +1 -0
- package/dist/esm/gen/flowrensic/v1/remediation_pb.js +100 -0
- package/dist/esm/gen/flowrensic/v1/remediation_pb.js.map +1 -0
- package/dist/esm/gen/flowrensic/v1/replay_pb.d.ts +805 -0
- package/dist/esm/gen/flowrensic/v1/replay_pb.d.ts.map +1 -0
- package/dist/esm/gen/flowrensic/v1/replay_pb.js +176 -0
- package/dist/esm/gen/flowrensic/v1/replay_pb.js.map +1 -0
- package/dist/esm/gen/flowrensic/v1/server_config_pb.d.ts +220 -0
- package/dist/esm/gen/flowrensic/v1/server_config_pb.d.ts.map +1 -0
- package/dist/esm/gen/flowrensic/v1/server_config_pb.js +41 -0
- package/dist/esm/gen/flowrensic/v1/server_config_pb.js.map +1 -0
- package/dist/esm/gen/flowrensic/v1/services_pb.d.ts +561 -0
- package/dist/esm/gen/flowrensic/v1/services_pb.d.ts.map +1 -0
- package/dist/esm/gen/flowrensic/v1/services_pb.js +56 -0
- package/dist/esm/gen/flowrensic/v1/services_pb.js.map +1 -0
- package/dist/esm/gen/flowrensic/v1/stored_data_pb.d.ts +120 -0
- package/dist/esm/gen/flowrensic/v1/stored_data_pb.d.ts.map +1 -0
- package/dist/esm/gen/flowrensic/v1/stored_data_pb.js +30 -0
- package/dist/esm/gen/flowrensic/v1/stored_data_pb.js.map +1 -0
- package/dist/esm/gen/flowrensic/v1/workflow_history_pb.d.ts +204 -0
- package/dist/esm/gen/flowrensic/v1/workflow_history_pb.d.ts.map +1 -0
- package/dist/esm/gen/flowrensic/v1/workflow_history_pb.js +132 -0
- package/dist/esm/gen/flowrensic/v1/workflow_history_pb.js.map +1 -0
- package/dist/esm/gen/flowrensic/v1/workflow_types_pb.d.ts +505 -0
- package/dist/esm/gen/flowrensic/v1/workflow_types_pb.d.ts.map +1 -0
- package/dist/esm/gen/flowrensic/v1/workflow_types_pb.js +53 -0
- package/dist/esm/gen/flowrensic/v1/workflow_types_pb.js.map +1 -0
- package/dist/esm/index.d.ts +29 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +16 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/interceptor-names.d.ts +11 -0
- package/dist/esm/interceptor-names.d.ts.map +1 -0
- package/dist/esm/interceptor-names.js +23 -0
- package/dist/esm/interceptor-names.js.map +1 -0
- package/dist/esm/interceptor.d.ts +39 -0
- package/dist/esm/interceptor.d.ts.map +1 -0
- package/dist/esm/interceptor.js +108 -0
- package/dist/esm/interceptor.js.map +1 -0
- package/dist/esm/query-sink.d.ts +31 -0
- package/dist/esm/query-sink.d.ts.map +1 -0
- package/dist/esm/query-sink.js +61 -0
- package/dist/esm/query-sink.js.map +1 -0
- package/dist/esm/replay.d.ts +119 -0
- package/dist/esm/replay.d.ts.map +1 -0
- package/dist/esm/replay.js +197 -0
- package/dist/esm/replay.js.map +1 -0
- package/dist/esm/sink.d.ts +79 -0
- package/dist/esm/sink.d.ts.map +1 -0
- package/dist/esm/sink.js +315 -0
- package/dist/esm/sink.js.map +1 -0
- package/dist/esm/telemetry.d.ts +128 -0
- package/dist/esm/telemetry.d.ts.map +1 -0
- package/dist/esm/telemetry.js +414 -0
- package/dist/esm/telemetry.js.map +1 -0
- package/dist/esm/workflow.d.ts +15 -0
- package/dist/esm/workflow.d.ts.map +1 -0
- package/dist/esm/workflow.js +35 -0
- package/dist/esm/workflow.js.map +1 -0
- package/package.json +75 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,iCAA6F;AAApF,0GAAA,iBAAiB,OAAA;AAC1B,qCAAoJ;AAA3I,qGAAA,UAAU,OAAA;AAAE,4GAAA,iBAAiB,OAAA;AACtC,mDAAyG;AAAhG,+HAAA,6BAA6B,OAAA;AAAE,uHAAA,qBAAqB,OAAA;AAC7D,iEAIiC;AAH/B,oIAAA,2BAA2B,OAAA;AAC3B,oIAAA,2BAA2B,OAAA;AAG7B,6EAA2E;AAAlE,uHAAA,iBAAiB,OAAA;AAE1B,yCAUqB;AATnB,mHAAA,sBAAsB,OAAA;AACtB,iHAAA,oBAAoB,OAAA;AACpB,+GAAA,kBAAkB,OAAA;AAClB,kHAAA,qBAAqB,OAAA;AACrB,yHAAA,4BAA4B,OAAA;AAC5B,6GAAA,gBAAgB,OAAA;AAKlB,+CAKwB;AAJtB,0HAAA,0BAA0B,OAAA;AAK5B,yCAYqB;AAXnB,2GAAA,cAAc,OAAA;AACd,0GAAA,aAAa,OAAA;AACb,6GAAA,gBAAgB,OAAA;AAChB,4GAAA,eAAe,OAAA;AACf,uGAAA,UAAU,OAAA;AAaZ,qFAAqE;AAA5D,iHAAA,OAAO,OAAA;AAIhB,qFAAuE;AAA9D,mHAAA,SAAS,OAAA;AAGlB,+DAAyD;AAAhD,uHAAA,eAAe,OAAA;AACxB,iEAA6D;AAApD,yGAAA,SAAS,OAAA;AAElB,mEAAsG;AAA7F,6GAAA,YAAY,OAAA;AAAE,8GAAA,aAAa,OAAA;AAAE,2GAAA,UAAU,OAAA;AAAE,yGAAA,QAAQ,OAAA;AAI1D,2EAA0E;AAAjE,sHAAA,iBAAiB,OAAA;AAS1B,iDAA+F;AAAtF,qHAAA,oBAAoB,OAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type WorkflowInterceptors } from './gen/flowrensic/v1/replay_pb.js';
|
|
2
|
+
/**
|
|
3
|
+
* The name of a workflow interceptor module: its file name without the folder
|
|
4
|
+
* and the extension, and for a file named index the name of its folder. So a
|
|
5
|
+
* prod worker's /app/dist/interceptors/metrics.js and a CI job's
|
|
6
|
+
* ./src/interceptors/metrics.ts are both metrics.
|
|
7
|
+
*/
|
|
8
|
+
export declare function interceptorName(module: string): string;
|
|
9
|
+
/** The modules as Flowrensic is sent them, in their order. Undefined sends no list. */
|
|
10
|
+
export declare function interceptorList(modules: readonly string[] | undefined): WorkflowInterceptors | undefined;
|
|
11
|
+
//# sourceMappingURL=interceptor-names.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interceptor-names.d.ts","sourceRoot":"","sources":["../../src/interceptor-names.ts"],"names":[],"mappings":"AAEA,OAAO,EAA8B,KAAK,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAIzG;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAKtD;AAED,uFAAuF;AACvF,wBAAgB,eAAe,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,GAAG,oBAAoB,GAAG,SAAS,CAGxG"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.interceptorName = interceptorName;
|
|
4
|
+
exports.interceptorList = interceptorList;
|
|
5
|
+
const protobuf_1 = require("@bufbuild/protobuf");
|
|
6
|
+
const replay_pb_js_1 = require("./gen/flowrensic/v1/replay_pb.js");
|
|
7
|
+
const extensions = /\.(?:[cm]?[jt]s|[jt]sx)$/;
|
|
8
|
+
/**
|
|
9
|
+
* The name of a workflow interceptor module: its file name without the folder
|
|
10
|
+
* and the extension, and for a file named index the name of its folder. So a
|
|
11
|
+
* prod worker's /app/dist/interceptors/metrics.js and a CI job's
|
|
12
|
+
* ./src/interceptors/metrics.ts are both metrics.
|
|
13
|
+
*/
|
|
14
|
+
function interceptorName(module) {
|
|
15
|
+
const parts = module.split(/[/\\]/).filter((part) => part !== '');
|
|
16
|
+
const file = (parts.at(-1) ?? '').replace(extensions, '');
|
|
17
|
+
if (file === 'index' && parts.length > 1)
|
|
18
|
+
return parts.at(-2) ?? file;
|
|
19
|
+
return file;
|
|
20
|
+
}
|
|
21
|
+
/** The modules as Flowrensic is sent them, in their order. Undefined sends no list. */
|
|
22
|
+
function interceptorList(modules) {
|
|
23
|
+
if (modules === undefined)
|
|
24
|
+
return undefined;
|
|
25
|
+
return (0, protobuf_1.create)(replay_pb_js_1.WorkflowInterceptorsSchema, { names: modules.map(interceptorName) });
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=interceptor-names.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interceptor-names.js","sourceRoot":"","sources":["../../src/interceptor-names.ts"],"names":[],"mappings":";;;;AAAA,iDAA4C;AAE5C,mEAAyG;AAEzG,MAAM,UAAU,GAAG,0BAA0B,CAAC;AAE9C;;;;;GAKG;AACH,yBAAgC,MAAc;IAC5C,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC;IAClE,MAAM,IAAI,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;IAC1D,IAAI,IAAI,KAAK,OAAO,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;IACtE,OAAO,IAAI,CAAC;AACd,CAAC;AAED,uFAAuF;AACvF,yBAAgC,OAAsC;IACpE,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC5C,OAAO,IAAA,iBAAM,EAAC,yCAA0B,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;AACrF,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Context } from '@temporalio/activity';
|
|
2
|
+
import type { ActivityExecuteInput, ActivityInboundCallsInterceptor, ActivityInterceptorsFactory, Next } from '@temporalio/worker';
|
|
3
|
+
import type { AttemptSink } from './sink.js';
|
|
4
|
+
/**
|
|
5
|
+
* What the worker says of itself on each attempt. The env and the ephemeral run
|
|
6
|
+
* are not here: the sink sends them in the headers of its calls.
|
|
7
|
+
*/
|
|
8
|
+
export interface EnvOptions {
|
|
9
|
+
/** The version this worker serves, from its own config. A worker that
|
|
10
|
+
* carries none reports none, and a run with no version is on neither side of
|
|
11
|
+
* an overlap. */
|
|
12
|
+
version?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Records one event per activity attempt, which is everything Temporal's own
|
|
16
|
+
* OpenTelemetry spans throw away: the attempt number, the workflow type, the
|
|
17
|
+
* task queue, the failure classification, and the start to close timeout,
|
|
18
|
+
* maximum attempts and heartbeat timeout the activity context was handed for
|
|
19
|
+
* this attempt, and when the activity was first scheduled.
|
|
20
|
+
*
|
|
21
|
+
* Activity inbound, never workflow inbound. This runs in the activity worker
|
|
22
|
+
* where I/O is ordinary. Emitting from a workflow interceptor would be
|
|
23
|
+
* non-determinism in the product that sells determinism analysis.
|
|
24
|
+
*/
|
|
25
|
+
export declare class FlowrensicActivityInterceptor implements ActivityInboundCallsInterceptor {
|
|
26
|
+
private readonly ctx;
|
|
27
|
+
private readonly sink;
|
|
28
|
+
private readonly env;
|
|
29
|
+
constructor(ctx: Context, sink: AttemptSink, env?: EnvOptions);
|
|
30
|
+
execute(input: ActivityExecuteInput, next: Next<ActivityInboundCallsInterceptor, 'execute'>): Promise<unknown>;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Pass to `Worker.create({ interceptors: { activity: [flowrensicInterceptor(sink, env)] } })`.
|
|
34
|
+
* `env` is the version the worker serves. The namespace of each attempt is the
|
|
35
|
+
* one Temporal gives in the activity info. The env and the ephemeral run are
|
|
36
|
+
* those the sink was made with.
|
|
37
|
+
*/
|
|
38
|
+
export declare function flowrensicInterceptor(sink: AttemptSink, env?: EnvOptions): ActivityInterceptorsFactory;
|
|
39
|
+
//# sourceMappingURL=interceptor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interceptor.d.ts","sourceRoot":"","sources":["../../src/interceptor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEpD,OAAO,KAAK,EACV,oBAAoB,EACpB,+BAA+B,EAC/B,2BAA2B,EAC3B,IAAI,EACL,MAAM,oBAAoB,CAAC;AAG5B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB;;qBAEiB;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AA2BD;;;;;;;;;;GAUG;AACH,qBAAa,6BAA8B,YAAW,+BAA+B;IAEjF,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,GAAG;IAHtB,YACmB,GAAG,EAAE,OAAO,EACZ,IAAI,EAAE,WAAW,EACjB,GAAG,GAAE,UAAkB,EACtC;IAEE,OAAO,CACX,KAAK,EAAE,oBAAoB,EAC3B,IAAI,EAAE,IAAI,CAAC,+BAA+B,EAAE,SAAS,CAAC,GACrD,OAAO,CAAC,OAAO,CAAC,CAgDlB;CACF;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,WAAW,EAAE,GAAG,GAAE,UAAkB,GAAG,2BAA2B,CAI7G"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FlowrensicActivityInterceptor = void 0;
|
|
4
|
+
exports.flowrensicInterceptor = flowrensicInterceptor;
|
|
5
|
+
const wkt_1 = require("@bufbuild/protobuf/wkt");
|
|
6
|
+
const common_1 = require("@temporalio/common");
|
|
7
|
+
const activity_metrics_pb_js_1 = require("./gen/flowrensic/v1/activity_metrics_pb.js");
|
|
8
|
+
const noEnv = {};
|
|
9
|
+
function classify(err) {
|
|
10
|
+
if (err instanceof common_1.CancelledFailure) {
|
|
11
|
+
return { outcome: activity_metrics_pb_js_1.Outcome.CANCELED, errorType: 'CancelledFailure' };
|
|
12
|
+
}
|
|
13
|
+
if (err instanceof common_1.ApplicationFailure) {
|
|
14
|
+
return { outcome: activity_metrics_pb_js_1.Outcome.FAILED, errorType: err.type ?? 'ApplicationFailure' };
|
|
15
|
+
}
|
|
16
|
+
if (err instanceof Error) {
|
|
17
|
+
return { outcome: activity_metrics_pb_js_1.Outcome.FAILED, errorType: err.constructor.name };
|
|
18
|
+
}
|
|
19
|
+
return { outcome: activity_metrics_pb_js_1.Outcome.FAILED, errorType: 'Unknown' };
|
|
20
|
+
}
|
|
21
|
+
/** The outcome and error type of a failed attempt, as two values. */
|
|
22
|
+
function classified(err) {
|
|
23
|
+
try {
|
|
24
|
+
const { outcome, errorType } = classify(err);
|
|
25
|
+
return [outcome, errorType];
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return [activity_metrics_pb_js_1.Outcome.FAILED, 'Unknown'];
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Records one event per activity attempt, which is everything Temporal's own
|
|
33
|
+
* OpenTelemetry spans throw away: the attempt number, the workflow type, the
|
|
34
|
+
* task queue, the failure classification, and the start to close timeout,
|
|
35
|
+
* maximum attempts and heartbeat timeout the activity context was handed for
|
|
36
|
+
* this attempt, and when the activity was first scheduled.
|
|
37
|
+
*
|
|
38
|
+
* Activity inbound, never workflow inbound. This runs in the activity worker
|
|
39
|
+
* where I/O is ordinary. Emitting from a workflow interceptor would be
|
|
40
|
+
* non-determinism in the product that sells determinism analysis.
|
|
41
|
+
*/
|
|
42
|
+
class FlowrensicActivityInterceptor {
|
|
43
|
+
ctx;
|
|
44
|
+
sink;
|
|
45
|
+
env;
|
|
46
|
+
constructor(ctx, sink, env = noEnv) {
|
|
47
|
+
this.ctx = ctx;
|
|
48
|
+
this.sink = sink;
|
|
49
|
+
this.env = env;
|
|
50
|
+
}
|
|
51
|
+
async execute(input, next) {
|
|
52
|
+
const info = this.ctx.info;
|
|
53
|
+
const startedAt = new Date();
|
|
54
|
+
const record = (outcome, errorType) => {
|
|
55
|
+
const endedAt = new Date();
|
|
56
|
+
this.sink.record({
|
|
57
|
+
$typeName: 'flowrensic.v1.ActivityAttempt',
|
|
58
|
+
namespace: info.namespace,
|
|
59
|
+
env: '',
|
|
60
|
+
ephemeralRun: '',
|
|
61
|
+
version: this.env.version ?? '',
|
|
62
|
+
workflowType: info.workflowType ?? '',
|
|
63
|
+
workflowExecutionId: info.workflowExecution?.workflowId ?? '',
|
|
64
|
+
runKey: info.workflowExecution?.runId ?? '',
|
|
65
|
+
activityType: info.activityType,
|
|
66
|
+
activityId: info.activityId,
|
|
67
|
+
attempt: info.attempt,
|
|
68
|
+
taskQueue: info.taskQueue,
|
|
69
|
+
outcome,
|
|
70
|
+
errorType,
|
|
71
|
+
startedAt: (0, wkt_1.timestampFromDate)(startedAt),
|
|
72
|
+
endedAt: (0, wkt_1.timestampFromDate)(endedAt),
|
|
73
|
+
durationMs: BigInt(endedAt.getTime() - startedAt.getTime()),
|
|
74
|
+
startToCloseTimeoutMs: BigInt(Math.round(info.startToCloseTimeoutMs)),
|
|
75
|
+
maximumAttempts: info.retryPolicy?.maximumAttempts ?? 0,
|
|
76
|
+
heartbeatTimeoutMs: BigInt(Math.round(info.heartbeatTimeoutMs ?? 0)),
|
|
77
|
+
scheduledAt: (0, wkt_1.timestampFromDate)(new Date(info.scheduledTimestampMs)),
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
// Reporting never changes what the activity returns or throws: an error
|
|
81
|
+
// inside it is swallowed.
|
|
82
|
+
const emit = (outcome, errorType) => {
|
|
83
|
+
try {
|
|
84
|
+
record(outcome, errorType);
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
try {
|
|
91
|
+
const result = await next(input);
|
|
92
|
+
emit(activity_metrics_pb_js_1.Outcome.COMPLETED, '');
|
|
93
|
+
return result;
|
|
94
|
+
}
|
|
95
|
+
catch (err) {
|
|
96
|
+
emit(...classified(err));
|
|
97
|
+
throw err;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
exports.FlowrensicActivityInterceptor = FlowrensicActivityInterceptor;
|
|
102
|
+
/**
|
|
103
|
+
* Pass to `Worker.create({ interceptors: { activity: [flowrensicInterceptor(sink, env)] } })`.
|
|
104
|
+
* `env` is the version the worker serves. The namespace of each attempt is the
|
|
105
|
+
* one Temporal gives in the activity info. The env and the ephemeral run are
|
|
106
|
+
* those the sink was made with.
|
|
107
|
+
*/
|
|
108
|
+
function flowrensicInterceptor(sink, env = noEnv) {
|
|
109
|
+
return (ctx) => ({
|
|
110
|
+
inbound: new FlowrensicActivityInterceptor(ctx, sink, env),
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=interceptor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interceptor.js","sourceRoot":"","sources":["../../src/interceptor.ts"],"names":[],"mappings":";;;;AAAA,gDAA2D;AAE3D,+CAA0E;AAQ1E,uFAAqE;AAcrE,MAAM,KAAK,GAAe,EAAE,CAAC;AAE7B,SAAS,QAAQ,CAAC,GAAY;IAC5B,IAAI,GAAG,YAAY,yBAAgB,EAAE,CAAC;QACpC,OAAO,EAAE,OAAO,EAAE,gCAAO,CAAC,QAAQ,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC;IACtE,CAAC;IACD,IAAI,GAAG,YAAY,2BAAkB,EAAE,CAAC;QACtC,OAAO,EAAE,OAAO,EAAE,gCAAO,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,CAAC,IAAI,IAAI,oBAAoB,EAAE,CAAC;IAClF,CAAC;IACD,IAAI,GAAG,YAAY,KAAK,EAAE,CAAC;QACzB,OAAO,EAAE,OAAO,EAAE,gCAAO,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;IACtE,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,gCAAO,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;AAC3D,CAAC;AAED,qEAAqE;AACrE,SAAS,UAAU,CAAC,GAAY;IAC9B,IAAI,CAAC;QACH,MAAM,EAAE,OAAO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,CAAC,CAAC;QACxB,OAAO,EAAE,IAAI,6BAA6B,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,CAAC;KAC3D,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type": "commonjs"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { InjectedSinks } from '@temporalio/worker';
|
|
2
|
+
import { type ClientContext } from './client.js';
|
|
3
|
+
import { type BufferOptions, type RecordSink } from './sink.js';
|
|
4
|
+
import type { FlowrensicSinks } from './workflow.js';
|
|
5
|
+
export interface QuerySinkOptions extends BufferOptions, ClientContext {
|
|
6
|
+
/** The Flowrensic server to send to. */
|
|
7
|
+
serverBaseUrl: string;
|
|
8
|
+
/** The env the worker runs in, sent with its key and ephemeral run in the headers of every send. */
|
|
9
|
+
currentEnv: string;
|
|
10
|
+
}
|
|
11
|
+
interface Answered {
|
|
12
|
+
readonly namespace: string;
|
|
13
|
+
readonly workflowType: string;
|
|
14
|
+
readonly name: string;
|
|
15
|
+
readonly ok: boolean;
|
|
16
|
+
readonly at: number;
|
|
17
|
+
}
|
|
18
|
+
/** The sinks of the worker, with what the queries the workflows answer go to, and the buffer behind them. */
|
|
19
|
+
export interface QuerySinks {
|
|
20
|
+
readonly sinks: InjectedSinks<FlowrensicSinks>;
|
|
21
|
+
readonly buffer: RecordSink<Answered>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Pass sinks to `Worker.create({ sinks })`, beside the workflow module
|
|
25
|
+
* `@flowrensic/temporal-flowrensic-node-sdk/workflow` in `interceptors.workflowModules`. The queries
|
|
26
|
+
* the workflows answer are counted per workflow type, name and minute, and
|
|
27
|
+
* sent in batches. Call buffer.close() before the process ends.
|
|
28
|
+
*/
|
|
29
|
+
export declare function flowrensicQuerySinks(options: QuerySinkOptions): QuerySinks;
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=query-sink.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-sink.d.ts","sourceRoot":"","sources":["../../src/query-sink.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGxD,OAAO,EAAqC,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAEpF,OAAO,EAAsB,KAAK,aAAa,EAAE,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AACpF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD,MAAM,WAAW,gBAAiB,SAAQ,aAAa,EAAE,aAAa;IACpE,wCAAwC;IACxC,aAAa,EAAE,MAAM,CAAC;IACtB,oGAAoG;IACpG,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,UAAU,QAAQ;IAChB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB;AAID,6GAA6G;AAC7G,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;IAC/C,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;CACvC;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,gBAAgB,GAAG,UAAU,CAiD1E"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.flowrensicQuerySinks = flowrensicQuerySinks;
|
|
4
|
+
const wkt_1 = require("@bufbuild/protobuf/wkt");
|
|
5
|
+
const client_js_1 = require("./client.js");
|
|
6
|
+
const sink_js_1 = require("./sink.js");
|
|
7
|
+
const MINUTE = 60_000;
|
|
8
|
+
/**
|
|
9
|
+
* Pass sinks to `Worker.create({ sinks })`, beside the workflow module
|
|
10
|
+
* `@flowrensic/temporal-flowrensic-node-sdk/workflow` in `interceptors.workflowModules`. The queries
|
|
11
|
+
* the workflows answer are counted per workflow type, name and minute, and
|
|
12
|
+
* sent in batches. Call buffer.close() before the process ends.
|
|
13
|
+
*/
|
|
14
|
+
function flowrensicQuerySinks(options) {
|
|
15
|
+
const client = (0, client_js_1.createFlowrensicClient)(options.serverBaseUrl, (0, client_js_1.contextOf)(options));
|
|
16
|
+
const buffer = (0, sink_js_1.createRecordBuffer)({
|
|
17
|
+
async send(records, timeoutMs, id) {
|
|
18
|
+
const counts = new Map();
|
|
19
|
+
for (const one of records) {
|
|
20
|
+
const minute = Math.floor(one.at / MINUTE) * MINUTE;
|
|
21
|
+
const key = `${one.namespace}\u0000${one.workflowType}\u0000${one.name}\u0000${String(minute)}`;
|
|
22
|
+
let count = counts.get(key);
|
|
23
|
+
if (count === undefined) {
|
|
24
|
+
count = {
|
|
25
|
+
$typeName: 'flowrensic.v1.QueryCount',
|
|
26
|
+
namespace: one.namespace,
|
|
27
|
+
env: '',
|
|
28
|
+
workflowType: one.workflowType,
|
|
29
|
+
queryName: one.name,
|
|
30
|
+
answered: 0n,
|
|
31
|
+
failed: 0n,
|
|
32
|
+
minute: (0, wkt_1.timestampFromDate)(new Date(minute)),
|
|
33
|
+
};
|
|
34
|
+
counts.set(key, count);
|
|
35
|
+
}
|
|
36
|
+
if (one.ok)
|
|
37
|
+
count.answered += 1n;
|
|
38
|
+
else
|
|
39
|
+
count.failed += 1n;
|
|
40
|
+
}
|
|
41
|
+
await client.ingest.ingestQueryCounts({ counts: [...counts.values()], ...id }, { timeoutMs });
|
|
42
|
+
},
|
|
43
|
+
envOf: () => options.currentEnv,
|
|
44
|
+
}, options);
|
|
45
|
+
return {
|
|
46
|
+
buffer,
|
|
47
|
+
sinks: {
|
|
48
|
+
flowrensic: {
|
|
49
|
+
query: {
|
|
50
|
+
fn(info, name, ok) {
|
|
51
|
+
try {
|
|
52
|
+
buffer.record({ namespace: info.namespace, workflowType: info.workflowType, name, ok, at: Date.now() });
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
callDuringReplay: false,
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=query-sink.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-sink.js","sourceRoot":"","sources":["../../src/query-sink.ts"],"names":[],"mappings":";;;AAAA,gDAA2D;AAI3D,2CAAoF;AAEpF,uCAAoF;AAkBpF,MAAM,MAAM,GAAG,MAAM,CAAC;AAQtB;;;;;GAKG;AACH,8BAAqC,OAAyB;IAC5D,MAAM,MAAM,GAAG,IAAA,kCAAsB,EAAC,OAAO,CAAC,aAAa,EAAE,IAAA,qBAAS,EAAC,OAAO,CAAC,CAAC,CAAC;IACjF,MAAM,MAAM,GAAG,IAAA,4BAAkB,EAC/B;QACE,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,EAAE;YAC/B,MAAM,MAAM,GAAG,IAAI,GAAG,EAAsB,CAAC;YAC7C,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;gBAC1B,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,GAAG,MAAM,CAAC,GAAG,MAAM,CAAC;gBACpD,MAAM,GAAG,GAAG,GAAG,GAAG,CAAC,SAAS,SAAS,GAAG,CAAC,YAAY,SAAS,GAAG,CAAC,IAAI,SAAS,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;gBAChG,IAAI,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;gBAC5B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;oBACxB,KAAK,GAAG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,CAAC"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/** Manifest written beside the histories, the same one the CLI writes. */
|
|
2
|
+
export declare const INDEX_NAME = "replay-set.json";
|
|
3
|
+
/** One history on disk, with the metadata the server chose it by. */
|
|
4
|
+
export interface ReplaySetEntry {
|
|
5
|
+
readonly run_id: string;
|
|
6
|
+
readonly file: string;
|
|
7
|
+
readonly status: string;
|
|
8
|
+
/** The env the history comes from. */
|
|
9
|
+
readonly env?: string;
|
|
10
|
+
/** The build ids the history carries, unknown when it carries none. */
|
|
11
|
+
readonly code_versions: readonly string[];
|
|
12
|
+
readonly events: number;
|
|
13
|
+
readonly started_at: string;
|
|
14
|
+
readonly closed_at?: string;
|
|
15
|
+
}
|
|
16
|
+
/** A stored run the server could not read, so it is not in the set. */
|
|
17
|
+
export interface LeftOutEntry {
|
|
18
|
+
readonly run_id: string;
|
|
19
|
+
readonly reason: string;
|
|
20
|
+
}
|
|
21
|
+
export interface ReplaySet {
|
|
22
|
+
readonly workflow_type: string;
|
|
23
|
+
/** The envs the histories come from, in the order they were asked for. */
|
|
24
|
+
readonly envs: readonly string[];
|
|
25
|
+
readonly fetched_at: string;
|
|
26
|
+
readonly server: string;
|
|
27
|
+
readonly histories: readonly ReplaySetEntry[];
|
|
28
|
+
/** Empty when every stored history of the type and envs could be read. */
|
|
29
|
+
readonly left_out: readonly LeftOutEntry[];
|
|
30
|
+
/** Why the download failed, when failOnError was false and it did. The set is then empty. */
|
|
31
|
+
readonly failed?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface FetchOptions {
|
|
34
|
+
/** Flowrensic base URL, e.g. `http://flowrensic:8080`. */
|
|
35
|
+
serverBaseUrl: string;
|
|
36
|
+
/** The workflow type to replay. A set spans one, because that is what a replayer is built for. */
|
|
37
|
+
replayHistoryWorkflow: string;
|
|
38
|
+
/** Directory to write the histories and the manifest into. */
|
|
39
|
+
replayHistoryOutDir: string;
|
|
40
|
+
/**
|
|
41
|
+
* The envs to replay from, such as prod and staging. Each one must be the
|
|
42
|
+
* current env or an env it may read. The set of each env comes in this order.
|
|
43
|
+
*/
|
|
44
|
+
replayHistoryFromEnvs: readonly string[];
|
|
45
|
+
/** The env of the caller, sent in the header Flowrensic-Current-Env. */
|
|
46
|
+
currentEnv: string;
|
|
47
|
+
/** The access key of the env of the caller. The request carries it. */
|
|
48
|
+
envAccessKey: string;
|
|
49
|
+
/** The ephemeral run of the caller, such as the CI build number. For an env of kind ephemeral, without one the run is default. */
|
|
50
|
+
currentEphemeralRun?: string;
|
|
51
|
+
/** How long the download may take, in milliseconds. Left out, 60 seconds. */
|
|
52
|
+
timeoutMs?: number;
|
|
53
|
+
/**
|
|
54
|
+
* Whether a download that failed rejects, so the CI job fails. Left out,
|
|
55
|
+
* true. False resolves with an empty set whose failed field says why, and
|
|
56
|
+
* writes no manifest.
|
|
57
|
+
*/
|
|
58
|
+
failOnError?: boolean;
|
|
59
|
+
}
|
|
60
|
+
/** What one history did when replayed against the checkout under test. */
|
|
61
|
+
export interface ReplayVerdict {
|
|
62
|
+
readonly runId: string;
|
|
63
|
+
readonly workflowType: string;
|
|
64
|
+
readonly passed: boolean;
|
|
65
|
+
/** The replayer's own message, kept verbatim: it names what diverged. */
|
|
66
|
+
readonly error?: string;
|
|
67
|
+
}
|
|
68
|
+
export interface PublishOptions {
|
|
69
|
+
serverBaseUrl: string;
|
|
70
|
+
/**
|
|
71
|
+
* The commit, tag or build replayed. Only the pipeline knows it, and a
|
|
72
|
+
* verdict without one cannot be attributed to a change.
|
|
73
|
+
*/
|
|
74
|
+
codeVersion: string;
|
|
75
|
+
verdicts: readonly ReplayVerdict[];
|
|
76
|
+
/** The env the verdicts are sent for, sent in the header Flowrensic-Current-Env. */
|
|
77
|
+
currentEnv: string;
|
|
78
|
+
/** The access key of that env. */
|
|
79
|
+
envAccessKey: string;
|
|
80
|
+
/** The ephemeral run of that env, such as the CI build number. For an env of kind ephemeral, without one the run is default. */
|
|
81
|
+
currentEphemeralRun?: string;
|
|
82
|
+
/**
|
|
83
|
+
* The module paths of the workflow interceptors the replay ran with, the
|
|
84
|
+
* workflowInterceptorModules its bundle was built with. Every result is sent
|
|
85
|
+
* with their names, to compare with the list the workers of the env load.
|
|
86
|
+
* Left out, no list is sent, which is not an empty list.
|
|
87
|
+
*/
|
|
88
|
+
workflowInterceptors?: readonly string[];
|
|
89
|
+
/**
|
|
90
|
+
* How long refused results are sent again before publishVerdicts gives up
|
|
91
|
+
* with the last error, 10 minutes when left out. Results Flowrensic does not
|
|
92
|
+
* answer, or answers try again later, are sent again (FPP-135-R23).
|
|
93
|
+
*/
|
|
94
|
+
sendAgainForMs?: number;
|
|
95
|
+
/** How long one call may take, in milliseconds. Left out, 30 seconds. */
|
|
96
|
+
timeoutMs?: number;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Fetches the set the server picks for a workflow type in each env named, in
|
|
100
|
+
* one request, and writes it to disk.
|
|
101
|
+
*
|
|
102
|
+
* Which histories are worth replaying is the server's call, not the caller's.
|
|
103
|
+
* What comes down is the engine's own history, verbatim, so a replayer reads
|
|
104
|
+
* it the way the engine wrote it.
|
|
105
|
+
*
|
|
106
|
+
* Nothing here runs a workflow. Replay belongs to the suite that owns the
|
|
107
|
+
* code, through its own SDK, and `publishVerdicts` takes the outcome back.
|
|
108
|
+
*/
|
|
109
|
+
export declare function fetchReplaySet(options: FetchOptions): Promise<ReplaySet>;
|
|
110
|
+
/** Reads a manifest a fetch left behind, the CLI's or this package's. */
|
|
111
|
+
export declare function readReplaySet(dir: string): Promise<ReplaySet>;
|
|
112
|
+
/** Histories in a directory, for a caller that wants them without the index. */
|
|
113
|
+
export declare function listHistoryFiles(dir: string): Promise<string[]>;
|
|
114
|
+
/**
|
|
115
|
+
* Reports what a replay found, against the history and the version replayed,
|
|
116
|
+
* so a break is attributed to a code change rather than to a failing test.
|
|
117
|
+
*/
|
|
118
|
+
export declare function publishVerdicts(options: PublishOptions): Promise<void>;
|
|
119
|
+
//# source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