@ontemper/sdk 0.8.0 → 0.8.1
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/README.md +55 -2
- package/dist/As2Resource.d.ts +431 -76
- package/dist/As2Resource.d.ts.map +1 -1
- package/dist/As2Resource.js +31 -30
- package/dist/As2Resource.js.map +1 -1
- package/dist/As2Transport.d.ts.map +1 -1
- package/dist/As2Transport.js +3 -1
- package/dist/As2Transport.js.map +1 -1
- package/dist/As2Wire.d.ts +39 -0
- package/dist/As2Wire.d.ts.map +1 -1
- package/dist/Contract/RuntimeApi.d.ts +19 -0
- package/dist/Contract/RuntimeApi.d.ts.map +1 -1
- package/dist/Contract/RuntimeApi.js +1 -1
- package/dist/Contract/RuntimeApi.js.map +1 -1
- package/dist/DatabaseTunnelAuthorization.d.ts +3 -0
- package/dist/DatabaseTunnelAuthorization.d.ts.map +1 -0
- package/dist/DatabaseTunnelAuthorization.js +12 -0
- package/dist/DatabaseTunnelAuthorization.js.map +1 -0
- package/dist/HttpApiResource.d.ts +2916 -177
- package/dist/HttpApiResource.d.ts.map +1 -1
- package/dist/HttpApiResource.js +82 -60
- package/dist/HttpApiResource.js.map +1 -1
- package/dist/Kafka.d.ts +89 -0
- package/dist/Kafka.d.ts.map +1 -0
- package/dist/Kafka.js +297 -0
- package/dist/Kafka.js.map +1 -0
- package/dist/Manifest.d.ts +1 -1
- package/dist/Manifest.js +1 -1
- package/dist/PostgreSql.d.ts +18 -0
- package/dist/PostgreSql.d.ts.map +1 -0
- package/dist/PostgreSql.js +40 -0
- package/dist/PostgreSql.js.map +1 -0
- package/dist/PostgreSqlPool.d.ts +34 -0
- package/dist/PostgreSqlPool.d.ts.map +1 -0
- package/dist/PostgreSqlPool.js +133 -0
- package/dist/PostgreSqlPool.js.map +1 -0
- package/dist/PostgreSqlTimeouts.d.ts +6 -0
- package/dist/PostgreSqlTimeouts.d.ts.map +1 -0
- package/dist/PostgreSqlTimeouts.js +17 -0
- package/dist/PostgreSqlTimeouts.js.map +1 -0
- package/dist/PostgreSqlTunnel.d.ts +25 -0
- package/dist/PostgreSqlTunnel.d.ts.map +1 -0
- package/dist/PostgreSqlTunnel.js +114 -0
- package/dist/PostgreSqlTunnel.js.map +1 -0
- package/dist/ResourceRecords.d.ts +1086 -0
- package/dist/ResourceRecords.d.ts.map +1 -0
- package/dist/ResourceRecords.js +303 -0
- package/dist/ResourceRecords.js.map +1 -0
- package/dist/Resources.d.ts +13 -0
- package/dist/Resources.d.ts.map +1 -0
- package/dist/Resources.js +13 -0
- package/dist/Resources.js.map +1 -0
- package/dist/RuntimeResources.d.ts +15 -1
- package/dist/RuntimeResources.d.ts.map +1 -1
- package/dist/RuntimeResources.js +42 -13
- package/dist/RuntimeResources.js.map +1 -1
- package/dist/TransportResource.d.ts +1 -32
- package/dist/TransportResource.d.ts.map +1 -1
- package/dist/TransportResource.js +1 -19
- package/dist/TransportResource.js.map +1 -1
- package/package.json +37 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResourceRecords.d.ts","sourceRoot":"","sources":["../src/ResourceRecords.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAuB,MAAM,EAAqD,MAAM,QAAQ,CAAC;AAYhH,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAK5D,mFAAmF;AACnF,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,WAAW,CAAC;AAC3C,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAkBlD,yGAAyG;AACzG,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,CAAC;AAwC9D;;;;GAIG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0CAiBxB,CAAC;AACF,MAAM,MAAM,YAAY,GAAG,OAAO,YAAY,CAAC,IAAI,CAAC;;;;;;;AAIpD;;;;GAIG;AACH,qBAAa,uBAAwB,SAAQ,4BAK3C;IACA,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,uBAAuB,CAU7E;CACF;AA2GD,2EAA2E;AAC3E,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,GAAG;IAAE,QAAQ,CAAC,gBAAgB,EAAE,KAAK,CAAA;CAAE,CAAC;AAE7E;;;GAGG;AACH,eAAO,MAAM,YAAY,GAAI,CAAC,SAAS,YAAY,UACzC,CAAC,OACJ,MAAM,SACJ,MAAM,CAAC,IAAI,KACjB,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,oBAAoB,GAAG,uBAAuB,CAwBvE,CAAC"}
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
import { Effect, Predicate, Redacted, Schema, SchemaAST, SchemaTransformation } from 'effect';
|
|
2
|
+
import { As2IdentityResource, As2PartnerResource } from './As2Resource.js';
|
|
3
|
+
import { AbsoluteHttpUrl, AwsAuth, HttpApiResource, HttpProxy, OAuthTokenRequest, recordStruct, TlsSettings, } from './HttpApiResource.js';
|
|
4
|
+
import { SDK_VERSION } from './Manifest.js';
|
|
5
|
+
import { InvalidResourceError } from './ResourcesErrors.js';
|
|
6
|
+
const Secret = Schema.RedactedFromValue(Schema.String);
|
|
7
|
+
const NonEmptySecret = Schema.RedactedFromValue(Schema.String.check(Schema.isMinLength(1)));
|
|
8
|
+
const NonEmptyString = Schema.String.check(Schema.isMinLength(1));
|
|
9
|
+
const Port = Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 65_535 }));
|
|
10
|
+
// Legacy SSH ports accept every integer, including those outside the safe-integer range and TCP port range.
|
|
11
|
+
const SshPort = Schema.Number.check(Schema.makeFilter(Number.isInteger, { expected: 'an integer', toJsonSchema: () => ({ type: 'integer' }) }));
|
|
12
|
+
const SshAlgorithms = recordStruct({
|
|
13
|
+
kex: Schema.optional(Schema.Array(Schema.String)),
|
|
14
|
+
serverHostKey: Schema.optional(Schema.Array(Schema.String)),
|
|
15
|
+
cipher: Schema.optional(Schema.Array(Schema.String)),
|
|
16
|
+
hmac: Schema.optional(Schema.Array(Schema.String)),
|
|
17
|
+
});
|
|
18
|
+
/** A `postgresql` record; `sslmode` carries libpq semantics, and `tls` the CA and client certificate. */
|
|
19
|
+
export const PostgresqlResource = recordStruct({
|
|
20
|
+
host: NonEmptyString,
|
|
21
|
+
port: Port.pipe(Schema.withDecodingDefault(Effect.succeed(5432))),
|
|
22
|
+
dbname: NonEmptyString,
|
|
23
|
+
user: NonEmptyString,
|
|
24
|
+
// Closed: the type decides how the client signs in.
|
|
25
|
+
auth: Schema.Union([
|
|
26
|
+
recordStruct({ type: Schema.Literal('password'), password: Secret }),
|
|
27
|
+
recordStruct({ type: Schema.Literal('rds_iam'), region: NonEmptyString, awsAuth: AwsAuth }),
|
|
28
|
+
recordStruct({ type: Schema.Literal('none') }),
|
|
29
|
+
]),
|
|
30
|
+
// Closed: libpq's weaker `allow` and `prefer` would map to no TLS at all.
|
|
31
|
+
sslmode: Schema.Literals(['disable', 'require', 'verify-ca', 'verify-full']).pipe(Schema.withDecodingDefault(Effect.succeed('verify-full'))),
|
|
32
|
+
tls: Schema.optional(TlsSettings),
|
|
33
|
+
sshTunnel: Schema.optional(recordStruct({
|
|
34
|
+
host: NonEmptyString,
|
|
35
|
+
port: SshPort.pipe(Schema.withDecodingDefault(Effect.succeed(22))),
|
|
36
|
+
username: Schema.String,
|
|
37
|
+
auth: Schema.Union([
|
|
38
|
+
recordStruct({
|
|
39
|
+
type: Schema.Literal('credentials'),
|
|
40
|
+
password: Schema.optional(Secret),
|
|
41
|
+
privateKey: Schema.optional(Secret),
|
|
42
|
+
passphrase: Schema.optional(Secret),
|
|
43
|
+
}),
|
|
44
|
+
]).pipe(Schema.withDecodingDefault(Effect.succeed({ type: 'credentials' }))),
|
|
45
|
+
hostKeyFingerprints: Schema.optional(Schema.Array(NonEmptyString)),
|
|
46
|
+
algorithms: Schema.optional(SshAlgorithms),
|
|
47
|
+
})),
|
|
48
|
+
options: Schema.optional(Schema.String),
|
|
49
|
+
});
|
|
50
|
+
// The port is 1-65535 without leading zeros, as the API catalog requires; `\s` is spelled out for deploy's RE2.
|
|
51
|
+
const KafkaBroker = Schema.String.check(Schema.isPattern(/^(\[[0-9A-Fa-f:.]+\]|[^\t\n\v\f\r\p{Z}:/@[\]]+):(?:[1-9][0-9]{0,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])$/u), Schema.makeFilter((broker) => !broker.includes(String.fromCodePoint(0xfeff)), {
|
|
52
|
+
expected: 'a broker without whitespace',
|
|
53
|
+
toJsonSchema: () => ({ not: { pattern: String.fromCodePoint(0xfeff) } }),
|
|
54
|
+
}));
|
|
55
|
+
const KafkaAuth = Schema.Union([
|
|
56
|
+
recordStruct({ type: Schema.Literal('none') }),
|
|
57
|
+
recordStruct({ type: Schema.Literal('sasl_plain'), username: Schema.String, password: Secret }),
|
|
58
|
+
recordStruct({
|
|
59
|
+
type: Schema.Literal('sasl_scram'),
|
|
60
|
+
mechanism: Schema.Literals(['SCRAM-SHA-256', 'SCRAM-SHA-512']).pipe(Schema.withDecodingDefault(Effect.succeed('SCRAM-SHA-512'))),
|
|
61
|
+
username: Schema.String,
|
|
62
|
+
password: Secret,
|
|
63
|
+
}),
|
|
64
|
+
recordStruct({ type: Schema.Literal('oauthbearer'), tokenRequest: OAuthTokenRequest }),
|
|
65
|
+
recordStruct({ type: Schema.Literal('aws_msk_iam'), region: NonEmptyString, awsAuth: AwsAuth }),
|
|
66
|
+
]);
|
|
67
|
+
/** A `kafka` record: bootstrap brokers, the `auth` variant, and `tls`, whose presence turns TLS on. */
|
|
68
|
+
export const KafkaResource = recordStruct({
|
|
69
|
+
brokers: Schema.Array(KafkaBroker).check(Schema.isMinLength(1)),
|
|
70
|
+
clientId: Schema.optional(Schema.String),
|
|
71
|
+
// Closed: the type decides the SASL mechanism, and a client that falls back on an unknown one signs in without it.
|
|
72
|
+
auth: KafkaAuth,
|
|
73
|
+
tls: Schema.optional(TlsSettings),
|
|
74
|
+
}).check(
|
|
75
|
+
// MSK IAM and OAuth bearer send a token in the SASL payload; without `tls` it would cross the network in plaintext.
|
|
76
|
+
Schema.makeFilter(({ auth, tls }) => (auth.type !== 'aws_msk_iam' && auth.type !== 'oauthbearer') ||
|
|
77
|
+
tls !== undefined || { path: ['tls'], issue: 'Expected tls with aws_msk_iam or oauthbearer' }));
|
|
78
|
+
/** An `s3` record: bucket, region, an optional S3-compatible endpoint, and the AWS credential source under `auth`. */
|
|
79
|
+
export const S3Resource = recordStruct({
|
|
80
|
+
bucket: NonEmptyString,
|
|
81
|
+
region: NonEmptyString.pipe(Schema.withDecodingDefault(Effect.succeed('us-east-1'))),
|
|
82
|
+
endpoint: Schema.optional(AbsoluteHttpUrl),
|
|
83
|
+
pathStyle: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(false))),
|
|
84
|
+
prefix: Schema.optional(Schema.String),
|
|
85
|
+
// Closed and required: `ambient` is an explicit choice (Temper-operated runtimes refuse it), never a fallback.
|
|
86
|
+
auth: AwsAuth,
|
|
87
|
+
tls: Schema.optional(TlsSettings),
|
|
88
|
+
proxy: Schema.optional(HttpProxy),
|
|
89
|
+
});
|
|
90
|
+
// Closed: the type decides which identity the client presents, and a guess could fall back to anonymous access.
|
|
91
|
+
const AzureAuth = Schema.Union([
|
|
92
|
+
recordStruct({ type: Schema.Literal('shared_key'), accountKey: NonEmptySecret }),
|
|
93
|
+
recordStruct({ type: Schema.Literal('sas'), sasToken: NonEmptySecret }),
|
|
94
|
+
recordStruct({
|
|
95
|
+
type: Schema.Literal('service_principal'),
|
|
96
|
+
tenantId: NonEmptyString,
|
|
97
|
+
clientId: NonEmptyString,
|
|
98
|
+
clientSecret: NonEmptySecret,
|
|
99
|
+
}),
|
|
100
|
+
recordStruct({
|
|
101
|
+
type: Schema.Literal('service_principal_certificate'),
|
|
102
|
+
tenantId: NonEmptyString,
|
|
103
|
+
clientId: NonEmptyString,
|
|
104
|
+
certificatePem: NonEmptySecret,
|
|
105
|
+
}),
|
|
106
|
+
recordStruct({ type: Schema.Literal('ambient') }),
|
|
107
|
+
]);
|
|
108
|
+
/** An `azure_blob` record: account, container, endpoint, and the credential source under `auth`. */
|
|
109
|
+
export const AzureBlobResource = recordStruct({
|
|
110
|
+
accountName: NonEmptyString,
|
|
111
|
+
containerName: NonEmptyString,
|
|
112
|
+
// A full Blob service URL (Azurite, a gateway, a custom domain); it overrides `endpointSuffix`.
|
|
113
|
+
endpoint: Schema.optional(AbsoluteHttpUrl),
|
|
114
|
+
endpointSuffix: NonEmptyString.pipe(Schema.withDecodingDefault(Effect.succeed('core.windows.net'))),
|
|
115
|
+
prefix: Schema.optional(Schema.String),
|
|
116
|
+
auth: AzureAuth,
|
|
117
|
+
tls: Schema.optional(TlsSettings),
|
|
118
|
+
proxy: Schema.optional(HttpProxy),
|
|
119
|
+
});
|
|
120
|
+
const sftpFields = {
|
|
121
|
+
host: NonEmptyString,
|
|
122
|
+
port: SshPort.pipe(Schema.withDecodingDefault(Effect.succeed(22))),
|
|
123
|
+
username: NonEmptyString,
|
|
124
|
+
// Closed: the type decides which credentials the client offers.
|
|
125
|
+
auth: Schema.Union([
|
|
126
|
+
recordStruct({ type: Schema.Literal('password'), password: Secret }),
|
|
127
|
+
recordStruct({
|
|
128
|
+
type: Schema.Literal('private_key'),
|
|
129
|
+
privateKey: Secret,
|
|
130
|
+
passphrase: Schema.optional(Secret),
|
|
131
|
+
}),
|
|
132
|
+
recordStruct({
|
|
133
|
+
type: Schema.Literal('private_key_and_password'),
|
|
134
|
+
privateKey: Secret,
|
|
135
|
+
passphrase: Schema.optional(Secret),
|
|
136
|
+
password: Secret,
|
|
137
|
+
}),
|
|
138
|
+
]),
|
|
139
|
+
hostKeyFingerprints: Schema.optional(Schema.Array(NonEmptyString)),
|
|
140
|
+
algorithms: Schema.optional(SshAlgorithms),
|
|
141
|
+
};
|
|
142
|
+
const SftpLifted = Schema.toType(recordStruct({
|
|
143
|
+
...sftpFields,
|
|
144
|
+
password: Schema.optional(Schema.Redacted(Schema.Unknown)),
|
|
145
|
+
privateKey: Schema.optional(Schema.Redacted(Schema.Unknown)),
|
|
146
|
+
passphrase: Schema.optional(Schema.Redacted(Schema.Unknown)),
|
|
147
|
+
}));
|
|
148
|
+
/**
|
|
149
|
+
* An `sftp` record; `hostKeyFingerprints` are the `SHA256:` fingerprints the client must pin when set. The
|
|
150
|
+
* credentials under `auth` are also lifted to the top level. Lifted values are Redacted<unknown>: legacy also copies
|
|
151
|
+
* undeclared credential fields; narrow those values before use, or read the typed fields of the auth variant.
|
|
152
|
+
*/
|
|
153
|
+
export const SftpResource = recordStruct(sftpFields).pipe(Schema.decodeTo(SftpLifted, SchemaTransformation.transform({
|
|
154
|
+
decode: (record) => {
|
|
155
|
+
const lifted = {};
|
|
156
|
+
for (const field of ['password', 'privateKey', 'passphrase']) {
|
|
157
|
+
const value = record.auth[field];
|
|
158
|
+
if (value !== undefined)
|
|
159
|
+
lifted[field] = Redacted.isRedacted(value) ? value : Redacted.make(value);
|
|
160
|
+
}
|
|
161
|
+
// Legacy lifting overwrites root credential copies, including stale fields the auth variant does not use.
|
|
162
|
+
const { password: _password, privateKey: _privateKey, passphrase: _passphrase, ...fields } = record;
|
|
163
|
+
return { ...fields, ...lifted };
|
|
164
|
+
},
|
|
165
|
+
encode: ({ password: _password, privateKey: _privateKey, passphrase: _passphrase, ...record }) => record,
|
|
166
|
+
})));
|
|
167
|
+
const CLIENT_NAME = '@ontemper/sdk';
|
|
168
|
+
/**
|
|
169
|
+
* A built-in record holds a value this SDK does not know in a closed field: one that chooses TLS, where a key
|
|
170
|
+
* travels, or AS2 cryptography, where a guess would weaken security silently. The message names the fields and this
|
|
171
|
+
* SDK's version, never the value, which can be a mis-pointed secret.
|
|
172
|
+
*/
|
|
173
|
+
export class UnknownRecordValueError extends Schema.TaggedError()('UnknownRecordValueError', {
|
|
174
|
+
key: Schema.String,
|
|
175
|
+
fields: Schema.Array(Schema.String),
|
|
176
|
+
clientVersion: Schema.String,
|
|
177
|
+
message: Schema.String,
|
|
178
|
+
}) {
|
|
179
|
+
static of(key, fields) {
|
|
180
|
+
const subject = fields.length === 1 ? `field ${fields[0]} uses a value` : `fields ${fields.join(', ')} use values`;
|
|
181
|
+
return new UnknownRecordValueError({
|
|
182
|
+
key,
|
|
183
|
+
fields,
|
|
184
|
+
clientVersion: SDK_VERSION,
|
|
185
|
+
message: `record ${key}: ${subject} this ${CLIENT_NAME} version (${SDK_VERSION}) does not know; ` +
|
|
186
|
+
'upgrade to a release that supports it',
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
// Only these schemas mirror the platform catalog; a caller's own closed value failing is not an outdated SDK.
|
|
191
|
+
const BUILT_IN_RECORDS = new Set([
|
|
192
|
+
HttpApiResource,
|
|
193
|
+
SftpResource,
|
|
194
|
+
PostgresqlResource,
|
|
195
|
+
KafkaResource,
|
|
196
|
+
S3Resource,
|
|
197
|
+
AzureBlobResource,
|
|
198
|
+
As2IdentityResource,
|
|
199
|
+
As2PartnerResource,
|
|
200
|
+
]);
|
|
201
|
+
const isJsonObject = Schema.is(Schema.JsonObject);
|
|
202
|
+
const isJsonArray = Schema.is(Schema.Array(Schema.Json));
|
|
203
|
+
// The resolved value at an issue's path; closed values sit in objects, and arrays only hold brokers and fingerprints.
|
|
204
|
+
const valueAt = (value, path) => path.reduce((current, segment) => {
|
|
205
|
+
if (isJsonArray(current))
|
|
206
|
+
return current[Number(segment)];
|
|
207
|
+
return isJsonObject(current) ? current[segment] : undefined;
|
|
208
|
+
}, value);
|
|
209
|
+
// The one property every member of a union of structs fixes to a literal, such as `type` or `mode`.
|
|
210
|
+
const discriminatorOf = (types) => {
|
|
211
|
+
const literalKeys = (ast) => SchemaAST.isObjects(ast)
|
|
212
|
+
? ast.propertySignatures.filter((field) => SchemaAST.isLiteral(field.type)).map((field) => String(field.name))
|
|
213
|
+
: [];
|
|
214
|
+
const [first, ...rest] = types;
|
|
215
|
+
if (first === undefined)
|
|
216
|
+
return undefined;
|
|
217
|
+
return literalKeys(first).find((key) => rest.every((member) => literalKeys(member).includes(key)));
|
|
218
|
+
};
|
|
219
|
+
// Never the received value: a secret mis-pointed at the field would land in the error.
|
|
220
|
+
const leafMessage = (issue) => {
|
|
221
|
+
if (issue._tag === 'MissingKey')
|
|
222
|
+
return 'Missing key';
|
|
223
|
+
const invalid = issue._tag === 'Filter' ? issue.issue : issue;
|
|
224
|
+
const message = invalid._tag === 'InvalidValue' ? invalid.annotations?.message : undefined;
|
|
225
|
+
if (Predicate.isString(message))
|
|
226
|
+
return message;
|
|
227
|
+
const expected = issue._tag === 'Filter' ? issue.filter.annotations?.expected : undefined;
|
|
228
|
+
return Predicate.isString(expected) ? `Expected ${expected}` : 'Invalid value';
|
|
229
|
+
};
|
|
230
|
+
const unionFindings = (union, path, value) => {
|
|
231
|
+
if (!SchemaAST.isUnion(union))
|
|
232
|
+
return [{ path, message: 'Invalid value', unknownValue: false }];
|
|
233
|
+
const types = union.types.filter((member) => !SchemaAST.isUndefined(member));
|
|
234
|
+
const only = types[0];
|
|
235
|
+
if (types.length === 1 && only !== undefined && SchemaAST.isUnion(only))
|
|
236
|
+
return unionFindings(only, path, value);
|
|
237
|
+
const at = valueAt(value, path);
|
|
238
|
+
if (types.every(SchemaAST.isLiteral)) {
|
|
239
|
+
return [{ path, message: 'Invalid value', unknownValue: Predicate.isString(at) }];
|
|
240
|
+
}
|
|
241
|
+
const discriminator = discriminatorOf(types);
|
|
242
|
+
if (discriminator === undefined || !isJsonObject(at))
|
|
243
|
+
return [{ path, message: 'Invalid value', unknownValue: false }];
|
|
244
|
+
const received = at[discriminator];
|
|
245
|
+
return [
|
|
246
|
+
{
|
|
247
|
+
path: [...path, discriminator],
|
|
248
|
+
message: received === undefined ? 'Missing key' : 'Invalid value',
|
|
249
|
+
unknownValue: Predicate.isString(received),
|
|
250
|
+
},
|
|
251
|
+
];
|
|
252
|
+
};
|
|
253
|
+
function findings(issue, path, value) {
|
|
254
|
+
switch (issue._tag) {
|
|
255
|
+
case 'Pointer':
|
|
256
|
+
return findings(issue.issue, [...path, ...issue.path.map(String)], value);
|
|
257
|
+
case 'Composite':
|
|
258
|
+
return issue.issues.flatMap((inner) => findings(inner, path, value));
|
|
259
|
+
case 'Encoding':
|
|
260
|
+
return findings(issue.issue, path, value);
|
|
261
|
+
case 'Filter':
|
|
262
|
+
// A filter that names a field (`{ path, issue }`) reports at that field.
|
|
263
|
+
return issue.issue._tag === 'Pointer'
|
|
264
|
+
? findings(issue.issue, path, value)
|
|
265
|
+
: [{ path, message: leafMessage(issue), unknownValue: false }];
|
|
266
|
+
case 'AnyOf': {
|
|
267
|
+
if (issue.issues.length === 0)
|
|
268
|
+
return unionFindings(issue.ast, path, value);
|
|
269
|
+
const candidates = issue.issues.map((inner) => findings(inner, path, value));
|
|
270
|
+
// A catch-all member that fails only at `type` (`HttpApiAuth`'s unsupported variant) is not the intended one.
|
|
271
|
+
const intended = candidates.filter((found) => !found.every((finding) => finding.path.length === path.length + 1 && finding.path.at(-1) === 'type'));
|
|
272
|
+
return (intended.length > 0 ? intended : candidates).flat();
|
|
273
|
+
}
|
|
274
|
+
default:
|
|
275
|
+
return [{ path, message: leafMessage(issue), unknownValue: false }];
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
const PATTERN_MESSAGE = 'Expected a string matching the RegExp';
|
|
279
|
+
/**
|
|
280
|
+
* Decodes a resolved record. A mismatch names the fields, never their values; a built-in record with a closed value
|
|
281
|
+
* this SDK does not know fails with `UnknownRecordValueError`.
|
|
282
|
+
*/
|
|
283
|
+
export const decodeRecord = (schema, key, value) => Schema.decodeUnknownEffect(schema)(value, { errors: 'all' }).pipe(Effect.mapError((error) => {
|
|
284
|
+
const found = findings(error.issue, [], value);
|
|
285
|
+
const unknown = [
|
|
286
|
+
...new Set(found.filter((finding) => finding.unknownValue).map((finding) => finding.path.join('.'))),
|
|
287
|
+
];
|
|
288
|
+
if (BUILT_IN_RECORDS.has(schema) && unknown.length > 0)
|
|
289
|
+
return UnknownRecordValueError.of(key, unknown);
|
|
290
|
+
const lines = found.map((finding) => ({
|
|
291
|
+
field: finding.path.join('.') || '<root>',
|
|
292
|
+
message: finding.message,
|
|
293
|
+
}));
|
|
294
|
+
// Overlapping patterns and custom checks can fail together; the custom message says why.
|
|
295
|
+
const shown = lines.filter(({ field, message }) => !message.startsWith(PATTERN_MESSAGE) ||
|
|
296
|
+
!lines.some((other) => other.field === field && !other.message.startsWith(PATTERN_MESSAGE)));
|
|
297
|
+
const issues = [...new Set(shown.map(({ field, message }) => `${field}: ${message}`))];
|
|
298
|
+
return new InvalidResourceError({
|
|
299
|
+
target: `key ${key}`,
|
|
300
|
+
message: `Resource ${key} does not match the expected schema: ${issues.join('; ')}`,
|
|
301
|
+
});
|
|
302
|
+
}));
|
|
303
|
+
//# sourceMappingURL=ResourceRecords.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResourceRecords.js","sourceRoot":"","sources":["../src/ResourceRecords.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAoB,oBAAoB,EAAE,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CAAC,CAAC,CACH,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resource pools, records, and Kafka client options:
|
|
3
|
+
* `import { makePostgresqlPool, KafkaResource, kafkaConfig } from '@temper/workflow/resources'`. PostgreSQL pools load
|
|
4
|
+
* the optional `pg` and `ws` peers when a pool is built, and Kafka's optional AWS peers load only for MSK IAM, so
|
|
5
|
+
* importing this module needs none.
|
|
6
|
+
*/
|
|
7
|
+
export { As2IdentityResource, As2PartnerResource } from './As2Resource.js';
|
|
8
|
+
export { HttpApiAuth, HttpApiResource, HttpApiUnsupportedAuth, HttpProxy, OAuthTokenRequest, TlsSettings, } from './HttpApiResource.js';
|
|
9
|
+
export { makePostgresqlPool, type PostgresqlPoolError } from './PostgreSql.js';
|
|
10
|
+
export { AzureBlobResource, type JsonObject, type JsonValue, KafkaResource, PostgresqlResource, S3Resource, SftpResource, UnknownRecordValueError, } from './ResourceRecords.js';
|
|
11
|
+
export { kafkaConfig, type KafkaClientConfig, type KafkaClientSasl, type KafkaClientTlsOptions, type KafkaConfigOptions, OptionalKafkaDependencyError, UnsupportedKafkaAuthError, } from './Kafka.js';
|
|
12
|
+
export { InvalidResourceError, ResourceNotFoundError, ResourceNotSelectableError, ResourcesUnauthorizedError, ResourcesUnavailableError, } from './ResourcesErrors.js';
|
|
13
|
+
//# sourceMappingURL=Resources.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Resources.d.ts","sourceRoot":"","sources":["../src/Resources.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EACL,WAAW,EACX,eAAe,EACf,sBAAsB,EACtB,SAAS,EACT,iBAAiB,EACjB,WAAW,GACZ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,KAAK,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAE/E,OAAO,EACL,iBAAiB,EACjB,KAAK,UAAU,EACf,KAAK,SAAS,EACd,aAAa,EACb,kBAAkB,EAClB,UAAU,EACV,YAAY,EACZ,uBAAuB,GACxB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,WAAW,EACX,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACvB,4BAA4B,EAC5B,yBAAyB,GAC1B,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,0BAA0B,EAC1B,0BAA0B,EAC1B,yBAAyB,GAC1B,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resource pools, records, and Kafka client options:
|
|
3
|
+
* `import { makePostgresqlPool, KafkaResource, kafkaConfig } from '@temper/workflow/resources'`. PostgreSQL pools load
|
|
4
|
+
* the optional `pg` and `ws` peers when a pool is built, and Kafka's optional AWS peers load only for MSK IAM, so
|
|
5
|
+
* importing this module needs none.
|
|
6
|
+
*/
|
|
7
|
+
export { As2IdentityResource, As2PartnerResource } from './As2Resource.js';
|
|
8
|
+
export { HttpApiAuth, HttpApiResource, HttpApiUnsupportedAuth, HttpProxy, OAuthTokenRequest, TlsSettings, } from './HttpApiResource.js';
|
|
9
|
+
export { makePostgresqlPool } from './PostgreSql.js';
|
|
10
|
+
export { AzureBlobResource, KafkaResource, PostgresqlResource, S3Resource, SftpResource, UnknownRecordValueError, } from './ResourceRecords.js';
|
|
11
|
+
export { kafkaConfig, OptionalKafkaDependencyError, UnsupportedKafkaAuthError, } from './Kafka.js';
|
|
12
|
+
export { InvalidResourceError, ResourceNotFoundError, ResourceNotSelectableError, ResourcesUnauthorizedError, ResourcesUnavailableError, } from './ResourcesErrors.js';
|
|
13
|
+
//# sourceMappingURL=Resources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Resources.js","sourceRoot":"","sources":["../src/Resources.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EACL,WAAW,EACX,eAAe,EACf,sBAAsB,EACtB,SAAS,EACT,iBAAiB,EACjB,WAAW,GACZ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAA4B,MAAM,iBAAiB,CAAC;AAE/E,OAAO,EACL,iBAAiB,EAGjB,aAAa,EACb,kBAAkB,EAClB,UAAU,EACV,YAAY,EACZ,uBAAuB,GACxB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,WAAW,EAKX,4BAA4B,EAC5B,yBAAyB,GAC1B,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,0BAA0B,EAC1B,0BAA0B,EAC1B,yBAAyB,GAC1B,MAAM,sBAAsB,CAAC"}
|
|
@@ -1,10 +1,24 @@
|
|
|
1
1
|
import { Context, Effect, Layer, Redacted, Schema } from 'effect';
|
|
2
2
|
import { HttpClient } from 'effect/http';
|
|
3
|
-
import { type SelectResourceRuntimeInputSchema } from './Contract/RuntimeApi.js';
|
|
3
|
+
import { type RuntimeInspectedResourceSchema, type SelectResourceRuntimeInputSchema } from './Contract/RuntimeApi.js';
|
|
4
4
|
import { InvalidResourceError, ResourceNotFoundError, ResourceNotSelectableError, ResourcesUnauthorizedError, ResourcesUnavailableError } from './ResourcesErrors.js';
|
|
5
5
|
/** Finds the one record of a type whose `x-selectable` field equals the value a tenant presented. */
|
|
6
6
|
export type ResourceSelector = typeof SelectResourceRuntimeInputSchema.Type;
|
|
7
7
|
export type ReadError = ResourceNotFoundError | ResourcesUnauthorizedError | ResourcesUnavailableError;
|
|
8
|
+
/** The resolver's answer to `inspect`: literal fields and metadata, never a secret. */
|
|
9
|
+
export type InspectedResource = typeof RuntimeInspectedResourceSchema.Type;
|
|
10
|
+
/** The `./resources` pool client: uncached runtime reads and the current runtime token. */
|
|
11
|
+
export declare const makeRuntimeResourceClient: Effect.Effect<{
|
|
12
|
+
/**
|
|
13
|
+
* The token for one database tunnel; re-read on every call, never cached by the caller. The tunnel re-checks it
|
|
14
|
+
* every 2 s, so a token in its 30 s refresh window would end the connection when it expires.
|
|
15
|
+
*/
|
|
16
|
+
tunnelToken: Effect.Effect<string, ResourcesUnauthorizedError, never>;
|
|
17
|
+
variable: (key: string) => Effect.Effect<string, ReadError, never>;
|
|
18
|
+
resolve: (key: string) => Effect.Effect<Schema.Json, InvalidResourceError | ReadError, never>;
|
|
19
|
+
inspect: (key: string) => Effect.Effect<InspectedResource, ReadError>;
|
|
20
|
+
select: (selector: ResourceSelector) => Effect.Effect<string, InvalidResourceError | ResourceNotSelectableError | ReadError, never>;
|
|
21
|
+
}, never, HttpClient.HttpClient>;
|
|
8
22
|
/** What declared resources read through: the Temper runtime API in production, fixed values in tests. */
|
|
9
23
|
export interface ResourceReader {
|
|
10
24
|
/** A Variable's live value; `Redacted` because the platform, not the caller, decides what is secret. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RuntimeResources.d.ts","sourceRoot":"","sources":["../src/RuntimeResources.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,OAAO,EAAY,MAAM,EAAQ,KAAK,EAAU,QAAQ,EAAE,MAAM,EAAc,MAAM,QAAQ,CAAC;AAErH,OAAO,EAAE,UAAU,EAA2C,MAAM,aAAa,CAAC;AAElF,OAAO,EAQL,KAAK,gCAAgC,EACtC,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,0BAA0B,EAC1B,0BAA0B,EAC1B,yBAAyB,EAC1B,MAAM,sBAAsB,CAAC;AAY9B,qGAAqG;AACrG,MAAM,MAAM,gBAAgB,GAAG,OAAO,gCAAgC,CAAC,IAAI,CAAC;AAE5E,MAAM,MAAM,SAAS,GAAG,qBAAqB,GAAG,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AC,CAAC;IAChG,oEAAoE;IACpE,QAAQ,CAAC,MAAM,EAAE,CACf,QAAQ,EAAE,gBAAgB,KACvB,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,GAAG,0BAA0B,GAAG,oBAAoB,CAAC,CAAC;CAC3F;;AAED;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,qBAErC;IAEC,MAAM,CAAC,QAAQ,CAAC,KAAK,8DAAiD;CACvE"}
|
package/dist/RuntimeResources.js
CHANGED
|
@@ -26,7 +26,8 @@ const statusOfRuntimeError = {
|
|
|
26
26
|
RuntimeResourcesConflictError: 409,
|
|
27
27
|
RuntimeResourcesUnavailableError: 503,
|
|
28
28
|
};
|
|
29
|
-
|
|
29
|
+
// One authenticated runtime API caller; `RuntimeResources` and the `@temper/workflow/resources` pools share it.
|
|
30
|
+
const makeRuntimeCaller = Effect.gen(function* () {
|
|
30
31
|
const tokens = yield* makeRuntimeTokens;
|
|
31
32
|
// Each attempt's scope owns its request: leaving the scope aborts it, so no response outlives its attempt.
|
|
32
33
|
const platform = HttpClient.withScope(yield* HttpClient.HttpClient).pipe(HttpClient.mapRequestEffect((request) => Config.NonEmptyString('UNNBOUND_API_URL').pipe(Effect.map((apiUrl) => HttpClientRequest.prependUrl(request, apiUrl)), Effect.mapError(() => new ApiUrlMissing()))));
|
|
@@ -75,27 +76,55 @@ const ResourcesMake = Effect.gen(function* () {
|
|
|
75
76
|
const first = yield* attempt(client.resourcesRuntime, token).pipe(Effect.map(Option.some), Effect.catchTag('TokenRefused', () => Effect.succeedNone));
|
|
76
77
|
if (Option.isSome(first))
|
|
77
78
|
return first.value;
|
|
78
|
-
|
|
79
|
+
// A refused token stays a refusal if its provider cannot replace it; a cached credential must never outlive it.
|
|
80
|
+
const replacement = yield* tokens.replacing(token).pipe(Effect.mapError(() => new TokenRefused()));
|
|
81
|
+
return yield* attempt(client.resourcesRuntime, replacement);
|
|
79
82
|
}).pipe(Effect.catchIf((error) => error._tag !== 'ResourcesUnauthorizedError' && error._tag !== 'ResourcesUnavailableError', (error) => Effect.fail(toReadError(error))));
|
|
80
83
|
};
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
84
|
+
return { tokens, call };
|
|
85
|
+
});
|
|
86
|
+
// Registers the answer's secrets in the caller's context, so a cached read masks them like a fresh one.
|
|
87
|
+
const unwrap = (read) => read.pipe(Effect.tap(({ redactionMasks }) => registerSecrets(redactionMasks ?? [])), Effect.map(({ value }) => value));
|
|
88
|
+
// The four runtime reads, uncached; each answer still carries its `redactionMasks`.
|
|
89
|
+
const runtimeReads = (call) => ({
|
|
90
|
+
variable: (key) => call('resolveVariable', `key ${key}`, (api, authorization) => api.resolveVariable({ headers: { authorization }, payload: { key } })),
|
|
91
|
+
resolve: (key) => call('resolveResource', `key ${key}`, (api, authorization) => api.resolveResource({ headers: { authorization }, payload: { key } }), (status, message) => (status === 409 ? new InvalidResourceError({ target: `key ${key}`, message }) : undefined)),
|
|
92
|
+
inspect: (key) => call('inspectResource', `key ${key}`, (api, authorization) => api.inspectResource({ headers: { authorization }, payload: { key } })),
|
|
93
|
+
select: (selector) => {
|
|
90
94
|
const target = `${selector.resourceTypeKey} matching ${Object.keys(selector.match).join(', ')}`;
|
|
91
95
|
return call('selectResource', target, (api, authorization) => api.selectResource({ headers: { authorization }, payload: selector }), (status, message) => status === 400
|
|
92
96
|
? new ResourceNotSelectableError({ target, message })
|
|
93
97
|
: status === 409
|
|
94
98
|
? new InvalidResourceError({ target, message })
|
|
95
99
|
: undefined);
|
|
100
|
+
},
|
|
101
|
+
});
|
|
102
|
+
/** The `./resources` pool client: uncached runtime reads and the current runtime token. */
|
|
103
|
+
export const makeRuntimeResourceClient = Effect.map(makeRuntimeCaller, ({ tokens, call }) => {
|
|
104
|
+
const reads = runtimeReads(call);
|
|
105
|
+
return {
|
|
106
|
+
/**
|
|
107
|
+
* The token for one database tunnel; re-read on every call, never cached by the caller. The tunnel re-checks it
|
|
108
|
+
* every 2 s, so a token in its 30 s refresh window would end the connection when it expires.
|
|
109
|
+
*/
|
|
110
|
+
tunnelToken: tokens.current,
|
|
111
|
+
variable: (key) => unwrap(reads.variable(key)),
|
|
112
|
+
resolve: (key) => unwrap(reads.resolve(key)),
|
|
113
|
+
inspect: (key) => unwrap(reads.inspect(key)),
|
|
114
|
+
select: (selector) => Effect.map(unwrap(reads.select(selector)), (selected) => selected.key),
|
|
115
|
+
};
|
|
116
|
+
});
|
|
117
|
+
const ResourcesMake = Effect.gen(function* () {
|
|
118
|
+
const reads = runtimeReads((yield* makeRuntimeCaller).call);
|
|
119
|
+
const cache = (lookup) => Cache.makeWith(lookup, {
|
|
120
|
+
capacity: CACHE_CAPACITY,
|
|
121
|
+
// A failure is not kept: the next read asks the resolver again.
|
|
122
|
+
timeToLive: (exit) => (Exit.isSuccess(exit) ? CACHE_TTL : Duration.zero),
|
|
96
123
|
});
|
|
97
|
-
|
|
98
|
-
const
|
|
124
|
+
const variables = yield* cache(reads.variable);
|
|
125
|
+
const values = yield* cache(reads.resolve);
|
|
126
|
+
// Keyed by value: `{a,b}` and `{b,a}` share one entry, and each tenant's presented value gets its own.
|
|
127
|
+
const selections = yield* cache(reads.select);
|
|
99
128
|
return RuntimeResources.of({
|
|
100
129
|
variable: (key) => Effect.map(unwrap(Cache.get(variables, key)), Redacted.make),
|
|
101
130
|
// Each caller gets its own copy: the cached value is shared across requests for 30 s.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RuntimeResources.js","sourceRoot":"","sources":["../src/RuntimeResources.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAc,MAAM,QAAQ,CAAC;AACrH,OAAO,EAAE,SAAS,EAAE,M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ACJ,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAcH;;;GAGG;AACH,MAAM,OAAO,gBAAiB,SAAQ,OAAO,CAAC,OAAO,EAAoC,CACvF,mCAAmC,CACpC;IACC,mDAAmD;IACnD,MAAM,CAAU,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,gBAAgB,EAAE,aAAa,CAAC,CAAC;CACvE"}
|
|
@@ -1,33 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const TransportTls: Schema.Struct<{
|
|
3
|
-
readonly caCertificate: Schema.optionalKey<Schema.String>;
|
|
4
|
-
readonly clientCertificate: Schema.optionalKey<Schema.String>;
|
|
5
|
-
readonly clientKey: Schema.optionalKey<Schema.RedactedFromValue<Schema.String>>;
|
|
6
|
-
readonly clientKeyPassphrase: Schema.optionalKey<Schema.RedactedFromValue<Schema.String>>;
|
|
7
|
-
readonly serverName: Schema.optionalKey<Schema.String>;
|
|
8
|
-
}>;
|
|
9
|
-
export declare const TransportAuth: Schema.withDecodingDefaultKey<Schema.Union<readonly [Schema.Struct<{
|
|
10
|
-
readonly type: Schema.Literal<"none">;
|
|
11
|
-
}>, Schema.Struct<{
|
|
12
|
-
readonly type: Schema.Literal<"basic">;
|
|
13
|
-
readonly username: Schema.String;
|
|
14
|
-
readonly password: Schema.RedactedFromValue<Schema.String>;
|
|
15
|
-
}>]>, never>;
|
|
16
|
-
export declare const TransportProxy: Schema.Struct<{
|
|
17
|
-
readonly url: Schema.String;
|
|
18
|
-
readonly auth: Schema.withDecodingDefaultKey<Schema.Union<readonly [Schema.Struct<{
|
|
19
|
-
readonly type: Schema.Literal<"none">;
|
|
20
|
-
}>, Schema.Struct<{
|
|
21
|
-
readonly type: Schema.Literal<"basic">;
|
|
22
|
-
readonly username: Schema.String;
|
|
23
|
-
readonly password: Schema.RedactedFromValue<Schema.String>;
|
|
24
|
-
}>]>, never>;
|
|
25
|
-
readonly tls: Schema.optionalKey<Schema.Struct<{
|
|
26
|
-
readonly caCertificate: Schema.optionalKey<Schema.String>;
|
|
27
|
-
readonly clientCertificate: Schema.optionalKey<Schema.String>;
|
|
28
|
-
readonly clientKey: Schema.optionalKey<Schema.RedactedFromValue<Schema.String>>;
|
|
29
|
-
readonly clientKeyPassphrase: Schema.optionalKey<Schema.RedactedFromValue<Schema.String>>;
|
|
30
|
-
readonly serverName: Schema.optionalKey<Schema.String>;
|
|
31
|
-
}>>;
|
|
32
|
-
}>;
|
|
1
|
+
export { HttpBasicOrNoneAuth as TransportAuth, HttpProxy as TransportProxy, TlsSettings as TransportTls, } from './HttpApiResource.js';
|
|
33
2
|
//# sourceMappingURL=TransportResource.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransportResource.d.ts","sourceRoot":"","sources":["../src/TransportResource.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"TransportResource.d.ts","sourceRoot":"","sources":["../src/TransportResource.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,IAAI,aAAa,EACpC,SAAS,IAAI,cAAc,EAC3B,WAAW,IAAI,YAAY,GAC5B,MAAM,sBAAsB,CAAC"}
|
|
@@ -1,20 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
const Secret = Schema.RedactedFromValue(Schema.String);
|
|
3
|
-
const NonEmptyString = Schema.String.check(Schema.isMinLength(1));
|
|
4
|
-
export const TransportTls = Schema.Struct({
|
|
5
|
-
caCertificate: Schema.optionalKey(Schema.String),
|
|
6
|
-
clientCertificate: Schema.optionalKey(Schema.String),
|
|
7
|
-
clientKey: Schema.optionalKey(Secret),
|
|
8
|
-
clientKeyPassphrase: Schema.optionalKey(Secret),
|
|
9
|
-
serverName: Schema.optionalKey(NonEmptyString),
|
|
10
|
-
});
|
|
11
|
-
export const TransportAuth = Schema.Union([
|
|
12
|
-
Schema.Struct({ type: Schema.Literal('none') }),
|
|
13
|
-
Schema.Struct({ type: Schema.Literal('basic'), username: Schema.String, password: Secret }),
|
|
14
|
-
]).pipe(Schema.withDecodingDefaultKey(Effect.succeed({ type: 'none' })));
|
|
15
|
-
export const TransportProxy = Schema.Struct({
|
|
16
|
-
url: NonEmptyString,
|
|
17
|
-
auth: TransportAuth,
|
|
18
|
-
tls: Schema.optionalKey(TransportTls),
|
|
19
|
-
});
|
|
1
|
+
export { HttpBasicOrNoneAuth as TransportAuth, HttpProxy as TransportProxy, TlsSettings as TransportTls, } from './HttpApiResource.js';
|
|
20
2
|
//# sourceMappingURL=TransportResource.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransportResource.js","sourceRoot":"","sources":["../src/TransportResource.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"TransportResource.js","sourceRoot":"","sources":["../src/TransportResource.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,IAAI,aAAa,EACpC,SAAS,IAAI,cAAc,EAC3B,WAAW,IAAI,YAAY,GAC5B,MAAM,sBAAsB,CAAC"}
|