@versori/run 0.4.4 → 0.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/deps/jsr.io/@std/encoding/1.0.10/_common64.d.ts +35 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.10/_common64.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.10/_common64.js +113 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.10/_common_detach.d.ts +4 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.10/_common_detach.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.10/_common_detach.js +13 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.10/_types.d.ts +9 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.10/_types.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.10/_types.js +2 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.10/base64.d.ts +40 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.10/base64.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.10/base64.js +82 -0
- package/esm/src/connection/CredentialsProvider.d.ts +23 -0
- package/esm/src/connection/CredentialsProvider.d.ts.map +1 -0
- package/esm/src/connection/CredentialsProvider.js +130 -0
- package/esm/src/connection/DirectConnectionFactory.d.ts +3 -3
- package/esm/src/connection/DirectConnectionFactory.d.ts.map +1 -1
- package/esm/src/connection/DirectConnectionFactory.js +2 -2
- package/esm/src/credentials/CredentialsProvider.d.ts +49 -0
- package/esm/src/credentials/CredentialsProvider.d.ts.map +1 -0
- package/esm/src/credentials/CredentialsProvider.js +102 -0
- package/esm/src/interpreter/durable/DurableInterpreter.d.ts.map +1 -1
- package/esm/src/interpreter/durable/DurableInterpreter.js +5 -17
- package/esm/src/interpreter/memory/MemoryInterpreter.d.ts.map +1 -1
- package/esm/src/interpreter/memory/MemoryInterpreter.js +5 -9
- package/esm/src/kv/nats/NatsKeyValueProvider.d.ts.map +1 -1
- package/esm/src/kv/nats/NatsKeyValueProvider.js +2 -2
- package/esm/src/kv/sdk/SDKKeyValueProvider.d.ts.map +1 -1
- package/esm/src/kv/sdk/SDKKeyValueProvider.js +3 -3
- package/package.json +1 -1
- package/script/deps/jsr.io/@std/encoding/1.0.10/_common64.d.ts +35 -0
- package/script/deps/jsr.io/@std/encoding/1.0.10/_common64.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/encoding/1.0.10/_common64.js +119 -0
- package/script/deps/jsr.io/@std/encoding/1.0.10/_common_detach.d.ts +4 -0
- package/script/deps/jsr.io/@std/encoding/1.0.10/_common_detach.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/encoding/1.0.10/_common_detach.js +16 -0
- package/script/deps/jsr.io/@std/encoding/1.0.10/_types.d.ts +9 -0
- package/script/deps/jsr.io/@std/encoding/1.0.10/_types.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/encoding/1.0.10/_types.js +3 -0
- package/script/deps/jsr.io/@std/encoding/1.0.10/base64.d.ts +40 -0
- package/script/deps/jsr.io/@std/encoding/1.0.10/base64.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/encoding/1.0.10/base64.js +86 -0
- package/script/src/connection/CredentialsProvider.d.ts +23 -0
- package/script/src/connection/CredentialsProvider.d.ts.map +1 -0
- package/script/src/connection/CredentialsProvider.js +134 -0
- package/script/src/connection/DirectConnectionFactory.d.ts +3 -3
- package/script/src/connection/DirectConnectionFactory.d.ts.map +1 -1
- package/script/src/connection/DirectConnectionFactory.js +2 -2
- package/script/src/credentials/CredentialsProvider.d.ts +49 -0
- package/script/src/credentials/CredentialsProvider.d.ts.map +1 -0
- package/script/src/credentials/CredentialsProvider.js +106 -0
- package/script/src/interpreter/durable/DurableInterpreter.d.ts.map +1 -1
- package/script/src/interpreter/durable/DurableInterpreter.js +5 -17
- package/script/src/interpreter/memory/MemoryInterpreter.d.ts.map +1 -1
- package/script/src/interpreter/memory/MemoryInterpreter.js +5 -9
- package/script/src/kv/nats/NatsKeyValueProvider.d.ts.map +1 -1
- package/script/src/kv/nats/NatsKeyValueProvider.js +2 -2
- package/script/src/kv/sdk/SDKKeyValueProvider.d.ts.map +1 -1
- package/script/src/kv/sdk/SDKKeyValueProvider.js +3 -3
- package/esm/src/dsl/http/default.d.ts +0 -26
- package/esm/src/dsl/http/default.d.ts.map +0 -1
- package/esm/src/dsl/http/default.js +0 -56
- package/esm/src/dsl/http/versori/cli.d.ts +0 -2
- package/esm/src/dsl/http/versori/cli.d.ts.map +0 -1
- package/esm/src/dsl/http/versori/cli.js +0 -32
- package/esm/src/dsl/http/versori/internalauth.d.ts +0 -15
- package/esm/src/dsl/http/versori/internalauth.d.ts.map +0 -1
- package/esm/src/dsl/http/versori/internalauth.js +0 -102
- package/esm/src/dsl/http/versori/proxyroundtripper.d.ts +0 -23
- package/esm/src/dsl/http/versori/proxyroundtripper.d.ts.map +0 -1
- package/esm/src/dsl/http/versori/proxyroundtripper.js +0 -208
- package/script/src/dsl/http/default.d.ts +0 -26
- package/script/src/dsl/http/default.d.ts.map +0 -1
- package/script/src/dsl/http/default.js +0 -60
- package/script/src/dsl/http/versori/cli.d.ts +0 -2
- package/script/src/dsl/http/versori/cli.d.ts.map +0 -1
- package/script/src/dsl/http/versori/cli.js +0 -35
- package/script/src/dsl/http/versori/internalauth.d.ts +0 -15
- package/script/src/dsl/http/versori/internalauth.d.ts.map +0 -1
- package/script/src/dsl/http/versori/internalauth.js +0 -106
- package/script/src/dsl/http/versori/proxyroundtripper.d.ts +0 -23
- package/script/src/dsl/http/versori/proxyroundtripper.d.ts.map +0 -1
- package/script/src/dsl/http/versori/proxyroundtripper.js +0 -212
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Client } from '@connectrpc/connect';
|
|
2
|
+
import { CredentialsProvider } from '../credentials/CredentialsProvider.js';
|
|
3
|
+
import { VersoriConfigReader } from '../dsl/http/versori/configloader.js';
|
|
4
|
+
import { credentialv1alpha1, oauth1v1, tokensv1 } from '../services/credentials/mod.js';
|
|
5
|
+
import { PlatformApi } from '../services/platform/mod.js';
|
|
6
|
+
export declare class CredentialsProviderImpl implements CredentialsProvider {
|
|
7
|
+
private readonly credentials;
|
|
8
|
+
private readonly tokens;
|
|
9
|
+
private readonly oauth1;
|
|
10
|
+
private readonly configReader;
|
|
11
|
+
private platformApi;
|
|
12
|
+
private readonly organisationId;
|
|
13
|
+
constructor(credentials: Client<typeof credentialv1alpha1.CredentialService>, tokens: Client<typeof tokensv1.TokenService>, oauth1: Client<typeof oauth1v1.AuthorizationService>, configReader: VersoriConfigReader, platformApi: PlatformApi);
|
|
14
|
+
getRaw(name: string, _activationId?: string): Promise<Uint8Array>;
|
|
15
|
+
getAccessToken(name: string, forceRefresh?: boolean, _activationId?: string): Promise<{
|
|
16
|
+
accessToken: string;
|
|
17
|
+
tokenType: string;
|
|
18
|
+
expiry: Date | undefined;
|
|
19
|
+
}>;
|
|
20
|
+
getOAuth1Metadata(name: string, _activationId?: string): Promise<oauth1v1.GetAuthorizationMetadataResponse>;
|
|
21
|
+
private getCredentialIDFromName;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=CredentialsProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CredentialsProvider.d.ts","sourceRoot":"","sources":["../../../src/src/connection/CredentialsProvider.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAE1E,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AACxF,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE1D,qBAAa,uBAAwB,YAAW,mBAAmB;IAI3D,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,WAAW;IAPvB,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAS;gBAGnB,WAAW,EAAE,MAAM,CAAC,OAAO,kBAAkB,CAAC,iBAAiB,CAAC,EAChE,MAAM,EAAE,MAAM,CAAC,OAAO,QAAQ,CAAC,YAAY,CAAC,EAC5C,MAAM,EAAE,MAAM,CAAC,OAAO,QAAQ,CAAC,oBAAoB,CAAC,EACpD,YAAY,EAAE,mBAAmB,EAC1C,WAAW,EAAE,WAAW;IAK9B,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAWjE,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,OAAO,EAAE,aAAa,CAAC,EAAE,MAAM;;;;;IAc3E,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM;YAU9C,uBAAuB;CA4DxC"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2025 Versori Group Inc
|
|
4
|
+
*
|
|
5
|
+
* Use of this software is governed by the Business Source License 1.1
|
|
6
|
+
* included in the LICENSE file at the root of this repository.
|
|
7
|
+
*
|
|
8
|
+
* Change Date: 2029-01-01
|
|
9
|
+
* Change License: Apache License, Version 2.0
|
|
10
|
+
*
|
|
11
|
+
* As of the Change Date, in accordance with the Business Source License,
|
|
12
|
+
* use of this software will be governed by the Apache License, Version 2.0.
|
|
13
|
+
*/
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.CredentialsProviderImpl = void 0;
|
|
16
|
+
const protobuf_1 = require("@bufbuild/protobuf");
|
|
17
|
+
const wkt_1 = require("@bufbuild/protobuf/wkt");
|
|
18
|
+
const constants_js_1 = require("../internal/constants.js");
|
|
19
|
+
const mod_js_1 = require("../services/credentials/mod.js");
|
|
20
|
+
class CredentialsProviderImpl {
|
|
21
|
+
constructor(credentials, tokens, oauth1, configReader, platformApi) {
|
|
22
|
+
Object.defineProperty(this, "credentials", {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
configurable: true,
|
|
25
|
+
writable: true,
|
|
26
|
+
value: credentials
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(this, "tokens", {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
configurable: true,
|
|
31
|
+
writable: true,
|
|
32
|
+
value: tokens
|
|
33
|
+
});
|
|
34
|
+
Object.defineProperty(this, "oauth1", {
|
|
35
|
+
enumerable: true,
|
|
36
|
+
configurable: true,
|
|
37
|
+
writable: true,
|
|
38
|
+
value: oauth1
|
|
39
|
+
});
|
|
40
|
+
Object.defineProperty(this, "configReader", {
|
|
41
|
+
enumerable: true,
|
|
42
|
+
configurable: true,
|
|
43
|
+
writable: true,
|
|
44
|
+
value: configReader
|
|
45
|
+
});
|
|
46
|
+
Object.defineProperty(this, "platformApi", {
|
|
47
|
+
enumerable: true,
|
|
48
|
+
configurable: true,
|
|
49
|
+
writable: true,
|
|
50
|
+
value: platformApi
|
|
51
|
+
});
|
|
52
|
+
Object.defineProperty(this, "organisationId", {
|
|
53
|
+
enumerable: true,
|
|
54
|
+
configurable: true,
|
|
55
|
+
writable: true,
|
|
56
|
+
value: void 0
|
|
57
|
+
});
|
|
58
|
+
this.organisationId = Deno.env.get(constants_js_1.envVarOrgId) || 'development';
|
|
59
|
+
}
|
|
60
|
+
async getRaw(name, _activationId) {
|
|
61
|
+
const credentialId = await this.getCredentialIDFromName(name, _activationId);
|
|
62
|
+
const response = await this.credentials.get({ id: credentialId, organisationId: '' });
|
|
63
|
+
if (!response.credential) {
|
|
64
|
+
throw new Error(`Failed to get credential: ${name}`);
|
|
65
|
+
}
|
|
66
|
+
const rawData = (0, protobuf_1.create)(mod_js_1.credentialv1alpha1.CredentialDataRawSchema, response.credential.data);
|
|
67
|
+
return rawData.raw;
|
|
68
|
+
}
|
|
69
|
+
async getAccessToken(name, forceRefresh, _activationId) {
|
|
70
|
+
const credentialId = await this.getCredentialIDFromName(name, _activationId);
|
|
71
|
+
const response = await this.tokens.getToken({ credentialId: credentialId, forceRefresh: forceRefresh || false });
|
|
72
|
+
if (!response.token) {
|
|
73
|
+
throw new Error(`Failed to get token for credential: ${name}`);
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
accessToken: response.token.accessToken,
|
|
77
|
+
tokenType: response.token.tokenType,
|
|
78
|
+
expiry: response.token.expiry ? new Date((0, wkt_1.timestampMs)(response.token.expiry)) : undefined,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
async getOAuth1Metadata(name, _activationId) {
|
|
82
|
+
const credentialId = await this.getCredentialIDFromName(name, _activationId);
|
|
83
|
+
const response = await this.oauth1.getAuthorizationMetadata({ credentialId: credentialId });
|
|
84
|
+
if (!response) {
|
|
85
|
+
throw new Error(`Failed to get OAuth1 metadata for credential: ${name}`);
|
|
86
|
+
}
|
|
87
|
+
return response;
|
|
88
|
+
}
|
|
89
|
+
async getCredentialIDFromName(name, activationId) {
|
|
90
|
+
// fin connection config from versori file
|
|
91
|
+
const conn = this.configReader.getCnxMapping(name);
|
|
92
|
+
if (!conn) {
|
|
93
|
+
return '';
|
|
94
|
+
}
|
|
95
|
+
// if connection is dynamic try and load the activation
|
|
96
|
+
if (conn.dynamic) {
|
|
97
|
+
if (!activationId) {
|
|
98
|
+
throw new Error(`Connection ${name} is dynamic, but no activation ID was found on the context`);
|
|
99
|
+
}
|
|
100
|
+
if (!conn.templateId) {
|
|
101
|
+
throw new Error(`Connection ${name} is dynamic, but no template ID was found on the config`);
|
|
102
|
+
}
|
|
103
|
+
const { data: dynamicConn } = await this.platformApi.getActivationConnection({
|
|
104
|
+
path: {
|
|
105
|
+
activation_id: activationId,
|
|
106
|
+
env_system_id: conn.templateId,
|
|
107
|
+
organisation_id: this.organisationId,
|
|
108
|
+
},
|
|
109
|
+
});
|
|
110
|
+
if (!dynamicConn) {
|
|
111
|
+
throw new Error(`Connection ${name} not found`);
|
|
112
|
+
}
|
|
113
|
+
if (!dynamicConn.credentials[0]?.credential?.id) {
|
|
114
|
+
throw new Error(`Connection ${name} has no credentials defined on it`);
|
|
115
|
+
}
|
|
116
|
+
return dynamicConn.credentials[0].credential?.id;
|
|
117
|
+
}
|
|
118
|
+
// connection is not dynamic try and load static connection
|
|
119
|
+
if (!conn.connId) {
|
|
120
|
+
throw new Error(`Connection ${name} is static, but no connection ID was found on the config`);
|
|
121
|
+
}
|
|
122
|
+
const { data: staticConn } = await this.platformApi.getConnection({
|
|
123
|
+
path: {
|
|
124
|
+
organisation_id: this.organisationId,
|
|
125
|
+
connection_id: conn.connId,
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
if (!staticConn?.credentials[0]?.credential?.id) {
|
|
129
|
+
throw new Error(`Connection ${name}/${conn.connId} has no credentials defined on it`);
|
|
130
|
+
}
|
|
131
|
+
return staticConn.credentials[0].credential.id;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
exports.CredentialsProviderImpl = CredentialsProviderImpl;
|
|
@@ -15,9 +15,9 @@ import { ConnectionFactory, FetchLike } from './types.js';
|
|
|
15
15
|
*/
|
|
16
16
|
export declare class DirectConnectionFactory implements ConnectionFactory {
|
|
17
17
|
private readonly httpClientFactory;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
readonly credentials: Client<typeof credentialv1alpha1.CredentialService>;
|
|
19
|
+
readonly tokens: Client<typeof tokensv1.TokenService>;
|
|
20
|
+
readonly oauth1: Client<typeof oauth1v1.AuthorizationService>;
|
|
21
21
|
private readonly logger;
|
|
22
22
|
private readonly outboundConnectionFactory;
|
|
23
23
|
private readonly expressInboundConnectionFactory;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DirectConnectionFactory.d.ts","sourceRoot":"","sources":["../../../src/src/connection/DirectConnectionFactory.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"DirectConnectionFactory.d.ts","sourceRoot":"","sources":["../../../src/src/connection/DirectConnectionFactory.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEjD,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AACxF,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAGpE,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE1D;;;;;;;GAOG;AACH,qBAAa,uBAAwB,YAAW,iBAAiB;IAKzD,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAClC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC,OAAO,kBAAkB,CAAC,iBAAiB,CAAC;IACzE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,QAAQ,CAAC,YAAY,CAAC;IACrD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,QAAQ,CAAC,oBAAoB,CAAC;IAC7D,OAAO,CAAC,QAAQ,CAAC,MAAM;IAR3B,OAAO,CAAC,QAAQ,CAAC,yBAAyB,CAA4B;IACtE,OAAO,CAAC,QAAQ,CAAC,+BAA+B,CAA2B;gBAGtD,iBAAiB,EAAE,iBAAiB,EAC5C,WAAW,EAAE,MAAM,CAAC,OAAO,kBAAkB,CAAC,iBAAiB,CAAC,EAChE,MAAM,EAAE,MAAM,CAAC,OAAO,QAAQ,CAAC,YAAY,CAAC,EAC5C,MAAM,EAAE,MAAM,CAAC,OAAO,QAAQ,CAAC,oBAAoB,CAAC,EAC5C,MAAM,EAAE,MAAM;IAkBnC,OAAO,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC;IAI5C,OAAO,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,cAAc,CAAC;IAIjD,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,uBAAuB;CAuB1D"}
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.DirectConnectionFactory = void 0;
|
|
16
16
|
const connect_node_1 = require("@connectrpc/connect-node");
|
|
17
|
-
const
|
|
17
|
+
const constants_js_1 = require("../internal/constants.js");
|
|
18
18
|
const createConnectRpcClient_js_1 = require("../services/createConnectRpcClient.js");
|
|
19
|
+
const mod_js_1 = require("../services/credentials/mod.js");
|
|
19
20
|
const HttpClientFactory_js_1 = require("./internal/HttpClientFactory.js");
|
|
20
21
|
const InboundConnectionFactory_js_1 = require("./internal/InboundConnectionFactory.js");
|
|
21
22
|
const OutboundConnectionFactory_js_1 = require("./internal/OutboundConnectionFactory.js");
|
|
22
|
-
const constants_js_1 = require("../internal/constants.js");
|
|
23
23
|
/**
|
|
24
24
|
* DirectConnectionFactory is used by actual {@link FetchFactory} and {@link ExpressHandlers} implementations to build a
|
|
25
25
|
* fetchers and handlers for a given connection.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { MessageInitShape } from '@bufbuild/protobuf';
|
|
2
|
+
import { Client } from '@connectrpc/connect';
|
|
3
|
+
import { credentialv1alpha1, oauth1v1 } from '../services/credentials/mod.js';
|
|
4
|
+
export type Token = {
|
|
5
|
+
accessToken: string;
|
|
6
|
+
tokenType: string;
|
|
7
|
+
expiry?: Date;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* CredentialsProvider is the interface for interacting with the credentials service.
|
|
11
|
+
*/
|
|
12
|
+
export interface CredentialsProvider {
|
|
13
|
+
getRaw(name: string, activationId?: string): Promise<Uint8Array>;
|
|
14
|
+
getAccessToken(name: string, forceRefresh?: boolean, activationId?: string): Promise<Token>;
|
|
15
|
+
getOAuth1Metadata(name: string, activationId?: string): Promise<oauth1v1.GetAuthorizationMetadataResponse>;
|
|
16
|
+
}
|
|
17
|
+
export type CredentialData = {
|
|
18
|
+
[key: string]: Uint8Array;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* CredentialsProviderV2 is the latest version of the CredentialsProvider interface and provides more capabilities for
|
|
22
|
+
* interacting with the credentials service.
|
|
23
|
+
*
|
|
24
|
+
* All implementations should be provided a fixed organisation ID to prevent misuse of the API.
|
|
25
|
+
*/
|
|
26
|
+
export interface CredentialsProviderV2 {
|
|
27
|
+
get(id: string): Promise<credentialv1alpha1.Credential>;
|
|
28
|
+
updateApiKey(id: string, key: string): Promise<credentialv1alpha1.Credential>;
|
|
29
|
+
updateBasicAuth(id: string, username: string, password: string): Promise<credentialv1alpha1.Credential>;
|
|
30
|
+
updateCertificate(id: string, payload: MessageInitShape<typeof credentialv1alpha1.CredentialDataCertificateSchema>): Promise<credentialv1alpha1.Credential>;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* CredentialsProviderV2 is the latest version of the CredentialsProvider interface and provides more capabilities for
|
|
34
|
+
* interacting with the credentials service.
|
|
35
|
+
*
|
|
36
|
+
* THIS IS A WORK IN PROGRESS - WE SHOULD STILL USE THE V1 INTERFACE FOR NOW.
|
|
37
|
+
*
|
|
38
|
+
* No idea if this approach is a good idea, happy to change it if there's a better way.
|
|
39
|
+
*/
|
|
40
|
+
export declare class CredentialsProviderImpl implements CredentialsProviderV2 {
|
|
41
|
+
private readonly client;
|
|
42
|
+
private readonly organisationId;
|
|
43
|
+
constructor(client: Client<typeof credentialv1alpha1.CredentialService>, organisationId: string);
|
|
44
|
+
get(id: string): Promise<credentialv1alpha1.Credential>;
|
|
45
|
+
updateApiKey(id: string, key: string): Promise<credentialv1alpha1.Credential>;
|
|
46
|
+
updateBasicAuth(id: string, username: string, password: string): Promise<credentialv1alpha1.Credential>;
|
|
47
|
+
updateCertificate(id: string, payload: MessageInitShape<typeof credentialv1alpha1.CredentialDataCertificateSchema>): Promise<credentialv1alpha1.Credential>;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=CredentialsProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CredentialsProvider.d.ts","sourceRoot":"","sources":["../../../src/src/credentials/CredentialsProvider.ts"],"names":[],"mappings":"AAaA,OAAO,EAAU,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAS9E,MAAM,MAAM,KAAK,GAAG;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,IAAI,CAAC;CACjB,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAEjE,cAAc,CACV,IAAI,EAAE,MAAM,EACZ,YAAY,CAAC,EAAE,OAAO,EACtB,YAAY,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,KAAK,CAAC,CAAC;IAElB,iBAAiB,CACb,IAAI,EAAE,MAAM,EACZ,YAAY,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,QAAQ,CAAC,gCAAgC,CAAC,CAAC;CACzD;AAED,MAAM,MAAM,cAAc,GAAG;IAAE,C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CAAC,GACrF,OAAO,CAAC,kBAAkB,CAAC,UAAU,CAAC;CAyB5C"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2025 Versori Group Inc
|
|
4
|
+
*
|
|
5
|
+
* Use of this software is governed by the Business Source License 1.1
|
|
6
|
+
* included in the LICENSE file at the root of this repository.
|
|
7
|
+
*
|
|
8
|
+
* Change Date: 2029-01-01
|
|
9
|
+
* Change License: Apache License, Version 2.0
|
|
10
|
+
*
|
|
11
|
+
* As of the Change Date, in accordance with the Business Source License,
|
|
12
|
+
* use of this software will be governed by the Apache License, Version 2.0.
|
|
13
|
+
*/
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.CredentialsProviderImpl = void 0;
|
|
16
|
+
const protobuf_1 = require("@bufbuild/protobuf");
|
|
17
|
+
const base64_js_1 = require("../../deps/jsr.io/@std/encoding/1.0.10/base64.js");
|
|
18
|
+
const mod_js_1 = require("../services/credentials/mod.js");
|
|
19
|
+
/**
|
|
20
|
+
* CredentialsProviderV2 is the latest version of the CredentialsProvider interface and provides more capabilities for
|
|
21
|
+
* interacting with the credentials service.
|
|
22
|
+
*
|
|
23
|
+
* THIS IS A WORK IN PROGRESS - WE SHOULD STILL USE THE V1 INTERFACE FOR NOW.
|
|
24
|
+
*
|
|
25
|
+
* No idea if this approach is a good idea, happy to change it if there's a better way.
|
|
26
|
+
*/
|
|
27
|
+
class CredentialsProviderImpl {
|
|
28
|
+
constructor(client, organisationId) {
|
|
29
|
+
Object.defineProperty(this, "client", {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
configurable: true,
|
|
32
|
+
writable: true,
|
|
33
|
+
value: client
|
|
34
|
+
});
|
|
35
|
+
Object.defineProperty(this, "organisationId", {
|
|
36
|
+
enumerable: true,
|
|
37
|
+
configurable: true,
|
|
38
|
+
writable: true,
|
|
39
|
+
value: organisationId
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
async get(id) {
|
|
43
|
+
const response = await this.client.get({ id, organisationId: this.organisationId });
|
|
44
|
+
if (!response.credential) {
|
|
45
|
+
throw new Error('Failed to get credential, response was undefined');
|
|
46
|
+
}
|
|
47
|
+
return response.credential;
|
|
48
|
+
}
|
|
49
|
+
async updateApiKey(id, key) {
|
|
50
|
+
const rawMsg = (0, protobuf_1.create)(mod_js_1.credentialv1alpha1.CredentialDataRawSchema, {
|
|
51
|
+
raw: new TextEncoder().encode((0, base64_js_1.encodeBase64)(key)),
|
|
52
|
+
});
|
|
53
|
+
const response = await this.client.update({
|
|
54
|
+
id,
|
|
55
|
+
organisationId: this.organisationId,
|
|
56
|
+
data: {
|
|
57
|
+
raw: rawMsg.raw,
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
if (!response.credential) {
|
|
61
|
+
throw new Error('Failed to update API key credential, response was undefined');
|
|
62
|
+
}
|
|
63
|
+
return response.credential;
|
|
64
|
+
}
|
|
65
|
+
async updateBasicAuth(id, username, password) {
|
|
66
|
+
const basicAuthMsg = (0, protobuf_1.create)(mod_js_1.credentialv1alpha1.CredentialDataBasicAuthSchema, {
|
|
67
|
+
username,
|
|
68
|
+
password,
|
|
69
|
+
});
|
|
70
|
+
const data = {
|
|
71
|
+
username: new TextEncoder().encode((0, base64_js_1.encodeBase64)(basicAuthMsg.username)),
|
|
72
|
+
password: new TextEncoder().encode((0, base64_js_1.encodeBase64)(basicAuthMsg.password)),
|
|
73
|
+
};
|
|
74
|
+
const response = await this.client.update({
|
|
75
|
+
id,
|
|
76
|
+
organisationId: this.organisationId,
|
|
77
|
+
data,
|
|
78
|
+
});
|
|
79
|
+
if (!response.credential) {
|
|
80
|
+
throw new Error('Failed to update basic auth credential, response was undefined');
|
|
81
|
+
}
|
|
82
|
+
return response.credential;
|
|
83
|
+
}
|
|
84
|
+
async updateCertificate(id, payload) {
|
|
85
|
+
const certificateMsg = (0, protobuf_1.create)(mod_js_1.credentialv1alpha1.CredentialDataCertificateSchema, {
|
|
86
|
+
certificate: payload.certificate,
|
|
87
|
+
key: payload.key,
|
|
88
|
+
ca: payload.ca,
|
|
89
|
+
});
|
|
90
|
+
const data = {
|
|
91
|
+
certificate: new TextEncoder().encode((0, base64_js_1.encodeBase64)(certificateMsg.certificate)),
|
|
92
|
+
key: new TextEncoder().encode((0, base64_js_1.encodeBase64)(certificateMsg.key)),
|
|
93
|
+
ca: new TextEncoder().encode((0, base64_js_1.encodeBase64)(certificateMsg.ca)),
|
|
94
|
+
};
|
|
95
|
+
const response = await this.client.update({
|
|
96
|
+
id,
|
|
97
|
+
organisationId: this.organisationId,
|
|
98
|
+
data,
|
|
99
|
+
});
|
|
100
|
+
if (!response.credential) {
|
|
101
|
+
throw new Error('Failed to update certificate credential, response was undefined');
|
|
102
|
+
}
|
|
103
|
+
return response.credential;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
exports.CredentialsProviderImpl = CredentialsProviderImpl;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DurableInterpreter.d.ts","sourceRoot":"","sources":["../../../../src/src/interpreter/durable/DurableInterpreter.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;
|
|
1
|
+
{"version":3,"file":"DurableInterpreter.d.ts","sourceRoot":"","sources":["../../../../src/src/interpreter/durable/DurableInterpreter.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,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C;IAuG9F,QAAQ,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,yBAAyB;IAoDtE,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IA4MtB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CASxB"}
|
|
@@ -22,13 +22,12 @@ const resources_1 = require("@opentelemetry/resources");
|
|
|
22
22
|
const sdk_node_1 = require("@opentelemetry/sdk-node");
|
|
23
23
|
const express_1 = __importDefault(require("express"));
|
|
24
24
|
const rxjs_1 = require("rxjs");
|
|
25
|
+
const CredentialsProvider_js_1 = require("../../connection/CredentialsProvider.js");
|
|
25
26
|
const DirectConnectionFactory_js_1 = require("../../connection/DirectConnectionFactory.js");
|
|
26
27
|
const ContextProvider_js_1 = require("../../context/ContextProvider.js");
|
|
27
|
-
const default_js_1 = require("../../dsl/http/default.js");
|
|
28
28
|
const configloader_js_1 = require("../../dsl/http/versori/configloader.js");
|
|
29
29
|
const constants_js_1 = require("../../dsl/http/versori/constants.js");
|
|
30
30
|
const cronapi_js_1 = require("../../dsl/http/versori/cronapi.js");
|
|
31
|
-
const proxyroundtripper_js_1 = require("../../dsl/http/versori/proxyroundtripper.js");
|
|
32
31
|
const Workflow_js_1 = require("../../dsl/Workflow.js");
|
|
33
32
|
const Issues_js_1 = require("../../issues/Issues.js");
|
|
34
33
|
const MemoryKeyValueProvider_js_1 = require("../../kv/memory/MemoryKeyValueProvider.js");
|
|
@@ -43,14 +42,6 @@ function getKVProvider(runLocal) {
|
|
|
43
42
|
}
|
|
44
43
|
return SDKKeyValueProvider_js_1.SDKKeyValueProvider.fromEnv();
|
|
45
44
|
}
|
|
46
|
-
function getRoundTripperFactory(log, _tracer, opts) {
|
|
47
|
-
if (opts && opts.runLocal) {
|
|
48
|
-
log.info('Running in local mode, using ProxyRoundTripperFactory');
|
|
49
|
-
return proxyroundtripper_js_1.ProxyRoundTripper.fromEnv(log);
|
|
50
|
-
}
|
|
51
|
-
log.info('Running with default round tripper factory');
|
|
52
|
-
return new default_js_1.DefaultRoundTripperFactory();
|
|
53
|
-
}
|
|
54
45
|
/**
|
|
55
46
|
* DurableInterpreter is an interpreter for executing Versori workflows with support for durable, queue-based workflow
|
|
56
47
|
* execution. It supports all trigger types including the {@link workflow} trigger which allows workflows to be started
|
|
@@ -234,23 +225,20 @@ class DurableInterpreter {
|
|
|
234
225
|
otelSDK.start();
|
|
235
226
|
}
|
|
236
227
|
const tracer = api_1.default.trace.getTracer(serviceName, version);
|
|
237
|
-
const roundTripperFactory = getRoundTripperFactory(log, tracer, {
|
|
238
|
-
skipVersoriCredentials: options.skipVersoriCredentials,
|
|
239
|
-
runLocal: runLocal,
|
|
240
|
-
});
|
|
241
228
|
const queueProvider = await Queue_js_1.QueueImpl.fromEnv(log);
|
|
229
|
+
const connectionFactory = DirectConnectionFactory_js_1.DirectConnectionFactory.fromEnv(log);
|
|
242
230
|
const issuesProvider = new Issues_js_1.IssueImpl(log);
|
|
243
231
|
if (options.contextProvider) {
|
|
244
232
|
// no need to set up a key-value provider if options.contextProvider is already
|
|
245
233
|
// initialised.
|
|
246
|
-
return new DurableInterpreter(log, compiler, options.contextProvider, express_1.default.Router(), express_1.default.Router(), new Map(), PlatformApi_js_1.PlatformApiImpl.fromEnv(),
|
|
234
|
+
return new DurableInterpreter(log, compiler, options.contextProvider, express_1.default.Router(), express_1.default.Router(), new Map(), PlatformApi_js_1.PlatformApiImpl.fromEnv(), connectionFactory, cronapi_js_1.CronAPIClient.fromEnv(), tracer, issuesProvider, configReader, queueProvider, otelSDK);
|
|
247
235
|
}
|
|
248
236
|
const kvp = await getKVProvider(runLocal);
|
|
249
237
|
const platformApi = PlatformApi_js_1.PlatformApiImpl.fromEnv();
|
|
250
238
|
const organisationId = Deno.env.get(constants_js_1.envVarOrgId) || 'development';
|
|
251
239
|
const environmentId = Deno.env.get(constants_js_1.envVarEnvId) || 'development';
|
|
252
|
-
const ctxProvider = new ContextProvider_js_1.ContextProviderImpl(log, kvp,
|
|
253
|
-
return new DurableInterpreter(log, compiler, ctxProvider, express_1.default.Router(), express_1.default.Router(), new Map(), PlatformApi_js_1.PlatformApiImpl.fromEnv(),
|
|
240
|
+
const ctxProvider = new ContextProvider_js_1.ContextProviderImpl(log, kvp, new CredentialsProvider_js_1.CredentialsProviderImpl(connectionFactory.credentials, connectionFactory.tokens, connectionFactory.oauth1, configReader, platformApi), platformApi, organisationId, environmentId, issuesProvider);
|
|
241
|
+
return new DurableInterpreter(log, compiler, ctxProvider, express_1.default.Router(), express_1.default.Router(), new Map(), PlatformApi_js_1.PlatformApiImpl.fromEnv(), connectionFactory, cronapi_js_1.CronAPIClient.fromEnv(), tracer, issuesProvider, configReader, queueProvider, otelSDK);
|
|
254
242
|
}
|
|
255
243
|
register(workflow, options) {
|
|
256
244
|
const localAbortController = new AbortController();
|
|
@@ -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;
|
|
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;AAEtF,OAAO,EAAE,uB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");
|
|
23
23
|
const express_1 = __importDefault(require("express"));
|
|
24
24
|
const rxjs_1 = require("rxjs");
|
|
25
|
+
const CredentialsProvider_js_1 = require("../../connection/CredentialsProvider.js");
|
|
25
26
|
const DirectConnectionFactory_js_1 = require("../../connection/DirectConnectionFactory.js");
|
|
26
27
|
const ContextProvider_js_1 = require("../../context/ContextProvider.js");
|
|
27
|
-
const default_js_1 = require("../../dsl/http/default.js");
|
|
28
28
|
const configloader_js_1 = require("../../dsl/http/versori/configloader.js");
|
|
29
|
-
const constants_js_1 = require("../../dsl/http/versori/constants.js");
|
|
30
29
|
const cronapi_js_1 = require("../../dsl/http/versori/cronapi.js");
|
|
31
30
|
const Workflow_js_1 = require("../../dsl/Workflow.js");
|
|
31
|
+
const constants_js_1 = require("../../internal/constants.js");
|
|
32
32
|
const Issues_js_1 = require("../../issues/Issues.js");
|
|
33
33
|
const MemoryKeyValueProvider_js_1 = require("../../kv/memory/MemoryKeyValueProvider.js");
|
|
34
34
|
const NatsKeyValueProvider_js_1 = require("../../kv/nats/NatsKeyValueProvider.js");
|
|
@@ -41,10 +41,6 @@ function getKVProvider(runLocal) {
|
|
|
41
41
|
}
|
|
42
42
|
return NatsKeyValueProvider_js_1.NatsKeyValueProvider.fromEnv();
|
|
43
43
|
}
|
|
44
|
-
function getRoundTripperFactory(log) {
|
|
45
|
-
log.info('Running with default round tripper factory');
|
|
46
|
-
return new default_js_1.DefaultRoundTripperFactory();
|
|
47
|
-
}
|
|
48
44
|
/**
|
|
49
45
|
* MemoryInterpreter is the default interpreter for executing Versori workflows. It handles registration and execution
|
|
50
46
|
* of workflows triggered by schedules and webhooks.
|
|
@@ -211,7 +207,7 @@ class MemoryInterpreter {
|
|
|
211
207
|
otelSDK.start();
|
|
212
208
|
}
|
|
213
209
|
const tracer = api_1.default.trace.getTracer(serviceName, version);
|
|
214
|
-
const
|
|
210
|
+
const connectionFactory = DirectConnectionFactory_js_1.DirectConnectionFactory.fromEnv(log);
|
|
215
211
|
const issuesProvider = new Issues_js_1.IssueImpl(log);
|
|
216
212
|
if (options.contextProvider) {
|
|
217
213
|
// no need to set up a key-value provider if options.contextProvider is already
|
|
@@ -222,8 +218,8 @@ class MemoryInterpreter {
|
|
|
222
218
|
const platformApi = PlatformApi_js_1.PlatformApiImpl.fromEnv();
|
|
223
219
|
const organisationId = Deno.env.get(constants_js_1.envVarOrgId) || 'development';
|
|
224
220
|
const environmentId = Deno.env.get(constants_js_1.envVarEnvId) || 'development';
|
|
225
|
-
const ctxProvider = new ContextProvider_js_1.ContextProviderImpl(log, kvp,
|
|
226
|
-
return new MemoryInterpreter(log, compiler, ctxProvider, express_1.default.Router(), express_1.default.Router(), new Map(),
|
|
221
|
+
const ctxProvider = new ContextProvider_js_1.ContextProviderImpl(log, kvp, new CredentialsProvider_js_1.CredentialsProviderImpl(connectionFactory.credentials, connectionFactory.tokens, connectionFactory.oauth1, configReader, platformApi), platformApi, organisationId, environmentId, issuesProvider);
|
|
222
|
+
return new MemoryInterpreter(log, compiler, ctxProvider, express_1.default.Router(), express_1.default.Router(), new Map(), connectionFactory, cronapi_js_1.CronAPIClient.fromEnv(), tracer, issuesProvider, configReader, otelSDK);
|
|
227
223
|
}
|
|
228
224
|
register(workflow, options) {
|
|
229
225
|
const localAbortController = new AbortController();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NatsKeyValueProvider.d.ts","sourceRoot":"","sources":["../../../../src/src/kv/nats/NatsKeyValueProvider.ts"],"names":[],"mappings":"AAeA,OAAO,EAA+B,UAAU,EAAE,MAAM,+DAA+D,CAAC;
|
|
1
|
+
{"version":3,"file":"NatsKeyValueProvider.d.ts","sourceRoot":"","sources":["../../../../src/src/kv/nats/NatsKeyValueProvider.ts"],"names":[],"mappings":"AAeA,OAAO,EAA+B,UAAU,EAAE,MAAM,+DAA+D,CAAC;AAExH,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AA4CvF,MAAM,MAAM,2BAA2B,GAAG;IACtC,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE;QACF,GAAG,EAAE,MAAM,CAAC;QACZ,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,GAAG,CAAC,EAAE,UAAU,CAAC;KACpB,CAAC;CACL,CAAC;AAuBF,qBAAa,oBAAqB,YAAW,gBAAgB,EAAE,eAAe;IAEtE,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACjC,OAAO,CAAC,QAAQ,CAAC,IAAI;IALzB,OAAO;WAQM,WAAW,CACpB,IAAI,GAAE,OAAO,CAAC,2BAA2B,CAAM,GAChD,OAAO,CAAC,oBAAoB,CAAC;IA0BhC,MAAM,CAAC,OAAO,IAAI,OAAO,CAAC,oBAAoB,CAAC;IAI/C,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,WAAW,CAAC,IAAI,CAAC;IAI1C,EAAE,CAAC,OAAO,EAAE,SAAS,GAAG,QAAQ;IAqB1B,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IA6CrD,OAAO,CAAC,aAAa;CAYxB"}
|
|
@@ -16,8 +16,8 @@ exports.NatsKeyValueProvider = void 0;
|
|
|
16
16
|
const mod_js_1 = require("../../../deps/jsr.io/@nats-io/jetstream/3.2.0/src/mod.js");
|
|
17
17
|
const mod_js_2 = require("../../../deps/jsr.io/@nats-io/kv/3.2.0/src/mod.js");
|
|
18
18
|
const mod_js_3 = require("../../../deps/jsr.io/@nats-io/transport-deno/3.2.0/src/mod.js");
|
|
19
|
-
const NatsKeyValue_js_1 = require("./NatsKeyValue.js");
|
|
20
19
|
const isKVOptionsExecution_js_1 = require("../isKVOptionsExecution.js");
|
|
20
|
+
const NatsKeyValue_js_1 = require("./NatsKeyValue.js");
|
|
21
21
|
function getOptionsFromEnv() {
|
|
22
22
|
const natsTlsCaFile = Deno.env.get('RUN_NATS_TLS_CA_FILE');
|
|
23
23
|
return {
|
|
@@ -175,7 +175,7 @@ class NatsKeyValueProvider {
|
|
|
175
175
|
const activationSuffix = options.activationId ? `.${options.activationId}` : '';
|
|
176
176
|
switch (options.scope) {
|
|
177
177
|
case ':organization:':
|
|
178
|
-
return `${this.opts.organizationId}
|
|
178
|
+
return `${this.opts.organizationId}`;
|
|
179
179
|
case ':project:':
|
|
180
180
|
return `${this.opts.organizationId}.${this.opts.projectId}.${this.opts.environment}${activationSuffix}`;
|
|
181
181
|
case ':execution:':
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SDKKeyValueProvider.d.ts","sourceRoot":"","sources":["../../../../src/src/kv/sdk/SDKKeyValueProvider.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SDKKeyValueProvider.d.ts","sourceRoot":"","sources":["../../../../src/src/kv/sdk/SDKKeyValueProvider.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAkCvF,MAAM,MAAM,0BAA0B,GAAG;IACrC,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CACpB,CAAC;AA6BF,qBAAa,mBAAoB,YAAW,gBAAgB,EAAE,eAAe;IAErE,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACjC,OAAO,CAAC,QAAQ,CAAC,IAAI;IAJzB,OAAO;WAOM,WAAW,CACpB,IAAI,GAAE,OAAO,CAAC,0BAA0B,CAAM,GAC/C,OAAO,CAAC,mBAAmB,CAAC;IAY/B,MAAM,CAAC,OAAO,IAAI,OAAO,CAAC,mBAAmB,CAAC;IAI9C,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,WAAW,CAAC,IAAI,CAAC;IAI1C,EAAE,CAAC,OAAO,EAAE,SAAS,GAAG,QAAQ;IAqB1B,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IA6CrD,OAAO,CAAC,aAAa;CAYxB"}
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
*/
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.SDKKeyValueProvider = void 0;
|
|
16
|
-
const StoresService_js_1 = require("../../dsl/http/versori/kvapi/services/StoresService.js");
|
|
17
16
|
const KvOperationsService_js_1 = require("../../dsl/http/versori/kvapi/services/KvOperationsService.js");
|
|
18
|
-
const
|
|
17
|
+
const StoresService_js_1 = require("../../dsl/http/versori/kvapi/services/StoresService.js");
|
|
19
18
|
const isKVOptionsExecution_js_1 = require("../isKVOptionsExecution.js");
|
|
19
|
+
const SDKKeyValue_js_1 = require("./SDKKeyValue.js");
|
|
20
20
|
function getOptionsFromEnv() {
|
|
21
21
|
return {
|
|
22
22
|
organizationId: Deno.env.get('RUN_ORGANISATION_ID'),
|
|
@@ -148,7 +148,7 @@ class SDKKeyValueProvider {
|
|
|
148
148
|
const activationSuffix = options.activationId ? `/${options.activationId}` : '';
|
|
149
149
|
switch (options.scope) {
|
|
150
150
|
case ':organization:':
|
|
151
|
-
return `${this.opts.organizationId}
|
|
151
|
+
return `${this.opts.organizationId}`;
|
|
152
152
|
case ':project:':
|
|
153
153
|
return `${this.opts.organizationId}/${this.opts.projectId}/${this.opts.environment}${activationSuffix}`;
|
|
154
154
|
case ':execution:':
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { DynamicFetcher, RoundTripperFactory } from './types.js';
|
|
2
|
-
import { CredentialsProvider } from './versori/contextcredentials.js';
|
|
3
|
-
/**
|
|
4
|
-
* A factory class for creating a default round tripper.
|
|
5
|
-
* This class is used to provide a default implementation for initializing
|
|
6
|
-
* if no round tripper factory is given.
|
|
7
|
-
*/
|
|
8
|
-
export declare class DefaultRoundTripperFactory implements RoundTripperFactory {
|
|
9
|
-
/**
|
|
10
|
-
* Constructs a new instance of the DefaultRoundTripperFactory.
|
|
11
|
-
*/
|
|
12
|
-
constructor();
|
|
13
|
-
/**
|
|
14
|
-
* Creates a round tripper function.
|
|
15
|
-
* This implementation simply returns the fetch function passed to it.
|
|
16
|
-
*
|
|
17
|
-
* @param connName - The name of the connection.
|
|
18
|
-
* @param fn - The fetch function to be used. Defaults to the global fetch function.
|
|
19
|
-
* @returns A promise that resolves to the fetch function.
|
|
20
|
-
*/
|
|
21
|
-
create(_connName: string): Promise<typeof fetch>;
|
|
22
|
-
createDynamic(_templateName: string): Promise<DynamicFetcher>;
|
|
23
|
-
credentials(): CredentialsProvider;
|
|
24
|
-
baseUrlFetcher(_connName: string): (activationId: string) => Promise<string>;
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=default.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../../../src/src/dsl/http/default.ts"],"names":[],"mappings":"AAcA,OAAO,EAAc,cAAc,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAGtE;;;;GAIG;AACH,qBAAa,0BAA2B,YAAW,mBAAmB;IAClE;;OAEG;;IAIH;;;;;;;OAOG;IACH,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,KAAK,CAAC;IAIhD,aAAa,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAU7D,WAAW,IAAI,mBAAmB;IAclC,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC;CAG/E"}
|