@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,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// @generated by protoc-gen-es v2.2.3
|
|
3
|
+
// @generated from file versori/credential/v1alpha1/credential_service.proto (package versori.credential.v1alpha1, syntax proto3)
|
|
4
|
+
/* eslint-disable */
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CredentialService = exports.ValidateCredentialResponse_ValidationErrorSchema = exports.ValidateCredentialResponseSchema = exports.ValidateCredentialRequestSchema = exports.DeleteCredentialResponseSchema = exports.DeleteCredentialRequestSchema = exports.UpdateCredentialResponseSchema = exports.UpdateCredentialRequestSchema = exports.ListCredentialsResponseSchema = exports.ListCredentialsRequestSchema = exports.GetManyCredentialsResponseSchema = exports.GetManyCredentialsRequestSchema = exports.GetCredentialResponseSchema = exports.GetCredentialRequestSchema = exports.CreateCredentialResponseSchema = exports.CreateCredentialRequestSchema = exports.file_versori_credential_v1alpha1_credential_service = void 0;
|
|
7
|
+
const codegenv1_1 = require("@bufbuild/protobuf/codegenv1");
|
|
8
|
+
const wkt_1 = require("@bufbuild/protobuf/wkt");
|
|
9
|
+
const common_pb_js_1 = require("./common_pb.js");
|
|
10
|
+
const credential_pb_js_1 = require("./credential_pb.js");
|
|
11
|
+
/**
|
|
12
|
+
* Describes the file versori/credential/v1alpha1/credential_service.proto.
|
|
13
|
+
*/
|
|
14
|
+
exports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mkuY3JlZGVudGlhbC52MWFscGhhMS5MaXN0Q3JlZGVudGlhbHNSZXF1ZXN0GjQudmVyc29yaS5jcmVkZW50aWFsLnYxYWxwaGExLkxpc3RDcmVkZW50aWFsc1Jlc3BvbnNlEnUKBlVwZGF0ZRI0LnZlcnNvcmkuY3JlZGVudGlhbC52MWFscGhhMS5VcGRhdGVDcmVkZW50aWFsUmVxdWVzdBo1LnZlcnNvcmkuY3JlZGVudGlhbC52MWFscGhhMS5VcGRhdGVDcmVkZW50aWFsUmVzcG9uc2USdQoGRGVsZXRlEjQudmVyc29yaS5jcmVkZW50aWFsLnYxYWxwaGExLkRlbGV0ZUNyZWRlbnRpYWxSZXF1ZXN0GjUudmVyc29yaS5jcmVkZW50aWFsLnYxYWxwaGExLkRlbGV0ZUNyZWRlbnRpYWxSZXNwb25zZRJ7CghWYWxpZGF0ZRI2LnZlcnNvcmkuY3JlZGVudGlhbC52MWFscGhhMS5WYWxpZGF0ZUNyZWRlbnRpYWxSZXF1ZXN0GjcudmVyc29yaS5jcmVkZW50aWFsLnYxYWxwaGExLlZhbGlkYXRlQ3JlZGVudGlhbFJlc3BvbnNlQiZaJHZlcnNvcmkuZGV2L2NyZWRlbnRpYWxzL2FwaS92MWFscGhhMWIGcHJvdG8z', [
|
|
17
|
+
wkt_1.file_google_protobuf_timestamp,
|
|
18
|
+
common_pb_js_1.file_versori_credential_v1alpha1_common,
|
|
19
|
+
credential_pb_js_1.file_versori_credential_v1alpha1_credential,
|
|
20
|
+
]);
|
|
21
|
+
/**
|
|
22
|
+
* Describes the message versori.credential.v1alpha1.CreateCredentialRequest.
|
|
23
|
+
* Use `create(CreateCredentialRequestSchema)` to create a new message.
|
|
24
|
+
*/
|
|
25
|
+
exports.CreateCredentialRequestSchema =
|
|
26
|
+
/*@__PURE__*/
|
|
27
|
+
(0, codegenv1_1.messageDesc)(exports.file_versori_credential_v1alpha1_credential_service, 0);
|
|
28
|
+
/**
|
|
29
|
+
* Describes the message versori.credential.v1alpha1.CreateCredentialResponse.
|
|
30
|
+
* Use `create(CreateCredentialResponseSchema)` to create a new message.
|
|
31
|
+
*/
|
|
32
|
+
exports.CreateCredentialResponseSchema =
|
|
33
|
+
/*@__PURE__*/
|
|
34
|
+
(0, codegenv1_1.messageDesc)(exports.file_versori_credential_v1alpha1_credential_service, 1);
|
|
35
|
+
/**
|
|
36
|
+
* Describes the message versori.credential.v1alpha1.GetCredentialRequest.
|
|
37
|
+
* Use `create(GetCredentialRequestSchema)` to create a new message.
|
|
38
|
+
*/
|
|
39
|
+
exports.GetCredentialRequestSchema =
|
|
40
|
+
/*@__PURE__*/
|
|
41
|
+
(0, codegenv1_1.messageDesc)(exports.file_versori_credential_v1alpha1_credential_service, 2);
|
|
42
|
+
/**
|
|
43
|
+
* Describes the message versori.credential.v1alpha1.GetCredentialResponse.
|
|
44
|
+
* Use `create(GetCredentialResponseSchema)` to create a new message.
|
|
45
|
+
*/
|
|
46
|
+
exports.GetCredentialResponseSchema =
|
|
47
|
+
/*@__PURE__*/
|
|
48
|
+
(0, codegenv1_1.messageDesc)(exports.file_versori_credential_v1alpha1_credential_service, 3);
|
|
49
|
+
/**
|
|
50
|
+
* Describes the message versori.credential.v1alpha1.GetManyCredentialsRequest.
|
|
51
|
+
* Use `create(GetManyCredentialsRequestSchema)` to create a new message.
|
|
52
|
+
*/
|
|
53
|
+
exports.GetManyCredentialsRequestSchema =
|
|
54
|
+
/*@__PURE__*/
|
|
55
|
+
(0, codegenv1_1.messageDesc)(exports.file_versori_credential_v1alpha1_credential_service, 4);
|
|
56
|
+
/**
|
|
57
|
+
* Describes the message versori.credential.v1alpha1.GetManyCredentialsResponse.
|
|
58
|
+
* Use `create(GetManyCredentialsResponseSchema)` to create a new message.
|
|
59
|
+
*/
|
|
60
|
+
exports.GetManyCredentialsResponseSchema =
|
|
61
|
+
/*@__PURE__*/
|
|
62
|
+
(0, codegenv1_1.messageDesc)(exports.file_versori_credential_v1alpha1_credential_service, 5);
|
|
63
|
+
/**
|
|
64
|
+
* Describes the message versori.credential.v1alpha1.ListCredentialsRequest.
|
|
65
|
+
* Use `create(ListCredentialsRequestSchema)` to create a new message.
|
|
66
|
+
*/
|
|
67
|
+
exports.ListCredentialsRequestSchema =
|
|
68
|
+
/*@__PURE__*/
|
|
69
|
+
(0, codegenv1_1.messageDesc)(exports.file_versori_credential_v1alpha1_credential_service, 6);
|
|
70
|
+
/**
|
|
71
|
+
* Describes the message versori.credential.v1alpha1.ListCredentialsResponse.
|
|
72
|
+
* Use `create(ListCredentialsResponseSchema)` to create a new message.
|
|
73
|
+
*/
|
|
74
|
+
exports.ListCredentialsResponseSchema =
|
|
75
|
+
/*@__PURE__*/
|
|
76
|
+
(0, codegenv1_1.messageDesc)(exports.file_versori_credential_v1alpha1_credential_service, 7);
|
|
77
|
+
/**
|
|
78
|
+
* Describes the message versori.credential.v1alpha1.UpdateCredentialRequest.
|
|
79
|
+
* Use `create(UpdateCredentialRequestSchema)` to create a new message.
|
|
80
|
+
*/
|
|
81
|
+
exports.UpdateCredentialRequestSchema =
|
|
82
|
+
/*@__PURE__*/
|
|
83
|
+
(0, codegenv1_1.messageDesc)(exports.file_versori_credential_v1alpha1_credential_service, 8);
|
|
84
|
+
/**
|
|
85
|
+
* Describes the message versori.credential.v1alpha1.UpdateCredentialResponse.
|
|
86
|
+
* Use `create(UpdateCredentialResponseSchema)` to create a new message.
|
|
87
|
+
*/
|
|
88
|
+
exports.UpdateCredentialResponseSchema =
|
|
89
|
+
/*@__PURE__*/
|
|
90
|
+
(0, codegenv1_1.messageDesc)(exports.file_versori_credential_v1alpha1_credential_service, 9);
|
|
91
|
+
/**
|
|
92
|
+
* Describes the message versori.credential.v1alpha1.DeleteCredentialRequest.
|
|
93
|
+
* Use `create(DeleteCredentialRequestSchema)` to create a new message.
|
|
94
|
+
*/
|
|
95
|
+
exports.DeleteCredentialRequestSchema =
|
|
96
|
+
/*@__PURE__*/
|
|
97
|
+
(0, codegenv1_1.messageDesc)(exports.file_versori_credential_v1alpha1_credential_service, 10);
|
|
98
|
+
/**
|
|
99
|
+
* Describes the message versori.credential.v1alpha1.DeleteCredentialResponse.
|
|
100
|
+
* Use `create(DeleteCredentialResponseSchema)` to create a new message.
|
|
101
|
+
*/
|
|
102
|
+
exports.DeleteCredentialResponseSchema =
|
|
103
|
+
/*@__PURE__*/
|
|
104
|
+
(0, codegenv1_1.messageDesc)(exports.file_versori_credential_v1alpha1_credential_service, 11);
|
|
105
|
+
/**
|
|
106
|
+
* Describes the message versori.credential.v1alpha1.ValidateCredentialRequest.
|
|
107
|
+
* Use `create(ValidateCredentialRequestSchema)` to create a new message.
|
|
108
|
+
*/
|
|
109
|
+
exports.ValidateCredentialRequestSchema =
|
|
110
|
+
/*@__PURE__*/
|
|
111
|
+
(0, codegenv1_1.messageDesc)(exports.file_versori_credential_v1alpha1_credential_service, 12);
|
|
112
|
+
/**
|
|
113
|
+
* Describes the message versori.credential.v1alpha1.ValidateCredentialResponse.
|
|
114
|
+
* Use `create(ValidateCredentialResponseSchema)` to create a new message.
|
|
115
|
+
*/
|
|
116
|
+
exports.ValidateCredentialResponseSchema =
|
|
117
|
+
/*@__PURE__*/
|
|
118
|
+
(0, codegenv1_1.messageDesc)(exports.file_versori_credential_v1alpha1_credential_service, 13);
|
|
119
|
+
/**
|
|
120
|
+
* Describes the message versori.credential.v1alpha1.ValidateCredentialResponse.ValidationError.
|
|
121
|
+
* Use `create(ValidateCredentialResponse_ValidationErrorSchema)` to create a new message.
|
|
122
|
+
*/
|
|
123
|
+
exports.ValidateCredentialResponse_ValidationErrorSchema =
|
|
124
|
+
/*@__PURE__*/
|
|
125
|
+
(0, codegenv1_1.messageDesc)(exports.file_versori_credential_v1alpha1_credential_service, 13, 0);
|
|
126
|
+
/**
|
|
127
|
+
* @generated from service versori.credential.v1alpha1.CredentialService
|
|
128
|
+
*/
|
|
129
|
+
exports.CredentialService =
|
|
130
|
+
/*@__PURE__*/
|
|
131
|
+
(0, codegenv1_1.serviceDesc)(exports.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,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.VersoriCredentialsFactory = void 0;
|
|
4
|
+
const connect_1 = require("@connectrpc/connect");
|
|
5
|
+
const mod_js_1 = require("../../../observability/mod.js");
|
|
4
6
|
const configloader_js_1 = require("./configloader.js");
|
|
5
|
-
const mod_js_1 = require("./credentials/mod.js");
|
|
6
|
-
const platformapi_js_1 = require("./platformapi.js");
|
|
7
|
-
const mod_js_2 = require("../../../observability/mod.js");
|
|
8
7
|
const constants_js_1 = require("./constants.js");
|
|
8
|
+
const mod_js_2 = require("./credentials/mod.js");
|
|
9
|
+
const platformapi_js_1 = require("./platformapi.js");
|
|
9
10
|
/**
|
|
10
11
|
* VersoriRoundTripper is an implementation of the RoundTripperFactory interface for Versori connections.
|
|
11
12
|
* This is the intended implementation for when projects/services are hosted on Versori infrastructure.
|
|
@@ -13,19 +14,25 @@ const constants_js_1 = require("./constants.js");
|
|
|
13
14
|
*
|
|
14
15
|
* @example
|
|
15
16
|
* ```typescript
|
|
16
|
-
* const factory = new
|
|
17
|
+
* const factory = new VersoriCredentialsFactory(connectAPIClient, tokenClient);
|
|
17
18
|
* const customFetch = await factory.create('connectionName');
|
|
18
19
|
* const response = await customFetch('https://api.example.com/data');
|
|
19
20
|
* ```
|
|
20
21
|
*/
|
|
21
|
-
class
|
|
22
|
-
constructor(credsClient, platformAPIClient, logger) {
|
|
22
|
+
class VersoriCredentialsFactory {
|
|
23
|
+
constructor(credsClient, credsBaseURL, platformAPIClient, logger) {
|
|
23
24
|
Object.defineProperty(this, "tokenClient", {
|
|
24
25
|
enumerable: true,
|
|
25
26
|
configurable: true,
|
|
26
27
|
writable: true,
|
|
27
28
|
value: void 0
|
|
28
29
|
});
|
|
30
|
+
Object.defineProperty(this, "credsBaseURL", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
configurable: true,
|
|
33
|
+
writable: true,
|
|
34
|
+
value: void 0
|
|
35
|
+
});
|
|
29
36
|
Object.defineProperty(this, "platformAPIClient", {
|
|
30
37
|
enumerable: true,
|
|
31
38
|
configurable: true,
|
|
@@ -56,9 +63,11 @@ class VersoriRoundTripperFactory {
|
|
|
56
63
|
}
|
|
57
64
|
});
|
|
58
65
|
this.tokenClient = credsClient;
|
|
66
|
+
this.credsBaseURL = credsBaseURL;
|
|
59
67
|
this.platformAPIClient = platformAPIClient;
|
|
60
68
|
this.versoriCfg = (0, configloader_js_1.LoadConfigFromFile)();
|
|
61
69
|
this.log = logger;
|
|
70
|
+
this.credentials = this.credentials.bind(this);
|
|
62
71
|
}
|
|
63
72
|
static fromEnv(logger) {
|
|
64
73
|
const credsBaseURL = Deno.env.get(constants_js_1.envVarCredsBaseURL);
|
|
@@ -77,56 +86,20 @@ class VersoriRoundTripperFactory {
|
|
|
77
86
|
missingVars.push(constants_js_1.envVarCredsBaseURL);
|
|
78
87
|
throw new Error(`Missing environment variables: ${missingVars.join(', ')}`);
|
|
79
88
|
}
|
|
80
|
-
const log = logger || new
|
|
89
|
+
const log = logger || new mod_js_1.ConsoleLogger('debug');
|
|
81
90
|
const pAPIClient = new platformapi_js_1.PlatformAPIClient(platformApiBaseURL, orgId, envId, log);
|
|
82
|
-
const tokenClient = new
|
|
83
|
-
return new
|
|
91
|
+
const tokenClient = new mod_js_2.VersoriCredentialClient(credsBaseURL);
|
|
92
|
+
return new VersoriCredentialsFactory(tokenClient, credsBaseURL, pAPIClient, log);
|
|
84
93
|
}
|
|
85
|
-
|
|
86
|
-
// if a full valid URL is passed as a string, it will be returned as is
|
|
87
|
-
// if a valid URL object is passed, it will be returned as is
|
|
88
|
-
changeRequestInit(info, conn) {
|
|
89
|
-
if (typeof info === 'string') {
|
|
90
|
-
if (isValidURL(info)) {
|
|
91
|
-
return info;
|
|
92
|
-
}
|
|
93
|
-
return this.changeBaseUrl(info, conn);
|
|
94
|
-
}
|
|
95
|
-
else if (info instanceof URL) {
|
|
96
|
-
return info;
|
|
97
|
-
}
|
|
98
|
-
else if (info instanceof Request) {
|
|
99
|
-
const url = this.changeBaseUrl(info.url, conn);
|
|
100
|
-
return new Request(url, info);
|
|
101
|
-
}
|
|
102
|
-
return info;
|
|
103
|
-
}
|
|
104
|
-
changeBaseUrl(pathname, conn) {
|
|
105
|
-
const connBaseURL = conn.baseUrl;
|
|
106
|
-
// if the connection has no baseUrl set, but the pathname is a valid URL, return it as is
|
|
107
|
-
if (!connBaseURL && isValidURL(pathname)) {
|
|
108
|
-
this.log.debug('Using given URL as is', { url: pathname });
|
|
109
|
-
return pathname;
|
|
110
|
-
}
|
|
111
|
-
const connBaseURLObj = new URL(connBaseURL);
|
|
112
|
-
let _pathname = pathname;
|
|
113
|
-
if (isValidURL(pathname)) {
|
|
114
|
-
const pathnameObj = new URL(pathname);
|
|
115
|
-
_pathname = pathnameObj.pathname;
|
|
116
|
-
}
|
|
117
|
-
const newURL = new URL(_pathname, connBaseURLObj.origin);
|
|
118
|
-
this.log.debug('Using baseURL from connection', { url: newURL.toString() });
|
|
119
|
-
return newURL.toString();
|
|
120
|
-
}
|
|
121
|
-
async create(connName, fn = globalThis.fetch) {
|
|
94
|
+
create(connName, fn = globalThis.fetch) {
|
|
122
95
|
const cnxId = this.getConnectionID(connName);
|
|
123
96
|
if (!cnxId) {
|
|
124
97
|
this.log.debug('Connection not found in config, could be a dynamic connection', {
|
|
125
98
|
connectionName: connName,
|
|
126
99
|
});
|
|
127
|
-
return undefined;
|
|
100
|
+
return Promise.resolve(undefined);
|
|
128
101
|
}
|
|
129
|
-
|
|
102
|
+
return Promise.resolve(async (input, init) => {
|
|
130
103
|
const conn = await this.platformAPIClient.getStaticConnection(cnxId);
|
|
131
104
|
if (!conn) {
|
|
132
105
|
this.log.error('Connection not found for user, using default fetch', {
|
|
@@ -147,18 +120,19 @@ class VersoriRoundTripperFactory {
|
|
|
147
120
|
default:
|
|
148
121
|
return fn(_input, init);
|
|
149
122
|
}
|
|
150
|
-
};
|
|
151
|
-
return _fn;
|
|
123
|
+
});
|
|
152
124
|
}
|
|
153
|
-
|
|
125
|
+
// takes the info and modifies the url using changeBaseUrl if necessary
|
|
126
|
+
// if a full valid URL is passed as a string, it will be returned as is
|
|
127
|
+
createDynamic(templateName, fn = globalThis.fetch) {
|
|
154
128
|
const template = this.getTemplateID(templateName);
|
|
155
129
|
if (!template) {
|
|
156
130
|
this.log.debug('Template not found in config, could be a static connection', {
|
|
157
131
|
templateName: templateName,
|
|
158
132
|
});
|
|
159
|
-
return undefined;
|
|
133
|
+
return Promise.resolve(undefined);
|
|
160
134
|
}
|
|
161
|
-
|
|
135
|
+
return Promise.resolve(async (activation, input, init) => {
|
|
162
136
|
const conn = await this.platformAPIClient.getActivationConnection(template, activation.id);
|
|
163
137
|
if (!conn) {
|
|
164
138
|
return this.defaultDynamic('Connection not found for user, using default fetch', {
|
|
@@ -180,8 +154,81 @@ class VersoriRoundTripperFactory {
|
|
|
180
154
|
default:
|
|
181
155
|
return fn(_input, init);
|
|
182
156
|
}
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
credentials() {
|
|
160
|
+
return {
|
|
161
|
+
getRaw: this.getRawByName.bind(this),
|
|
162
|
+
getAccessToken: this.getTokenByName.bind(this),
|
|
183
163
|
};
|
|
184
|
-
|
|
164
|
+
}
|
|
165
|
+
// if a valid URL object is passed, it will be returned as is
|
|
166
|
+
changeRequestInit(info, conn) {
|
|
167
|
+
if (typeof info === 'string') {
|
|
168
|
+
if (isValidURL(info)) {
|
|
169
|
+
return info;
|
|
170
|
+
}
|
|
171
|
+
return this.changeBaseUrl(info, conn);
|
|
172
|
+
}
|
|
173
|
+
else if (info instanceof URL) {
|
|
174
|
+
return info;
|
|
175
|
+
}
|
|
176
|
+
else if (info instanceof Request) {
|
|
177
|
+
const url = this.changeBaseUrl(info.url, conn);
|
|
178
|
+
return new Request(url, info);
|
|
179
|
+
}
|
|
180
|
+
return info;
|
|
181
|
+
}
|
|
182
|
+
changeBaseUrl(pathname, conn) {
|
|
183
|
+
const connBaseURL = conn.baseUrl;
|
|
184
|
+
// if the connection has no baseUrl set, but the pathname is a valid URL, return it as is
|
|
185
|
+
if (!connBaseURL && isValidURL(pathname)) {
|
|
186
|
+
this.log.debug('Using given URL as is', { url: pathname });
|
|
187
|
+
return pathname;
|
|
188
|
+
}
|
|
189
|
+
const connBaseURLObj = new URL(connBaseURL);
|
|
190
|
+
let _pathname = pathname;
|
|
191
|
+
if (isValidURL(pathname)) {
|
|
192
|
+
const pathnameObj = new URL(pathname);
|
|
193
|
+
_pathname = pathnameObj.pathname;
|
|
194
|
+
}
|
|
195
|
+
const newURL = new URL(_pathname, connBaseURLObj.origin);
|
|
196
|
+
this.log.debug('Using baseURL from connection', { url: newURL.toString() });
|
|
197
|
+
return newURL.toString();
|
|
198
|
+
}
|
|
199
|
+
async getTokenByName(name, forceRefresh = false) {
|
|
200
|
+
const credId = await this.getCredentialIDFromName(name);
|
|
201
|
+
const token = await this.tokenClient.getToken(credId, forceRefresh);
|
|
202
|
+
if (!token?.token) {
|
|
203
|
+
throw new Error(`Token not found for connection ${name} with credential ID ${credId}`);
|
|
204
|
+
}
|
|
205
|
+
return {
|
|
206
|
+
accessToken: token.token.accessToken,
|
|
207
|
+
tokenType: token.token.tokenType,
|
|
208
|
+
expiry: token.token.expiry ? new Date(Number(token.token.expiry.seconds) * 1000) : undefined,
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
async getRawByName(name) {
|
|
212
|
+
const credId = await this.getCredentialIDFromName(name);
|
|
213
|
+
const raw = await this.tokenClient.getRaw(credId);
|
|
214
|
+
if (!raw) {
|
|
215
|
+
throw new Error(`Raw data not found for connection ${name} with credential ID ${credId}`);
|
|
216
|
+
}
|
|
217
|
+
return raw?.credential?.data['raw'] ?? new Uint8Array(0);
|
|
218
|
+
}
|
|
219
|
+
async getCredentialIDFromName(name) {
|
|
220
|
+
const conId = this.getConnectionID(name);
|
|
221
|
+
if (!conId) {
|
|
222
|
+
throw new Error(`Connection ${name} not found`);
|
|
223
|
+
}
|
|
224
|
+
const conn = await this.platformAPIClient.getStaticConnection(conId);
|
|
225
|
+
if (!conn) {
|
|
226
|
+
throw new Error(`Connection ${name} not found`);
|
|
227
|
+
}
|
|
228
|
+
if (!conn?.credentials[0]?.credential?.id) {
|
|
229
|
+
throw new Error(`Connection ${name}/${conId} has no credentials defined on it`);
|
|
230
|
+
}
|
|
231
|
+
return conn.credentials[0].credential.id;
|
|
185
232
|
}
|
|
186
233
|
getConnectionID(connName) {
|
|
187
234
|
const conn = this.versoriCfg.mappings.find((c) => (c.dynamic === undefined || c.dynamic === false) &&
|
|
@@ -198,9 +245,9 @@ class VersoriRoundTripperFactory {
|
|
|
198
245
|
}
|
|
199
246
|
return template.templateId;
|
|
200
247
|
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
const tokenResponse = await this.
|
|
248
|
+
apiKeyFetcher(conn, fn) {
|
|
249
|
+
return Promise.resolve(async (input, init) => {
|
|
250
|
+
const tokenResponse = await this.getToken(conn.credentials[0].credential.id);
|
|
204
251
|
const token = tokenResponse.token?.accessToken;
|
|
205
252
|
const asc = conn.credentials[0].authSchemeConfig.apiKey;
|
|
206
253
|
if (!token) {
|
|
@@ -220,7 +267,7 @@ class VersoriRoundTripperFactory {
|
|
|
220
267
|
if (init.headers instanceof Headers) {
|
|
221
268
|
init.headers.set(asc.name, token);
|
|
222
269
|
}
|
|
223
|
-
else if (init.headers
|
|
270
|
+
else if (Array.isArray(init.headers)) {
|
|
224
271
|
init.headers.push([asc.name, token]);
|
|
225
272
|
}
|
|
226
273
|
else {
|
|
@@ -243,12 +290,11 @@ class VersoriRoundTripperFactory {
|
|
|
243
290
|
break;
|
|
244
291
|
}
|
|
245
292
|
return fn(input, init);
|
|
246
|
-
};
|
|
247
|
-
return _fn;
|
|
293
|
+
});
|
|
248
294
|
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
const tokenResponse = await this.
|
|
295
|
+
basicAuthFetcher(conn, fn) {
|
|
296
|
+
return Promise.resolve(async (input, init) => {
|
|
297
|
+
const tokenResponse = await this.getToken(conn.credentials[0].credential.id);
|
|
252
298
|
const token = tokenResponse.token?.accessToken;
|
|
253
299
|
if (!token) {
|
|
254
300
|
throw new Error('Token not found');
|
|
@@ -272,13 +318,12 @@ class VersoriRoundTripperFactory {
|
|
|
272
318
|
};
|
|
273
319
|
}
|
|
274
320
|
return fn(input, init);
|
|
275
|
-
};
|
|
276
|
-
return _fn;
|
|
321
|
+
});
|
|
277
322
|
}
|
|
278
323
|
// TODO: need to make the prefix and header name configurable from authschemeconfig
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
const tokenResponse = await this.
|
|
324
|
+
bearerTokenFetcher(conn, fn) {
|
|
325
|
+
return Promise.resolve(async (input, init) => {
|
|
326
|
+
const tokenResponse = await this.getToken(conn.credentials[0].credential.id);
|
|
282
327
|
const token = tokenResponse.token?.accessToken;
|
|
283
328
|
if (!token) {
|
|
284
329
|
throw new Error('Token not found');
|
|
@@ -302,12 +347,11 @@ class VersoriRoundTripperFactory {
|
|
|
302
347
|
};
|
|
303
348
|
}
|
|
304
349
|
return fn(input, init);
|
|
305
|
-
};
|
|
306
|
-
return _fn;
|
|
350
|
+
});
|
|
307
351
|
}
|
|
308
|
-
|
|
352
|
+
oauth2Fetcher(conn, fn) {
|
|
309
353
|
const refreshFn = async (input, init, forceRefresh = false) => {
|
|
310
|
-
const tokenResponse = await this.
|
|
354
|
+
const tokenResponse = await this.getToken(conn.credentials[0].credential.id, forceRefresh);
|
|
311
355
|
const token = tokenResponse.token?.accessToken;
|
|
312
356
|
const tokenType = tokenResponse.token?.tokenType;
|
|
313
357
|
if (!token) {
|
|
@@ -346,7 +390,7 @@ class VersoriRoundTripperFactory {
|
|
|
346
390
|
}
|
|
347
391
|
return fn(input, init);
|
|
348
392
|
};
|
|
349
|
-
|
|
393
|
+
return Promise.resolve(async (input, init) => {
|
|
350
394
|
const resp = await refreshFn(input, init, false);
|
|
351
395
|
if (resp.status === 401) {
|
|
352
396
|
this.log.debug('Received 401 Unauthorized response, attempting refresh', {
|
|
@@ -357,11 +401,27 @@ class VersoriRoundTripperFactory {
|
|
|
357
401
|
return refreshFn(input, init, true);
|
|
358
402
|
}
|
|
359
403
|
return Promise.resolve(resp);
|
|
360
|
-
};
|
|
361
|
-
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
async getToken(id, forceRefresh = false) {
|
|
407
|
+
try {
|
|
408
|
+
return await this.tokenClient.getToken(id, forceRefresh);
|
|
409
|
+
}
|
|
410
|
+
catch (error) {
|
|
411
|
+
this.log.error('unable to get credential', { error });
|
|
412
|
+
if (error instanceof connect_1.ConnectError) {
|
|
413
|
+
if (error.rawMessage.includes("connection error received: not a result of an error") && error.code === connect_1.Code.Internal) {
|
|
414
|
+
this.log.info('Connection error received, attempting to reconnect');
|
|
415
|
+
this.tokenClient = new mod_js_2.VersoriCredentialClient(this.credsBaseURL);
|
|
416
|
+
return await this.tokenClient.getToken(id);
|
|
417
|
+
}
|
|
418
|
+
throw error;
|
|
419
|
+
}
|
|
420
|
+
throw error;
|
|
421
|
+
}
|
|
362
422
|
}
|
|
363
423
|
}
|
|
364
|
-
exports.
|
|
424
|
+
exports.VersoriCredentialsFactory = VersoriCredentialsFactory;
|
|
365
425
|
function isValidURL(url) {
|
|
366
426
|
try {
|
|
367
427
|
new URL(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,CAA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