@versori/run 0.6.0-alpha.1 → 0.6.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/esm/deps/jsr.io/@std/fmt/1.0.10/colors.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/fmt/{1.0.9 → 1.0.10}/colors.js +2 -2
- package/esm/deps/jsr.io/@std/log/0.224.14/console_handler.js +1 -1
- package/esm/src/connection/internal/CredentialHolder.js +1 -1
- package/esm/src/connection/internal/FetchBuilder.d.ts +2 -9
- package/esm/src/connection/internal/FetchBuilder.d.ts.map +1 -1
- package/esm/src/connection/internal/FetchBuilder.js +3 -124
- package/esm/src/context/Context.d.ts +0 -5
- package/esm/src/context/Context.d.ts.map +1 -1
- package/esm/src/context/Context.js +3 -6
- package/esm/src/context/VanillaContext.d.ts.map +1 -1
- package/esm/src/context/VanillaContext.js +3 -0
- package/esm/src/context/WorkflowClient.d.ts +1 -0
- package/esm/src/context/WorkflowClient.d.ts.map +1 -1
- package/esm/src/context/WorkflowClient.js +3 -0
- package/esm/src/dsl/Workflow.d.ts.map +1 -1
- package/esm/src/dsl/Workflow.js +0 -2
- package/esm/src/dsl/http/types.d.ts +0 -2
- package/esm/src/dsl/http/types.d.ts.map +1 -1
- package/esm/src/dsl/http/versori/configloader.d.ts.map +1 -1
- package/esm/src/dsl/http/versori/configloader.js +1 -1
- package/esm/src/dsl/http/versori/constants.d.ts +21 -0
- package/esm/src/dsl/http/versori/constants.d.ts.map +1 -0
- package/esm/src/dsl/http/versori/constants.js +38 -0
- package/esm/src/dsl/http/versori/cronapi.d.ts +3 -2
- package/esm/src/dsl/http/versori/cronapi.d.ts.map +1 -1
- package/esm/src/dsl/http/versori/cronapi.js +15 -14
- package/esm/src/dsl/http/versori/kvapi/core/OpenAPI.js +1 -1
- package/esm/src/dsl/triggers/WebhookTrigger.d.ts.map +1 -1
- package/esm/src/dsl/triggers/WebhookTrigger.js +1 -3
- package/esm/src/internal/constants.d.ts +0 -3
- package/esm/src/internal/constants.d.ts.map +1 -1
- package/esm/src/internal/constants.js +0 -3
- package/esm/src/interpreter/durable/DurableInterpreter.d.ts +2 -9
- package/esm/src/interpreter/durable/DurableInterpreter.d.ts.map +1 -1
- package/esm/src/interpreter/durable/DurableInterpreter.js +13 -57
- package/esm/src/interpreter/durable/ObservableCompiler.d.ts +1 -6
- package/esm/src/interpreter/durable/ObservableCompiler.d.ts.map +1 -1
- package/esm/src/interpreter/durable/Queue.d.ts +3 -0
- package/esm/src/interpreter/durable/Queue.d.ts.map +1 -1
- package/esm/src/interpreter/durable/Queue.js +1 -1
- package/esm/src/interpreter/durable/compilers/catch.d.ts.map +1 -1
- package/esm/src/interpreter/durable/compilers/catch.js +1 -3
- package/esm/src/interpreter/durable/compilers/durableworkflow.d.ts.map +1 -1
- package/esm/src/interpreter/durable/compilers/durableworkflow.js +21 -6
- package/esm/src/interpreter/durable/compilers/fn.d.ts.map +1 -1
- package/esm/src/interpreter/durable/compilers/fn.js +6 -29
- package/esm/src/interpreter/durable/compilers/http.d.ts.map +1 -1
- package/esm/src/interpreter/durable/compilers/http.js +11 -45
- package/esm/src/interpreter/durable/compilers/schedule.d.ts.map +1 -1
- package/esm/src/interpreter/durable/compilers/schedule.js +3 -4
- package/esm/src/interpreter/durable/compilers/webhook.d.ts.map +1 -1
- package/esm/src/interpreter/durable/compilers/webhook.js +0 -2
- package/esm/src/interpreter/memory/MemoryInterpreter.d.ts +1 -8
- package/esm/src/interpreter/memory/MemoryInterpreter.d.ts.map +1 -1
- package/esm/src/interpreter/memory/MemoryInterpreter.js +12 -56
- package/esm/src/interpreter/memory/ObservableCompiler.d.ts +1 -6
- package/esm/src/interpreter/memory/ObservableCompiler.d.ts.map +1 -1
- package/esm/src/interpreter/memory/compilers/catch.d.ts.map +1 -1
- package/esm/src/interpreter/memory/compilers/catch.js +0 -5
- package/esm/src/interpreter/memory/compilers/fn.d.ts.map +1 -1
- package/esm/src/interpreter/memory/compilers/fn.js +18 -29
- package/esm/src/interpreter/memory/compilers/http.d.ts.map +1 -1
- package/esm/src/interpreter/memory/compilers/http.js +10 -44
- package/esm/src/interpreter/memory/compilers/schedule.d.ts.map +1 -1
- package/esm/src/interpreter/memory/compilers/schedule.js +4 -61
- package/esm/src/interpreter/memory/compilers/webhook.d.ts.map +1 -1
- package/esm/src/interpreter/memory/compilers/webhook.js +3 -9
- package/esm/src/interpreter/vanilla/VanillaInterpreter.d.ts +0 -1
- package/esm/src/interpreter/vanilla/VanillaInterpreter.d.ts.map +1 -1
- package/esm/src/interpreter/vanilla/VanillaInterpreter.js +6 -30
- package/esm/src/interpreter/vanilla/compilers/durableworkflow.d.ts.map +1 -1
- package/esm/src/interpreter/vanilla/compilers/durableworkflow.js +12 -2
- package/esm/src/interpreter/vanilla/compilers/schedule.js +1 -1
- package/esm/src/issues/Issues.d.ts.map +1 -1
- package/esm/src/issues/Issues.js +1 -6
- package/esm/src/kv/KeyValue.d.ts +7 -3
- package/esm/src/kv/KeyValue.d.ts.map +1 -1
- package/esm/src/kv/fingerprintExternalUserId.d.ts +6 -0
- package/esm/src/kv/fingerprintExternalUserId.d.ts.map +1 -0
- package/esm/src/kv/fingerprintExternalUserId.js +20 -0
- package/esm/src/kv/memory/MemoryKeyValueProvider.d.ts +4 -0
- package/esm/src/kv/memory/MemoryKeyValueProvider.d.ts.map +1 -1
- package/esm/src/kv/memory/MemoryKeyValueProvider.js +50 -0
- package/esm/src/kv/nats/NatsKeyValueProvider.d.ts.map +1 -1
- package/esm/src/kv/nats/NatsKeyValueProvider.js +14 -0
- package/esm/src/kv/sdk/SDKKeyValueProvider.d.ts.map +1 -1
- package/esm/src/kv/sdk/SDKKeyValueProvider.js +12 -0
- package/esm/src/observability/logging/ConsoleLogger.d.ts.map +1 -1
- package/esm/src/observability/mod.d.ts +1 -0
- package/esm/src/observability/mod.d.ts.map +1 -1
- package/esm/src/observability/mod.js +1 -0
- package/esm/src/observability/tracePropagation.d.ts +23 -0
- package/esm/src/observability/tracePropagation.d.ts.map +1 -0
- package/esm/src/observability/tracePropagation.js +39 -0
- package/package.json +1 -3
- package/script/deps/jsr.io/@std/fmt/1.0.10/colors.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/fmt/{1.0.9 → 1.0.10}/colors.js +2 -2
- package/script/deps/jsr.io/@std/log/0.224.14/console_handler.js +1 -1
- package/script/src/connection/internal/CredentialHolder.js +1 -1
- package/script/src/connection/internal/FetchBuilder.d.ts +2 -9
- package/script/src/connection/internal/FetchBuilder.d.ts.map +1 -1
- package/script/src/connection/internal/FetchBuilder.js +3 -147
- package/script/src/context/Context.d.ts +0 -5
- package/script/src/context/Context.d.ts.map +1 -1
- package/script/src/context/Context.js +3 -6
- package/script/src/context/VanillaContext.d.ts.map +1 -1
- package/script/src/context/VanillaContext.js +3 -0
- package/script/src/context/WorkflowClient.d.ts +1 -0
- package/script/src/context/WorkflowClient.d.ts.map +1 -1
- package/script/src/context/WorkflowClient.js +3 -0
- package/script/src/dsl/Workflow.d.ts.map +1 -1
- package/script/src/dsl/Workflow.js +0 -2
- package/script/src/dsl/http/types.d.ts +0 -2
- package/script/src/dsl/http/types.d.ts.map +1 -1
- package/script/src/dsl/http/versori/configloader.d.ts.map +1 -1
- package/script/src/dsl/http/versori/configloader.js +1 -1
- package/script/src/dsl/http/versori/constants.d.ts +21 -0
- package/script/src/dsl/http/versori/constants.d.ts.map +1 -0
- package/script/src/dsl/http/versori/constants.js +41 -0
- package/script/src/dsl/http/versori/cronapi.d.ts +3 -2
- package/script/src/dsl/http/versori/cronapi.d.ts.map +1 -1
- package/script/src/dsl/http/versori/cronapi.js +15 -14
- package/script/src/dsl/http/versori/kvapi/core/OpenAPI.js +1 -1
- package/script/src/dsl/triggers/WebhookTrigger.d.ts.map +1 -1
- package/script/src/dsl/triggers/WebhookTrigger.js +1 -3
- package/script/src/internal/constants.d.ts +0 -3
- package/script/src/internal/constants.d.ts.map +1 -1
- package/script/src/internal/constants.js +1 -4
- package/script/src/interpreter/durable/DurableInterpreter.d.ts +2 -9
- package/script/src/interpreter/durable/DurableInterpreter.d.ts.map +1 -1
- package/script/src/interpreter/durable/DurableInterpreter.js +18 -62
- package/script/src/interpreter/durable/ObservableCompiler.d.ts +1 -6
- package/script/src/interpreter/durable/ObservableCompiler.d.ts.map +1 -1
- package/script/src/interpreter/durable/Queue.d.ts +3 -0
- package/script/src/interpreter/durable/Queue.d.ts.map +1 -1
- package/script/src/interpreter/durable/Queue.js +1 -1
- package/script/src/interpreter/durable/compilers/catch.d.ts.map +1 -1
- package/script/src/interpreter/durable/compilers/catch.js +1 -3
- package/script/src/interpreter/durable/compilers/durableworkflow.d.ts.map +1 -1
- package/script/src/interpreter/durable/compilers/durableworkflow.js +21 -6
- package/script/src/interpreter/durable/compilers/fn.d.ts.map +1 -1
- package/script/src/interpreter/durable/compilers/fn.js +5 -28
- package/script/src/interpreter/durable/compilers/http.d.ts.map +1 -1
- package/script/src/interpreter/durable/compilers/http.js +11 -45
- package/script/src/interpreter/durable/compilers/schedule.d.ts.map +1 -1
- package/script/src/interpreter/durable/compilers/schedule.js +3 -4
- package/script/src/interpreter/durable/compilers/webhook.d.ts.map +1 -1
- package/script/src/interpreter/durable/compilers/webhook.js +0 -2
- package/script/src/interpreter/memory/MemoryInterpreter.d.ts +1 -8
- package/script/src/interpreter/memory/MemoryInterpreter.d.ts.map +1 -1
- package/script/src/interpreter/memory/MemoryInterpreter.js +11 -55
- package/script/src/interpreter/memory/ObservableCompiler.d.ts +1 -6
- package/script/src/interpreter/memory/ObservableCompiler.d.ts.map +1 -1
- package/script/src/interpreter/memory/compilers/catch.d.ts.map +1 -1
- package/script/src/interpreter/memory/compilers/catch.js +0 -5
- package/script/src/interpreter/memory/compilers/fn.d.ts.map +1 -1
- package/script/src/interpreter/memory/compilers/fn.js +17 -28
- package/script/src/interpreter/memory/compilers/http.d.ts.map +1 -1
- package/script/src/interpreter/memory/compilers/http.js +10 -44
- package/script/src/interpreter/memory/compilers/schedule.d.ts.map +1 -1
- package/script/src/interpreter/memory/compilers/schedule.js +4 -61
- package/script/src/interpreter/memory/compilers/webhook.d.ts.map +1 -1
- package/script/src/interpreter/memory/compilers/webhook.js +3 -9
- package/script/src/interpreter/vanilla/VanillaInterpreter.d.ts +0 -1
- package/script/src/interpreter/vanilla/VanillaInterpreter.d.ts.map +1 -1
- package/script/src/interpreter/vanilla/VanillaInterpreter.js +6 -30
- package/script/src/interpreter/vanilla/compilers/durableworkflow.d.ts.map +1 -1
- package/script/src/interpreter/vanilla/compilers/durableworkflow.js +12 -2
- package/script/src/interpreter/vanilla/compilers/schedule.js +1 -1
- package/script/src/issues/Issues.d.ts.map +1 -1
- package/script/src/issues/Issues.js +1 -6
- package/script/src/kv/KeyValue.d.ts +7 -3
- package/script/src/kv/KeyValue.d.ts.map +1 -1
- package/script/src/kv/fingerprintExternalUserId.d.ts +6 -0
- package/script/src/kv/fingerprintExternalUserId.d.ts.map +1 -0
- package/script/src/kv/fingerprintExternalUserId.js +23 -0
- package/script/src/kv/memory/MemoryKeyValueProvider.d.ts +4 -0
- package/script/src/kv/memory/MemoryKeyValueProvider.d.ts.map +1 -1
- package/script/src/kv/memory/MemoryKeyValueProvider.js +50 -0
- package/script/src/kv/nats/NatsKeyValueProvider.d.ts.map +1 -1
- package/script/src/kv/nats/NatsKeyValueProvider.js +14 -0
- package/script/src/kv/sdk/SDKKeyValueProvider.d.ts.map +1 -1
- package/script/src/kv/sdk/SDKKeyValueProvider.js +12 -0
- package/script/src/observability/logging/ConsoleLogger.d.ts.map +1 -1
- package/script/src/observability/mod.d.ts +1 -0
- package/script/src/observability/mod.d.ts.map +1 -1
- package/script/src/observability/mod.js +1 -0
- package/script/src/observability/tracePropagation.d.ts +23 -0
- package/script/src/observability/tracePropagation.d.ts.map +1 -0
- package/script/src/observability/tracePropagation.js +46 -0
- package/esm/deps/jsr.io/@std/fmt/1.0.9/colors.d.ts.map +0 -1
- package/esm/src/internal/supervisor.d.ts +0 -23
- package/esm/src/internal/supervisor.d.ts.map +0 -1
- package/esm/src/internal/supervisor.js +0 -267
- package/script/deps/jsr.io/@std/fmt/1.0.9/colors.d.ts.map +0 -1
- package/script/src/internal/supervisor.d.ts +0 -23
- package/script/src/internal/supervisor.d.ts.map +0 -1
- package/script/src/internal/supervisor.js +0 -275
- /package/esm/deps/jsr.io/@std/fmt/{1.0.9 → 1.0.10}/colors.d.ts +0 -0
- /package/script/deps/jsr.io/@std/fmt/{1.0.9 → 1.0.10}/colors.d.ts +0 -0
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
import { KvOperationsService } from '../../dsl/http/versori/kvapi/services/KvOperationsService.js';
|
|
14
14
|
import { StoresService } from '../../dsl/http/versori/kvapi/services/StoresService.js';
|
|
15
|
+
import { fingerprintExternalUserId } from '../fingerprintExternalUserId.js';
|
|
15
16
|
import { isKVOptionsExecution } from '../isKVOptionsExecution.js';
|
|
16
17
|
import { SDKKeyValue } from './SDKKeyValue.js';
|
|
17
18
|
function getOptionsFromEnv() {
|
|
@@ -104,6 +105,10 @@ export class SDKKeyValueProvider {
|
|
|
104
105
|
return new SDKKeyValue(this.kvOrgScope, this.subjectPrefix(options));
|
|
105
106
|
case ':project:':
|
|
106
107
|
return new SDKKeyValue(this.kvProjectScope, this.subjectPrefix(options));
|
|
108
|
+
case ':workspace:':
|
|
109
|
+
return new SDKKeyValue(this.kvProjectScope, this.subjectPrefix(options));
|
|
110
|
+
case ':user:':
|
|
111
|
+
return new SDKKeyValue(this.kvProjectScope, this.subjectPrefix(options));
|
|
107
112
|
case ':execution:':
|
|
108
113
|
if (!isKVOptionsExecution(options)) {
|
|
109
114
|
throw new Error('invalid KV options, executionId is required for :execution: scope');
|
|
@@ -150,6 +155,13 @@ export class SDKKeyValueProvider {
|
|
|
150
155
|
return `${this.opts.organizationId}/${this.opts.projectId}/${this.opts.environment}${activationSuffix}`;
|
|
151
156
|
case ':execution:':
|
|
152
157
|
return `${this.opts.organizationId}/${this.opts.projectId}/${this.opts.environment}/${options.executionId}${activationSuffix}`;
|
|
158
|
+
case ':workspace:':
|
|
159
|
+
return `${this.opts.organizationId}/${this.opts.projectId}/${this.opts.environment}`;
|
|
160
|
+
case ':user:':
|
|
161
|
+
if (typeof options.externalUserId === 'undefined') {
|
|
162
|
+
throw new Error('externalUserId is required when scope is :user:');
|
|
163
|
+
}
|
|
164
|
+
return `${this.opts.organizationId}/${this.opts.projectId}/${this.opts.environment}/${fingerprintExternalUserId(options.externalUserId)}`;
|
|
153
165
|
}
|
|
154
166
|
}
|
|
155
167
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConsoleLogger.d.ts","sourceRoot":"","sources":["../../../../src/src/observability/logging/ConsoleLogger.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,GAAG,MAAM,+CAA+C,CAAC;AACrE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"ConsoleLogger.d.ts","sourceRoot":"","sources":["../../../../src/src/observability/logging/ConsoleLogger.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,GAAG,MAAM,+CAA+C,CAAC;AACrE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAmN/C;;;;;GAKG;AACH,qBAAa,aAAc,YAAW,MAAM;IACxC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC;IAEhB,KAAK,EAAE,QAAQ,CAAC;IAEhB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBAEpB,KAAK,GAAE,QAAqD,EAAE,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM;IAO9G,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAO9D,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAO7D,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAO7D,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAC3E,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAsB9D,KAAK,CAAC,MAAM,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,GAAG,aAAa;IAOvD,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI;CAIlC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../src/src/observability/mod.ts"],"names":[],"mappings":"AAaA;;;;;;GAMG;AAEH,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../src/src/observability/mod.ts"],"names":[],"mappings":"AAaA;;;;;;GAMG;AAEH,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Context } from '@opentelemetry/api';
|
|
2
|
+
/**
|
|
3
|
+
* Injects the current active OpenTelemetry trace context into the given carrier
|
|
4
|
+
* using the default W3C trace-context propagator. The returned object will
|
|
5
|
+
* contain `traceparent` (and optionally `tracestate`) keys that downstream
|
|
6
|
+
* consumers can use to continue the trace.
|
|
7
|
+
*/
|
|
8
|
+
export declare function injectTraceContext(into?: Record<string, any>): Record<string, any>;
|
|
9
|
+
/**
|
|
10
|
+
* Extracts an OpenTelemetry trace context from the given carrier (usually a
|
|
11
|
+
* workflow's metadata containing `traceparent`/`tracestate`). The returned
|
|
12
|
+
* Context can be passed as the parent context to
|
|
13
|
+
* `tracer.startActiveSpan(name, options, ctx, fn)` (or to
|
|
14
|
+
* `opentelemetry.context.with(...)`) so that subsequently created spans are
|
|
15
|
+
* children of the upstream trace.
|
|
16
|
+
*
|
|
17
|
+
* If the carrier has no `traceparent`, the current active context is returned
|
|
18
|
+
* unchanged - `startActiveSpan` will then create a new root span / new trace,
|
|
19
|
+
* which is exactly the behaviour we want for workflows submitted without any
|
|
20
|
+
* upstream trace (e.g. scheduler-triggered submissions).
|
|
21
|
+
*/
|
|
22
|
+
export declare function extractTraceContext(from: Record<string, any> | undefined): Context;
|
|
23
|
+
//# sourceMappingURL=tracePropagation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tracePropagation.d.ts","sourceRoot":"","sources":["../../../src/src/observability/tracePropagation.ts"],"names":[],"mappings":"AAaA,OAAsB,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE5D;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAC9B,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,GAC/B,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAGrB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAC/B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,GACtC,OAAO,CAKT"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 Versori Group Inc
|
|
3
|
+
*
|
|
4
|
+
* Use of this software is governed by the Business Source License 1.1
|
|
5
|
+
* included in the LICENSE file at the root of this repository.
|
|
6
|
+
*
|
|
7
|
+
* Change Date: 2029-01-01
|
|
8
|
+
* Change License: Apache License, Version 2.0
|
|
9
|
+
*
|
|
10
|
+
* As of the Change Date, in accordance with the Business Source License,
|
|
11
|
+
* use of this software will be governed by the Apache License, Version 2.0.
|
|
12
|
+
*/
|
|
13
|
+
import opentelemetry from '@opentelemetry/api';
|
|
14
|
+
/**
|
|
15
|
+
* Injects the current active OpenTelemetry trace context into the given carrier
|
|
16
|
+
* using the default W3C trace-context propagator. The returned object will
|
|
17
|
+
* contain `traceparent` (and optionally `tracestate`) keys that downstream
|
|
18
|
+
* consumers can use to continue the trace.
|
|
19
|
+
*/
|
|
20
|
+
export function injectTraceContext(into = {}) {
|
|
21
|
+
opentelemetry.propagation.inject(opentelemetry.context.active(), into);
|
|
22
|
+
return into;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Extracts an OpenTelemetry trace context from the given carrier (usually a
|
|
26
|
+
* workflow's metadata containing `traceparent`/`tracestate`). The returned
|
|
27
|
+
* Context can be passed as the parent context to
|
|
28
|
+
* `tracer.startActiveSpan(name, options, ctx, fn)` (or to
|
|
29
|
+
* `opentelemetry.context.with(...)`) so that subsequently created spans are
|
|
30
|
+
* children of the upstream trace.
|
|
31
|
+
*
|
|
32
|
+
* If the carrier has no `traceparent`, the current active context is returned
|
|
33
|
+
* unchanged - `startActiveSpan` will then create a new root span / new trace,
|
|
34
|
+
* which is exactly the behaviour we want for workflows submitted without any
|
|
35
|
+
* upstream trace (e.g. scheduler-triggered submissions).
|
|
36
|
+
*/
|
|
37
|
+
export function extractTraceContext(from) {
|
|
38
|
+
return opentelemetry.propagation.extract(opentelemetry.context.active(), from ?? {});
|
|
39
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@versori/run",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "Versori Run",
|
|
5
5
|
"homepage": "https://github.com/versori/versori-run#readme",
|
|
6
6
|
"repository": {
|
|
@@ -27,11 +27,9 @@
|
|
|
27
27
|
"@connectrpc/connect": "^2.0.4",
|
|
28
28
|
"@connectrpc/connect-node": "^2.0.4",
|
|
29
29
|
"@opentelemetry/api": "^1.9.0",
|
|
30
|
-
"@opentelemetry/core": "^2.1.0",
|
|
31
30
|
"@opentelemetry/exporter-trace-otlp-proto": "^0.200.0",
|
|
32
31
|
"@opentelemetry/resources": "^2.0.0",
|
|
33
32
|
"@opentelemetry/sdk-node": "^0.200.0",
|
|
34
|
-
"@opentelemetry/sdk-trace-node": "^2.0.0",
|
|
35
33
|
"cors": "^2.8.5",
|
|
36
34
|
"express": "^4.21.2",
|
|
37
35
|
"express-xml-bodyparser": "^0.3.0",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/fmt/1.0.10/colors.ts"],"names":[],"mappings":"AAoEA,qEAAqE;AACrE,MAAM,WAAW,GAAG;IAClB,0BAA0B;IAC1B,CAAC,EAAE,MAAM,CAAC;IACV,4BAA4B;IAC5B,CAAC,EAAE,MAAM,CAAC;IACV,2BAA2B;IAC3B,CAAC,EAAE,MAAM,CAAC;CACX;AAID;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,QAM7C;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,IAAI,OAAO,CAEzC;AA0BD;;;;;;;;;;;;GAYG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEzC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAExC;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEvC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE1C;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,C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|
@@ -954,7 +954,7 @@ function bgRgb24(str, color) {
|
|
|
954
954
|
], 49));
|
|
955
955
|
}
|
|
956
956
|
// https://github.com/chalk/ansi-regex/blob/02fa893d619d3da85411acc8fd4e2eea0e95a9d9/index.js
|
|
957
|
-
const
|
|
957
|
+
const ANSI_REGEXP = new RegExp([
|
|
958
958
|
"[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
|
|
959
959
|
"(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TXZcf-nq-uy=><~]))",
|
|
960
960
|
].join("|"), "g");
|
|
@@ -972,5 +972,5 @@ const ANSI_PATTERN = new RegExp([
|
|
|
972
972
|
* @returns The text without ANSI escape codes
|
|
973
973
|
*/
|
|
974
974
|
function stripAnsiCode(string) {
|
|
975
|
-
return string.replace(
|
|
975
|
+
return string.replace(ANSI_REGEXP, "");
|
|
976
976
|
}
|
|
@@ -16,7 +16,7 @@ exports.ConsoleHandler = void 0;
|
|
|
16
16
|
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
17
17
|
// This module is browser compatible.
|
|
18
18
|
const levels_js_1 = require("./levels.js");
|
|
19
|
-
const colors_js_1 = require("../../fmt/1.0.
|
|
19
|
+
const colors_js_1 = require("../../fmt/1.0.10/colors.js");
|
|
20
20
|
const base_handler_js_1 = require("./base_handler.js");
|
|
21
21
|
function applyColors(msg, level) {
|
|
22
22
|
switch (level) {
|
|
@@ -47,7 +47,7 @@ class CredentialHolder {
|
|
|
47
47
|
this.refresh();
|
|
48
48
|
return __classPrivateFieldGet(this, _CredentialHolder_value, "f");
|
|
49
49
|
}
|
|
50
|
-
// if this.refresh returns a rejected promise we are stuck with it until a restart.
|
|
50
|
+
// if this.refresh returns a rejected promise we are stuck with it until a restart.
|
|
51
51
|
// the try/catch bellow just keeps on trying to refresh the token if this.#value is rejected.
|
|
52
52
|
//
|
|
53
53
|
// We might have to change this because if credentials has an issue we might just make that issue worse by pamming more requests
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { FetchLike, OutboundMiddleware } from '../types.js';
|
|
2
|
-
|
|
3
|
-
name: string;
|
|
4
|
-
id?: string;
|
|
5
|
-
baseUrl?: string;
|
|
6
|
-
};
|
|
2
|
+
import { Connection } from '../../services/platform/mod.js';
|
|
7
3
|
/**
|
|
8
4
|
* FetchBuilder is used to build a fetch function which can be composed by multiple middlewares for
|
|
9
5
|
* modifying the request/response and makes the implementation of {@link ConnectionFetchFactory}
|
|
@@ -12,11 +8,8 @@ export type FetchConnection = {
|
|
|
12
8
|
export declare class FetchBuilder {
|
|
13
9
|
#private;
|
|
14
10
|
middlewares: OutboundMiddleware[];
|
|
15
|
-
constructor(fetch: FetchLike, cnx:
|
|
11
|
+
constructor(fetch: FetchLike, cnx: Connection);
|
|
16
12
|
use(fn: OutboundMiddleware): void;
|
|
17
13
|
build(): FetchLike;
|
|
18
|
-
buildSupervisedFetch(): FetchLike;
|
|
19
|
-
private supervisedFetch;
|
|
20
|
-
private wrapWithTracing;
|
|
21
14
|
}
|
|
22
15
|
//# sourceMappingURL=FetchBuilder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FetchBuilder.d.ts","sourceRoot":"","sources":["../../../../src/src/connection/internal/FetchBuilder.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FetchBuilder.d.ts","sourceRoot":"","sources":["../../../../src/src/connection/internal/FetchBuilder.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAG5D;;;;GAIG;AACH,qBAAa,YAAY;;IACrB,WAAW,EAAE,kBAAkB,EAAE,CAAC;gBAKtB,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,UAAU;IAM7C,GAAG,CAAC,EAAE,EAAE,kBAAkB;IAI1B,KAAK,IAAI,SAAS;CAWrB"}
|
|
@@ -11,29 +11,6 @@
|
|
|
11
11
|
* As of the Change Date, in accordance with the Business Source License,
|
|
12
12
|
* use of this software will be governed by the Apache License, Version 2.0.
|
|
13
13
|
*/
|
|
14
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
15
|
-
if (k2 === undefined) k2 = k;
|
|
16
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
17
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
18
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
19
|
-
}
|
|
20
|
-
Object.defineProperty(o, k2, desc);
|
|
21
|
-
}) : (function(o, m, k, k2) {
|
|
22
|
-
if (k2 === undefined) k2 = k;
|
|
23
|
-
o[k2] = m[k];
|
|
24
|
-
}));
|
|
25
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
26
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
27
|
-
}) : function(o, v) {
|
|
28
|
-
o["default"] = v;
|
|
29
|
-
});
|
|
30
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
31
|
-
if (mod && mod.__esModule) return mod;
|
|
32
|
-
var result = {};
|
|
33
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
34
|
-
__setModuleDefault(result, mod);
|
|
35
|
-
return result;
|
|
36
|
-
};
|
|
37
14
|
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
38
15
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
39
16
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
@@ -45,12 +22,10 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
45
22
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
46
23
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
47
24
|
};
|
|
48
|
-
var _FetchBuilder_base, _FetchBuilder_cnx
|
|
25
|
+
var _FetchBuilder_base, _FetchBuilder_cnx;
|
|
49
26
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
27
|
exports.FetchBuilder = void 0;
|
|
51
|
-
const api_1 = __importStar(require("@opentelemetry/api"));
|
|
52
28
|
const helpers_js_1 = require("../../dsl/http/versori/helpers.js");
|
|
53
|
-
const supervisor_js_1 = require("../../internal/supervisor.js");
|
|
54
29
|
/**
|
|
55
30
|
* FetchBuilder is used to build a fetch function which can be composed by multiple middlewares for
|
|
56
31
|
* modifying the request/response and makes the implementation of {@link ConnectionFetchFactory}
|
|
@@ -66,18 +41,9 @@ class FetchBuilder {
|
|
|
66
41
|
});
|
|
67
42
|
_FetchBuilder_base.set(this, void 0);
|
|
68
43
|
_FetchBuilder_cnx.set(this, void 0);
|
|
69
|
-
_FetchBuilder_tracer.set(this, void 0);
|
|
70
44
|
__classPrivateFieldSet(this, _FetchBuilder_base, fetch, "f");
|
|
71
45
|
__classPrivateFieldSet(this, _FetchBuilder_cnx, cnx, "f");
|
|
72
|
-
|
|
73
|
-
const traceMiddleware = this.wrapWithTracing.bind(this);
|
|
74
|
-
if (cnx.baseUrl) {
|
|
75
|
-
this.middlewares = [changeRequestbaseURLMiddleware(cnx), traceMiddleware];
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
78
|
-
this.middlewares = [traceMiddleware];
|
|
79
|
-
}
|
|
80
|
-
this.supervisedFetch = this.supervisedFetch.bind(this);
|
|
46
|
+
this.middlewares = [changeRequestbaseURLMiddleware(cnx)];
|
|
81
47
|
}
|
|
82
48
|
use(fn) {
|
|
83
49
|
this.middlewares.push(fn);
|
|
@@ -91,102 +57,9 @@ class FetchBuilder {
|
|
|
91
57
|
}
|
|
92
58
|
return fetch;
|
|
93
59
|
}
|
|
94
|
-
buildSupervisedFetch() {
|
|
95
|
-
return this.supervisedFetch();
|
|
96
|
-
}
|
|
97
|
-
// during testing the user can choose to use a real connection or AI mock.
|
|
98
|
-
// so in supervised mode this function is used instead of the normal build() function.
|
|
99
|
-
// and it will make the decision on using mock or real at runtime at the cost of performance
|
|
100
|
-
supervisedFetch() {
|
|
101
|
-
return (input, init) => {
|
|
102
|
-
let fetch = (input, init) => {
|
|
103
|
-
return (0, supervisor_js_1.mockAPIRequest)(input, __classPrivateFieldGet(this, _FetchBuilder_cnx, "f"), init);
|
|
104
|
-
};
|
|
105
|
-
for (let i = this.middlewares.length - 1; i >= 0; i--) {
|
|
106
|
-
// apply middlewares in reverse order so that the actual middleware executes in the
|
|
107
|
-
// order they were added
|
|
108
|
-
fetch = this.middlewares[i](fetch);
|
|
109
|
-
}
|
|
110
|
-
return fetch(input, init);
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
wrapWithTracing(fetch) {
|
|
114
|
-
const connectionId = __classPrivateFieldGet(this, _FetchBuilder_cnx, "f")?.id || '';
|
|
115
|
-
const connectionName = __classPrivateFieldGet(this, _FetchBuilder_cnx, "f")?.name || '';
|
|
116
|
-
return (input, init) => {
|
|
117
|
-
const url = getUrl(input);
|
|
118
|
-
return __classPrivateFieldGet(this, _FetchBuilder_tracer, "f").startActiveSpan(`fetch ${connectionName}/${connectionId}`, async (span) => {
|
|
119
|
-
// Set span attributes
|
|
120
|
-
span.setAttribute('http.url', url);
|
|
121
|
-
span.setAttribute('type', 'fetch');
|
|
122
|
-
span.setAttribute('connection.id', connectionId);
|
|
123
|
-
span.setAttribute('connection.name', connectionName);
|
|
124
|
-
span.setAttribute('isConnected', connectionId !== '');
|
|
125
|
-
try {
|
|
126
|
-
const response = await fetch(input, init);
|
|
127
|
-
if (supervisor_js_1.enabled) {
|
|
128
|
-
if (init?.method) {
|
|
129
|
-
span.setAttribute('http.method', init.method);
|
|
130
|
-
}
|
|
131
|
-
else {
|
|
132
|
-
span.setAttribute('http.method', 'GET');
|
|
133
|
-
}
|
|
134
|
-
// when we are in supervisor mode, we need to store the response body in the span attribute
|
|
135
|
-
// this will be shown the end-user in some UI in the future(the future is now)
|
|
136
|
-
const body = await response.clone().arrayBuffer();
|
|
137
|
-
// if response is text/* or json we store the body as a string, otherwise we store it as a base64 string
|
|
138
|
-
const contentType = response.headers.get('Content-Type');
|
|
139
|
-
span.setAttribute('response.content_type', contentType || '');
|
|
140
|
-
span.setAttribute('request.headers', JSON.stringify(init?.headers || {}));
|
|
141
|
-
if (contentType &&
|
|
142
|
-
(contentType.startsWith('text/') ||
|
|
143
|
-
contentType.startsWith('application/json'))) {
|
|
144
|
-
span.setAttribute('response.body', new TextDecoder().decode(body));
|
|
145
|
-
}
|
|
146
|
-
else {
|
|
147
|
-
span.setAttribute('response.body', btoa(String.fromCharCode(...new Uint8Array(body))));
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
// Record response status
|
|
151
|
-
span.setAttribute('http.status_code', response.status);
|
|
152
|
-
if (response.status >= 400) {
|
|
153
|
-
span.setStatus({
|
|
154
|
-
code: api_1.SpanStatusCode.ERROR,
|
|
155
|
-
message: `HTTP ${response.status}`,
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
else {
|
|
159
|
-
span.setStatus({ code: api_1.SpanStatusCode.OK });
|
|
160
|
-
}
|
|
161
|
-
return response;
|
|
162
|
-
}
|
|
163
|
-
catch (error) {
|
|
164
|
-
// Record exception
|
|
165
|
-
if (error instanceof Error) {
|
|
166
|
-
span.recordException(error);
|
|
167
|
-
span.setStatus({
|
|
168
|
-
code: api_1.SpanStatusCode.ERROR,
|
|
169
|
-
message: error.message,
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
else {
|
|
173
|
-
span.recordException(new Error(String(error)));
|
|
174
|
-
span.setStatus({
|
|
175
|
-
code: api_1.SpanStatusCode.ERROR,
|
|
176
|
-
message: String(error),
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
throw error;
|
|
180
|
-
}
|
|
181
|
-
finally {
|
|
182
|
-
span.end();
|
|
183
|
-
}
|
|
184
|
-
});
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
60
|
}
|
|
188
61
|
exports.FetchBuilder = FetchBuilder;
|
|
189
|
-
_FetchBuilder_base = new WeakMap(), _FetchBuilder_cnx = new WeakMap()
|
|
62
|
+
_FetchBuilder_base = new WeakMap(), _FetchBuilder_cnx = new WeakMap();
|
|
190
63
|
function changeBaseUrl(pathname, conn) {
|
|
191
64
|
const connBaseURL = conn.baseUrl;
|
|
192
65
|
// if the connection has no baseUrl set, but the pathname is a valid URL, return it as is
|
|
@@ -230,20 +103,3 @@ function changeRequestbaseURLMiddleware(conn) {
|
|
|
230
103
|
};
|
|
231
104
|
};
|
|
232
105
|
}
|
|
233
|
-
function getUrl(input) {
|
|
234
|
-
// Extract URL for span naming
|
|
235
|
-
let url;
|
|
236
|
-
if (typeof input === 'string') {
|
|
237
|
-
url = input;
|
|
238
|
-
}
|
|
239
|
-
else if (input instanceof URL) {
|
|
240
|
-
url = input.toString();
|
|
241
|
-
}
|
|
242
|
-
else if (input instanceof Request) {
|
|
243
|
-
url = input.url;
|
|
244
|
-
}
|
|
245
|
-
else {
|
|
246
|
-
url = 'unknown';
|
|
247
|
-
}
|
|
248
|
-
return url;
|
|
249
|
-
}
|
|
@@ -12,8 +12,6 @@ export type OnSuccessFn = (ctx: Context<any>) => void;
|
|
|
12
12
|
export type OnErrorFn = (ctx: Context<any>) => void;
|
|
13
13
|
export type ContextOptions = {
|
|
14
14
|
workflow?: Workflow;
|
|
15
|
-
/** DSL trigger id (webhook, schedule, etc.) for tracing; distinct from queued {@link Workflow}. */
|
|
16
|
-
workflowId?: string;
|
|
17
15
|
request?: express.Request;
|
|
18
16
|
onSuccess?: OnSuccessFn;
|
|
19
17
|
onError?: OnErrorFn;
|
|
@@ -55,7 +53,6 @@ export interface Context<D> {
|
|
|
55
53
|
readonly data: D;
|
|
56
54
|
activation: ActivationInterface;
|
|
57
55
|
workflow?: Workflow;
|
|
58
|
-
workflowId?: string;
|
|
59
56
|
/**
|
|
60
57
|
* Opens a key value store for the given scope, defaulting to ':project:' if not provided.
|
|
61
58
|
* @param scope The scope of the key value store to open, defaulting to ':project:' if not provided.
|
|
@@ -111,10 +108,8 @@ export declare class ContextImpl<D, Index = void> implements Context<D> {
|
|
|
111
108
|
constructor(log: Logger, kvp: KeyValueProvider, creds: CredentialsProvider, executionId: string, startTime: Date, data: D, activation: ActivationImpl, issues: IssueAPI, queue?: QueueAPI, options?: ContextOptions);
|
|
112
109
|
get activation(): ActivationImpl;
|
|
113
110
|
get workflow(): Workflow | undefined;
|
|
114
|
-
get workflowId(): string | undefined;
|
|
115
111
|
setIndex(idx: number): ContextImpl<D, number>;
|
|
116
112
|
withData<D2>(data: D2, optionsPatch?: Partial<ContextOptions>): ContextImpl<D2, Index>;
|
|
117
|
-
withLogger(log: Logger): ContextImpl<D, Index>;
|
|
118
113
|
openKv(scope?: KeyValueScope): KeyValue;
|
|
119
114
|
request(): express.Request | undefined;
|
|
120
115
|
workflowClient(): WorkflowInterface;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../../src/src/context/Context.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,KAAK,OAAO,MAAM,SAAS,CAAC;AAExC,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,aAAa,EAAE,M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EAAE,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC;IAkCtE,WAAW,CAAC,KAAK,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,OAAO,CAAC;QAAC,cAAc,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;IAYpH,WAAW,IAAI,mBAAmB;IAUlC,OAAO,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAe5C,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAQlD"}
|
|
@@ -28,6 +28,7 @@ exports.ContextImpl = void 0;
|
|
|
28
28
|
const node_buffer_1 = require("node:buffer");
|
|
29
29
|
const AsyncWorkflow_js_1 = require("./AsyncWorkflow.js");
|
|
30
30
|
const WorkflowClient_js_1 = require("./WorkflowClient.js");
|
|
31
|
+
const tracePropagation_js_1 = require("../observability/tracePropagation.js");
|
|
31
32
|
class ContextImpl {
|
|
32
33
|
constructor(log, kvp, creds, executionId, startTime, data, activation, issues, queue, options = {}) {
|
|
33
34
|
Object.defineProperty(this, "log", {
|
|
@@ -109,9 +110,6 @@ class ContextImpl {
|
|
|
109
110
|
get workflow() {
|
|
110
111
|
return this.options.workflow;
|
|
111
112
|
}
|
|
112
|
-
get workflowId() {
|
|
113
|
-
return this.options.workflowId ?? this.workflow?.id;
|
|
114
|
-
}
|
|
115
113
|
setIndex(idx) {
|
|
116
114
|
const next = new ContextImpl(this.log, this.kvp, __classPrivateFieldGet(this, _ContextImpl_creds, "f"), this.executionId, this.startTime, this.data, __classPrivateFieldGet(this, _ContextImpl_activation, "f"), __classPrivateFieldGet(this, _ContextImpl_issues, "f"), this.queue, this.options);
|
|
117
115
|
next.idx = idx;
|
|
@@ -123,9 +121,6 @@ class ContextImpl {
|
|
|
123
121
|
: this.options;
|
|
124
122
|
return new ContextImpl(this.log, this.kvp, __classPrivateFieldGet(this, _ContextImpl_creds, "f"), this.executionId, this.startTime, data, __classPrivateFieldGet(this, _ContextImpl_activation, "f"), __classPrivateFieldGet(this, _ContextImpl_issues, "f"), this.queue, nextOptions);
|
|
125
123
|
}
|
|
126
|
-
withLogger(log) {
|
|
127
|
-
return new ContextImpl(log, this.kvp, __classPrivateFieldGet(this, _ContextImpl_creds, "f"), this.executionId, this.startTime, this.data, __classPrivateFieldGet(this, _ContextImpl_activation, "f"), __classPrivateFieldGet(this, _ContextImpl_issues, "f"), this.queue, this.options);
|
|
128
|
-
}
|
|
129
124
|
openKv(scope = ':project:') {
|
|
130
125
|
if (scope === ':execution:') {
|
|
131
126
|
return this.kvp.kv({
|
|
@@ -137,6 +132,7 @@ class ContextImpl {
|
|
|
137
132
|
return this.kvp.kv({
|
|
138
133
|
scope,
|
|
139
134
|
activationId: this.activation?.id,
|
|
135
|
+
externalUserId: this.activation?.user?.externalId,
|
|
140
136
|
});
|
|
141
137
|
}
|
|
142
138
|
request() {
|
|
@@ -169,6 +165,7 @@ class ContextImpl {
|
|
|
169
165
|
executionId: this.executionId,
|
|
170
166
|
activationId: this.activation?.id,
|
|
171
167
|
userId: this.activation?.user?.externalId,
|
|
168
|
+
...(0, tracePropagation_js_1.injectTraceContext)(),
|
|
172
169
|
},
|
|
173
170
|
payload: payload ?? btoa("{}"),
|
|
174
171
|
maxAttempts: opts.maxAttempts,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VanillaContext.d.ts","sourceRoot":"","sources":["../../../src/src/context/VanillaContext.ts"],"names":[],"mappings":"AAcA,OAAO,EACH,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,OAAO,EACP,kBAAkB,EACrB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,KAAK,OAAO,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,QAAQ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EAAE,MAAM,EACX,GAAG,EAAE,gBAAgB,EACJ,cAAc,EAAE,MAAM,EACtB,aAAa,EAAE,MAAM,EACtC,MAAM,EAAE,QAAQ,EAChB,KAAK,GAAE,QAAQ,GAAG,SAAqB;IAQ3C,MAAM,CAAC,CAAC,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,GAAE,cAAmB,GAAG,cAAc,CAAC,CAAC,CAAC;IA6B3F,qBAAqB,CAAC,CAAC,EACnB,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,CAAC,EACP,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,cAAmB,GAC7B,cAAc,CAAC,CAAC,CAAC;IA2BpB,OAAO,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAG1C"}
|
|
@@ -28,6 +28,7 @@ exports.VanillaContextProvider = exports.VanillaContext = exports.VanillaActivat
|
|
|
28
28
|
const ulid_js_1 = require("../../deps/jsr.io/@std/ulid/1.0.0/ulid.js");
|
|
29
29
|
const AsyncWorkflow_js_1 = require("./AsyncWorkflow.js");
|
|
30
30
|
const WorkflowClient_js_1 = require("./WorkflowClient.js");
|
|
31
|
+
const tracePropagation_js_1 = require("../observability/tracePropagation.js");
|
|
31
32
|
class VanillaActivation {
|
|
32
33
|
constructor(activation, organisationId, environmentId, log) {
|
|
33
34
|
Object.defineProperty(this, "activation", {
|
|
@@ -182,6 +183,7 @@ class VanillaContext {
|
|
|
182
183
|
return this.kvp.kv({
|
|
183
184
|
scope,
|
|
184
185
|
activationId: this.activation?.id,
|
|
186
|
+
externalUserId: this.activation?.user?.externalId,
|
|
185
187
|
});
|
|
186
188
|
}
|
|
187
189
|
request() {
|
|
@@ -214,6 +216,7 @@ class VanillaContext {
|
|
|
214
216
|
executionId: this.executionId,
|
|
215
217
|
activationId: this.activation?.id,
|
|
216
218
|
userId: this.activation?.user?.externalId,
|
|
219
|
+
...(0, tracePropagation_js_1.injectTraceContext)(),
|
|
217
220
|
},
|
|
218
221
|
payload: payload ?? btoa('{}'),
|
|
219
222
|
maxAttempts: opts.maxAttempts,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkflowClient.d.ts","sourceRoot":"","sources":["../../../src/src/context/WorkflowClient.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"WorkflowClient.d.ts","sourceRoot":"","sources":["../../../src/src/context/WorkflowClient.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAS3D,MAAM,MAAM,YAAY,GAAG;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,WAAW,iBAAiB;IAC9B,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IACpE,WAAW,CAAC,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC9C,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC/C,iBAAiB,CAAC,EAAE,EAAE,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IACnD,kBAAkB,CAAC,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/D,gBAAgB,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,GAAG,QAAQ,EAAE,MAAM,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/F;AAED,qBAAa,YAAa,YAAW,iBAAiB;IAClD,OAAO,CAAC,KAAK,CAAW;IACxB,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,UAAU,CAAsB;IACxC,OAAO,CAAC,eAAe,CAAuB;gBAElC,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,mBAAmB,EAAE,eAAe,EAAE,QAAQ,GAAG,SAAS;IAelH,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,QAAQ,CAAC;IAmCnE,WAAW,CAAC,EAAE,EAAE,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IAgB5C,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IAgB9C,iBAAiB,CAAC,EAAE,EAAE,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IAqBlD,kBAAkB,CAAC,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAsC9D,gBAAgB,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,GAAG,QAAQ,EAAE,MAAM,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;CAwBpG"}
|
|
@@ -18,6 +18,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
18
18
|
exports.WorkflowImpl = void 0;
|
|
19
19
|
const node_buffer_1 = require("node:buffer");
|
|
20
20
|
const api_1 = __importDefault(require("@opentelemetry/api"));
|
|
21
|
+
const tracePropagation_js_1 = require("../observability/tracePropagation.js");
|
|
21
22
|
const tracer = api_1.default.trace.getTracer('versori-run-workflow-client');
|
|
22
23
|
class WorkflowImpl {
|
|
23
24
|
constructor(queue, executionId, activation, currentWorkflow) {
|
|
@@ -72,9 +73,11 @@ class WorkflowImpl {
|
|
|
72
73
|
activationId: this.activation?.id,
|
|
73
74
|
userId: this.activation?.user?.externalId,
|
|
74
75
|
parentWorkflowId: this.currentWorkflow?.id ?? undefined,
|
|
76
|
+
...(0, tracePropagation_js_1.injectTraceContext)(),
|
|
75
77
|
},
|
|
76
78
|
payload: opts.data ? node_buffer_1.Buffer.from(JSON.stringify(opts.data)).toString('base64') : node_buffer_1.Buffer.from("{}").toString('base64'),
|
|
77
79
|
maxAttempts: opts.maxAttempts,
|
|
80
|
+
after: opts.after ?? undefined,
|
|
78
81
|
},
|
|
79
82
|
],
|
|
80
83
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Workflow.d.ts","sourceRoot":"","sources":["../../../src/src/dsl/Workflow.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC;;;;;;GAMG;AACH,MAAM,WAAW,QAAQ,CAAC,CAAC;IACvB;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IAE9C;;;;;;;;;OASG;IACH,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,GAAG,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;CACvC;
|
|
1
|
+
{"version":3,"file":"Workflow.d.ts","sourceRoot":"","sources":["../../../src/src/dsl/Workflow.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC;;;;;;GAMG;AACH,MAAM,WAAW,QAAQ,CAAC,CAAC;IACvB;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IAE9C;;;;;;;;;OASG;IACH,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,GAAG,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;CACvC;AAED,qBAAa,YAAY,CAAC,CAAC,EAAE,CAAC,CAAE,YAAW,QAAQ,CAAC,CAAC,CAAC;IAClD,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IACpB,IAAI,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;gBAEL,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC;IAKjD,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC;IAI7C,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,GAAG,GAAG,QAAQ,CAAC,EAAE,CAAC;CAGtC"}
|
|
@@ -105,13 +105,11 @@ export type StaticCnxMap = {
|
|
|
105
105
|
name: string;
|
|
106
106
|
dynamic: false;
|
|
107
107
|
connId: string;
|
|
108
|
-
mockWithAI: boolean;
|
|
109
108
|
};
|
|
110
109
|
export type DynamicCnxMap = {
|
|
111
110
|
name: string;
|
|
112
111
|
dynamic: true;
|
|
113
112
|
templateId: string;
|
|
114
|
-
mockWithAI: boolean;
|
|
115
113
|
};
|
|
116
114
|
export type CnxMap = StaticCnxMap | DynamicCnxMap;
|
|
117
115
|
export type VersoriSDKConfig = {
|