1 | (() => {
|
2 | "use strict";
|
3 | var __webpack_modules__ = ({
|
4 |
|
5 | "./src/InvocationContext.ts":
|
6 |
|
7 |
|
8 |
|
9 | (function(__unused_webpack_module, exports) {
|
10 |
|
11 |
|
12 |
|
13 |
|
14 | var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
15 | if (kind === "m") throw new TypeError("Private method is not writable");
|
16 | if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
17 | if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
18 | return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
19 | };
|
20 | var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
21 | if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
22 | if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
23 | return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
24 | };
|
25 | var _InvocationContext_userLogHandler, _InvocationContextExtraInputs_inputs, _InvocationContextExtraOutputs_outputs;
|
26 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
27 | exports.InvocationContext = void 0;
|
28 | class InvocationContext {
|
29 | constructor(init) {
|
30 | var _a, _b, _c, _d;
|
31 | _InvocationContext_userLogHandler.set(this, void 0);
|
32 | init = init || {};
|
33 | const fallbackString = 'unknown';
|
34 | this.invocationId = init.invocationId || fallbackString;
|
35 | this.functionName = init.functionName || fallbackString;
|
36 | this.extraInputs = new InvocationContextExtraInputs();
|
37 | this.extraOutputs = new InvocationContextExtraOutputs();
|
38 | this.retryContext = init.retryContext;
|
39 | this.traceContext = init.traceContext;
|
40 | this.triggerMetadata = init.triggerMetadata;
|
41 | this.options = {
|
42 | trigger: ((_a = init.options) === null || _a === void 0 ? void 0 : _a.trigger) || {
|
43 | name: fallbackString,
|
44 | type: fallbackString,
|
45 | },
|
46 | return: (_b = init.options) === null || _b === void 0 ? void 0 : _b.return,
|
47 | extraInputs: ((_c = init.options) === null || _c === void 0 ? void 0 : _c.extraInputs) || [],
|
48 | extraOutputs: ((_d = init.options) === null || _d === void 0 ? void 0 : _d.extraOutputs) || [],
|
49 | };
|
50 | __classPrivateFieldSet(this, _InvocationContext_userLogHandler, init.logHandler || fallbackLogHandler, "f");
|
51 | }
|
52 | log(...args) {
|
53 | __classPrivateFieldGet(this, _InvocationContext_userLogHandler, "f").call(this, 'information', ...args);
|
54 | }
|
55 | trace(...args) {
|
56 | __classPrivateFieldGet(this, _InvocationContext_userLogHandler, "f").call(this, 'trace', ...args);
|
57 | }
|
58 | debug(...args) {
|
59 | __classPrivateFieldGet(this, _InvocationContext_userLogHandler, "f").call(this, 'debug', ...args);
|
60 | }
|
61 | info(...args) {
|
62 | __classPrivateFieldGet(this, _InvocationContext_userLogHandler, "f").call(this, 'information', ...args);
|
63 | }
|
64 | warn(...args) {
|
65 | __classPrivateFieldGet(this, _InvocationContext_userLogHandler, "f").call(this, 'warning', ...args);
|
66 | }
|
67 | error(...args) {
|
68 | __classPrivateFieldGet(this, _InvocationContext_userLogHandler, "f").call(this, 'error', ...args);
|
69 | }
|
70 | }
|
71 | exports.InvocationContext = InvocationContext;
|
72 | _InvocationContext_userLogHandler = new WeakMap();
|
73 | class InvocationContextExtraInputs {
|
74 | constructor() {
|
75 | _InvocationContextExtraInputs_inputs.set(this, {});
|
76 | }
|
77 | get(inputOrName) {
|
78 | const name = typeof inputOrName === 'string' ? inputOrName : inputOrName.name;
|
79 | return __classPrivateFieldGet(this, _InvocationContextExtraInputs_inputs, "f")[name];
|
80 | }
|
81 | set(inputOrName, value) {
|
82 | const name = typeof inputOrName === 'string' ? inputOrName : inputOrName.name;
|
83 | __classPrivateFieldGet(this, _InvocationContextExtraInputs_inputs, "f")[name] = value;
|
84 | }
|
85 | }
|
86 | _InvocationContextExtraInputs_inputs = new WeakMap();
|
87 | class InvocationContextExtraOutputs {
|
88 | constructor() {
|
89 | _InvocationContextExtraOutputs_outputs.set(this, {});
|
90 | }
|
91 | get(outputOrName) {
|
92 | const name = typeof outputOrName === 'string' ? outputOrName : outputOrName.name;
|
93 | return __classPrivateFieldGet(this, _InvocationContextExtraOutputs_outputs, "f")[name];
|
94 | }
|
95 | set(outputOrName, value) {
|
96 | const name = typeof outputOrName === 'string' ? outputOrName : outputOrName.name;
|
97 | __classPrivateFieldGet(this, _InvocationContextExtraOutputs_outputs, "f")[name] = value;
|
98 | }
|
99 | }
|
100 | _InvocationContextExtraOutputs_outputs = new WeakMap();
|
101 | function fallbackLogHandler(level, ...args) {
|
102 | switch (level) {
|
103 | case 'trace':
|
104 | console.trace(...args);
|
105 | break;
|
106 | case 'debug':
|
107 | console.debug(...args);
|
108 | break;
|
109 | case 'information':
|
110 | console.info(...args);
|
111 | break;
|
112 | case 'warning':
|
113 | console.warn(...args);
|
114 | break;
|
115 | case 'critical':
|
116 | case 'error':
|
117 | console.error(...args);
|
118 | break;
|
119 | default:
|
120 | console.log(...args);
|
121 | }
|
122 | }
|
123 |
|
124 |
|
125 | }),
|
126 |
|
127 | "./src/InvocationModel.ts":
|
128 |
|
129 |
|
130 |
|
131 | (function(__unused_webpack_module, exports, __webpack_require__) {
|
132 |
|
133 |
|
134 |
|
135 |
|
136 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
137 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
138 | return new (P || (P = Promise))(function (resolve, reject) {
|
139 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
140 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
141 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
142 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
143 | });
|
144 | };
|
145 | var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
146 | if (kind === "m") throw new TypeError("Private method is not writable");
|
147 | if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
148 | if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
149 | return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
150 | };
|
151 | var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
152 | if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
153 | if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
154 | return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
155 | };
|
156 | var _InvocationModel_instances, _InvocationModel_isDone, _InvocationModel_coreCtx, _InvocationModel_functionName, _InvocationModel_bindings, _InvocationModel_triggerType, _InvocationModel_convertOutput, _InvocationModel_log, _InvocationModel_systemLog, _InvocationModel_userLog;
|
157 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
158 | exports.InvocationModel = void 0;
|
159 | const util_1 = __webpack_require__( "util");
|
160 | const constants_1 = __webpack_require__( "./src/constants.ts");
|
161 | const fromRpcBindings_1 = __webpack_require__( "./src/converters/fromRpcBindings.ts");
|
162 | const fromRpcContext_1 = __webpack_require__( "./src/converters/fromRpcContext.ts");
|
163 | const fromRpcTriggerMetadata_1 = __webpack_require__( "./src/converters/fromRpcTriggerMetadata.ts");
|
164 | const fromRpcTypedData_1 = __webpack_require__( "./src/converters/fromRpcTypedData.ts");
|
165 | const toCamelCase_1 = __webpack_require__( "./src/converters/toCamelCase.ts");
|
166 | const toRpcHttp_1 = __webpack_require__( "./src/converters/toRpcHttp.ts");
|
167 | const toRpcTypedData_1 = __webpack_require__( "./src/converters/toRpcTypedData.ts");
|
168 | const InvocationContext_1 = __webpack_require__( "./src/InvocationContext.ts");
|
169 | const isTrigger_1 = __webpack_require__( "./src/utils/isTrigger.ts");
|
170 | const nonNull_1 = __webpack_require__( "./src/utils/nonNull.ts");
|
171 | class InvocationModel {
|
172 | constructor(coreCtx) {
|
173 | _InvocationModel_instances.add(this);
|
174 | _InvocationModel_isDone.set(this, false);
|
175 | _InvocationModel_coreCtx.set(this, void 0);
|
176 | _InvocationModel_functionName.set(this, void 0);
|
177 | _InvocationModel_bindings.set(this, void 0);
|
178 | _InvocationModel_triggerType.set(this, void 0);
|
179 | __classPrivateFieldSet(this, _InvocationModel_coreCtx, coreCtx, "f");
|
180 | __classPrivateFieldSet(this, _InvocationModel_functionName, (0, nonNull_1.nonNullProp)(coreCtx.metadata, 'name'), "f");
|
181 | __classPrivateFieldSet(this, _InvocationModel_bindings, (0, nonNull_1.nonNullProp)(coreCtx.metadata, 'bindings'), "f");
|
182 | const triggerBinding = (0, nonNull_1.nonNullValue)(Object.values(__classPrivateFieldGet(this, _InvocationModel_bindings, "f")).find((b) => (0, isTrigger_1.isTrigger)(b.type)), 'triggerBinding');
|
183 | __classPrivateFieldSet(this, _InvocationModel_triggerType, (0, nonNull_1.nonNullProp)(triggerBinding, 'type'), "f");
|
184 | }
|
185 |
|
186 | getArguments() {
|
187 | return __awaiter(this, void 0, void 0, function* () {
|
188 | const req = __classPrivateFieldGet(this, _InvocationModel_coreCtx, "f").request;
|
189 | const context = new InvocationContext_1.InvocationContext({
|
190 | invocationId: (0, nonNull_1.nonNullProp)(__classPrivateFieldGet(this, _InvocationModel_coreCtx, "f"), 'invocationId'),
|
191 | functionName: __classPrivateFieldGet(this, _InvocationModel_functionName, "f"),
|
192 | logHandler: (level, ...args) => __classPrivateFieldGet(this, _InvocationModel_instances, "m", _InvocationModel_userLog).call(this, level, ...args),
|
193 | retryContext: (0, fromRpcContext_1.fromRpcRetryContext)(req.retryContext),
|
194 | traceContext: (0, fromRpcContext_1.fromRpcTraceContext)(req.traceContext),
|
195 | triggerMetadata: (0, fromRpcTriggerMetadata_1.fromRpcTriggerMetadata)(req.triggerMetadata, __classPrivateFieldGet(this, _InvocationModel_triggerType, "f")),
|
196 | options: (0, fromRpcBindings_1.fromRpcBindings)(__classPrivateFieldGet(this, _InvocationModel_bindings, "f")),
|
197 | });
|
198 | const inputs = [];
|
199 | if (req.inputData) {
|
200 | for (const binding of req.inputData) {
|
201 | const bindingName = (0, nonNull_1.nonNullProp)(binding, 'name');
|
202 | let input = (0, fromRpcTypedData_1.fromRpcTypedData)(binding.data);
|
203 | const bindingType = __classPrivateFieldGet(this, _InvocationModel_bindings, "f")[bindingName].type;
|
204 | if ((0, isTrigger_1.isTimerTrigger)(bindingType)) {
|
205 | input = (0, toCamelCase_1.toCamelCaseValue)(input);
|
206 | }
|
207 | if ((0, isTrigger_1.isTrigger)(bindingType)) {
|
208 | inputs.push(input);
|
209 | }
|
210 | else {
|
211 | context.extraInputs.set(bindingName, input);
|
212 | }
|
213 | }
|
214 | }
|
215 | return { context, inputs };
|
216 | });
|
217 | }
|
218 | invokeFunction(context, inputs, handler) {
|
219 | return __awaiter(this, void 0, void 0, function* () {
|
220 | try {
|
221 | return yield Promise.resolve(handler(...inputs, context));
|
222 | }
|
223 | finally {
|
224 | __classPrivateFieldSet(this, _InvocationModel_isDone, true, "f");
|
225 | }
|
226 | });
|
227 | }
|
228 | getResponse(context, result) {
|
229 | return __awaiter(this, void 0, void 0, function* () {
|
230 | const response = { invocationId: __classPrivateFieldGet(this, _InvocationModel_coreCtx, "f").invocationId };
|
231 | response.outputData = [];
|
232 | let usedReturnValue = false;
|
233 | for (const [name, binding] of Object.entries(__classPrivateFieldGet(this, _InvocationModel_bindings, "f"))) {
|
234 | if (binding.direction === 'out') {
|
235 | if (name === constants_1.returnBindingKey) {
|
236 | response.returnValue = yield __classPrivateFieldGet(this, _InvocationModel_instances, "m", _InvocationModel_convertOutput).call(this, binding, result);
|
237 | usedReturnValue = true;
|
238 | }
|
239 | else {
|
240 | const outputValue = yield __classPrivateFieldGet(this, _InvocationModel_instances, "m", _InvocationModel_convertOutput).call(this, binding, context.extraOutputs.get(name));
|
241 | if ((0, nonNull_1.isDefined)(outputValue)) {
|
242 | response.outputData.push({ name, data: outputValue });
|
243 | }
|
244 | }
|
245 | }
|
246 | }
|
247 |
|
248 |
|
249 |
|
250 |
|
251 | if (!usedReturnValue && !(0, isTrigger_1.isHttpTrigger)(__classPrivateFieldGet(this, _InvocationModel_triggerType, "f"))) {
|
252 | response.returnValue = (0, toRpcTypedData_1.toRpcTypedData)(result);
|
253 | }
|
254 | return response;
|
255 | });
|
256 | }
|
257 | }
|
258 | exports.InvocationModel = InvocationModel;
|
259 | _InvocationModel_isDone = new WeakMap(), _InvocationModel_coreCtx = new WeakMap(), _InvocationModel_functionName = new WeakMap(), _InvocationModel_bindings = new WeakMap(), _InvocationModel_triggerType = new WeakMap(), _InvocationModel_instances = new WeakSet(), _InvocationModel_convertOutput = function _InvocationModel_convertOutput(binding, value) {
|
260 | var _a;
|
261 | return __awaiter(this, void 0, void 0, function* () {
|
262 | if (((_a = binding.type) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'http') {
|
263 | return (0, toRpcHttp_1.toRpcHttp)(value);
|
264 | }
|
265 | else {
|
266 | return (0, toRpcTypedData_1.toRpcTypedData)(value);
|
267 | }
|
268 | });
|
269 | }, _InvocationModel_log = function _InvocationModel_log(level, logCategory, ...args) {
|
270 | __classPrivateFieldGet(this, _InvocationModel_coreCtx, "f").log(level, logCategory, (0, util_1.format)(...args));
|
271 | }, _InvocationModel_systemLog = function _InvocationModel_systemLog(level, ...args) {
|
272 | __classPrivateFieldGet(this, _InvocationModel_instances, "m", _InvocationModel_log).call(this, level, 'system', ...args);
|
273 | }, _InvocationModel_userLog = function _InvocationModel_userLog(level, ...args) {
|
274 | if (__classPrivateFieldGet(this, _InvocationModel_isDone, "f") && __classPrivateFieldGet(this, _InvocationModel_coreCtx, "f").state !== 'postInvocationHooks') {
|
275 | let badAsyncMsg = "Warning: Unexpected call to 'log' on the context object after function execution has completed. Please check for asynchronous calls that are not awaited. ";
|
276 | badAsyncMsg += `Function name: ${__classPrivateFieldGet(this, _InvocationModel_functionName, "f")}. Invocation Id: ${__classPrivateFieldGet(this, _InvocationModel_coreCtx, "f").invocationId}.`;
|
277 | __classPrivateFieldGet(this, _InvocationModel_instances, "m", _InvocationModel_systemLog).call(this, 'warning', badAsyncMsg);
|
278 | }
|
279 | __classPrivateFieldGet(this, _InvocationModel_instances, "m", _InvocationModel_log).call(this, level, 'user', ...args);
|
280 | };
|
281 |
|
282 |
|
283 | }),
|
284 |
|
285 | "./src/addBindingName.ts":
|
286 |
|
287 |
|
288 |
|
289 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
290 |
|
291 |
|
292 |
|
293 |
|
294 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
295 | exports.addBindingName = exports.InvocationContext = exports.HttpResponse = exports.HttpRequest = void 0;
|
296 | var HttpRequest_1 = __webpack_require__( "./src/http/HttpRequest.ts");
|
297 | Object.defineProperty(exports, "HttpRequest", ({ enumerable: true, get: function () { return HttpRequest_1.HttpRequest; } }));
|
298 | var HttpResponse_1 = __webpack_require__( "./src/http/HttpResponse.ts");
|
299 | Object.defineProperty(exports, "HttpResponse", ({ enumerable: true, get: function () { return HttpResponse_1.HttpResponse; } }));
|
300 | var InvocationContext_1 = __webpack_require__( "./src/InvocationContext.ts");
|
301 | Object.defineProperty(exports, "InvocationContext", ({ enumerable: true, get: function () { return InvocationContext_1.InvocationContext; } }));
|
302 | const bindingCounts = {};
|
303 |
|
304 |
|
305 |
|
306 |
|
307 |
|
308 |
|
309 |
|
310 |
|
311 | function addBindingName(binding, suffix) {
|
312 | if (!binding.name) {
|
313 | let bindingType = binding.type;
|
314 | if (!bindingType.toLowerCase().endsWith(suffix.toLowerCase())) {
|
315 | bindingType += suffix;
|
316 | }
|
317 | let count = bindingCounts[bindingType] || 0;
|
318 | count += 1;
|
319 | bindingCounts[bindingType] = count;
|
320 | binding.name = bindingType + count.toString();
|
321 | }
|
322 | return binding;
|
323 | }
|
324 | exports.addBindingName = addBindingName;
|
325 |
|
326 |
|
327 | }),
|
328 |
|
329 | "./src/app.ts":
|
330 |
|
331 |
|
332 |
|
333 | (function(__unused_webpack_module, exports, __webpack_require__) {
|
334 |
|
335 |
|
336 |
|
337 |
|
338 | var __rest = (this && this.__rest) || function (s, e) {
|
339 | var t = {};
|
340 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
341 | t[p] = s[p];
|
342 | if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
343 | for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
344 | if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
345 | t[p[i]] = s[p[i]];
|
346 | }
|
347 | return t;
|
348 | };
|
349 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
350 | exports.generic = exports.warmup = exports.cosmosDB = exports.eventGrid = exports.eventHub = exports.serviceBusTopic = exports.serviceBusQueue = exports.storageQueue = exports.storageBlob = exports.timer = exports.http = exports.deleteRequest = exports.patch = exports.post = exports.put = exports.get = exports.hook = void 0;
|
351 | const constants_1 = __webpack_require__( "./src/constants.ts");
|
352 | const toRpcDuration_1 = __webpack_require__( "./src/converters/toRpcDuration.ts");
|
353 | const InvocationModel_1 = __webpack_require__( "./src/InvocationModel.ts");
|
354 | const output = __webpack_require__( "./src/output.ts");
|
355 | const trigger = __webpack_require__( "./src/trigger.ts");
|
356 | const isTrigger_1 = __webpack_require__( "./src/utils/isTrigger.ts");
|
357 | const tryGetCoreApiLazy_1 = __webpack_require__( "./src/utils/tryGetCoreApiLazy.ts");
|
358 | exports.hook = __webpack_require__( "./src/hooks/registerHook.ts");
|
359 | class ProgrammingModel {
|
360 | constructor() {
|
361 | this.name = '@azure/functions';
|
362 | this.version = constants_1.version;
|
363 | }
|
364 | getInvocationModel(coreCtx) {
|
365 | return new InvocationModel_1.InvocationModel(coreCtx);
|
366 | }
|
367 | }
|
368 | let hasSetup = false;
|
369 | function setup() {
|
370 | const coreApi = (0, tryGetCoreApiLazy_1.tryGetCoreApiLazy)();
|
371 | if (!coreApi) {
|
372 | console.warn('WARNING: Failed to detect the Azure Functions runtime. Switching "@azure/functions" package to test mode - not all features are supported.');
|
373 | }
|
374 | else {
|
375 | coreApi.setProgrammingModel(new ProgrammingModel());
|
376 | }
|
377 | hasSetup = true;
|
378 | }
|
379 | function convertToHttpOptions(optionsOrHandler, method) {
|
380 | const options = typeof optionsOrHandler === 'function' ? { handler: optionsOrHandler } : optionsOrHandler;
|
381 | options.methods = [method];
|
382 | return options;
|
383 | }
|
384 | function convertToGenericOptions(options, triggerMethod) {
|
385 | const { handler, return: ret, trigger, extraInputs, extraOutputs } = options, triggerOptions = __rest(options, ["handler", "return", "trigger", "extraInputs", "extraOutputs"]);
|
386 | return {
|
387 | trigger: trigger !== null && trigger !== void 0 ? trigger : triggerMethod(triggerOptions),
|
388 | return: ret,
|
389 | extraInputs,
|
390 | extraOutputs,
|
391 | handler,
|
392 | };
|
393 | }
|
394 | function get(name, optionsOrHandler) {
|
395 | http(name, convertToHttpOptions(optionsOrHandler, 'GET'));
|
396 | }
|
397 | exports.get = get;
|
398 | function put(name, optionsOrHandler) {
|
399 | http(name, convertToHttpOptions(optionsOrHandler, 'PUT'));
|
400 | }
|
401 | exports.put = put;
|
402 | function post(name, optionsOrHandler) {
|
403 | http(name, convertToHttpOptions(optionsOrHandler, 'POST'));
|
404 | }
|
405 | exports.post = post;
|
406 | function patch(name, optionsOrHandler) {
|
407 | http(name, convertToHttpOptions(optionsOrHandler, 'PATCH'));
|
408 | }
|
409 | exports.patch = patch;
|
410 | function deleteRequest(name, optionsOrHandler) {
|
411 | http(name, convertToHttpOptions(optionsOrHandler, 'DELETE'));
|
412 | }
|
413 | exports.deleteRequest = deleteRequest;
|
414 | function http(name, options) {
|
415 | options.return || (options.return = output.http({}));
|
416 | generic(name, convertToGenericOptions(options, trigger.http));
|
417 | }
|
418 | exports.http = http;
|
419 | function timer(name, options) {
|
420 | generic(name, convertToGenericOptions(options, trigger.timer));
|
421 | }
|
422 | exports.timer = timer;
|
423 | function storageBlob(name, options) {
|
424 | generic(name, convertToGenericOptions(options, trigger.storageBlob));
|
425 | }
|
426 | exports.storageBlob = storageBlob;
|
427 | function storageQueue(name, options) {
|
428 | generic(name, convertToGenericOptions(options, trigger.storageQueue));
|
429 | }
|
430 | exports.storageQueue = storageQueue;
|
431 | function serviceBusQueue(name, options) {
|
432 | generic(name, convertToGenericOptions(options, trigger.serviceBusQueue));
|
433 | }
|
434 | exports.serviceBusQueue = serviceBusQueue;
|
435 | function serviceBusTopic(name, options) {
|
436 | generic(name, convertToGenericOptions(options, trigger.serviceBusTopic));
|
437 | }
|
438 | exports.serviceBusTopic = serviceBusTopic;
|
439 | function eventHub(name, options) {
|
440 | generic(name, convertToGenericOptions(options, trigger.eventHub));
|
441 | }
|
442 | exports.eventHub = eventHub;
|
443 | function eventGrid(name, options) {
|
444 | generic(name, convertToGenericOptions(options, trigger.eventGrid));
|
445 | }
|
446 | exports.eventGrid = eventGrid;
|
447 | function cosmosDB(name, options) {
|
448 |
|
449 | generic(name, convertToGenericOptions(options, trigger.cosmosDB));
|
450 | }
|
451 | exports.cosmosDB = cosmosDB;
|
452 | function warmup(name, options) {
|
453 | generic(name, convertToGenericOptions(options, trigger.warmup));
|
454 | }
|
455 | exports.warmup = warmup;
|
456 | function generic(name, options) {
|
457 | if (!hasSetup) {
|
458 | setup();
|
459 | }
|
460 | const bindings = {};
|
461 | const trigger = options.trigger;
|
462 | bindings[trigger.name] = Object.assign(Object.assign({}, trigger), { direction: 'in', type: (0, isTrigger_1.isTrigger)(trigger.type) ? trigger.type : trigger.type + 'Trigger' });
|
463 | if (options.extraInputs) {
|
464 | for (const input of options.extraInputs) {
|
465 | bindings[input.name] = Object.assign(Object.assign({}, input), { direction: 'in' });
|
466 | }
|
467 | }
|
468 | if (options.return) {
|
469 | bindings[constants_1.returnBindingKey] = Object.assign(Object.assign({}, options.return), { direction: 'out' });
|
470 | }
|
471 | if (options.extraOutputs) {
|
472 | for (const output of options.extraOutputs) {
|
473 | bindings[output.name] = Object.assign(Object.assign({}, output), { direction: 'out' });
|
474 | }
|
475 | }
|
476 | let retryOptions;
|
477 | if (options.retry) {
|
478 | retryOptions = Object.assign(Object.assign({}, options.retry), { retryStrategy: options.retry.strategy, delayInterval: (0, toRpcDuration_1.toRpcDuration)(options.retry.delayInterval, 'retry.delayInterval'), maximumInterval: (0, toRpcDuration_1.toRpcDuration)(options.retry.maximumInterval, 'retry.maximumInterval'), minimumInterval: (0, toRpcDuration_1.toRpcDuration)(options.retry.minimumInterval, 'retry.minimumInterval') });
|
479 | }
|
480 | const coreApi = (0, tryGetCoreApiLazy_1.tryGetCoreApiLazy)();
|
481 | if (!coreApi) {
|
482 | console.warn(`WARNING: Skipping call to register function "${name}" because the "@azure/functions" package is in test mode.`);
|
483 | }
|
484 | else {
|
485 | coreApi.registerFunction({ name, bindings, retryOptions }, options.handler);
|
486 | }
|
487 | }
|
488 | exports.generic = generic;
|
489 |
|
490 |
|
491 | }),
|
492 |
|
493 | "./src/constants.ts":
|
494 |
|
495 |
|
496 |
|
497 | ((__unused_webpack_module, exports) => {
|
498 |
|
499 |
|
500 |
|
501 |
|
502 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
503 | exports.returnBindingKey = exports.version = void 0;
|
504 | exports.version = '4.1.0';
|
505 | exports.returnBindingKey = '$return';
|
506 |
|
507 |
|
508 | }),
|
509 |
|
510 | "./src/converters/fromRpcBindings.ts":
|
511 |
|
512 |
|
513 |
|
514 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
515 |
|
516 |
|
517 |
|
518 |
|
519 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
520 | exports.fromRpcBindings = void 0;
|
521 | const constants_1 = __webpack_require__( "./src/constants.ts");
|
522 | const isTrigger_1 = __webpack_require__( "./src/utils/isTrigger.ts");
|
523 | const nonNull_1 = __webpack_require__( "./src/utils/nonNull.ts");
|
524 | function fromRpcBindings(bindings) {
|
525 | let trigger;
|
526 | let returnBinding;
|
527 | const extraInputs = [];
|
528 | const extraOutputs = [];
|
529 | for (const [name, binding] of Object.entries((0, nonNull_1.nonNullValue)(bindings, 'bindings'))) {
|
530 | if ((0, isTrigger_1.isTrigger)(binding.type)) {
|
531 | trigger = fromRpcBinding(name, binding);
|
532 | }
|
533 | else if (name === constants_1.returnBindingKey) {
|
534 | returnBinding = fromRpcBinding(name, binding);
|
535 | }
|
536 | else if (binding.direction === 'in') {
|
537 | extraInputs.push(fromRpcBinding(name, binding));
|
538 | }
|
539 | else if (binding.direction === 'out') {
|
540 | extraOutputs.push(fromRpcBinding(name, binding));
|
541 | }
|
542 | }
|
543 | return {
|
544 | trigger: (0, nonNull_1.nonNullValue)(trigger, 'trigger'),
|
545 | return: returnBinding,
|
546 | extraInputs,
|
547 | extraOutputs,
|
548 | };
|
549 | }
|
550 | exports.fromRpcBindings = fromRpcBindings;
|
551 | function fromRpcBinding(name, binding) {
|
552 | return Object.assign(Object.assign({}, binding), { type: (0, nonNull_1.nonNullProp)(binding, 'type'), name });
|
553 | }
|
554 |
|
555 |
|
556 | }),
|
557 |
|
558 | "./src/converters/fromRpcContext.ts":
|
559 |
|
560 |
|
561 |
|
562 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
563 |
|
564 |
|
565 |
|
566 |
|
567 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
568 | exports.fromRpcTraceContext = exports.fromRpcRetryContext = void 0;
|
569 | const nonNull_1 = __webpack_require__( "./src/utils/nonNull.ts");
|
570 | function fromRpcRetryContext(retryContext) {
|
571 | if (!retryContext) {
|
572 | return undefined;
|
573 | }
|
574 | else {
|
575 | const result = {
|
576 | retryCount: (0, nonNull_1.nonNullProp)(retryContext, 'retryCount'),
|
577 | maxRetryCount: (0, nonNull_1.nonNullProp)(retryContext, 'maxRetryCount'),
|
578 | };
|
579 | if (retryContext.exception) {
|
580 | result.exception = fromRpcException(retryContext.exception);
|
581 | }
|
582 | return result;
|
583 | }
|
584 | }
|
585 | exports.fromRpcRetryContext = fromRpcRetryContext;
|
586 | function fromRpcException(exception) {
|
587 | const result = {};
|
588 | (0, nonNull_1.copyPropIfDefined)(exception, result, 'message');
|
589 | (0, nonNull_1.copyPropIfDefined)(exception, result, 'source');
|
590 | (0, nonNull_1.copyPropIfDefined)(exception, result, 'stackTrace');
|
591 | return result;
|
592 | }
|
593 | function fromRpcTraceContext(traceContext) {
|
594 | if (!traceContext) {
|
595 | return undefined;
|
596 | }
|
597 | else {
|
598 | const result = {};
|
599 | (0, nonNull_1.copyPropIfDefined)(traceContext, result, 'traceParent');
|
600 | (0, nonNull_1.copyPropIfDefined)(traceContext, result, 'traceState');
|
601 | if (traceContext.attributes) {
|
602 | result.attributes = traceContext.attributes;
|
603 | }
|
604 | return result;
|
605 | }
|
606 | }
|
607 | exports.fromRpcTraceContext = fromRpcTraceContext;
|
608 |
|
609 |
|
610 | }),
|
611 |
|
612 | "./src/converters/fromRpcNullable.ts":
|
613 |
|
614 |
|
615 |
|
616 | ((__unused_webpack_module, exports) => {
|
617 |
|
618 |
|
619 |
|
620 |
|
621 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
622 | exports.fromNullableMapping = void 0;
|
623 | function fromNullableMapping(nullableMapping, originalMapping) {
|
624 | let converted = {};
|
625 | if (nullableMapping && Object.keys(nullableMapping).length > 0) {
|
626 | for (const key in nullableMapping) {
|
627 | converted[key] = nullableMapping[key].value || '';
|
628 | }
|
629 | }
|
630 | else if (originalMapping && Object.keys(originalMapping).length > 0) {
|
631 | converted = originalMapping;
|
632 | }
|
633 | return converted;
|
634 | }
|
635 | exports.fromNullableMapping = fromNullableMapping;
|
636 |
|
637 |
|
638 | }),
|
639 |
|
640 | "./src/converters/fromRpcTriggerMetadata.ts":
|
641 |
|
642 |
|
643 |
|
644 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
645 |
|
646 |
|
647 |
|
648 |
|
649 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
650 | exports.fromRpcTriggerMetadata = void 0;
|
651 | const isTrigger_1 = __webpack_require__( "./src/utils/isTrigger.ts");
|
652 | const fromRpcTypedData_1 = __webpack_require__( "./src/converters/fromRpcTypedData.ts");
|
653 | const toCamelCase_1 = __webpack_require__( "./src/converters/toCamelCase.ts");
|
654 | function fromRpcTriggerMetadata(triggerMetadata, triggerType) {
|
655 |
|
656 |
|
657 |
|
658 |
|
659 | if (!triggerMetadata || (0, isTrigger_1.isHttpTrigger)(triggerType) || (0, isTrigger_1.isTimerTrigger)(triggerType)) {
|
660 | return undefined;
|
661 | }
|
662 | else {
|
663 | const result = {};
|
664 | for (const [key, value] of Object.entries(triggerMetadata)) {
|
665 | result[(0, toCamelCase_1.toCamelCaseKey)(key)] = (0, toCamelCase_1.toCamelCaseValue)((0, fromRpcTypedData_1.fromRpcTypedData)(value));
|
666 | }
|
667 | return result;
|
668 | }
|
669 | }
|
670 | exports.fromRpcTriggerMetadata = fromRpcTriggerMetadata;
|
671 |
|
672 |
|
673 | }),
|
674 |
|
675 | "./src/converters/fromRpcTypedData.ts":
|
676 |
|
677 |
|
678 |
|
679 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
680 |
|
681 |
|
682 |
|
683 |
|
684 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
685 | exports.fromRpcTypedData = void 0;
|
686 | const HttpRequest_1 = __webpack_require__( "./src/http/HttpRequest.ts");
|
687 | const nonNull_1 = __webpack_require__( "./src/utils/nonNull.ts");
|
688 | function fromRpcTypedData(data) {
|
689 | if (!data) {
|
690 | return undefined;
|
691 | }
|
692 | else if ((0, nonNull_1.isDefined)(data.string)) {
|
693 | return tryJsonParse(data.string);
|
694 | }
|
695 | else if ((0, nonNull_1.isDefined)(data.json)) {
|
696 | return JSON.parse(data.json);
|
697 | }
|
698 | else if ((0, nonNull_1.isDefined)(data.bytes)) {
|
699 | return Buffer.from(data.bytes);
|
700 | }
|
701 | else if ((0, nonNull_1.isDefined)(data.stream)) {
|
702 | return Buffer.from(data.stream);
|
703 | }
|
704 | else if ((0, nonNull_1.isDefined)(data.http)) {
|
705 | return new HttpRequest_1.HttpRequest(data.http);
|
706 | }
|
707 | else if ((0, nonNull_1.isDefined)(data.int)) {
|
708 | return data.int;
|
709 | }
|
710 | else if ((0, nonNull_1.isDefined)(data.double)) {
|
711 | return data.double;
|
712 | }
|
713 | else if (data.collectionBytes && (0, nonNull_1.isDefined)(data.collectionBytes.bytes)) {
|
714 | return data.collectionBytes.bytes.map((d) => Buffer.from(d));
|
715 | }
|
716 | else if (data.collectionString && (0, nonNull_1.isDefined)(data.collectionString.string)) {
|
717 | return data.collectionString.string.map(tryJsonParse);
|
718 | }
|
719 | else if (data.collectionDouble && (0, nonNull_1.isDefined)(data.collectionDouble.double)) {
|
720 | return data.collectionDouble.double;
|
721 | }
|
722 | else if (data.collectionSint64 && (0, nonNull_1.isDefined)(data.collectionSint64.sint64)) {
|
723 | return data.collectionSint64.sint64;
|
724 | }
|
725 | else {
|
726 | return undefined;
|
727 | }
|
728 | }
|
729 | exports.fromRpcTypedData = fromRpcTypedData;
|
730 | function tryJsonParse(data) {
|
731 | try {
|
732 | return JSON.parse(data);
|
733 | }
|
734 | catch (_a) {
|
735 | return data;
|
736 | }
|
737 | }
|
738 |
|
739 |
|
740 | }),
|
741 |
|
742 | "./src/converters/toCamelCase.ts":
|
743 |
|
744 |
|
745 |
|
746 | ((__unused_webpack_module, exports) => {
|
747 |
|
748 |
|
749 |
|
750 |
|
751 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
752 | exports.toCamelCaseKey = exports.toCamelCaseValue = void 0;
|
753 | function toCamelCaseValue(data) {
|
754 | if (typeof data !== 'object' || data === null) {
|
755 | return data;
|
756 | }
|
757 | else if (Array.isArray(data)) {
|
758 | return data.map(toCamelCaseValue);
|
759 | }
|
760 | else {
|
761 | const result = {};
|
762 | for (const [key, value] of Object.entries(data)) {
|
763 | result[toCamelCaseKey(key)] = toCamelCaseValue(value);
|
764 | }
|
765 | return result;
|
766 | }
|
767 | }
|
768 | exports.toCamelCaseValue = toCamelCaseValue;
|
769 | function toCamelCaseKey(key) {
|
770 | return key.charAt(0).toLowerCase() + key.slice(1);
|
771 | }
|
772 | exports.toCamelCaseKey = toCamelCaseKey;
|
773 |
|
774 |
|
775 | }),
|
776 |
|
777 | "./src/converters/toRpcDuration.ts":
|
778 |
|
779 |
|
780 |
|
781 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
782 |
|
783 |
|
784 |
|
785 |
|
786 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
787 | exports.toRpcDuration = void 0;
|
788 | const errors_1 = __webpack_require__( "./src/errors.ts");
|
789 | const nonNull_1 = __webpack_require__( "./src/utils/nonNull.ts");
|
790 | function toRpcDuration(dateTime, propertyName) {
|
791 | if ((0, nonNull_1.isDefined)(dateTime)) {
|
792 | try {
|
793 | let timeInMilliseconds;
|
794 | if (typeof dateTime === 'object') {
|
795 | const minutes = (dateTime.minutes || 0) + (dateTime.hours || 0) * 60;
|
796 | const seconds = (dateTime.seconds || 0) + minutes * 60;
|
797 | timeInMilliseconds = (dateTime.milliseconds || 0) + seconds * 1000;
|
798 | }
|
799 | else if (typeof dateTime === 'number') {
|
800 | timeInMilliseconds = dateTime;
|
801 | }
|
802 | if ((0, nonNull_1.isDefined)(timeInMilliseconds) && timeInMilliseconds >= 0) {
|
803 | return {
|
804 | seconds: Math.round(timeInMilliseconds / 1000),
|
805 | };
|
806 | }
|
807 | }
|
808 | catch (_a) {
|
809 |
|
810 | }
|
811 | throw new errors_1.AzFuncSystemError(`A 'number' or 'Duration' object was expected instead of a '${typeof dateTime}'. Cannot parse value of '${propertyName}'.`);
|
812 | }
|
813 | return undefined;
|
814 | }
|
815 | exports.toRpcDuration = toRpcDuration;
|
816 |
|
817 |
|
818 | }),
|
819 |
|
820 | "./src/converters/toRpcHttp.ts":
|
821 |
|
822 |
|
823 |
|
824 | (function(__unused_webpack_module, exports, __webpack_require__) {
|
825 |
|
826 |
|
827 |
|
828 |
|
829 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
830 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
831 | return new (P || (P = Promise))(function (resolve, reject) {
|
832 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
833 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
834 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
835 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
836 | });
|
837 | };
|
838 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
839 | exports.toRpcHttp = void 0;
|
840 | const errors_1 = __webpack_require__( "./src/errors.ts");
|
841 | const HttpResponse_1 = __webpack_require__( "./src/http/HttpResponse.ts");
|
842 | const toRpcHttpCookie_1 = __webpack_require__( "./src/converters/toRpcHttpCookie.ts");
|
843 | const toRpcTypedData_1 = __webpack_require__( "./src/converters/toRpcTypedData.ts");
|
844 | function toRpcHttp(data) {
|
845 | return __awaiter(this, void 0, void 0, function* () {
|
846 | if (data === null || data === undefined) {
|
847 | return data;
|
848 | }
|
849 | else if (typeof data !== 'object') {
|
850 | throw new errors_1.AzFuncSystemError('The HTTP response must be an object with optional properties "body", "status", "headers", and "cookies".');
|
851 | }
|
852 | const response = data instanceof HttpResponse_1.HttpResponse ? data : new HttpResponse_1.HttpResponse(data);
|
853 | const rpcResponse = {};
|
854 | rpcResponse.statusCode = response.status.toString();
|
855 | rpcResponse.headers = {};
|
856 | for (const [key, value] of response.headers.entries()) {
|
857 | rpcResponse.headers[key] = value;
|
858 | }
|
859 | rpcResponse.cookies = [];
|
860 | for (const cookie of response.cookies) {
|
861 | rpcResponse.cookies.push((0, toRpcHttpCookie_1.toRpcHttpCookie)(cookie));
|
862 | }
|
863 | rpcResponse.enableContentNegotiation = response.enableContentNegotiation;
|
864 | const bodyBytes = yield response.arrayBuffer();
|
865 | rpcResponse.body = (0, toRpcTypedData_1.toRpcTypedData)(bodyBytes);
|
866 | return { http: rpcResponse };
|
867 | });
|
868 | }
|
869 | exports.toRpcHttp = toRpcHttp;
|
870 |
|
871 |
|
872 | }),
|
873 |
|
874 | "./src/converters/toRpcHttpCookie.ts":
|
875 |
|
876 |
|
877 |
|
878 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
879 |
|
880 |
|
881 |
|
882 |
|
883 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
884 | exports.toRpcHttpCookie = void 0;
|
885 | const toRpcNullable_1 = __webpack_require__( "./src/converters/toRpcNullable.ts");
|
886 |
|
887 |
|
888 |
|
889 |
|
890 | function toRpcHttpCookie(inputCookie) {
|
891 |
|
892 | let rpcSameSite = 'none';
|
893 | if (inputCookie && inputCookie.sameSite) {
|
894 | const sameSite = inputCookie.sameSite.toLocaleLowerCase();
|
895 | if (sameSite === 'lax') {
|
896 | rpcSameSite = 'lax';
|
897 | }
|
898 | else if (sameSite === 'strict') {
|
899 | rpcSameSite = 'strict';
|
900 | }
|
901 | else if (sameSite === 'none') {
|
902 | rpcSameSite = 'explicitNone';
|
903 | }
|
904 | }
|
905 | const rpcCookie = {
|
906 | name: inputCookie && (0, toRpcNullable_1.toRpcString)(inputCookie.name, 'cookie.name'),
|
907 | value: inputCookie && (0, toRpcNullable_1.toRpcString)(inputCookie.value, 'cookie.value'),
|
908 | domain: (0, toRpcNullable_1.toNullableString)(inputCookie && inputCookie.domain, 'cookie.domain'),
|
909 | path: (0, toRpcNullable_1.toNullableString)(inputCookie && inputCookie.path, 'cookie.path'),
|
910 | expires: (0, toRpcNullable_1.toNullableTimestamp)(inputCookie && inputCookie.expires, 'cookie.expires'),
|
911 | secure: (0, toRpcNullable_1.toNullableBool)(inputCookie && inputCookie.secure, 'cookie.secure'),
|
912 | httpOnly: (0, toRpcNullable_1.toNullableBool)(inputCookie && inputCookie.httpOnly, 'cookie.httpOnly'),
|
913 | sameSite: rpcSameSite,
|
914 | maxAge: (0, toRpcNullable_1.toNullableDouble)(inputCookie && inputCookie.maxAge, 'cookie.maxAge'),
|
915 | };
|
916 | return rpcCookie;
|
917 | }
|
918 | exports.toRpcHttpCookie = toRpcHttpCookie;
|
919 |
|
920 |
|
921 | }),
|
922 |
|
923 | "./src/converters/toRpcNullable.ts":
|
924 |
|
925 |
|
926 |
|
927 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
928 |
|
929 |
|
930 |
|
931 |
|
932 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
933 | exports.toNullableTimestamp = exports.toNullableString = exports.toRpcString = exports.toNullableDouble = exports.toNullableBool = void 0;
|
934 | const errors_1 = __webpack_require__( "./src/errors.ts");
|
935 | const nonNull_1 = __webpack_require__( "./src/utils/nonNull.ts");
|
936 |
|
937 |
|
938 |
|
939 |
|
940 |
|
941 |
|
942 | function toNullableBool(nullable, propertyName) {
|
943 | if (typeof nullable === 'boolean') {
|
944 | return {
|
945 | value: nullable,
|
946 | };
|
947 | }
|
948 | if ((0, nonNull_1.isDefined)(nullable)) {
|
949 | throw new errors_1.AzFuncSystemError(`A 'boolean' type was expected instead of a '${typeof nullable}' type. Cannot parse value of '${propertyName}'.`);
|
950 | }
|
951 | return undefined;
|
952 | }
|
953 | exports.toNullableBool = toNullableBool;
|
954 |
|
955 |
|
956 |
|
957 |
|
958 |
|
959 |
|
960 | function toNullableDouble(nullable, propertyName) {
|
961 | if (typeof nullable === 'number') {
|
962 | return {
|
963 | value: nullable,
|
964 | };
|
965 | }
|
966 | else if (typeof nullable === 'string') {
|
967 | if (!isNaN(Number(nullable))) {
|
968 | const parsedNumber = parseFloat(nullable);
|
969 | return {
|
970 | value: parsedNumber,
|
971 | };
|
972 | }
|
973 | }
|
974 | if ((0, nonNull_1.isDefined)(nullable)) {
|
975 | throw new errors_1.AzFuncSystemError(`A 'number' type was expected instead of a '${typeof nullable}' type. Cannot parse value of '${propertyName}'.`);
|
976 | }
|
977 | return undefined;
|
978 | }
|
979 | exports.toNullableDouble = toNullableDouble;
|
980 |
|
981 |
|
982 |
|
983 |
|
984 |
|
985 |
|
986 | function toRpcString(nullable, propertyName) {
|
987 | if (typeof nullable === 'string') {
|
988 | return nullable;
|
989 | }
|
990 | if ((0, nonNull_1.isDefined)(nullable)) {
|
991 | throw new errors_1.AzFuncSystemError(`A 'string' type was expected instead of a '${typeof nullable}' type. Cannot parse value of '${propertyName}'.`);
|
992 | }
|
993 | return '';
|
994 | }
|
995 | exports.toRpcString = toRpcString;
|
996 |
|
997 |
|
998 |
|
999 |
|
1000 |
|
1001 |
|
1002 | function toNullableString(nullable, propertyName) {
|
1003 | if (typeof nullable === 'string') {
|
1004 | return {
|
1005 | value: nullable,
|
1006 | };
|
1007 | }
|
1008 | if ((0, nonNull_1.isDefined)(nullable)) {
|
1009 | throw new errors_1.AzFuncSystemError(`A 'string' type was expected instead of a '${typeof nullable}' type. Cannot parse value of '${propertyName}'.`);
|
1010 | }
|
1011 | return undefined;
|
1012 | }
|
1013 | exports.toNullableString = toNullableString;
|
1014 |
|
1015 |
|
1016 |
|
1017 |
|
1018 |
|
1019 |
|
1020 | function toNullableTimestamp(dateTime, propertyName) {
|
1021 | if ((0, nonNull_1.isDefined)(dateTime)) {
|
1022 | try {
|
1023 | const timeInMilliseconds = typeof dateTime === 'number' ? dateTime : dateTime.getTime();
|
1024 | if (timeInMilliseconds && timeInMilliseconds >= 0) {
|
1025 | return {
|
1026 | value: {
|
1027 | seconds: Math.round(timeInMilliseconds / 1000),
|
1028 | },
|
1029 | };
|
1030 | }
|
1031 | }
|
1032 | catch (_a) {
|
1033 | throw new errors_1.AzFuncSystemError(`A 'number' or 'Date' input was expected instead of a '${typeof dateTime}'. Cannot parse value of '${propertyName}'.`);
|
1034 | }
|
1035 | }
|
1036 | return undefined;
|
1037 | }
|
1038 | exports.toNullableTimestamp = toNullableTimestamp;
|
1039 |
|
1040 |
|
1041 | }),
|
1042 |
|
1043 | "./src/converters/toRpcTypedData.ts":
|
1044 |
|
1045 |
|
1046 |
|
1047 | ((__unused_webpack_module, exports) => {
|
1048 |
|
1049 |
|
1050 |
|
1051 |
|
1052 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
1053 | exports.toRpcTypedData = void 0;
|
1054 | function toRpcTypedData(data) {
|
1055 | if (data === null || data === undefined) {
|
1056 | return data;
|
1057 | }
|
1058 | else if (typeof data === 'string') {
|
1059 | return { string: data };
|
1060 | }
|
1061 | else if (Buffer.isBuffer(data)) {
|
1062 | return { bytes: data };
|
1063 | }
|
1064 | else if (ArrayBuffer.isView(data)) {
|
1065 | const bytes = new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
|
1066 | return { bytes: bytes };
|
1067 | }
|
1068 | else if (data instanceof ArrayBuffer) {
|
1069 | const bytes = new Uint8Array(data);
|
1070 | return { bytes: bytes };
|
1071 | }
|
1072 | else if (typeof data === 'number') {
|
1073 | if (Number.isInteger(data)) {
|
1074 | return { int: data };
|
1075 | }
|
1076 | else {
|
1077 | return { double: data };
|
1078 | }
|
1079 | }
|
1080 | else {
|
1081 | return { json: JSON.stringify(data) };
|
1082 | }
|
1083 | }
|
1084 | exports.toRpcTypedData = toRpcTypedData;
|
1085 |
|
1086 |
|
1087 | }),
|
1088 |
|
1089 | "./src/errors.ts":
|
1090 |
|
1091 |
|
1092 |
|
1093 | ((__unused_webpack_module, exports) => {
|
1094 |
|
1095 |
|
1096 |
|
1097 |
|
1098 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
1099 | exports.isError = exports.ensureErrorType = exports.ReadOnlyError = exports.AzFuncRangeError = exports.AzFuncTypeError = exports.AzFuncSystemError = void 0;
|
1100 | class AzFuncSystemError extends Error {
|
1101 | constructor() {
|
1102 | super(...arguments);
|
1103 | this.isAzureFunctionsSystemError = true;
|
1104 | }
|
1105 | }
|
1106 | exports.AzFuncSystemError = AzFuncSystemError;
|
1107 | class AzFuncTypeError extends TypeError {
|
1108 | constructor() {
|
1109 | super(...arguments);
|
1110 | this.isAzureFunctionsSystemError = true;
|
1111 | }
|
1112 | }
|
1113 | exports.AzFuncTypeError = AzFuncTypeError;
|
1114 | class AzFuncRangeError extends RangeError {
|
1115 | constructor() {
|
1116 | super(...arguments);
|
1117 | this.isAzureFunctionsSystemError = true;
|
1118 | }
|
1119 | }
|
1120 | exports.AzFuncRangeError = AzFuncRangeError;
|
1121 | class ReadOnlyError extends AzFuncTypeError {
|
1122 | constructor(propertyName) {
|
1123 | super(`Cannot assign to read only property '${propertyName}'`);
|
1124 | }
|
1125 | }
|
1126 | exports.ReadOnlyError = ReadOnlyError;
|
1127 | function ensureErrorType(err) {
|
1128 | if (err instanceof Error) {
|
1129 | return err;
|
1130 | }
|
1131 | else {
|
1132 | let message;
|
1133 | if (err === undefined || err === null) {
|
1134 | message = 'Unknown error';
|
1135 | }
|
1136 | else if (typeof err === 'string') {
|
1137 | message = err;
|
1138 | }
|
1139 | else if (typeof err === 'object') {
|
1140 | message = JSON.stringify(err);
|
1141 | }
|
1142 | else {
|
1143 | message = String(err);
|
1144 | }
|
1145 | return new Error(message);
|
1146 | }
|
1147 | }
|
1148 | exports.ensureErrorType = ensureErrorType;
|
1149 |
|
1150 |
|
1151 |
|
1152 |
|
1153 | function isError(err) {
|
1154 | return err !== null && err !== undefined;
|
1155 | }
|
1156 | exports.isError = isError;
|
1157 |
|
1158 |
|
1159 | }),
|
1160 |
|
1161 | "./src/hooks/AppStartContext.ts":
|
1162 |
|
1163 |
|
1164 |
|
1165 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
1166 |
|
1167 |
|
1168 |
|
1169 |
|
1170 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
1171 | exports.AppStartContext = void 0;
|
1172 | const HookContext_1 = __webpack_require__( "./src/hooks/HookContext.ts");
|
1173 | class AppStartContext extends HookContext_1.HookContext {
|
1174 | }
|
1175 | exports.AppStartContext = AppStartContext;
|
1176 |
|
1177 |
|
1178 | }),
|
1179 |
|
1180 | "./src/hooks/AppTerminateContext.ts":
|
1181 |
|
1182 |
|
1183 |
|
1184 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
1185 |
|
1186 |
|
1187 |
|
1188 |
|
1189 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
1190 | exports.AppTerminateContext = void 0;
|
1191 | const HookContext_1 = __webpack_require__( "./src/hooks/HookContext.ts");
|
1192 | class AppTerminateContext extends HookContext_1.HookContext {
|
1193 | }
|
1194 | exports.AppTerminateContext = AppTerminateContext;
|
1195 |
|
1196 |
|
1197 | }),
|
1198 |
|
1199 | "./src/hooks/HookContext.ts":
|
1200 |
|
1201 |
|
1202 |
|
1203 | (function(__unused_webpack_module, exports, __webpack_require__) {
|
1204 |
|
1205 |
|
1206 |
|
1207 |
|
1208 | var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
1209 | if (kind === "m") throw new TypeError("Private method is not writable");
|
1210 | if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
1211 | if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
1212 | return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
1213 | };
|
1214 | var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
1215 | if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
1216 | if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
1217 | return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
1218 | };
|
1219 | var _HookContext_init;
|
1220 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
1221 | exports.HookContext = void 0;
|
1222 | const errors_1 = __webpack_require__( "./src/errors.ts");
|
1223 | const nonNull_1 = __webpack_require__( "./src/utils/nonNull.ts");
|
1224 | class HookContext {
|
1225 | constructor(init) {
|
1226 | var _a;
|
1227 | var _b;
|
1228 | _HookContext_init.set(this, void 0);
|
1229 | __classPrivateFieldSet(this, _HookContext_init, init !== null && init !== void 0 ? init : {}, "f");
|
1230 | (_a = (_b = __classPrivateFieldGet(this, _HookContext_init, "f")).hookData) !== null && _a !== void 0 ? _a : (_b.hookData = {});
|
1231 | }
|
1232 | get hookData() {
|
1233 | return (0, nonNull_1.nonNullProp)(__classPrivateFieldGet(this, _HookContext_init, "f"), 'hookData');
|
1234 | }
|
1235 | set hookData(_value) {
|
1236 | throw new errors_1.ReadOnlyError('hookData');
|
1237 | }
|
1238 | }
|
1239 | exports.HookContext = HookContext;
|
1240 | _HookContext_init = new WeakMap();
|
1241 |
|
1242 |
|
1243 | }),
|
1244 |
|
1245 | "./src/hooks/InvocationHookContext.ts":
|
1246 |
|
1247 |
|
1248 |
|
1249 | (function(__unused_webpack_module, exports, __webpack_require__) {
|
1250 |
|
1251 |
|
1252 |
|
1253 |
|
1254 | var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
1255 | if (kind === "m") throw new TypeError("Private method is not writable");
|
1256 | if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
1257 | if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
1258 | return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
1259 | };
|
1260 | var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
1261 | if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
1262 | if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
1263 | return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
1264 | };
|
1265 | var _InvocationHookContext_init;
|
1266 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
1267 | exports.InvocationHookContext = void 0;
|
1268 | const errors_1 = __webpack_require__( "./src/errors.ts");
|
1269 | const InvocationContext_1 = __webpack_require__( "./src/InvocationContext.ts");
|
1270 | const nonNull_1 = __webpack_require__( "./src/utils/nonNull.ts");
|
1271 | const HookContext_1 = __webpack_require__( "./src/hooks/HookContext.ts");
|
1272 | class InvocationHookContext extends HookContext_1.HookContext {
|
1273 | constructor(init) {
|
1274 | var _a, _b;
|
1275 | var _c, _d;
|
1276 | super(init);
|
1277 | _InvocationHookContext_init.set(this, void 0);
|
1278 | __classPrivateFieldSet(this, _InvocationHookContext_init, init !== null && init !== void 0 ? init : {}, "f");
|
1279 | (_a = (_c = __classPrivateFieldGet(this, _InvocationHookContext_init, "f")).inputs) !== null && _a !== void 0 ? _a : (_c.inputs = []);
|
1280 | (_b = (_d = __classPrivateFieldGet(this, _InvocationHookContext_init, "f")).invocationContext) !== null && _b !== void 0 ? _b : (_d.invocationContext = new InvocationContext_1.InvocationContext());
|
1281 | }
|
1282 | get invocationContext() {
|
1283 | return (0, nonNull_1.nonNullProp)(__classPrivateFieldGet(this, _InvocationHookContext_init, "f"), 'invocationContext');
|
1284 | }
|
1285 | set invocationContext(_value) {
|
1286 | throw new errors_1.ReadOnlyError('invocationContext');
|
1287 | }
|
1288 | get inputs() {
|
1289 | return (0, nonNull_1.nonNullProp)(__classPrivateFieldGet(this, _InvocationHookContext_init, "f"), 'inputs');
|
1290 | }
|
1291 | set inputs(value) {
|
1292 | __classPrivateFieldGet(this, _InvocationHookContext_init, "f").inputs = value;
|
1293 | }
|
1294 | }
|
1295 | exports.InvocationHookContext = InvocationHookContext;
|
1296 | _InvocationHookContext_init = new WeakMap();
|
1297 |
|
1298 |
|
1299 | }),
|
1300 |
|
1301 | "./src/hooks/PostInvocationContext.ts":
|
1302 |
|
1303 |
|
1304 |
|
1305 | (function(__unused_webpack_module, exports, __webpack_require__) {
|
1306 |
|
1307 |
|
1308 |
|
1309 |
|
1310 | var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
1311 | if (kind === "m") throw new TypeError("Private method is not writable");
|
1312 | if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
1313 | if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
1314 | return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
1315 | };
|
1316 | var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
1317 | if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
1318 | if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
1319 | return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
1320 | };
|
1321 | var _PostInvocationContext_init;
|
1322 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
1323 | exports.PostInvocationContext = void 0;
|
1324 | const InvocationHookContext_1 = __webpack_require__( "./src/hooks/InvocationHookContext.ts");
|
1325 | class PostInvocationContext extends InvocationHookContext_1.InvocationHookContext {
|
1326 | constructor(init) {
|
1327 | super(init);
|
1328 | _PostInvocationContext_init.set(this, void 0);
|
1329 | __classPrivateFieldSet(this, _PostInvocationContext_init, init !== null && init !== void 0 ? init : {}, "f");
|
1330 | }
|
1331 | get result() {
|
1332 | return __classPrivateFieldGet(this, _PostInvocationContext_init, "f").result;
|
1333 | }
|
1334 | set result(value) {
|
1335 | __classPrivateFieldGet(this, _PostInvocationContext_init, "f").result = value;
|
1336 | }
|
1337 | get error() {
|
1338 | return __classPrivateFieldGet(this, _PostInvocationContext_init, "f").error;
|
1339 | }
|
1340 | set error(value) {
|
1341 | __classPrivateFieldGet(this, _PostInvocationContext_init, "f").error = value;
|
1342 | }
|
1343 | }
|
1344 | exports.PostInvocationContext = PostInvocationContext;
|
1345 | _PostInvocationContext_init = new WeakMap();
|
1346 |
|
1347 |
|
1348 | }),
|
1349 |
|
1350 | "./src/hooks/PreInvocationContext.ts":
|
1351 |
|
1352 |
|
1353 |
|
1354 | (function(__unused_webpack_module, exports, __webpack_require__) {
|
1355 |
|
1356 |
|
1357 |
|
1358 |
|
1359 | var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
1360 | if (kind === "m") throw new TypeError("Private method is not writable");
|
1361 | if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
1362 | if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
1363 | return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
1364 | };
|
1365 | var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
1366 | if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
1367 | if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
1368 | return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
1369 | };
|
1370 | var _PreInvocationContext_init;
|
1371 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
1372 | exports.PreInvocationContext = void 0;
|
1373 | const nonNull_1 = __webpack_require__( "./src/utils/nonNull.ts");
|
1374 | const InvocationHookContext_1 = __webpack_require__( "./src/hooks/InvocationHookContext.ts");
|
1375 | class PreInvocationContext extends InvocationHookContext_1.InvocationHookContext {
|
1376 | constructor(init) {
|
1377 | var _a;
|
1378 | var _b;
|
1379 | super(init);
|
1380 | _PreInvocationContext_init.set(this, void 0);
|
1381 | __classPrivateFieldSet(this, _PreInvocationContext_init, init !== null && init !== void 0 ? init : {}, "f");
|
1382 | (_a = (_b = __classPrivateFieldGet(this, _PreInvocationContext_init, "f")).functionCallback) !== null && _a !== void 0 ? _a : (_b.functionCallback = () => { });
|
1383 | }
|
1384 | get functionHandler() {
|
1385 | return (0, nonNull_1.nonNullProp)(__classPrivateFieldGet(this, _PreInvocationContext_init, "f"), 'functionCallback');
|
1386 | }
|
1387 | set functionHandler(value) {
|
1388 | __classPrivateFieldGet(this, _PreInvocationContext_init, "f").functionCallback = value;
|
1389 | }
|
1390 | }
|
1391 | exports.PreInvocationContext = PreInvocationContext;
|
1392 | _PreInvocationContext_init = new WeakMap();
|
1393 |
|
1394 |
|
1395 | }),
|
1396 |
|
1397 | "./src/hooks/registerHook.ts":
|
1398 |
|
1399 |
|
1400 |
|
1401 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
1402 |
|
1403 |
|
1404 |
|
1405 |
|
1406 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
1407 | exports.postInvocation = exports.preInvocation = exports.appTerminate = exports.appStart = void 0;
|
1408 | const Disposable_1 = __webpack_require__( "./src/utils/Disposable.ts");
|
1409 | const tryGetCoreApiLazy_1 = __webpack_require__( "./src/utils/tryGetCoreApiLazy.ts");
|
1410 | const AppStartContext_1 = __webpack_require__( "./src/hooks/AppStartContext.ts");
|
1411 | const AppTerminateContext_1 = __webpack_require__( "./src/hooks/AppTerminateContext.ts");
|
1412 | const PostInvocationContext_1 = __webpack_require__( "./src/hooks/PostInvocationContext.ts");
|
1413 | const PreInvocationContext_1 = __webpack_require__( "./src/hooks/PreInvocationContext.ts");
|
1414 | function registerHook(hookName, callback) {
|
1415 | const coreApi = (0, tryGetCoreApiLazy_1.tryGetCoreApiLazy)();
|
1416 | if (!coreApi) {
|
1417 | console.warn(`WARNING: Skipping call to register ${hookName} hook because the "@azure/functions" package is in test mode.`);
|
1418 | return new Disposable_1.Disposable(() => {
|
1419 | console.warn(`WARNING: Skipping call to dispose ${hookName} hook because the "@azure/functions" package is in test mode.`);
|
1420 | });
|
1421 | }
|
1422 | else {
|
1423 | return coreApi.registerHook(hookName, callback);
|
1424 | }
|
1425 | }
|
1426 | function appStart(handler) {
|
1427 | return registerHook('appStart', (coreContext) => {
|
1428 | return handler(new AppStartContext_1.AppStartContext(coreContext));
|
1429 | });
|
1430 | }
|
1431 | exports.appStart = appStart;
|
1432 | function appTerminate(handler) {
|
1433 | return registerHook('appTerminate', (coreContext) => {
|
1434 | return handler(new AppTerminateContext_1.AppTerminateContext(coreContext));
|
1435 | });
|
1436 | }
|
1437 | exports.appTerminate = appTerminate;
|
1438 | function preInvocation(handler) {
|
1439 | return registerHook('preInvocation', (coreContext) => {
|
1440 | return handler(new PreInvocationContext_1.PreInvocationContext(coreContext));
|
1441 | });
|
1442 | }
|
1443 | exports.preInvocation = preInvocation;
|
1444 | function postInvocation(handler) {
|
1445 | return registerHook('postInvocation', (coreContext) => {
|
1446 | return handler(new PostInvocationContext_1.PostInvocationContext(coreContext));
|
1447 | });
|
1448 | }
|
1449 | exports.postInvocation = postInvocation;
|
1450 |
|
1451 |
|
1452 | }),
|
1453 |
|
1454 | "./src/http/HttpRequest.ts":
|
1455 |
|
1456 |
|
1457 |
|
1458 | (function(__unused_webpack_module, exports, __webpack_require__) {
|
1459 |
|
1460 |
|
1461 |
|
1462 |
|
1463 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
1464 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
1465 | return new (P || (P = Promise))(function (resolve, reject) {
|
1466 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
1467 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
1468 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
1469 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
1470 | });
|
1471 | };
|
1472 | var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
1473 | if (kind === "m") throw new TypeError("Private method is not writable");
|
1474 | if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
1475 | if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
1476 | return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
1477 | };
|
1478 | var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
1479 | if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
1480 | if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
1481 | return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
1482 | };
|
1483 | var _HttpRequest_cachedUser, _HttpRequest_uReq, _HttpRequest_body;
|
1484 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
1485 | exports.HttpRequest = void 0;
|
1486 | const undici_1 = __webpack_require__( "undici");
|
1487 | const url_1 = __webpack_require__( "url");
|
1488 | const fromRpcNullable_1 = __webpack_require__( "./src/converters/fromRpcNullable.ts");
|
1489 | const nonNull_1 = __webpack_require__( "./src/utils/nonNull.ts");
|
1490 | const extractHttpUserFromHeaders_1 = __webpack_require__( "./src/http/extractHttpUserFromHeaders.ts");
|
1491 | class HttpRequest {
|
1492 | constructor(rpcHttp) {
|
1493 | var _a, _b, _c;
|
1494 | _HttpRequest_cachedUser.set(this, void 0);
|
1495 | _HttpRequest_uReq.set(this, void 0);
|
1496 | _HttpRequest_body.set(this, void 0);
|
1497 | const url = (0, nonNull_1.nonNullProp)(rpcHttp, 'url');
|
1498 | if ((_a = rpcHttp.body) === null || _a === void 0 ? void 0 : _a.bytes) {
|
1499 | __classPrivateFieldSet(this, _HttpRequest_body, Buffer.from((_b = rpcHttp.body) === null || _b === void 0 ? void 0 : _b.bytes), "f");
|
1500 | }
|
1501 | else if ((_c = rpcHttp.body) === null || _c === void 0 ? void 0 : _c.string) {
|
1502 | __classPrivateFieldSet(this, _HttpRequest_body, rpcHttp.body.string, "f");
|
1503 | }
|
1504 | __classPrivateFieldSet(this, _HttpRequest_uReq, new undici_1.Request(url, {
|
1505 | body: __classPrivateFieldGet(this, _HttpRequest_body, "f"),
|
1506 | method: (0, nonNull_1.nonNullProp)(rpcHttp, 'method'),
|
1507 | headers: (0, fromRpcNullable_1.fromNullableMapping)(rpcHttp.nullableHeaders, rpcHttp.headers),
|
1508 | }), "f");
|
1509 | this.query = new url_1.URLSearchParams((0, fromRpcNullable_1.fromNullableMapping)(rpcHttp.nullableQuery, rpcHttp.query));
|
1510 | this.params = (0, fromRpcNullable_1.fromNullableMapping)(rpcHttp.nullableParams, rpcHttp.params);
|
1511 | }
|
1512 | get url() {
|
1513 | return __classPrivateFieldGet(this, _HttpRequest_uReq, "f").url;
|
1514 | }
|
1515 | get method() {
|
1516 | return __classPrivateFieldGet(this, _HttpRequest_uReq, "f").method;
|
1517 | }
|
1518 | get headers() {
|
1519 | return __classPrivateFieldGet(this, _HttpRequest_uReq, "f").headers;
|
1520 | }
|
1521 | get user() {
|
1522 | if (__classPrivateFieldGet(this, _HttpRequest_cachedUser, "f") === undefined) {
|
1523 | __classPrivateFieldSet(this, _HttpRequest_cachedUser, (0, extractHttpUserFromHeaders_1.extractHttpUserFromHeaders)(this.headers), "f");
|
1524 | }
|
1525 | return __classPrivateFieldGet(this, _HttpRequest_cachedUser, "f");
|
1526 | }
|
1527 | get body() {
|
1528 | return __classPrivateFieldGet(this, _HttpRequest_uReq, "f").body;
|
1529 | }
|
1530 | get bodyUsed() {
|
1531 | return __classPrivateFieldGet(this, _HttpRequest_uReq, "f").bodyUsed;
|
1532 | }
|
1533 | arrayBuffer() {
|
1534 | return __awaiter(this, void 0, void 0, function* () {
|
1535 | return __classPrivateFieldGet(this, _HttpRequest_uReq, "f").arrayBuffer();
|
1536 | });
|
1537 | }
|
1538 | blob() {
|
1539 | return __awaiter(this, void 0, void 0, function* () {
|
1540 | return __classPrivateFieldGet(this, _HttpRequest_uReq, "f").blob();
|
1541 | });
|
1542 | }
|
1543 | formData() {
|
1544 | return __awaiter(this, void 0, void 0, function* () {
|
1545 | return __classPrivateFieldGet(this, _HttpRequest_uReq, "f").formData();
|
1546 | });
|
1547 | }
|
1548 | json() {
|
1549 | return __awaiter(this, void 0, void 0, function* () {
|
1550 | return __classPrivateFieldGet(this, _HttpRequest_uReq, "f").json();
|
1551 | });
|
1552 | }
|
1553 | text() {
|
1554 | return __awaiter(this, void 0, void 0, function* () {
|
1555 | return __classPrivateFieldGet(this, _HttpRequest_uReq, "f").text();
|
1556 | });
|
1557 | }
|
1558 | }
|
1559 | exports.HttpRequest = HttpRequest;
|
1560 | _HttpRequest_cachedUser = new WeakMap(), _HttpRequest_uReq = new WeakMap(), _HttpRequest_body = new WeakMap();
|
1561 |
|
1562 |
|
1563 | }),
|
1564 |
|
1565 | "./src/http/HttpResponse.ts":
|
1566 |
|
1567 |
|
1568 |
|
1569 | (function(__unused_webpack_module, exports, __webpack_require__) {
|
1570 |
|
1571 |
|
1572 |
|
1573 |
|
1574 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
1575 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
1576 | return new (P || (P = Promise))(function (resolve, reject) {
|
1577 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
1578 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
1579 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
1580 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
1581 | });
|
1582 | };
|
1583 | var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
1584 | if (kind === "m") throw new TypeError("Private method is not writable");
|
1585 | if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
1586 | if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
1587 | return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
1588 | };
|
1589 | var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
1590 | if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
1591 | if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
1592 | return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
1593 | };
|
1594 | var _HttpResponse_uRes;
|
1595 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
1596 | exports.HttpResponse = void 0;
|
1597 | const undici_1 = __webpack_require__( "undici");
|
1598 | const nonNull_1 = __webpack_require__( "./src/utils/nonNull.ts");
|
1599 | class HttpResponse {
|
1600 | constructor(resInit) {
|
1601 | _HttpResponse_uRes.set(this, void 0);
|
1602 | const uResInit = { status: resInit === null || resInit === void 0 ? void 0 : resInit.status, headers: resInit === null || resInit === void 0 ? void 0 : resInit.headers };
|
1603 | if ((0, nonNull_1.isDefined)(resInit === null || resInit === void 0 ? void 0 : resInit.jsonBody)) {
|
1604 | __classPrivateFieldSet(this, _HttpResponse_uRes, undici_1.Response.json(resInit === null || resInit === void 0 ? void 0 : resInit.jsonBody, uResInit), "f");
|
1605 | }
|
1606 | else {
|
1607 | __classPrivateFieldSet(this, _HttpResponse_uRes, new undici_1.Response(resInit === null || resInit === void 0 ? void 0 : resInit.body, uResInit), "f");
|
1608 | }
|
1609 | this.cookies = (resInit === null || resInit === void 0 ? void 0 : resInit.cookies) || [];
|
1610 | this.enableContentNegotiation = !!(resInit === null || resInit === void 0 ? void 0 : resInit.enableContentNegotiation);
|
1611 | }
|
1612 | get status() {
|
1613 | return __classPrivateFieldGet(this, _HttpResponse_uRes, "f").status;
|
1614 | }
|
1615 | get headers() {
|
1616 | return __classPrivateFieldGet(this, _HttpResponse_uRes, "f").headers;
|
1617 | }
|
1618 | get body() {
|
1619 | return __classPrivateFieldGet(this, _HttpResponse_uRes, "f").body;
|
1620 | }
|
1621 | get bodyUsed() {
|
1622 | return __classPrivateFieldGet(this, _HttpResponse_uRes, "f").bodyUsed;
|
1623 | }
|
1624 | arrayBuffer() {
|
1625 | return __awaiter(this, void 0, void 0, function* () {
|
1626 | return __classPrivateFieldGet(this, _HttpResponse_uRes, "f").arrayBuffer();
|
1627 | });
|
1628 | }
|
1629 | blob() {
|
1630 | return __awaiter(this, void 0, void 0, function* () {
|
1631 | return __classPrivateFieldGet(this, _HttpResponse_uRes, "f").blob();
|
1632 | });
|
1633 | }
|
1634 | formData() {
|
1635 | return __awaiter(this, void 0, void 0, function* () {
|
1636 | return __classPrivateFieldGet(this, _HttpResponse_uRes, "f").formData();
|
1637 | });
|
1638 | }
|
1639 | json() {
|
1640 | return __awaiter(this, void 0, void 0, function* () {
|
1641 | return __classPrivateFieldGet(this, _HttpResponse_uRes, "f").json();
|
1642 | });
|
1643 | }
|
1644 | text() {
|
1645 | return __awaiter(this, void 0, void 0, function* () {
|
1646 | return __classPrivateFieldGet(this, _HttpResponse_uRes, "f").text();
|
1647 | });
|
1648 | }
|
1649 | }
|
1650 | exports.HttpResponse = HttpResponse;
|
1651 | _HttpResponse_uRes = new WeakMap();
|
1652 |
|
1653 |
|
1654 | }),
|
1655 |
|
1656 | "./src/http/extractHttpUserFromHeaders.ts":
|
1657 |
|
1658 |
|
1659 |
|
1660 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
1661 |
|
1662 |
|
1663 |
|
1664 |
|
1665 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
1666 | exports.extractHttpUserFromHeaders = void 0;
|
1667 | const nonNull_1 = __webpack_require__( "./src/utils/nonNull.ts");
|
1668 |
|
1669 |
|
1670 | function extractHttpUserFromHeaders(headers) {
|
1671 | let user = null;
|
1672 | const clientPrincipal = headers.get('x-ms-client-principal');
|
1673 | if (clientPrincipal) {
|
1674 | const claimsPrincipalData = JSON.parse(Buffer.from(clientPrincipal, 'base64').toString('utf-8'));
|
1675 | if (claimsPrincipalData['identityProvider']) {
|
1676 | user = {
|
1677 | type: 'StaticWebApps',
|
1678 | id: claimsPrincipalData['userId'],
|
1679 | username: claimsPrincipalData['userDetails'],
|
1680 | identityProvider: claimsPrincipalData['identityProvider'],
|
1681 | claimsPrincipalData,
|
1682 | };
|
1683 | }
|
1684 | else {
|
1685 | user = {
|
1686 | type: 'AppService',
|
1687 | id: (0, nonNull_1.nonNullValue)(headers.get('x-ms-client-principal-id'), 'user-id'),
|
1688 | username: (0, nonNull_1.nonNullValue)(headers.get('x-ms-client-principal-name'), 'user-name'),
|
1689 | identityProvider: (0, nonNull_1.nonNullValue)(headers.get('x-ms-client-principal-idp'), 'user-idp'),
|
1690 | claimsPrincipalData,
|
1691 | };
|
1692 | }
|
1693 | }
|
1694 | return user;
|
1695 | }
|
1696 | exports.extractHttpUserFromHeaders = extractHttpUserFromHeaders;
|
1697 |
|
1698 |
|
1699 | }),
|
1700 |
|
1701 | "./src/input.ts":
|
1702 |
|
1703 |
|
1704 |
|
1705 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
1706 |
|
1707 |
|
1708 |
|
1709 |
|
1710 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
1711 | exports.generic = exports.sql = exports.cosmosDB = exports.table = exports.storageBlob = void 0;
|
1712 | const addBindingName_1 = __webpack_require__( "./src/addBindingName.ts");
|
1713 | function storageBlob(options) {
|
1714 | return addInputBindingName(Object.assign(Object.assign({}, options), { type: 'blob' }));
|
1715 | }
|
1716 | exports.storageBlob = storageBlob;
|
1717 | function table(options) {
|
1718 | return addInputBindingName(Object.assign(Object.assign({}, options), { type: 'table' }));
|
1719 | }
|
1720 | exports.table = table;
|
1721 | function cosmosDB(options) {
|
1722 | return addInputBindingName(Object.assign(Object.assign({}, options), { type: 'cosmosDB' }));
|
1723 | }
|
1724 | exports.cosmosDB = cosmosDB;
|
1725 | function sql(options) {
|
1726 | return addInputBindingName(Object.assign(Object.assign({}, options), { type: 'sql' }));
|
1727 | }
|
1728 | exports.sql = sql;
|
1729 | function generic(options) {
|
1730 | return addInputBindingName(options);
|
1731 | }
|
1732 | exports.generic = generic;
|
1733 | function addInputBindingName(binding) {
|
1734 | return (0, addBindingName_1.addBindingName)(binding, 'Input');
|
1735 | }
|
1736 |
|
1737 |
|
1738 | }),
|
1739 |
|
1740 | "./src/output.ts":
|
1741 |
|
1742 |
|
1743 |
|
1744 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
1745 |
|
1746 |
|
1747 |
|
1748 |
|
1749 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
1750 | exports.generic = exports.sql = exports.cosmosDB = exports.eventGrid = exports.eventHub = exports.serviceBusTopic = exports.serviceBusQueue = exports.storageQueue = exports.table = exports.storageBlob = exports.http = void 0;
|
1751 | const addBindingName_1 = __webpack_require__( "./src/addBindingName.ts");
|
1752 | function http(options) {
|
1753 | return addOutputBindingName(Object.assign(Object.assign({}, options), { type: 'http' }));
|
1754 | }
|
1755 | exports.http = http;
|
1756 | function storageBlob(options) {
|
1757 | return addOutputBindingName(Object.assign(Object.assign({}, options), { type: 'blob' }));
|
1758 | }
|
1759 | exports.storageBlob = storageBlob;
|
1760 | function table(options) {
|
1761 | return addOutputBindingName(Object.assign(Object.assign({}, options), { type: 'table' }));
|
1762 | }
|
1763 | exports.table = table;
|
1764 | function storageQueue(options) {
|
1765 | return addOutputBindingName(Object.assign(Object.assign({}, options), { type: 'queue' }));
|
1766 | }
|
1767 | exports.storageQueue = storageQueue;
|
1768 | function serviceBusQueue(options) {
|
1769 | return addOutputBindingName(Object.assign(Object.assign({}, options), { type: 'serviceBus' }));
|
1770 | }
|
1771 | exports.serviceBusQueue = serviceBusQueue;
|
1772 | function serviceBusTopic(options) {
|
1773 | return addOutputBindingName(Object.assign(Object.assign({}, options), { type: 'serviceBus' }));
|
1774 | }
|
1775 | exports.serviceBusTopic = serviceBusTopic;
|
1776 | function eventHub(options) {
|
1777 | return addOutputBindingName(Object.assign(Object.assign({}, options), { type: 'eventHub' }));
|
1778 | }
|
1779 | exports.eventHub = eventHub;
|
1780 | function eventGrid(options) {
|
1781 | return addOutputBindingName(Object.assign(Object.assign({}, options), { type: 'eventGrid' }));
|
1782 | }
|
1783 | exports.eventGrid = eventGrid;
|
1784 | function cosmosDB(options) {
|
1785 | return addOutputBindingName(Object.assign(Object.assign({}, options), { type: 'cosmosDB' }));
|
1786 | }
|
1787 | exports.cosmosDB = cosmosDB;
|
1788 | function sql(options) {
|
1789 | return addOutputBindingName(Object.assign(Object.assign({}, options), { type: 'sql' }));
|
1790 | }
|
1791 | exports.sql = sql;
|
1792 | function generic(options) {
|
1793 | return addOutputBindingName(options);
|
1794 | }
|
1795 | exports.generic = generic;
|
1796 | function addOutputBindingName(binding) {
|
1797 | return (0, addBindingName_1.addBindingName)(binding, 'Output');
|
1798 | }
|
1799 |
|
1800 |
|
1801 | }),
|
1802 |
|
1803 | "./src/trigger.ts":
|
1804 |
|
1805 |
|
1806 |
|
1807 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
1808 |
|
1809 |
|
1810 |
|
1811 |
|
1812 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
1813 | exports.generic = exports.warmup = exports.cosmosDB = exports.eventGrid = exports.eventHub = exports.serviceBusTopic = exports.serviceBusQueue = exports.storageQueue = exports.storageBlob = exports.timer = exports.http = void 0;
|
1814 | const addBindingName_1 = __webpack_require__( "./src/addBindingName.ts");
|
1815 | function http(options) {
|
1816 | return addTriggerBindingName(Object.assign(Object.assign({}, options), { authLevel: options.authLevel || 'anonymous', methods: options.methods || ['GET', 'POST'], type: 'httpTrigger' }));
|
1817 | }
|
1818 | exports.http = http;
|
1819 | function timer(options) {
|
1820 | return addTriggerBindingName(Object.assign(Object.assign({}, options), { type: 'timerTrigger' }));
|
1821 | }
|
1822 | exports.timer = timer;
|
1823 | function storageBlob(options) {
|
1824 | return addTriggerBindingName(Object.assign(Object.assign({}, options), { type: 'blobTrigger' }));
|
1825 | }
|
1826 | exports.storageBlob = storageBlob;
|
1827 | function storageQueue(options) {
|
1828 | return addTriggerBindingName(Object.assign(Object.assign({}, options), { type: 'queueTrigger' }));
|
1829 | }
|
1830 | exports.storageQueue = storageQueue;
|
1831 | function serviceBusQueue(options) {
|
1832 | return addTriggerBindingName(Object.assign(Object.assign({}, options), { type: 'serviceBusTrigger' }));
|
1833 | }
|
1834 | exports.serviceBusQueue = serviceBusQueue;
|
1835 | function serviceBusTopic(options) {
|
1836 | return addTriggerBindingName(Object.assign(Object.assign({}, options), { type: 'serviceBusTrigger' }));
|
1837 | }
|
1838 | exports.serviceBusTopic = serviceBusTopic;
|
1839 | function eventHub(options) {
|
1840 | return addTriggerBindingName(Object.assign(Object.assign({}, options), { type: 'eventHubTrigger' }));
|
1841 | }
|
1842 | exports.eventHub = eventHub;
|
1843 | function eventGrid(options) {
|
1844 | return addTriggerBindingName(Object.assign(Object.assign({}, options), { type: 'eventGridTrigger' }));
|
1845 | }
|
1846 | exports.eventGrid = eventGrid;
|
1847 | function cosmosDB(options) {
|
1848 | return addTriggerBindingName(Object.assign(Object.assign({}, options), { type: 'cosmosDBTrigger' }));
|
1849 | }
|
1850 | exports.cosmosDB = cosmosDB;
|
1851 | function warmup(options) {
|
1852 | return addTriggerBindingName(Object.assign(Object.assign({}, options), { type: 'warmupTrigger' }));
|
1853 | }
|
1854 | exports.warmup = warmup;
|
1855 | function generic(options) {
|
1856 | return addTriggerBindingName(options);
|
1857 | }
|
1858 | exports.generic = generic;
|
1859 | function addTriggerBindingName(binding) {
|
1860 | return (0, addBindingName_1.addBindingName)(binding, 'Trigger');
|
1861 | }
|
1862 |
|
1863 |
|
1864 | }),
|
1865 |
|
1866 | "./src/utils/Disposable.ts":
|
1867 |
|
1868 |
|
1869 |
|
1870 | (function(__unused_webpack_module, exports) {
|
1871 |
|
1872 |
|
1873 |
|
1874 |
|
1875 | var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
1876 | if (kind === "m") throw new TypeError("Private method is not writable");
|
1877 | if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
1878 | if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
1879 | return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
1880 | };
|
1881 | var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
1882 | if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
1883 | if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
1884 | return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
1885 | };
|
1886 | var _Disposable_callOnDispose;
|
1887 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
1888 | exports.Disposable = void 0;
|
1889 |
|
1890 |
|
1891 |
|
1892 |
|
1893 | class Disposable {
|
1894 | constructor(callOnDispose) {
|
1895 | _Disposable_callOnDispose.set(this, void 0);
|
1896 | __classPrivateFieldSet(this, _Disposable_callOnDispose, callOnDispose, "f");
|
1897 | }
|
1898 | static from(...inDisposables) {
|
1899 | let disposables = inDisposables;
|
1900 | return new Disposable(function () {
|
1901 | if (disposables) {
|
1902 | for (const disposable of disposables) {
|
1903 | if (disposable && typeof disposable.dispose === 'function') {
|
1904 | disposable.dispose();
|
1905 | }
|
1906 | }
|
1907 | disposables = undefined;
|
1908 | }
|
1909 | });
|
1910 | }
|
1911 | dispose() {
|
1912 | if (typeof __classPrivateFieldGet(this, _Disposable_callOnDispose, "f") === 'function') {
|
1913 | __classPrivateFieldGet(this, _Disposable_callOnDispose, "f").call(this);
|
1914 | __classPrivateFieldSet(this, _Disposable_callOnDispose, undefined, "f");
|
1915 | }
|
1916 | }
|
1917 | }
|
1918 | exports.Disposable = Disposable;
|
1919 | _Disposable_callOnDispose = new WeakMap();
|
1920 |
|
1921 |
|
1922 | }),
|
1923 |
|
1924 | "./src/utils/isTrigger.ts":
|
1925 |
|
1926 |
|
1927 |
|
1928 | ((__unused_webpack_module, exports) => {
|
1929 |
|
1930 |
|
1931 |
|
1932 |
|
1933 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
1934 | exports.isTimerTrigger = exports.isHttpTrigger = exports.isTrigger = void 0;
|
1935 | function isTrigger(typeName) {
|
1936 | return !!typeName && /trigger$/i.test(typeName);
|
1937 | }
|
1938 | exports.isTrigger = isTrigger;
|
1939 | function isHttpTrigger(typeName) {
|
1940 | return (typeName === null || typeName === void 0 ? void 0 : typeName.toLowerCase()) === 'httptrigger';
|
1941 | }
|
1942 | exports.isHttpTrigger = isHttpTrigger;
|
1943 | function isTimerTrigger(typeName) {
|
1944 | return (typeName === null || typeName === void 0 ? void 0 : typeName.toLowerCase()) === 'timertrigger';
|
1945 | }
|
1946 | exports.isTimerTrigger = isTimerTrigger;
|
1947 |
|
1948 |
|
1949 | }),
|
1950 |
|
1951 | "./src/utils/nonNull.ts":
|
1952 |
|
1953 |
|
1954 |
|
1955 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
1956 |
|
1957 |
|
1958 |
|
1959 |
|
1960 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
1961 | exports.isDefined = exports.copyPropIfDefined = exports.nonNullValue = exports.nonNullProp = void 0;
|
1962 | const errors_1 = __webpack_require__( "./src/errors.ts");
|
1963 |
|
1964 |
|
1965 |
|
1966 |
|
1967 | function nonNullProp(source, name) {
|
1968 | const value = source[name];
|
1969 | return nonNullValue(value, name);
|
1970 | }
|
1971 | exports.nonNullProp = nonNullProp;
|
1972 |
|
1973 |
|
1974 |
|
1975 | function nonNullValue(value, propertyNameOrMessage) {
|
1976 | if (value === null || value === undefined) {
|
1977 | throw new errors_1.AzFuncSystemError('Internal error: Expected value to be neither null nor undefined' +
|
1978 | (propertyNameOrMessage ? `: ${propertyNameOrMessage}` : ''));
|
1979 | }
|
1980 | return value;
|
1981 | }
|
1982 | exports.nonNullValue = nonNullValue;
|
1983 | function copyPropIfDefined(source, destination, key) {
|
1984 | if (source[key] !== null && source[key] !== undefined) {
|
1985 | destination[key] = source[key];
|
1986 | }
|
1987 | }
|
1988 | exports.copyPropIfDefined = copyPropIfDefined;
|
1989 | function isDefined(data) {
|
1990 | return data !== null && data !== undefined;
|
1991 | }
|
1992 | exports.isDefined = isDefined;
|
1993 |
|
1994 |
|
1995 | }),
|
1996 |
|
1997 | "./src/utils/tryGetCoreApiLazy.ts":
|
1998 |
|
1999 |
|
2000 |
|
2001 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
2002 |
|
2003 |
|
2004 |
|
2005 |
|
2006 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
2007 | exports.tryGetCoreApiLazy = void 0;
|
2008 | let coreApi;
|
2009 | function tryGetCoreApiLazy() {
|
2010 | if (coreApi === undefined) {
|
2011 | try {
|
2012 |
|
2013 | coreApi = __webpack_require__( "@azure/functions-core");
|
2014 | }
|
2015 | catch (_a) {
|
2016 | coreApi = null;
|
2017 | }
|
2018 | }
|
2019 | return coreApi;
|
2020 | }
|
2021 | exports.tryGetCoreApiLazy = tryGetCoreApiLazy;
|
2022 |
|
2023 |
|
2024 | }),
|
2025 |
|
2026 | "@azure/functions-core":
|
2027 |
|
2028 |
|
2029 |
|
2030 | ((module) => {
|
2031 |
|
2032 | module.exports = require("@azure/functions-core");
|
2033 |
|
2034 | }),
|
2035 |
|
2036 | "undici":
|
2037 |
|
2038 |
|
2039 |
|
2040 | ((module) => {
|
2041 |
|
2042 | module.exports = require("undici");
|
2043 |
|
2044 | }),
|
2045 |
|
2046 | "url":
|
2047 |
|
2048 |
|
2049 |
|
2050 | ((module) => {
|
2051 |
|
2052 | module.exports = require("url");
|
2053 |
|
2054 | }),
|
2055 |
|
2056 | "util":
|
2057 |
|
2058 |
|
2059 |
|
2060 | ((module) => {
|
2061 |
|
2062 | module.exports = require("util");
|
2063 |
|
2064 | })
|
2065 |
|
2066 | });
|
2067 |
|
2068 |
|
2069 | var __webpack_module_cache__ = {};
|
2070 |
|
2071 |
|
2072 | function __webpack_require__(moduleId) {
|
2073 |
|
2074 | var cachedModule = __webpack_module_cache__[moduleId];
|
2075 | if (cachedModule !== undefined) {
|
2076 | return cachedModule.exports;
|
2077 | }
|
2078 |
|
2079 | var module = __webpack_module_cache__[moduleId] = {
|
2080 |
|
2081 |
|
2082 | exports: {}
|
2083 | };
|
2084 |
|
2085 |
|
2086 | __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
2087 |
|
2088 |
|
2089 | return module.exports;
|
2090 | }
|
2091 |
|
2092 |
|
2093 | var __webpack_exports__ = {};
|
2094 |
|
2095 | (() => {
|
2096 | var exports = __webpack_exports__;
|
2097 |
|
2098 |
|
2099 |
|
2100 |
|
2101 |
|
2102 |
|
2103 | Object.defineProperty(exports, "__esModule", ({ value: true }));
|
2104 | exports.Disposable = exports.trigger = exports.output = exports.InvocationContext = exports.input = exports.HttpResponse = exports.HttpRequest = exports.PreInvocationContext = exports.PostInvocationContext = exports.InvocationHookContext = exports.HookContext = exports.AppTerminateContext = exports.AppStartContext = exports.app = void 0;
|
2105 | exports.app = __webpack_require__( "./src/app.ts");
|
2106 | var AppStartContext_1 = __webpack_require__( "./src/hooks/AppStartContext.ts");
|
2107 | Object.defineProperty(exports, "AppStartContext", ({ enumerable: true, get: function () { return AppStartContext_1.AppStartContext; } }));
|
2108 | var AppTerminateContext_1 = __webpack_require__( "./src/hooks/AppTerminateContext.ts");
|
2109 | Object.defineProperty(exports, "AppTerminateContext", ({ enumerable: true, get: function () { return AppTerminateContext_1.AppTerminateContext; } }));
|
2110 | var HookContext_1 = __webpack_require__( "./src/hooks/HookContext.ts");
|
2111 | Object.defineProperty(exports, "HookContext", ({ enumerable: true, get: function () { return HookContext_1.HookContext; } }));
|
2112 | var InvocationHookContext_1 = __webpack_require__( "./src/hooks/InvocationHookContext.ts");
|
2113 | Object.defineProperty(exports, "InvocationHookContext", ({ enumerable: true, get: function () { return InvocationHookContext_1.InvocationHookContext; } }));
|
2114 | var PostInvocationContext_1 = __webpack_require__( "./src/hooks/PostInvocationContext.ts");
|
2115 | Object.defineProperty(exports, "PostInvocationContext", ({ enumerable: true, get: function () { return PostInvocationContext_1.PostInvocationContext; } }));
|
2116 | var PreInvocationContext_1 = __webpack_require__( "./src/hooks/PreInvocationContext.ts");
|
2117 | Object.defineProperty(exports, "PreInvocationContext", ({ enumerable: true, get: function () { return PreInvocationContext_1.PreInvocationContext; } }));
|
2118 | var HttpRequest_1 = __webpack_require__( "./src/http/HttpRequest.ts");
|
2119 | Object.defineProperty(exports, "HttpRequest", ({ enumerable: true, get: function () { return HttpRequest_1.HttpRequest; } }));
|
2120 | var HttpResponse_1 = __webpack_require__( "./src/http/HttpResponse.ts");
|
2121 | Object.defineProperty(exports, "HttpResponse", ({ enumerable: true, get: function () { return HttpResponse_1.HttpResponse; } }));
|
2122 | exports.input = __webpack_require__( "./src/input.ts");
|
2123 | var InvocationContext_1 = __webpack_require__( "./src/InvocationContext.ts");
|
2124 | Object.defineProperty(exports, "InvocationContext", ({ enumerable: true, get: function () { return InvocationContext_1.InvocationContext; } }));
|
2125 | exports.output = __webpack_require__( "./src/output.ts");
|
2126 | exports.trigger = __webpack_require__( "./src/trigger.ts");
|
2127 | var Disposable_1 = __webpack_require__( "./src/utils/Disposable.ts");
|
2128 | Object.defineProperty(exports, "Disposable", ({ enumerable: true, get: function () { return Disposable_1.Disposable; } }));
|
2129 |
|
2130 | })();
|
2131 |
|
2132 | module.exports = __webpack_exports__;
|
2133 | })()
|
2134 | ;
|
2135 |
|
\ | No newline at end of file |