@walkeros/server-destination-aws 4.7.0-next-1790722899482 → 4.7.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/CHANGELOG.md +21 -3
- package/README.md +16 -3
- package/dist/dev.d.mts +76 -50
- package/dist/dev.d.ts +76 -50
- package/dist/dev.js +1 -1
- package/dist/dev.js.map +1 -1
- package/dist/dev.mjs +1 -1
- package/dist/dev.mjs.map +1 -1
- package/dist/examples/index.d.mts +47 -35
- package/dist/examples/index.d.ts +47 -35
- package/dist/examples/index.js +181 -102
- package/dist/examples/index.mjs +179 -100
- package/dist/index.d.mts +161 -60
- package/dist/index.d.ts +161 -60
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/schemas.js +1 -1
- package/dist/schemas.js.map +1 -1
- package/dist/schemas.mjs +1 -1
- package/dist/schemas.mjs.map +1 -1
- package/dist/walkerOS.json +1331 -129
- package/package.json +4 -3
package/dist/index.d.mts
CHANGED
|
@@ -5,84 +5,180 @@ import { SNSClientConfig, CreateTopicCommandInput, PublishCommandInput, GetTopic
|
|
|
5
5
|
import { STSClientConfig, GetCallerIdentityCommandInput } from '@aws-sdk/client-sts';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* The part of an AWS SDK v3 client this
|
|
9
|
-
*
|
|
10
|
-
* simulate) without a cast.
|
|
8
|
+
* The part of an AWS SDK v3 client this package calls: `send` with a command,
|
|
9
|
+
* and `destroy` on a client it created. The SDK clients satisfy it, and so
|
|
10
|
+
* does an injected mock (tests, simulate) without a cast.
|
|
11
11
|
*/
|
|
12
|
-
interface SendClient
|
|
12
|
+
interface SendClient {
|
|
13
13
|
send(command: object): Promise<unknown>;
|
|
14
|
+
destroy?(): void;
|
|
14
15
|
}
|
|
15
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Tracks the sends an instance has in flight, so `destroy` can let them land
|
|
18
|
+
* before it closes the client under them.
|
|
19
|
+
*/
|
|
20
|
+
declare class InFlight {
|
|
21
|
+
private readonly pending;
|
|
22
|
+
track<T>(promise: Promise<T>): Promise<T>;
|
|
23
|
+
get size(): number;
|
|
24
|
+
/** Resolves once every tracked send settled, whatever its outcome. */
|
|
25
|
+
settle(): Promise<void>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Static AWS keys, the shape `config.credentials` takes. Back each value with
|
|
30
|
+
* `$secret`; a literal key in a flow file is a leaked key.
|
|
31
|
+
*/
|
|
32
|
+
interface AwsCredentials {
|
|
33
|
+
accessKeyId: string;
|
|
34
|
+
secretAccessKey: string;
|
|
35
|
+
sessionToken?: string;
|
|
36
|
+
}
|
|
37
|
+
/** `config.credentials` as written: the object, or the same object as JSON. */
|
|
38
|
+
type CredentialsInput = AwsCredentials | string;
|
|
39
|
+
|
|
40
|
+
/** Client and stream options, as the deprecated `settings.firehose` held them. */
|
|
41
|
+
interface FirehoseConfig {
|
|
42
|
+
streamName?: string;
|
|
43
|
+
client?: SendClient;
|
|
44
|
+
region?: string;
|
|
45
|
+
config?: FirehoseClientConfig;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Settings as a user writes them. Only `streamName` is required (here or in
|
|
49
|
+
* the deprecated `firehose` alias); `init` fills in the rest.
|
|
50
|
+
*/
|
|
51
|
+
interface InitSettings$1 {
|
|
52
|
+
/** Name of the Firehose stream. */
|
|
53
|
+
streamName?: string;
|
|
54
|
+
/** AWS region. Default: `AWS_REGION` or the profile, else `eu-central-1`. */
|
|
55
|
+
region?: string;
|
|
56
|
+
/** Append `\n` to every record. Default `true`. */
|
|
57
|
+
newline?: boolean;
|
|
58
|
+
/** Raw `FirehoseClient` options, passed through to the SDK. */
|
|
59
|
+
config?: FirehoseClientConfig;
|
|
60
|
+
/** A client of your own. Used as is and never closed by the destination. */
|
|
61
|
+
client?: SendClient;
|
|
62
|
+
/** @deprecated Use the flat fields. Read at `init` as an alias. */
|
|
16
63
|
firehose?: FirehoseConfig;
|
|
64
|
+
/** Runtime-only, set by `init`: what the destination owns. Not user-facing. */
|
|
65
|
+
runtime?: Runtime$1;
|
|
66
|
+
}
|
|
67
|
+
/** What `init` resolved. Every field is present. */
|
|
68
|
+
interface Settings$1 {
|
|
69
|
+
streamName: string;
|
|
70
|
+
region: string;
|
|
71
|
+
newline: boolean;
|
|
72
|
+
config?: FirehoseClientConfig;
|
|
73
|
+
client: SendClient;
|
|
74
|
+
runtime: Runtime$1;
|
|
17
75
|
}
|
|
18
|
-
|
|
76
|
+
/** Runtime-only state of one initialized instance. */
|
|
77
|
+
interface Runtime$1 {
|
|
78
|
+
/**
|
|
79
|
+
* True when the destination built the client from nothing the user owns,
|
|
80
|
+
* and so closes it. A user client, or a user request handler instance in
|
|
81
|
+
* `settings.config`, keeps it false.
|
|
82
|
+
*/
|
|
83
|
+
ownsClient: boolean;
|
|
84
|
+
/** Sends in flight, awaited by `destroy`. */
|
|
85
|
+
inflight: InFlight;
|
|
86
|
+
/** Where the client's credentials come from, for the debug line. */
|
|
87
|
+
credentialSource: CredentialSource;
|
|
88
|
+
}
|
|
89
|
+
type CredentialSource = 'config.credentials' | 'settings.config.credentials' | 'default chain' | 'client';
|
|
19
90
|
interface Mapping$1 {
|
|
20
91
|
}
|
|
92
|
+
type FirehoseClientConstructor = new (config: FirehoseClientConfig) => SendClient;
|
|
93
|
+
type PutRecordBatchCommandConstructor = new (input: PutRecordBatchCommandInput) => {
|
|
94
|
+
readonly input: PutRecordBatchCommandInput;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Optional SDK overrides. Each one present wins over the SDK the package
|
|
98
|
+
* imports; tests and simulate inject mocks here.
|
|
99
|
+
*/
|
|
21
100
|
interface Env$1 extends DestinationServer.Env {
|
|
22
|
-
AWS
|
|
23
|
-
FirehoseClient
|
|
24
|
-
PutRecordBatchCommand
|
|
25
|
-
readonly input: PutRecordBatchCommandInput;
|
|
26
|
-
};
|
|
101
|
+
AWS?: {
|
|
102
|
+
FirehoseClient?: FirehoseClientConstructor;
|
|
103
|
+
PutRecordBatchCommand?: PutRecordBatchCommandConstructor;
|
|
27
104
|
};
|
|
28
105
|
}
|
|
29
|
-
type Types$1 = Destination$2.Types<Settings$1, Mapping$1, Env$1, InitSettings$1>;
|
|
106
|
+
type Types$1 = Destination$2.Types<Settings$1, Mapping$1, Env$1, InitSettings$1, unknown, CredentialsInput>;
|
|
30
107
|
interface Destination$1 extends DestinationServer.Destination<Types$1> {
|
|
31
|
-
init:
|
|
108
|
+
init: InitFn$1;
|
|
109
|
+
pushBatch: PushBatchFn;
|
|
32
110
|
}
|
|
33
111
|
type Config$1 = {
|
|
34
|
-
settings:
|
|
112
|
+
settings: InitSettings$1;
|
|
35
113
|
} & DestinationServer.Config<Types$1>;
|
|
36
114
|
type InitFn$1 = DestinationServer.InitFn<Types$1>;
|
|
37
115
|
type PushFn$1 = DestinationServer.PushFn<Types$1>;
|
|
116
|
+
type PushBatchFn = Destination$2.PushBatchFn<Types$1>;
|
|
38
117
|
type PartialConfig$1 = DestinationServer.PartialConfig<Types$1>;
|
|
39
118
|
type PushEvents$1 = DestinationServer.PushEvents<Mapping$1>;
|
|
40
119
|
type Rule$1 = Mapping$2.Rule<Mapping$1>;
|
|
41
120
|
type Rules$1 = Mapping$2.Rules<Rule$1>;
|
|
42
|
-
interface FirehoseConfig {
|
|
43
|
-
streamName: string;
|
|
44
|
-
client?: SendClient$1;
|
|
45
|
-
region?: string;
|
|
46
|
-
config?: FirehoseClientConfig;
|
|
47
|
-
}
|
|
48
121
|
|
|
122
|
+
type index$1_CredentialSource = CredentialSource;
|
|
123
|
+
type index$1_FirehoseClientConstructor = FirehoseClientConstructor;
|
|
49
124
|
type index$1_FirehoseConfig = FirehoseConfig;
|
|
125
|
+
type index$1_PushBatchFn = PushBatchFn;
|
|
126
|
+
type index$1_PutRecordBatchCommandConstructor = PutRecordBatchCommandConstructor;
|
|
127
|
+
type index$1_SendClient = SendClient;
|
|
50
128
|
declare namespace index$1 {
|
|
51
|
-
export type { Config$1 as Config, Destination$1 as Destination, Env$1 as Env, index$1_FirehoseConfig as FirehoseConfig, InitFn$1 as InitFn, InitSettings$1 as InitSettings, Mapping$1 as Mapping, PartialConfig$1 as PartialConfig, PushEvents$1 as PushEvents, PushFn$1 as PushFn, Rule$1 as Rule, Rules$1 as Rules,
|
|
129
|
+
export type { Config$1 as Config, index$1_CredentialSource as CredentialSource, Destination$1 as Destination, Env$1 as Env, index$1_FirehoseClientConstructor as FirehoseClientConstructor, index$1_FirehoseConfig as FirehoseConfig, InitFn$1 as InitFn, InitSettings$1 as InitSettings, Mapping$1 as Mapping, PartialConfig$1 as PartialConfig, index$1_PushBatchFn as PushBatchFn, PushEvents$1 as PushEvents, PushFn$1 as PushFn, index$1_PutRecordBatchCommandConstructor as PutRecordBatchCommandConstructor, Rule$1 as Rule, Rules$1 as Rules, Runtime$1 as Runtime, index$1_SendClient as SendClient, Settings$1 as Settings, Types$1 as Types };
|
|
52
130
|
}
|
|
53
131
|
|
|
54
|
-
declare const destinationFirehose: Destination$1;
|
|
55
|
-
|
|
56
132
|
/**
|
|
57
|
-
* The
|
|
58
|
-
*
|
|
59
|
-
* mock (tests, simulate) without a cast.
|
|
133
|
+
* The Firehose destination. Batching is on by default: a flushed batch goes
|
|
134
|
+
* out as `PutRecordBatch` calls of at most 500 records.
|
|
60
135
|
*/
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
136
|
+
declare const destinationFirehose: Destination$1;
|
|
137
|
+
|
|
64
138
|
/** An AWS SDK v3 command class, as far as this destination builds one. */
|
|
65
139
|
type CommandConstructor<Input> = new (input: Input) => {
|
|
66
140
|
readonly input: Input;
|
|
67
141
|
};
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
/** AWS region. Mirrors setup.region default ('eu-central-1'). */
|
|
74
|
-
region?: string;
|
|
75
|
-
/** SDK client config (credentials, etc.). Optional. */
|
|
76
|
-
config?: SNSClientConfig;
|
|
77
|
-
/** Topic ARN, populated at init() from CreateTopic. Operator may pre-set to skip init's CreateTopic call. */
|
|
78
|
-
topicArn?: string;
|
|
79
|
-
}
|
|
142
|
+
/**
|
|
143
|
+
* Settings as a user writes them. `topicArn` alone is enough: region and
|
|
144
|
+
* topic name derive from it. `topicName` (with `region`) also works, and the
|
|
145
|
+
* ARN is then completed with the account id at the first publish.
|
|
146
|
+
*/
|
|
80
147
|
interface InitSettings {
|
|
81
|
-
|
|
82
|
-
|
|
148
|
+
/** Topic ARN. Region and topic name derive from it. */
|
|
149
|
+
topicArn?: string;
|
|
150
|
+
/** Topic name (with `.fifo` for FIFO topics). Needed by `walkeros setup`. */
|
|
151
|
+
topicName?: string;
|
|
152
|
+
/** AWS region. Default: the ARN's region, `AWS_REGION` or the profile, else `eu-central-1`. */
|
|
83
153
|
region?: string;
|
|
154
|
+
/** Raw `SNSClient` options, passed through to the SDK. */
|
|
84
155
|
config?: SNSClientConfig;
|
|
156
|
+
/** A client of your own. Used as is and never closed by the destination. */
|
|
157
|
+
client?: SendClient;
|
|
158
|
+
/** Runtime-only, set by `init`: what the destination owns. Not user-facing. */
|
|
159
|
+
runtime?: Runtime;
|
|
160
|
+
}
|
|
161
|
+
/** What `init` resolved. */
|
|
162
|
+
interface Settings {
|
|
85
163
|
topicArn?: string;
|
|
164
|
+
topicName?: string;
|
|
165
|
+
region: string;
|
|
166
|
+
config?: SNSClientConfig;
|
|
167
|
+
client: SendClient;
|
|
168
|
+
runtime: Runtime;
|
|
169
|
+
}
|
|
170
|
+
/** Runtime-only state of one initialized instance. */
|
|
171
|
+
interface Runtime {
|
|
172
|
+
/**
|
|
173
|
+
* True when the destination built the client from nothing the user owns,
|
|
174
|
+
* and so closes it. A user client, or a user request handler instance in
|
|
175
|
+
* `settings.config`, keeps it false.
|
|
176
|
+
*/
|
|
177
|
+
ownsClient: boolean;
|
|
178
|
+
/** Publishes in flight, awaited by `destroy`. */
|
|
179
|
+
inflight: InFlight;
|
|
180
|
+
/** The topic ARN, completed once with the account id when only a name was given. */
|
|
181
|
+
topicArn: () => Promise<string>;
|
|
86
182
|
}
|
|
87
183
|
interface Mapping {
|
|
88
184
|
/**
|
|
@@ -98,18 +194,25 @@ interface Mapping {
|
|
|
98
194
|
* `messageGroupId: 'user.id'` (path) instead of hard-coding a literal.
|
|
99
195
|
*/
|
|
100
196
|
messageGroupId?: Mapping$2.Value;
|
|
101
|
-
/**
|
|
197
|
+
/**
|
|
198
|
+
* FIFO deduplication ID. `Mapping.Value`, same reasoning as
|
|
199
|
+
* `messageGroupId`. Defaults to the event id on FIFO topics.
|
|
200
|
+
*/
|
|
102
201
|
messageDeduplicationId?: Mapping$2.Value;
|
|
103
202
|
}
|
|
203
|
+
/**
|
|
204
|
+
* Optional SDK overrides. Each one present wins over the SDK the package
|
|
205
|
+
* imports; tests and simulate inject mocks here.
|
|
206
|
+
*/
|
|
104
207
|
interface Env extends DestinationServer.Env {
|
|
105
|
-
AWS
|
|
106
|
-
SNSClient
|
|
107
|
-
CreateTopicCommand
|
|
108
|
-
PublishCommand
|
|
109
|
-
GetTopicAttributesCommand
|
|
110
|
-
SubscribeCommand
|
|
111
|
-
STSClient
|
|
112
|
-
GetCallerIdentityCommand
|
|
208
|
+
AWS?: {
|
|
209
|
+
SNSClient?: new (config: SNSClientConfig) => SendClient;
|
|
210
|
+
CreateTopicCommand?: CommandConstructor<CreateTopicCommandInput>;
|
|
211
|
+
PublishCommand?: CommandConstructor<PublishCommandInput>;
|
|
212
|
+
GetTopicAttributesCommand?: CommandConstructor<GetTopicAttributesCommandInput>;
|
|
213
|
+
SubscribeCommand?: CommandConstructor<SubscribeCommandInput>;
|
|
214
|
+
STSClient?: new (config: STSClientConfig) => SendClient;
|
|
215
|
+
GetCallerIdentityCommand?: CommandConstructor<GetCallerIdentityCommandInput>;
|
|
113
216
|
};
|
|
114
217
|
}
|
|
115
218
|
/**
|
|
@@ -119,7 +222,7 @@ interface Env extends DestinationServer.Env {
|
|
|
119
222
|
* `topicName` lives in Settings (one source of truth for setup AND runtime publish).
|
|
120
223
|
*/
|
|
121
224
|
interface Setup {
|
|
122
|
-
/** AWS region for the topic. Default:
|
|
225
|
+
/** AWS region for the topic. Default: the runtime region order. */
|
|
123
226
|
region?: string;
|
|
124
227
|
/** Display name. Optional. */
|
|
125
228
|
displayName?: string;
|
|
@@ -139,20 +242,17 @@ interface SetupSubscription {
|
|
|
139
242
|
filterPolicy?: Record<string, unknown>;
|
|
140
243
|
deadLetterTargetArn?: string;
|
|
141
244
|
}
|
|
142
|
-
type Types = Destination$2.Types<Settings, Mapping, Env, InitSettings, Setup>;
|
|
245
|
+
type Types = Destination$2.Types<Settings, Mapping, Env, InitSettings, Setup, CredentialsInput>;
|
|
143
246
|
interface Destination extends DestinationServer.Destination<Types> {
|
|
144
247
|
init: DestinationServer.InitFn<Types>;
|
|
145
248
|
}
|
|
146
249
|
type Config = {
|
|
147
|
-
settings:
|
|
250
|
+
settings: InitSettings;
|
|
148
251
|
} & DestinationServer.Config<Types>;
|
|
149
252
|
type InitFn = DestinationServer.InitFn<Types>;
|
|
150
253
|
type PushFn = DestinationServer.PushFn<Types>;
|
|
151
254
|
type SetupFn = SetupFn$1<Config, Env>;
|
|
152
|
-
type PartialConfig =
|
|
153
|
-
settings?: Partial<Settings> | Settings;
|
|
154
|
-
setup?: boolean | Setup;
|
|
155
|
-
};
|
|
255
|
+
type PartialConfig = DestinationServer.PartialConfig<Types>;
|
|
156
256
|
type PushEvents = DestinationServer.PushEvents<Mapping>;
|
|
157
257
|
type Rule = Mapping$2.Rule<Mapping>;
|
|
158
258
|
type Rules = Mapping$2.Rules<Rule>;
|
|
@@ -169,6 +269,7 @@ type index_PushEvents = PushEvents;
|
|
|
169
269
|
type index_PushFn = PushFn;
|
|
170
270
|
type index_Rule = Rule;
|
|
171
271
|
type index_Rules = Rules;
|
|
272
|
+
type index_Runtime = Runtime;
|
|
172
273
|
type index_SendClient = SendClient;
|
|
173
274
|
type index_Settings = Settings;
|
|
174
275
|
type index_Setup = Setup;
|
|
@@ -176,7 +277,7 @@ type index_SetupFn = SetupFn;
|
|
|
176
277
|
type index_SetupSubscription = SetupSubscription;
|
|
177
278
|
type index_Types = Types;
|
|
178
279
|
declare namespace index {
|
|
179
|
-
export type { index_CommandConstructor as CommandConstructor, index_Config as Config, index_Destination as Destination, index_Env as Env, index_InitFn as InitFn, index_InitSettings as InitSettings, index_Mapping as Mapping, index_PartialConfig as PartialConfig, index_PushEvents as PushEvents, index_PushFn as PushFn, index_Rule as Rule, index_Rules as Rules, index_SendClient as SendClient, index_Settings as Settings, index_Setup as Setup, index_SetupFn as SetupFn, index_SetupSubscription as SetupSubscription, index_Types as Types };
|
|
280
|
+
export type { index_CommandConstructor as CommandConstructor, index_Config as Config, index_Destination as Destination, index_Env as Env, index_InitFn as InitFn, index_InitSettings as InitSettings, index_Mapping as Mapping, index_PartialConfig as PartialConfig, index_PushEvents as PushEvents, index_PushFn as PushFn, index_Rule as Rule, index_Rules as Rules, index_Runtime as Runtime, index_SendClient as SendClient, index_Settings as Settings, index_Setup as Setup, index_SetupFn as SetupFn, index_SetupSubscription as SetupSubscription, index_Types as Types };
|
|
180
281
|
}
|
|
181
282
|
|
|
182
283
|
declare const destinationSNS: Destination;
|
package/dist/index.d.ts
CHANGED
|
@@ -5,84 +5,180 @@ import { SNSClientConfig, CreateTopicCommandInput, PublishCommandInput, GetTopic
|
|
|
5
5
|
import { STSClientConfig, GetCallerIdentityCommandInput } from '@aws-sdk/client-sts';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* The part of an AWS SDK v3 client this
|
|
9
|
-
*
|
|
10
|
-
* simulate) without a cast.
|
|
8
|
+
* The part of an AWS SDK v3 client this package calls: `send` with a command,
|
|
9
|
+
* and `destroy` on a client it created. The SDK clients satisfy it, and so
|
|
10
|
+
* does an injected mock (tests, simulate) without a cast.
|
|
11
11
|
*/
|
|
12
|
-
interface SendClient
|
|
12
|
+
interface SendClient {
|
|
13
13
|
send(command: object): Promise<unknown>;
|
|
14
|
+
destroy?(): void;
|
|
14
15
|
}
|
|
15
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Tracks the sends an instance has in flight, so `destroy` can let them land
|
|
18
|
+
* before it closes the client under them.
|
|
19
|
+
*/
|
|
20
|
+
declare class InFlight {
|
|
21
|
+
private readonly pending;
|
|
22
|
+
track<T>(promise: Promise<T>): Promise<T>;
|
|
23
|
+
get size(): number;
|
|
24
|
+
/** Resolves once every tracked send settled, whatever its outcome. */
|
|
25
|
+
settle(): Promise<void>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Static AWS keys, the shape `config.credentials` takes. Back each value with
|
|
30
|
+
* `$secret`; a literal key in a flow file is a leaked key.
|
|
31
|
+
*/
|
|
32
|
+
interface AwsCredentials {
|
|
33
|
+
accessKeyId: string;
|
|
34
|
+
secretAccessKey: string;
|
|
35
|
+
sessionToken?: string;
|
|
36
|
+
}
|
|
37
|
+
/** `config.credentials` as written: the object, or the same object as JSON. */
|
|
38
|
+
type CredentialsInput = AwsCredentials | string;
|
|
39
|
+
|
|
40
|
+
/** Client and stream options, as the deprecated `settings.firehose` held them. */
|
|
41
|
+
interface FirehoseConfig {
|
|
42
|
+
streamName?: string;
|
|
43
|
+
client?: SendClient;
|
|
44
|
+
region?: string;
|
|
45
|
+
config?: FirehoseClientConfig;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Settings as a user writes them. Only `streamName` is required (here or in
|
|
49
|
+
* the deprecated `firehose` alias); `init` fills in the rest.
|
|
50
|
+
*/
|
|
51
|
+
interface InitSettings$1 {
|
|
52
|
+
/** Name of the Firehose stream. */
|
|
53
|
+
streamName?: string;
|
|
54
|
+
/** AWS region. Default: `AWS_REGION` or the profile, else `eu-central-1`. */
|
|
55
|
+
region?: string;
|
|
56
|
+
/** Append `\n` to every record. Default `true`. */
|
|
57
|
+
newline?: boolean;
|
|
58
|
+
/** Raw `FirehoseClient` options, passed through to the SDK. */
|
|
59
|
+
config?: FirehoseClientConfig;
|
|
60
|
+
/** A client of your own. Used as is and never closed by the destination. */
|
|
61
|
+
client?: SendClient;
|
|
62
|
+
/** @deprecated Use the flat fields. Read at `init` as an alias. */
|
|
16
63
|
firehose?: FirehoseConfig;
|
|
64
|
+
/** Runtime-only, set by `init`: what the destination owns. Not user-facing. */
|
|
65
|
+
runtime?: Runtime$1;
|
|
66
|
+
}
|
|
67
|
+
/** What `init` resolved. Every field is present. */
|
|
68
|
+
interface Settings$1 {
|
|
69
|
+
streamName: string;
|
|
70
|
+
region: string;
|
|
71
|
+
newline: boolean;
|
|
72
|
+
config?: FirehoseClientConfig;
|
|
73
|
+
client: SendClient;
|
|
74
|
+
runtime: Runtime$1;
|
|
17
75
|
}
|
|
18
|
-
|
|
76
|
+
/** Runtime-only state of one initialized instance. */
|
|
77
|
+
interface Runtime$1 {
|
|
78
|
+
/**
|
|
79
|
+
* True when the destination built the client from nothing the user owns,
|
|
80
|
+
* and so closes it. A user client, or a user request handler instance in
|
|
81
|
+
* `settings.config`, keeps it false.
|
|
82
|
+
*/
|
|
83
|
+
ownsClient: boolean;
|
|
84
|
+
/** Sends in flight, awaited by `destroy`. */
|
|
85
|
+
inflight: InFlight;
|
|
86
|
+
/** Where the client's credentials come from, for the debug line. */
|
|
87
|
+
credentialSource: CredentialSource;
|
|
88
|
+
}
|
|
89
|
+
type CredentialSource = 'config.credentials' | 'settings.config.credentials' | 'default chain' | 'client';
|
|
19
90
|
interface Mapping$1 {
|
|
20
91
|
}
|
|
92
|
+
type FirehoseClientConstructor = new (config: FirehoseClientConfig) => SendClient;
|
|
93
|
+
type PutRecordBatchCommandConstructor = new (input: PutRecordBatchCommandInput) => {
|
|
94
|
+
readonly input: PutRecordBatchCommandInput;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Optional SDK overrides. Each one present wins over the SDK the package
|
|
98
|
+
* imports; tests and simulate inject mocks here.
|
|
99
|
+
*/
|
|
21
100
|
interface Env$1 extends DestinationServer.Env {
|
|
22
|
-
AWS
|
|
23
|
-
FirehoseClient
|
|
24
|
-
PutRecordBatchCommand
|
|
25
|
-
readonly input: PutRecordBatchCommandInput;
|
|
26
|
-
};
|
|
101
|
+
AWS?: {
|
|
102
|
+
FirehoseClient?: FirehoseClientConstructor;
|
|
103
|
+
PutRecordBatchCommand?: PutRecordBatchCommandConstructor;
|
|
27
104
|
};
|
|
28
105
|
}
|
|
29
|
-
type Types$1 = Destination$2.Types<Settings$1, Mapping$1, Env$1, InitSettings$1>;
|
|
106
|
+
type Types$1 = Destination$2.Types<Settings$1, Mapping$1, Env$1, InitSettings$1, unknown, CredentialsInput>;
|
|
30
107
|
interface Destination$1 extends DestinationServer.Destination<Types$1> {
|
|
31
|
-
init:
|
|
108
|
+
init: InitFn$1;
|
|
109
|
+
pushBatch: PushBatchFn;
|
|
32
110
|
}
|
|
33
111
|
type Config$1 = {
|
|
34
|
-
settings:
|
|
112
|
+
settings: InitSettings$1;
|
|
35
113
|
} & DestinationServer.Config<Types$1>;
|
|
36
114
|
type InitFn$1 = DestinationServer.InitFn<Types$1>;
|
|
37
115
|
type PushFn$1 = DestinationServer.PushFn<Types$1>;
|
|
116
|
+
type PushBatchFn = Destination$2.PushBatchFn<Types$1>;
|
|
38
117
|
type PartialConfig$1 = DestinationServer.PartialConfig<Types$1>;
|
|
39
118
|
type PushEvents$1 = DestinationServer.PushEvents<Mapping$1>;
|
|
40
119
|
type Rule$1 = Mapping$2.Rule<Mapping$1>;
|
|
41
120
|
type Rules$1 = Mapping$2.Rules<Rule$1>;
|
|
42
|
-
interface FirehoseConfig {
|
|
43
|
-
streamName: string;
|
|
44
|
-
client?: SendClient$1;
|
|
45
|
-
region?: string;
|
|
46
|
-
config?: FirehoseClientConfig;
|
|
47
|
-
}
|
|
48
121
|
|
|
122
|
+
type index$1_CredentialSource = CredentialSource;
|
|
123
|
+
type index$1_FirehoseClientConstructor = FirehoseClientConstructor;
|
|
49
124
|
type index$1_FirehoseConfig = FirehoseConfig;
|
|
125
|
+
type index$1_PushBatchFn = PushBatchFn;
|
|
126
|
+
type index$1_PutRecordBatchCommandConstructor = PutRecordBatchCommandConstructor;
|
|
127
|
+
type index$1_SendClient = SendClient;
|
|
50
128
|
declare namespace index$1 {
|
|
51
|
-
export type { Config$1 as Config, Destination$1 as Destination, Env$1 as Env, index$1_FirehoseConfig as FirehoseConfig, InitFn$1 as InitFn, InitSettings$1 as InitSettings, Mapping$1 as Mapping, PartialConfig$1 as PartialConfig, PushEvents$1 as PushEvents, PushFn$1 as PushFn, Rule$1 as Rule, Rules$1 as Rules,
|
|
129
|
+
export type { Config$1 as Config, index$1_CredentialSource as CredentialSource, Destination$1 as Destination, Env$1 as Env, index$1_FirehoseClientConstructor as FirehoseClientConstructor, index$1_FirehoseConfig as FirehoseConfig, InitFn$1 as InitFn, InitSettings$1 as InitSettings, Mapping$1 as Mapping, PartialConfig$1 as PartialConfig, index$1_PushBatchFn as PushBatchFn, PushEvents$1 as PushEvents, PushFn$1 as PushFn, index$1_PutRecordBatchCommandConstructor as PutRecordBatchCommandConstructor, Rule$1 as Rule, Rules$1 as Rules, Runtime$1 as Runtime, index$1_SendClient as SendClient, Settings$1 as Settings, Types$1 as Types };
|
|
52
130
|
}
|
|
53
131
|
|
|
54
|
-
declare const destinationFirehose: Destination$1;
|
|
55
|
-
|
|
56
132
|
/**
|
|
57
|
-
* The
|
|
58
|
-
*
|
|
59
|
-
* mock (tests, simulate) without a cast.
|
|
133
|
+
* The Firehose destination. Batching is on by default: a flushed batch goes
|
|
134
|
+
* out as `PutRecordBatch` calls of at most 500 records.
|
|
60
135
|
*/
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
136
|
+
declare const destinationFirehose: Destination$1;
|
|
137
|
+
|
|
64
138
|
/** An AWS SDK v3 command class, as far as this destination builds one. */
|
|
65
139
|
type CommandConstructor<Input> = new (input: Input) => {
|
|
66
140
|
readonly input: Input;
|
|
67
141
|
};
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
/** AWS region. Mirrors setup.region default ('eu-central-1'). */
|
|
74
|
-
region?: string;
|
|
75
|
-
/** SDK client config (credentials, etc.). Optional. */
|
|
76
|
-
config?: SNSClientConfig;
|
|
77
|
-
/** Topic ARN, populated at init() from CreateTopic. Operator may pre-set to skip init's CreateTopic call. */
|
|
78
|
-
topicArn?: string;
|
|
79
|
-
}
|
|
142
|
+
/**
|
|
143
|
+
* Settings as a user writes them. `topicArn` alone is enough: region and
|
|
144
|
+
* topic name derive from it. `topicName` (with `region`) also works, and the
|
|
145
|
+
* ARN is then completed with the account id at the first publish.
|
|
146
|
+
*/
|
|
80
147
|
interface InitSettings {
|
|
81
|
-
|
|
82
|
-
|
|
148
|
+
/** Topic ARN. Region and topic name derive from it. */
|
|
149
|
+
topicArn?: string;
|
|
150
|
+
/** Topic name (with `.fifo` for FIFO topics). Needed by `walkeros setup`. */
|
|
151
|
+
topicName?: string;
|
|
152
|
+
/** AWS region. Default: the ARN's region, `AWS_REGION` or the profile, else `eu-central-1`. */
|
|
83
153
|
region?: string;
|
|
154
|
+
/** Raw `SNSClient` options, passed through to the SDK. */
|
|
84
155
|
config?: SNSClientConfig;
|
|
156
|
+
/** A client of your own. Used as is and never closed by the destination. */
|
|
157
|
+
client?: SendClient;
|
|
158
|
+
/** Runtime-only, set by `init`: what the destination owns. Not user-facing. */
|
|
159
|
+
runtime?: Runtime;
|
|
160
|
+
}
|
|
161
|
+
/** What `init` resolved. */
|
|
162
|
+
interface Settings {
|
|
85
163
|
topicArn?: string;
|
|
164
|
+
topicName?: string;
|
|
165
|
+
region: string;
|
|
166
|
+
config?: SNSClientConfig;
|
|
167
|
+
client: SendClient;
|
|
168
|
+
runtime: Runtime;
|
|
169
|
+
}
|
|
170
|
+
/** Runtime-only state of one initialized instance. */
|
|
171
|
+
interface Runtime {
|
|
172
|
+
/**
|
|
173
|
+
* True when the destination built the client from nothing the user owns,
|
|
174
|
+
* and so closes it. A user client, or a user request handler instance in
|
|
175
|
+
* `settings.config`, keeps it false.
|
|
176
|
+
*/
|
|
177
|
+
ownsClient: boolean;
|
|
178
|
+
/** Publishes in flight, awaited by `destroy`. */
|
|
179
|
+
inflight: InFlight;
|
|
180
|
+
/** The topic ARN, completed once with the account id when only a name was given. */
|
|
181
|
+
topicArn: () => Promise<string>;
|
|
86
182
|
}
|
|
87
183
|
interface Mapping {
|
|
88
184
|
/**
|
|
@@ -98,18 +194,25 @@ interface Mapping {
|
|
|
98
194
|
* `messageGroupId: 'user.id'` (path) instead of hard-coding a literal.
|
|
99
195
|
*/
|
|
100
196
|
messageGroupId?: Mapping$2.Value;
|
|
101
|
-
/**
|
|
197
|
+
/**
|
|
198
|
+
* FIFO deduplication ID. `Mapping.Value`, same reasoning as
|
|
199
|
+
* `messageGroupId`. Defaults to the event id on FIFO topics.
|
|
200
|
+
*/
|
|
102
201
|
messageDeduplicationId?: Mapping$2.Value;
|
|
103
202
|
}
|
|
203
|
+
/**
|
|
204
|
+
* Optional SDK overrides. Each one present wins over the SDK the package
|
|
205
|
+
* imports; tests and simulate inject mocks here.
|
|
206
|
+
*/
|
|
104
207
|
interface Env extends DestinationServer.Env {
|
|
105
|
-
AWS
|
|
106
|
-
SNSClient
|
|
107
|
-
CreateTopicCommand
|
|
108
|
-
PublishCommand
|
|
109
|
-
GetTopicAttributesCommand
|
|
110
|
-
SubscribeCommand
|
|
111
|
-
STSClient
|
|
112
|
-
GetCallerIdentityCommand
|
|
208
|
+
AWS?: {
|
|
209
|
+
SNSClient?: new (config: SNSClientConfig) => SendClient;
|
|
210
|
+
CreateTopicCommand?: CommandConstructor<CreateTopicCommandInput>;
|
|
211
|
+
PublishCommand?: CommandConstructor<PublishCommandInput>;
|
|
212
|
+
GetTopicAttributesCommand?: CommandConstructor<GetTopicAttributesCommandInput>;
|
|
213
|
+
SubscribeCommand?: CommandConstructor<SubscribeCommandInput>;
|
|
214
|
+
STSClient?: new (config: STSClientConfig) => SendClient;
|
|
215
|
+
GetCallerIdentityCommand?: CommandConstructor<GetCallerIdentityCommandInput>;
|
|
113
216
|
};
|
|
114
217
|
}
|
|
115
218
|
/**
|
|
@@ -119,7 +222,7 @@ interface Env extends DestinationServer.Env {
|
|
|
119
222
|
* `topicName` lives in Settings (one source of truth for setup AND runtime publish).
|
|
120
223
|
*/
|
|
121
224
|
interface Setup {
|
|
122
|
-
/** AWS region for the topic. Default:
|
|
225
|
+
/** AWS region for the topic. Default: the runtime region order. */
|
|
123
226
|
region?: string;
|
|
124
227
|
/** Display name. Optional. */
|
|
125
228
|
displayName?: string;
|
|
@@ -139,20 +242,17 @@ interface SetupSubscription {
|
|
|
139
242
|
filterPolicy?: Record<string, unknown>;
|
|
140
243
|
deadLetterTargetArn?: string;
|
|
141
244
|
}
|
|
142
|
-
type Types = Destination$2.Types<Settings, Mapping, Env, InitSettings, Setup>;
|
|
245
|
+
type Types = Destination$2.Types<Settings, Mapping, Env, InitSettings, Setup, CredentialsInput>;
|
|
143
246
|
interface Destination extends DestinationServer.Destination<Types> {
|
|
144
247
|
init: DestinationServer.InitFn<Types>;
|
|
145
248
|
}
|
|
146
249
|
type Config = {
|
|
147
|
-
settings:
|
|
250
|
+
settings: InitSettings;
|
|
148
251
|
} & DestinationServer.Config<Types>;
|
|
149
252
|
type InitFn = DestinationServer.InitFn<Types>;
|
|
150
253
|
type PushFn = DestinationServer.PushFn<Types>;
|
|
151
254
|
type SetupFn = SetupFn$1<Config, Env>;
|
|
152
|
-
type PartialConfig =
|
|
153
|
-
settings?: Partial<Settings> | Settings;
|
|
154
|
-
setup?: boolean | Setup;
|
|
155
|
-
};
|
|
255
|
+
type PartialConfig = DestinationServer.PartialConfig<Types>;
|
|
156
256
|
type PushEvents = DestinationServer.PushEvents<Mapping>;
|
|
157
257
|
type Rule = Mapping$2.Rule<Mapping>;
|
|
158
258
|
type Rules = Mapping$2.Rules<Rule>;
|
|
@@ -169,6 +269,7 @@ type index_PushEvents = PushEvents;
|
|
|
169
269
|
type index_PushFn = PushFn;
|
|
170
270
|
type index_Rule = Rule;
|
|
171
271
|
type index_Rules = Rules;
|
|
272
|
+
type index_Runtime = Runtime;
|
|
172
273
|
type index_SendClient = SendClient;
|
|
173
274
|
type index_Settings = Settings;
|
|
174
275
|
type index_Setup = Setup;
|
|
@@ -176,7 +277,7 @@ type index_SetupFn = SetupFn;
|
|
|
176
277
|
type index_SetupSubscription = SetupSubscription;
|
|
177
278
|
type index_Types = Types;
|
|
178
279
|
declare namespace index {
|
|
179
|
-
export type { index_CommandConstructor as CommandConstructor, index_Config as Config, index_Destination as Destination, index_Env as Env, index_InitFn as InitFn, index_InitSettings as InitSettings, index_Mapping as Mapping, index_PartialConfig as PartialConfig, index_PushEvents as PushEvents, index_PushFn as PushFn, index_Rule as Rule, index_Rules as Rules, index_SendClient as SendClient, index_Settings as Settings, index_Setup as Setup, index_SetupFn as SetupFn, index_SetupSubscription as SetupSubscription, index_Types as Types };
|
|
280
|
+
export type { index_CommandConstructor as CommandConstructor, index_Config as Config, index_Destination as Destination, index_Env as Env, index_InitFn as InitFn, index_InitSettings as InitSettings, index_Mapping as Mapping, index_PartialConfig as PartialConfig, index_PushEvents as PushEvents, index_PushFn as PushFn, index_Rule as Rule, index_Rules as Rules, index_Runtime as Runtime, index_SendClient as SendClient, index_Settings as Settings, index_Setup as Setup, index_SetupFn as SetupFn, index_SetupSubscription as SetupSubscription, index_Types as Types };
|
|
180
281
|
}
|
|
181
282
|
|
|
182
283
|
declare const destinationSNS: Destination;
|