-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathaws_javascript.aws.txt
152 lines (124 loc) · 7.1 KB
/
aws_javascript.aws.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
┏━━━━━━━━━━━━━━━━━━━━┓
┃ AWS JAVASCRIPT ┃
┗━━━━━━━━━━━━━━━━━━━━┛
VERSION ==> #3.773.0
#For browsers/Node.js
SEE ALSO ==> #Doc for AWS general (and related)
#Doc for API, for request|response
┌────────────┐
│ CONFIG │
└────────────┘
COPTS.* #Most VAL can also be a FUNC()->[>]VAL
CLIENT.config #Normalized config OBJ. Not documented here
┌────────────────┐
│ MIDDLEWARE │
└────────────────┘
PLUGIN #Plugin manipulating MSTACK, e.g. adding MFUNCs
MSTACK #Series of MFUNCs
MFUNC #FUNC(NEXT, MCONTEXT)->FUNC2(NEXT)
#Perform FUNC2 before any ACTION
NEXT #FUNC(MINPUT)->>MOUTPUT
#Must be called within FUNC2
@aws-sdk/middleware-* #Most features of the SDK are implemented as MFUNCs enabled by default
COPTS.cacheMiddleware #BOOL (def: false). Memoize MSTACK per COMMAND
#I.e. cannot add|remove MFUNCs dynamically, but slightly faster
MSTACK.use(PLUGIN) #Add PLUGIN
PLUGIN.applyToStack(MSTACK) #Main function, calling MSTACK.*
CLIENT.middlewareStack #MSTACK
MSTACK.add(MFUNC[, MOPTS]) #Add MFUNC with position based on MOPTS.step
MSTACK.addRelativeTo
(MFUNC, MROPTS) #Add MFUNC with position based on another MFUNC2
MSTACK.remove(MFUNC|'MNAME')
->BOOL #
MSTACK.removeByTag('MTAG')
->BOOL #
MSTACK.identify()->'MNAME'_ARR #
MSTACK.concat(MSTACK2)
->MSTACK3 #
MSTACK.clone()->MSTACK2 #
MSTACK.resolve #Returns MSTACK as a single MFUNC2 of step 'initialize'
(MFUNC, MCONTEXT)->MFUNC2 #Must pass an additional MFUNC of step 'deserialize'
#MCONTEXT is used in MFUNCs
MINPUT.input #PARAMS. With step 'initialize'
MINPUT.request #MREQ. With step 'serialize|finalizeRequest'
MREQ.headers #OBJ. HTTP headers
MREQ.* #Other fields not documented yet
MOUTPUT.response #MRES. With step 'deserialize'
MRES.* #Other fields not documented yet
MOUTPUT.output #RESP. With step 'initialize|deserialize'
MOPTS.step #STR among:
# - 'initialize' (def): transforming PARAMS
# - 'serialize': validating PARAMS and serializing into HTTP request
# - 'build': transform HTTP request
# - 'finalizeRequest': final transformation of HTTP request that does not change semantics (e.g. signing)
# - 'deserialize': deserialize HTTP response into RESP
MOPTS.priority #'high', 'normal' (def) or 'low'. Priority with other MFUNCs of same MOPTS.step
MROPTS.relation #'before|after'
MROPTS.toMiddleware #'MNAME'
M[R]OPTS.name #'MNAME'. MFUNC name
M[R]OPTS.tags #'MTAG'_ARR. Arbitary description of MFUNC
M[R]OPTS.override #BOOL (def: false). Override existing MFUNC if already exists
MCONTEXT.* #Any custom property can be set
MCONTEXT.logger #LOGGER
MCONTEXT.userAgent #USER_AGENTS (see AWS network doc)
MCONTEXT.endpointV2 #ENDPOINT (see AWS endpoint doc)
MCONTEXT.currentAuthConfig #AUTH_CONFIG
AUTH_CONFIG.in #'header|query'. Where authorization is located
AUTH_CONFIG.name #STR. Header|query variable name
AUTH_CONFIG.scheme #STR
┌─────────────┐
│ MOCKING │
└─────────────┘
aws-sdk-client-mock #Version 4.1.0
aws-sdk-mock #Alternative, but v2 only
new AwsStub(CLIENT, STUB) #MCLIENT
#STUB is from Sinon (see doc)
mockClient
(SERVICEClient|CLIENT
[, OPTS])->MCLIENT #Same but using noop STUB
OPTS.sandbox #Sinon SANDBOX (def: none) used to create noop STUB
MCLIENT.send #STUB
MCLIENT.clientName #'SERVICEClient'
MCLIENT.restore|resetHistory
|reset() #STUB.restore|resetHistory|reset()
MCLIENT.calls()->SPYCALL_ARR #STUB.getCalls()
MCLIENT.call
(NUM|-NUM)->SPYCALL #STUB.getCall(...)
MCLIENT.commandCalls
(...)->SPYCALL_ARR #Same arguments as MCLIENT.on(...)
MCLIENT.commandCall
(NUM, ...)->SPYCALL_ARR #Same as MCLIENT.commandCalls(...).at(NUM)
MCLIENT|MSTUB.onAnyCommand #Filters by PARAMS (def: any)
([PARAMS[, BOOL]])->MSTUB #Unless BOOL true, partial match, and PARAMs can contain SINONMATCHs
MCLIENT|MSTUB.on
(ACTIONCommand[, ...])
->MSTUB #Like onAnyCommand([...]) but also filters by ACTION
MCLIENT|MSTUB
.resolves|rejects(VAL) #STUB.resolves|rejects(...)
MCLIENT|MSTUB.callsFake
(FUNC(PARAMS,
FUNC2()->MCLIENT)) #STUB.callsFake(FUNC)
MCLIENT|MSTUB
.resolvesOnce|rejectsOnce
|callsFakeOnce(...) #Same but using STUB.onCall(NUM), where NUM is initially 0, incremented at each call
aws-sdk-client-mock-jest #Jest assertions. Same version as aws-sdk-client-mock
#Import with side-effects, adding following.
expect(MCLIENT) #MEXPECT
MEXPECT
.toHaveReceivedAnyCommand() #At least 1 call used any ACTION
MEXPECT
.toHaveReceivedCommand
(ACTIONCommand) #At least 1 call used ACTION
MEXPECT
.toHaveReceivedCommandTimes
(ACTIONCommand, NUM) #NUM calls used ACTION
MEXPECT
.toHaveReceivedCommandWith #At least 1 call used ACTION with PARAMS
(ACTIONCommand, PARAMS) #Partial match, and PARAMS can use Jest deep matchers, e.g. { PROP: expect.any(TYPE) }
MEXPECT.toHaveReceived
NthCommandWith
(NUM, ACTIONCommand, PARAMS) #Call number NUM (from any ACTION) used ACTION with PARAMS
MEXPECT.toHaveReceived
NthSpecificCommandWith
(NUM, ACTIONCommand, PARAMS) #ACTION's call number NUM used PARAMS
aws-sdk-client-mock-jest/vitest #Same for Vitest assertions