UNPKG

99.2 kBJavaScriptView Raw
1/******/ (() => { // webpackBootstrap
2/******/ "use strict";
3/******/ var __webpack_modules__ = ({
4
5/***/ "./src/InvocationContext.ts":
6/*!**********************************!*\
7 !*** ./src/InvocationContext.ts ***!
8 \**********************************/
9/***/ (function(__unused_webpack_module, exports) {
10
11
12// Copyright (c) .NET Foundation. All rights reserved.
13// Licensed under the MIT License.
14var __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};
20var __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};
25var _InvocationContext_userLogHandler, _InvocationContextExtraInputs_inputs, _InvocationContextExtraOutputs_outputs;
26Object.defineProperty(exports, "__esModule", ({ value: true }));
27exports.InvocationContext = void 0;
28class 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}
71exports.InvocationContext = InvocationContext;
72_InvocationContext_userLogHandler = new WeakMap();
73class 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();
87class 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();
101function 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 !*** ./src/InvocationModel.ts ***!
130 \********************************/
131/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
132
133
134// Copyright (c) .NET Foundation. All rights reserved.
135// Licensed under the MIT License.
136var __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};
145var __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};
151var __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};
156var _InvocationModel_instances, _InvocationModel_isDone, _InvocationModel_coreCtx, _InvocationModel_functionName, _InvocationModel_bindings, _InvocationModel_triggerType, _InvocationModel_convertOutput, _InvocationModel_log, _InvocationModel_systemLog, _InvocationModel_userLog;
157Object.defineProperty(exports, "__esModule", ({ value: true }));
158exports.InvocationModel = void 0;
159const util_1 = __webpack_require__(/*! util */ "util");
160const constants_1 = __webpack_require__(/*! ./constants */ "./src/constants.ts");
161const fromRpcBindings_1 = __webpack_require__(/*! ./converters/fromRpcBindings */ "./src/converters/fromRpcBindings.ts");
162const fromRpcContext_1 = __webpack_require__(/*! ./converters/fromRpcContext */ "./src/converters/fromRpcContext.ts");
163const fromRpcTriggerMetadata_1 = __webpack_require__(/*! ./converters/fromRpcTriggerMetadata */ "./src/converters/fromRpcTriggerMetadata.ts");
164const fromRpcTypedData_1 = __webpack_require__(/*! ./converters/fromRpcTypedData */ "./src/converters/fromRpcTypedData.ts");
165const toCamelCase_1 = __webpack_require__(/*! ./converters/toCamelCase */ "./src/converters/toCamelCase.ts");
166const toRpcHttp_1 = __webpack_require__(/*! ./converters/toRpcHttp */ "./src/converters/toRpcHttp.ts");
167const toRpcTypedData_1 = __webpack_require__(/*! ./converters/toRpcTypedData */ "./src/converters/toRpcTypedData.ts");
168const InvocationContext_1 = __webpack_require__(/*! ./InvocationContext */ "./src/InvocationContext.ts");
169const isTrigger_1 = __webpack_require__(/*! ./utils/isTrigger */ "./src/utils/isTrigger.ts");
170const nonNull_1 = __webpack_require__(/*! ./utils/nonNull */ "./src/utils/nonNull.ts");
171class 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 // eslint-disable-next-line @typescript-eslint/require-await
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 // This allows the return value of non-HTTP triggered functions to be passed back
248 // to the host, even if no explicit output binding is set. In most cases, this is ignored,
249 // but e.g., Durable uses this to pass orchestrator state back to the Durable extension, w/o
250 // an explicit output binding. See here for more details: https://github.com/Azure/azure-functions-nodejs-library/pull/25
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}
258exports.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 !*** ./src/addBindingName.ts ***!
288 \*******************************/
289/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
290
291
292// Copyright (c) .NET Foundation. All rights reserved.
293// Licensed under the MIT License.
294Object.defineProperty(exports, "__esModule", ({ value: true }));
295exports.addBindingName = exports.InvocationContext = exports.HttpResponse = exports.HttpRequest = void 0;
296var HttpRequest_1 = __webpack_require__(/*! ./http/HttpRequest */ "./src/http/HttpRequest.ts");
297Object.defineProperty(exports, "HttpRequest", ({ enumerable: true, get: function () { return HttpRequest_1.HttpRequest; } }));
298var HttpResponse_1 = __webpack_require__(/*! ./http/HttpResponse */ "./src/http/HttpResponse.ts");
299Object.defineProperty(exports, "HttpResponse", ({ enumerable: true, get: function () { return HttpResponse_1.HttpResponse; } }));
300var InvocationContext_1 = __webpack_require__(/*! ./InvocationContext */ "./src/InvocationContext.ts");
301Object.defineProperty(exports, "InvocationContext", ({ enumerable: true, get: function () { return InvocationContext_1.InvocationContext; } }));
302const bindingCounts = {};
303/**
304 * If the host spawns multiple workers, it expects the metadata (including binding name) to be the same across workers.
305 * That means we need to generate binding names in a deterministic fashion, so we'll do that using a count
306 * There's a tiny risk users register bindings in a non-deterministic order (i.e. async race conditions), but it's okay considering the following:
307 * 1. We will track the count individually for each binding type. This makes the names more readable and reduces the chances a race condition will matter
308 * 2. Users can manually specify the name themselves (aka if they're doing weird async stuff) and we will respect that
309 * More info here: https://github.com/Azure/azure-functions-nodejs-worker/issues/638
310 */
311function 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}
324exports.addBindingName = addBindingName;
325
326
327/***/ }),
328
329/***/ "./src/app.ts":
330/*!********************!*\
331 !*** ./src/app.ts ***!
332 \********************/
333/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
334
335
336// Copyright (c) .NET Foundation. All rights reserved.
337// Licensed under the MIT License.
338var __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};
349Object.defineProperty(exports, "__esModule", ({ value: true }));
350exports.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;
351const constants_1 = __webpack_require__(/*! ./constants */ "./src/constants.ts");
352const toRpcDuration_1 = __webpack_require__(/*! ./converters/toRpcDuration */ "./src/converters/toRpcDuration.ts");
353const InvocationModel_1 = __webpack_require__(/*! ./InvocationModel */ "./src/InvocationModel.ts");
354const output = __webpack_require__(/*! ./output */ "./src/output.ts");
355const trigger = __webpack_require__(/*! ./trigger */ "./src/trigger.ts");
356const isTrigger_1 = __webpack_require__(/*! ./utils/isTrigger */ "./src/utils/isTrigger.ts");
357const tryGetCoreApiLazy_1 = __webpack_require__(/*! ./utils/tryGetCoreApiLazy */ "./src/utils/tryGetCoreApiLazy.ts");
358exports.hook = __webpack_require__(/*! ./hooks/registerHook */ "./src/hooks/registerHook.ts");
359class 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}
368let hasSetup = false;
369function 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}
379function convertToHttpOptions(optionsOrHandler, method) {
380 const options = typeof optionsOrHandler === 'function' ? { handler: optionsOrHandler } : optionsOrHandler;
381 options.methods = [method];
382 return options;
383}
384function 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}
394function get(name, optionsOrHandler) {
395 http(name, convertToHttpOptions(optionsOrHandler, 'GET'));
396}
397exports.get = get;
398function put(name, optionsOrHandler) {
399 http(name, convertToHttpOptions(optionsOrHandler, 'PUT'));
400}
401exports.put = put;
402function post(name, optionsOrHandler) {
403 http(name, convertToHttpOptions(optionsOrHandler, 'POST'));
404}
405exports.post = post;
406function patch(name, optionsOrHandler) {
407 http(name, convertToHttpOptions(optionsOrHandler, 'PATCH'));
408}
409exports.patch = patch;
410function deleteRequest(name, optionsOrHandler) {
411 http(name, convertToHttpOptions(optionsOrHandler, 'DELETE'));
412}
413exports.deleteRequest = deleteRequest;
414function http(name, options) {
415 options.return || (options.return = output.http({}));
416 generic(name, convertToGenericOptions(options, trigger.http));
417}
418exports.http = http;
419function timer(name, options) {
420 generic(name, convertToGenericOptions(options, trigger.timer));
421}
422exports.timer = timer;
423function storageBlob(name, options) {
424 generic(name, convertToGenericOptions(options, trigger.storageBlob));
425}
426exports.storageBlob = storageBlob;
427function storageQueue(name, options) {
428 generic(name, convertToGenericOptions(options, trigger.storageQueue));
429}
430exports.storageQueue = storageQueue;
431function serviceBusQueue(name, options) {
432 generic(name, convertToGenericOptions(options, trigger.serviceBusQueue));
433}
434exports.serviceBusQueue = serviceBusQueue;
435function serviceBusTopic(name, options) {
436 generic(name, convertToGenericOptions(options, trigger.serviceBusTopic));
437}
438exports.serviceBusTopic = serviceBusTopic;
439function eventHub(name, options) {
440 generic(name, convertToGenericOptions(options, trigger.eventHub));
441}
442exports.eventHub = eventHub;
443function eventGrid(name, options) {
444 generic(name, convertToGenericOptions(options, trigger.eventGrid));
445}
446exports.eventGrid = eventGrid;
447function cosmosDB(name, options) {
448 // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
449 generic(name, convertToGenericOptions(options, trigger.cosmosDB));
450}
451exports.cosmosDB = cosmosDB;
452function warmup(name, options) {
453 generic(name, convertToGenericOptions(options, trigger.warmup));
454}
455exports.warmup = warmup;
456function 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}
488exports.generic = generic;
489
490
491/***/ }),
492
493/***/ "./src/constants.ts":
494/*!**************************!*\
495 !*** ./src/constants.ts ***!
496 \**************************/
497/***/ ((__unused_webpack_module, exports) => {
498
499
500// Copyright (c) .NET Foundation. All rights reserved.
501// Licensed under the MIT License.
502Object.defineProperty(exports, "__esModule", ({ value: true }));
503exports.returnBindingKey = exports.version = void 0;
504exports.version = '4.1.0';
505exports.returnBindingKey = '$return';
506
507
508/***/ }),
509
510/***/ "./src/converters/fromRpcBindings.ts":
511/*!*******************************************!*\
512 !*** ./src/converters/fromRpcBindings.ts ***!
513 \*******************************************/
514/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
515
516
517// Copyright (c) .NET Foundation. All rights reserved.
518// Licensed under the MIT License.
519Object.defineProperty(exports, "__esModule", ({ value: true }));
520exports.fromRpcBindings = void 0;
521const constants_1 = __webpack_require__(/*! ../constants */ "./src/constants.ts");
522const isTrigger_1 = __webpack_require__(/*! ../utils/isTrigger */ "./src/utils/isTrigger.ts");
523const nonNull_1 = __webpack_require__(/*! ../utils/nonNull */ "./src/utils/nonNull.ts");
524function 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}
550exports.fromRpcBindings = fromRpcBindings;
551function 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 !*** ./src/converters/fromRpcContext.ts ***!
561 \******************************************/
562/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
563
564
565// Copyright (c) .NET Foundation. All rights reserved.
566// Licensed under the MIT License.
567Object.defineProperty(exports, "__esModule", ({ value: true }));
568exports.fromRpcTraceContext = exports.fromRpcRetryContext = void 0;
569const nonNull_1 = __webpack_require__(/*! ../utils/nonNull */ "./src/utils/nonNull.ts");
570function 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}
585exports.fromRpcRetryContext = fromRpcRetryContext;
586function 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}
593function 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}
607exports.fromRpcTraceContext = fromRpcTraceContext;
608
609
610/***/ }),
611
612/***/ "./src/converters/fromRpcNullable.ts":
613/*!*******************************************!*\
614 !*** ./src/converters/fromRpcNullable.ts ***!
615 \*******************************************/
616/***/ ((__unused_webpack_module, exports) => {
617
618
619// Copyright (c) .NET Foundation. All rights reserved.
620// Licensed under the MIT License.
621Object.defineProperty(exports, "__esModule", ({ value: true }));
622exports.fromNullableMapping = void 0;
623function 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}
635exports.fromNullableMapping = fromNullableMapping;
636
637
638/***/ }),
639
640/***/ "./src/converters/fromRpcTriggerMetadata.ts":
641/*!**************************************************!*\
642 !*** ./src/converters/fromRpcTriggerMetadata.ts ***!
643 \**************************************************/
644/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
645
646
647// Copyright (c) .NET Foundation. All rights reserved.
648// Licensed under the MIT License.
649Object.defineProperty(exports, "__esModule", ({ value: true }));
650exports.fromRpcTriggerMetadata = void 0;
651const isTrigger_1 = __webpack_require__(/*! ../utils/isTrigger */ "./src/utils/isTrigger.ts");
652const fromRpcTypedData_1 = __webpack_require__(/*! ./fromRpcTypedData */ "./src/converters/fromRpcTypedData.ts");
653const toCamelCase_1 = __webpack_require__(/*! ./toCamelCase */ "./src/converters/toCamelCase.ts");
654function fromRpcTriggerMetadata(triggerMetadata, triggerType) {
655 // For http and timer triggers, we will avoid using `triggerMetadata` for a few reasons:
656 // 1. It uses `toCamelCase` methods, which can lead to weird casing bugs
657 // 2. It's generally a large medley of properties that is difficult for us to document/type
658 // 3. We can represent that information on the request & timer objects instead
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}
670exports.fromRpcTriggerMetadata = fromRpcTriggerMetadata;
671
672
673/***/ }),
674
675/***/ "./src/converters/fromRpcTypedData.ts":
676/*!********************************************!*\
677 !*** ./src/converters/fromRpcTypedData.ts ***!
678 \********************************************/
679/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
680
681
682// Copyright (c) .NET Foundation. All rights reserved.
683// Licensed under the MIT License.
684Object.defineProperty(exports, "__esModule", ({ value: true }));
685exports.fromRpcTypedData = void 0;
686const HttpRequest_1 = __webpack_require__(/*! ../http/HttpRequest */ "./src/http/HttpRequest.ts");
687const nonNull_1 = __webpack_require__(/*! ../utils/nonNull */ "./src/utils/nonNull.ts");
688function 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}
729exports.fromRpcTypedData = fromRpcTypedData;
730function 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 !*** ./src/converters/toCamelCase.ts ***!
745 \***************************************/
746/***/ ((__unused_webpack_module, exports) => {
747
748
749// Copyright (c) .NET Foundation. All rights reserved.
750// Licensed under the MIT License.
751Object.defineProperty(exports, "__esModule", ({ value: true }));
752exports.toCamelCaseKey = exports.toCamelCaseValue = void 0;
753function 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}
768exports.toCamelCaseValue = toCamelCaseValue;
769function toCamelCaseKey(key) {
770 return key.charAt(0).toLowerCase() + key.slice(1);
771}
772exports.toCamelCaseKey = toCamelCaseKey;
773
774
775/***/ }),
776
777/***/ "./src/converters/toRpcDuration.ts":
778/*!*****************************************!*\
779 !*** ./src/converters/toRpcDuration.ts ***!
780 \*****************************************/
781/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
782
783
784// Copyright (c) .NET Foundation. All rights reserved.
785// Licensed under the MIT License.
786Object.defineProperty(exports, "__esModule", ({ value: true }));
787exports.toRpcDuration = void 0;
788const errors_1 = __webpack_require__(/*! ../errors */ "./src/errors.ts");
789const nonNull_1 = __webpack_require__(/*! ../utils/nonNull */ "./src/utils/nonNull.ts");
790function 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 // fall through
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}
815exports.toRpcDuration = toRpcDuration;
816
817
818/***/ }),
819
820/***/ "./src/converters/toRpcHttp.ts":
821/*!*************************************!*\
822 !*** ./src/converters/toRpcHttp.ts ***!
823 \*************************************/
824/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
825
826
827// Copyright (c) .NET Foundation. All rights reserved.
828// Licensed under the MIT License.
829var __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};
838Object.defineProperty(exports, "__esModule", ({ value: true }));
839exports.toRpcHttp = void 0;
840const errors_1 = __webpack_require__(/*! ../errors */ "./src/errors.ts");
841const HttpResponse_1 = __webpack_require__(/*! ../http/HttpResponse */ "./src/http/HttpResponse.ts");
842const toRpcHttpCookie_1 = __webpack_require__(/*! ./toRpcHttpCookie */ "./src/converters/toRpcHttpCookie.ts");
843const toRpcTypedData_1 = __webpack_require__(/*! ./toRpcTypedData */ "./src/converters/toRpcTypedData.ts");
844function 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}
869exports.toRpcHttp = toRpcHttp;
870
871
872/***/ }),
873
874/***/ "./src/converters/toRpcHttpCookie.ts":
875/*!*******************************************!*\
876 !*** ./src/converters/toRpcHttpCookie.ts ***!
877 \*******************************************/
878/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
879
880
881// Copyright (c) .NET Foundation. All rights reserved.
882// Licensed under the MIT License.
883Object.defineProperty(exports, "__esModule", ({ value: true }));
884exports.toRpcHttpCookie = void 0;
885const toRpcNullable_1 = __webpack_require__(/*! ./toRpcNullable */ "./src/converters/toRpcNullable.ts");
886/**
887 * From RFC specifications for 'Set-Cookie' response header: https://www.rfc-editor.org/rfc/rfc6265.txt
888 * @param inputCookie
889 */
890function toRpcHttpCookie(inputCookie) {
891 // Resolve RpcHttpCookie.SameSite enum, a one-off
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}
918exports.toRpcHttpCookie = toRpcHttpCookie;
919
920
921/***/ }),
922
923/***/ "./src/converters/toRpcNullable.ts":
924/*!*****************************************!*\
925 !*** ./src/converters/toRpcNullable.ts ***!
926 \*****************************************/
927/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
928
929
930// Copyright (c) .NET Foundation. All rights reserved.
931// Licensed under the MIT License.
932Object.defineProperty(exports, "__esModule", ({ value: true }));
933exports.toNullableTimestamp = exports.toNullableString = exports.toRpcString = exports.toNullableDouble = exports.toNullableBool = void 0;
934const errors_1 = __webpack_require__(/*! ../errors */ "./src/errors.ts");
935const nonNull_1 = __webpack_require__(/*! ../utils/nonNull */ "./src/utils/nonNull.ts");
936/**
937 * Converts boolean input to an 'INullableBool' to be sent through the RPC layer.
938 * Input that is not a boolean but is also not null or undefined logs a function app level warning.
939 * @param nullable Input to be converted to an INullableBool if it is a valid boolean
940 * @param propertyName The name of the property that the caller will assign the output to. Used for debugging.
941 */
942function 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}
953exports.toNullableBool = toNullableBool;
954/**
955 * Converts number or string that parses to a number to an 'INullableDouble' to be sent through the RPC layer.
956 * Input that is not a valid number but is also not null or undefined logs a function app level warning.
957 * @param nullable Input to be converted to an INullableDouble if it is a valid number
958 * @param propertyName The name of the property that the caller will assign the output to. Used for debugging.
959 */
960function 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}
979exports.toNullableDouble = toNullableDouble;
980/**
981 * Converts string input to an 'INullableString' to be sent through the RPC layer.
982 * Input that is not a string but is also not null or undefined logs a function app level warning.
983 * @param nullable Input to be converted to an INullableString if it is a valid string
984 * @param propertyName The name of the property that the caller will assign the output to. Used for debugging.
985 */
986function 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}
995exports.toRpcString = toRpcString;
996/**
997 * Converts string input to an 'INullableString' to be sent through the RPC layer.
998 * Input that is not a string but is also not null or undefined logs a function app level warning.
999 * @param nullable Input to be converted to an INullableString if it is a valid string
1000 * @param propertyName The name of the property that the caller will assign the output to. Used for debugging.
1001 */
1002function 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}
1013exports.toNullableString = toNullableString;
1014/**
1015 * Converts Date or number input to an 'INullableTimestamp' to be sent through the RPC layer.
1016 * Input that is not a Date or number but is also not null or undefined logs a function app level warning.
1017 * @param nullable Input to be converted to an INullableTimestamp if it is valid input
1018 * @param propertyName The name of the property that the caller will assign the output to. Used for debugging.
1019 */
1020function 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}
1038exports.toNullableTimestamp = toNullableTimestamp;
1039
1040
1041/***/ }),
1042
1043/***/ "./src/converters/toRpcTypedData.ts":
1044/*!******************************************!*\
1045 !*** ./src/converters/toRpcTypedData.ts ***!
1046 \******************************************/
1047/***/ ((__unused_webpack_module, exports) => {
1048
1049
1050// Copyright (c) .NET Foundation. All rights reserved.
1051// Licensed under the MIT License.
1052Object.defineProperty(exports, "__esModule", ({ value: true }));
1053exports.toRpcTypedData = void 0;
1054function 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}
1084exports.toRpcTypedData = toRpcTypedData;
1085
1086
1087/***/ }),
1088
1089/***/ "./src/errors.ts":
1090/*!***********************!*\
1091 !*** ./src/errors.ts ***!
1092 \***********************/
1093/***/ ((__unused_webpack_module, exports) => {
1094
1095
1096// Copyright (c) .NET Foundation. All rights reserved.
1097// Licensed under the MIT License.
1098Object.defineProperty(exports, "__esModule", ({ value: true }));
1099exports.isError = exports.ensureErrorType = exports.ReadOnlyError = exports.AzFuncRangeError = exports.AzFuncTypeError = exports.AzFuncSystemError = void 0;
1100class AzFuncSystemError extends Error {
1101 constructor() {
1102 super(...arguments);
1103 this.isAzureFunctionsSystemError = true;
1104 }
1105}
1106exports.AzFuncSystemError = AzFuncSystemError;
1107class AzFuncTypeError extends TypeError {
1108 constructor() {
1109 super(...arguments);
1110 this.isAzureFunctionsSystemError = true;
1111 }
1112}
1113exports.AzFuncTypeError = AzFuncTypeError;
1114class AzFuncRangeError extends RangeError {
1115 constructor() {
1116 super(...arguments);
1117 this.isAzureFunctionsSystemError = true;
1118 }
1119}
1120exports.AzFuncRangeError = AzFuncRangeError;
1121class ReadOnlyError extends AzFuncTypeError {
1122 constructor(propertyName) {
1123 super(`Cannot assign to read only property '${propertyName}'`);
1124 }
1125}
1126exports.ReadOnlyError = ReadOnlyError;
1127function 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}
1148exports.ensureErrorType = ensureErrorType;
1149/**
1150 * This is mostly for callbacks where `null` or `undefined` indicates there is no error
1151 * By contrast, anything thrown/caught is assumed to be an error regardless of what it is
1152 */
1153function isError(err) {
1154 return err !== null && err !== undefined;
1155}
1156exports.isError = isError;
1157
1158
1159/***/ }),
1160
1161/***/ "./src/hooks/AppStartContext.ts":
1162/*!**************************************!*\
1163 !*** ./src/hooks/AppStartContext.ts ***!
1164 \**************************************/
1165/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1166
1167
1168// Copyright (c) .NET Foundation. All rights reserved.
1169// Licensed under the MIT License.
1170Object.defineProperty(exports, "__esModule", ({ value: true }));
1171exports.AppStartContext = void 0;
1172const HookContext_1 = __webpack_require__(/*! ./HookContext */ "./src/hooks/HookContext.ts");
1173class AppStartContext extends HookContext_1.HookContext {
1174}
1175exports.AppStartContext = AppStartContext;
1176
1177
1178/***/ }),
1179
1180/***/ "./src/hooks/AppTerminateContext.ts":
1181/*!******************************************!*\
1182 !*** ./src/hooks/AppTerminateContext.ts ***!
1183 \******************************************/
1184/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1185
1186
1187// Copyright (c) .NET Foundation. All rights reserved.
1188// Licensed under the MIT License.
1189Object.defineProperty(exports, "__esModule", ({ value: true }));
1190exports.AppTerminateContext = void 0;
1191const HookContext_1 = __webpack_require__(/*! ./HookContext */ "./src/hooks/HookContext.ts");
1192class AppTerminateContext extends HookContext_1.HookContext {
1193}
1194exports.AppTerminateContext = AppTerminateContext;
1195
1196
1197/***/ }),
1198
1199/***/ "./src/hooks/HookContext.ts":
1200/*!**********************************!*\
1201 !*** ./src/hooks/HookContext.ts ***!
1202 \**********************************/
1203/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
1204
1205
1206// Copyright (c) .NET Foundation. All rights reserved.
1207// Licensed under the MIT License.
1208var __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};
1214var __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};
1219var _HookContext_init;
1220Object.defineProperty(exports, "__esModule", ({ value: true }));
1221exports.HookContext = void 0;
1222const errors_1 = __webpack_require__(/*! ../errors */ "./src/errors.ts");
1223const nonNull_1 = __webpack_require__(/*! ../utils/nonNull */ "./src/utils/nonNull.ts");
1224class 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}
1239exports.HookContext = HookContext;
1240_HookContext_init = new WeakMap();
1241
1242
1243/***/ }),
1244
1245/***/ "./src/hooks/InvocationHookContext.ts":
1246/*!********************************************!*\
1247 !*** ./src/hooks/InvocationHookContext.ts ***!
1248 \********************************************/
1249/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
1250
1251
1252// Copyright (c) .NET Foundation. All rights reserved.
1253// Licensed under the MIT License.
1254var __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};
1260var __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};
1265var _InvocationHookContext_init;
1266Object.defineProperty(exports, "__esModule", ({ value: true }));
1267exports.InvocationHookContext = void 0;
1268const errors_1 = __webpack_require__(/*! ../errors */ "./src/errors.ts");
1269const InvocationContext_1 = __webpack_require__(/*! ../InvocationContext */ "./src/InvocationContext.ts");
1270const nonNull_1 = __webpack_require__(/*! ../utils/nonNull */ "./src/utils/nonNull.ts");
1271const HookContext_1 = __webpack_require__(/*! ./HookContext */ "./src/hooks/HookContext.ts");
1272class 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}
1295exports.InvocationHookContext = InvocationHookContext;
1296_InvocationHookContext_init = new WeakMap();
1297
1298
1299/***/ }),
1300
1301/***/ "./src/hooks/PostInvocationContext.ts":
1302/*!********************************************!*\
1303 !*** ./src/hooks/PostInvocationContext.ts ***!
1304 \********************************************/
1305/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
1306
1307
1308// Copyright (c) .NET Foundation. All rights reserved.
1309// Licensed under the MIT License.
1310var __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};
1316var __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};
1321var _PostInvocationContext_init;
1322Object.defineProperty(exports, "__esModule", ({ value: true }));
1323exports.PostInvocationContext = void 0;
1324const InvocationHookContext_1 = __webpack_require__(/*! ./InvocationHookContext */ "./src/hooks/InvocationHookContext.ts");
1325class 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}
1344exports.PostInvocationContext = PostInvocationContext;
1345_PostInvocationContext_init = new WeakMap();
1346
1347
1348/***/ }),
1349
1350/***/ "./src/hooks/PreInvocationContext.ts":
1351/*!*******************************************!*\
1352 !*** ./src/hooks/PreInvocationContext.ts ***!
1353 \*******************************************/
1354/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
1355
1356
1357// Copyright (c) .NET Foundation. All rights reserved.
1358// Licensed under the MIT License.
1359var __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};
1365var __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};
1370var _PreInvocationContext_init;
1371Object.defineProperty(exports, "__esModule", ({ value: true }));
1372exports.PreInvocationContext = void 0;
1373const nonNull_1 = __webpack_require__(/*! ../utils/nonNull */ "./src/utils/nonNull.ts");
1374const InvocationHookContext_1 = __webpack_require__(/*! ./InvocationHookContext */ "./src/hooks/InvocationHookContext.ts");
1375class 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}
1391exports.PreInvocationContext = PreInvocationContext;
1392_PreInvocationContext_init = new WeakMap();
1393
1394
1395/***/ }),
1396
1397/***/ "./src/hooks/registerHook.ts":
1398/*!***********************************!*\
1399 !*** ./src/hooks/registerHook.ts ***!
1400 \***********************************/
1401/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1402
1403
1404// Copyright (c) .NET Foundation. All rights reserved.
1405// Licensed under the MIT License.
1406Object.defineProperty(exports, "__esModule", ({ value: true }));
1407exports.postInvocation = exports.preInvocation = exports.appTerminate = exports.appStart = void 0;
1408const Disposable_1 = __webpack_require__(/*! ../utils/Disposable */ "./src/utils/Disposable.ts");
1409const tryGetCoreApiLazy_1 = __webpack_require__(/*! ../utils/tryGetCoreApiLazy */ "./src/utils/tryGetCoreApiLazy.ts");
1410const AppStartContext_1 = __webpack_require__(/*! ./AppStartContext */ "./src/hooks/AppStartContext.ts");
1411const AppTerminateContext_1 = __webpack_require__(/*! ./AppTerminateContext */ "./src/hooks/AppTerminateContext.ts");
1412const PostInvocationContext_1 = __webpack_require__(/*! ./PostInvocationContext */ "./src/hooks/PostInvocationContext.ts");
1413const PreInvocationContext_1 = __webpack_require__(/*! ./PreInvocationContext */ "./src/hooks/PreInvocationContext.ts");
1414function 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}
1426function appStart(handler) {
1427 return registerHook('appStart', (coreContext) => {
1428 return handler(new AppStartContext_1.AppStartContext(coreContext));
1429 });
1430}
1431exports.appStart = appStart;
1432function appTerminate(handler) {
1433 return registerHook('appTerminate', (coreContext) => {
1434 return handler(new AppTerminateContext_1.AppTerminateContext(coreContext));
1435 });
1436}
1437exports.appTerminate = appTerminate;
1438function preInvocation(handler) {
1439 return registerHook('preInvocation', (coreContext) => {
1440 return handler(new PreInvocationContext_1.PreInvocationContext(coreContext));
1441 });
1442}
1443exports.preInvocation = preInvocation;
1444function postInvocation(handler) {
1445 return registerHook('postInvocation', (coreContext) => {
1446 return handler(new PostInvocationContext_1.PostInvocationContext(coreContext));
1447 });
1448}
1449exports.postInvocation = postInvocation;
1450
1451
1452/***/ }),
1453
1454/***/ "./src/http/HttpRequest.ts":
1455/*!*********************************!*\
1456 !*** ./src/http/HttpRequest.ts ***!
1457 \*********************************/
1458/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
1459
1460
1461// Copyright (c) .NET Foundation. All rights reserved.
1462// Licensed under the MIT License.
1463var __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};
1472var __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};
1478var __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};
1483var _HttpRequest_cachedUser, _HttpRequest_uReq, _HttpRequest_body;
1484Object.defineProperty(exports, "__esModule", ({ value: true }));
1485exports.HttpRequest = void 0;
1486const undici_1 = __webpack_require__(/*! undici */ "undici");
1487const url_1 = __webpack_require__(/*! url */ "url");
1488const fromRpcNullable_1 = __webpack_require__(/*! ../converters/fromRpcNullable */ "./src/converters/fromRpcNullable.ts");
1489const nonNull_1 = __webpack_require__(/*! ../utils/nonNull */ "./src/utils/nonNull.ts");
1490const extractHttpUserFromHeaders_1 = __webpack_require__(/*! ./extractHttpUserFromHeaders */ "./src/http/extractHttpUserFromHeaders.ts");
1491class 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}
1559exports.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 !*** ./src/http/HttpResponse.ts ***!
1568 \**********************************/
1569/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
1570
1571
1572// Copyright (c) .NET Foundation. All rights reserved.
1573// Licensed under the MIT License.
1574var __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};
1583var __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};
1589var __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};
1594var _HttpResponse_uRes;
1595Object.defineProperty(exports, "__esModule", ({ value: true }));
1596exports.HttpResponse = void 0;
1597const undici_1 = __webpack_require__(/*! undici */ "undici");
1598const nonNull_1 = __webpack_require__(/*! ../utils/nonNull */ "./src/utils/nonNull.ts");
1599class 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}
1650exports.HttpResponse = HttpResponse;
1651_HttpResponse_uRes = new WeakMap();
1652
1653
1654/***/ }),
1655
1656/***/ "./src/http/extractHttpUserFromHeaders.ts":
1657/*!************************************************!*\
1658 !*** ./src/http/extractHttpUserFromHeaders.ts ***!
1659 \************************************************/
1660/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1661
1662
1663// Copyright (c) .NET Foundation. All rights reserved.
1664// Licensed under the MIT License.
1665Object.defineProperty(exports, "__esModule", ({ value: true }));
1666exports.extractHttpUserFromHeaders = void 0;
1667const nonNull_1 = __webpack_require__(/*! ../utils/nonNull */ "./src/utils/nonNull.ts");
1668/* grandfathered in. Should fix when possible */
1669/* eslint-disable @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access */
1670function 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}
1696exports.extractHttpUserFromHeaders = extractHttpUserFromHeaders;
1697
1698
1699/***/ }),
1700
1701/***/ "./src/input.ts":
1702/*!**********************!*\
1703 !*** ./src/input.ts ***!
1704 \**********************/
1705/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1706
1707
1708// Copyright (c) .NET Foundation. All rights reserved.
1709// Licensed under the MIT License.
1710Object.defineProperty(exports, "__esModule", ({ value: true }));
1711exports.generic = exports.sql = exports.cosmosDB = exports.table = exports.storageBlob = void 0;
1712const addBindingName_1 = __webpack_require__(/*! ./addBindingName */ "./src/addBindingName.ts");
1713function storageBlob(options) {
1714 return addInputBindingName(Object.assign(Object.assign({}, options), { type: 'blob' }));
1715}
1716exports.storageBlob = storageBlob;
1717function table(options) {
1718 return addInputBindingName(Object.assign(Object.assign({}, options), { type: 'table' }));
1719}
1720exports.table = table;
1721function cosmosDB(options) {
1722 return addInputBindingName(Object.assign(Object.assign({}, options), { type: 'cosmosDB' }));
1723}
1724exports.cosmosDB = cosmosDB;
1725function sql(options) {
1726 return addInputBindingName(Object.assign(Object.assign({}, options), { type: 'sql' }));
1727}
1728exports.sql = sql;
1729function generic(options) {
1730 return addInputBindingName(options);
1731}
1732exports.generic = generic;
1733function addInputBindingName(binding) {
1734 return (0, addBindingName_1.addBindingName)(binding, 'Input');
1735}
1736
1737
1738/***/ }),
1739
1740/***/ "./src/output.ts":
1741/*!***********************!*\
1742 !*** ./src/output.ts ***!
1743 \***********************/
1744/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1745
1746
1747// Copyright (c) .NET Foundation. All rights reserved.
1748// Licensed under the MIT License.
1749Object.defineProperty(exports, "__esModule", ({ value: true }));
1750exports.generic = exports.sql = exports.cosmosDB = exports.eventGrid = exports.eventHub = exports.serviceBusTopic = exports.serviceBusQueue = exports.storageQueue = exports.table = exports.storageBlob = exports.http = void 0;
1751const addBindingName_1 = __webpack_require__(/*! ./addBindingName */ "./src/addBindingName.ts");
1752function http(options) {
1753 return addOutputBindingName(Object.assign(Object.assign({}, options), { type: 'http' }));
1754}
1755exports.http = http;
1756function storageBlob(options) {
1757 return addOutputBindingName(Object.assign(Object.assign({}, options), { type: 'blob' }));
1758}
1759exports.storageBlob = storageBlob;
1760function table(options) {
1761 return addOutputBindingName(Object.assign(Object.assign({}, options), { type: 'table' }));
1762}
1763exports.table = table;
1764function storageQueue(options) {
1765 return addOutputBindingName(Object.assign(Object.assign({}, options), { type: 'queue' }));
1766}
1767exports.storageQueue = storageQueue;
1768function serviceBusQueue(options) {
1769 return addOutputBindingName(Object.assign(Object.assign({}, options), { type: 'serviceBus' }));
1770}
1771exports.serviceBusQueue = serviceBusQueue;
1772function serviceBusTopic(options) {
1773 return addOutputBindingName(Object.assign(Object.assign({}, options), { type: 'serviceBus' }));
1774}
1775exports.serviceBusTopic = serviceBusTopic;
1776function eventHub(options) {
1777 return addOutputBindingName(Object.assign(Object.assign({}, options), { type: 'eventHub' }));
1778}
1779exports.eventHub = eventHub;
1780function eventGrid(options) {
1781 return addOutputBindingName(Object.assign(Object.assign({}, options), { type: 'eventGrid' }));
1782}
1783exports.eventGrid = eventGrid;
1784function cosmosDB(options) {
1785 return addOutputBindingName(Object.assign(Object.assign({}, options), { type: 'cosmosDB' }));
1786}
1787exports.cosmosDB = cosmosDB;
1788function sql(options) {
1789 return addOutputBindingName(Object.assign(Object.assign({}, options), { type: 'sql' }));
1790}
1791exports.sql = sql;
1792function generic(options) {
1793 return addOutputBindingName(options);
1794}
1795exports.generic = generic;
1796function addOutputBindingName(binding) {
1797 return (0, addBindingName_1.addBindingName)(binding, 'Output');
1798}
1799
1800
1801/***/ }),
1802
1803/***/ "./src/trigger.ts":
1804/*!************************!*\
1805 !*** ./src/trigger.ts ***!
1806 \************************/
1807/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1808
1809
1810// Copyright (c) .NET Foundation. All rights reserved.
1811// Licensed under the MIT License.
1812Object.defineProperty(exports, "__esModule", ({ value: true }));
1813exports.generic = exports.warmup = exports.cosmosDB = exports.eventGrid = exports.eventHub = exports.serviceBusTopic = exports.serviceBusQueue = exports.storageQueue = exports.storageBlob = exports.timer = exports.http = void 0;
1814const addBindingName_1 = __webpack_require__(/*! ./addBindingName */ "./src/addBindingName.ts");
1815function http(options) {
1816 return addTriggerBindingName(Object.assign(Object.assign({}, options), { authLevel: options.authLevel || 'anonymous', methods: options.methods || ['GET', 'POST'], type: 'httpTrigger' }));
1817}
1818exports.http = http;
1819function timer(options) {
1820 return addTriggerBindingName(Object.assign(Object.assign({}, options), { type: 'timerTrigger' }));
1821}
1822exports.timer = timer;
1823function storageBlob(options) {
1824 return addTriggerBindingName(Object.assign(Object.assign({}, options), { type: 'blobTrigger' }));
1825}
1826exports.storageBlob = storageBlob;
1827function storageQueue(options) {
1828 return addTriggerBindingName(Object.assign(Object.assign({}, options), { type: 'queueTrigger' }));
1829}
1830exports.storageQueue = storageQueue;
1831function serviceBusQueue(options) {
1832 return addTriggerBindingName(Object.assign(Object.assign({}, options), { type: 'serviceBusTrigger' }));
1833}
1834exports.serviceBusQueue = serviceBusQueue;
1835function serviceBusTopic(options) {
1836 return addTriggerBindingName(Object.assign(Object.assign({}, options), { type: 'serviceBusTrigger' }));
1837}
1838exports.serviceBusTopic = serviceBusTopic;
1839function eventHub(options) {
1840 return addTriggerBindingName(Object.assign(Object.assign({}, options), { type: 'eventHubTrigger' }));
1841}
1842exports.eventHub = eventHub;
1843function eventGrid(options) {
1844 return addTriggerBindingName(Object.assign(Object.assign({}, options), { type: 'eventGridTrigger' }));
1845}
1846exports.eventGrid = eventGrid;
1847function cosmosDB(options) {
1848 return addTriggerBindingName(Object.assign(Object.assign({}, options), { type: 'cosmosDBTrigger' }));
1849}
1850exports.cosmosDB = cosmosDB;
1851function warmup(options) {
1852 return addTriggerBindingName(Object.assign(Object.assign({}, options), { type: 'warmupTrigger' }));
1853}
1854exports.warmup = warmup;
1855function generic(options) {
1856 return addTriggerBindingName(options);
1857}
1858exports.generic = generic;
1859function addTriggerBindingName(binding) {
1860 return (0, addBindingName_1.addBindingName)(binding, 'Trigger');
1861}
1862
1863
1864/***/ }),
1865
1866/***/ "./src/utils/Disposable.ts":
1867/*!*********************************!*\
1868 !*** ./src/utils/Disposable.ts ***!
1869 \*********************************/
1870/***/ (function(__unused_webpack_module, exports) {
1871
1872
1873// Copyright (c) .NET Foundation. All rights reserved.
1874// Licensed under the MIT License.
1875var __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};
1881var __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};
1886var _Disposable_callOnDispose;
1887Object.defineProperty(exports, "__esModule", ({ value: true }));
1888exports.Disposable = void 0;
1889/**
1890 * Based off of VS Code
1891 * https://github.com/microsoft/vscode/blob/7bed4ce3e9f5059b5fc638c348f064edabcce5d2/src/vs/workbench/api/common/extHostTypes.ts#L65
1892 */
1893class 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}
1918exports.Disposable = Disposable;
1919_Disposable_callOnDispose = new WeakMap();
1920
1921
1922/***/ }),
1923
1924/***/ "./src/utils/isTrigger.ts":
1925/*!********************************!*\
1926 !*** ./src/utils/isTrigger.ts ***!
1927 \********************************/
1928/***/ ((__unused_webpack_module, exports) => {
1929
1930
1931// Copyright (c) .NET Foundation. All rights reserved.
1932// Licensed under the MIT License.
1933Object.defineProperty(exports, "__esModule", ({ value: true }));
1934exports.isTimerTrigger = exports.isHttpTrigger = exports.isTrigger = void 0;
1935function isTrigger(typeName) {
1936 return !!typeName && /trigger$/i.test(typeName);
1937}
1938exports.isTrigger = isTrigger;
1939function isHttpTrigger(typeName) {
1940 return (typeName === null || typeName === void 0 ? void 0 : typeName.toLowerCase()) === 'httptrigger';
1941}
1942exports.isHttpTrigger = isHttpTrigger;
1943function isTimerTrigger(typeName) {
1944 return (typeName === null || typeName === void 0 ? void 0 : typeName.toLowerCase()) === 'timertrigger';
1945}
1946exports.isTimerTrigger = isTimerTrigger;
1947
1948
1949/***/ }),
1950
1951/***/ "./src/utils/nonNull.ts":
1952/*!******************************!*\
1953 !*** ./src/utils/nonNull.ts ***!
1954 \******************************/
1955/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1956
1957
1958// Copyright (c) .NET Foundation. All rights reserved.
1959// Licensed under the MIT License.
1960Object.defineProperty(exports, "__esModule", ({ value: true }));
1961exports.isDefined = exports.copyPropIfDefined = exports.nonNullValue = exports.nonNullProp = void 0;
1962const errors_1 = __webpack_require__(/*! ../errors */ "./src/errors.ts");
1963/**
1964 * Retrieves a property by name from an object and checks that it's not null and not undefined. It is strongly typed
1965 * for the property and will give a compile error if the given name is not a property of the source.
1966 */
1967function nonNullProp(source, name) {
1968 const value = source[name];
1969 return nonNullValue(value, name);
1970}
1971exports.nonNullProp = nonNullProp;
1972/**
1973 * Validates that a given value is not null and not undefined.
1974 */
1975function 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}
1982exports.nonNullValue = nonNullValue;
1983function copyPropIfDefined(source, destination, key) {
1984 if (source[key] !== null && source[key] !== undefined) {
1985 destination[key] = source[key];
1986 }
1987}
1988exports.copyPropIfDefined = copyPropIfDefined;
1989function isDefined(data) {
1990 return data !== null && data !== undefined;
1991}
1992exports.isDefined = isDefined;
1993
1994
1995/***/ }),
1996
1997/***/ "./src/utils/tryGetCoreApiLazy.ts":
1998/*!****************************************!*\
1999 !*** ./src/utils/tryGetCoreApiLazy.ts ***!
2000 \****************************************/
2001/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2002
2003
2004// Copyright (c) .NET Foundation. All rights reserved.
2005// Licensed under the MIT License.
2006Object.defineProperty(exports, "__esModule", ({ value: true }));
2007exports.tryGetCoreApiLazy = void 0;
2008let coreApi;
2009function tryGetCoreApiLazy() {
2010 if (coreApi === undefined) {
2011 try {
2012 // eslint-disable-next-line @typescript-eslint/no-var-requires
2013 coreApi = __webpack_require__(/*! @azure/functions-core */ "@azure/functions-core");
2014 }
2015 catch (_a) {
2016 coreApi = null;
2017 }
2018 }
2019 return coreApi;
2020}
2021exports.tryGetCoreApiLazy = tryGetCoreApiLazy;
2022
2023
2024/***/ }),
2025
2026/***/ "@azure/functions-core":
2027/*!****************************************!*\
2028 !*** external "@azure/functions-core" ***!
2029 \****************************************/
2030/***/ ((module) => {
2031
2032module.exports = require("@azure/functions-core");
2033
2034/***/ }),
2035
2036/***/ "undici":
2037/*!*************************!*\
2038 !*** external "undici" ***!
2039 \*************************/
2040/***/ ((module) => {
2041
2042module.exports = require("undici");
2043
2044/***/ }),
2045
2046/***/ "url":
2047/*!**********************!*\
2048 !*** external "url" ***!
2049 \**********************/
2050/***/ ((module) => {
2051
2052module.exports = require("url");
2053
2054/***/ }),
2055
2056/***/ "util":
2057/*!***********************!*\
2058 !*** external "util" ***!
2059 \***********************/
2060/***/ ((module) => {
2061
2062module.exports = require("util");
2063
2064/***/ })
2065
2066/******/ });
2067/************************************************************************/
2068/******/ // The module cache
2069/******/ var __webpack_module_cache__ = {};
2070/******/
2071/******/ // The require function
2072/******/ function __webpack_require__(moduleId) {
2073/******/ // Check if module is in cache
2074/******/ var cachedModule = __webpack_module_cache__[moduleId];
2075/******/ if (cachedModule !== undefined) {
2076/******/ return cachedModule.exports;
2077/******/ }
2078/******/ // Create a new module (and put it into the cache)
2079/******/ var module = __webpack_module_cache__[moduleId] = {
2080/******/ // no module.id needed
2081/******/ // no module.loaded needed
2082/******/ exports: {}
2083/******/ };
2084/******/
2085/******/ // Execute the module function
2086/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
2087/******/
2088/******/ // Return the exports of the module
2089/******/ return module.exports;
2090/******/ }
2091/******/
2092/************************************************************************/
2093var __webpack_exports__ = {};
2094// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
2095(() => {
2096var exports = __webpack_exports__;
2097/*!**********************!*\
2098 !*** ./src/index.ts ***!
2099 \**********************/
2100
2101// Copyright (c) .NET Foundation. All rights reserved.
2102// Licensed under the MIT License.
2103Object.defineProperty(exports, "__esModule", ({ value: true }));
2104exports.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;
2105exports.app = __webpack_require__(/*! ./app */ "./src/app.ts");
2106var AppStartContext_1 = __webpack_require__(/*! ./hooks/AppStartContext */ "./src/hooks/AppStartContext.ts");
2107Object.defineProperty(exports, "AppStartContext", ({ enumerable: true, get: function () { return AppStartContext_1.AppStartContext; } }));
2108var AppTerminateContext_1 = __webpack_require__(/*! ./hooks/AppTerminateContext */ "./src/hooks/AppTerminateContext.ts");
2109Object.defineProperty(exports, "AppTerminateContext", ({ enumerable: true, get: function () { return AppTerminateContext_1.AppTerminateContext; } }));
2110var HookContext_1 = __webpack_require__(/*! ./hooks/HookContext */ "./src/hooks/HookContext.ts");
2111Object.defineProperty(exports, "HookContext", ({ enumerable: true, get: function () { return HookContext_1.HookContext; } }));
2112var InvocationHookContext_1 = __webpack_require__(/*! ./hooks/InvocationHookContext */ "./src/hooks/InvocationHookContext.ts");
2113Object.defineProperty(exports, "InvocationHookContext", ({ enumerable: true, get: function () { return InvocationHookContext_1.InvocationHookContext; } }));
2114var PostInvocationContext_1 = __webpack_require__(/*! ./hooks/PostInvocationContext */ "./src/hooks/PostInvocationContext.ts");
2115Object.defineProperty(exports, "PostInvocationContext", ({ enumerable: true, get: function () { return PostInvocationContext_1.PostInvocationContext; } }));
2116var PreInvocationContext_1 = __webpack_require__(/*! ./hooks/PreInvocationContext */ "./src/hooks/PreInvocationContext.ts");
2117Object.defineProperty(exports, "PreInvocationContext", ({ enumerable: true, get: function () { return PreInvocationContext_1.PreInvocationContext; } }));
2118var HttpRequest_1 = __webpack_require__(/*! ./http/HttpRequest */ "./src/http/HttpRequest.ts");
2119Object.defineProperty(exports, "HttpRequest", ({ enumerable: true, get: function () { return HttpRequest_1.HttpRequest; } }));
2120var HttpResponse_1 = __webpack_require__(/*! ./http/HttpResponse */ "./src/http/HttpResponse.ts");
2121Object.defineProperty(exports, "HttpResponse", ({ enumerable: true, get: function () { return HttpResponse_1.HttpResponse; } }));
2122exports.input = __webpack_require__(/*! ./input */ "./src/input.ts");
2123var InvocationContext_1 = __webpack_require__(/*! ./InvocationContext */ "./src/InvocationContext.ts");
2124Object.defineProperty(exports, "InvocationContext", ({ enumerable: true, get: function () { return InvocationContext_1.InvocationContext; } }));
2125exports.output = __webpack_require__(/*! ./output */ "./src/output.ts");
2126exports.trigger = __webpack_require__(/*! ./trigger */ "./src/trigger.ts");
2127var Disposable_1 = __webpack_require__(/*! ./utils/Disposable */ "./src/utils/Disposable.ts");
2128Object.defineProperty(exports, "Disposable", ({ enumerable: true, get: function () { return Disposable_1.Disposable; } }));
2129
2130})();
2131
2132module.exports = __webpack_exports__;
2133/******/ })()
2134;
2135//# sourceMappingURL=azure-functions.js.map
\No newline at end of file