@versori/run 0.2.0-alpha.9 → 0.2.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/console_handler.js +1 -1
- package/esm/src/context/Context.d.ts +5 -1
- package/esm/src/context/Context.d.ts.map +1 -1
- package/esm/src/context/Context.js +15 -4
- package/esm/src/context/ContextProvider.d.ts +3 -1
- 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 +38 -0
- package/esm/src/dsl/http/versori/credentials/credentials.d.ts.map +1 -1
- package/esm/src/dsl/http/versori/credentials/credentials.js +7 -8
- 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 +11 -4
- package/esm/src/dsl/http/versori/roundtripper.d.ts.map +1 -1
- package/esm/src/dsl/http/versori/roundtripper.js +81 -14
- package/esm/src/dsl/tasks/HttpTask.d.ts.map +1 -1
- package/esm/src/dsl/tasks/HttpTask.js +1 -1
- package/esm/src/interpreter/memory/MemoryInterpreter.d.ts.map +1 -1
- package/esm/src/interpreter/memory/MemoryInterpreter.js +11 -3
- 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 +2 -1
- 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/console_handler.js +1 -1
- package/script/src/context/Context.d.ts +5 -1
- package/script/src/context/Context.d.ts.map +1 -1
- package/script/src/context/Context.js +15 -4
- package/script/src/context/ContextProvider.d.ts +3 -1
- 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 +38 -0
- package/script/src/dsl/http/versori/credentials/credentials.d.ts.map +1 -1
- package/script/src/dsl/http/versori/credentials/credentials.js +8 -8
- 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 +11 -4
- package/script/src/dsl/http/versori/roundtripper.d.ts.map +1 -1
- package/script/src/dsl/http/versori/roundtripper.js +83 -16
- package/script/src/dsl/tasks/HttpTask.d.ts.map +1 -1
- package/script/src/dsl/tasks/HttpTask.js +1 -1
- package/script/src/interpreter/memory/MemoryInterpreter.d.ts.map +1 -1
- package/script/src/interpreter/memory/MemoryInterpreter.js +10 -2
- 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
|
@@ -1,39 +1,130 @@
|
|
|
1
1
|
import * as log from '../../../deps/jsr.io/@std/log/0.224.14/mod.js';
|
|
2
|
-
function
|
|
3
|
-
|
|
2
|
+
function isObjectLiteral(obj) {
|
|
3
|
+
return Object.getPrototypeOf(obj) === Object.prototype;
|
|
4
|
+
}
|
|
5
|
+
function formatError(err) {
|
|
6
|
+
if (Symbol.toPrimitive in err) {
|
|
7
|
+
const toPrimitive = err[Symbol.toPrimitive];
|
|
8
|
+
if (typeof toPrimitive === 'function') {
|
|
9
|
+
return toPrimitive();
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
const ret = {
|
|
13
|
+
error: err.message,
|
|
14
|
+
};
|
|
15
|
+
if (err.cause) {
|
|
16
|
+
if (err.cause instanceof Error) {
|
|
17
|
+
ret.cause = formatError(err.cause);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
// potential place to Deno.inspect?
|
|
21
|
+
ret.cause = formatArg(err.cause);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
if (err.stack) {
|
|
25
|
+
ret.stacktrace = err.stack;
|
|
26
|
+
}
|
|
27
|
+
return ret;
|
|
28
|
+
}
|
|
29
|
+
// deno-lint-ignore ban-types
|
|
30
|
+
function formatFunction(fn) {
|
|
31
|
+
const str = fn.toString();
|
|
32
|
+
return {
|
|
33
|
+
[`<fn:${fn.name}>`]: str.length > 40 ? `${str.substring(0, 40)}...` : str,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function formatArg(arg, nested = false) {
|
|
37
|
+
switch (typeof arg) {
|
|
4
38
|
case 'object':
|
|
5
|
-
if (
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
39
|
+
if (arg === null) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
if (Array.isArray(arg)) {
|
|
43
|
+
return arg.map((arg) => formatArg(arg));
|
|
44
|
+
}
|
|
45
|
+
if (arg instanceof Date) {
|
|
46
|
+
return arg.toISOString();
|
|
47
|
+
}
|
|
48
|
+
if (Symbol.toPrimitive in arg) {
|
|
49
|
+
const toPrimitive = arg[Symbol.toPrimitive];
|
|
50
|
+
if (typeof toPrimitive === 'function') {
|
|
51
|
+
return toPrimitive();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (arg instanceof Error) {
|
|
55
|
+
if (nested) {
|
|
56
|
+
return formatError(arg);
|
|
9
57
|
}
|
|
10
|
-
return
|
|
11
|
-
[`arg${idx}`]: obj,
|
|
12
|
-
};
|
|
58
|
+
return arg;
|
|
13
59
|
}
|
|
14
|
-
if (
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
60
|
+
if (isObjectLiteral(arg)) {
|
|
61
|
+
// object literal or directly created by `new Object()`, not subclasses of Object.
|
|
62
|
+
return Object.entries(arg).reduce((acc, [key, value]) => ({
|
|
63
|
+
...acc,
|
|
64
|
+
[key]: formatArg(value, true),
|
|
65
|
+
}), {});
|
|
18
66
|
}
|
|
19
|
-
return
|
|
67
|
+
return Deno.inspect(arg);
|
|
20
68
|
case 'undefined':
|
|
21
|
-
return
|
|
22
|
-
[`arg${idx}`]: undefined,
|
|
23
|
-
};
|
|
69
|
+
return '<undefined>';
|
|
24
70
|
case 'function':
|
|
25
|
-
return
|
|
26
|
-
[`arg${idx}`]: obj.valueOf(),
|
|
27
|
-
};
|
|
71
|
+
return formatFunction(arg);
|
|
28
72
|
default:
|
|
29
|
-
return
|
|
30
|
-
|
|
31
|
-
|
|
73
|
+
return arg;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function formatArgs(args) {
|
|
77
|
+
if (args.length === 0) {
|
|
78
|
+
return {};
|
|
79
|
+
}
|
|
80
|
+
if (args.length === 1) {
|
|
81
|
+
const formatted = formatArg(args[0]);
|
|
82
|
+
if (formatted instanceof Error) {
|
|
83
|
+
return formatError(formatted);
|
|
84
|
+
}
|
|
85
|
+
if (typeof formatted === 'object' && formatted !== null) {
|
|
86
|
+
return formatted;
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
89
|
+
arg0: formatted,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
const errors = [];
|
|
93
|
+
const others = [];
|
|
94
|
+
for (const arg of args) {
|
|
95
|
+
const formatted = formatArgs([arg]);
|
|
96
|
+
if (arg instanceof Error) {
|
|
97
|
+
// formatted isn't an instanceof Error after `formatArgs()`, so check original `arg`.
|
|
98
|
+
errors.push(formatted);
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
others.push(formatted);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
const othersMerged = others.length === 1
|
|
105
|
+
? others[0]
|
|
106
|
+
: others.reduce((acc, value, idx) => ({
|
|
107
|
+
...acc,
|
|
108
|
+
[`arg${idx}`]: value,
|
|
109
|
+
}), {});
|
|
110
|
+
if (errors.length === 1) {
|
|
111
|
+
return {
|
|
112
|
+
...othersMerged,
|
|
113
|
+
// if there's only one error, we want to splat 'error', 'cause' and 'stacktrace' over
|
|
114
|
+
// all other merged fields.
|
|
115
|
+
...errors[0],
|
|
116
|
+
};
|
|
32
117
|
}
|
|
118
|
+
return {
|
|
119
|
+
...othersMerged,
|
|
120
|
+
// array of errors.
|
|
121
|
+
errors: errors,
|
|
122
|
+
};
|
|
33
123
|
}
|
|
34
124
|
log.setup({
|
|
35
125
|
handlers: {
|
|
36
126
|
default: new log.ConsoleHandler('DEBUG', {
|
|
127
|
+
useColors: false,
|
|
37
128
|
formatter: (record) => {
|
|
38
129
|
// log.formatters.jsonFormatter bugs me:
|
|
39
130
|
// - time is in unix milliseconds
|
|
@@ -46,12 +137,7 @@ log.setup({
|
|
|
46
137
|
time: record.datetime.toISOString(),
|
|
47
138
|
...(record.loggerName ? { name: record.loggerName } : {}),
|
|
48
139
|
msg: record.msg,
|
|
49
|
-
...(
|
|
50
|
-
? (record.args.reduce((acc, next, idx) => ({
|
|
51
|
-
...acc,
|
|
52
|
-
...(valueOfUnknown(next, idx)),
|
|
53
|
-
}), {}))
|
|
54
|
-
: {}),
|
|
140
|
+
...formatArgs(record.args),
|
|
55
141
|
});
|
|
56
142
|
}
|
|
57
143
|
catch (err) {
|
|
@@ -112,9 +198,17 @@ export class ConsoleLogger {
|
|
|
112
198
|
...fields,
|
|
113
199
|
});
|
|
114
200
|
}
|
|
115
|
-
error(message, fields) {
|
|
201
|
+
error(message, fieldsOrError, fields) {
|
|
202
|
+
if (fieldsOrError instanceof Error) {
|
|
203
|
+
this.log.error(message, fieldsOrError, {
|
|
204
|
+
...this.fields,
|
|
205
|
+
...fields,
|
|
206
|
+
});
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
116
209
|
this.log.error(message, {
|
|
117
210
|
...this.fields,
|
|
211
|
+
...fieldsOrError,
|
|
118
212
|
...fields,
|
|
119
213
|
});
|
|
120
214
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@versori/run",
|
|
3
|
-
"version": "v0.2.0
|
|
3
|
+
"version": "v0.2.0",
|
|
4
4
|
"description": "Versori Run",
|
|
5
5
|
"homepage": "https://github.com/versori/versori-run#readme",
|
|
6
6
|
"repository": {
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"cors": "^2.8.5",
|
|
30
30
|
"cron": "3.5.0",
|
|
31
31
|
"express": "^4.18.3",
|
|
32
|
+
"express-xml-bodyparser": "^0.3.0",
|
|
32
33
|
"rxjs": "^7.8.1",
|
|
33
34
|
"tweetnacl": "1.0.3"
|
|
34
35
|
},
|
package/{esm/deps/jsr.io/@std/bytes/1.0.5 → script/deps/jsr.io/@std/bytes/1.0.6}/_types.d.ts.map
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_types.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/bytes/1.0.
|
|
1
|
+
{"version":3,"file":"_types.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/bytes/1.0.6/_types.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC"}
|
package/{esm/deps/jsr.io/@std/bytes/1.0.5 → script/deps/jsr.io/@std/bytes/1.0.6}/concat.d.ts
RENAMED
|
@@ -17,5 +17,5 @@ export type { Uint8Array_ };
|
|
|
17
17
|
* assertEquals(concat([a, b]), new Uint8Array([0, 1, 2, 3, 4, 5]));
|
|
18
18
|
* ```
|
|
19
19
|
*/
|
|
20
|
-
export declare function concat(buffers: Uint8Array[]): Uint8Array_;
|
|
20
|
+
export declare function concat(buffers: readonly Uint8Array[]): Uint8Array_;
|
|
21
21
|
//# sourceMappingURL=concat.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"concat.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/bytes/1.0.
|
|
1
|
+
{"version":3,"file":"concat.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/bytes/1.0.6/concat.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,YAAY,EAAE,WAAW,EAAE,CAAC;AAE5B;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,SAAS,UAAU,EAAE,GAAG,WAAW,CAalE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copy.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/bytes/1.0.
|
|
1
|
+
{"version":3,"file":"copy.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/bytes/1.0.6/copy.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAgB,IAAI,CAAC,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,SAAI,GAAG,MAAM,CAQzE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/fmt/1.0.
|
|
1
|
+
{"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/fmt/1.0.8/colors.ts"],"names":[],"mappings":"AAoEA,qEAAqE;AACrE,MAAM,WAAW,GAAG;IAClB,0BAA0B;IAC1B,CAAC,EAAE,MAAM,CAA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AM,CAEhD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEjD;AAcD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,GAAG,GAAG,MAAM,CAuB9D;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,GAAG,GAAG,MAAM,CAuBhE;AAWD;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEpD"}
|
|
@@ -15,7 +15,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
15
15
|
var _Buffer_instances, _Buffer_buf, _Buffer_off, _Buffer_tryGrowByReslice, _Buffer_reslice, _Buffer_grow;
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.Buffer = void 0;
|
|
18
|
-
const copy_js_1 = require("../../bytes/1.0.
|
|
18
|
+
const copy_js_1 = require("../../bytes/1.0.6/copy.js");
|
|
19
19
|
// MIN_READ is the minimum ArrayBuffer size passed to a read call by
|
|
20
20
|
// buffer.ReadFrom. As long as the Buffer has at least MIN_READ bytes beyond
|
|
21
21
|
// what is required to hold the contents of r, readFrom() will not grow the
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
exports.readAll = readAll;
|
|
6
6
|
exports.readAllSync = readAllSync;
|
|
7
|
-
const concat_js_1 = require("../../bytes/1.0.
|
|
7
|
+
const concat_js_1 = require("../../bytes/1.0.6/concat.js");
|
|
8
8
|
const _constants_js_1 = require("./_constants.js");
|
|
9
9
|
/**
|
|
10
10
|
* Read {@linkcode Reader} `r` until EOF (`null`) and resolve to the content as
|
|
@@ -16,7 +16,7 @@ exports.ConsoleHandler = void 0;
|
|
|
16
16
|
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
17
17
|
// This module is browser compatible.
|
|
18
18
|
const levels_js_1 = require("./levels.js");
|
|
19
|
-
const colors_js_1 = require("../../fmt/1.0.
|
|
19
|
+
const colors_js_1 = require("../../fmt/1.0.8/colors.js");
|
|
20
20
|
const base_handler_js_1 = require("./base_handler.js");
|
|
21
21
|
function applyColors(msg, level) {
|
|
22
22
|
switch (level) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Activation } from '../dsl/http/types.js';
|
|
2
2
|
import { KeyValue, KeyValueProvider, KeyValueScope } from '../kv/KeyValue.js';
|
|
3
3
|
import { Logger } from '../observability/logging/Logger.js';
|
|
4
|
+
import { Credentials } from '../dsl/http/versori/contextcredentials.js';
|
|
4
5
|
export type OnSuccessFn = (ctx: Context<any>) => void;
|
|
5
6
|
export type OnErrorFn = (ctx: Context<any>) => void;
|
|
6
7
|
export type ContextOptions = {
|
|
@@ -19,6 +20,7 @@ export interface Context<D> {
|
|
|
19
20
|
* @param scope
|
|
20
21
|
*/
|
|
21
22
|
openKv(scope?: KeyValueScope): KeyValue;
|
|
23
|
+
credentials(): Credentials;
|
|
22
24
|
}
|
|
23
25
|
export interface InternalContext<D, Index = void> extends Context<D> {
|
|
24
26
|
withData<D2>(data: D2): InternalContext<D2, Index>;
|
|
@@ -35,15 +37,17 @@ export declare class ContextImpl<D, Index = void> implements InternalContext<D,
|
|
|
35
37
|
executionId: string;
|
|
36
38
|
startTime: Date;
|
|
37
39
|
data: D;
|
|
40
|
+
creds: Credentials;
|
|
38
41
|
idx: Index;
|
|
39
42
|
readonly kvp: KeyValueProvider;
|
|
40
43
|
readonly options: ContextOptions;
|
|
41
|
-
constructor(log: Logger, kvp: KeyValueProvider, executionId: string, startTime: Date, data: D, options?: ContextOptions);
|
|
44
|
+
constructor(log: Logger, kvp: KeyValueProvider, creds: Credentials, executionId: string, startTime: Date, data: D, options?: ContextOptions);
|
|
42
45
|
get activation(): Activation | undefined;
|
|
43
46
|
setIndex(idx: number): InternalContext<D, number>;
|
|
44
47
|
withActivation(activation: Activation): InternalContext<D, Index>;
|
|
45
48
|
withData<D2>(data: D2): InternalContext<D2, Index>;
|
|
46
49
|
openKv(scope?: KeyValueScope): KeyValue;
|
|
50
|
+
credentials(): Credentials;
|
|
47
51
|
destroy(scope: KeyValueScope): Promise<void>;
|
|
48
52
|
[Symbol.toPrimitive](): Record<string, unknown>;
|
|
49
53
|
toJSON(): Record<string, unknown>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../../src/src/context/Context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../../src/src/context/Context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AAExE,MAAM,MAAM,WAAW,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,CA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executionId, startTime, data, options = {}) {
|
|
5
|
+
constructor(log, kvp, creds, executionId, startTime, data, options = {}) {
|
|
6
6
|
Object.defineProperty(this, "log", {
|
|
7
7
|
enumerable: true,
|
|
8
8
|
configurable: true,
|
|
@@ -27,6 +27,12 @@ class ContextImpl {
|
|
|
27
27
|
writable: true,
|
|
28
28
|
value: void 0
|
|
29
29
|
});
|
|
30
|
+
Object.defineProperty(this, "creds", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
configurable: true,
|
|
33
|
+
writable: true,
|
|
34
|
+
value: void 0
|
|
35
|
+
});
|
|
30
36
|
Object.defineProperty(this, "idx", {
|
|
31
37
|
enumerable: true,
|
|
32
38
|
configurable: true,
|
|
@@ -47,6 +53,7 @@ class ContextImpl {
|
|
|
47
53
|
});
|
|
48
54
|
this.log = log;
|
|
49
55
|
this.executionId = executionId;
|
|
56
|
+
this.creds = creds;
|
|
50
57
|
this.startTime = startTime;
|
|
51
58
|
this.data = data;
|
|
52
59
|
this.idx = void 0;
|
|
@@ -56,12 +63,13 @@ class ContextImpl {
|
|
|
56
63
|
// so that destructuring the context object doesn't break the binding of the methods to the
|
|
57
64
|
// correct instance.
|
|
58
65
|
this.openKv = this.openKv.bind(this);
|
|
66
|
+
this.credentials = this.credentials.bind(this);
|
|
59
67
|
}
|
|
60
68
|
get activation() {
|
|
61
69
|
return this.options.activation;
|
|
62
70
|
}
|
|
63
71
|
setIndex(idx) {
|
|
64
|
-
const next = new ContextImpl(this.log, this.kvp, this.executionId, this.startTime, this.data, this.options);
|
|
72
|
+
const next = new ContextImpl(this.log, this.kvp, this.creds, this.executionId, this.startTime, this.data, this.options);
|
|
65
73
|
next.idx = idx;
|
|
66
74
|
return next;
|
|
67
75
|
}
|
|
@@ -70,13 +78,13 @@ class ContextImpl {
|
|
|
70
78
|
if (this.activation) {
|
|
71
79
|
throw new Error('Activation is already set');
|
|
72
80
|
}
|
|
73
|
-
return new ContextImpl(this.log, this.kvp, this.executionId, this.startTime, this.data, {
|
|
81
|
+
return new ContextImpl(this.log, this.kvp, this.creds, this.executionId, this.startTime, this.data, {
|
|
74
82
|
...this.options,
|
|
75
83
|
activation,
|
|
76
84
|
});
|
|
77
85
|
}
|
|
78
86
|
withData(data) {
|
|
79
|
-
return new ContextImpl(this.log, this.kvp, this.executionId, this.startTime, data, this.options);
|
|
87
|
+
return new ContextImpl(this.log, this.kvp, this.creds, this.executionId, this.startTime, data, this.options);
|
|
80
88
|
}
|
|
81
89
|
openKv(scope = ':project:') {
|
|
82
90
|
if (scope === ':execution:') {
|
|
@@ -91,6 +99,9 @@ class ContextImpl {
|
|
|
91
99
|
activationId: this.activation?.id,
|
|
92
100
|
});
|
|
93
101
|
}
|
|
102
|
+
credentials() {
|
|
103
|
+
return this.creds;
|
|
104
|
+
}
|
|
94
105
|
destroy(scope) {
|
|
95
106
|
if (scope === ':execution:') {
|
|
96
107
|
return this.kvp.destroy({
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { KeyValueProvider } from '../kv/KeyValue.js';
|
|
2
2
|
import { Logger } from '../observability/logging/Logger.js';
|
|
3
3
|
import { Context, ContextOptions, InternalContext } from './Context.js';
|
|
4
|
+
import { Credentials } from '../dsl/http/versori/contextcredentials.js';
|
|
4
5
|
export interface ContextProvider {
|
|
5
6
|
create<D>(data: D, options?: ContextOptions): InternalContext<D, void>;
|
|
6
7
|
destroy(ctx: Context<any>): Promise<void>;
|
|
@@ -8,7 +9,8 @@ export interface ContextProvider {
|
|
|
8
9
|
export declare class ContextProviderImpl implements ContextProvider {
|
|
9
10
|
log: Logger;
|
|
10
11
|
kvp: KeyValueProvider;
|
|
11
|
-
|
|
12
|
+
creds: Credentials;
|
|
13
|
+
constructor(log: Logger, kvp: KeyValueProvider, creds: Credentials);
|
|
12
14
|
create<D>(data: D, options?: ContextOptions): InternalContext<D, void>;
|
|
13
15
|
destroy(ctx: Context<any>): Promise<void>;
|
|
14
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextProvider.d.ts","sourceRoot":"","sources":["../../../src/src/context/ContextProvider.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAe,cAAc,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"ContextProvider.d.ts","sourceRoot":"","sources":["../../../src/src/context/ContextProvider.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAe,cAAc,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACrF,OAAO,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AAExE,MAAM,WAAW,eAAe;IAC5B,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,eAAe,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IACvE,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7C;AAED,qBAAa,mBAAoB,YAAW,eAAe;IACvD,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,gBAAgB,CAAC;IACtB,KAAK,EAAE,WAAW,CAAC;gBAEP,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,gBAAgB,EAAE,KAAK,EAAE,WAAW;IAMlE,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,GAAE,cAAmB,GAAG,eAAe,CAAC,CAAC,EAAE,IAAI,CAAC;IAe1E,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAM5C"}
|
|
@@ -4,7 +4,7 @@ exports.ContextProviderImpl = void 0;
|
|
|
4
4
|
const mod_js_1 = require("../../deps/jsr.io/@std/ulid/1.0.0/mod.js");
|
|
5
5
|
const Context_js_1 = require("./Context.js");
|
|
6
6
|
class ContextProviderImpl {
|
|
7
|
-
constructor(log, kvp) {
|
|
7
|
+
constructor(log, kvp, creds) {
|
|
8
8
|
Object.defineProperty(this, "log", {
|
|
9
9
|
enumerable: true,
|
|
10
10
|
configurable: true,
|
|
@@ -17,8 +17,15 @@ class ContextProviderImpl {
|
|
|
17
17
|
writable: true,
|
|
18
18
|
value: void 0
|
|
19
19
|
});
|
|
20
|
+
Object.defineProperty(this, "creds", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
configurable: true,
|
|
23
|
+
writable: true,
|
|
24
|
+
value: void 0
|
|
25
|
+
});
|
|
20
26
|
this.log = log;
|
|
21
27
|
this.kvp = kvp;
|
|
28
|
+
this.creds = creds;
|
|
22
29
|
}
|
|
23
30
|
create(data, options = {}) {
|
|
24
31
|
const executionId = (0, mod_js_1.ulid)();
|
|
@@ -29,7 +36,7 @@ class ContextProviderImpl {
|
|
|
29
36
|
externalUserId: options.activation.user.externalId,
|
|
30
37
|
});
|
|
31
38
|
}
|
|
32
|
-
return new Context_js_1.ContextImpl(logger, this.kvp, executionId, new Date(), data, options);
|
|
39
|
+
return new Context_js_1.ContextImpl(logger, this.kvp, this.creds, executionId, new Date(), data, options);
|
|
33
40
|
}
|
|
34
41
|
destroy(ctx) {
|
|
35
42
|
return this.kvp.destroy({
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DynamicFetcher, RoundTripperFactory } from './types.js';
|
|
2
|
+
import { Credentials } from './versori/contextcredentials.js';
|
|
2
3
|
/**
|
|
3
4
|
* A factory class for creating a default round tripper.
|
|
4
5
|
* This class is used to provide a default implementation for initializing
|
|
@@ -19,5 +20,6 @@ export declare class DefaultRoundTripperFactory implements RoundTripperFactory {
|
|
|
19
20
|
*/
|
|
20
21
|
create(connName: string, fn?: typeof fetch): Promise<typeof fetch>;
|
|
21
22
|
createDynamic(templateName: string, fn: typeof fetch): Promise<DynamicFetcher>;
|
|
23
|
+
credentials(): Credentials;
|
|
22
24
|
}
|
|
23
25
|
//# sourceMappingURL=default.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../../../src/src/dsl/http/default.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,cAAc,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../../../src/src/dsl/http/default.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,cAAc,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D;;;;GAIG;AACH,qBAAa,0BAA2B,YAAW,mBAAmB;IAClE;;OAEG;;IAGH;;;;;;;OAOG;IACG,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,GAAE,OAAO,KAAa,GAAG,OAAO,CAAC,OAAO,KAAK,CAAC;IAIzE,aAAa,CAAC,YAAY,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,KAAK,GAAG,OAAO,CAAC,cAAc,CAAC;IAMpF,WAAW,IAAI,WAAW;CAU7B"}
|
|
@@ -27,5 +27,15 @@ class DefaultRoundTripperFactory {
|
|
|
27
27
|
return fetch(input, init);
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
+
credentials() {
|
|
31
|
+
return {
|
|
32
|
+
getRaw: () => Promise.resolve(new ArrayBuffer(0)),
|
|
33
|
+
getAccessToken: () => Promise.resolve({
|
|
34
|
+
accessToken: '',
|
|
35
|
+
tokenType: '',
|
|
36
|
+
expiry: undefined,
|
|
37
|
+
}),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
30
40
|
}
|
|
31
41
|
exports.DefaultRoundTripperFactory = DefaultRoundTripperFactory;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type Token = {
|
|
2
|
+
accessToken: string;
|
|
3
|
+
tokenType: string;
|
|
4
|
+
expiry?: Date;
|
|
5
|
+
};
|
|
6
|
+
export interface Credentials {
|
|
7
|
+
getRaw(name: string): Promise<ArrayBuffer>;
|
|
8
|
+
getAccessToken(name: string): Promise<Token>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=contextcredentials.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contextcredentials.d.ts","sourceRoot":"","sources":["../../../../../src/src/dsl/http/versori/contextcredentials.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,KAAK,GAAG;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,IAAI,CAAC;CACjB,CAAA;AAED,MAAM,WAAW,WAAW;IACxB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAC3C,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;CAChD"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { GetTokenResponse } from './tokens/v1/token_service_pb.js';
|
|
2
|
+
import { GetCredentialResponse } from './v1alpha1/credential_service_pb.js';
|
|
2
3
|
export declare class VersoriCredentialClient {
|
|
3
4
|
private TokenService;
|
|
5
|
+
private credentialsClient;
|
|
4
6
|
constructor(credsBaseUrl: string);
|
|
5
7
|
getToken(credId: string, forceRefresh?: boolean): Promise<GetTokenResponse>;
|
|
8
|
+
getRaw(credId: string): Promise<GetCredentialResponse>;
|
|
6
9
|
}
|
|
7
10
|
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../../../src/src/dsl/http/versori/credentials/client.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAGnE,qBAAa,uBAAuB;IAEhC,OAAO,CAAC,YAAY,CAAc;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../../../src/src/dsl/http/versori/credentials/client.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAGnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAE5E,qBAAa,uBAAuB;IAEhC,OAAO,CAAC,YAAY,CAAc;IAClC,OAAO,CAAC,iBAAiB,CAAoB;gBAEjC,YAAY,EAAE,MAAM;IAKhC,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,GAAE,OAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAIlF,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC;CAGzD"}
|
|
@@ -10,10 +10,20 @@ class VersoriCredentialClient {
|
|
|
10
10
|
writable: true,
|
|
11
11
|
value: void 0
|
|
12
12
|
});
|
|
13
|
+
Object.defineProperty(this, "credentialsClient", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
configurable: true,
|
|
16
|
+
writable: true,
|
|
17
|
+
value: void 0
|
|
18
|
+
});
|
|
13
19
|
this.TokenService = (0, credentials_js_1.createTokenClient)(credsBaseUrl);
|
|
20
|
+
this.credentialsClient = (0, credentials_js_1.createCredentialsClient)(credsBaseUrl);
|
|
14
21
|
}
|
|
15
22
|
getToken(credId, forceRefresh = false) {
|
|
16
23
|
return this.TokenService.getToken({ credentialId: credId, forceRefresh });
|
|
17
24
|
}
|
|
25
|
+
getRaw(credId) {
|
|
26
|
+
return this.credentialsClient.get({ id: credId, showRedacted: true });
|
|
27
|
+
}
|
|
18
28
|
}
|
|
19
29
|
exports.VersoriCredentialClient = VersoriCredentialClient;
|
|
@@ -39,4 +39,42 @@ export declare function createOAuth2TokenService(baseUrl?: string): import("@con
|
|
|
39
39
|
};
|
|
40
40
|
}>>;
|
|
41
41
|
export type OAuth2TokenClient = ReturnType<typeof createOAuth2TokenService>;
|
|
42
|
+
export declare function createCredentialsClient(baseUrl?: string): import("@connectrpc/connect").Client<import("@bufbuild/protobuf/codegenv1").GenService<{
|
|
43
|
+
create: {
|
|
44
|
+
methodKind: "unary";
|
|
45
|
+
input: typeof import("./v1alpha1/credential_service_pb.js").CreateCredentialRequestSchema;
|
|
46
|
+
output: typeof import("./v1alpha1/credential_service_pb.js").CreateCredentialResponseSchema;
|
|
47
|
+
};
|
|
48
|
+
get: {
|
|
49
|
+
methodKind: "unary";
|
|
50
|
+
input: typeof import("./v1alpha1/credential_service_pb.js").GetCredentialRequestSchema;
|
|
51
|
+
output: typeof import("./v1alpha1/credential_service_pb.js").GetCredentialResponseSchema;
|
|
52
|
+
};
|
|
53
|
+
getMany: {
|
|
54
|
+
methodKind: "unary";
|
|
55
|
+
input: typeof import("./v1alpha1/credential_service_pb.js").GetManyCredentialsRequestSchema;
|
|
56
|
+
output: typeof import("./v1alpha1/credential_service_pb.js").GetManyCredentialsResponseSchema;
|
|
57
|
+
};
|
|
58
|
+
list: {
|
|
59
|
+
methodKind: "unary";
|
|
60
|
+
input: typeof import("./v1alpha1/credential_service_pb.js").ListCredentialsRequestSchema;
|
|
61
|
+
output: typeof import("./v1alpha1/credential_service_pb.js").ListCredentialsResponseSchema;
|
|
62
|
+
};
|
|
63
|
+
update: {
|
|
64
|
+
methodKind: "unary";
|
|
65
|
+
input: typeof import("./v1alpha1/credential_service_pb.js").UpdateCredentialRequestSchema;
|
|
66
|
+
output: typeof import("./v1alpha1/credential_service_pb.js").UpdateCredentialResponseSchema;
|
|
67
|
+
};
|
|
68
|
+
delete: {
|
|
69
|
+
methodKind: "unary";
|
|
70
|
+
input: typeof import("./v1alpha1/credential_service_pb.js").DeleteCredentialRequestSchema;
|
|
71
|
+
output: typeof import("./v1alpha1/credential_service_pb.js").DeleteCredentialResponseSchema;
|
|
72
|
+
};
|
|
73
|
+
validate: {
|
|
74
|
+
methodKind: "unary";
|
|
75
|
+
input: typeof import("./v1alpha1/credential_service_pb.js").ValidateCredentialRequestSchema;
|
|
76
|
+
output: typeof import("./v1alpha1/credential_service_pb.js").ValidateCredentialResponseSchema;
|
|
77
|
+
};
|
|
78
|
+
}>>;
|
|
79
|
+
export type CredentialsClient = ReturnType<typeof createCredentialsClient>;
|
|
42
80
|
//# sourceMappingURL=credentials.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../../../../../src/src/dsl/http/versori/credentials/credentials.ts"],"names":[],"mappings":"AAeA,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,MAAgC;;;;;;;;;;;IAK1E;AAED,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE/D,wBAAgB,wBAAwB,CAAC,OAAO,GAAE,MAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;IAKjF;AAED,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../../../../../src/src/dsl/http/versori/credentials/credentials.ts"],"names":[],"mappings":"AAeA,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,MAAgC;;;;;;;;;;;IAK1E;AAED,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE/D,wBAAgB,wBAAwB,CAAC,OAAO,GAAE,MAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;IAKjF;AAED,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE5E,wBAAgB,uBAAuB,CAAC,OAAO,GAAE,MAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAKhF;AAED,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC"}
|
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createTokenClient = createTokenClient;
|
|
4
4
|
exports.createOAuth2TokenService = createOAuth2TokenService;
|
|
5
|
+
exports.createCredentialsClient = createCredentialsClient;
|
|
5
6
|
const connect_1 = require("@connectrpc/connect");
|
|
6
7
|
const connect_node_1 = require("@connectrpc/connect-node");
|
|
7
8
|
const token_service_pb_js_1 = require("./tokens/v1/token_service_pb.js");
|
|
8
9
|
const token_service_pb_js_2 = require("./oauth2/v1/token_service_pb.js");
|
|
9
10
|
// // @deno-types="./v1alpha1/credential_service_pb.d.ts"
|
|
10
|
-
|
|
11
|
+
const credential_service_pb_js_1 = require("./v1alpha1/credential_service_pb.js");
|
|
11
12
|
// // @deno-types="./customauth/v1/customauth_service_pb.d.ts"
|
|
12
13
|
// import { CustomAuthenticationService } from './customauth/v1/customauth_service_pb.d.ts';
|
|
13
14
|
function createTokenClient(baseUrl = 'http://localhost:9000') {
|
|
@@ -22,13 +23,12 @@ function createOAuth2TokenService(baseUrl = 'http://localhost:9000') {
|
|
|
22
23
|
});
|
|
23
24
|
return (0, connect_1.createClient)(token_service_pb_js_2.OAuth2TokenService, transport);
|
|
24
25
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
// export type CredentialService = ReturnType<typeof createCredentialService>;
|
|
26
|
+
function createCredentialsClient(baseUrl = 'http://localhost:9000') {
|
|
27
|
+
const transport = (0, connect_node_1.createGrpcTransport)({
|
|
28
|
+
baseUrl,
|
|
29
|
+
});
|
|
30
|
+
return (0, connect_1.createClient)(credential_service_pb_js_1.CredentialService, transport);
|
|
31
|
+
}
|
|
32
32
|
// export function createCustomAuthService(baseUrl: string = 'http://localhost:9000') {
|
|
33
33
|
// const transport = createGrpcTransport({
|
|
34
34
|
// baseUrl,
|