@versori/run 0.5.10 → 0.7.0-alpha.10
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 +9 -2
- package/esm/src/connection/internal/FetchBuilder.d.ts.map +1 -1
- package/esm/src/connection/internal/FetchBuilder.js +124 -3
- package/esm/src/context/Context.d.ts +5 -0
- package/esm/src/context/Context.d.ts.map +1 -1
- package/esm/src/context/Context.js +6 -0
- package/esm/src/dsl/Workflow.d.ts.map +1 -1
- package/esm/src/dsl/Workflow.js +2 -0
- package/esm/src/dsl/http/types.d.ts +2 -0
- 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/cronapi.d.ts +2 -3
- package/esm/src/dsl/http/versori/cronapi.d.ts.map +1 -1
- package/esm/src/dsl/http/versori/cronapi.js +14 -15
- 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 +3 -1
- package/esm/src/internal/constants.d.ts +3 -0
- package/esm/src/internal/constants.d.ts.map +1 -1
- package/esm/src/internal/constants.js +3 -0
- package/esm/src/internal/supervisor.d.ts +23 -0
- package/esm/src/internal/supervisor.d.ts.map +1 -0
- package/esm/src/internal/supervisor.js +267 -0
- package/esm/src/interpreter/durable/DurableInterpreter.d.ts +10 -3
- package/esm/src/interpreter/durable/DurableInterpreter.d.ts.map +1 -1
- package/esm/src/interpreter/durable/DurableInterpreter.js +65 -13
- package/esm/src/interpreter/durable/ObservableCompiler.d.ts +6 -1
- package/esm/src/interpreter/durable/ObservableCompiler.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 +3 -1
- package/esm/src/interpreter/durable/compilers/fn.d.ts.map +1 -1
- package/esm/src/interpreter/durable/compilers/fn.js +29 -6
- package/esm/src/interpreter/durable/compilers/http.d.ts.map +1 -1
- package/esm/src/interpreter/durable/compilers/http.js +45 -11
- package/esm/src/interpreter/durable/compilers/schedule.d.ts.map +1 -1
- package/esm/src/interpreter/durable/compilers/schedule.js +4 -3
- package/esm/src/interpreter/durable/compilers/webhook.d.ts.map +1 -1
- package/esm/src/interpreter/durable/compilers/webhook.js +2 -0
- package/esm/src/interpreter/memory/MemoryInterpreter.d.ts +8 -1
- package/esm/src/interpreter/memory/MemoryInterpreter.d.ts.map +1 -1
- package/esm/src/interpreter/memory/MemoryInterpreter.js +56 -12
- package/esm/src/interpreter/memory/ObservableCompiler.d.ts +6 -1
- 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 +5 -0
- package/esm/src/interpreter/memory/compilers/fn.d.ts.map +1 -1
- package/esm/src/interpreter/memory/compilers/fn.js +29 -18
- package/esm/src/interpreter/memory/compilers/http.d.ts.map +1 -1
- package/esm/src/interpreter/memory/compilers/http.js +44 -10
- package/esm/src/interpreter/memory/compilers/schedule.d.ts.map +1 -1
- package/esm/src/interpreter/memory/compilers/schedule.js +61 -4
- package/esm/src/interpreter/memory/compilers/webhook.d.ts.map +1 -1
- package/esm/src/interpreter/memory/compilers/webhook.js +9 -3
- package/esm/src/interpreter/vanilla/VanillaInterpreter.d.ts +2 -1
- package/esm/src/interpreter/vanilla/VanillaInterpreter.d.ts.map +1 -1
- package/esm/src/interpreter/vanilla/VanillaInterpreter.js +41 -9
- 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 +6 -1
- package/esm/src/observability/logging/ConsoleLogger.d.ts.map +1 -1
- package/package.json +3 -1
- 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 +9 -2
- package/script/src/connection/internal/FetchBuilder.d.ts.map +1 -1
- package/script/src/connection/internal/FetchBuilder.js +147 -3
- package/script/src/context/Context.d.ts +5 -0
- package/script/src/context/Context.d.ts.map +1 -1
- package/script/src/context/Context.js +6 -0
- package/script/src/dsl/Workflow.d.ts.map +1 -1
- package/script/src/dsl/Workflow.js +2 -0
- package/script/src/dsl/http/types.d.ts +2 -0
- 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/cronapi.d.ts +2 -3
- package/script/src/dsl/http/versori/cronapi.d.ts.map +1 -1
- package/script/src/dsl/http/versori/cronapi.js +14 -15
- 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 +3 -1
- package/script/src/internal/constants.d.ts +3 -0
- package/script/src/internal/constants.d.ts.map +1 -1
- package/script/src/internal/constants.js +4 -1
- package/script/src/internal/supervisor.d.ts +23 -0
- package/script/src/internal/supervisor.d.ts.map +1 -0
- package/script/src/internal/supervisor.js +275 -0
- package/script/src/interpreter/durable/DurableInterpreter.d.ts +10 -3
- package/script/src/interpreter/durable/DurableInterpreter.d.ts.map +1 -1
- package/script/src/interpreter/durable/DurableInterpreter.js +70 -18
- package/script/src/interpreter/durable/ObservableCompiler.d.ts +6 -1
- package/script/src/interpreter/durable/ObservableCompiler.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 +3 -1
- package/script/src/interpreter/durable/compilers/fn.d.ts.map +1 -1
- package/script/src/interpreter/durable/compilers/fn.js +28 -5
- package/script/src/interpreter/durable/compilers/http.d.ts.map +1 -1
- package/script/src/interpreter/durable/compilers/http.js +45 -11
- package/script/src/interpreter/durable/compilers/schedule.d.ts.map +1 -1
- package/script/src/interpreter/durable/compilers/schedule.js +4 -3
- package/script/src/interpreter/durable/compilers/webhook.d.ts.map +1 -1
- package/script/src/interpreter/durable/compilers/webhook.js +2 -0
- package/script/src/interpreter/memory/MemoryInterpreter.d.ts +8 -1
- package/script/src/interpreter/memory/MemoryInterpreter.d.ts.map +1 -1
- package/script/src/interpreter/memory/MemoryInterpreter.js +55 -11
- package/script/src/interpreter/memory/ObservableCompiler.d.ts +6 -1
- 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 +5 -0
- package/script/src/interpreter/memory/compilers/fn.d.ts.map +1 -1
- package/script/src/interpreter/memory/compilers/fn.js +28 -17
- package/script/src/interpreter/memory/compilers/http.d.ts.map +1 -1
- package/script/src/interpreter/memory/compilers/http.js +44 -10
- package/script/src/interpreter/memory/compilers/schedule.d.ts.map +1 -1
- package/script/src/interpreter/memory/compilers/schedule.js +61 -4
- package/script/src/interpreter/memory/compilers/webhook.d.ts.map +1 -1
- package/script/src/interpreter/memory/compilers/webhook.js +9 -3
- package/script/src/interpreter/vanilla/VanillaInterpreter.d.ts +2 -1
- package/script/src/interpreter/vanilla/VanillaInterpreter.d.ts.map +1 -1
- package/script/src/interpreter/vanilla/VanillaInterpreter.js +41 -9
- 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 +6 -1
- package/script/src/observability/logging/ConsoleLogger.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/fmt/1.0.9/colors.d.ts.map +0 -1
- package/esm/src/dsl/http/versori/constants.d.ts +0 -21
- package/esm/src/dsl/http/versori/constants.d.ts.map +0 -1
- package/esm/src/dsl/http/versori/constants.js +0 -38
- package/script/deps/jsr.io/@std/fmt/1.0.9/colors.d.ts.map +0 -1
- package/script/src/dsl/http/versori/constants.d.ts +0 -21
- package/script/src/dsl/http/versori/constants.d.ts.map +0 -1
- package/script/src/dsl/http/versori/constants.js +0 -41
- /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
|
@@ -11,8 +11,9 @@
|
|
|
11
11
|
* use of this software will be governed by the Apache License, Version 2.0.
|
|
12
12
|
*/
|
|
13
13
|
import { Observable } from 'rxjs';
|
|
14
|
-
import { envVarEnvId, envVarEnvironmentName, envVarOrgId, envVarProjectId, } from '../../../dsl/http/versori/constants.js';
|
|
15
14
|
import { ScheduleTrigger } from '../../../dsl/triggers/ScheduleTrigger.js';
|
|
15
|
+
import { envVarEnvId, envVarEnvironmentName, envVarOrgId, envVarProjectId, } from '../../../internal/constants.js';
|
|
16
|
+
import { sendTaskStartEvent } from '../../../internal/supervisor.js';
|
|
16
17
|
function compileSchedule(ctx, trigger, signal) {
|
|
17
18
|
return new Observable((subscriber) => {
|
|
18
19
|
// Add HTTP endpoint for manual triggering
|
|
@@ -25,8 +26,43 @@ function compileSchedule(ctx, trigger, signal) {
|
|
|
25
26
|
const orgId = Deno.env.get(envVarOrgId) || 'example-org';
|
|
26
27
|
const client = ctx.platformApi;
|
|
27
28
|
ctx.cronRegistry.set(trigger.id, trigger.schedule);
|
|
28
|
-
async function handleSchedule(
|
|
29
|
+
async function handleSchedule(req, res, span) {
|
|
29
30
|
try {
|
|
31
|
+
// run for a single activation
|
|
32
|
+
const activationId = req.params.activationId;
|
|
33
|
+
if (activationId) {
|
|
34
|
+
const { data: activation } = await client.getActivation({
|
|
35
|
+
path: {
|
|
36
|
+
organisation_id: ctx.organisationId,
|
|
37
|
+
environment_id: environmentId,
|
|
38
|
+
activation_id: activationId,
|
|
39
|
+
},
|
|
40
|
+
throwOnError: false,
|
|
41
|
+
});
|
|
42
|
+
if (!activation) {
|
|
43
|
+
res.status(412).json({
|
|
44
|
+
status: 'error',
|
|
45
|
+
message: `No activation found for ID: ${activationId}`,
|
|
46
|
+
});
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const executionCtx = ctx.contextProvider.create(activation, {}, { workflowId: trigger.id });
|
|
50
|
+
span.setAttribute('execution.id', executionCtx.executionId);
|
|
51
|
+
await sendTaskStartEvent(trigger.id, executionCtx, span);
|
|
52
|
+
try {
|
|
53
|
+
ctx.log.info(`Running schedule ${trigger.id} for activation ${activationId}`);
|
|
54
|
+
subscriber.next(executionCtx);
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
executionCtx.log.error('execution error inside schedule', { error });
|
|
58
|
+
}
|
|
59
|
+
res.status(200).json({
|
|
60
|
+
status: 'triggered',
|
|
61
|
+
executionId: executionCtx.executionId,
|
|
62
|
+
});
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
// run for static activation only
|
|
30
66
|
if (trigger.activationPredicate === undefined) {
|
|
31
67
|
const { data: activation } = await client.listActivations({
|
|
32
68
|
path: {
|
|
@@ -45,8 +81,9 @@ function compileSchedule(ctx, trigger, signal) {
|
|
|
45
81
|
});
|
|
46
82
|
return;
|
|
47
83
|
}
|
|
48
|
-
const executionCtx = ctx.contextProvider.create(activation[0], {});
|
|
84
|
+
const executionCtx = ctx.contextProvider.create(activation[0], {}, { workflowId: trigger.id });
|
|
49
85
|
span.setAttribute('execution.id', executionCtx.executionId);
|
|
86
|
+
await sendTaskStartEvent(trigger.id, executionCtx, span);
|
|
50
87
|
try {
|
|
51
88
|
subscriber.next(executionCtx);
|
|
52
89
|
}
|
|
@@ -59,6 +96,7 @@ function compileSchedule(ctx, trigger, signal) {
|
|
|
59
96
|
});
|
|
60
97
|
return;
|
|
61
98
|
}
|
|
99
|
+
// run for all activations
|
|
62
100
|
const { data: activations } = await client.listActivations({
|
|
63
101
|
path: {
|
|
64
102
|
organisation_id: ctx.organisationId,
|
|
@@ -77,8 +115,9 @@ function compileSchedule(ctx, trigger, signal) {
|
|
|
77
115
|
return;
|
|
78
116
|
}
|
|
79
117
|
activations.forEach((activation) => {
|
|
80
|
-
const executionCtx = ctx.contextProvider.create(activation, {});
|
|
118
|
+
const executionCtx = ctx.contextProvider.create(activation, {}, { workflowId: trigger.id });
|
|
81
119
|
try {
|
|
120
|
+
ctx.log.info(`Running schedule ${trigger.id} for activation ${activation.id}`);
|
|
82
121
|
subscriber.next(executionCtx);
|
|
83
122
|
}
|
|
84
123
|
catch (error) {
|
|
@@ -96,11 +135,29 @@ function compileSchedule(ctx, trigger, signal) {
|
|
|
96
135
|
await ctx.tracer.startActiveSpan(`schedule-${trigger.id}`, async (span) => {
|
|
97
136
|
span.setAttribute('task.id', trigger.id);
|
|
98
137
|
span.setAttribute('task.type', 'schedule');
|
|
138
|
+
span.setAttribute('type', 'task');
|
|
139
|
+
span.setAttribute('schedule', trigger.schedule);
|
|
140
|
+
span.setAttribute('project.id', projectId);
|
|
141
|
+
span.setAttribute('environment.id', environmentId);
|
|
142
|
+
span.setAttribute('environment.name', environmentName);
|
|
143
|
+
span.setAttribute('org.id', orgId);
|
|
144
|
+
span.setAttribute('workflow.id', trigger.id);
|
|
145
|
+
await handleSchedule(req, res, span);
|
|
146
|
+
span.end();
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
ctx.cronRouter.post(`/cron/${trigger.id}/activations/:activationId`, async (req, res) => {
|
|
150
|
+
await ctx.tracer.startActiveSpan(`schedule-${trigger.id}`, async (span) => {
|
|
151
|
+
span.setAttribute('task.id', trigger.id);
|
|
152
|
+
span.setAttribute('activation.id', req.params.activationId);
|
|
153
|
+
span.setAttribute('task.type', 'schedule');
|
|
154
|
+
span.setAttribute('type', 'task');
|
|
99
155
|
span.setAttribute('schedule', trigger.schedule);
|
|
100
156
|
span.setAttribute('project.id', projectId);
|
|
101
157
|
span.setAttribute('environment.id', environmentId);
|
|
102
158
|
span.setAttribute('environment.name', environmentName);
|
|
103
159
|
span.setAttribute('org.id', orgId);
|
|
160
|
+
span.setAttribute('workflow.id', trigger.id);
|
|
104
161
|
await handleSchedule(req, res, span);
|
|
105
162
|
span.end();
|
|
106
163
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhook.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/memory/compilers/webhook.ts"],"names":[],"mappings":"AA2BA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"webhook.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/memory/compilers/webhook.ts"],"names":[],"mappings":"AA2BA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAItF,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAuD7C,eAAO,MAAM,eAAe,EAAE,eAAe,CAAC,WAAW,EAAE,cAAc,CAmTxE,CAAC"}
|
|
@@ -18,6 +18,7 @@ import { Observable } from 'rxjs';
|
|
|
18
18
|
import { createActIdDynamicWebhookMiddleware, createStaticWebhookMiddleware, createUserIdDynamicWebhookMiddleware, } from '../../../dsl/http/versori/webhookmiddleware.js';
|
|
19
19
|
import { WebhookTrigger } from '../../../dsl/triggers/WebhookTrigger.js';
|
|
20
20
|
import { envVarEnvId } from '../../../internal/constants.js';
|
|
21
|
+
import { sendTaskStartEvent } from '../../../internal/supervisor.js';
|
|
21
22
|
const xml2jsDefaults = {
|
|
22
23
|
explicitArray: false,
|
|
23
24
|
normalize: false,
|
|
@@ -84,6 +85,7 @@ export const webhookCompiler = {
|
|
|
84
85
|
onError = trigger.options.response.onError;
|
|
85
86
|
}
|
|
86
87
|
const ctxOptionsFn = (req, res) => ({
|
|
88
|
+
workflowId: trigger.id,
|
|
87
89
|
onSuccess: (ctx) => {
|
|
88
90
|
if (isSync) {
|
|
89
91
|
sendResponse(res, onSuccess(ctx));
|
|
@@ -104,6 +106,7 @@ export const webhookCompiler = {
|
|
|
104
106
|
else {
|
|
105
107
|
routeMiddleware.push(express.raw({ type: '*/*', limit: '50mb' }));
|
|
106
108
|
}
|
|
109
|
+
ctx.webhookRegistry.set(trigger.id, { method, path: `/${trigger.id}`, options: trigger.options });
|
|
107
110
|
return new Observable((subscriber) => {
|
|
108
111
|
if (!ctx.webhookRouter) {
|
|
109
112
|
throw new Error('Router not available in compiler context');
|
|
@@ -129,12 +132,13 @@ export const webhookCompiler = {
|
|
|
129
132
|
cfgReader: ctx.configReader,
|
|
130
133
|
log: ctx.log,
|
|
131
134
|
}), async (req, res) => {
|
|
132
|
-
await ctx.tracer.startActiveSpan(`webhook-${trigger.id}`, (span) => {
|
|
135
|
+
await ctx.tracer.startActiveSpan(`webhook-${trigger.id}`, async (span) => {
|
|
133
136
|
span.setAttribute('task.id', trigger.id);
|
|
134
137
|
span.setAttribute('task.type', 'webhook');
|
|
135
138
|
const staticActivation = res.locals.activation;
|
|
136
139
|
const executionCtx = ctx.contextProvider.create(staticActivation, req.body, ctxOptionsFn(req, res));
|
|
137
140
|
span.setAttribute('execution.id', executionCtx.executionId);
|
|
141
|
+
await sendTaskStartEvent(trigger.id, executionCtx, span);
|
|
138
142
|
try {
|
|
139
143
|
subscriber.next(executionCtx);
|
|
140
144
|
if (isAsync) {
|
|
@@ -165,7 +169,7 @@ export const webhookCompiler = {
|
|
|
165
169
|
cfgReader: ctx.configReader,
|
|
166
170
|
log: ctx.log,
|
|
167
171
|
}), async (req, res) => {
|
|
168
|
-
await ctx.tracer.startActiveSpan(`webhook-${trigger.id}`, (span) => {
|
|
172
|
+
await ctx.tracer.startActiveSpan(`webhook-${trigger.id}`, async (span) => {
|
|
169
173
|
span.setAttribute('task.id', trigger.id);
|
|
170
174
|
span.setAttribute('task.type', 'webhook');
|
|
171
175
|
span.setAttribute('user.id', req.params.userId);
|
|
@@ -186,6 +190,7 @@ export const webhookCompiler = {
|
|
|
186
190
|
}
|
|
187
191
|
const executionCtx = ctx.contextProvider.create(activation, req.body, ctxOptionsFn(req, res));
|
|
188
192
|
span.setAttribute('execution.id', executionCtx.executionId);
|
|
193
|
+
await sendTaskStartEvent(trigger.id, executionCtx, span);
|
|
189
194
|
const errors = [];
|
|
190
195
|
try {
|
|
191
196
|
subscriber.next(executionCtx);
|
|
@@ -221,7 +226,7 @@ export const webhookCompiler = {
|
|
|
221
226
|
cfgReader: ctx.configReader,
|
|
222
227
|
log: ctx.log,
|
|
223
228
|
}), async (req, res) => {
|
|
224
|
-
await ctx.tracer.startActiveSpan(`webhook-${trigger.id}`, (span) => {
|
|
229
|
+
await ctx.tracer.startActiveSpan(`webhook-${trigger.id}`, async (span) => {
|
|
225
230
|
span.setAttribute('task.id', trigger.id);
|
|
226
231
|
span.setAttribute('task.type', 'webhook');
|
|
227
232
|
span.setAttribute('activation.id', req.params.activationId);
|
|
@@ -240,6 +245,7 @@ export const webhookCompiler = {
|
|
|
240
245
|
}
|
|
241
246
|
const activationCtx = ctx.contextProvider.create(activation, req.body, ctxOptionsFn(req, res));
|
|
242
247
|
span.setAttribute('execution.id', activationCtx.executionId);
|
|
248
|
+
await sendTaskStartEvent(trigger.id, activationCtx, span);
|
|
243
249
|
try {
|
|
244
250
|
subscriber.next(activationCtx);
|
|
245
251
|
if (isAsync) {
|
|
@@ -86,9 +86,10 @@ export declare class VanillaInterpreter {
|
|
|
86
86
|
private cronServer?;
|
|
87
87
|
private shutdownServer?;
|
|
88
88
|
private isShuttingDown;
|
|
89
|
+
private wfRegistration;
|
|
89
90
|
constructor(log: Logger, compiler: ObservableCompiler, contextProvider: ContextProvider, webhookRouter: Router, cronRouter: Router, cronRegistry: Map<string, string>, cnxFetchFactory: DefaultConnectionFactory, cronProvider: CronProvider, tracer: Tracer, cfgReader: ConfigReader, queueProvider: QueueAPI, otelSDK?: NodeSDK | undefined);
|
|
90
91
|
static newInstance(options?: VanillaInterpreterOptions): Promise<VanillaInterpreter>;
|
|
91
|
-
register<O>(workflow: Workflow<O>, options?: VanillaInterpreterOptions): Registration;
|
|
92
|
+
register<O>(workflow: Workflow<O>, options?: VanillaInterpreterOptions): Registration | void;
|
|
92
93
|
start(): Promise<void>;
|
|
93
94
|
stop(): Promise<void>;
|
|
94
95
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VanillaInterpreter.d.ts","sourceRoot":"","sources":["../../../../src/src/interpreter/vanilla/VanillaInterpreter.ts"],"names":[],"mappings":"AAaA,OAAsB,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAG3D,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAgB,EAAqB,MAAM,EAAE,MAAM,SAAS,CAAC;AAE7D,OAAO,EAA+B,UAAU,EAAM,YAAY,EAAO,MAAM,MAAM,CAAC;AACtF,OAAO,EAAE,wBAAwB,EAAE,MAAM,8CAA8C,CAAC;AACxF,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzF,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"VanillaInterpreter.d.ts","sourceRoot":"","sources":["../../../../src/src/interpreter/vanilla/VanillaInterpreter.ts"],"names":[],"mappings":"AAaA,OAAsB,EAAE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kBAAkB,CAAC;IAoG9F,QAAQ,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,yBAAyB,GAAG,YAAY,GAAG,IAAI;IAkEtF,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IA2M5B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CASxB"}
|
|
@@ -19,8 +19,10 @@ import { catchError, EMPTY, mergeMap, of, tap } from 'rxjs';
|
|
|
19
19
|
import { DefaultConnectionFactory } from '../../connection/VanillaConnectionFactory.js';
|
|
20
20
|
import { VanillaContextProvider } from '../../context/VanillaContext.js';
|
|
21
21
|
import { VersoriConfigReader } from '../../dsl/http/versori/configloader.js';
|
|
22
|
-
import { envVarEnvId, envVarEnvironmentName,
|
|
22
|
+
import { envVarEnvId, envVarEnvironmentName, envVarOrgId, envVarOrgSlug, envVarOtelTracesURL, envVarProjectId, envVarVersion, } from '../../internal/constants.js';
|
|
23
|
+
import { Fake, registerWorkflow, signalReady, enabled as supervisorEnabled } from '../../internal/supervisor.js';
|
|
23
24
|
import { CronAPIClient } from '../../dsl/http/versori/cronapi.js';
|
|
25
|
+
import { DurableWorkflowTrigger } from '../../dsl/triggers/DurableTrigger.js';
|
|
24
26
|
import { WorkflowImpl } from '../../dsl/Workflow.js';
|
|
25
27
|
import { IssueImpl } from '../../issues/Issues.js';
|
|
26
28
|
import { MemoryKeyValueProvider } from '../../kv/memory/MemoryKeyValueProvider.js';
|
|
@@ -28,8 +30,8 @@ import { SDKKeyValueProvider } from '../../kv/sdk/SDKKeyValueProvider.js';
|
|
|
28
30
|
import { ConsoleLogger } from '../../observability/logging/ConsoleLogger.js';
|
|
29
31
|
import { QueueImpl } from '../durable/Queue.js';
|
|
30
32
|
import { ObservableCompiler } from './ObservableCompiler.js';
|
|
31
|
-
function getKVProvider(
|
|
32
|
-
if (
|
|
33
|
+
function getKVProvider() {
|
|
34
|
+
if (supervisorEnabled) {
|
|
33
35
|
return Promise.resolve(new MemoryKeyValueProvider());
|
|
34
36
|
}
|
|
35
37
|
return SDKKeyValueProvider.fromEnv();
|
|
@@ -161,6 +163,13 @@ export class VanillaInterpreter {
|
|
|
161
163
|
writable: true,
|
|
162
164
|
value: false
|
|
163
165
|
});
|
|
166
|
+
// Workflow registration promises only used when supervisor is enabled
|
|
167
|
+
Object.defineProperty(this, "wfRegistration", {
|
|
168
|
+
enumerable: true,
|
|
169
|
+
configurable: true,
|
|
170
|
+
writable: true,
|
|
171
|
+
value: []
|
|
172
|
+
});
|
|
164
173
|
if (typeof this.log === 'undefined') {
|
|
165
174
|
throw new Error('VanillaInterpreter should not be instantiated directly. Use VanillaInterpreter.newInstance() instead.');
|
|
166
175
|
}
|
|
@@ -177,7 +186,6 @@ export class VanillaInterpreter {
|
|
|
177
186
|
const otelTracesURL = Deno.env.get(envVarOtelTracesURL);
|
|
178
187
|
let otelSDK;
|
|
179
188
|
const configReader = VersoriConfigReader.fromEnv(log);
|
|
180
|
-
const runLocal = Deno.env.get(envVarLocalRun) === 'true';
|
|
181
189
|
await waitForReady(log);
|
|
182
190
|
// Do NOT change these attributes, they are used by the API to filter on
|
|
183
191
|
const resource = resourceFromAttributes({
|
|
@@ -199,6 +207,15 @@ export class VanillaInterpreter {
|
|
|
199
207
|
log.info('Starting OpenTelemetry SDK');
|
|
200
208
|
otelSDK.start();
|
|
201
209
|
}
|
|
210
|
+
else if (supervisorEnabled) {
|
|
211
|
+
otelSDK = new NodeSDK({
|
|
212
|
+
traceExporter: new Fake(),
|
|
213
|
+
serviceName: serviceName,
|
|
214
|
+
resource: resource,
|
|
215
|
+
});
|
|
216
|
+
log.info('Starting Testing OpenTelemetry SDK');
|
|
217
|
+
otelSDK.start();
|
|
218
|
+
}
|
|
202
219
|
const tracer = opentelemetry.trace.getTracer(serviceName, version);
|
|
203
220
|
const queueProvider = await QueueImpl.fromEnv(log);
|
|
204
221
|
const connectionFactory = new DefaultConnectionFactory();
|
|
@@ -206,7 +223,7 @@ export class VanillaInterpreter {
|
|
|
206
223
|
if (options.contextProvider) {
|
|
207
224
|
return new VanillaInterpreter(log, compiler, options.contextProvider, express.Router(), express.Router(), new Map(), connectionFactory, CronAPIClient.fromEnv(), tracer, configReader, queueProvider, otelSDK);
|
|
208
225
|
}
|
|
209
|
-
const kvp = await getKVProvider(
|
|
226
|
+
const kvp = await getKVProvider();
|
|
210
227
|
const organisationId = Deno.env.get(envVarOrgId) || 'development';
|
|
211
228
|
const environmentId = Deno.env.get(envVarEnvId) || 'development';
|
|
212
229
|
const ctxProvider = new VanillaContextProvider(log, kvp, organisationId, environmentId, issuesProvider, queueProvider);
|
|
@@ -220,6 +237,16 @@ export class VanillaInterpreter {
|
|
|
220
237
|
if (!(workflow instanceof WorkflowImpl)) {
|
|
221
238
|
throw new Error('workflow is not an instance of WorkflowImpl');
|
|
222
239
|
}
|
|
240
|
+
const triggerName = 'id' in workflow.trigger && typeof workflow.trigger.id === 'string'
|
|
241
|
+
? workflow.trigger.id
|
|
242
|
+
: workflow.trigger.constructor.name;
|
|
243
|
+
if (supervisorEnabled && workflow.trigger instanceof DurableWorkflowTrigger) {
|
|
244
|
+
this.log.info('Skipping durable workflow trigger registration (supervisor mode)', {
|
|
245
|
+
triggerName,
|
|
246
|
+
});
|
|
247
|
+
this.wfRegistration.push(registerWorkflow(workflow));
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
223
250
|
const compilerContext = {
|
|
224
251
|
compiler: this.compiler,
|
|
225
252
|
log: this.log,
|
|
@@ -235,9 +262,6 @@ export class VanillaInterpreter {
|
|
|
235
262
|
};
|
|
236
263
|
const trigger$ = this.compiler.compileTrigger(compilerContext, workflow.trigger, combinedSignal);
|
|
237
264
|
const task$ = this.compiler.compileTask(compilerContext, workflow.task);
|
|
238
|
-
const triggerName = 'id' in workflow.trigger && typeof workflow.trigger.id === 'string'
|
|
239
|
-
? workflow.trigger.id
|
|
240
|
-
: workflow.trigger.constructor.name;
|
|
241
265
|
const registration = {
|
|
242
266
|
triggerName,
|
|
243
267
|
trigger$,
|
|
@@ -249,9 +273,12 @@ export class VanillaInterpreter {
|
|
|
249
273
|
},
|
|
250
274
|
};
|
|
251
275
|
this.registeredWorkflows.push(registration);
|
|
276
|
+
if (supervisorEnabled) {
|
|
277
|
+
this.wfRegistration.push(registerWorkflow(workflow));
|
|
278
|
+
}
|
|
252
279
|
return registration;
|
|
253
280
|
}
|
|
254
|
-
start() {
|
|
281
|
+
async start() {
|
|
255
282
|
const port = Deno.env.get('PORT') || 3000;
|
|
256
283
|
const cronPort = Deno.env.get('CRON_PORT') || 3001;
|
|
257
284
|
const webhookApp = express();
|
|
@@ -360,6 +387,7 @@ export class VanillaInterpreter {
|
|
|
360
387
|
if (this.cronServer) {
|
|
361
388
|
this.cronServer.close();
|
|
362
389
|
}
|
|
390
|
+
this.otelSDK?.shutdown();
|
|
363
391
|
for (const registration of this.registeredWorkflows) {
|
|
364
392
|
Deno.removeSignalListener('SIGINT', registration.sigintListener);
|
|
365
393
|
if (registration.subscription) {
|
|
@@ -372,6 +400,10 @@ export class VanillaInterpreter {
|
|
|
372
400
|
}
|
|
373
401
|
};
|
|
374
402
|
Deno.addSignalListener('SIGINT', this.shutdownServer);
|
|
403
|
+
if (supervisorEnabled) {
|
|
404
|
+
await Promise.all(this.wfRegistration);
|
|
405
|
+
await signalReady();
|
|
406
|
+
}
|
|
375
407
|
return new Promise((resolve) => {
|
|
376
408
|
let serversClosed = 0;
|
|
377
409
|
const totalServers = [this.webhookServer, this.cronServer].filter(Boolean).length;
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* use of this software will be governed by the Apache License, Version 2.0.
|
|
12
12
|
*/
|
|
13
13
|
import { Observable } from 'rxjs';
|
|
14
|
-
import { envVarEnvId, envVarEnvironmentName, envVarOrgId, envVarProjectId, } from '../../../
|
|
14
|
+
import { envVarEnvId, envVarEnvironmentName, envVarOrgId, envVarProjectId, } from '../../../internal/constants.js';
|
|
15
15
|
import { ScheduleTrigger } from '../../../dsl/triggers/ScheduleTrigger.js';
|
|
16
16
|
import { VanillaActivation } from '../ObservableCompiler.js';
|
|
17
17
|
function compileSchedule(ctx, trigger, signal) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Issues.d.ts","sourceRoot":"","sources":["../../../src/src/issues/Issues.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Issues.d.ts","sourceRoot":"","sources":["../../../src/src/issues/Issues.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEjD,MAAM,MAAM,WAAW,GAAG;IACtB,MAAM,EAAE,QAAQ,GAAG,OAAO,CAAC;IAC3B,QAAQ,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,KAAK,GAAG;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,M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CAAC,EAAE,OAAO,CAAC;QACtB,cAAc,CAAC,EAAE,MAAM,CAAC;KAC3B,GAAG,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;CAG5B"}
|
package/esm/src/issues/Issues.js
CHANGED
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
* use of this software will be governed by the Apache License, Version 2.0.
|
|
12
12
|
*/
|
|
13
13
|
import { createHash } from 'node:crypto';
|
|
14
|
-
import { envVarEnvId, envVarEnvironmentName, envVarOrgId, envVarOrgSlug, envVarProjectId, envVarSDKApiBaseURL, envVarVersion, } from '../
|
|
14
|
+
import { envVarEnvId, envVarEnvironmentName, envVarOrgId, envVarOrgSlug, envVarProjectId, envVarSDKApiBaseURL, envVarVersion, } from '../internal/constants.js';
|
|
15
|
+
import { enabled as supervisorEnabled } from '../internal/supervisor.js';
|
|
15
16
|
export class IssueImpl {
|
|
16
17
|
constructor(log) {
|
|
17
18
|
Object.defineProperty(this, "baseUrl", {
|
|
@@ -107,6 +108,10 @@ export class IssueImpl {
|
|
|
107
108
|
issue.annotations['environmentId'] = this.environmentId;
|
|
108
109
|
issue.annotations['organisationId'] = this.organisationId;
|
|
109
110
|
try {
|
|
111
|
+
if (supervisorEnabled) {
|
|
112
|
+
this.log.info('Issue to be submitted', { issue: issue });
|
|
113
|
+
return Promise.resolve(null);
|
|
114
|
+
}
|
|
110
115
|
const response = await fetch(`${this.baseUrl}/v1/issues/submit`, {
|
|
111
116
|
method: 'POST',
|
|
112
117
|
headers: {
|
|
@@ -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/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version": "0.
|
|
3
|
+
"version": "0.7.0-alpha.10",
|
|
4
4
|
"description": "Versori Run",
|
|
5
5
|
"homepage": "https://github.com/versori/versori-run#readme",
|
|
6
6
|
"repository": {
|
|
@@ -27,9 +27,11 @@
|
|
|
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",
|
|
30
31
|
"@opentelemetry/exporter-trace-otlp-proto": "^0.200.0",
|
|
31
32
|
"@opentelemetry/resources": "^2.0.0",
|
|
32
33
|
"@opentelemetry/sdk-node": "^0.200.0",
|
|
34
|
+
"@opentelemetry/sdk-trace-node": "^2.0.0",
|
|
33
35
|
"cors": "^2.8.5",
|
|
34
36
|
"express": "^4.21.2",
|
|
35
37
|
"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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ED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,GAAG,GAAG,MAAM,CAuBhE;AAWD;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEpD"}
|
|
@@ -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,5 +1,9 @@
|
|
|
1
1
|
import { FetchLike, OutboundMiddleware } from '../types.js';
|
|
2
|
-
|
|
2
|
+
export type FetchConnection = {
|
|
3
|
+
name: string;
|
|
4
|
+
id?: string;
|
|
5
|
+
baseUrl?: string;
|
|
6
|
+
};
|
|
3
7
|
/**
|
|
4
8
|
* FetchBuilder is used to build a fetch function which can be composed by multiple middlewares for
|
|
5
9
|
* modifying the request/response and makes the implementation of {@link ConnectionFetchFactory}
|
|
@@ -8,8 +12,11 @@ import { Connection } from '../../services/platform/mod.js';
|
|
|
8
12
|
export declare class FetchBuilder {
|
|
9
13
|
#private;
|
|
10
14
|
middlewares: OutboundMiddleware[];
|
|
11
|
-
constructor(fetch: FetchLike, cnx:
|
|
15
|
+
constructor(fetch: FetchLike, cnx: FetchConnection);
|
|
12
16
|
use(fn: OutboundMiddleware): void;
|
|
13
17
|
build(): FetchLike;
|
|
18
|
+
buildSupervisedFetch(): FetchLike;
|
|
19
|
+
private supervisedFetch;
|
|
20
|
+
private wrapWithTracing;
|
|
14
21
|
}
|
|
15
22
|
//# 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":"AAgBA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAE5D,MAAM,MAAM,eAAe,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;GAIG;AACH,qBAAa,YAAY;;IACrB,WAAW,EAAE,kBAAkB,EAAE,CAAC;gBAMtB,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,eAAe;IAelD,GAAG,CAAC,EAAE,EAAE,kBAAkB;IAI1B,KAAK,IAAI,SAAS;IAYlB,oBAAoB,IAAI,SAAS;IAOjC,OAAO,CAAC,eAAe;IAevB,OAAO,CAAC,eAAe;CAyF1B"}
|