@versori/run 0.3.0-veta.2 → 0.4.0-alpha.2
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/src/connection/DirectConnectionFactory.d.ts +1 -1
- package/esm/src/connection/DirectConnectionFactory.d.ts.map +1 -1
- package/esm/src/connection/DirectConnectionFactory.js +6 -9
- package/esm/src/connection/StaticFetchFactory.d.ts.map +1 -1
- package/esm/src/connection/internal/CredentialHolder.d.ts.map +1 -1
- package/esm/src/connection/internal/CredentialHolder.js +11 -2
- package/esm/src/connection/internal/FetchBuilder.d.ts +3 -2
- package/esm/src/connection/internal/FetchBuilder.d.ts.map +1 -1
- package/esm/src/connection/internal/FetchBuilder.js +103 -4
- package/esm/src/connection/internal/OutboundConnectionFactory.d.ts +1 -1
- package/esm/src/connection/internal/OutboundConnectionFactory.d.ts.map +1 -1
- package/esm/src/connection/internal/OutboundConnectionFactory.js +2 -3
- package/esm/src/context/AsyncWorkflow.js +1 -1
- package/esm/src/context/Context.d.ts +7 -6
- package/esm/src/context/Context.d.ts.map +1 -1
- package/esm/src/context/Context.js +3 -13
- package/esm/src/context/ContextProvider.d.ts +1 -3
- package/esm/src/context/ContextProvider.d.ts.map +1 -1
- package/esm/src/context/ContextProvider.js +3 -6
- package/esm/src/dsl/Workflow.d.ts.map +1 -1
- package/esm/src/dsl/Workflow.js +2 -0
- 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 -14
- package/esm/src/dsl/http/versori/kvapi/core/OpenAPI.js +1 -1
- package/esm/src/dsl/http/versori/webhookmiddleware.d.ts +1 -1
- package/esm/src/dsl/http/versori/webhookmiddleware.d.ts.map +1 -1
- package/esm/src/dsl/http/versori/webhookmiddleware.js +24 -19
- package/esm/src/dsl/tasks/HttpTask.d.ts +1 -2
- package/esm/src/dsl/tasks/HttpTask.d.ts.map +1 -1
- package/esm/src/dsl/tasks/HttpTask.js +0 -3
- package/esm/src/dsl/triggers/DurableTrigger.d.ts +1 -0
- package/esm/src/dsl/triggers/DurableTrigger.d.ts.map +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 -1
- package/esm/src/internal/constants.d.ts.map +1 -1
- package/esm/src/internal/constants.js +4 -1
- package/esm/src/internal/supervisor.d.ts +21 -0
- package/esm/src/internal/supervisor.d.ts.map +1 -0
- package/esm/src/internal/supervisor.js +122 -0
- package/esm/src/interpreter/durable/DurableInterpreter.d.ts +8 -2
- package/esm/src/interpreter/durable/DurableInterpreter.d.ts.map +1 -1
- package/esm/src/interpreter/durable/DurableInterpreter.js +62 -22
- 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.d.ts +16 -24
- package/esm/src/interpreter/durable/Queue.d.ts.map +1 -1
- package/esm/src/interpreter/durable/Queue.js +5 -4
- package/esm/src/interpreter/durable/compilers/catch.d.ts.map +1 -1
- package/esm/src/interpreter/durable/compilers/catch.js +3 -2
- package/esm/src/interpreter/durable/compilers/durableworkflow.d.ts.map +1 -1
- package/esm/src/interpreter/durable/compilers/durableworkflow.js +19 -19
- package/esm/src/interpreter/durable/compilers/fn.d.ts.map +1 -1
- package/esm/src/interpreter/durable/compilers/fn.js +17 -4
- package/esm/src/interpreter/durable/compilers/http.d.ts.map +1 -1
- package/esm/src/interpreter/durable/compilers/http.js +8 -2
- package/esm/src/interpreter/durable/compilers/schedule.d.ts.map +1 -1
- package/esm/src/interpreter/durable/compilers/schedule.js +2 -1
- package/esm/src/interpreter/durable/compilers/webhook.d.ts.map +1 -1
- package/esm/src/interpreter/durable/compilers/webhook.js +4 -1
- package/esm/src/interpreter/memory/MemoryInterpreter.d.ts +8 -2
- package/esm/src/interpreter/memory/MemoryInterpreter.d.ts.map +1 -1
- package/esm/src/interpreter/memory/MemoryInterpreter.js +46 -18
- 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 +3 -2
- package/esm/src/interpreter/memory/compilers/fn.d.ts.map +1 -1
- package/esm/src/interpreter/memory/compilers/fn.js +17 -4
- package/esm/src/interpreter/memory/compilers/http.d.ts.map +1 -1
- package/esm/src/interpreter/memory/compilers/http.js +33 -3
- package/esm/src/interpreter/memory/compilers/schedule.d.ts.map +1 -1
- package/esm/src/interpreter/memory/compilers/schedule.js +2 -1
- package/esm/src/interpreter/memory/compilers/webhook.d.ts.map +1 -1
- package/esm/src/interpreter/memory/compilers/webhook.js +5 -1
- package/esm/src/issues/Issues.js +1 -1
- package/esm/src/kv/sdk/SDKKeyValue.d.ts.map +1 -1
- package/esm/src/kv/sdk/SDKKeyValue.js +3 -9
- package/esm/src/services/createConnectRpcClient.d.ts +16 -0
- package/esm/src/services/createConnectRpcClient.d.ts.map +1 -0
- package/esm/src/services/createConnectRpcClient.js +63 -0
- package/package.json +3 -1
- package/script/src/connection/DirectConnectionFactory.d.ts +1 -1
- package/script/src/connection/DirectConnectionFactory.d.ts.map +1 -1
- package/script/src/connection/DirectConnectionFactory.js +5 -8
- package/script/src/connection/StaticFetchFactory.d.ts.map +1 -1
- package/script/src/connection/internal/CredentialHolder.d.ts.map +1 -1
- package/script/src/connection/internal/CredentialHolder.js +11 -2
- package/script/src/connection/internal/FetchBuilder.d.ts +3 -2
- package/script/src/connection/internal/FetchBuilder.d.ts.map +1 -1
- package/script/src/connection/internal/FetchBuilder.js +126 -4
- package/script/src/connection/internal/OutboundConnectionFactory.d.ts +1 -1
- package/script/src/connection/internal/OutboundConnectionFactory.d.ts.map +1 -1
- package/script/src/connection/internal/OutboundConnectionFactory.js +2 -3
- package/script/src/context/AsyncWorkflow.js +1 -1
- package/script/src/context/Context.d.ts +7 -6
- package/script/src/context/Context.d.ts.map +1 -1
- package/script/src/context/Context.js +3 -13
- package/script/src/context/ContextProvider.d.ts +1 -3
- package/script/src/context/ContextProvider.d.ts.map +1 -1
- package/script/src/context/ContextProvider.js +3 -6
- package/script/src/dsl/Workflow.d.ts.map +1 -1
- package/script/src/dsl/Workflow.js +2 -0
- 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 -14
- package/script/src/dsl/http/versori/kvapi/core/OpenAPI.js +1 -1
- package/script/src/dsl/http/versori/webhookmiddleware.d.ts +1 -1
- package/script/src/dsl/http/versori/webhookmiddleware.d.ts.map +1 -1
- package/script/src/dsl/http/versori/webhookmiddleware.js +24 -19
- package/script/src/dsl/tasks/HttpTask.d.ts +1 -2
- package/script/src/dsl/tasks/HttpTask.d.ts.map +1 -1
- package/script/src/dsl/tasks/HttpTask.js +0 -3
- package/script/src/dsl/triggers/DurableTrigger.d.ts +1 -0
- package/script/src/dsl/triggers/DurableTrigger.d.ts.map +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 -1
- package/script/src/internal/constants.d.ts.map +1 -1
- package/script/src/internal/constants.js +5 -2
- package/script/src/internal/supervisor.d.ts +21 -0
- package/script/src/internal/supervisor.d.ts.map +1 -0
- package/script/src/internal/supervisor.js +129 -0
- package/script/src/interpreter/durable/DurableInterpreter.d.ts +8 -2
- package/script/src/interpreter/durable/DurableInterpreter.d.ts.map +1 -1
- package/script/src/interpreter/durable/DurableInterpreter.js +62 -22
- 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.d.ts +16 -24
- package/script/src/interpreter/durable/Queue.d.ts.map +1 -1
- package/script/src/interpreter/durable/Queue.js +5 -4
- package/script/src/interpreter/durable/compilers/catch.d.ts.map +1 -1
- package/script/src/interpreter/durable/compilers/catch.js +3 -2
- package/script/src/interpreter/durable/compilers/durableworkflow.d.ts.map +1 -1
- package/script/src/interpreter/durable/compilers/durableworkflow.js +19 -19
- package/script/src/interpreter/durable/compilers/fn.d.ts.map +1 -1
- package/script/src/interpreter/durable/compilers/fn.js +17 -4
- package/script/src/interpreter/durable/compilers/http.d.ts.map +1 -1
- package/script/src/interpreter/durable/compilers/http.js +8 -2
- package/script/src/interpreter/durable/compilers/schedule.d.ts.map +1 -1
- package/script/src/interpreter/durable/compilers/schedule.js +2 -1
- package/script/src/interpreter/durable/compilers/webhook.d.ts.map +1 -1
- package/script/src/interpreter/durable/compilers/webhook.js +4 -1
- package/script/src/interpreter/memory/MemoryInterpreter.d.ts +8 -2
- package/script/src/interpreter/memory/MemoryInterpreter.d.ts.map +1 -1
- package/script/src/interpreter/memory/MemoryInterpreter.js +46 -18
- 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 +3 -2
- package/script/src/interpreter/memory/compilers/fn.d.ts.map +1 -1
- package/script/src/interpreter/memory/compilers/fn.js +17 -4
- package/script/src/interpreter/memory/compilers/http.d.ts.map +1 -1
- package/script/src/interpreter/memory/compilers/http.js +33 -3
- package/script/src/interpreter/memory/compilers/schedule.d.ts.map +1 -1
- package/script/src/interpreter/memory/compilers/schedule.js +2 -1
- package/script/src/interpreter/memory/compilers/webhook.d.ts.map +1 -1
- package/script/src/interpreter/memory/compilers/webhook.js +5 -1
- package/script/src/issues/Issues.js +1 -1
- package/script/src/kv/sdk/SDKKeyValue.d.ts.map +1 -1
- package/script/src/kv/sdk/SDKKeyValue.js +3 -9
- package/script/src/services/createConnectRpcClient.d.ts +16 -0
- package/script/src/services/createConnectRpcClient.d.ts.map +1 -0
- package/script/src/services/createConnectRpcClient.js +66 -0
- package/esm/src/context/WorkflowClient.d.ts +0 -29
- package/esm/src/context/WorkflowClient.d.ts.map +0 -1
- package/esm/src/context/WorkflowClient.js +0 -95
- package/esm/src/dsl/http/versori/activation.d.ts +0 -13
- package/esm/src/dsl/http/versori/activation.d.ts.map +0 -1
- package/esm/src/dsl/http/versori/activation.js +0 -65
- package/esm/src/dsl/http/versori/cli.d.ts +0 -2
- package/esm/src/dsl/http/versori/cli.d.ts.map +0 -1
- package/esm/src/dsl/http/versori/cli.js +0 -20
- package/esm/src/dsl/http/versori/constants.d.ts +0 -20
- package/esm/src/dsl/http/versori/constants.d.ts.map +0 -1
- package/esm/src/dsl/http/versori/constants.js +0 -25
- package/esm/src/dsl/http/versori/internalauth.d.ts +0 -15
- package/esm/src/dsl/http/versori/internalauth.d.ts.map +0 -1
- package/esm/src/dsl/http/versori/internalauth.js +0 -90
- package/esm/src/dsl/http/versori/platformapi.d.ts +0 -19
- package/esm/src/dsl/http/versori/platformapi.d.ts.map +0 -1
- package/esm/src/dsl/http/versori/platformapi.js +0 -148
- package/esm/src/dsl/http/versori/proxyroundtripper.d.ts +0 -23
- package/esm/src/dsl/http/versori/proxyroundtripper.d.ts.map +0 -1
- package/esm/src/dsl/http/versori/proxyroundtripper.js +0 -196
- package/script/src/context/WorkflowClient.d.ts +0 -29
- package/script/src/context/WorkflowClient.d.ts.map +0 -1
- package/script/src/context/WorkflowClient.js +0 -99
- package/script/src/dsl/http/versori/activation.d.ts +0 -13
- package/script/src/dsl/http/versori/activation.d.ts.map +0 -1
- package/script/src/dsl/http/versori/activation.js +0 -69
- package/script/src/dsl/http/versori/cli.d.ts +0 -2
- package/script/src/dsl/http/versori/cli.d.ts.map +0 -1
- package/script/src/dsl/http/versori/cli.js +0 -23
- package/script/src/dsl/http/versori/constants.d.ts +0 -20
- package/script/src/dsl/http/versori/constants.d.ts.map +0 -1
- package/script/src/dsl/http/versori/constants.js +0 -28
- package/script/src/dsl/http/versori/internalauth.d.ts +0 -15
- package/script/src/dsl/http/versori/internalauth.d.ts.map +0 -1
- package/script/src/dsl/http/versori/internalauth.js +0 -94
- package/script/src/dsl/http/versori/platformapi.d.ts +0 -19
- package/script/src/dsl/http/versori/platformapi.d.ts.map +0 -1
- package/script/src/dsl/http/versori/platformapi.js +0 -152
- package/script/src/dsl/http/versori/proxyroundtripper.d.ts +0 -23
- package/script/src/dsl/http/versori/proxyroundtripper.d.ts.map +0 -1
- package/script/src/dsl/http/versori/proxyroundtripper.js +0 -200
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObservableCompiler.d.ts","sourceRoot":"","sources":["../../../../src/src/interpreter/memory/ObservableCompiler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"ObservableCompiler.d.ts","sourceRoot":"","sources":["../../../../src/src/interpreter/memory/ObservableCompiler.ts"],"names":[],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catch.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/memory/compilers/catch.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAG5D,OAAO,EAA2B,YAAY,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"catch.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/memory/compilers/catch.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAG5D,OAAO,EAA2B,YAAY,EAAE,MAAM,YAAY,CAAC;AAmFnE,eAAO,MAAM,aAAa,EAAE,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,CAGrE,CAAC"}
|
|
@@ -9,6 +9,7 @@ function compileCatch(compilerCtx, task) {
|
|
|
9
9
|
return compilerCtx.tracer.startActiveSpan(`catch`, (span) => {
|
|
10
10
|
span.setAttribute('execution.id', ctx.executionId);
|
|
11
11
|
span.setAttribute('task.type', 'catch');
|
|
12
|
+
span.setAttribute('type', 'task');
|
|
12
13
|
if (error instanceof Error) {
|
|
13
14
|
span.recordException(error);
|
|
14
15
|
span.setAttribute('error.message', error.message);
|
|
@@ -22,7 +23,7 @@ function compileCatch(compilerCtx, task) {
|
|
|
22
23
|
annotations: {
|
|
23
24
|
'error': error.message,
|
|
24
25
|
'stack': error.stack || '',
|
|
25
|
-
'workflowId': ctx.options.
|
|
26
|
+
'workflowId': ctx.options.workflowId || ctx.workflowId ||
|
|
26
27
|
'',
|
|
27
28
|
'executionId': ctx.executionId,
|
|
28
29
|
},
|
|
@@ -35,7 +36,7 @@ function compileCatch(compilerCtx, task) {
|
|
|
35
36
|
annotations: {
|
|
36
37
|
'error': error.message || '',
|
|
37
38
|
'stack': error.stack || '',
|
|
38
|
-
'workflowId': ctx.options.
|
|
39
|
+
'workflowId': ctx.options.workflowId || ctx.workflowId ||
|
|
39
40
|
'',
|
|
40
41
|
'executionId': ctx.executionId,
|
|
41
42
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fn.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/memory/compilers/fn.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fn.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/memory/compilers/fn.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAGtD,OAAO,EAA2B,YAAY,EAAE,MAAM,YAAY,CAAC;AAwCnE,eAAO,MAAM,UAAU,EAAE,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,CAG/D,CAAC"}
|
|
@@ -1,18 +1,31 @@
|
|
|
1
1
|
import { mergeMap, tap } from 'rxjs';
|
|
2
2
|
import { FnTask } from '../../../dsl/tasks/FnTask.js';
|
|
3
|
+
import { enabled as supervisorEnabled } from '../../../internal/supervisor.js';
|
|
3
4
|
function compileFn(compilerCtx, task) {
|
|
4
5
|
return (src) => src.pipe(tap({
|
|
5
6
|
complete: () => compilerCtx.log.debug('fn.complete')
|
|
6
7
|
}), mergeMap(async (ctx) => {
|
|
7
8
|
return await compilerCtx.tracer.startActiveSpan(`fn-${task.id}`, async (span) => {
|
|
8
9
|
span.setAttribute('task.id', task.id);
|
|
10
|
+
span.setAttribute('type', 'task');
|
|
11
|
+
span.setAttribute('task.type', 'fn');
|
|
9
12
|
span.setAttribute('execution.id', ctx.executionId);
|
|
10
|
-
|
|
13
|
+
try {
|
|
14
|
+
let result;
|
|
15
|
+
if (typeof ctx.idx === 'number') {
|
|
16
|
+
result = ctx.withData(await task._fn(ctx, ctx.idx));
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
result = ctx.withData(await task._fn(ctx));
|
|
20
|
+
}
|
|
21
|
+
if (supervisorEnabled) {
|
|
22
|
+
span.setAttribute('response.body', JSON.stringify(result.data));
|
|
23
|
+
}
|
|
24
|
+
return result;
|
|
25
|
+
}
|
|
26
|
+
finally {
|
|
11
27
|
span.end();
|
|
12
|
-
return ctx.withData(await task._fn(ctx, ctx.idx));
|
|
13
28
|
}
|
|
14
|
-
span.end();
|
|
15
|
-
return ctx.withData(await task._fn(ctx));
|
|
16
29
|
});
|
|
17
30
|
}));
|
|
18
31
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/memory/compilers/http.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/memory/compilers/http.ts"],"names":[],"mappings":"AAQA,OAAO,EAAmB,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAG/E,OAAO,EAA2B,YAAY,EAAE,MAAM,YAAY,CAAC;AAuGnE,eAAO,MAAM,YAAY,EAAE,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAG5E,CAAC"}
|
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
import { mergeMap } from 'rxjs';
|
|
2
2
|
import { tap } from 'rxjs/operators';
|
|
3
3
|
import { DynamicFetchFactory } from '../../../connection/DynamicFetchFactory.js';
|
|
4
|
+
import { FetchBuilder } from '../../../connection/internal/FetchBuilder.js';
|
|
4
5
|
import { StaticFetchFactory } from '../../../connection/StaticFetchFactory.js';
|
|
5
6
|
import { HttpContextImpl, HttpTaskImpl } from '../../../dsl/tasks/HttpTask.js';
|
|
7
|
+
import { enabled as supervisorEnabled } from '../../../internal/supervisor.js';
|
|
6
8
|
function compileHttp(compilerCtx, task) {
|
|
7
9
|
const cnxMap = compilerCtx.configReader.getCnxMapping(task.opts.connection);
|
|
8
10
|
let fetchFactory;
|
|
9
11
|
if (!cnxMap) {
|
|
10
12
|
compilerCtx.log.error(`Connection ${task.opts.connection} not found, using default fetch with no credentials`);
|
|
11
|
-
|
|
13
|
+
if (supervisorEnabled) {
|
|
14
|
+
fetchFactory = Promise.resolve(new StaticFetchFactory(new FetchBuilder(globalThis.fetch).build()));
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
fetchFactory = Promise.resolve(new StaticFetchFactory(globalThis.fetch));
|
|
18
|
+
}
|
|
12
19
|
}
|
|
13
20
|
else if (cnxMap.dynamic) {
|
|
14
21
|
fetchFactory = Promise.resolve(new DynamicFetchFactory(compilerCtx.cnxFactory, compilerCtx.platformApi, compilerCtx.organisationId, cnxMap.templateId));
|
|
@@ -22,7 +29,14 @@ function compileHttp(compilerCtx, task) {
|
|
|
22
29
|
throwOnError: true,
|
|
23
30
|
})
|
|
24
31
|
.then(({ data }) => Promise.all([compilerCtx.cnxFactory.fetcher(data), data.baseUrl ?? '']))
|
|
25
|
-
.then(([fetcher, baseUrl]) => new StaticFetchFactory(fetcher, baseUrl))
|
|
32
|
+
.then(([fetcher, baseUrl]) => new StaticFetchFactory(fetcher, baseUrl))
|
|
33
|
+
.catch((err) => {
|
|
34
|
+
compilerCtx.log.error(`Failed to get connection ${task.opts.connection}`, err);
|
|
35
|
+
if (supervisorEnabled) {
|
|
36
|
+
return new StaticFetchFactory(new FetchBuilder(globalThis.fetch).build());
|
|
37
|
+
}
|
|
38
|
+
throw err;
|
|
39
|
+
});
|
|
26
40
|
}
|
|
27
41
|
async function http(ctx) {
|
|
28
42
|
const [fetch, baseUrl] = await fetchFactory.then(ff => Promise.all([ff.fetcher(ctx), ff.baseUrl(ctx)]));
|
|
@@ -36,10 +50,15 @@ function compileHttp(compilerCtx, task) {
|
|
|
36
50
|
return compilerCtx.tracer.startActiveSpan(`http-${task.id}`, async (span) => {
|
|
37
51
|
span.setAttribute('task.id', task.id);
|
|
38
52
|
span.setAttribute('task.type', 'http');
|
|
53
|
+
span.setAttribute('type', 'task');
|
|
39
54
|
span.setAttribute('execution.id', ctx.executionId);
|
|
40
55
|
span.setAttribute('connection.name', task.opts.connection);
|
|
41
56
|
try {
|
|
42
|
-
|
|
57
|
+
let newCtx = await http(ctx);
|
|
58
|
+
if (supervisorEnabled) {
|
|
59
|
+
span.setAttribute('response.body', JSON.stringify(newCtx.data));
|
|
60
|
+
}
|
|
61
|
+
return newCtx;
|
|
43
62
|
}
|
|
44
63
|
catch (error) {
|
|
45
64
|
if (error instanceof Error) {
|
|
@@ -60,3 +79,14 @@ export const httpCompiler = {
|
|
|
60
79
|
ctor: HttpTaskImpl,
|
|
61
80
|
compile: compileHttp,
|
|
62
81
|
};
|
|
82
|
+
// `TypeError: Invalid URL: '/api/v1/echo/loca-test'
|
|
83
|
+
// at getSerialization (ext:deno_url/00_url.js:98:11)
|
|
84
|
+
// at new URL (ext:deno_url/00_url.js:405:27)
|
|
85
|
+
// at new Request (ext:deno_fetch/23_request.js:344:25)
|
|
86
|
+
// at ext:deno_fetch/26_fetch.js:374:29
|
|
87
|
+
// at new Promise (<anonymous>)
|
|
88
|
+
// at fetch (ext:deno_fetch/26_fetch.js:370:20)
|
|
89
|
+
// at HttpTaskImpl.fn (file:///Users/teodor/Documents/sdk-node/examples/webhook/local_wh.ts:6:31)
|
|
90
|
+
// at http (file:///Users/teodor/Documents/sdk-node/src/interpreter/memory/compilers/http.ts:66:35)
|
|
91
|
+
// at eventLoopTick (ext:core/01_core.js:179:7)
|
|
92
|
+
// at async file:///Users/teodor/Documents/sdk-node/src/interpreter/memory/compilers/http.ts:85:38`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schedule.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/memory/compilers/schedule.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"schedule.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/memory/compilers/schedule.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAQzF,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAyI7C,eAAO,MAAM,gBAAgB,EAAE,eAAe,CAAC,YAAY,EAAE,eAAe,CAG3E,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
|
-
import { envVarEnvId, envVarEnvironmentName, envVarOrgId, envVarProjectId, } from '../../../dsl/http/versori/constants.js';
|
|
3
2
|
import { ScheduleTrigger } from '../../../dsl/triggers/ScheduleTrigger.js';
|
|
3
|
+
import { envVarEnvId, envVarEnvironmentName, envVarOrgId, envVarProjectId, } from '../../../internal/constants.js';
|
|
4
4
|
function compileSchedule(ctx, trigger, signal) {
|
|
5
5
|
return new Observable((subscriber) => {
|
|
6
6
|
// Add HTTP endpoint for manual triggering
|
|
@@ -84,6 +84,7 @@ function compileSchedule(ctx, trigger, signal) {
|
|
|
84
84
|
await ctx.tracer.startActiveSpan(`schedule-${trigger.id}`, async (span) => {
|
|
85
85
|
span.setAttribute('task.id', trigger.id);
|
|
86
86
|
span.setAttribute('task.type', 'schedule');
|
|
87
|
+
span.setAttribute('type', 'task');
|
|
87
88
|
span.setAttribute('schedule', trigger.schedule);
|
|
88
89
|
span.setAttribute('project.id', projectId);
|
|
89
90
|
span.setAttribute('environment.id', environmentId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhook.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/memory/compilers/webhook.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webhook.d.ts","sourceRoot":"","sources":["../../../../../src/src/interpreter/memory/compilers/webhook.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAGtF,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAuD7C,eAAO,MAAM,eAAe,EAAE,eAAe,CAAC,WAAW,EAAE,cAAc,CA6SxE,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import cors from 'cors';
|
|
2
2
|
import express from 'express';
|
|
3
|
+
import xmlparser from 'express-xml-bodyparser';
|
|
3
4
|
import { pipeline } from 'node:stream/promises';
|
|
4
5
|
import { Observable } from 'rxjs';
|
|
5
6
|
import { createActIdDynamicWebhookMiddleware, createStaticWebhookMiddleware, createUserIdDynamicWebhookMiddleware, } from '../../../dsl/http/versori/webhookmiddleware.js';
|
|
6
7
|
import { WebhookTrigger } from '../../../dsl/triggers/WebhookTrigger.js';
|
|
7
8
|
import { envVarEnvId } from '../../../internal/constants.js';
|
|
8
|
-
import xmlparser from 'express-xml-bodyparser';
|
|
9
9
|
const xml2jsDefaults = {
|
|
10
10
|
explicitArray: false,
|
|
11
11
|
normalize: false,
|
|
@@ -105,6 +105,7 @@ export const webhookCompiler = {
|
|
|
105
105
|
ctx.webhookRouter.use(cors(corsOptions));
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
|
+
ctx.webhookRegistry.set(trigger.id, { method, path: `/${trigger.id}`, options: trigger.options });
|
|
108
109
|
// endpoint for sans user because I'm not quite sure how the dynamic routing works
|
|
109
110
|
ctx.webhookRouter[method](`/${trigger.id}`, createStaticWebhookMiddleware({
|
|
110
111
|
id: trigger.id,
|
|
@@ -119,6 +120,7 @@ export const webhookCompiler = {
|
|
|
119
120
|
await ctx.tracer.startActiveSpan(`webhook-${trigger.id}`, async (span) => {
|
|
120
121
|
span.setAttribute('task.id', trigger.id);
|
|
121
122
|
span.setAttribute('task.type', 'webhook');
|
|
123
|
+
span.setAttribute('type', 'task');
|
|
122
124
|
const staticActivation = res.locals.activation;
|
|
123
125
|
const executionCtx = ctx.contextProvider.create(staticActivation, req.body, ctxOptionsFn(req, res));
|
|
124
126
|
span.setAttribute('execution.id', executionCtx.executionId);
|
|
@@ -155,6 +157,7 @@ export const webhookCompiler = {
|
|
|
155
157
|
await ctx.tracer.startActiveSpan(`webhook-${trigger.id}`, async (span) => {
|
|
156
158
|
span.setAttribute('task.id', trigger.id);
|
|
157
159
|
span.setAttribute('task.type', 'webhook');
|
|
160
|
+
span.setAttribute('type', 'task');
|
|
158
161
|
span.setAttribute('user.id', req.params.userId);
|
|
159
162
|
const userId = req.params.userId;
|
|
160
163
|
// Right now we only support a user having one activation
|
|
@@ -211,6 +214,7 @@ export const webhookCompiler = {
|
|
|
211
214
|
await ctx.tracer.startActiveSpan(`webhook-${trigger.id}`, async (span) => {
|
|
212
215
|
span.setAttribute('task.id', trigger.id);
|
|
213
216
|
span.setAttribute('task.type', 'webhook');
|
|
217
|
+
span.setAttribute('type', 'task');
|
|
214
218
|
span.setAttribute('activation.id', req.params.activationId);
|
|
215
219
|
const activation = res.locals.activation;
|
|
216
220
|
const activationId = activation?.id ?? req.params.activationId;
|
package/esm/src/issues/Issues.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto';
|
|
2
|
-
import { envVarEnvId, envVarEnvironmentName, envVarOrgId, envVarOrgSlug, envVarProjectId, envVarSDKApiBaseURL, envVarVersion, } from '../
|
|
2
|
+
import { envVarEnvId, envVarEnvironmentName, envVarOrgId, envVarOrgSlug, envVarProjectId, envVarSDKApiBaseURL, envVarVersion, } from '../internal/constants.js';
|
|
3
3
|
export class IssueImpl {
|
|
4
4
|
constructor(log) {
|
|
5
5
|
Object.defineProperty(this, "baseUrl", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SDKKeyValue.d.ts","sourceRoot":"","sources":["../../../../src/src/kv/sdk/SDKKeyValue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,4DAA4D,CAAC;AAGjG,OAAO,EAAE,aAAa,EAAE,MAAM,sDAAsD,CAAC;AACrF,OAAO,EAAE,cAAc,EAAE,MAAM,uDAAuD,CAAC;AACvF,OAAO,EAAE,eAAe,EAAE,MAAM,wDAAwD,CAAC;AAEzF,qBAAa,WAAY,YAAW,QAAQ;IAC5B,OAAO,CAAC,QAAQ,CAAC,KAAK;IAAuB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAnD,KAAK,EAAE,mBAAmB,EAAmB,MAAM,EAAE,MAAM;IAElF,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,OAAO,GAAE,UAAU,CAAC,CAAC,CAAM,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"SDKKeyValue.d.ts","sourceRoot":"","sources":["../../../../src/src/kv/sdk/SDKKeyValue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,4DAA4D,CAAC;AAGjG,OAAO,EAAE,aAAa,EAAE,MAAM,sDAAsD,CAAC;AACrF,OAAO,EAAE,cAAc,EAAE,MAAM,uDAAuD,CAAC;AACvF,OAAO,EAAE,eAAe,EAAE,MAAM,wDAAwD,CAAC;AAEzF,qBAAa,WAAY,YAAW,QAAQ;IAC5B,OAAO,CAAC,QAAQ,CAAC,KAAK;IAAuB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAnD,KAAK,EAAE,mBAAmB,EAAmB,MAAM,EAAE,MAAM;IAElF,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,OAAO,GAAE,UAAU,CAAC,CAAC,CAAM,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;IAoBnF,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAYvD,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAU7C,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,eAAe,CAAC;IAUjD,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC;IAY9E,OAAO,CAAC,WAAW;CAGtB"}
|
|
@@ -19,13 +19,7 @@ export class SDKKeyValue {
|
|
|
19
19
|
try {
|
|
20
20
|
const k = this.generateKey(key instanceof Array ? key.join('/') : key);
|
|
21
21
|
const entry = await KvOperationsService.getKv(this.store.id, k);
|
|
22
|
-
|
|
23
|
-
if (options.throwOnNotFound) {
|
|
24
|
-
throw new Error('Key not found');
|
|
25
|
-
}
|
|
26
|
-
return undefined;
|
|
27
|
-
}
|
|
28
|
-
return JSON.parse(String(entry.value));
|
|
22
|
+
return entry.value;
|
|
29
23
|
}
|
|
30
24
|
catch (error) {
|
|
31
25
|
if (options.throwOnNotFound && error instanceof Error && error.message === 'Key not found') {
|
|
@@ -39,10 +33,10 @@ export class SDKKeyValue {
|
|
|
39
33
|
}
|
|
40
34
|
}
|
|
41
35
|
async set(key, value) {
|
|
42
|
-
const payload = JSON.stringify(value);
|
|
36
|
+
// const payload = JSON.stringify(value);
|
|
43
37
|
const k = this.generateKey(key instanceof Array ? key.join('/') : key);
|
|
44
38
|
await KvOperationsService.setKv(this.store.id, k, {
|
|
45
|
-
value:
|
|
39
|
+
value: value,
|
|
46
40
|
options: {}
|
|
47
41
|
});
|
|
48
42
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { DescService } from '@bufbuild/protobuf';
|
|
2
|
+
import { Client, Transport } from '@connectrpc/connect';
|
|
3
|
+
/**
|
|
4
|
+
* Create a gRPC client with retry logic for Deno's unsupported GOAWAY issue.
|
|
5
|
+
*
|
|
6
|
+
* This function makes use of ES6 Proxy classes to intercept method calls and retry on connection
|
|
7
|
+
* errors. Users must not mess with the returned client object or change the receiver (i.e. by
|
|
8
|
+
* using this client as the prototype for another object).
|
|
9
|
+
*
|
|
10
|
+
* This will also not work with gRPC streams, but could be extended to do so.
|
|
11
|
+
*
|
|
12
|
+
* @param service - The service descriptor.
|
|
13
|
+
* @returns A gRPC client with retry logic for connection errors.
|
|
14
|
+
*/
|
|
15
|
+
export declare function createConnectRpcClient<T extends DescService>(service: T, transportFn: () => Transport): Client<T>;
|
|
16
|
+
//# sourceMappingURL=createConnectRpcClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createConnectRpcClient.d.ts","sourceRoot":"","sources":["../../../src/src/services/createConnectRpcClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EACH,MAAM,EAIN,SAAS,EACZ,MAAM,qBAAqB,CAAC;AAM7B;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,WAAW,EACxD,OAAO,EAAE,CAAC,EACV,WAAW,EAAE,MAAM,SAAS,GAC7B,MAAM,CAAC,CAAC,CAAC,CAsEX"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Code, ConnectError, createClient as connectCreateClient, } from '@connectrpc/connect';
|
|
2
|
+
/**
|
|
3
|
+
* Create a gRPC client with retry logic for Deno's unsupported GOAWAY issue.
|
|
4
|
+
*
|
|
5
|
+
* This function makes use of ES6 Proxy classes to intercept method calls and retry on connection
|
|
6
|
+
* errors. Users must not mess with the returned client object or change the receiver (i.e. by
|
|
7
|
+
* using this client as the prototype for another object).
|
|
8
|
+
*
|
|
9
|
+
* This will also not work with gRPC streams, but could be extended to do so.
|
|
10
|
+
*
|
|
11
|
+
* @param service - The service descriptor.
|
|
12
|
+
* @returns A gRPC client with retry logic for connection errors.
|
|
13
|
+
*/
|
|
14
|
+
export function createConnectRpcClient(service, transportFn) {
|
|
15
|
+
function createClientInner() {
|
|
16
|
+
return connectCreateClient(service, transportFn());
|
|
17
|
+
}
|
|
18
|
+
const handler = {
|
|
19
|
+
get(target, prop, receiver) {
|
|
20
|
+
const original = Reflect.get(target.value, prop, receiver);
|
|
21
|
+
if (typeof original !== 'function') {
|
|
22
|
+
return original;
|
|
23
|
+
}
|
|
24
|
+
return (...args) => {
|
|
25
|
+
try {
|
|
26
|
+
const result = Reflect.apply(original, receiver, args);
|
|
27
|
+
// If promise-like, attach retry-once logic
|
|
28
|
+
if (result && typeof result.then === 'function') {
|
|
29
|
+
return result.catch((error) => {
|
|
30
|
+
if (!(error instanceof ConnectError)) {
|
|
31
|
+
throw error;
|
|
32
|
+
}
|
|
33
|
+
if (error.rawMessage.includes('connection error received: not a result of an error') &&
|
|
34
|
+
error.code === Code.Internal) {
|
|
35
|
+
// Recreate client and retry once
|
|
36
|
+
target.value = createClientInner();
|
|
37
|
+
const rebound = Reflect.get(target.value, prop, receiver);
|
|
38
|
+
return Reflect.apply(rebound, receiver, args);
|
|
39
|
+
}
|
|
40
|
+
throw error;
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
// Non-promise results (e.g., streaming iterables) are returned as-is
|
|
44
|
+
return result;
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
if (!(error instanceof ConnectError)) {
|
|
48
|
+
throw error;
|
|
49
|
+
}
|
|
50
|
+
if (error.rawMessage.includes('connection error received: not a result of an error') && error.code === Code.Internal) {
|
|
51
|
+
target.value = createClientInner();
|
|
52
|
+
const rebound = Reflect.get(target.value, prop, receiver);
|
|
53
|
+
return Reflect.apply(rebound, receiver, args);
|
|
54
|
+
}
|
|
55
|
+
throw error;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
return new Proxy({
|
|
61
|
+
value: createClientInner(),
|
|
62
|
+
}, handler);
|
|
63
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@versori/run",
|
|
3
|
-
"version": "v0.
|
|
3
|
+
"version": "v0.4.0-alpha.2",
|
|
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
|
"@types/express": "*",
|
|
34
36
|
"cors": "^2.8.5",
|
|
35
37
|
"express": "^4.18.3",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Client } from '@connectrpc/connect';
|
|
2
2
|
import { RequestHandler } from 'express';
|
|
3
3
|
import { Logger } from '../observability/mod.js';
|
|
4
|
-
import { credentialv1alpha1,
|
|
4
|
+
import { credentialv1alpha1, oauth1v1, tokensv1 } from '../services/credentials/mod.js';
|
|
5
5
|
import { Connection } from '../services/platform/mod.js';
|
|
6
6
|
import { HttpClientFactory } from './internal/HttpClientFactory.js';
|
|
7
7
|
import { ConnectionFactory, FetchLike } from './types.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DirectConnectionFactory.d.ts","sourceRoot":"","sources":["../../../src/src/connection/DirectConnectionFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"DirectConnectionFactory.d.ts","sourceRoot":"","sources":["../../../src/src/connection/DirectConnectionFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEjD,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AACxF,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAGpE,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE1D;;;;;;;GAOG;AACH,qBAAa,uBAAwB,YAAW,iBAAiB;IAKzD,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAClC,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAR3B,OAAO,CAAC,QAAQ,CAAC,yBAAyB,CAA4B;IACtE,OAAO,CAAC,QAAQ,CAAC,+BAA+B,CAA2B;gBAGtD,iBAAiB,EAAE,iBAAiB,EACpC,WAAW,EAAE,MAAM,CAAC,OAAO,kBAAkB,CAAC,iBAAiB,CAAC,EAChE,MAAM,EAAE,MAAM,CAAC,OAAO,QAAQ,CAAC,YAAY,CAAC,EAC5C,MAAM,EAAE,MAAM,CAAC,OAAO,QAAQ,CAAC,oBAAoB,CAAC,EACpD,MAAM,EAAE,MAAM;IAkBnC,OAAO,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC;IAI5C,OAAO,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,cAAc,CAAC;IAIjD,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,uBAAuB;CAiB1D"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DirectConnectionFactory = void 0;
|
|
4
|
-
const connect_1 = require("@connectrpc/connect");
|
|
5
4
|
const connect_node_1 = require("@connectrpc/connect-node");
|
|
5
|
+
const constants_js_1 = require("../internal/constants.js");
|
|
6
|
+
const createConnectRpcClient_js_1 = require("../services/createConnectRpcClient.js");
|
|
6
7
|
const mod_js_1 = require("../services/credentials/mod.js");
|
|
7
8
|
const HttpClientFactory_js_1 = require("./internal/HttpClientFactory.js");
|
|
8
9
|
const InboundConnectionFactory_js_1 = require("./internal/InboundConnectionFactory.js");
|
|
9
10
|
const OutboundConnectionFactory_js_1 = require("./internal/OutboundConnectionFactory.js");
|
|
10
|
-
const constants_js_1 = require("../internal/constants.js");
|
|
11
11
|
/**
|
|
12
12
|
* DirectConnectionFactory is used by actual {@link FetchFactory} and {@link ExpressHandlers} implementations to build a
|
|
13
13
|
* fetchers and handlers for a given connection.
|
|
@@ -73,12 +73,9 @@ class DirectConnectionFactory {
|
|
|
73
73
|
}
|
|
74
74
|
static fromEnv(logger) {
|
|
75
75
|
const baseUrl = Deno.env.get(constants_js_1.envVarCredsBaseURL) || 'http://localhost:9000';
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
});
|
|
79
|
-
const credentials = (0, connect_1.createClient)(mod_js_1.credentialv1alpha1.CredentialService, transport);
|
|
80
|
-
const tokens = (0, connect_1.createClient)(mod_js_1.tokensv1.TokenService, transport);
|
|
81
|
-
const oauth1 = (0, connect_1.createClient)(mod_js_1.oauth1v1.AuthorizationService, transport);
|
|
76
|
+
const credentials = (0, createConnectRpcClient_js_1.createConnectRpcClient)(mod_js_1.credentialv1alpha1.CredentialService, () => { return (0, connect_node_1.createGrpcTransport)({ baseUrl }); });
|
|
77
|
+
const tokens = (0, createConnectRpcClient_js_1.createConnectRpcClient)(mod_js_1.tokensv1.TokenService, () => { return (0, connect_node_1.createGrpcTransport)({ baseUrl }); });
|
|
78
|
+
const oauth1 = (0, createConnectRpcClient_js_1.createConnectRpcClient)(mod_js_1.oauth1v1.AuthorizationService, () => { return (0, connect_node_1.createGrpcTransport)({ baseUrl }); });
|
|
82
79
|
const httpClientFactory = new HttpClientFactory_js_1.HttpClientFactory();
|
|
83
80
|
return new DirectConnectionFactory(httpClientFactory, credentials, tokens, oauth1, logger);
|
|
84
81
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StaticFetchFactory.d.ts","sourceRoot":"","sources":["../../../src/src/connection/StaticFetchFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"StaticFetchFactory.d.ts","sourceRoot":"","sources":["../../../src/src/connection/StaticFetchFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyB,cAAc,EAAY,MAAM,SAAS,CAAC;AAC/E,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAMjE,qBAAa,kBAAmB,YAAW,wBAAwB;;gBAKnD,KAAK,EAAE,SAAS,EAAE,OAAO,GAAE,MAAW,EAAE,OAAO,CAAC,EAAE,cAAc;IAM5E,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC;IAInD,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IAIhD,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC;CAG3D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CredentialHolder.d.ts","sourceRoot":"","sources":["../../../../src/src/connection/internal/CredentialHolder.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CredentialHolder.d.ts","sourceRoot":"","sources":["../../../../src/src/connection/internal/CredentialHolder.ts"],"names":[],"mappings":"AAEA,wBAAgB,WAAW,IAAI,OAAO,CAErC;AAED;;GAEG;AACH,qBAAa,gBAAgB,CAAC,CAAC;;gBAOf,YAAY,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;IAMxF,GAAG,CAAC,OAAO,GAAE,OAAe,GAAG,OAAO,CAAC,CAAC,CAAC;IA0B/C,OAAO,IAAI,IAAI;CAgClB"}
|
|
@@ -35,8 +35,17 @@ class CredentialHolder {
|
|
|
35
35
|
this.refresh();
|
|
36
36
|
return __classPrivateFieldGet(this, _CredentialHolder_value, "f");
|
|
37
37
|
}
|
|
38
|
-
|
|
39
|
-
if
|
|
38
|
+
// if this.refresh returns a rejected promise we are stuck with it until a restart.
|
|
39
|
+
// the try/catch bellow just keeps on trying to refresh the token if this.#value is rejected.
|
|
40
|
+
//
|
|
41
|
+
// We might have to change this because if credentials has an issue we might just make that issue worse by pamming more requests
|
|
42
|
+
try {
|
|
43
|
+
const value = await __classPrivateFieldGet(this, _CredentialHolder_value, "f");
|
|
44
|
+
if (!__classPrivateFieldGet(this, _CredentialHolder_isValid, "f").call(this, value)) {
|
|
45
|
+
this.refresh();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
40
49
|
this.refresh();
|
|
41
50
|
}
|
|
42
51
|
// must return this.#value and not value, since calling `this.refresh()` above will replace
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { OutboundMiddleware, FetchLike } from '../types.js';
|
|
2
1
|
import { Connection } from '../../services/platform/mod.js';
|
|
2
|
+
import { FetchLike, OutboundMiddleware } from '../types.js';
|
|
3
3
|
/**
|
|
4
4
|
* FetchBuilder is used to build a fetch function which can be composed by multiple middlewares for
|
|
5
5
|
* modifying the request/response and makes the implementation of {@link ConnectionFetchFactory}
|
|
@@ -8,8 +8,9 @@ import { Connection } from '../../services/platform/mod.js';
|
|
|
8
8
|
export declare class FetchBuilder {
|
|
9
9
|
#private;
|
|
10
10
|
middlewares: OutboundMiddleware[];
|
|
11
|
-
constructor(fetch: FetchLike, cnx
|
|
11
|
+
constructor(fetch: FetchLike, cnx?: Connection);
|
|
12
12
|
use(fn: OutboundMiddleware): void;
|
|
13
13
|
build(): FetchLike;
|
|
14
|
+
private wrapWithTracing;
|
|
14
15
|
}
|
|
15
16
|
//# 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":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAG5D;;;;GAIG;AACH,qBAAa,YAAY;;IACrB,WAAW,EAAE,kBAAkB,EAAE,CAAC;gBAMtB,KAAK,EAAE,SAAS,EAAE,GAAG,CAAC,EAAE,UAAU;IAW9C,GAAG,CAAC,EAAE,EAAE,kBAAkB;IAI1B,KAAK,IAAI,SAAS;IAmBlB,OAAO,CAAC,eAAe;CAsE1B"}
|