@versori/run 0.2.0-alpha.9 → 0.2.1-alpha.0
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/bytes/1.0.5 → esm/deps/jsr.io/@std/bytes/1.0.6}/_types.d.ts.map +1 -1
- package/{script/deps/jsr.io/@std/bytes/1.0.5 → esm/deps/jsr.io/@std/bytes/1.0.6}/concat.d.ts +1 -1
- package/esm/deps/jsr.io/@std/bytes/{1.0.5 → 1.0.6}/concat.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/bytes/{1.0.5 → 1.0.6}/copy.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/fmt/{1.0.7 → 1.0.8}/colors.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/io/0.225.2/buffer.js +1 -1
- package/esm/deps/jsr.io/@std/io/0.225.2/read_all.js +1 -1
- package/esm/deps/jsr.io/@std/log/0.224.14/base_handler.d.ts +21 -0
- package/esm/deps/jsr.io/@std/log/0.224.14/base_handler.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/log/0.224.14/console_handler.js +1 -1
- package/esm/src/context/Context.d.ts +17 -24
- package/esm/src/context/Context.d.ts.map +1 -1
- package/esm/src/context/Context.js +23 -8
- package/esm/src/context/ContextProvider.d.ts +6 -4
- package/esm/src/context/ContextProvider.d.ts.map +1 -1
- package/esm/src/context/ContextProvider.js +9 -2
- package/esm/src/dsl/http/default.d.ts +2 -0
- package/esm/src/dsl/http/default.d.ts.map +1 -1
- package/esm/src/dsl/http/default.js +10 -0
- package/esm/src/dsl/http/versori/contextcredentials.d.ts +10 -0
- package/esm/src/dsl/http/versori/contextcredentials.d.ts.map +1 -0
- package/esm/src/dsl/http/versori/contextcredentials.js +1 -0
- package/esm/src/dsl/http/versori/credentials/client.d.ts +3 -0
- package/esm/src/dsl/http/versori/credentials/client.d.ts.map +1 -1
- package/esm/src/dsl/http/versori/credentials/client.js +11 -3
- package/esm/src/dsl/http/versori/credentials/credentials.d.ts +41 -2
- package/esm/src/dsl/http/versori/credentials/credentials.d.ts.map +1 -1
- package/esm/src/dsl/http/versori/credentials/credentials.js +7 -9
- package/esm/src/dsl/http/versori/credentials/v1alpha1/common_pb.d.ts +31 -0
- package/esm/src/dsl/http/versori/credentials/v1alpha1/common_pb.d.ts.map +1 -0
- package/esm/src/dsl/http/versori/credentials/v1alpha1/common_pb.js +31 -0
- package/esm/src/dsl/http/versori/credentials/v1alpha1/credential_service_pb.d.ts +84 -0
- package/esm/src/dsl/http/versori/credentials/v1alpha1/credential_service_pb.d.ts.map +1 -0
- package/esm/src/dsl/http/versori/credentials/v1alpha1/credential_service_pb.js +128 -0
- package/esm/src/dsl/http/versori/roundtripper.d.ts +14 -7
- package/esm/src/dsl/http/versori/roundtripper.d.ts.map +1 -1
- package/esm/src/dsl/http/versori/roundtripper.js +132 -72
- package/esm/src/dsl/tasks/HttpTask.d.ts +13 -4
- package/esm/src/dsl/tasks/HttpTask.d.ts.map +1 -1
- package/esm/src/dsl/tasks/HttpTask.js +42 -21
- package/esm/src/interpreter/memory/MemoryInterpreter.d.ts.map +1 -1
- package/esm/src/interpreter/memory/MemoryInterpreter.js +11 -3
- package/esm/src/interpreter/memory/compilers/schedule.d.ts.map +1 -1
- package/esm/src/interpreter/memory/compilers/schedule.js +1 -1
- package/esm/src/interpreter/memory/compilers/webhook.js +1 -1
- package/esm/src/kv/nats/NatsKeyValueProvider.d.ts +1 -0
- package/esm/src/kv/nats/NatsKeyValueProvider.d.ts.map +1 -1
- package/esm/src/observability/logging/ConsoleLogger.d.ts +1 -0
- package/esm/src/observability/logging/ConsoleLogger.d.ts.map +1 -1
- package/esm/src/observability/logging/ConsoleLogger.js +124 -30
- package/package.json +3 -2
- package/{esm/deps/jsr.io/@std/bytes/1.0.5 → script/deps/jsr.io/@std/bytes/1.0.6}/_types.d.ts.map +1 -1
- package/{esm/deps/jsr.io/@std/bytes/1.0.5 → script/deps/jsr.io/@std/bytes/1.0.6}/concat.d.ts +1 -1
- package/script/deps/jsr.io/@std/bytes/{1.0.5 → 1.0.6}/concat.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/bytes/{1.0.5 → 1.0.6}/copy.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/fmt/{1.0.7 → 1.0.8}/colors.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/io/0.225.2/buffer.js +1 -1
- package/script/deps/jsr.io/@std/io/0.225.2/read_all.js +1 -1
- package/script/deps/jsr.io/@std/log/0.224.14/base_handler.d.ts +21 -0
- package/script/deps/jsr.io/@std/log/0.224.14/base_handler.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/log/0.224.14/console_handler.js +1 -1
- package/script/src/context/Context.d.ts +17 -24
- package/script/src/context/Context.d.ts.map +1 -1
- package/script/src/context/Context.js +23 -8
- package/script/src/context/ContextProvider.d.ts +6 -4
- package/script/src/context/ContextProvider.d.ts.map +1 -1
- package/script/src/context/ContextProvider.js +9 -2
- package/script/src/dsl/http/default.d.ts +2 -0
- package/script/src/dsl/http/default.d.ts.map +1 -1
- package/script/src/dsl/http/default.js +10 -0
- package/script/src/dsl/http/versori/contextcredentials.d.ts +10 -0
- package/script/src/dsl/http/versori/contextcredentials.d.ts.map +1 -0
- package/script/src/dsl/http/versori/contextcredentials.js +2 -0
- package/script/src/dsl/http/versori/credentials/client.d.ts +3 -0
- package/script/src/dsl/http/versori/credentials/client.d.ts.map +1 -1
- package/script/src/dsl/http/versori/credentials/client.js +10 -0
- package/script/src/dsl/http/versori/credentials/credentials.d.ts +41 -2
- package/script/src/dsl/http/versori/credentials/credentials.d.ts.map +1 -1
- package/script/src/dsl/http/versori/credentials/credentials.js +8 -9
- package/script/src/dsl/http/versori/credentials/v1alpha1/common_pb.d.ts +31 -0
- package/script/src/dsl/http/versori/credentials/v1alpha1/common_pb.d.ts.map +1 -0
- package/script/src/dsl/http/versori/credentials/v1alpha1/common_pb.js +34 -0
- package/script/src/dsl/http/versori/credentials/v1alpha1/credential_service_pb.d.ts +84 -0
- package/script/src/dsl/http/versori/credentials/v1alpha1/credential_service_pb.d.ts.map +1 -0
- package/script/src/dsl/http/versori/credentials/v1alpha1/credential_service_pb.js +131 -0
- package/script/src/dsl/http/versori/roundtripper.d.ts +14 -7
- package/script/src/dsl/http/versori/roundtripper.d.ts.map +1 -1
- package/script/src/dsl/http/versori/roundtripper.js +137 -77
- package/script/src/dsl/tasks/HttpTask.d.ts +13 -4
- package/script/src/dsl/tasks/HttpTask.d.ts.map +1 -1
- package/script/src/dsl/tasks/HttpTask.js +42 -21
- package/script/src/interpreter/memory/MemoryInterpreter.d.ts.map +1 -1
- package/script/src/interpreter/memory/MemoryInterpreter.js +10 -2
- package/script/src/interpreter/memory/compilers/schedule.d.ts.map +1 -1
- package/script/src/interpreter/memory/compilers/schedule.js +1 -1
- package/script/src/interpreter/memory/compilers/webhook.js +1 -1
- package/script/src/kv/nats/NatsKeyValueProvider.d.ts +1 -0
- package/script/src/kv/nats/NatsKeyValueProvider.d.ts.map +1 -1
- package/script/src/observability/logging/ConsoleLogger.d.ts +1 -0
- package/script/src/observability/logging/ConsoleLogger.d.ts.map +1 -1
- package/script/src/observability/logging/ConsoleLogger.js +124 -30
- /package/esm/deps/jsr.io/@std/bytes/{1.0.5 → 1.0.6}/_types.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/bytes/{1.0.5 → 1.0.6}/_types.js +0 -0
- /package/esm/deps/jsr.io/@std/bytes/{1.0.5 → 1.0.6}/concat.js +0 -0
- /package/esm/deps/jsr.io/@std/bytes/{1.0.5 → 1.0.6}/copy.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/bytes/{1.0.5 → 1.0.6}/copy.js +0 -0
- /package/esm/deps/jsr.io/@std/fmt/{1.0.7 → 1.0.8}/colors.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/fmt/{1.0.7 → 1.0.8}/colors.js +0 -0
- /package/script/deps/jsr.io/@std/bytes/{1.0.5 → 1.0.6}/_types.d.ts +0 -0
- /package/script/deps/jsr.io/@std/bytes/{1.0.5 → 1.0.6}/_types.js +0 -0
- /package/script/deps/jsr.io/@std/bytes/{1.0.5 → 1.0.6}/concat.js +0 -0
- /package/script/deps/jsr.io/@std/bytes/{1.0.5 → 1.0.6}/copy.d.ts +0 -0
- /package/script/deps/jsr.io/@std/bytes/{1.0.5 → 1.0.6}/copy.js +0 -0
- /package/script/deps/jsr.io/@std/fmt/{1.0.7 → 1.0.8}/colors.d.ts +0 -0
- /package/script/deps/jsr.io/@std/fmt/{1.0.7 → 1.0.8}/colors.js +0 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Describes the file versori/credential/v1alpha1/credential_service.proto.
|
|
3
|
+
*/
|
|
4
|
+
export const file_versori_credential_v1alpha1_credential_service: import("@bufbuild/protobuf").DescFile;
|
|
5
|
+
/**
|
|
6
|
+
* Describes the message versori.credential.v1alpha1.CreateCredentialRequest.
|
|
7
|
+
* Use `create(CreateCredentialRequestSchema)` to create a new message.
|
|
8
|
+
*/
|
|
9
|
+
export const CreateCredentialRequestSchema: import("@bufbuild/protobuf/codegenv1").GenMessage<import("@bufbuild/protobuf").Message, import("@bufbuild/protobuf").JsonValue>;
|
|
10
|
+
/**
|
|
11
|
+
* Describes the message versori.credential.v1alpha1.CreateCredentialResponse.
|
|
12
|
+
* Use `create(CreateCredentialResponseSchema)` to create a new message.
|
|
13
|
+
*/
|
|
14
|
+
export const CreateCredentialResponseSchema: import("@bufbuild/protobuf/codegenv1").GenMessage<import("@bufbuild/protobuf").Message, import("@bufbuild/protobuf").JsonValue>;
|
|
15
|
+
/**
|
|
16
|
+
* Describes the message versori.credential.v1alpha1.GetCredentialRequest.
|
|
17
|
+
* Use `create(GetCredentialRequestSchema)` to create a new message.
|
|
18
|
+
*/
|
|
19
|
+
export const GetCredentialRequestSchema: import("@bufbuild/protobuf/codegenv1").GenMessage<import("@bufbuild/protobuf").Message, import("@bufbuild/protobuf").JsonValue>;
|
|
20
|
+
/**
|
|
21
|
+
* Describes the message versori.credential.v1alpha1.GetCredentialResponse.
|
|
22
|
+
* Use `create(GetCredentialResponseSchema)` to create a new message.
|
|
23
|
+
*/
|
|
24
|
+
export const GetCredentialResponseSchema: import("@bufbuild/protobuf/codegenv1").GenMessage<import("@bufbuild/protobuf").Message, import("@bufbuild/protobuf").JsonValue>;
|
|
25
|
+
/**
|
|
26
|
+
* Describes the message versori.credential.v1alpha1.GetManyCredentialsRequest.
|
|
27
|
+
* Use `create(GetManyCredentialsRequestSchema)` to create a new message.
|
|
28
|
+
*/
|
|
29
|
+
export const GetManyCredentialsRequestSchema: import("@bufbuild/protobuf/codegenv1").GenMessage<import("@bufbuild/protobuf").Message, import("@bufbuild/protobuf").JsonValue>;
|
|
30
|
+
/**
|
|
31
|
+
* Describes the message versori.credential.v1alpha1.GetManyCredentialsResponse.
|
|
32
|
+
* Use `create(GetManyCredentialsResponseSchema)` to create a new message.
|
|
33
|
+
*/
|
|
34
|
+
export const GetManyCredentialsResponseSchema: import("@bufbuild/protobuf/codegenv1").GenMessage<import("@bufbuild/protobuf").Message, import("@bufbuild/protobuf").JsonValue>;
|
|
35
|
+
/**
|
|
36
|
+
* Describes the message versori.credential.v1alpha1.ListCredentialsRequest.
|
|
37
|
+
* Use `create(ListCredentialsRequestSchema)` to create a new message.
|
|
38
|
+
*/
|
|
39
|
+
export const ListCredentialsRequestSchema: import("@bufbuild/protobuf/codegenv1").GenMessage<import("@bufbuild/protobuf").Message, import("@bufbuild/protobuf").JsonValue>;
|
|
40
|
+
/**
|
|
41
|
+
* Describes the message versori.credential.v1alpha1.ListCredentialsResponse.
|
|
42
|
+
* Use `create(ListCredentialsResponseSchema)` to create a new message.
|
|
43
|
+
*/
|
|
44
|
+
export const ListCredentialsResponseSchema: import("@bufbuild/protobuf/codegenv1").GenMessage<import("@bufbuild/protobuf").Message, import("@bufbuild/protobuf").JsonValue>;
|
|
45
|
+
/**
|
|
46
|
+
* Describes the message versori.credential.v1alpha1.UpdateCredentialRequest.
|
|
47
|
+
* Use `create(UpdateCredentialRequestSchema)` to create a new message.
|
|
48
|
+
*/
|
|
49
|
+
export const UpdateCredentialRequestSchema: import("@bufbuild/protobuf/codegenv1").GenMessage<import("@bufbuild/protobuf").Message, import("@bufbuild/protobuf").JsonValue>;
|
|
50
|
+
/**
|
|
51
|
+
* Describes the message versori.credential.v1alpha1.UpdateCredentialResponse.
|
|
52
|
+
* Use `create(UpdateCredentialResponseSchema)` to create a new message.
|
|
53
|
+
*/
|
|
54
|
+
export const UpdateCredentialResponseSchema: import("@bufbuild/protobuf/codegenv1").GenMessage<import("@bufbuild/protobuf").Message, import("@bufbuild/protobuf").JsonValue>;
|
|
55
|
+
/**
|
|
56
|
+
* Describes the message versori.credential.v1alpha1.DeleteCredentialRequest.
|
|
57
|
+
* Use `create(DeleteCredentialRequestSchema)` to create a new message.
|
|
58
|
+
*/
|
|
59
|
+
export const DeleteCredentialRequestSchema: import("@bufbuild/protobuf/codegenv1").GenMessage<import("@bufbuild/protobuf").Message, import("@bufbuild/protobuf").JsonValue>;
|
|
60
|
+
/**
|
|
61
|
+
* Describes the message versori.credential.v1alpha1.DeleteCredentialResponse.
|
|
62
|
+
* Use `create(DeleteCredentialResponseSchema)` to create a new message.
|
|
63
|
+
*/
|
|
64
|
+
export const DeleteCredentialResponseSchema: import("@bufbuild/protobuf/codegenv1").GenMessage<import("@bufbuild/protobuf").Message, import("@bufbuild/protobuf").JsonValue>;
|
|
65
|
+
/**
|
|
66
|
+
* Describes the message versori.credential.v1alpha1.ValidateCredentialRequest.
|
|
67
|
+
* Use `create(ValidateCredentialRequestSchema)` to create a new message.
|
|
68
|
+
*/
|
|
69
|
+
export const ValidateCredentialRequestSchema: import("@bufbuild/protobuf/codegenv1").GenMessage<import("@bufbuild/protobuf").Message, import("@bufbuild/protobuf").JsonValue>;
|
|
70
|
+
/**
|
|
71
|
+
* Describes the message versori.credential.v1alpha1.ValidateCredentialResponse.
|
|
72
|
+
* Use `create(ValidateCredentialResponseSchema)` to create a new message.
|
|
73
|
+
*/
|
|
74
|
+
export const ValidateCredentialResponseSchema: import("@bufbuild/protobuf/codegenv1").GenMessage<import("@bufbuild/protobuf").Message, import("@bufbuild/protobuf").JsonValue>;
|
|
75
|
+
/**
|
|
76
|
+
* Describes the message versori.credential.v1alpha1.ValidateCredentialResponse.ValidationError.
|
|
77
|
+
* Use `create(ValidateCredentialResponse_ValidationErrorSchema)` to create a new message.
|
|
78
|
+
*/
|
|
79
|
+
export const ValidateCredentialResponse_ValidationErrorSchema: import("@bufbuild/protobuf/codegenv1").GenMessage<import("@bufbuild/protobuf").Message, import("@bufbuild/protobuf").JsonValue>;
|
|
80
|
+
/**
|
|
81
|
+
* @generated from service versori.credential.v1alpha1.CredentialService
|
|
82
|
+
*/
|
|
83
|
+
export const CredentialService: import("@bufbuild/protobuf/codegenv1").GenService<import("@bufbuild/protobuf/codegenv1").GenServiceMethods>;
|
|
84
|
+
//# sourceMappingURL=credential_service_pb.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credential_service_pb.d.ts","sourceRoot":"","sources":["../../../../../../../src/src/dsl/http/versori/credentials/v1alpha1/credential_service_pb.js"],"names":[],"mappings":"AASA;;GAEG;AACH,wGASM;AAEN;;;GAGG;AACH,4KAEwE;AAExE;;;GAGG;AACH,6KAEwE;AAExE;;;GAGG;AACH,yKAEwE;AAExE;;;GAGG;AACH,0KAEwE;AAExE;;;GAGG;AACH,8KAEwE;AAExE;;;GAGG;AACH,+KAEwE;AAExE;;;GAGG;AACH,2KAEwE;AAExE;;;GAGG;AACH,4KAEwE;AAExE;;;GAGG;AACH,4KAEwE;AAExE;;;GAGG;AACH,6KAEwE;AAExE;;;GAGG;AACH,4KAEyE;AAEzE;;;GAGG;AACH,6KAEyE;AAEzE;;;GAGG;AACH,8KAEyE;AAEzE;;;GAGG;AACH,+KAEyE;AAEzE;;;GAGG;AACH,+LAE4E;AAE5E;;GAEG;AACH,4IAEwE"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
// @generated by protoc-gen-es v2.2.3
|
|
2
|
+
// @generated from file versori/credential/v1alpha1/credential_service.proto (package versori.credential.v1alpha1, syntax proto3)
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
import { fileDesc, messageDesc, serviceDesc } from '@bufbuild/protobuf/codegenv1';
|
|
5
|
+
import { file_google_protobuf_timestamp } from '@bufbuild/protobuf/wkt';
|
|
6
|
+
import { file_versori_credential_v1alpha1_common } from './common_pb.js';
|
|
7
|
+
import { file_versori_credential_v1alpha1_credential } from './credential_pb.js';
|
|
8
|
+
/**
|
|
9
|
+
* Describes the file versori/credential/v1alpha1/credential_service.proto.
|
|
10
|
+
*/
|
|
11
|
+
export const file_versori_credential_v1alpha1_credential_service =
|
|
12
|
+
/*@__PURE__*/
|
|
13
|
+
fileDesc('CjR2ZXJzb3JpL2NyZWRlbnRpYWwvdjFhbHBoYTEvY3JlZGVudGlhbF9zZXJ2aWNlLnByb3RvEht2ZXJzb3JpLmNyZWRlbnRpYWwudjFhbHBoYTEivgIKF0NyZWF0ZUNyZWRlbnRpYWxSZXF1ZXN0EhcKD29yZ2FuaXNhdGlvbl9pZBgBIAEoCRIMCgRuYW1lGAIgASgJEkwKBGRhdGEYAyADKAsyPi52ZXJzb3JpLmNyZWRlbnRpYWwudjFhbHBoYTEuQ3JlYXRlQ3JlZGVudGlhbFJlcXVlc3QuRGF0YUVudHJ5EjoKBHR5cGUYBCABKA4yLC52ZXJzb3JpLmNyZWRlbnRpYWwudjFhbHBoYTEuQ3JlZGVudGlhbC5UeXBlEhUKDXJlZGFjdF9maWVsZHMYBSADKAkSLgoKZXhwaXJlc19hdBgGIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXAaKwoJRGF0YUVudHJ5EgsKA2tleRgBIAEoCRINCgV2YWx1ZRgCIAEoDDoCOAEiVwoYQ3JlYXRlQ3JlZGVudGlhbFJlc3Bv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FscGhhMWIGcHJvdG8z', [
|
|
14
|
+
file_google_protobuf_timestamp,
|
|
15
|
+
file_versori_credential_v1alpha1_common,
|
|
16
|
+
file_versori_credential_v1alpha1_credential,
|
|
17
|
+
]);
|
|
18
|
+
/**
|
|
19
|
+
* Describes the message versori.credential.v1alpha1.CreateCredentialRequest.
|
|
20
|
+
* Use `create(CreateCredentialRequestSchema)` to create a new message.
|
|
21
|
+
*/
|
|
22
|
+
export const CreateCredentialRequestSchema =
|
|
23
|
+
/*@__PURE__*/
|
|
24
|
+
messageDesc(file_versori_credential_v1alpha1_credential_service, 0);
|
|
25
|
+
/**
|
|
26
|
+
* Describes the message versori.credential.v1alpha1.CreateCredentialResponse.
|
|
27
|
+
* Use `create(CreateCredentialResponseSchema)` to create a new message.
|
|
28
|
+
*/
|
|
29
|
+
export const CreateCredentialResponseSchema =
|
|
30
|
+
/*@__PURE__*/
|
|
31
|
+
messageDesc(file_versori_credential_v1alpha1_credential_service, 1);
|
|
32
|
+
/**
|
|
33
|
+
* Describes the message versori.credential.v1alpha1.GetCredentialRequest.
|
|
34
|
+
* Use `create(GetCredentialRequestSchema)` to create a new message.
|
|
35
|
+
*/
|
|
36
|
+
export const GetCredentialRequestSchema =
|
|
37
|
+
/*@__PURE__*/
|
|
38
|
+
messageDesc(file_versori_credential_v1alpha1_credential_service, 2);
|
|
39
|
+
/**
|
|
40
|
+
* Describes the message versori.credential.v1alpha1.GetCredentialResponse.
|
|
41
|
+
* Use `create(GetCredentialResponseSchema)` to create a new message.
|
|
42
|
+
*/
|
|
43
|
+
export const GetCredentialResponseSchema =
|
|
44
|
+
/*@__PURE__*/
|
|
45
|
+
messageDesc(file_versori_credential_v1alpha1_credential_service, 3);
|
|
46
|
+
/**
|
|
47
|
+
* Describes the message versori.credential.v1alpha1.GetManyCredentialsRequest.
|
|
48
|
+
* Use `create(GetManyCredentialsRequestSchema)` to create a new message.
|
|
49
|
+
*/
|
|
50
|
+
export const GetManyCredentialsRequestSchema =
|
|
51
|
+
/*@__PURE__*/
|
|
52
|
+
messageDesc(file_versori_credential_v1alpha1_credential_service, 4);
|
|
53
|
+
/**
|
|
54
|
+
* Describes the message versori.credential.v1alpha1.GetManyCredentialsResponse.
|
|
55
|
+
* Use `create(GetManyCredentialsResponseSchema)` to create a new message.
|
|
56
|
+
*/
|
|
57
|
+
export const GetManyCredentialsResponseSchema =
|
|
58
|
+
/*@__PURE__*/
|
|
59
|
+
messageDesc(file_versori_credential_v1alpha1_credential_service, 5);
|
|
60
|
+
/**
|
|
61
|
+
* Describes the message versori.credential.v1alpha1.ListCredentialsRequest.
|
|
62
|
+
* Use `create(ListCredentialsRequestSchema)` to create a new message.
|
|
63
|
+
*/
|
|
64
|
+
export const ListCredentialsRequestSchema =
|
|
65
|
+
/*@__PURE__*/
|
|
66
|
+
messageDesc(file_versori_credential_v1alpha1_credential_service, 6);
|
|
67
|
+
/**
|
|
68
|
+
* Describes the message versori.credential.v1alpha1.ListCredentialsResponse.
|
|
69
|
+
* Use `create(ListCredentialsResponseSchema)` to create a new message.
|
|
70
|
+
*/
|
|
71
|
+
export const ListCredentialsResponseSchema =
|
|
72
|
+
/*@__PURE__*/
|
|
73
|
+
messageDesc(file_versori_credential_v1alpha1_credential_service, 7);
|
|
74
|
+
/**
|
|
75
|
+
* Describes the message versori.credential.v1alpha1.UpdateCredentialRequest.
|
|
76
|
+
* Use `create(UpdateCredentialRequestSchema)` to create a new message.
|
|
77
|
+
*/
|
|
78
|
+
export const UpdateCredentialRequestSchema =
|
|
79
|
+
/*@__PURE__*/
|
|
80
|
+
messageDesc(file_versori_credential_v1alpha1_credential_service, 8);
|
|
81
|
+
/**
|
|
82
|
+
* Describes the message versori.credential.v1alpha1.UpdateCredentialResponse.
|
|
83
|
+
* Use `create(UpdateCredentialResponseSchema)` to create a new message.
|
|
84
|
+
*/
|
|
85
|
+
export const UpdateCredentialResponseSchema =
|
|
86
|
+
/*@__PURE__*/
|
|
87
|
+
messageDesc(file_versori_credential_v1alpha1_credential_service, 9);
|
|
88
|
+
/**
|
|
89
|
+
* Describes the message versori.credential.v1alpha1.DeleteCredentialRequest.
|
|
90
|
+
* Use `create(DeleteCredentialRequestSchema)` to create a new message.
|
|
91
|
+
*/
|
|
92
|
+
export const DeleteCredentialRequestSchema =
|
|
93
|
+
/*@__PURE__*/
|
|
94
|
+
messageDesc(file_versori_credential_v1alpha1_credential_service, 10);
|
|
95
|
+
/**
|
|
96
|
+
* Describes the message versori.credential.v1alpha1.DeleteCredentialResponse.
|
|
97
|
+
* Use `create(DeleteCredentialResponseSchema)` to create a new message.
|
|
98
|
+
*/
|
|
99
|
+
export const DeleteCredentialResponseSchema =
|
|
100
|
+
/*@__PURE__*/
|
|
101
|
+
messageDesc(file_versori_credential_v1alpha1_credential_service, 11);
|
|
102
|
+
/**
|
|
103
|
+
* Describes the message versori.credential.v1alpha1.ValidateCredentialRequest.
|
|
104
|
+
* Use `create(ValidateCredentialRequestSchema)` to create a new message.
|
|
105
|
+
*/
|
|
106
|
+
export const ValidateCredentialRequestSchema =
|
|
107
|
+
/*@__PURE__*/
|
|
108
|
+
messageDesc(file_versori_credential_v1alpha1_credential_service, 12);
|
|
109
|
+
/**
|
|
110
|
+
* Describes the message versori.credential.v1alpha1.ValidateCredentialResponse.
|
|
111
|
+
* Use `create(ValidateCredentialResponseSchema)` to create a new message.
|
|
112
|
+
*/
|
|
113
|
+
export const ValidateCredentialResponseSchema =
|
|
114
|
+
/*@__PURE__*/
|
|
115
|
+
messageDesc(file_versori_credential_v1alpha1_credential_service, 13);
|
|
116
|
+
/**
|
|
117
|
+
* Describes the message versori.credential.v1alpha1.ValidateCredentialResponse.ValidationError.
|
|
118
|
+
* Use `create(ValidateCredentialResponse_ValidationErrorSchema)` to create a new message.
|
|
119
|
+
*/
|
|
120
|
+
export const ValidateCredentialResponse_ValidationErrorSchema =
|
|
121
|
+
/*@__PURE__*/
|
|
122
|
+
messageDesc(file_versori_credential_v1alpha1_credential_service, 13, 0);
|
|
123
|
+
/**
|
|
124
|
+
* @generated from service versori.credential.v1alpha1.CredentialService
|
|
125
|
+
*/
|
|
126
|
+
export const CredentialService =
|
|
127
|
+
/*@__PURE__*/
|
|
128
|
+
serviceDesc(file_versori_credential_v1alpha1_credential_service, 0);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { Logger } from '../../../observability/logging/Logger.js';
|
|
1
2
|
import { DynamicFetcher, RoundTripperFactory } from '../types.js';
|
|
3
|
+
import { Credentials } from './contextcredentials.js';
|
|
2
4
|
import { VersoriCredentialClient } from './credentials/mod.js';
|
|
3
5
|
import { PlatformAPIClient } from './platformapi.js';
|
|
4
|
-
import { Logger } from '../../../observability/logging/Logger.js';
|
|
5
6
|
/**
|
|
6
7
|
* VersoriRoundTripper is an implementation of the RoundTripperFactory interface for Versori connections.
|
|
7
8
|
* This is the intended implementation for when projects/services are hosted on Versori infrastructure.
|
|
@@ -9,28 +10,34 @@ import { Logger } from '../../../observability/logging/Logger.js';
|
|
|
9
10
|
*
|
|
10
11
|
* @example
|
|
11
12
|
* ```typescript
|
|
12
|
-
* const factory = new
|
|
13
|
+
* const factory = new VersoriCredentialsFactory(connectAPIClient, tokenClient);
|
|
13
14
|
* const customFetch = await factory.create('connectionName');
|
|
14
15
|
* const response = await customFetch('https://api.example.com/data');
|
|
15
16
|
* ```
|
|
16
17
|
*/
|
|
17
|
-
export declare class
|
|
18
|
+
export declare class VersoriCredentialsFactory implements RoundTripperFactory {
|
|
18
19
|
private tokenClient;
|
|
20
|
+
private credsBaseURL;
|
|
19
21
|
private platformAPIClient;
|
|
20
22
|
private versoriCfg;
|
|
21
23
|
private log;
|
|
24
|
+
constructor(credsClient: VersoriCredentialClient, credsBaseURL: string, platformAPIClient: PlatformAPIClient, logger: Logger);
|
|
25
|
+
static fromEnv(logger?: Logger): VersoriCredentialsFactory;
|
|
26
|
+
create(connName: string, fn?: typeof fetch): Promise<typeof fetch | undefined>;
|
|
27
|
+
createDynamic(templateName: string, fn?: typeof fetch): Promise<DynamicFetcher | undefined>;
|
|
28
|
+
credentials(): Credentials;
|
|
22
29
|
private readonly defaultDynamic;
|
|
23
|
-
constructor(credsClient: VersoriCredentialClient, platformAPIClient: PlatformAPIClient, logger: Logger);
|
|
24
|
-
static fromEnv(logger?: Logger): VersoriRoundTripperFactory;
|
|
25
30
|
private changeRequestInit;
|
|
26
31
|
private changeBaseUrl;
|
|
27
|
-
|
|
28
|
-
|
|
32
|
+
private getTokenByName;
|
|
33
|
+
private getRawByName;
|
|
34
|
+
private getCredentialIDFromName;
|
|
29
35
|
private getConnectionID;
|
|
30
36
|
private getTemplateID;
|
|
31
37
|
private apiKeyFetcher;
|
|
32
38
|
private basicAuthFetcher;
|
|
33
39
|
private bearerTokenFetcher;
|
|
34
40
|
private oauth2Fetcher;
|
|
41
|
+
private getToken;
|
|
35
42
|
}
|
|
36
43
|
//# sourceMappingURL=roundtripper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"roundtripper.d.ts","sourceRoot":"","sources":["../../../../../src/src/dsl/http/versori/roundtripper.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"roundtripper.d.ts","sourceRoot":"","sources":["../../../../../src/src/dsl/http/versori/roundtripper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,0CAA0C,CAAC;AAElE,OAAO,EAGH,cAAc,EACd,mBAAmB,EAEtB,MAAM,aAAa,CAAC;AAQrB,OAAO,EAAE,WAAW,EAAS,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAG/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD;;;;;;;;;;;GAWG;AACH,qBAAa,yBAA0B,YAAW,mBAAmB;IACjE,OAAO,CAAC,WAAW,CAA0B;IAC7C,OAAO,CAAC,YAAY,CAAS;IAE7B,OAAO,CAAC,iBAAiB,CAAoB;IAE7C,OAAO,CAAC,UAAU,CAAmB;IAErC,OAAO,CAAC,GAAG,CAAS;gBAGhB,WAAW,EAAE,uBAAuB,EACpC,YAAY,EAAE,MAAM,EACpB,iBAAiB,EAAE,iBAAiB,EACpC,MAAM,EAAE,MAAM;IAWlB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,yBAAyB;IA0B1D,MAAM,CACF,QAAQ,EAAE,MAAM,EAChB,EAAE,GAAE,OAAO,KAAwB,GACpC,OAAO,CAAC,OAAO,KAAK,GAAG,SAAS,CAAC;IAsCpC,aAAa,CACT,YAAY,EAAE,MAAM,EACpB,EAAE,GAAE,OAAO,KAAwB,GACpC,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC;IA8CtC,WAAW,IAAI,WAAW;IAO1B,OAAO,CAAC,QAAQ,CAAC,cAAc,CAK7B;IAGF,OAAO,CAAC,iBAAiB;IAezB,OAAO,CAAC,aAAa;YAwBP,cAAc;YAed,YAAY;YAWZ,uBAAuB;IAkBrC,OAAO,CAAC,eAAe;IAcvB,OAAO,CAAC,aAAa;IAYrB,OAAO,CAAC,aAAa;IAuDrB,OAAO,CAAC,gBAAgB;IAmCxB,OAAO,CAAC,kBAAkB;IAiC1B,OAAO,CAAC,aAAa;YAsEP,QAAQ;CAwBzB"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { Code, ConnectError } from '@connectrpc/connect';
|
|
2
|
+
import { ConsoleLogger } from '../../../observability/mod.js';
|
|
1
3
|
import { LoadConfigFromFile } from './configloader.js';
|
|
4
|
+
import { envVarCredsBaseURL, envVarEnvId, envVarOrgId, envVarPlatformApiBaseURL, } from './constants.js';
|
|
2
5
|
import { VersoriCredentialClient } from './credentials/mod.js';
|
|
3
6
|
import { PlatformAPIClient } from './platformapi.js';
|
|
4
|
-
import { ConsoleLogger } from '../../../observability/mod.js';
|
|
5
|
-
import { envVarCredsBaseURL, envVarEnvId, envVarOrgId, envVarPlatformApiBaseURL, } from './constants.js';
|
|
6
7
|
/**
|
|
7
8
|
* VersoriRoundTripper is an implementation of the RoundTripperFactory interface for Versori connections.
|
|
8
9
|
* This is the intended implementation for when projects/services are hosted on Versori infrastructure.
|
|
@@ -10,19 +11,25 @@ import { envVarCredsBaseURL, envVarEnvId, envVarOrgId, envVarPlatformApiBaseURL,
|
|
|
10
11
|
*
|
|
11
12
|
* @example
|
|
12
13
|
* ```typescript
|
|
13
|
-
* const factory = new
|
|
14
|
+
* const factory = new VersoriCredentialsFactory(connectAPIClient, tokenClient);
|
|
14
15
|
* const customFetch = await factory.create('connectionName');
|
|
15
16
|
* const response = await customFetch('https://api.example.com/data');
|
|
16
17
|
* ```
|
|
17
18
|
*/
|
|
18
|
-
export class
|
|
19
|
-
constructor(credsClient, platformAPIClient, logger) {
|
|
19
|
+
export class VersoriCredentialsFactory {
|
|
20
|
+
constructor(credsClient, credsBaseURL, platformAPIClient, logger) {
|
|
20
21
|
Object.defineProperty(this, "tokenClient", {
|
|
21
22
|
enumerable: true,
|
|
22
23
|
configurable: true,
|
|
23
24
|
writable: true,
|
|
24
25
|
value: void 0
|
|
25
26
|
});
|
|
27
|
+
Object.defineProperty(this, "credsBaseURL", {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
configurable: true,
|
|
30
|
+
writable: true,
|
|
31
|
+
value: void 0
|
|
32
|
+
});
|
|
26
33
|
Object.defineProperty(this, "platformAPIClient", {
|
|
27
34
|
enumerable: true,
|
|
28
35
|
configurable: true,
|
|
@@ -53,9 +60,11 @@ export class VersoriRoundTripperFactory {
|
|
|
53
60
|
}
|
|
54
61
|
});
|
|
55
62
|
this.tokenClient = credsClient;
|
|
63
|
+
this.credsBaseURL = credsBaseURL;
|
|
56
64
|
this.platformAPIClient = platformAPIClient;
|
|
57
65
|
this.versoriCfg = LoadConfigFromFile();
|
|
58
66
|
this.log = logger;
|
|
67
|
+
this.credentials = this.credentials.bind(this);
|
|
59
68
|
}
|
|
60
69
|
static fromEnv(logger) {
|
|
61
70
|
const credsBaseURL = Deno.env.get(envVarCredsBaseURL);
|
|
@@ -77,53 +86,17 @@ export class VersoriRoundTripperFactory {
|
|
|
77
86
|
const log = logger || new ConsoleLogger('debug');
|
|
78
87
|
const pAPIClient = new PlatformAPIClient(platformApiBaseURL, orgId, envId, log);
|
|
79
88
|
const tokenClient = new VersoriCredentialClient(credsBaseURL);
|
|
80
|
-
return new
|
|
81
|
-
}
|
|
82
|
-
// takes the info and modifies the url using changeBaseUrl if necessary
|
|
83
|
-
// if a full valid URL is passed as a string, it will be returned as is
|
|
84
|
-
// if a valid URL object is passed, it will be returned as is
|
|
85
|
-
changeRequestInit(info, conn) {
|
|
86
|
-
if (typeof info === 'string') {
|
|
87
|
-
if (isValidURL(info)) {
|
|
88
|
-
return info;
|
|
89
|
-
}
|
|
90
|
-
return this.changeBaseUrl(info, conn);
|
|
91
|
-
}
|
|
92
|
-
else if (info instanceof URL) {
|
|
93
|
-
return info;
|
|
94
|
-
}
|
|
95
|
-
else if (info instanceof Request) {
|
|
96
|
-
const url = this.changeBaseUrl(info.url, conn);
|
|
97
|
-
return new Request(url, info);
|
|
98
|
-
}
|
|
99
|
-
return info;
|
|
89
|
+
return new VersoriCredentialsFactory(tokenClient, credsBaseURL, pAPIClient, log);
|
|
100
90
|
}
|
|
101
|
-
|
|
102
|
-
const connBaseURL = conn.baseUrl;
|
|
103
|
-
// if the connection has no baseUrl set, but the pathname is a valid URL, return it as is
|
|
104
|
-
if (!connBaseURL && isValidURL(pathname)) {
|
|
105
|
-
this.log.debug('Using given URL as is', { url: pathname });
|
|
106
|
-
return pathname;
|
|
107
|
-
}
|
|
108
|
-
const connBaseURLObj = new URL(connBaseURL);
|
|
109
|
-
let _pathname = pathname;
|
|
110
|
-
if (isValidURL(pathname)) {
|
|
111
|
-
const pathnameObj = new URL(pathname);
|
|
112
|
-
_pathname = pathnameObj.pathname;
|
|
113
|
-
}
|
|
114
|
-
const newURL = new URL(_pathname, connBaseURLObj.origin);
|
|
115
|
-
this.log.debug('Using baseURL from connection', { url: newURL.toString() });
|
|
116
|
-
return newURL.toString();
|
|
117
|
-
}
|
|
118
|
-
async create(connName, fn = globalThis.fetch) {
|
|
91
|
+
create(connName, fn = globalThis.fetch) {
|
|
119
92
|
const cnxId = this.getConnectionID(connName);
|
|
120
93
|
if (!cnxId) {
|
|
121
94
|
this.log.debug('Connection not found in config, could be a dynamic connection', {
|
|
122
95
|
connectionName: connName,
|
|
123
96
|
});
|
|
124
|
-
return undefined;
|
|
97
|
+
return Promise.resolve(undefined);
|
|
125
98
|
}
|
|
126
|
-
|
|
99
|
+
return Promise.resolve(async (input, init) => {
|
|
127
100
|
const conn = await this.platformAPIClient.getStaticConnection(cnxId);
|
|
128
101
|
if (!conn) {
|
|
129
102
|
this.log.error('Connection not found for user, using default fetch', {
|
|
@@ -144,18 +117,19 @@ export class VersoriRoundTripperFactory {
|
|
|
144
117
|
default:
|
|
145
118
|
return fn(_input, init);
|
|
146
119
|
}
|
|
147
|
-
};
|
|
148
|
-
return _fn;
|
|
120
|
+
});
|
|
149
121
|
}
|
|
150
|
-
|
|
122
|
+
// takes the info and modifies the url using changeBaseUrl if necessary
|
|
123
|
+
// if a full valid URL is passed as a string, it will be returned as is
|
|
124
|
+
createDynamic(templateName, fn = globalThis.fetch) {
|
|
151
125
|
const template = this.getTemplateID(templateName);
|
|
152
126
|
if (!template) {
|
|
153
127
|
this.log.debug('Template not found in config, could be a static connection', {
|
|
154
128
|
templateName: templateName,
|
|
155
129
|
});
|
|
156
|
-
return undefined;
|
|
130
|
+
return Promise.resolve(undefined);
|
|
157
131
|
}
|
|
158
|
-
|
|
132
|
+
return Promise.resolve(async (activation, input, init) => {
|
|
159
133
|
const conn = await this.platformAPIClient.getActivationConnection(template, activation.id);
|
|
160
134
|
if (!conn) {
|
|
161
135
|
return this.defaultDynamic('Connection not found for user, using default fetch', {
|
|
@@ -177,8 +151,81 @@ export class VersoriRoundTripperFactory {
|
|
|
177
151
|
default:
|
|
178
152
|
return fn(_input, init);
|
|
179
153
|
}
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
credentials() {
|
|
157
|
+
return {
|
|
158
|
+
getRaw: this.getRawByName.bind(this),
|
|
159
|
+
getAccessToken: this.getTokenByName.bind(this),
|
|
180
160
|
};
|
|
181
|
-
|
|
161
|
+
}
|
|
162
|
+
// if a valid URL object is passed, it will be returned as is
|
|
163
|
+
changeRequestInit(info, conn) {
|
|
164
|
+
if (typeof info === 'string') {
|
|
165
|
+
if (isValidURL(info)) {
|
|
166
|
+
return info;
|
|
167
|
+
}
|
|
168
|
+
return this.changeBaseUrl(info, conn);
|
|
169
|
+
}
|
|
170
|
+
else if (info instanceof URL) {
|
|
171
|
+
return info;
|
|
172
|
+
}
|
|
173
|
+
else if (info instanceof Request) {
|
|
174
|
+
const url = this.changeBaseUrl(info.url, conn);
|
|
175
|
+
return new Request(url, info);
|
|
176
|
+
}
|
|
177
|
+
return info;
|
|
178
|
+
}
|
|
179
|
+
changeBaseUrl(pathname, conn) {
|
|
180
|
+
const connBaseURL = conn.baseUrl;
|
|
181
|
+
// if the connection has no baseUrl set, but the pathname is a valid URL, return it as is
|
|
182
|
+
if (!connBaseURL && isValidURL(pathname)) {
|
|
183
|
+
this.log.debug('Using given URL as is', { url: pathname });
|
|
184
|
+
return pathname;
|
|
185
|
+
}
|
|
186
|
+
const connBaseURLObj = new URL(connBaseURL);
|
|
187
|
+
let _pathname = pathname;
|
|
188
|
+
if (isValidURL(pathname)) {
|
|
189
|
+
const pathnameObj = new URL(pathname);
|
|
190
|
+
_pathname = pathnameObj.pathname;
|
|
191
|
+
}
|
|
192
|
+
const newURL = new URL(_pathname, connBaseURLObj.origin);
|
|
193
|
+
this.log.debug('Using baseURL from connection', { url: newURL.toString() });
|
|
194
|
+
return newURL.toString();
|
|
195
|
+
}
|
|
196
|
+
async getTokenByName(name, forceRefresh = false) {
|
|
197
|
+
const credId = await this.getCredentialIDFromName(name);
|
|
198
|
+
const token = await this.tokenClient.getToken(credId, forceRefresh);
|
|
199
|
+
if (!token?.token) {
|
|
200
|
+
throw new Error(`Token not found for connection ${name} with credential ID ${credId}`);
|
|
201
|
+
}
|
|
202
|
+
return {
|
|
203
|
+
accessToken: token.token.accessToken,
|
|
204
|
+
tokenType: token.token.tokenType,
|
|
205
|
+
expiry: token.token.expiry ? new Date(Number(token.token.expiry.seconds) * 1000) : undefined,
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
async getRawByName(name) {
|
|
209
|
+
const credId = await this.getCredentialIDFromName(name);
|
|
210
|
+
const raw = await this.tokenClient.getRaw(credId);
|
|
211
|
+
if (!raw) {
|
|
212
|
+
throw new Error(`Raw data not found for connection ${name} with credential ID ${credId}`);
|
|
213
|
+
}
|
|
214
|
+
return raw?.credential?.data['raw'] ?? new Uint8Array(0);
|
|
215
|
+
}
|
|
216
|
+
async getCredentialIDFromName(name) {
|
|
217
|
+
const conId = this.getConnectionID(name);
|
|
218
|
+
if (!conId) {
|
|
219
|
+
throw new Error(`Connection ${name} not found`);
|
|
220
|
+
}
|
|
221
|
+
const conn = await this.platformAPIClient.getStaticConnection(conId);
|
|
222
|
+
if (!conn) {
|
|
223
|
+
throw new Error(`Connection ${name} not found`);
|
|
224
|
+
}
|
|
225
|
+
if (!conn?.credentials[0]?.credential?.id) {
|
|
226
|
+
throw new Error(`Connection ${name}/${conId} has no credentials defined on it`);
|
|
227
|
+
}
|
|
228
|
+
return conn.credentials[0].credential.id;
|
|
182
229
|
}
|
|
183
230
|
getConnectionID(connName) {
|
|
184
231
|
const conn = this.versoriCfg.mappings.find((c) => (c.dynamic === undefined || c.dynamic === false) &&
|
|
@@ -195,9 +242,9 @@ export class VersoriRoundTripperFactory {
|
|
|
195
242
|
}
|
|
196
243
|
return template.templateId;
|
|
197
244
|
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
const tokenResponse = await this.
|
|
245
|
+
apiKeyFetcher(conn, fn) {
|
|
246
|
+
return Promise.resolve(async (input, init) => {
|
|
247
|
+
const tokenResponse = await this.getToken(conn.credentials[0].credential.id);
|
|
201
248
|
const token = tokenResponse.token?.accessToken;
|
|
202
249
|
const asc = conn.credentials[0].authSchemeConfig.apiKey;
|
|
203
250
|
if (!token) {
|
|
@@ -217,7 +264,7 @@ export class VersoriRoundTripperFactory {
|
|
|
217
264
|
if (init.headers instanceof Headers) {
|
|
218
265
|
init.headers.set(asc.name, token);
|
|
219
266
|
}
|
|
220
|
-
else if (init.headers
|
|
267
|
+
else if (Array.isArray(init.headers)) {
|
|
221
268
|
init.headers.push([asc.name, token]);
|
|
222
269
|
}
|
|
223
270
|
else {
|
|
@@ -240,12 +287,11 @@ export class VersoriRoundTripperFactory {
|
|
|
240
287
|
break;
|
|
241
288
|
}
|
|
242
289
|
return fn(input, init);
|
|
243
|
-
};
|
|
244
|
-
return _fn;
|
|
290
|
+
});
|
|
245
291
|
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
const tokenResponse = await this.
|
|
292
|
+
basicAuthFetcher(conn, fn) {
|
|
293
|
+
return Promise.resolve(async (input, init) => {
|
|
294
|
+
const tokenResponse = await this.getToken(conn.credentials[0].credential.id);
|
|
249
295
|
const token = tokenResponse.token?.accessToken;
|
|
250
296
|
if (!token) {
|
|
251
297
|
throw new Error('Token not found');
|
|
@@ -269,13 +315,12 @@ export class VersoriRoundTripperFactory {
|
|
|
269
315
|
};
|
|
270
316
|
}
|
|
271
317
|
return fn(input, init);
|
|
272
|
-
};
|
|
273
|
-
return _fn;
|
|
318
|
+
});
|
|
274
319
|
}
|
|
275
320
|
// TODO: need to make the prefix and header name configurable from authschemeconfig
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
const tokenResponse = await this.
|
|
321
|
+
bearerTokenFetcher(conn, fn) {
|
|
322
|
+
return Promise.resolve(async (input, init) => {
|
|
323
|
+
const tokenResponse = await this.getToken(conn.credentials[0].credential.id);
|
|
279
324
|
const token = tokenResponse.token?.accessToken;
|
|
280
325
|
if (!token) {
|
|
281
326
|
throw new Error('Token not found');
|
|
@@ -299,12 +344,11 @@ export class VersoriRoundTripperFactory {
|
|
|
299
344
|
};
|
|
300
345
|
}
|
|
301
346
|
return fn(input, init);
|
|
302
|
-
};
|
|
303
|
-
return _fn;
|
|
347
|
+
});
|
|
304
348
|
}
|
|
305
|
-
|
|
349
|
+
oauth2Fetcher(conn, fn) {
|
|
306
350
|
const refreshFn = async (input, init, forceRefresh = false) => {
|
|
307
|
-
const tokenResponse = await this.
|
|
351
|
+
const tokenResponse = await this.getToken(conn.credentials[0].credential.id, forceRefresh);
|
|
308
352
|
const token = tokenResponse.token?.accessToken;
|
|
309
353
|
const tokenType = tokenResponse.token?.tokenType;
|
|
310
354
|
if (!token) {
|
|
@@ -343,7 +387,7 @@ export class VersoriRoundTripperFactory {
|
|
|
343
387
|
}
|
|
344
388
|
return fn(input, init);
|
|
345
389
|
};
|
|
346
|
-
|
|
390
|
+
return Promise.resolve(async (input, init) => {
|
|
347
391
|
const resp = await refreshFn(input, init, false);
|
|
348
392
|
if (resp.status === 401) {
|
|
349
393
|
this.log.debug('Received 401 Unauthorized response, attempting refresh', {
|
|
@@ -354,8 +398,24 @@ export class VersoriRoundTripperFactory {
|
|
|
354
398
|
return refreshFn(input, init, true);
|
|
355
399
|
}
|
|
356
400
|
return Promise.resolve(resp);
|
|
357
|
-
};
|
|
358
|
-
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
async getToken(id, forceRefresh = false) {
|
|
404
|
+
try {
|
|
405
|
+
return await this.tokenClient.getToken(id, forceRefresh);
|
|
406
|
+
}
|
|
407
|
+
catch (error) {
|
|
408
|
+
this.log.error('unable to get credential', { error });
|
|
409
|
+
if (error instanceof ConnectError) {
|
|
410
|
+
if (error.rawMessage.includes("connection error received: not a result of an error") && error.code === Code.Internal) {
|
|
411
|
+
this.log.info('Connection error received, attempting to reconnect');
|
|
412
|
+
this.tokenClient = new VersoriCredentialClient(this.credsBaseURL);
|
|
413
|
+
return await this.tokenClient.getToken(id);
|
|
414
|
+
}
|
|
415
|
+
throw error;
|
|
416
|
+
}
|
|
417
|
+
throw error;
|
|
418
|
+
}
|
|
359
419
|
}
|
|
360
420
|
}
|
|
361
421
|
function isValidURL(url) {
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { Context, ContextImpl } from '../../context/Context.js';
|
|
2
|
-
import {
|
|
2
|
+
import { KeyValueScope, KeyValue } from '../../kv/KeyValue.js';
|
|
3
|
+
import { Logger } from '../../observability/logging/Logger.js';
|
|
4
|
+
import { Activation, DynamicFetcher } from '../http/types.js';
|
|
5
|
+
import { Credentials } from '../http/versori/contextcredentials.js';
|
|
3
6
|
import { ArrayTask, Task, Taskable, TaskType } from '../Task.js';
|
|
4
7
|
export interface HttpContext<Data, PageParams = undefined> extends Context<Data> {
|
|
5
8
|
fetch: typeof fetch;
|
|
@@ -28,12 +31,18 @@ export declare class HttpTaskImpl<In, Out, PageParams> implements Task<In, Out>
|
|
|
28
31
|
unpack<NextOut>(mapper: (data: Out) => NextOut[]): ArrayTask<In, NextOut>;
|
|
29
32
|
clone(): Task<In, Out>;
|
|
30
33
|
}
|
|
31
|
-
export declare class HttpContextImpl<D, PageParams>
|
|
34
|
+
export declare class HttpContextImpl<D, PageParams> implements HttpContext<D, PageParams> {
|
|
35
|
+
#private;
|
|
32
36
|
connectionVariables: Record<string, any>;
|
|
33
37
|
pageParams?: PageParams;
|
|
34
|
-
private dynamicFetcher?;
|
|
35
|
-
private staticFetcher?;
|
|
36
38
|
constructor(ctx: ContextImpl<D, any>, connectionVars: Record<string, any>, staticFetcher?: typeof globalThis.fetch, dynamicFetcher?: DynamicFetcher, pageParams?: PageParams);
|
|
39
|
+
get log(): Logger;
|
|
40
|
+
get executionId(): string;
|
|
41
|
+
get startTime(): Date;
|
|
42
|
+
get activation(): Activation | undefined;
|
|
43
|
+
get data(): D;
|
|
44
|
+
openKv(scope?: KeyValueScope): KeyValue;
|
|
45
|
+
credentials(): Credentials;
|
|
37
46
|
get fetch(): typeof globalThis.fetch;
|
|
38
47
|
nextPage(nextParams: PageParams): Promise<void>;
|
|
39
48
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HttpTask.d.ts","sourceRoot":"","sources":["../../../../src/src/dsl/tasks/HttpTask.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"HttpTask.d.ts","sourceRoot":"","sources":["../../../../src/src/dsl/tasks/HttpTask.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AAE/D,OAAO,EAAE,UAAU,EAAE,cAAc,EAAsB,MAAM,kBAAkB,CAAC;AAClF,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAMjE,MAAM,WAAW,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,SAAS,CAAE,SAAQ,OAAO,CAAC,IAAI,CAAC;IAC5E,KAAK,EAAE,OAAO,KAAK,CAAC;IACpB,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACzC,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,QAAQ,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACvD;AAED,MAAM,MAAM,eAAe,CAAC,EAAE,EAAE,GAAG,EAAE,UAAU,IAAI,CAC/C,GAAG,EAAE,WAAW,CAAC,EAAE,EAAE,UAAU,CAAC,KAC/B,OAAO,CAAC,GAAG,CAAC,CAAC;AAElB,MAAM,MAAM,eAAe,CAAC,CAAC,IAAI;IAC7B,aAAa,EAAE,C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