gingersnap 0.22.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/_virtual/_tslib.cjs +102 -0
- package/_virtual/_tslib.mjs +93 -0
- package/data/AtomicValue.d.ts +15 -0
- package/data/bus.cjs +179 -0
- package/data/bus.d.ts +72 -0
- package/data/bus.mjs +177 -0
- package/data/decoders/index.d.ts +4 -0
- package/data/decoders/json.cjs +12 -0
- package/data/decoders/json.d.ts +7 -0
- package/data/decoders/json.mjs +10 -0
- package/data/decoders/msgpack.cjs +14 -0
- package/data/decoders/msgpack.d.ts +7 -0
- package/data/decoders/msgpack.mjs +12 -0
- package/data/decoders/protobuf.d.ts +13 -0
- package/data/decoders/string.cjs +12 -0
- package/data/decoders/string.d.ts +7 -0
- package/data/decoders/string.mjs +10 -0
- package/data/decoders/type.d.ts +7 -0
- package/data/decoders.cjs +11 -0
- package/data/decoders.mjs +3 -0
- package/data/model/credentials.cjs +114 -0
- package/data/model/credentials.d.ts +61 -0
- package/data/model/credentials.mjs +109 -0
- package/data/model/extra.cjs +88 -0
- package/data/model/extra.d.ts +5 -0
- package/data/model/extra.mjs +66 -0
- package/data/model/index.d.ts +6 -0
- package/data/model/model.cjs +541 -0
- package/data/model/model.d.ts +207 -0
- package/data/model/model.mjs +518 -0
- package/data/model/plugin.cjs +96 -0
- package/data/model/plugin.d.ts +38 -0
- package/data/model/plugin.mjs +72 -0
- package/data/model/property.cjs +310 -0
- package/data/model/property.d.ts +83 -0
- package/data/model/property.mjs +278 -0
- package/data/model/types.cjs +32 -0
- package/data/model/types.d.ts +28 -0
- package/data/model/types.mjs +32 -0
- package/data/model.cjs +43 -0
- package/data/model.mjs +6 -0
- package/data/signal.cjs +47 -0
- package/data/signal.d.ts +17 -0
- package/data/signal.mjs +45 -0
- package/data/store/index.d.ts +4 -0
- package/data/store/json.cjs +58 -0
- package/data/store/json.d.ts +18 -0
- package/data/store/json.mjs +56 -0
- package/data/store/manager.cjs +206 -0
- package/data/store/manager.d.ts +44 -0
- package/data/store/manager.mjs +203 -0
- package/data/store/web.cjs +92 -0
- package/data/store/web.d.ts +25 -0
- package/data/store/web.mjs +89 -0
- package/data/value.cjs +66 -0
- package/data/value.mjs +64 -0
- package/data-structures/array/CyclicalList.cjs +57 -0
- package/data-structures/array/CyclicalList.d.ts +12 -0
- package/data-structures/array/CyclicalList.mjs +55 -0
- package/data-structures/array/Pair.cjs +30 -0
- package/data-structures/array/Pair.d.ts +17 -0
- package/data-structures/array/Pair.mjs +27 -0
- package/data-structures/array/Stack.cjs +96 -0
- package/data-structures/array/Stack.d.ts +41 -0
- package/data-structures/array/Stack.mjs +94 -0
- package/data-structures/array/Triple.cjs +34 -0
- package/data-structures/array/Triple.d.ts +19 -0
- package/data-structures/array/Triple.mjs +31 -0
- package/data-structures/array/Tuple.d.ts +8 -0
- package/data-structures/array/index.d.ts +5 -0
- package/data-structures/array.cjs +15 -0
- package/data-structures/array.mjs +4 -0
- package/data-structures/object/BufferQueue.cjs +98 -0
- package/data-structures/object/BufferQueue.d.ts +21 -0
- package/data-structures/object/BufferQueue.mjs +77 -0
- package/data-structures/object/CyclicalObject.cjs +155 -0
- package/data-structures/object/CyclicalObject.d.ts +74 -0
- package/data-structures/object/CyclicalObject.mjs +134 -0
- package/data-structures/object/Queue.cjs +178 -0
- package/data-structures/object/Queue.d.ts +31 -0
- package/data-structures/object/Queue.mjs +176 -0
- package/data-structures/object/SimpleQueue.cjs +53 -0
- package/data-structures/object/SimpleQueue.d.ts +13 -0
- package/data-structures/object/SimpleQueue.mjs +51 -0
- package/data-structures/object/TimeableObject.cjs +73 -0
- package/data-structures/object/TimeableObject.d.ts +30 -0
- package/data-structures/object/TimeableObject.mjs +71 -0
- package/data-structures/object/WaitableObject.cjs +61 -0
- package/data-structures/object/WaitableObject.d.ts +29 -0
- package/data-structures/object/WaitableObject.mjs +59 -0
- package/data-structures/object/WatchableObject.cjs +251 -0
- package/data-structures/object/WatchableObject.d.ts +88 -0
- package/data-structures/object/WatchableObject.mjs +230 -0
- package/data-structures/object/index.d.ts +7 -0
- package/data-structures/object.cjs +23 -0
- package/data-structures/object.mjs +7 -0
- package/errors/AbortError.cjs +9 -0
- package/errors/AbortError.d.ts +5 -0
- package/errors/AbortError.mjs +7 -0
- package/errors/CallExecutionError.cjs +13 -0
- package/errors/CallExecutionError.d.ts +7 -0
- package/errors/CallExecutionError.mjs +11 -0
- package/errors/FutureCancelled.cjs +11 -0
- package/errors/FutureCancelled.d.ts +6 -0
- package/errors/FutureCancelled.mjs +9 -0
- package/errors/FutureError.cjs +11 -0
- package/errors/FutureError.d.ts +6 -0
- package/errors/FutureError.mjs +9 -0
- package/errors/IllegalArgumentsError.cjs +13 -0
- package/errors/IllegalArgumentsError.d.ts +7 -0
- package/errors/IllegalArgumentsError.mjs +11 -0
- package/errors/IllegalOperationError.cjs +6 -0
- package/errors/IllegalOperationError.d.ts +2 -0
- package/errors/IllegalOperationError.mjs +4 -0
- package/errors/InvalidType.cjs +6 -0
- package/errors/InvalidType.d.ts +2 -0
- package/errors/InvalidType.mjs +4 -0
- package/errors/InvalidValue.cjs +11 -0
- package/errors/InvalidValue.d.ts +4 -0
- package/errors/InvalidValue.mjs +9 -0
- package/errors/MissingArgumentsError.cjs +13 -0
- package/errors/MissingArgumentsError.d.ts +7 -0
- package/errors/MissingArgumentsError.mjs +11 -0
- package/errors/NetworkError.cjs +13 -0
- package/errors/NetworkError.d.ts +8 -0
- package/errors/NetworkError.mjs +11 -0
- package/errors/NoSuchElement.cjs +6 -0
- package/errors/NoSuchElement.d.ts +2 -0
- package/errors/NoSuchElement.mjs +4 -0
- package/errors/NotImplemented.cjs +9 -0
- package/errors/NotImplemented.d.ts +5 -0
- package/errors/NotImplemented.mjs +7 -0
- package/errors/ParsingError.cjs +10 -0
- package/errors/ParsingError.d.ts +5 -0
- package/errors/ParsingError.mjs +8 -0
- package/errors/QueueEmptyError.cjs +6 -0
- package/errors/QueueEmptyError.d.ts +2 -0
- package/errors/QueueEmptyError.mjs +4 -0
- package/errors/QueueFullError.cjs +6 -0
- package/errors/QueueFullError.d.ts +2 -0
- package/errors/QueueFullError.mjs +4 -0
- package/errors/StackEmptyError.cjs +6 -0
- package/errors/StackEmptyError.d.ts +2 -0
- package/errors/StackEmptyError.mjs +4 -0
- package/errors/StackFullError.cjs +6 -0
- package/errors/StackFullError.d.ts +2 -0
- package/errors/StackFullError.mjs +4 -0
- package/errors/StreamEnded.cjs +6 -0
- package/errors/StreamEnded.d.ts +2 -0
- package/errors/StreamEnded.mjs +4 -0
- package/errors/TimeoutError.cjs +11 -0
- package/errors/TimeoutError.d.ts +6 -0
- package/errors/TimeoutError.mjs +9 -0
- package/errors/ValueDestroyedError.cjs +6 -0
- package/errors/ValueDestroyedError.d.ts +2 -0
- package/errors/ValueDestroyedError.mjs +4 -0
- package/errors/VerificationError.cjs +9 -0
- package/errors/VerificationError.d.ts +5 -0
- package/errors/VerificationError.mjs +7 -0
- package/errors/index.d.ts +18 -0
- package/errors.cjs +41 -0
- package/errors.mjs +18 -0
- package/files.cjs +201 -0
- package/files.d.ts +31 -0
- package/files.mjs +180 -0
- package/functools/index.d.ts +31 -0
- package/functools.cjs +371 -0
- package/functools.mjs +334 -0
- package/future/future.cjs +570 -0
- package/future/future.d.ts +208 -0
- package/future/future.mjs +548 -0
- package/future/group.cjs +180 -0
- package/future/group.d.ts +82 -0
- package/future/group.mjs +159 -0
- package/future/index.d.ts +3 -0
- package/future/result.cjs +19 -0
- package/future/result.d.ts +18 -0
- package/future/result.mjs +17 -0
- package/future.cjs +11 -0
- package/future.mjs +3 -0
- package/managers/context.d.ts +8 -0
- package/managers/index.d.ts +1 -0
- package/managers.cjs +2 -0
- package/managers.mjs +1 -0
- package/mocks.cjs +301 -0
- package/mocks.d.ts +125 -0
- package/mocks.mjs +293 -0
- package/networking/EventSourceService.cjs +104 -0
- package/networking/EventSourceService.d.ts +11 -0
- package/networking/EventSourceService.mjs +83 -0
- package/networking/NetworkService.cjs +394 -0
- package/networking/NetworkService.d.ts +97 -0
- package/networking/NetworkService.mjs +373 -0
- package/networking/SocketService.cjs +218 -0
- package/networking/SocketService.d.ts +23 -0
- package/networking/SocketService.mjs +197 -0
- package/networking/decorators/index.d.ts +4 -0
- package/networking/decorators/options.cjs +289 -0
- package/networking/decorators/options.d.ts +148 -0
- package/networking/decorators/options.mjs +242 -0
- package/networking/decorators/requests.cjs +80 -0
- package/networking/decorators/requests.d.ts +34 -0
- package/networking/decorators/requests.mjs +52 -0
- package/networking/decorators/socket.cjs +81 -0
- package/networking/decorators/socket.d.ts +13 -0
- package/networking/decorators/socket.mjs +51 -0
- package/networking/http.cjs +69 -0
- package/networking/http.d.ts +66 -0
- package/networking/http.mjs +69 -0
- package/networking/index.d.ts +39 -0
- package/networking/request.cjs +18 -0
- package/networking/request.d.ts +9 -0
- package/networking/request.mjs +16 -0
- package/networking/types.cjs +37 -0
- package/networking/types.d.ts +132 -0
- package/networking/types.mjs +35 -0
- package/networking.cjs +91 -0
- package/networking.mjs +33 -0
- package/package.json +1 -0
- package/reflection/injector.cjs +43 -0
- package/reflection/injector.d.ts +3 -0
- package/reflection/injector.mjs +40 -0
- package/socket.cjs +239 -0
- package/socket.d.ts +65 -0
- package/socket.mjs +237 -0
- package/store.cjs +12 -0
- package/store.mjs +3 -0
- package/stream/call.cjs +157 -0
- package/stream/call.d.ts +66 -0
- package/stream/call.mjs +154 -0
- package/stream/collector.cjs +217 -0
- package/stream/collector.d.ts +14 -0
- package/stream/collector.mjs +215 -0
- package/stream/index.d.ts +257 -0
- package/stream/observable.cjs +110 -0
- package/stream/observable.d.ts +65 -0
- package/stream/observable.mjs +106 -0
- package/stream/state.cjs +10 -0
- package/stream/state.d.ts +5 -0
- package/stream/state.mjs +8 -0
- package/stream.cjs +1153 -0
- package/stream.mjs +1132 -0
- package/synchronize.cjs +106 -0
- package/synchronize.d.ts +54 -0
- package/synchronize.mjs +103 -0
- package/typing/types.d.ts +24 -0
- package/typing.cjs +2 -0
- package/typing.mjs +1 -0
- package/utils/parser.cjs +37 -0
- package/utils/parser.d.ts +7 -0
- package/utils/parser.mjs +16 -0
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { __rest, __awaiter } from '../_virtual/_tslib.mjs';
|
|
2
|
+
import { NetworkService } from './NetworkService.mjs';
|
|
3
|
+
import { StreamableWebSocket } from '../socket.mjs';
|
|
4
|
+
import * as R from 'ramda';
|
|
5
|
+
import { CallExecutionError } from '../errors/CallExecutionError.mjs';
|
|
6
|
+
import { ParsingError } from '../errors/ParsingError.mjs';
|
|
7
|
+
import { Stream } from '../stream.mjs';
|
|
8
|
+
import { Future } from '../future/future.mjs';
|
|
9
|
+
import { FutureResult } from '../future/result.mjs';
|
|
10
|
+
import { JSONDecoder } from '../data/decoders/json.mjs';
|
|
11
|
+
import '@msgpack/msgpack';
|
|
12
|
+
import { Model } from '../data/model/model.mjs';
|
|
13
|
+
import '../data/model/types.mjs';
|
|
14
|
+
import '../data/model/credentials.mjs';
|
|
15
|
+
|
|
16
|
+
class WebSocketService extends NetworkService {
|
|
17
|
+
constructor(_a = {}) {
|
|
18
|
+
var { decoder } = _a, other = __rest(_a, ["decoder"]);
|
|
19
|
+
super(other !== null && other !== void 0 ? other : {});
|
|
20
|
+
const internals = this.__internal__;
|
|
21
|
+
this.socket = new StreamableWebSocket(this.baseUrl, decoder !== null && decoder !== void 0 ? decoder : (internals.classConfig.Decoder ? new internals.classConfig.Decoder() : new JSONDecoder()));
|
|
22
|
+
}
|
|
23
|
+
get connected() {
|
|
24
|
+
return this.socket.opened;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Called when socket connection is closed
|
|
28
|
+
* @protected
|
|
29
|
+
*/
|
|
30
|
+
onceConnectionClosed() { }
|
|
31
|
+
/**
|
|
32
|
+
* Shutdown the socket connection
|
|
33
|
+
*/
|
|
34
|
+
shutdown() {
|
|
35
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
this.socket.close();
|
|
37
|
+
this.onceConnectionClosed();
|
|
38
|
+
yield this.socket.closedFuture();
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Awaits socket closed
|
|
43
|
+
*/
|
|
44
|
+
closedFuture() {
|
|
45
|
+
return this.socket.closedFuture();
|
|
46
|
+
}
|
|
47
|
+
ready() {
|
|
48
|
+
return Future.shield(this.socket.open());
|
|
49
|
+
}
|
|
50
|
+
__setup__() {
|
|
51
|
+
const internals = this.__internal__;
|
|
52
|
+
if (this.socket.decoder.load) {
|
|
53
|
+
this.socket.decoder.load();
|
|
54
|
+
}
|
|
55
|
+
const socketMethods = R.filter(([_, v]) => { var _a, _b; return ((_b = (_a = v.socketReadStream) !== null && _a !== void 0 ? _a : v.socketWriteStream) !== null && _b !== void 0 ? _b : v.socketRequestReply) !== undefined; }, R.toPairs(internals.methodConfig));
|
|
56
|
+
R.forEach(([key, config]) => {
|
|
57
|
+
var _a;
|
|
58
|
+
const oldMethod = this[key];
|
|
59
|
+
const details = (_a = internals.methodConfig[key]) === null || _a === void 0 ? void 0 : _a.socketReadStream;
|
|
60
|
+
let dataComparator = (v) => false;
|
|
61
|
+
if (config.socketReadStream) {
|
|
62
|
+
if (!details)
|
|
63
|
+
throw new ParsingError([], "ReadStreamDetailsMissing");
|
|
64
|
+
if (!config.responseClass)
|
|
65
|
+
throw new ParsingError([], "ResponseTypeMissing");
|
|
66
|
+
let equalsChecker;
|
|
67
|
+
switch (typeof details.value) {
|
|
68
|
+
case "boolean":
|
|
69
|
+
equalsChecker = R.equals(Boolean(details.value));
|
|
70
|
+
break;
|
|
71
|
+
case "string":
|
|
72
|
+
equalsChecker = R.equals(String(details.value));
|
|
73
|
+
break;
|
|
74
|
+
case "number":
|
|
75
|
+
equalsChecker = R.equals(Number(details.value));
|
|
76
|
+
break;
|
|
77
|
+
default:
|
|
78
|
+
if (details.value instanceof RegExp)
|
|
79
|
+
equalsChecker = details.value.test;
|
|
80
|
+
else
|
|
81
|
+
equalsChecker = R.equals(details.value);
|
|
82
|
+
}
|
|
83
|
+
dataComparator = R.compose((v) => equalsChecker(v), R.view(typeof details.keyPath === "string" ? R.lensProp(details.keyPath) : R.lensPath(details.keyPath)));
|
|
84
|
+
}
|
|
85
|
+
// TODO add caching for websockets
|
|
86
|
+
// const cacheInfo = config.cache;
|
|
87
|
+
// let cache: Cache<string, ArrayBuffer> | undefined;
|
|
88
|
+
//
|
|
89
|
+
// if (cacheInfo) {
|
|
90
|
+
// cache = this.cacheManager.createCache(
|
|
91
|
+
// this.baseUrl,
|
|
92
|
+
// cacheInfo.persist,
|
|
93
|
+
// async (buffer) => JSON.stringify(new Uint8Array(buffer)),
|
|
94
|
+
// (v) => Uint8Array.of(JSON.parse(v)).buffer,
|
|
95
|
+
// undefined,
|
|
96
|
+
// cacheInfo.duration
|
|
97
|
+
// );
|
|
98
|
+
// }
|
|
99
|
+
this[key] = (body) => {
|
|
100
|
+
var _a, _b;
|
|
101
|
+
if (config.socketRequestReply) {
|
|
102
|
+
const guid = config.socketRequestReply.guidGen();
|
|
103
|
+
const lens = R.lensPath(config.socketRequestReply.guidPath);
|
|
104
|
+
return Stream.seed(() => Future.of(() => __awaiter(this, void 0, void 0, function* () {
|
|
105
|
+
if (!this.socket.opened) {
|
|
106
|
+
yield this.socket.open();
|
|
107
|
+
}
|
|
108
|
+
let data = body;
|
|
109
|
+
if (body instanceof Model) {
|
|
110
|
+
data = body.object();
|
|
111
|
+
}
|
|
112
|
+
data = R.set(lens, guid, data);
|
|
113
|
+
yield this.socket.send(JSON.stringify(data));
|
|
114
|
+
return 1;
|
|
115
|
+
})))
|
|
116
|
+
.map(() => this.socket.streamView(R.compose(R.equals(guid), R.view(lens)), config.socketRequestReply.objectMaxSize, config.socketRequestReply.expiryPeriod))
|
|
117
|
+
.map((data) => {
|
|
118
|
+
if (config.responseClass.prototype instanceof Model) {
|
|
119
|
+
const ModelClass = config.responseClass;
|
|
120
|
+
return ModelClass.fromJSON(data);
|
|
121
|
+
}
|
|
122
|
+
return config.responseClass(data);
|
|
123
|
+
})
|
|
124
|
+
.flatten()
|
|
125
|
+
.map((v) => __awaiter(this, void 0, void 0, function* () {
|
|
126
|
+
let result = oldMethod(v);
|
|
127
|
+
if (result === null || result === undefined)
|
|
128
|
+
return v;
|
|
129
|
+
if (result instanceof Promise)
|
|
130
|
+
result = yield result;
|
|
131
|
+
if (result instanceof FutureResult)
|
|
132
|
+
result = result.value;
|
|
133
|
+
return result;
|
|
134
|
+
}));
|
|
135
|
+
}
|
|
136
|
+
else if (config.socketWriteStream) {
|
|
137
|
+
if (body === undefined || body === null)
|
|
138
|
+
throw new CallExecutionError("Empty body detected for a write stream");
|
|
139
|
+
return new Stream((signal) => __awaiter(this, void 0, void 0, function* () {
|
|
140
|
+
if (!this.socket.opened) {
|
|
141
|
+
yield this.socket.open();
|
|
142
|
+
}
|
|
143
|
+
if (body instanceof Model) {
|
|
144
|
+
yield this.socket.send(body.blob());
|
|
145
|
+
}
|
|
146
|
+
else if (body instanceof ArrayBuffer || body instanceof Blob) {
|
|
147
|
+
yield this.socket.send(body);
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
yield this.socket.send(JSON.stringify(body));
|
|
151
|
+
}
|
|
152
|
+
const result = oldMethod();
|
|
153
|
+
if (result instanceof Promise) {
|
|
154
|
+
yield result;
|
|
155
|
+
}
|
|
156
|
+
return null;
|
|
157
|
+
})).once();
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
let stream = this.socket.streamView(dataComparator);
|
|
161
|
+
if (((_a = config.socketReadStream) === null || _a === void 0 ? void 0 : _a.skip) !== undefined)
|
|
162
|
+
stream = stream.skip(config.socketReadStream.skip);
|
|
163
|
+
if (((_b = config.socketReadStream) === null || _b === void 0 ? void 0 : _b.take) !== undefined)
|
|
164
|
+
stream = stream.take(config.socketReadStream.take);
|
|
165
|
+
return stream
|
|
166
|
+
.map((data) => {
|
|
167
|
+
if (config.responseClass.prototype instanceof Model) {
|
|
168
|
+
const ModelClass = config.responseClass;
|
|
169
|
+
return ModelClass.fromJSON(data);
|
|
170
|
+
}
|
|
171
|
+
return config.responseClass(data);
|
|
172
|
+
})
|
|
173
|
+
.flatten()
|
|
174
|
+
.map((v) => __awaiter(this, void 0, void 0, function* () {
|
|
175
|
+
let result = oldMethod(v);
|
|
176
|
+
if (result === null || result === undefined)
|
|
177
|
+
return v;
|
|
178
|
+
if (result instanceof Promise)
|
|
179
|
+
result = yield result;
|
|
180
|
+
if (result instanceof FutureResult)
|
|
181
|
+
result = result.value;
|
|
182
|
+
return result;
|
|
183
|
+
}));
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
}, socketMethods);
|
|
187
|
+
if (!this.socket.opened) {
|
|
188
|
+
void this.socket.open();
|
|
189
|
+
}
|
|
190
|
+
const originalMethodConfig = internals.methodConfig;
|
|
191
|
+
internals.methodConfig = R.fromPairs(R.filter(([_, v]) => !(v.socketReadStream && v.socketWriteStream), R.toPairs(internals.methodConfig)));
|
|
192
|
+
super.__setup__();
|
|
193
|
+
internals.methodConfig = originalMethodConfig;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export { WebSocketService };
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var types = require('../types.cjs');
|
|
4
|
+
var R = require('ramda');
|
|
5
|
+
require('reflect-metadata');
|
|
6
|
+
|
|
7
|
+
function _interopNamespaceDefault(e) {
|
|
8
|
+
var n = Object.create(null);
|
|
9
|
+
if (e) {
|
|
10
|
+
Object.keys(e).forEach(function (k) {
|
|
11
|
+
if (k !== 'default') {
|
|
12
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
13
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () { return e[k]; }
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
n.default = e;
|
|
21
|
+
return Object.freeze(n);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
var R__namespace = /*#__PURE__*/_interopNamespaceDefault(R);
|
|
25
|
+
|
|
26
|
+
/// //// Constants ///////
|
|
27
|
+
const THROTTLE_DEFAULT_MS = 3000;
|
|
28
|
+
const SUPPORTED_HEADER_VALUES = ["String", "Number", "Boolean"];
|
|
29
|
+
/// // // Helpers ///////
|
|
30
|
+
const createProps = (constructor) => {
|
|
31
|
+
const proto = constructor.prototype;
|
|
32
|
+
if (proto.__internal__ === undefined) {
|
|
33
|
+
proto.__internal__ = { classConfig: {}, methodConfig: {} };
|
|
34
|
+
}
|
|
35
|
+
return proto;
|
|
36
|
+
};
|
|
37
|
+
const createResponseDecorator = (type) => ({ modelType, format, isArray, modelTypeMapping, modelTypeKeyPath } = {
|
|
38
|
+
modelType: String,
|
|
39
|
+
isArray: false,
|
|
40
|
+
}) => (target, propertyKey) => {
|
|
41
|
+
const proto = createProps(target.constructor);
|
|
42
|
+
const lens = R__namespace.lensPath(["methodConfig", propertyKey, "responseType"]);
|
|
43
|
+
const formatLens = R__namespace.lensPath(["methodConfig", propertyKey, "dataFormat"]);
|
|
44
|
+
const typeLens = R__namespace.lensPath(["methodConfig", propertyKey, "responseClass"]);
|
|
45
|
+
const isArrayLens = R__namespace.lensPath(["methodConfig", propertyKey, "responseArray"]);
|
|
46
|
+
proto.__internal__ = R__namespace.set(lens, type, proto.__internal__);
|
|
47
|
+
proto.__internal__ = R__namespace.set(typeLens, modelType, proto.__internal__);
|
|
48
|
+
proto.__internal__ = R__namespace.set(isArrayLens, isArray, proto.__internal__);
|
|
49
|
+
proto.__internal__ = R__namespace.set(formatLens, format, proto.__internal__);
|
|
50
|
+
};
|
|
51
|
+
const createRequestBodyDecorator = (type) => (target, propertyKey, parameterIndex) => {
|
|
52
|
+
const proto = createProps(target.constructor);
|
|
53
|
+
const lens = R__namespace.lensPath(["methodConfig", propertyKey, "parameters", "body"]);
|
|
54
|
+
proto.__internal__ = R__namespace.set(lens, { type, parameterIndex }, proto.__internal__);
|
|
55
|
+
};
|
|
56
|
+
const createRequestMultiBodyDecorator = (type) => (target, propertyKey) => {
|
|
57
|
+
const proto = createProps(target.constructor);
|
|
58
|
+
const lens = R__namespace.lensPath(["methodConfig", propertyKey, "parameters", "body"]);
|
|
59
|
+
const changer = R__namespace.compose(R__namespace.mergeDeepLeft({ type }), R__namespace.or(R__namespace.__, {}));
|
|
60
|
+
proto.__internal__ = R__namespace.over(lens, changer, proto.__internal__);
|
|
61
|
+
};
|
|
62
|
+
const createRequestMultiBodyParameterDecorator = (key) => (value) => (target, propertyKey, parameterIndex) => {
|
|
63
|
+
const proto = createProps(target.constructor);
|
|
64
|
+
const lens = R__namespace.lensPath(["methodConfig", propertyKey, "parameters", "body", key]);
|
|
65
|
+
const changer = R__namespace.compose(R__namespace.mergeDeepLeft({ [value]: parameterIndex }), R__namespace.or(R__namespace.__, {}));
|
|
66
|
+
proto.__internal__ = R__namespace.over(lens, changer, proto.__internal__);
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Sets the host for the Snap Service
|
|
70
|
+
* @param value host
|
|
71
|
+
* @constructor
|
|
72
|
+
*/
|
|
73
|
+
const BaseUrl = (value) => (constructor) => {
|
|
74
|
+
const proto = createProps(constructor);
|
|
75
|
+
proto.__internal__.classConfig.baseUrl = value;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Marks the SnapService method as on that returns a JSON Response of a specific Model type
|
|
79
|
+
*/
|
|
80
|
+
const JSONResponse = createResponseDecorator(types.ResponseType.JSON);
|
|
81
|
+
/**
|
|
82
|
+
* Marks the SnapService method as on that returns a XML Response of a specific Model type
|
|
83
|
+
*/
|
|
84
|
+
const XMLResponse = createResponseDecorator(types.ResponseType.XML);
|
|
85
|
+
/**
|
|
86
|
+
* Marks the SnapService method as on that returns a String Response
|
|
87
|
+
*/
|
|
88
|
+
const StringResponse = createResponseDecorator(types.ResponseType.STRING)({ modelType: String });
|
|
89
|
+
/**
|
|
90
|
+
* Marks the SnapService method as on that returns a Blob
|
|
91
|
+
*/
|
|
92
|
+
const BinaryResponse = createResponseDecorator(types.ResponseType.BINARY)({ modelType: Blob });
|
|
93
|
+
/**
|
|
94
|
+
* Marks the SnapService method as on that has no return value
|
|
95
|
+
*/
|
|
96
|
+
const NoResponse = createResponseDecorator(types.ResponseType.NONE)();
|
|
97
|
+
/**
|
|
98
|
+
* Marks the SnapService method that it should use multipart/form-data when submitting the request
|
|
99
|
+
*/
|
|
100
|
+
const Multipart = createRequestMultiBodyDecorator(types.BodyType.MULTIPART);
|
|
101
|
+
/**
|
|
102
|
+
* Marks the SnapService method that it should use application/x-www-form-urlencoded when submitting the request
|
|
103
|
+
*/
|
|
104
|
+
const FormUrlEncoded = createRequestMultiBodyDecorator(types.BodyType.FORMURLENCODED);
|
|
105
|
+
/**
|
|
106
|
+
* Sets the headers for the request
|
|
107
|
+
* @param value MapOfHeaders
|
|
108
|
+
* @constructor
|
|
109
|
+
*/
|
|
110
|
+
const Headers = (value) => (target, propertyKey) => {
|
|
111
|
+
const proto = createProps(target.constructor);
|
|
112
|
+
const lens = R__namespace.lensPath(["methodConfig", propertyKey, "headers"]);
|
|
113
|
+
const changer = R__namespace.compose(R__namespace.mergeDeepLeft(value), R__namespace.or(R__namespace.__, {}));
|
|
114
|
+
proto.__internal__ = R__namespace.over(lens, changer, proto.__internal__);
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* Throttles the request by 3 seconds
|
|
118
|
+
* @param target
|
|
119
|
+
* @param propertyKey
|
|
120
|
+
* @constructor
|
|
121
|
+
*/
|
|
122
|
+
const Throttle = (target, propertyKey) => {
|
|
123
|
+
const proto = createProps(target.constructor);
|
|
124
|
+
const lens = R__namespace.lensPath(["methodConfig", propertyKey, "throttle"]);
|
|
125
|
+
proto.__internal__ = R__namespace.set(lens, { waitPeriodInMs: THROTTLE_DEFAULT_MS }, proto.__internal__);
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* Throttles the request by the value provided
|
|
129
|
+
* @param value ThrottleByProps - An object that contains the waitPeriodInMs
|
|
130
|
+
* @constructor
|
|
131
|
+
*/
|
|
132
|
+
const ThrottleBy = (value) => (target, propertyKey) => {
|
|
133
|
+
const proto = createProps(target.constructor);
|
|
134
|
+
const lens = R__namespace.lensPath(["methodConfig", propertyKey, "throttle"]);
|
|
135
|
+
proto.__internal__ = R__namespace.set(lens, value, proto.__internal__);
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* Marks this method as an authenticator. When requests receive 401 status code, this method will be called to retrieve
|
|
139
|
+
* the credentials
|
|
140
|
+
* @param type Credentials - Type of credentials that this authenticator should return
|
|
141
|
+
* (BasicCredentials | BearerCredentials | APIKeyCredentials | define one of your own by subclassing Credentials)
|
|
142
|
+
* @param global Whether this authenticator should be used across all services
|
|
143
|
+
* @param socketField
|
|
144
|
+
* @constructor
|
|
145
|
+
*/
|
|
146
|
+
const Authenticator = (type, global = false, socketField = "accessToken") => (target, propertyKey) => {
|
|
147
|
+
const proto = createProps(target.constructor);
|
|
148
|
+
const lens = R__namespace.lensPath(["methodConfig", propertyKey, "authenticator"]);
|
|
149
|
+
proto.__internal__ = R__namespace.over(lens, (v) => (Object.assign(Object.assign({}, (v !== null && v !== void 0 ? v : {})), { type, global })), proto.__internal__);
|
|
150
|
+
};
|
|
151
|
+
/**
|
|
152
|
+
* Marks this method as an auth refresher. Whenever a request receives a 401 status code for invalid credentials, this
|
|
153
|
+
* method will be called with the old Credentials, and should produce new credentials
|
|
154
|
+
* @param type Credentials - Type of credentials that this authenticator should return
|
|
155
|
+
* (BasicCredentials | BearerCredentials | APIKeyCredentials | define one of your own by subclassing Credentials)
|
|
156
|
+
* @param global Whether this auth refresher should be used across all services
|
|
157
|
+
* @constructor
|
|
158
|
+
*/
|
|
159
|
+
const AuthRefresher = (type, global = false) => (target, propertyKey) => {
|
|
160
|
+
const proto = createProps(target.constructor);
|
|
161
|
+
const lens = R__namespace.lensPath(["methodConfig", propertyKey, "authRefresher"]);
|
|
162
|
+
proto.__internal__ = R__namespace.over(lens, (v) => (Object.assign(Object.assign({}, (v !== null && v !== void 0 ? v : {})), { type, global })), proto.__internal__);
|
|
163
|
+
};
|
|
164
|
+
/**
|
|
165
|
+
* Marks argument as a property in the MultiPart form
|
|
166
|
+
*/
|
|
167
|
+
const Part = createRequestMultiBodyParameterDecorator("parts");
|
|
168
|
+
/**
|
|
169
|
+
* Marks argument as a property in the FormUrlEncoded form or a JSON payload
|
|
170
|
+
*/
|
|
171
|
+
const Field = createRequestMultiBodyParameterDecorator("fields");
|
|
172
|
+
/**
|
|
173
|
+
* Marks argument as a property in the FormUrlEncoded form or JSON payload, but it can be missing
|
|
174
|
+
*/
|
|
175
|
+
const OptionalField = createRequestMultiBodyParameterDecorator("OptionalFields");
|
|
176
|
+
/**
|
|
177
|
+
* Marks argument that should be deserialized to a JSON string and attached as the body of the request
|
|
178
|
+
*/
|
|
179
|
+
const JSONBody = createRequestBodyDecorator(types.BodyType.JSON);
|
|
180
|
+
/**
|
|
181
|
+
* Marks argument that should be deserialized to XML string and attached as the body of the request
|
|
182
|
+
*/
|
|
183
|
+
const XMLBody = createRequestBodyDecorator(types.BodyType.XML);
|
|
184
|
+
/**
|
|
185
|
+
* Marks argument that should be the body of the request, and is a string
|
|
186
|
+
*/
|
|
187
|
+
const StringBody = createRequestBodyDecorator(types.BodyType.STRING);
|
|
188
|
+
/**
|
|
189
|
+
* Marks argument that should contain a Map of the queries used in the request. Argument should be an object with each
|
|
190
|
+
* key value pair being the query name and value
|
|
191
|
+
* @constructor
|
|
192
|
+
*/
|
|
193
|
+
const QueryMap = (target, propertyKey, parameterIndex) => {
|
|
194
|
+
const proto = createProps(target.constructor);
|
|
195
|
+
const lens = R__namespace.lensPath(["methodConfig", propertyKey, "parameters", "queries"]);
|
|
196
|
+
proto.__internal__ = R__namespace.over(lens, R__namespace.compose(R__namespace.mergeLeft({ [Symbol(propertyKey)]: parameterIndex }, R__namespace.__), R__namespace.or(R__namespace.__, {})), proto.__internal__);
|
|
197
|
+
};
|
|
198
|
+
/**
|
|
199
|
+
* Marks argument as a path variable in the request url
|
|
200
|
+
* @param value Name of the path variable
|
|
201
|
+
* @constructor
|
|
202
|
+
*/
|
|
203
|
+
const Path = (value) => {
|
|
204
|
+
return (target, propertyKey, parameterIndex) => {
|
|
205
|
+
const type = R__namespace.path([parameterIndex, "name"], Reflect.getMetadata("design:paramtypes", target, propertyKey));
|
|
206
|
+
if (!["String", "Number"].includes(type)) {
|
|
207
|
+
throw Error("Invalid type given for @Query. Should be of type string or number");
|
|
208
|
+
}
|
|
209
|
+
const proto = createProps(target.constructor);
|
|
210
|
+
const lens = R__namespace.lensPath(["methodConfig", propertyKey, "parameters", "pathVariables"]);
|
|
211
|
+
proto.__internal__ = R__namespace.over(lens, R__namespace.compose(R__namespace.mergeDeepWith(R__namespace.concat, { [value]: parameterIndex }), R__namespace.or(R__namespace.__, {})), proto.__internal__);
|
|
212
|
+
};
|
|
213
|
+
};
|
|
214
|
+
/**
|
|
215
|
+
* Marks argument as a query to be attached to the request url
|
|
216
|
+
* @param value Name of the query
|
|
217
|
+
* @constructor
|
|
218
|
+
*/
|
|
219
|
+
const Query = (value) => {
|
|
220
|
+
return (target, propertyKey, parameterIndex) => {
|
|
221
|
+
const proto = createProps(target.constructor);
|
|
222
|
+
const lens = R__namespace.lensPath(["methodConfig", propertyKey, "parameters", "queries"]);
|
|
223
|
+
proto.__internal__ = R__namespace.over(lens, R__namespace.compose(R__namespace.mergeDeepWith(R__namespace.concat, { [value]: parameterIndex }), R__namespace.or(R__namespace.__, {})), proto.__internal__);
|
|
224
|
+
};
|
|
225
|
+
};
|
|
226
|
+
/**
|
|
227
|
+
* Marks argument as a header to be attached to the request
|
|
228
|
+
* @param value Name of the header
|
|
229
|
+
* @constructor
|
|
230
|
+
*/
|
|
231
|
+
const Header = (value) => {
|
|
232
|
+
return (target, propertyKey, parameterIndex) => {
|
|
233
|
+
const type = R__namespace.path([parameterIndex, "name"], Reflect.getMetadata("design:paramtypes", target, propertyKey));
|
|
234
|
+
if (!SUPPORTED_HEADER_VALUES.includes(type)) {
|
|
235
|
+
throw Error("Invalid type given for @HeaderMap. Should be of type string, number or boolean");
|
|
236
|
+
}
|
|
237
|
+
const proto = createProps(target.constructor);
|
|
238
|
+
const lens = R__namespace.lensPath(["methodConfig", propertyKey, "parameters", "headers"]);
|
|
239
|
+
proto.__internal__ = R__namespace.over(lens, R__namespace.compose(R__namespace.mergeDeepWith(R__namespace.concat, { [value]: parameterIndex }), R__namespace.or(R__namespace.__, {})), proto.__internal__);
|
|
240
|
+
};
|
|
241
|
+
};
|
|
242
|
+
/**
|
|
243
|
+
* Marks argument that should contain a Map of the headers used in the request. Argument should be an object with each
|
|
244
|
+
* key value pair being the header name and value
|
|
245
|
+
* @constructor
|
|
246
|
+
*/
|
|
247
|
+
const HeaderMap = (target, propertyKey, parameterIndex) => {
|
|
248
|
+
const proto = createProps(target.constructor);
|
|
249
|
+
const lens = R__namespace.lensPath(["methodConfig", propertyKey, "parameters", "headers"]);
|
|
250
|
+
const key = Symbol(propertyKey);
|
|
251
|
+
proto.__internal__ = R__namespace.over(lens, R__namespace.compose(R__namespace.mergeLeft({ [key]: parameterIndex }, R__namespace.__), R__namespace.or(R__namespace.__, {})), proto.__internal__);
|
|
252
|
+
};
|
|
253
|
+
/**
|
|
254
|
+
* Disables any authenticator that should be applied to this method
|
|
255
|
+
* @constructor
|
|
256
|
+
*/
|
|
257
|
+
const NoAuth = (target, propertyKey) => {
|
|
258
|
+
const proto = createProps(target.constructor);
|
|
259
|
+
const lens = R__namespace.lensPath(["methodConfig", propertyKey]);
|
|
260
|
+
proto.__internal__ = R__namespace.set(lens, (v) => (Object.assign(Object.assign({}, (v !== null && v !== void 0 ? v : {})), { noAuth: true })), proto.__internal__);
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
exports.AuthRefresher = AuthRefresher;
|
|
264
|
+
exports.Authenticator = Authenticator;
|
|
265
|
+
exports.BaseUrl = BaseUrl;
|
|
266
|
+
exports.BinaryResponse = BinaryResponse;
|
|
267
|
+
exports.Field = Field;
|
|
268
|
+
exports.FormUrlEncoded = FormUrlEncoded;
|
|
269
|
+
exports.Header = Header;
|
|
270
|
+
exports.HeaderMap = HeaderMap;
|
|
271
|
+
exports.Headers = Headers;
|
|
272
|
+
exports.JSONBody = JSONBody;
|
|
273
|
+
exports.JSONResponse = JSONResponse;
|
|
274
|
+
exports.Multipart = Multipart;
|
|
275
|
+
exports.NoAuth = NoAuth;
|
|
276
|
+
exports.NoResponse = NoResponse;
|
|
277
|
+
exports.OptionalField = OptionalField;
|
|
278
|
+
exports.Part = Part;
|
|
279
|
+
exports.Path = Path;
|
|
280
|
+
exports.Query = Query;
|
|
281
|
+
exports.QueryMap = QueryMap;
|
|
282
|
+
exports.StringBody = StringBody;
|
|
283
|
+
exports.StringResponse = StringResponse;
|
|
284
|
+
exports.THROTTLE_DEFAULT_MS = THROTTLE_DEFAULT_MS;
|
|
285
|
+
exports.Throttle = Throttle;
|
|
286
|
+
exports.ThrottleBy = ThrottleBy;
|
|
287
|
+
exports.XMLBody = XMLBody;
|
|
288
|
+
exports.XMLResponse = XMLResponse;
|
|
289
|
+
exports.createProps = createProps;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { MapOfHeaders, ServiceInternalProps, ThrottleByProps } from "../types";
|
|
2
|
+
import "reflect-metadata";
|
|
3
|
+
import { DataFormat } from "../../data/model";
|
|
4
|
+
interface ResponseDetails {
|
|
5
|
+
modelType?: any;
|
|
6
|
+
modelTypeMapping?: {
|
|
7
|
+
[string: string]: any;
|
|
8
|
+
};
|
|
9
|
+
modelTypeKeyPath?: string | Array<string | number>;
|
|
10
|
+
isArray?: boolean;
|
|
11
|
+
format?: DataFormat;
|
|
12
|
+
}
|
|
13
|
+
export declare const THROTTLE_DEFAULT_MS = 3000;
|
|
14
|
+
export declare const createProps: (constructor: any) => {
|
|
15
|
+
__internal__: ServiceInternalProps;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Sets the host for the Snap Service
|
|
19
|
+
* @param value host
|
|
20
|
+
* @constructor
|
|
21
|
+
*/
|
|
22
|
+
export declare const BaseUrl: (value: string) => (constructor: any) => void;
|
|
23
|
+
/**
|
|
24
|
+
* Marks the SnapService method as on that returns a JSON Response of a specific Model type
|
|
25
|
+
*/
|
|
26
|
+
export declare const JSONResponse: ({ modelType, format, isArray, modelTypeMapping, modelTypeKeyPath }?: ResponseDetails) => (target: any, propertyKey: string) => void;
|
|
27
|
+
/**
|
|
28
|
+
* Marks the SnapService method as on that returns a XML Response of a specific Model type
|
|
29
|
+
*/
|
|
30
|
+
export declare const XMLResponse: ({ modelType, format, isArray, modelTypeMapping, modelTypeKeyPath }?: ResponseDetails) => (target: any, propertyKey: string) => void;
|
|
31
|
+
/**
|
|
32
|
+
* Marks the SnapService method as on that returns a String Response
|
|
33
|
+
*/
|
|
34
|
+
export declare const StringResponse: (target: any, propertyKey: string) => void;
|
|
35
|
+
/**
|
|
36
|
+
* Marks the SnapService method as on that returns a Blob
|
|
37
|
+
*/
|
|
38
|
+
export declare const BinaryResponse: (target: any, propertyKey: string) => void;
|
|
39
|
+
/**
|
|
40
|
+
* Marks the SnapService method as on that has no return value
|
|
41
|
+
*/
|
|
42
|
+
export declare const NoResponse: (target: any, propertyKey: string) => void;
|
|
43
|
+
/**
|
|
44
|
+
* Marks the SnapService method that it should use multipart/form-data when submitting the request
|
|
45
|
+
*/
|
|
46
|
+
export declare const Multipart: (target: any, propertyKey: string) => void;
|
|
47
|
+
/**
|
|
48
|
+
* Marks the SnapService method that it should use application/x-www-form-urlencoded when submitting the request
|
|
49
|
+
*/
|
|
50
|
+
export declare const FormUrlEncoded: (target: any, propertyKey: string) => void;
|
|
51
|
+
/**
|
|
52
|
+
* Sets the headers for the request
|
|
53
|
+
* @param value MapOfHeaders
|
|
54
|
+
* @constructor
|
|
55
|
+
*/
|
|
56
|
+
export declare const Headers: (value: MapOfHeaders) => (target: any, propertyKey: string) => void;
|
|
57
|
+
/**
|
|
58
|
+
* Throttles the request by 3 seconds
|
|
59
|
+
* @param target
|
|
60
|
+
* @param propertyKey
|
|
61
|
+
* @constructor
|
|
62
|
+
*/
|
|
63
|
+
export declare const Throttle: (target: any, propertyKey: string) => void;
|
|
64
|
+
/**
|
|
65
|
+
* Throttles the request by the value provided
|
|
66
|
+
* @param value ThrottleByProps - An object that contains the waitPeriodInMs
|
|
67
|
+
* @constructor
|
|
68
|
+
*/
|
|
69
|
+
export declare const ThrottleBy: (value: ThrottleByProps) => (target: any, propertyKey: string) => void;
|
|
70
|
+
/**
|
|
71
|
+
* Marks this method as an authenticator. When requests receive 401 status code, this method will be called to retrieve
|
|
72
|
+
* the credentials
|
|
73
|
+
* @param type Credentials - Type of credentials that this authenticator should return
|
|
74
|
+
* (BasicCredentials | BearerCredentials | APIKeyCredentials | define one of your own by subclassing Credentials)
|
|
75
|
+
* @param global Whether this authenticator should be used across all services
|
|
76
|
+
* @param socketField
|
|
77
|
+
* @constructor
|
|
78
|
+
*/
|
|
79
|
+
export declare const Authenticator: <T>(type: T, global?: boolean, socketField?: string) => (target: any, propertyKey: string) => void;
|
|
80
|
+
/**
|
|
81
|
+
* Marks this method as an auth refresher. Whenever a request receives a 401 status code for invalid credentials, this
|
|
82
|
+
* method will be called with the old Credentials, and should produce new credentials
|
|
83
|
+
* @param type Credentials - Type of credentials that this authenticator should return
|
|
84
|
+
* (BasicCredentials | BearerCredentials | APIKeyCredentials | define one of your own by subclassing Credentials)
|
|
85
|
+
* @param global Whether this auth refresher should be used across all services
|
|
86
|
+
* @constructor
|
|
87
|
+
*/
|
|
88
|
+
export declare const AuthRefresher: <T>(type: T, global?: boolean) => (target: any, propertyKey: string) => void;
|
|
89
|
+
/**
|
|
90
|
+
* Marks argument as a property in the MultiPart form
|
|
91
|
+
*/
|
|
92
|
+
export declare const Part: (value: string) => (target: any, propertyKey: string, parameterIndex: number) => void;
|
|
93
|
+
/**
|
|
94
|
+
* Marks argument as a property in the FormUrlEncoded form or a JSON payload
|
|
95
|
+
*/
|
|
96
|
+
export declare const Field: (value: string) => (target: any, propertyKey: string, parameterIndex: number) => void;
|
|
97
|
+
/**
|
|
98
|
+
* Marks argument as a property in the FormUrlEncoded form or JSON payload, but it can be missing
|
|
99
|
+
*/
|
|
100
|
+
export declare const OptionalField: (value: string) => (target: any, propertyKey: string, parameterIndex: number) => void;
|
|
101
|
+
/**
|
|
102
|
+
* Marks argument that should be deserialized to a JSON string and attached as the body of the request
|
|
103
|
+
*/
|
|
104
|
+
export declare const JSONBody: (target: any, propertyKey: string, parameterIndex: number) => void;
|
|
105
|
+
/**
|
|
106
|
+
* Marks argument that should be deserialized to XML string and attached as the body of the request
|
|
107
|
+
*/
|
|
108
|
+
export declare const XMLBody: (target: any, propertyKey: string, parameterIndex: number) => void;
|
|
109
|
+
/**
|
|
110
|
+
* Marks argument that should be the body of the request, and is a string
|
|
111
|
+
*/
|
|
112
|
+
export declare const StringBody: (target: any, propertyKey: string, parameterIndex: number) => void;
|
|
113
|
+
/**
|
|
114
|
+
* Marks argument that should contain a Map of the queries used in the request. Argument should be an object with each
|
|
115
|
+
* key value pair being the query name and value
|
|
116
|
+
* @constructor
|
|
117
|
+
*/
|
|
118
|
+
export declare const QueryMap: (target: any, propertyKey: string, parameterIndex: number) => void;
|
|
119
|
+
/**
|
|
120
|
+
* Marks argument as a path variable in the request url
|
|
121
|
+
* @param value Name of the path variable
|
|
122
|
+
* @constructor
|
|
123
|
+
*/
|
|
124
|
+
export declare const Path: (value: string) => (target: any, propertyKey: string, parameterIndex: number) => void;
|
|
125
|
+
/**
|
|
126
|
+
* Marks argument as a query to be attached to the request url
|
|
127
|
+
* @param value Name of the query
|
|
128
|
+
* @constructor
|
|
129
|
+
*/
|
|
130
|
+
export declare const Query: (value: string) => (target: any, propertyKey: string, parameterIndex: number) => void;
|
|
131
|
+
/**
|
|
132
|
+
* Marks argument as a header to be attached to the request
|
|
133
|
+
* @param value Name of the header
|
|
134
|
+
* @constructor
|
|
135
|
+
*/
|
|
136
|
+
export declare const Header: (value: string) => (target: any, propertyKey: string, parameterIndex: number) => void;
|
|
137
|
+
/**
|
|
138
|
+
* Marks argument that should contain a Map of the headers used in the request. Argument should be an object with each
|
|
139
|
+
* key value pair being the header name and value
|
|
140
|
+
* @constructor
|
|
141
|
+
*/
|
|
142
|
+
export declare const HeaderMap: (target: any, propertyKey: string, parameterIndex: number) => void;
|
|
143
|
+
/**
|
|
144
|
+
* Disables any authenticator that should be applied to this method
|
|
145
|
+
* @constructor
|
|
146
|
+
*/
|
|
147
|
+
export declare const NoAuth: (target: any, propertyKey: string) => void;
|
|
148
|
+
export {};
|