@versori/run 0.3.0-beta.6 → 0.3.0-beta.9
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/{script/deps/jsr.io/@std/fs/1.0.19 → esm/deps/jsr.io/@std/fs/1.0.20}/exists.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/log/0.224.14/rotating_file_handler.js +1 -1
- package/esm/src/connection/DirectConnectionFactory.d.ts.map +1 -1
- package/esm/src/connection/DirectConnectionFactory.js +7 -4
- package/esm/src/connection/internal/CredentialHolder.d.ts.map +1 -1
- package/esm/src/connection/internal/CredentialHolder.js +2 -11
- package/esm/src/connection/internal/OutboundConnectionFactory.d.ts.map +1 -1
- package/esm/src/connection/internal/OutboundConnectionFactory.js +1 -0
- package/esm/src/context/AsyncWorkflow.js +1 -1
- package/esm/src/context/Context.d.ts +6 -7
- package/esm/src/context/Context.d.ts.map +1 -1
- package/esm/src/context/Context.js +13 -3
- package/esm/src/context/ContextProvider.d.ts +2 -0
- package/esm/src/context/ContextProvider.d.ts.map +1 -1
- package/esm/src/context/ContextProvider.js +5 -2
- package/esm/src/context/WorkflowClient.d.ts +29 -0
- package/esm/src/context/WorkflowClient.d.ts.map +1 -0
- package/esm/src/context/WorkflowClient.js +95 -0
- 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 +18 -10
- package/esm/src/dsl/tasks/HttpTask.d.ts +2 -1
- package/esm/src/dsl/tasks/HttpTask.d.ts.map +1 -1
- package/esm/src/dsl/tasks/HttpTask.js +3 -0
- package/esm/src/dsl/triggers/DurableTrigger.d.ts +0 -1
- package/esm/src/dsl/triggers/DurableTrigger.d.ts.map +1 -1
- package/esm/src/internal/InternalAuth.d.ts +0 -1
- package/esm/src/internal/InternalAuth.d.ts.map +1 -1
- package/esm/src/internal/InternalAuth.js +1 -14
- package/esm/src/interpreter/durable/DurableInterpreter.d.ts.map +1 -1
- package/esm/src/interpreter/durable/DurableInterpreter.js +2 -20
- package/esm/src/interpreter/durable/Queue.d.ts +24 -16
- package/esm/src/interpreter/durable/Queue.d.ts.map +1 -1
- package/esm/src/interpreter/durable/Queue.js +3 -4
- package/esm/src/interpreter/durable/compilers/catch.js +2 -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/memory/MemoryInterpreter.d.ts.map +1 -1
- package/esm/src/interpreter/memory/MemoryInterpreter.js +0 -1
- package/esm/src/interpreter/memory/compilers/catch.js +2 -2
- package/esm/src/kv/sdk/SDKKeyValue.d.ts.map +1 -1
- package/esm/src/kv/sdk/SDKKeyValue.js +9 -3
- package/package.json +1 -1
- package/{esm/deps/jsr.io/@std/fs/1.0.19 → script/deps/jsr.io/@std/fs/1.0.20}/exists.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/log/0.224.14/rotating_file_handler.js +1 -1
- package/script/src/connection/DirectConnectionFactory.d.ts.map +1 -1
- package/script/src/connection/DirectConnectionFactory.js +7 -4
- package/script/src/connection/internal/CredentialHolder.d.ts.map +1 -1
- package/script/src/connection/internal/CredentialHolder.js +2 -11
- package/script/src/connection/internal/OutboundConnectionFactory.d.ts.map +1 -1
- package/script/src/connection/internal/OutboundConnectionFactory.js +1 -0
- package/script/src/context/AsyncWorkflow.js +1 -1
- package/script/src/context/Context.d.ts +6 -7
- package/script/src/context/Context.d.ts.map +1 -1
- package/script/src/context/Context.js +13 -3
- package/script/src/context/ContextProvider.d.ts +2 -0
- package/script/src/context/ContextProvider.d.ts.map +1 -1
- package/script/src/context/ContextProvider.js +5 -2
- package/script/src/context/WorkflowClient.d.ts +29 -0
- package/script/src/context/WorkflowClient.d.ts.map +1 -0
- package/script/src/context/WorkflowClient.js +99 -0
- 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 +18 -10
- package/script/src/dsl/tasks/HttpTask.d.ts +2 -1
- package/script/src/dsl/tasks/HttpTask.d.ts.map +1 -1
- package/script/src/dsl/tasks/HttpTask.js +3 -0
- package/script/src/dsl/triggers/DurableTrigger.d.ts +0 -1
- package/script/src/dsl/triggers/DurableTrigger.d.ts.map +1 -1
- package/script/src/internal/InternalAuth.d.ts +0 -1
- package/script/src/internal/InternalAuth.d.ts.map +1 -1
- package/script/src/internal/InternalAuth.js +0 -13
- package/script/src/interpreter/durable/DurableInterpreter.d.ts.map +1 -1
- package/script/src/interpreter/durable/DurableInterpreter.js +1 -19
- package/script/src/interpreter/durable/Queue.d.ts +24 -16
- package/script/src/interpreter/durable/Queue.d.ts.map +1 -1
- package/script/src/interpreter/durable/Queue.js +3 -4
- package/script/src/interpreter/durable/compilers/catch.js +2 -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/memory/MemoryInterpreter.d.ts.map +1 -1
- package/script/src/interpreter/memory/MemoryInterpreter.js +0 -1
- package/script/src/interpreter/memory/compilers/catch.js +2 -2
- package/script/src/kv/sdk/SDKKeyValue.d.ts.map +1 -1
- package/script/src/kv/sdk/SDKKeyValue.js +9 -3
- package/esm/src/internal/cli.d.ts +0 -2
- package/esm/src/internal/cli.d.ts.map +0 -1
- package/esm/src/internal/cli.js +0 -20
- package/esm/src/services/createConnectRpcClient.d.ts +0 -16
- package/esm/src/services/createConnectRpcClient.d.ts.map +0 -1
- package/esm/src/services/createConnectRpcClient.js +0 -63
- package/script/src/internal/cli.d.ts +0 -2
- package/script/src/internal/cli.d.ts.map +0 -1
- package/script/src/internal/cli.js +0 -23
- package/script/src/services/createConnectRpcClient.d.ts +0 -16
- package/script/src/services/createConnectRpcClient.d.ts.map +0 -1
- package/script/src/services/createConnectRpcClient.js +0 -66
- /package/esm/deps/jsr.io/@std/fs/{1.0.19 → 1.0.20}/exists.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/fs/{1.0.19 → 1.0.20}/exists.js +0 -0
- /package/script/deps/jsr.io/@std/fs/{1.0.19 → 1.0.20}/exists.d.ts +0 -0
- /package/script/deps/jsr.io/@std/fs/{1.0.19 → 1.0.20}/exists.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MemoryInterpreter.d.ts","sourceRoot":"","sources":["../../../../src/src/interpreter/memory/MemoryInterpreter.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,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AACtF,OAAO,EAAE,eAAe,EAAuB,MAAM,kCAAkC,CAAC;AAExF,OAAO,
|
|
1
|
+
{"version":3,"file":"MemoryInterpreter.d.ts","sourceRoot":"","sources":["../../../../src/src/interpreter/memory/MemoryInterpreter.ts"],"names":[],"mappings":"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"}
|
|
@@ -25,7 +25,7 @@ function compileCatch(compilerCtx, task) {
|
|
|
25
25
|
annotations: {
|
|
26
26
|
'error': error.message,
|
|
27
27
|
'stack': error.stack || '',
|
|
28
|
-
'workflowId': ctx.options.
|
|
28
|
+
'workflowId': ctx.options.workflow?.id || ctx.workflow?.id ||
|
|
29
29
|
'',
|
|
30
30
|
'executionId': ctx.executionId,
|
|
31
31
|
},
|
|
@@ -38,7 +38,7 @@ function compileCatch(compilerCtx, task) {
|
|
|
38
38
|
annotations: {
|
|
39
39
|
'error': error.message || '',
|
|
40
40
|
'stack': error.stack || '',
|
|
41
|
-
'workflowId': ctx.options.
|
|
41
|
+
'workflowId': ctx.options.workflow?.id || ctx.workflow?.id ||
|
|
42
42
|
'',
|
|
43
43
|
'executionId': ctx.executionId,
|
|
44
44
|
},
|
|
@@ -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;IA2BnF,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"}
|
|
@@ -22,7 +22,13 @@ class SDKKeyValue {
|
|
|
22
22
|
try {
|
|
23
23
|
const k = this.generateKey(key instanceof Array ? key.join('/') : key);
|
|
24
24
|
const entry = await KvOperationsService_js_1.KvOperationsService.getKv(this.store.id, k);
|
|
25
|
-
|
|
25
|
+
if (entry.value === undefined) {
|
|
26
|
+
if (options.throwOnNotFound) {
|
|
27
|
+
throw new Error('Key not found');
|
|
28
|
+
}
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
return JSON.parse(String(entry.value));
|
|
26
32
|
}
|
|
27
33
|
catch (error) {
|
|
28
34
|
if (options.throwOnNotFound && error instanceof Error && error.message === 'Key not found') {
|
|
@@ -36,10 +42,10 @@ class SDKKeyValue {
|
|
|
36
42
|
}
|
|
37
43
|
}
|
|
38
44
|
async set(key, value) {
|
|
39
|
-
|
|
45
|
+
const payload = JSON.stringify(value);
|
|
40
46
|
const k = this.generateKey(key instanceof Array ? key.join('/') : key);
|
|
41
47
|
await KvOperationsService_js_1.KvOperationsService.setKv(this.store.id, k, {
|
|
42
|
-
value:
|
|
48
|
+
value: payload,
|
|
43
49
|
options: {}
|
|
44
50
|
});
|
|
45
51
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../../src/src/internal/cli.ts"],"names":[],"mappings":"AAiBA,wBAAgB,gBAAgB,IAAI,MAAM,CAoBzC"}
|
package/esm/src/internal/cli.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// This file contains functions that can read stuff generated by the Versori CLI. This is used when running locally.
|
|
2
|
-
import { homedir } from 'node:os';
|
|
3
|
-
const cookiesFileName = 'cookies.json';
|
|
4
|
-
const versoriCookieName = 'versori_sess';
|
|
5
|
-
export function getVersoriCookie() {
|
|
6
|
-
const cookiesFilePath = `${homedir()}/.config/versori/${cookiesFileName}`;
|
|
7
|
-
let cookiesFile;
|
|
8
|
-
try {
|
|
9
|
-
cookiesFile = JSON.parse(Deno.readTextFileSync(cookiesFilePath));
|
|
10
|
-
}
|
|
11
|
-
catch (e) {
|
|
12
|
-
console.error('Error reading file, have you run the Versori CLI to log in?');
|
|
13
|
-
throw new Error(`Failed to read or parse cookies file at ${cookiesFilePath}: ${e}`);
|
|
14
|
-
}
|
|
15
|
-
const versoriCookie = cookiesFile.cookies.find(cookie => cookie.Name === versoriCookieName);
|
|
16
|
-
if (!versoriCookie) {
|
|
17
|
-
throw new Error(`Cookie 'versori_sess' not found in ${cookiesFilePath}`);
|
|
18
|
-
}
|
|
19
|
-
return `${versoriCookieName}=${versoriCookie.Value}`;
|
|
20
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,63 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../../src/src/internal/cli.ts"],"names":[],"mappings":"AAiBA,wBAAgB,gBAAgB,IAAI,MAAM,CAoBzC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// This file contains functions that can read stuff generated by the Versori CLI. This is used when running locally.
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.getVersoriCookie = getVersoriCookie;
|
|
5
|
-
const node_os_1 = require("node:os");
|
|
6
|
-
const cookiesFileName = 'cookies.json';
|
|
7
|
-
const versoriCookieName = 'versori_sess';
|
|
8
|
-
function getVersoriCookie() {
|
|
9
|
-
const cookiesFilePath = `${(0, node_os_1.homedir)()}/.config/versori/${cookiesFileName}`;
|
|
10
|
-
let cookiesFile;
|
|
11
|
-
try {
|
|
12
|
-
cookiesFile = JSON.parse(Deno.readTextFileSync(cookiesFilePath));
|
|
13
|
-
}
|
|
14
|
-
catch (e) {
|
|
15
|
-
console.error('Error reading file, have you run the Versori CLI to log in?');
|
|
16
|
-
throw new Error(`Failed to read or parse cookies file at ${cookiesFilePath}: ${e}`);
|
|
17
|
-
}
|
|
18
|
-
const versoriCookie = cookiesFile.cookies.find(cookie => cookie.Name === versoriCookieName);
|
|
19
|
-
if (!versoriCookie) {
|
|
20
|
-
throw new Error(`Cookie 'versori_sess' not found in ${cookiesFilePath}`);
|
|
21
|
-
}
|
|
22
|
-
return `${versoriCookieName}=${versoriCookie.Value}`;
|
|
23
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createConnectRpcClient = createConnectRpcClient;
|
|
4
|
-
const connect_1 = require("@connectrpc/connect");
|
|
5
|
-
/**
|
|
6
|
-
* Create a gRPC client with retry logic for Deno's unsupported GOAWAY issue.
|
|
7
|
-
*
|
|
8
|
-
* This function makes use of ES6 Proxy classes to intercept method calls and retry on connection
|
|
9
|
-
* errors. Users must not mess with the returned client object or change the receiver (i.e. by
|
|
10
|
-
* using this client as the prototype for another object).
|
|
11
|
-
*
|
|
12
|
-
* This will also not work with gRPC streams, but could be extended to do so.
|
|
13
|
-
*
|
|
14
|
-
* @param service - The service descriptor.
|
|
15
|
-
* @returns A gRPC client with retry logic for connection errors.
|
|
16
|
-
*/
|
|
17
|
-
function createConnectRpcClient(service, transportFn) {
|
|
18
|
-
function createClientInner() {
|
|
19
|
-
return (0, connect_1.createClient)(service, transportFn());
|
|
20
|
-
}
|
|
21
|
-
const handler = {
|
|
22
|
-
get(target, prop, receiver) {
|
|
23
|
-
const original = Reflect.get(target.value, prop, receiver);
|
|
24
|
-
if (typeof original !== 'function') {
|
|
25
|
-
return original;
|
|
26
|
-
}
|
|
27
|
-
return (...args) => {
|
|
28
|
-
try {
|
|
29
|
-
const result = Reflect.apply(original, receiver, args);
|
|
30
|
-
// If promise-like, attach retry-once logic
|
|
31
|
-
if (result && typeof result.then === 'function') {
|
|
32
|
-
return result.catch((error) => {
|
|
33
|
-
if (!(error instanceof connect_1.ConnectError)) {
|
|
34
|
-
throw error;
|
|
35
|
-
}
|
|
36
|
-
if (error.rawMessage.includes('connection error received: not a result of an error') &&
|
|
37
|
-
error.code === connect_1.Code.Internal) {
|
|
38
|
-
// Recreate client and retry once
|
|
39
|
-
target.value = createClientInner();
|
|
40
|
-
const rebound = Reflect.get(target.value, prop, receiver);
|
|
41
|
-
return Reflect.apply(rebound, receiver, args);
|
|
42
|
-
}
|
|
43
|
-
throw error;
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
// Non-promise results (e.g., streaming iterables) are returned as-is
|
|
47
|
-
return result;
|
|
48
|
-
}
|
|
49
|
-
catch (error) {
|
|
50
|
-
if (!(error instanceof connect_1.ConnectError)) {
|
|
51
|
-
throw error;
|
|
52
|
-
}
|
|
53
|
-
if (error.rawMessage.includes('connection error received: not a result of an error') && error.code === connect_1.Code.Internal) {
|
|
54
|
-
target.value = createClientInner();
|
|
55
|
-
const rebound = Reflect.get(target.value, prop, receiver);
|
|
56
|
-
return Reflect.apply(rebound, receiver, args);
|
|
57
|
-
}
|
|
58
|
-
throw error;
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
},
|
|
62
|
-
};
|
|
63
|
-
return new Proxy({
|
|
64
|
-
value: createClientInner(),
|
|
65
|
-
}, handler);
|
|
66
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|