@shellicar/svelte-adapter-azure-functions 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +118 -8
- package/dist/adapter.js +9 -1
- package/dist/adapter.js.map +1 -1
- package/dist/ambient.d.js +7 -1
- package/dist/ambient.d.js.map +1 -1
- package/dist/chunk-42KILSBR.js +58 -1
- package/dist/chunk-42KILSBR.js.map +1 -1
- package/dist/chunk-6TUT2TP2.js +23 -1
- package/dist/chunk-6TUT2TP2.js.map +1 -1
- package/dist/chunk-AW5NC2LL.js +57 -1
- package/dist/chunk-AW5NC2LL.js.map +1 -1
- package/dist/chunk-CV4SYBYR.js +245 -1
- package/dist/chunk-CV4SYBYR.js.map +1 -1
- package/dist/chunk-GKOGVGYC.js +21 -1
- package/dist/chunk-GKOGVGYC.js.map +1 -1
- package/dist/chunk-QGAJTWE2.js +53 -1
- package/dist/chunk-QGAJTWE2.js.map +1 -1
- package/dist/defaults.js +8 -1
- package/dist/defaults.js.map +1 -1
- package/dist/handler.js +10 -1
- package/dist/handler.js.map +1 -1
- package/dist/headers.js +12 -1
- package/dist/headers.js.map +1 -1
- package/dist/index.js +16 -1
- package/dist/index.js.map +1 -1
- package/dist/server.js +8 -1
- package/dist/server.js.map +1 -1
- package/dist/shims.js +36 -1
- package/dist/shims.js.map +1 -1
- package/dist/trigger.js +3625 -254
- package/dist/trigger.js.map +1 -1
- package/dist/types.js +7 -1
- package/dist/types.js.map +1 -1
- package/package.json +14 -14
package/dist/trigger.js
CHANGED
|
@@ -1,258 +1,3628 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
handler
|
|
3
|
+
} from "./chunk-QGAJTWE2.js";
|
|
4
|
+
import "./chunk-CV4SYBYR.js";
|
|
5
|
+
import "./chunk-GKOGVGYC.js";
|
|
6
|
+
import {
|
|
7
|
+
__commonJS,
|
|
8
|
+
__name,
|
|
9
|
+
__require,
|
|
10
|
+
__toESM,
|
|
11
|
+
init_cjs_shim
|
|
12
|
+
} from "./chunk-AW5NC2LL.js";
|
|
13
|
+
|
|
14
|
+
// ../../node_modules/.pnpm/@azure+functions-extensions-base@0.2.0/node_modules/@azure/functions-extensions-base/dist/azure-functions-extensions-base.js
|
|
15
|
+
var require_azure_functions_extensions_base = __commonJS({
|
|
16
|
+
"../../node_modules/.pnpm/@azure+functions-extensions-base@0.2.0/node_modules/@azure/functions-extensions-base/dist/azure-functions-extensions-base.js"(exports, module) {
|
|
17
|
+
"use strict";
|
|
18
|
+
init_cjs_shim();
|
|
19
|
+
(() => {
|
|
20
|
+
"use strict";
|
|
21
|
+
var __webpack_modules__ = {
|
|
22
|
+
/***/
|
|
23
|
+
"./src/index.ts": (
|
|
24
|
+
/*!**********************!*\
|
|
3
25
|
!*** ./src/index.ts ***!
|
|
4
|
-
\**********************/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
26
|
+
\**********************/
|
|
27
|
+
/***/
|
|
28
|
+
/* @__PURE__ */ __name((function(__unused_webpack_module, exports2, __webpack_require__2) {
|
|
29
|
+
var __createBinding = this && this.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
30
|
+
if (k2 === void 0) k2 = k;
|
|
31
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
32
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
33
|
+
desc = { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
34
|
+
return m[k];
|
|
35
|
+
}, "get") };
|
|
36
|
+
}
|
|
37
|
+
Object.defineProperty(o, k2, desc);
|
|
38
|
+
}) : (function(o, m, k, k2) {
|
|
39
|
+
if (k2 === void 0) k2 = k;
|
|
40
|
+
o[k2] = m[k];
|
|
41
|
+
}));
|
|
42
|
+
var __exportStar = this && this.__exportStar || function(m, exports3) {
|
|
43
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding(exports3, m, p);
|
|
44
|
+
};
|
|
45
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
46
|
+
__exportStar(__webpack_require__2(
|
|
47
|
+
/*! ./resourceFactoryResolver */
|
|
48
|
+
"./src/resourceFactoryResolver.ts"
|
|
49
|
+
), exports2);
|
|
50
|
+
}), "./src/index.ts")
|
|
51
|
+
),
|
|
52
|
+
/***/
|
|
53
|
+
"./src/resourceFactoryResolver.ts": (
|
|
54
|
+
/*!****************************************!*\
|
|
8
55
|
!*** ./src/resourceFactoryResolver.ts ***!
|
|
9
|
-
\****************************************/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
"./src/
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
"
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
"
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
"
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
"
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
"
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
"
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
"
|
|
186
|
-
|
|
187
|
-
"
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
"
|
|
192
|
-
|
|
193
|
-
"
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
"
|
|
198
|
-
|
|
199
|
-
"
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
"
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
"
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
"
|
|
222
|
-
|
|
223
|
-
"
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
"
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
"
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
56
|
+
\****************************************/
|
|
57
|
+
/***/
|
|
58
|
+
/* @__PURE__ */ __name(((__unused_webpack_module, exports2) => {
|
|
59
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
60
|
+
exports2.ResourceFactoryResolver = void 0;
|
|
61
|
+
class ResourceFactoryResolver {
|
|
62
|
+
static {
|
|
63
|
+
__name(this, "ResourceFactoryResolver");
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Private constructor to enforce singleton pattern
|
|
67
|
+
*/
|
|
68
|
+
constructor() {
|
|
69
|
+
this.resourceFactories = /* @__PURE__ */ new Map();
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Gets the singleton instance of the registry
|
|
73
|
+
* @returns The singleton instance
|
|
74
|
+
*/
|
|
75
|
+
static getInstance() {
|
|
76
|
+
if (!ResourceFactoryResolver.instance) {
|
|
77
|
+
ResourceFactoryResolver.instance = new ResourceFactoryResolver();
|
|
78
|
+
}
|
|
79
|
+
return ResourceFactoryResolver.instance;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Registers a factory for a specific type.
|
|
83
|
+
* @param resourceType The type of the resource factory to check for.
|
|
84
|
+
* @param factory The factory function to create instances of the type.
|
|
85
|
+
*/
|
|
86
|
+
registerResourceFactory(resourceType, factory) {
|
|
87
|
+
if (this.resourceFactories.has(resourceType)) {
|
|
88
|
+
throw new Error(`Factory for type "${resourceType}" is already registered.`);
|
|
89
|
+
}
|
|
90
|
+
this.resourceFactories.set(resourceType, factory);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Creates a client instance for the specified resource type using the provided model binding data.
|
|
94
|
+
*
|
|
95
|
+
* @param resourceType - The type of the resource for which the client is being created.
|
|
96
|
+
* @param modelBindingData - The data required to bind the model for the resource.
|
|
97
|
+
* @returns An instance of the client for the specified resource type.
|
|
98
|
+
* @throws Error - If no factory is registered for the specified resource type.
|
|
99
|
+
*/
|
|
100
|
+
createClient(resourceType, modelBindingData) {
|
|
101
|
+
const resourceFactory = this.resourceFactories.get(resourceType);
|
|
102
|
+
if (!resourceFactory) {
|
|
103
|
+
throw new Error(`Factory for type "${resourceType}" is not registered. Register a factory implementation before creating clients.`);
|
|
104
|
+
}
|
|
105
|
+
return resourceFactory(modelBindingData);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Checks if a resource factory of the specified type exists.
|
|
109
|
+
*
|
|
110
|
+
* @param tyresourceTypepe - The type of the resource factory to check for.
|
|
111
|
+
* @returns A boolean indicating whether a resource factory of the specified type exists.
|
|
112
|
+
*/
|
|
113
|
+
hasResourceFactory(resourceType) {
|
|
114
|
+
return this.resourceFactories.has(resourceType);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
exports2.ResourceFactoryResolver = ResourceFactoryResolver;
|
|
118
|
+
}), "./src/resourceFactoryResolver.ts")
|
|
119
|
+
)
|
|
120
|
+
/******/
|
|
121
|
+
};
|
|
122
|
+
var __webpack_module_cache__ = {};
|
|
123
|
+
function __webpack_require__(moduleId) {
|
|
124
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
125
|
+
if (cachedModule !== void 0) {
|
|
126
|
+
return cachedModule.exports;
|
|
127
|
+
}
|
|
128
|
+
var module2 = __webpack_module_cache__[moduleId] = {
|
|
129
|
+
/******/
|
|
130
|
+
// no module.id needed
|
|
131
|
+
/******/
|
|
132
|
+
// no module.loaded needed
|
|
133
|
+
/******/
|
|
134
|
+
exports: {}
|
|
135
|
+
/******/
|
|
136
|
+
};
|
|
137
|
+
__webpack_modules__[moduleId].call(module2.exports, module2, module2.exports, __webpack_require__);
|
|
138
|
+
return module2.exports;
|
|
139
|
+
}
|
|
140
|
+
__name(__webpack_require__, "__webpack_require__");
|
|
141
|
+
var __webpack_exports__ = __webpack_require__("./src/index.ts");
|
|
142
|
+
module.exports = __webpack_exports__;
|
|
143
|
+
})();
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
// ../../node_modules/.pnpm/cookie@0.7.2/node_modules/cookie/index.js
|
|
148
|
+
var require_cookie = __commonJS({
|
|
149
|
+
"../../node_modules/.pnpm/cookie@0.7.2/node_modules/cookie/index.js"(exports) {
|
|
150
|
+
"use strict";
|
|
151
|
+
init_cjs_shim();
|
|
152
|
+
exports.parse = parse;
|
|
153
|
+
exports.serialize = serialize;
|
|
154
|
+
var __toString = Object.prototype.toString;
|
|
155
|
+
var __hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
156
|
+
var cookieNameRegExp = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
|
|
157
|
+
var cookieValueRegExp = /^("?)[\u0021\u0023-\u002B\u002D-\u003A\u003C-\u005B\u005D-\u007E]*\1$/;
|
|
158
|
+
var domainValueRegExp = /^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i;
|
|
159
|
+
var pathValueRegExp = /^[\u0020-\u003A\u003D-\u007E]*$/;
|
|
160
|
+
function parse(str, opt) {
|
|
161
|
+
if (typeof str !== "string") {
|
|
162
|
+
throw new TypeError("argument str must be a string");
|
|
163
|
+
}
|
|
164
|
+
var obj = {};
|
|
165
|
+
var len = str.length;
|
|
166
|
+
if (len < 2) return obj;
|
|
167
|
+
var dec = opt && opt.decode || decode;
|
|
168
|
+
var index = 0;
|
|
169
|
+
var eqIdx = 0;
|
|
170
|
+
var endIdx = 0;
|
|
171
|
+
do {
|
|
172
|
+
eqIdx = str.indexOf("=", index);
|
|
173
|
+
if (eqIdx === -1) break;
|
|
174
|
+
endIdx = str.indexOf(";", index);
|
|
175
|
+
if (endIdx === -1) {
|
|
176
|
+
endIdx = len;
|
|
177
|
+
} else if (eqIdx > endIdx) {
|
|
178
|
+
index = str.lastIndexOf(";", eqIdx - 1) + 1;
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
var keyStartIdx = startIndex(str, index, eqIdx);
|
|
182
|
+
var keyEndIdx = endIndex(str, eqIdx, keyStartIdx);
|
|
183
|
+
var key = str.slice(keyStartIdx, keyEndIdx);
|
|
184
|
+
if (!__hasOwnProperty.call(obj, key)) {
|
|
185
|
+
var valStartIdx = startIndex(str, eqIdx + 1, endIdx);
|
|
186
|
+
var valEndIdx = endIndex(str, endIdx, valStartIdx);
|
|
187
|
+
if (str.charCodeAt(valStartIdx) === 34 && str.charCodeAt(valEndIdx - 1) === 34) {
|
|
188
|
+
valStartIdx++;
|
|
189
|
+
valEndIdx--;
|
|
190
|
+
}
|
|
191
|
+
var val = str.slice(valStartIdx, valEndIdx);
|
|
192
|
+
obj[key] = tryDecode(val, dec);
|
|
193
|
+
}
|
|
194
|
+
index = endIdx + 1;
|
|
195
|
+
} while (index < len);
|
|
196
|
+
return obj;
|
|
197
|
+
}
|
|
198
|
+
__name(parse, "parse");
|
|
199
|
+
function startIndex(str, index, max) {
|
|
200
|
+
do {
|
|
201
|
+
var code = str.charCodeAt(index);
|
|
202
|
+
if (code !== 32 && code !== 9) return index;
|
|
203
|
+
} while (++index < max);
|
|
204
|
+
return max;
|
|
205
|
+
}
|
|
206
|
+
__name(startIndex, "startIndex");
|
|
207
|
+
function endIndex(str, index, min) {
|
|
208
|
+
while (index > min) {
|
|
209
|
+
var code = str.charCodeAt(--index);
|
|
210
|
+
if (code !== 32 && code !== 9) return index + 1;
|
|
211
|
+
}
|
|
212
|
+
return min;
|
|
213
|
+
}
|
|
214
|
+
__name(endIndex, "endIndex");
|
|
215
|
+
function serialize(name, val, opt) {
|
|
216
|
+
var enc = opt && opt.encode || encodeURIComponent;
|
|
217
|
+
if (typeof enc !== "function") {
|
|
218
|
+
throw new TypeError("option encode is invalid");
|
|
219
|
+
}
|
|
220
|
+
if (!cookieNameRegExp.test(name)) {
|
|
221
|
+
throw new TypeError("argument name is invalid");
|
|
222
|
+
}
|
|
223
|
+
var value = enc(val);
|
|
224
|
+
if (!cookieValueRegExp.test(value)) {
|
|
225
|
+
throw new TypeError("argument val is invalid");
|
|
226
|
+
}
|
|
227
|
+
var str = name + "=" + value;
|
|
228
|
+
if (!opt) return str;
|
|
229
|
+
if (null != opt.maxAge) {
|
|
230
|
+
var maxAge = Math.floor(opt.maxAge);
|
|
231
|
+
if (!isFinite(maxAge)) {
|
|
232
|
+
throw new TypeError("option maxAge is invalid");
|
|
233
|
+
}
|
|
234
|
+
str += "; Max-Age=" + maxAge;
|
|
235
|
+
}
|
|
236
|
+
if (opt.domain) {
|
|
237
|
+
if (!domainValueRegExp.test(opt.domain)) {
|
|
238
|
+
throw new TypeError("option domain is invalid");
|
|
239
|
+
}
|
|
240
|
+
str += "; Domain=" + opt.domain;
|
|
241
|
+
}
|
|
242
|
+
if (opt.path) {
|
|
243
|
+
if (!pathValueRegExp.test(opt.path)) {
|
|
244
|
+
throw new TypeError("option path is invalid");
|
|
245
|
+
}
|
|
246
|
+
str += "; Path=" + opt.path;
|
|
247
|
+
}
|
|
248
|
+
if (opt.expires) {
|
|
249
|
+
var expires = opt.expires;
|
|
250
|
+
if (!isDate(expires) || isNaN(expires.valueOf())) {
|
|
251
|
+
throw new TypeError("option expires is invalid");
|
|
252
|
+
}
|
|
253
|
+
str += "; Expires=" + expires.toUTCString();
|
|
254
|
+
}
|
|
255
|
+
if (opt.httpOnly) {
|
|
256
|
+
str += "; HttpOnly";
|
|
257
|
+
}
|
|
258
|
+
if (opt.secure) {
|
|
259
|
+
str += "; Secure";
|
|
260
|
+
}
|
|
261
|
+
if (opt.partitioned) {
|
|
262
|
+
str += "; Partitioned";
|
|
263
|
+
}
|
|
264
|
+
if (opt.priority) {
|
|
265
|
+
var priority = typeof opt.priority === "string" ? opt.priority.toLowerCase() : opt.priority;
|
|
266
|
+
switch (priority) {
|
|
267
|
+
case "low":
|
|
268
|
+
str += "; Priority=Low";
|
|
269
|
+
break;
|
|
270
|
+
case "medium":
|
|
271
|
+
str += "; Priority=Medium";
|
|
272
|
+
break;
|
|
273
|
+
case "high":
|
|
274
|
+
str += "; Priority=High";
|
|
275
|
+
break;
|
|
276
|
+
default:
|
|
277
|
+
throw new TypeError("option priority is invalid");
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
if (opt.sameSite) {
|
|
281
|
+
var sameSite = typeof opt.sameSite === "string" ? opt.sameSite.toLowerCase() : opt.sameSite;
|
|
282
|
+
switch (sameSite) {
|
|
283
|
+
case true:
|
|
284
|
+
str += "; SameSite=Strict";
|
|
285
|
+
break;
|
|
286
|
+
case "lax":
|
|
287
|
+
str += "; SameSite=Lax";
|
|
288
|
+
break;
|
|
289
|
+
case "strict":
|
|
290
|
+
str += "; SameSite=Strict";
|
|
291
|
+
break;
|
|
292
|
+
case "none":
|
|
293
|
+
str += "; SameSite=None";
|
|
294
|
+
break;
|
|
295
|
+
default:
|
|
296
|
+
throw new TypeError("option sameSite is invalid");
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
return str;
|
|
300
|
+
}
|
|
301
|
+
__name(serialize, "serialize");
|
|
302
|
+
function decode(str) {
|
|
303
|
+
return str.indexOf("%") !== -1 ? decodeURIComponent(str) : str;
|
|
304
|
+
}
|
|
305
|
+
__name(decode, "decode");
|
|
306
|
+
function isDate(val) {
|
|
307
|
+
return __toString.call(val) === "[object Date]";
|
|
308
|
+
}
|
|
309
|
+
__name(isDate, "isDate");
|
|
310
|
+
function tryDecode(str, decode2) {
|
|
311
|
+
try {
|
|
312
|
+
return decode2(str);
|
|
313
|
+
} catch (e) {
|
|
314
|
+
return str;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
__name(tryDecode, "tryDecode");
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
// ../../node_modules/.pnpm/@azure+functions@4.12.0/node_modules/@azure/functions/dist/azure-functions.js
|
|
322
|
+
var require_azure_functions = __commonJS({
|
|
323
|
+
"../../node_modules/.pnpm/@azure+functions@4.12.0/node_modules/@azure/functions/dist/azure-functions.js"(exports, module) {
|
|
324
|
+
"use strict";
|
|
325
|
+
init_cjs_shim();
|
|
326
|
+
(() => {
|
|
327
|
+
"use strict";
|
|
328
|
+
var __webpack_modules__ = {
|
|
329
|
+
/***/
|
|
330
|
+
"./src/InvocationContext.ts"(__unused_webpack_module, exports2, __webpack_require__2) {
|
|
331
|
+
var __classPrivateFieldSet = this && this.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
|
|
332
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
333
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
334
|
+
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");
|
|
335
|
+
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
336
|
+
};
|
|
337
|
+
var __classPrivateFieldGet = this && this.__classPrivateFieldGet || function(receiver, state, kind, f) {
|
|
338
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
339
|
+
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");
|
|
340
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
341
|
+
};
|
|
342
|
+
var _InvocationContext_userLogHandler, _InvocationContextExtraInputs_inputs, _InvocationContextExtraOutputs_outputs;
|
|
343
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
344
|
+
exports2.InvocationContext = void 0;
|
|
345
|
+
const fallbackLogHandler_1 = __webpack_require__2(
|
|
346
|
+
/*! ./utils/fallbackLogHandler */
|
|
347
|
+
"./src/utils/fallbackLogHandler.ts"
|
|
348
|
+
);
|
|
349
|
+
class InvocationContext {
|
|
350
|
+
static {
|
|
351
|
+
__name(this, "InvocationContext");
|
|
352
|
+
}
|
|
353
|
+
constructor(init) {
|
|
354
|
+
var _a, _b, _c, _d;
|
|
355
|
+
_InvocationContext_userLogHandler.set(this, void 0);
|
|
356
|
+
init = init || {};
|
|
357
|
+
const fallbackString = "unknown";
|
|
358
|
+
this.invocationId = init.invocationId || fallbackString;
|
|
359
|
+
this.functionName = init.functionName || fallbackString;
|
|
360
|
+
this.extraInputs = new InvocationContextExtraInputs();
|
|
361
|
+
this.extraOutputs = new InvocationContextExtraOutputs();
|
|
362
|
+
this.retryContext = init.retryContext;
|
|
363
|
+
this.traceContext = init.traceContext;
|
|
364
|
+
this.triggerMetadata = init.triggerMetadata;
|
|
365
|
+
this.options = {
|
|
366
|
+
trigger: ((_a = init.options) === null || _a === void 0 ? void 0 : _a.trigger) || {
|
|
367
|
+
name: fallbackString,
|
|
368
|
+
type: fallbackString
|
|
369
|
+
},
|
|
370
|
+
return: (_b = init.options) === null || _b === void 0 ? void 0 : _b.return,
|
|
371
|
+
extraInputs: ((_c = init.options) === null || _c === void 0 ? void 0 : _c.extraInputs) || [],
|
|
372
|
+
extraOutputs: ((_d = init.options) === null || _d === void 0 ? void 0 : _d.extraOutputs) || []
|
|
373
|
+
};
|
|
374
|
+
__classPrivateFieldSet(this, _InvocationContext_userLogHandler, init.logHandler || fallbackLogHandler_1.fallbackLogHandler, "f");
|
|
375
|
+
}
|
|
376
|
+
log(...args) {
|
|
377
|
+
__classPrivateFieldGet(this, _InvocationContext_userLogHandler, "f").call(this, "information", ...args);
|
|
378
|
+
}
|
|
379
|
+
trace(...args) {
|
|
380
|
+
__classPrivateFieldGet(this, _InvocationContext_userLogHandler, "f").call(this, "trace", ...args);
|
|
381
|
+
}
|
|
382
|
+
debug(...args) {
|
|
383
|
+
__classPrivateFieldGet(this, _InvocationContext_userLogHandler, "f").call(this, "debug", ...args);
|
|
384
|
+
}
|
|
385
|
+
info(...args) {
|
|
386
|
+
__classPrivateFieldGet(this, _InvocationContext_userLogHandler, "f").call(this, "information", ...args);
|
|
387
|
+
}
|
|
388
|
+
warn(...args) {
|
|
389
|
+
__classPrivateFieldGet(this, _InvocationContext_userLogHandler, "f").call(this, "warning", ...args);
|
|
390
|
+
}
|
|
391
|
+
error(...args) {
|
|
392
|
+
__classPrivateFieldGet(this, _InvocationContext_userLogHandler, "f").call(this, "error", ...args);
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
exports2.InvocationContext = InvocationContext;
|
|
396
|
+
_InvocationContext_userLogHandler = /* @__PURE__ */ new WeakMap();
|
|
397
|
+
class InvocationContextExtraInputs {
|
|
398
|
+
static {
|
|
399
|
+
__name(this, "InvocationContextExtraInputs");
|
|
400
|
+
}
|
|
401
|
+
constructor() {
|
|
402
|
+
_InvocationContextExtraInputs_inputs.set(this, {});
|
|
403
|
+
}
|
|
404
|
+
get(inputOrName) {
|
|
405
|
+
const name = typeof inputOrName === "string" ? inputOrName : inputOrName.name;
|
|
406
|
+
return __classPrivateFieldGet(this, _InvocationContextExtraInputs_inputs, "f")[name];
|
|
407
|
+
}
|
|
408
|
+
set(inputOrName, value) {
|
|
409
|
+
const name = typeof inputOrName === "string" ? inputOrName : inputOrName.name;
|
|
410
|
+
__classPrivateFieldGet(this, _InvocationContextExtraInputs_inputs, "f")[name] = value;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
_InvocationContextExtraInputs_inputs = /* @__PURE__ */ new WeakMap();
|
|
414
|
+
class InvocationContextExtraOutputs {
|
|
415
|
+
static {
|
|
416
|
+
__name(this, "InvocationContextExtraOutputs");
|
|
417
|
+
}
|
|
418
|
+
constructor() {
|
|
419
|
+
_InvocationContextExtraOutputs_outputs.set(this, {});
|
|
420
|
+
}
|
|
421
|
+
get(outputOrName) {
|
|
422
|
+
const name = typeof outputOrName === "string" ? outputOrName : outputOrName.name;
|
|
423
|
+
return __classPrivateFieldGet(this, _InvocationContextExtraOutputs_outputs, "f")[name];
|
|
424
|
+
}
|
|
425
|
+
set(outputOrName, value) {
|
|
426
|
+
const name = typeof outputOrName === "string" ? outputOrName : outputOrName.name;
|
|
427
|
+
__classPrivateFieldGet(this, _InvocationContextExtraOutputs_outputs, "f")[name] = value;
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
_InvocationContextExtraOutputs_outputs = /* @__PURE__ */ new WeakMap();
|
|
431
|
+
},
|
|
432
|
+
/***/
|
|
433
|
+
"./src/InvocationModel.ts"(__unused_webpack_module, exports2, __webpack_require__2) {
|
|
434
|
+
var __awaiter = this && this.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
435
|
+
function adopt(value) {
|
|
436
|
+
return value instanceof P ? value : new P(function(resolve) {
|
|
437
|
+
resolve(value);
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
__name(adopt, "adopt");
|
|
441
|
+
return new (P || (P = Promise))(function(resolve, reject) {
|
|
442
|
+
function fulfilled(value) {
|
|
443
|
+
try {
|
|
444
|
+
step(generator.next(value));
|
|
445
|
+
} catch (e) {
|
|
446
|
+
reject(e);
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
__name(fulfilled, "fulfilled");
|
|
450
|
+
function rejected(value) {
|
|
451
|
+
try {
|
|
452
|
+
step(generator["throw"](value));
|
|
453
|
+
} catch (e) {
|
|
454
|
+
reject(e);
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
__name(rejected, "rejected");
|
|
458
|
+
function step(result) {
|
|
459
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
460
|
+
}
|
|
461
|
+
__name(step, "step");
|
|
462
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
463
|
+
});
|
|
464
|
+
};
|
|
465
|
+
var __classPrivateFieldSet = this && this.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
|
|
466
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
467
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
468
|
+
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");
|
|
469
|
+
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
470
|
+
};
|
|
471
|
+
var __classPrivateFieldGet = this && this.__classPrivateFieldGet || function(receiver, state, kind, f) {
|
|
472
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
473
|
+
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");
|
|
474
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
475
|
+
};
|
|
476
|
+
var _InvocationModel_instances, _InvocationModel_isDone, _InvocationModel_coreCtx, _InvocationModel_functionName, _InvocationModel_bindings, _InvocationModel_triggerType, _InvocationModel_convertOutput, _InvocationModel_log, _InvocationModel_systemLog, _InvocationModel_userLog;
|
|
477
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
478
|
+
exports2.InvocationModel = void 0;
|
|
479
|
+
const util_1 = __webpack_require__2(
|
|
480
|
+
/*! util */
|
|
481
|
+
"util"
|
|
482
|
+
);
|
|
483
|
+
const constants_1 = __webpack_require__2(
|
|
484
|
+
/*! ./constants */
|
|
485
|
+
"./src/constants.ts"
|
|
486
|
+
);
|
|
487
|
+
const fromRpcBindings_1 = __webpack_require__2(
|
|
488
|
+
/*! ./converters/fromRpcBindings */
|
|
489
|
+
"./src/converters/fromRpcBindings.ts"
|
|
490
|
+
);
|
|
491
|
+
const fromRpcContext_1 = __webpack_require__2(
|
|
492
|
+
/*! ./converters/fromRpcContext */
|
|
493
|
+
"./src/converters/fromRpcContext.ts"
|
|
494
|
+
);
|
|
495
|
+
const fromRpcTriggerMetadata_1 = __webpack_require__2(
|
|
496
|
+
/*! ./converters/fromRpcTriggerMetadata */
|
|
497
|
+
"./src/converters/fromRpcTriggerMetadata.ts"
|
|
498
|
+
);
|
|
499
|
+
const fromRpcTypedData_1 = __webpack_require__2(
|
|
500
|
+
/*! ./converters/fromRpcTypedData */
|
|
501
|
+
"./src/converters/fromRpcTypedData.ts"
|
|
502
|
+
);
|
|
503
|
+
const toCamelCase_1 = __webpack_require__2(
|
|
504
|
+
/*! ./converters/toCamelCase */
|
|
505
|
+
"./src/converters/toCamelCase.ts"
|
|
506
|
+
);
|
|
507
|
+
const toRpcHttp_1 = __webpack_require__2(
|
|
508
|
+
/*! ./converters/toRpcHttp */
|
|
509
|
+
"./src/converters/toRpcHttp.ts"
|
|
510
|
+
);
|
|
511
|
+
const toRpcTypedData_1 = __webpack_require__2(
|
|
512
|
+
/*! ./converters/toRpcTypedData */
|
|
513
|
+
"./src/converters/toRpcTypedData.ts"
|
|
514
|
+
);
|
|
515
|
+
const errors_1 = __webpack_require__2(
|
|
516
|
+
/*! ./errors */
|
|
517
|
+
"./src/errors.ts"
|
|
518
|
+
);
|
|
519
|
+
const httpProxy_1 = __webpack_require__2(
|
|
520
|
+
/*! ./http/httpProxy */
|
|
521
|
+
"./src/http/httpProxy.ts"
|
|
522
|
+
);
|
|
523
|
+
const HttpRequest_1 = __webpack_require__2(
|
|
524
|
+
/*! ./http/HttpRequest */
|
|
525
|
+
"./src/http/HttpRequest.ts"
|
|
526
|
+
);
|
|
527
|
+
const InvocationContext_1 = __webpack_require__2(
|
|
528
|
+
/*! ./InvocationContext */
|
|
529
|
+
"./src/InvocationContext.ts"
|
|
530
|
+
);
|
|
531
|
+
const setup_1 = __webpack_require__2(
|
|
532
|
+
/*! ./setup */
|
|
533
|
+
"./src/setup.ts"
|
|
534
|
+
);
|
|
535
|
+
const isTrigger_1 = __webpack_require__2(
|
|
536
|
+
/*! ./utils/isTrigger */
|
|
537
|
+
"./src/utils/isTrigger.ts"
|
|
538
|
+
);
|
|
539
|
+
const nonNull_1 = __webpack_require__2(
|
|
540
|
+
/*! ./utils/nonNull */
|
|
541
|
+
"./src/utils/nonNull.ts"
|
|
542
|
+
);
|
|
543
|
+
class InvocationModel {
|
|
544
|
+
static {
|
|
545
|
+
__name(this, "InvocationModel");
|
|
546
|
+
}
|
|
547
|
+
constructor(coreCtx) {
|
|
548
|
+
_InvocationModel_instances.add(this);
|
|
549
|
+
_InvocationModel_isDone.set(this, false);
|
|
550
|
+
_InvocationModel_coreCtx.set(this, void 0);
|
|
551
|
+
_InvocationModel_functionName.set(this, void 0);
|
|
552
|
+
_InvocationModel_bindings.set(this, void 0);
|
|
553
|
+
_InvocationModel_triggerType.set(this, void 0);
|
|
554
|
+
__classPrivateFieldSet(this, _InvocationModel_coreCtx, coreCtx, "f");
|
|
555
|
+
__classPrivateFieldSet(this, _InvocationModel_functionName, (0, nonNull_1.nonNullProp)(coreCtx.metadata, "name"), "f");
|
|
556
|
+
__classPrivateFieldSet(this, _InvocationModel_bindings, (0, nonNull_1.nonNullProp)(coreCtx.metadata, "bindings"), "f");
|
|
557
|
+
const triggerBinding = (0, nonNull_1.nonNullValue)(Object.values(__classPrivateFieldGet(this, _InvocationModel_bindings, "f")).find((b) => (0, isTrigger_1.isTrigger)(b.type)), "triggerBinding");
|
|
558
|
+
__classPrivateFieldSet(this, _InvocationModel_triggerType, (0, nonNull_1.nonNullProp)(triggerBinding, "type"), "f");
|
|
559
|
+
}
|
|
560
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
561
|
+
getArguments() {
|
|
562
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
563
|
+
const req = __classPrivateFieldGet(this, _InvocationModel_coreCtx, "f").request;
|
|
564
|
+
const context = new InvocationContext_1.InvocationContext({
|
|
565
|
+
invocationId: (0, nonNull_1.nonNullProp)(__classPrivateFieldGet(this, _InvocationModel_coreCtx, "f"), "invocationId"),
|
|
566
|
+
functionName: __classPrivateFieldGet(this, _InvocationModel_functionName, "f"),
|
|
567
|
+
logHandler: /* @__PURE__ */ __name((level, ...args) => __classPrivateFieldGet(this, _InvocationModel_instances, "m", _InvocationModel_userLog).call(this, level, ...args), "logHandler"),
|
|
568
|
+
retryContext: (0, fromRpcContext_1.fromRpcRetryContext)(req.retryContext),
|
|
569
|
+
traceContext: (0, fromRpcContext_1.fromRpcTraceContext)(req.traceContext),
|
|
570
|
+
triggerMetadata: (0, fromRpcTriggerMetadata_1.fromRpcTriggerMetadata)(req.triggerMetadata, __classPrivateFieldGet(this, _InvocationModel_triggerType, "f")),
|
|
571
|
+
options: (0, fromRpcBindings_1.fromRpcBindings)(__classPrivateFieldGet(this, _InvocationModel_bindings, "f"))
|
|
572
|
+
});
|
|
573
|
+
const inputs = [];
|
|
574
|
+
if (req.inputData) {
|
|
575
|
+
for (const binding of req.inputData) {
|
|
576
|
+
const bindingName = (0, nonNull_1.nonNullProp)(binding, "name");
|
|
577
|
+
const rpcBinding = __classPrivateFieldGet(this, _InvocationModel_bindings, "f")[bindingName];
|
|
578
|
+
if (!rpcBinding) {
|
|
579
|
+
throw new errors_1.AzFuncSystemError(`Failed to find binding "${bindingName}" in bindings "${Object.keys(__classPrivateFieldGet(this, _InvocationModel_bindings, "f")).join(", ")}".`);
|
|
580
|
+
}
|
|
581
|
+
const bindingType = rpcBinding.type;
|
|
582
|
+
let input;
|
|
583
|
+
if ((0, isTrigger_1.isHttpTrigger)(bindingType) && setup_1.enableHttpStream) {
|
|
584
|
+
const proxyRequest = yield (0, httpProxy_1.waitForProxyRequest)(__classPrivateFieldGet(this, _InvocationModel_coreCtx, "f").invocationId);
|
|
585
|
+
input = (0, HttpRequest_1.createStreamRequest)(proxyRequest, (0, nonNull_1.nonNullProp)(req, "triggerMetadata"));
|
|
586
|
+
} else {
|
|
587
|
+
input = (0, fromRpcTypedData_1.fromRpcTypedData)(binding.data);
|
|
588
|
+
}
|
|
589
|
+
if ((0, isTrigger_1.isTimerTrigger)(bindingType)) {
|
|
590
|
+
input = (0, toCamelCase_1.toCamelCaseValue)(input);
|
|
591
|
+
}
|
|
592
|
+
if ((0, isTrigger_1.isTrigger)(bindingType)) {
|
|
593
|
+
inputs.push(input);
|
|
594
|
+
} else {
|
|
595
|
+
context.extraInputs.set(bindingName, input);
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
return { context, inputs };
|
|
600
|
+
});
|
|
601
|
+
}
|
|
602
|
+
invokeFunction(context, inputs, handler2) {
|
|
603
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
604
|
+
try {
|
|
605
|
+
return yield Promise.resolve(handler2(...inputs, context));
|
|
606
|
+
} finally {
|
|
607
|
+
__classPrivateFieldSet(this, _InvocationModel_isDone, true, "f");
|
|
608
|
+
}
|
|
609
|
+
});
|
|
610
|
+
}
|
|
611
|
+
getResponse(context, result) {
|
|
612
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
613
|
+
const response = { invocationId: __classPrivateFieldGet(this, _InvocationModel_coreCtx, "f").invocationId };
|
|
614
|
+
response.outputData = [];
|
|
615
|
+
let usedReturnValue = false;
|
|
616
|
+
for (const [name, binding] of Object.entries(__classPrivateFieldGet(this, _InvocationModel_bindings, "f"))) {
|
|
617
|
+
if (binding.direction === "out") {
|
|
618
|
+
if (name === constants_1.returnBindingKey) {
|
|
619
|
+
response.returnValue = yield __classPrivateFieldGet(this, _InvocationModel_instances, "m", _InvocationModel_convertOutput).call(this, context.invocationId, binding, result);
|
|
620
|
+
usedReturnValue = true;
|
|
621
|
+
} else {
|
|
622
|
+
const outputValue = yield __classPrivateFieldGet(this, _InvocationModel_instances, "m", _InvocationModel_convertOutput).call(this, context.invocationId, binding, context.extraOutputs.get(name));
|
|
623
|
+
if ((0, nonNull_1.isDefined)(outputValue)) {
|
|
624
|
+
response.outputData.push({ name, data: outputValue });
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
if (!usedReturnValue && !(0, isTrigger_1.isHttpTrigger)(__classPrivateFieldGet(this, _InvocationModel_triggerType, "f"))) {
|
|
630
|
+
response.returnValue = (0, toRpcTypedData_1.toRpcTypedData)(result);
|
|
631
|
+
}
|
|
632
|
+
return response;
|
|
633
|
+
});
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
exports2.InvocationModel = InvocationModel;
|
|
637
|
+
_InvocationModel_isDone = /* @__PURE__ */ new WeakMap(), _InvocationModel_coreCtx = /* @__PURE__ */ new WeakMap(), _InvocationModel_functionName = /* @__PURE__ */ new WeakMap(), _InvocationModel_bindings = /* @__PURE__ */ new WeakMap(), _InvocationModel_triggerType = /* @__PURE__ */ new WeakMap(), _InvocationModel_instances = /* @__PURE__ */ new WeakSet(), _InvocationModel_convertOutput = /* @__PURE__ */ __name(function _InvocationModel_convertOutput2(invocationId, binding, value) {
|
|
638
|
+
var _a;
|
|
639
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
640
|
+
if (((_a = binding.type) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === "http") {
|
|
641
|
+
return (0, toRpcHttp_1.toRpcHttp)(invocationId, value);
|
|
642
|
+
} else {
|
|
643
|
+
return (0, toRpcTypedData_1.toRpcTypedData)(value);
|
|
644
|
+
}
|
|
645
|
+
});
|
|
646
|
+
}, "_InvocationModel_convertOutput"), _InvocationModel_log = /* @__PURE__ */ __name(function _InvocationModel_log2(level, logCategory, ...args) {
|
|
647
|
+
__classPrivateFieldGet(this, _InvocationModel_coreCtx, "f").log(level, logCategory, (0, util_1.format)(...args));
|
|
648
|
+
}, "_InvocationModel_log"), _InvocationModel_systemLog = /* @__PURE__ */ __name(function _InvocationModel_systemLog2(level, ...args) {
|
|
649
|
+
__classPrivateFieldGet(this, _InvocationModel_instances, "m", _InvocationModel_log).call(this, level, "system", ...args);
|
|
650
|
+
}, "_InvocationModel_systemLog"), _InvocationModel_userLog = /* @__PURE__ */ __name(function _InvocationModel_userLog2(level, ...args) {
|
|
651
|
+
if (__classPrivateFieldGet(this, _InvocationModel_isDone, "f") && __classPrivateFieldGet(this, _InvocationModel_coreCtx, "f").state !== "postInvocationHooks") {
|
|
652
|
+
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. ";
|
|
653
|
+
badAsyncMsg += `Function name: ${__classPrivateFieldGet(this, _InvocationModel_functionName, "f")}. Invocation Id: ${__classPrivateFieldGet(this, _InvocationModel_coreCtx, "f").invocationId}.`;
|
|
654
|
+
__classPrivateFieldGet(this, _InvocationModel_instances, "m", _InvocationModel_systemLog).call(this, "warning", badAsyncMsg);
|
|
655
|
+
}
|
|
656
|
+
__classPrivateFieldGet(this, _InvocationModel_instances, "m", _InvocationModel_log).call(this, level, "user", ...args);
|
|
657
|
+
}, "_InvocationModel_userLog");
|
|
658
|
+
},
|
|
659
|
+
/***/
|
|
660
|
+
"./src/ProgrammingModel.ts"(__unused_webpack_module, exports2, __webpack_require__2) {
|
|
661
|
+
var __awaiter = this && this.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
662
|
+
function adopt(value) {
|
|
663
|
+
return value instanceof P ? value : new P(function(resolve) {
|
|
664
|
+
resolve(value);
|
|
665
|
+
});
|
|
666
|
+
}
|
|
667
|
+
__name(adopt, "adopt");
|
|
668
|
+
return new (P || (P = Promise))(function(resolve, reject) {
|
|
669
|
+
function fulfilled(value) {
|
|
670
|
+
try {
|
|
671
|
+
step(generator.next(value));
|
|
672
|
+
} catch (e) {
|
|
673
|
+
reject(e);
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
__name(fulfilled, "fulfilled");
|
|
677
|
+
function rejected(value) {
|
|
678
|
+
try {
|
|
679
|
+
step(generator["throw"](value));
|
|
680
|
+
} catch (e) {
|
|
681
|
+
reject(e);
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
__name(rejected, "rejected");
|
|
685
|
+
function step(result) {
|
|
686
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
687
|
+
}
|
|
688
|
+
__name(step, "step");
|
|
689
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
690
|
+
});
|
|
691
|
+
};
|
|
692
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
693
|
+
exports2.ProgrammingModel = void 0;
|
|
694
|
+
const constants_1 = __webpack_require__2(
|
|
695
|
+
/*! ./constants */
|
|
696
|
+
"./src/constants.ts"
|
|
697
|
+
);
|
|
698
|
+
const httpProxy_1 = __webpack_require__2(
|
|
699
|
+
/*! ./http/httpProxy */
|
|
700
|
+
"./src/http/httpProxy.ts"
|
|
701
|
+
);
|
|
702
|
+
const InvocationModel_1 = __webpack_require__2(
|
|
703
|
+
/*! ./InvocationModel */
|
|
704
|
+
"./src/InvocationModel.ts"
|
|
705
|
+
);
|
|
706
|
+
const setup_1 = __webpack_require__2(
|
|
707
|
+
/*! ./setup */
|
|
708
|
+
"./src/setup.ts"
|
|
709
|
+
);
|
|
710
|
+
class ProgrammingModel {
|
|
711
|
+
static {
|
|
712
|
+
__name(this, "ProgrammingModel");
|
|
713
|
+
}
|
|
714
|
+
constructor() {
|
|
715
|
+
this.name = "@azure/functions";
|
|
716
|
+
this.version = constants_1.version;
|
|
717
|
+
}
|
|
718
|
+
getInvocationModel(coreCtx) {
|
|
719
|
+
return new InvocationModel_1.InvocationModel(coreCtx);
|
|
720
|
+
}
|
|
721
|
+
getCapabilities(workerCapabilities) {
|
|
722
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
723
|
+
(0, setup_1.lockSetup)();
|
|
724
|
+
if (setup_1.enableHttpStream) {
|
|
725
|
+
const httpUri = yield (0, httpProxy_1.setupHttpProxy)();
|
|
726
|
+
workerCapabilities.HttpUri = httpUri;
|
|
727
|
+
}
|
|
728
|
+
Object.assign(workerCapabilities, setup_1.capabilities);
|
|
729
|
+
return workerCapabilities;
|
|
730
|
+
});
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
exports2.ProgrammingModel = ProgrammingModel;
|
|
734
|
+
},
|
|
735
|
+
/***/
|
|
736
|
+
"./src/addBindingName.ts"(__unused_webpack_module, exports2, __webpack_require__2) {
|
|
737
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
738
|
+
exports2.addBindingName = void 0;
|
|
739
|
+
const getRandomHexString_1 = __webpack_require__2(
|
|
740
|
+
/*! ./utils/getRandomHexString */
|
|
741
|
+
"./src/utils/getRandomHexString.ts"
|
|
742
|
+
);
|
|
743
|
+
function addBindingName(binding, suffix) {
|
|
744
|
+
if (!binding.name) {
|
|
745
|
+
let bindingType = binding.type;
|
|
746
|
+
if (!bindingType.toLowerCase().endsWith(suffix.toLowerCase())) {
|
|
747
|
+
bindingType += suffix;
|
|
748
|
+
}
|
|
749
|
+
binding.name = bindingType + (0, getRandomHexString_1.getStringHash)(JSON.stringify(binding));
|
|
750
|
+
}
|
|
751
|
+
return binding;
|
|
752
|
+
}
|
|
753
|
+
__name(addBindingName, "addBindingName");
|
|
754
|
+
exports2.addBindingName = addBindingName;
|
|
755
|
+
},
|
|
756
|
+
/***/
|
|
757
|
+
"./src/app.ts"(__unused_webpack_module, exports2, __webpack_require__2) {
|
|
758
|
+
var __rest = this && this.__rest || function(s, e) {
|
|
759
|
+
var t = {};
|
|
760
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
761
|
+
t[p] = s[p];
|
|
762
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
763
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
764
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
765
|
+
t[p[i]] = s[p[i]];
|
|
766
|
+
}
|
|
767
|
+
return t;
|
|
768
|
+
};
|
|
769
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
770
|
+
exports2.generic = exports2.mcpResource = exports2.mcpTool = exports2.webPubSub = exports2.mySql = exports2.sql = exports2.warmup = exports2.cosmosDB = exports2.eventGrid = exports2.eventHub = exports2.serviceBusTopic = exports2.serviceBusQueue = exports2.storageQueue = exports2.storageBlob = exports2.timer = exports2.http = exports2.deleteRequest = exports2.patch = exports2.post = exports2.put = exports2.get = exports2.setup = exports2.hook = void 0;
|
|
771
|
+
const toCoreFunctionMetadata_1 = __webpack_require__2(
|
|
772
|
+
/*! ./converters/toCoreFunctionMetadata */
|
|
773
|
+
"./src/converters/toCoreFunctionMetadata.ts"
|
|
774
|
+
);
|
|
775
|
+
const output = __webpack_require__2(
|
|
776
|
+
/*! ./output */
|
|
777
|
+
"./src/output.ts"
|
|
778
|
+
);
|
|
779
|
+
const ProgrammingModel_1 = __webpack_require__2(
|
|
780
|
+
/*! ./ProgrammingModel */
|
|
781
|
+
"./src/ProgrammingModel.ts"
|
|
782
|
+
);
|
|
783
|
+
const trigger = __webpack_require__2(
|
|
784
|
+
/*! ./trigger */
|
|
785
|
+
"./src/trigger.ts"
|
|
786
|
+
);
|
|
787
|
+
const tryGetCoreApiLazy_1 = __webpack_require__2(
|
|
788
|
+
/*! ./utils/tryGetCoreApiLazy */
|
|
789
|
+
"./src/utils/tryGetCoreApiLazy.ts"
|
|
790
|
+
);
|
|
791
|
+
exports2.hook = __webpack_require__2(
|
|
792
|
+
/*! ./hooks/registerHook */
|
|
793
|
+
"./src/hooks/registerHook.ts"
|
|
794
|
+
);
|
|
795
|
+
var setup_1 = __webpack_require__2(
|
|
796
|
+
/*! ./setup */
|
|
797
|
+
"./src/setup.ts"
|
|
798
|
+
);
|
|
799
|
+
Object.defineProperty(exports2, "setup", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
800
|
+
return setup_1.setup;
|
|
801
|
+
}, "get") });
|
|
802
|
+
let hasSetModel = false;
|
|
803
|
+
function setProgrammingModel() {
|
|
804
|
+
const coreApi = (0, tryGetCoreApiLazy_1.tryGetCoreApiLazy)();
|
|
805
|
+
if (!coreApi) {
|
|
806
|
+
console.warn('WARNING: Failed to detect the Azure Functions runtime. Switching "@azure/functions" package to test mode - not all features are supported.');
|
|
807
|
+
} else {
|
|
808
|
+
coreApi.setProgrammingModel(new ProgrammingModel_1.ProgrammingModel());
|
|
809
|
+
}
|
|
810
|
+
hasSetModel = true;
|
|
811
|
+
}
|
|
812
|
+
__name(setProgrammingModel, "setProgrammingModel");
|
|
813
|
+
function convertToHttpOptions(optionsOrHandler, method) {
|
|
814
|
+
const options = typeof optionsOrHandler === "function" ? { handler: optionsOrHandler } : optionsOrHandler;
|
|
815
|
+
options.methods = [method];
|
|
816
|
+
return options;
|
|
817
|
+
}
|
|
818
|
+
__name(convertToHttpOptions, "convertToHttpOptions");
|
|
819
|
+
function convertToGenericOptions(options, triggerMethod) {
|
|
820
|
+
const { handler: handler2, return: ret, trigger: trigger2, extraInputs, extraOutputs, retry } = options, triggerOptions = __rest(options, ["handler", "return", "trigger", "extraInputs", "extraOutputs", "retry"]);
|
|
821
|
+
return {
|
|
822
|
+
trigger: trigger2 !== null && trigger2 !== void 0 ? trigger2 : triggerMethod(triggerOptions),
|
|
823
|
+
return: ret,
|
|
824
|
+
retry,
|
|
825
|
+
extraInputs,
|
|
826
|
+
extraOutputs,
|
|
827
|
+
handler: handler2
|
|
828
|
+
};
|
|
829
|
+
}
|
|
830
|
+
__name(convertToGenericOptions, "convertToGenericOptions");
|
|
831
|
+
function get(name, optionsOrHandler) {
|
|
832
|
+
http(name, convertToHttpOptions(optionsOrHandler, "GET"));
|
|
833
|
+
}
|
|
834
|
+
__name(get, "get");
|
|
835
|
+
exports2.get = get;
|
|
836
|
+
function put(name, optionsOrHandler) {
|
|
837
|
+
http(name, convertToHttpOptions(optionsOrHandler, "PUT"));
|
|
838
|
+
}
|
|
839
|
+
__name(put, "put");
|
|
840
|
+
exports2.put = put;
|
|
841
|
+
function post(name, optionsOrHandler) {
|
|
842
|
+
http(name, convertToHttpOptions(optionsOrHandler, "POST"));
|
|
843
|
+
}
|
|
844
|
+
__name(post, "post");
|
|
845
|
+
exports2.post = post;
|
|
846
|
+
function patch(name, optionsOrHandler) {
|
|
847
|
+
http(name, convertToHttpOptions(optionsOrHandler, "PATCH"));
|
|
848
|
+
}
|
|
849
|
+
__name(patch, "patch");
|
|
850
|
+
exports2.patch = patch;
|
|
851
|
+
function deleteRequest(name, optionsOrHandler) {
|
|
852
|
+
http(name, convertToHttpOptions(optionsOrHandler, "DELETE"));
|
|
853
|
+
}
|
|
854
|
+
__name(deleteRequest, "deleteRequest");
|
|
855
|
+
exports2.deleteRequest = deleteRequest;
|
|
856
|
+
function http(name, options) {
|
|
857
|
+
options.return || (options.return = output.http({}));
|
|
858
|
+
generic(name, convertToGenericOptions(options, trigger.http));
|
|
859
|
+
}
|
|
860
|
+
__name(http, "http");
|
|
861
|
+
exports2.http = http;
|
|
862
|
+
function timer(name, options) {
|
|
863
|
+
generic(name, convertToGenericOptions(options, trigger.timer));
|
|
864
|
+
}
|
|
865
|
+
__name(timer, "timer");
|
|
866
|
+
exports2.timer = timer;
|
|
867
|
+
function storageBlob(name, options) {
|
|
868
|
+
generic(name, convertToGenericOptions(options, trigger.storageBlob));
|
|
869
|
+
}
|
|
870
|
+
__name(storageBlob, "storageBlob");
|
|
871
|
+
exports2.storageBlob = storageBlob;
|
|
872
|
+
function storageQueue(name, options) {
|
|
873
|
+
generic(name, convertToGenericOptions(options, trigger.storageQueue));
|
|
874
|
+
}
|
|
875
|
+
__name(storageQueue, "storageQueue");
|
|
876
|
+
exports2.storageQueue = storageQueue;
|
|
877
|
+
function serviceBusQueue(name, options) {
|
|
878
|
+
generic(name, convertToGenericOptions(options, trigger.serviceBusQueue));
|
|
879
|
+
}
|
|
880
|
+
__name(serviceBusQueue, "serviceBusQueue");
|
|
881
|
+
exports2.serviceBusQueue = serviceBusQueue;
|
|
882
|
+
function serviceBusTopic(name, options) {
|
|
883
|
+
generic(name, convertToGenericOptions(options, trigger.serviceBusTopic));
|
|
884
|
+
}
|
|
885
|
+
__name(serviceBusTopic, "serviceBusTopic");
|
|
886
|
+
exports2.serviceBusTopic = serviceBusTopic;
|
|
887
|
+
function eventHub(name, options) {
|
|
888
|
+
generic(name, convertToGenericOptions(options, trigger.eventHub));
|
|
889
|
+
}
|
|
890
|
+
__name(eventHub, "eventHub");
|
|
891
|
+
exports2.eventHub = eventHub;
|
|
892
|
+
function eventGrid(name, options) {
|
|
893
|
+
generic(name, convertToGenericOptions(options, trigger.eventGrid));
|
|
894
|
+
}
|
|
895
|
+
__name(eventGrid, "eventGrid");
|
|
896
|
+
exports2.eventGrid = eventGrid;
|
|
897
|
+
function cosmosDB(name, options) {
|
|
898
|
+
generic(name, convertToGenericOptions(options, trigger.cosmosDB));
|
|
899
|
+
}
|
|
900
|
+
__name(cosmosDB, "cosmosDB");
|
|
901
|
+
exports2.cosmosDB = cosmosDB;
|
|
902
|
+
function warmup(name, options) {
|
|
903
|
+
generic(name, convertToGenericOptions(options, trigger.warmup));
|
|
904
|
+
}
|
|
905
|
+
__name(warmup, "warmup");
|
|
906
|
+
exports2.warmup = warmup;
|
|
907
|
+
function sql(name, options) {
|
|
908
|
+
generic(name, convertToGenericOptions(options, trigger.sql));
|
|
909
|
+
}
|
|
910
|
+
__name(sql, "sql");
|
|
911
|
+
exports2.sql = sql;
|
|
912
|
+
function mySql(name, options) {
|
|
913
|
+
generic(name, convertToGenericOptions(options, trigger.mySql));
|
|
914
|
+
}
|
|
915
|
+
__name(mySql, "mySql");
|
|
916
|
+
exports2.mySql = mySql;
|
|
917
|
+
function webPubSub(name, options) {
|
|
918
|
+
generic(name, convertToGenericOptions(options, trigger.webPubSub));
|
|
919
|
+
}
|
|
920
|
+
__name(webPubSub, "webPubSub");
|
|
921
|
+
exports2.webPubSub = webPubSub;
|
|
922
|
+
function mcpTool(name, options) {
|
|
923
|
+
generic(name, convertToGenericOptions(options, trigger.mcpTool));
|
|
924
|
+
}
|
|
925
|
+
__name(mcpTool, "mcpTool");
|
|
926
|
+
exports2.mcpTool = mcpTool;
|
|
927
|
+
function mcpResource(name, options) {
|
|
928
|
+
generic(name, convertToGenericOptions(options, trigger.mcpResource));
|
|
929
|
+
}
|
|
930
|
+
__name(mcpResource, "mcpResource");
|
|
931
|
+
exports2.mcpResource = mcpResource;
|
|
932
|
+
function generic(name, options) {
|
|
933
|
+
if (!hasSetModel) {
|
|
934
|
+
setProgrammingModel();
|
|
935
|
+
}
|
|
936
|
+
const coreApi = (0, tryGetCoreApiLazy_1.tryGetCoreApiLazy)();
|
|
937
|
+
if (!coreApi) {
|
|
938
|
+
console.warn(`WARNING: Skipping call to register function "${name}" because the "@azure/functions" package is in test mode.`);
|
|
939
|
+
} else {
|
|
940
|
+
coreApi.registerFunction((0, toCoreFunctionMetadata_1.toCoreFunctionMetadata)(name, options), options.handler);
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
__name(generic, "generic");
|
|
944
|
+
exports2.generic = generic;
|
|
945
|
+
},
|
|
946
|
+
/***/
|
|
947
|
+
"./src/constants.ts"(__unused_webpack_module, exports2) {
|
|
948
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
949
|
+
exports2.returnBindingKey = exports2.version = void 0;
|
|
950
|
+
exports2.version = "4.12.0";
|
|
951
|
+
exports2.returnBindingKey = "$return";
|
|
952
|
+
},
|
|
953
|
+
/***/
|
|
954
|
+
"./src/converters/fromRpcBindings.ts"(__unused_webpack_module, exports2, __webpack_require__2) {
|
|
955
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
956
|
+
exports2.fromRpcBindings = void 0;
|
|
957
|
+
const constants_1 = __webpack_require__2(
|
|
958
|
+
/*! ../constants */
|
|
959
|
+
"./src/constants.ts"
|
|
960
|
+
);
|
|
961
|
+
const isTrigger_1 = __webpack_require__2(
|
|
962
|
+
/*! ../utils/isTrigger */
|
|
963
|
+
"./src/utils/isTrigger.ts"
|
|
964
|
+
);
|
|
965
|
+
const nonNull_1 = __webpack_require__2(
|
|
966
|
+
/*! ../utils/nonNull */
|
|
967
|
+
"./src/utils/nonNull.ts"
|
|
968
|
+
);
|
|
969
|
+
function fromRpcBindings(bindings) {
|
|
970
|
+
let trigger;
|
|
971
|
+
let returnBinding;
|
|
972
|
+
const extraInputs = [];
|
|
973
|
+
const extraOutputs = [];
|
|
974
|
+
for (const [name, binding] of Object.entries((0, nonNull_1.nonNullValue)(bindings, "bindings"))) {
|
|
975
|
+
if ((0, isTrigger_1.isTrigger)(binding.type)) {
|
|
976
|
+
trigger = fromRpcBinding(name, binding);
|
|
977
|
+
} else if (name === constants_1.returnBindingKey) {
|
|
978
|
+
returnBinding = fromRpcBinding(name, binding);
|
|
979
|
+
} else if (binding.direction === "in") {
|
|
980
|
+
extraInputs.push(fromRpcBinding(name, binding));
|
|
981
|
+
} else if (binding.direction === "out") {
|
|
982
|
+
extraOutputs.push(fromRpcBinding(name, binding));
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
return {
|
|
986
|
+
trigger: (0, nonNull_1.nonNullValue)(trigger, "trigger"),
|
|
987
|
+
return: returnBinding,
|
|
988
|
+
extraInputs,
|
|
989
|
+
extraOutputs
|
|
990
|
+
};
|
|
991
|
+
}
|
|
992
|
+
__name(fromRpcBindings, "fromRpcBindings");
|
|
993
|
+
exports2.fromRpcBindings = fromRpcBindings;
|
|
994
|
+
function fromRpcBinding(name, binding) {
|
|
995
|
+
return Object.assign(Object.assign({}, binding), { type: (0, nonNull_1.nonNullProp)(binding, "type"), name });
|
|
996
|
+
}
|
|
997
|
+
__name(fromRpcBinding, "fromRpcBinding");
|
|
998
|
+
},
|
|
999
|
+
/***/
|
|
1000
|
+
"./src/converters/fromRpcContext.ts"(__unused_webpack_module, exports2, __webpack_require__2) {
|
|
1001
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1002
|
+
exports2.fromRpcTraceContext = exports2.fromRpcRetryContext = void 0;
|
|
1003
|
+
const nonNull_1 = __webpack_require__2(
|
|
1004
|
+
/*! ../utils/nonNull */
|
|
1005
|
+
"./src/utils/nonNull.ts"
|
|
1006
|
+
);
|
|
1007
|
+
function fromRpcRetryContext(retryContext) {
|
|
1008
|
+
if (!retryContext) {
|
|
1009
|
+
return void 0;
|
|
1010
|
+
} else {
|
|
1011
|
+
const result = {
|
|
1012
|
+
retryCount: (0, nonNull_1.nonNullProp)(retryContext, "retryCount"),
|
|
1013
|
+
maxRetryCount: (0, nonNull_1.nonNullProp)(retryContext, "maxRetryCount")
|
|
1014
|
+
};
|
|
1015
|
+
if (retryContext.exception) {
|
|
1016
|
+
result.exception = fromRpcException(retryContext.exception);
|
|
1017
|
+
}
|
|
1018
|
+
return result;
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
__name(fromRpcRetryContext, "fromRpcRetryContext");
|
|
1022
|
+
exports2.fromRpcRetryContext = fromRpcRetryContext;
|
|
1023
|
+
function fromRpcException(exception) {
|
|
1024
|
+
const result = {};
|
|
1025
|
+
(0, nonNull_1.copyPropIfDefined)(exception, result, "message");
|
|
1026
|
+
(0, nonNull_1.copyPropIfDefined)(exception, result, "source");
|
|
1027
|
+
(0, nonNull_1.copyPropIfDefined)(exception, result, "stackTrace");
|
|
1028
|
+
return result;
|
|
1029
|
+
}
|
|
1030
|
+
__name(fromRpcException, "fromRpcException");
|
|
1031
|
+
function fromRpcTraceContext(traceContext) {
|
|
1032
|
+
if (!traceContext) {
|
|
1033
|
+
return void 0;
|
|
1034
|
+
} else {
|
|
1035
|
+
const result = {};
|
|
1036
|
+
(0, nonNull_1.copyPropIfDefined)(traceContext, result, "traceParent");
|
|
1037
|
+
(0, nonNull_1.copyPropIfDefined)(traceContext, result, "traceState");
|
|
1038
|
+
if (traceContext.attributes) {
|
|
1039
|
+
result.attributes = traceContext.attributes;
|
|
1040
|
+
}
|
|
1041
|
+
return result;
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
__name(fromRpcTraceContext, "fromRpcTraceContext");
|
|
1045
|
+
exports2.fromRpcTraceContext = fromRpcTraceContext;
|
|
1046
|
+
},
|
|
1047
|
+
/***/
|
|
1048
|
+
"./src/converters/fromRpcNullable.ts"(__unused_webpack_module, exports2) {
|
|
1049
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1050
|
+
exports2.fromNullableMapping = void 0;
|
|
1051
|
+
function fromNullableMapping(nullableMapping, originalMapping) {
|
|
1052
|
+
var _a;
|
|
1053
|
+
let converted = {};
|
|
1054
|
+
if (nullableMapping && Object.keys(nullableMapping).length > 0) {
|
|
1055
|
+
for (const key in nullableMapping) {
|
|
1056
|
+
converted[key] = ((_a = nullableMapping[key]) === null || _a === void 0 ? void 0 : _a.value) || "";
|
|
1057
|
+
}
|
|
1058
|
+
} else if (originalMapping && Object.keys(originalMapping).length > 0) {
|
|
1059
|
+
converted = originalMapping;
|
|
1060
|
+
}
|
|
1061
|
+
return converted;
|
|
1062
|
+
}
|
|
1063
|
+
__name(fromNullableMapping, "fromNullableMapping");
|
|
1064
|
+
exports2.fromNullableMapping = fromNullableMapping;
|
|
1065
|
+
},
|
|
1066
|
+
/***/
|
|
1067
|
+
"./src/converters/fromRpcTriggerMetadata.ts"(__unused_webpack_module, exports2, __webpack_require__2) {
|
|
1068
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1069
|
+
exports2.fromRpcTriggerMetadata = void 0;
|
|
1070
|
+
const isTrigger_1 = __webpack_require__2(
|
|
1071
|
+
/*! ../utils/isTrigger */
|
|
1072
|
+
"./src/utils/isTrigger.ts"
|
|
1073
|
+
);
|
|
1074
|
+
const fromRpcTypedData_1 = __webpack_require__2(
|
|
1075
|
+
/*! ./fromRpcTypedData */
|
|
1076
|
+
"./src/converters/fromRpcTypedData.ts"
|
|
1077
|
+
);
|
|
1078
|
+
const toCamelCase_1 = __webpack_require__2(
|
|
1079
|
+
/*! ./toCamelCase */
|
|
1080
|
+
"./src/converters/toCamelCase.ts"
|
|
1081
|
+
);
|
|
1082
|
+
function fromRpcTriggerMetadata(triggerMetadata, triggerType) {
|
|
1083
|
+
if (!triggerMetadata || (0, isTrigger_1.isHttpTrigger)(triggerType) || (0, isTrigger_1.isTimerTrigger)(triggerType)) {
|
|
1084
|
+
return void 0;
|
|
1085
|
+
} else {
|
|
1086
|
+
const result = {};
|
|
1087
|
+
for (const [key, value] of Object.entries(triggerMetadata)) {
|
|
1088
|
+
result[(0, toCamelCase_1.toCamelCaseKey)(key)] = (0, toCamelCase_1.toCamelCaseValue)((0, fromRpcTypedData_1.fromRpcTypedData)(value));
|
|
1089
|
+
}
|
|
1090
|
+
return result;
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1093
|
+
__name(fromRpcTriggerMetadata, "fromRpcTriggerMetadata");
|
|
1094
|
+
exports2.fromRpcTriggerMetadata = fromRpcTriggerMetadata;
|
|
1095
|
+
},
|
|
1096
|
+
/***/
|
|
1097
|
+
"./src/converters/fromRpcTypedData.ts"(__unused_webpack_module, exports2, __webpack_require__2) {
|
|
1098
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1099
|
+
exports2.fromRpcTypedData = void 0;
|
|
1100
|
+
const functions_extensions_base_1 = __webpack_require__2(
|
|
1101
|
+
/*! @azure/functions-extensions-base */
|
|
1102
|
+
"@azure/functions-extensions-base"
|
|
1103
|
+
);
|
|
1104
|
+
const HttpRequest_1 = __webpack_require__2(
|
|
1105
|
+
/*! ../http/HttpRequest */
|
|
1106
|
+
"./src/http/HttpRequest.ts"
|
|
1107
|
+
);
|
|
1108
|
+
const nonNull_1 = __webpack_require__2(
|
|
1109
|
+
/*! ../utils/nonNull */
|
|
1110
|
+
"./src/utils/nonNull.ts"
|
|
1111
|
+
);
|
|
1112
|
+
function fromRpcTypedData(data) {
|
|
1113
|
+
var _a;
|
|
1114
|
+
if (!data) {
|
|
1115
|
+
return void 0;
|
|
1116
|
+
} else if ((0, nonNull_1.isDefined)(data.string)) {
|
|
1117
|
+
return tryJsonParse(data.string);
|
|
1118
|
+
} else if ((0, nonNull_1.isDefined)(data.json)) {
|
|
1119
|
+
return JSON.parse(data.json);
|
|
1120
|
+
} else if ((0, nonNull_1.isDefined)(data.bytes)) {
|
|
1121
|
+
return Buffer.from(data.bytes);
|
|
1122
|
+
} else if ((0, nonNull_1.isDefined)(data.stream)) {
|
|
1123
|
+
return Buffer.from(data.stream);
|
|
1124
|
+
} else if ((0, nonNull_1.isDefined)(data.http)) {
|
|
1125
|
+
return new HttpRequest_1.HttpRequest(data.http);
|
|
1126
|
+
} else if ((0, nonNull_1.isDefined)(data.int)) {
|
|
1127
|
+
return data.int;
|
|
1128
|
+
} else if ((0, nonNull_1.isDefined)(data.double)) {
|
|
1129
|
+
return data.double;
|
|
1130
|
+
} else if (data.collectionBytes && (0, nonNull_1.isDefined)(data.collectionBytes.bytes)) {
|
|
1131
|
+
return data.collectionBytes.bytes.map((d) => Buffer.from(d));
|
|
1132
|
+
} else if (data.collectionString && (0, nonNull_1.isDefined)(data.collectionString.string)) {
|
|
1133
|
+
return data.collectionString.string.map(tryJsonParse);
|
|
1134
|
+
} else if (data.collectionDouble && (0, nonNull_1.isDefined)(data.collectionDouble.double)) {
|
|
1135
|
+
return data.collectionDouble.double;
|
|
1136
|
+
} else if (data.collectionSint64 && (0, nonNull_1.isDefined)(data.collectionSint64.sint64)) {
|
|
1137
|
+
return data.collectionSint64.sint64;
|
|
1138
|
+
} else if (data.modelBindingData && (0, nonNull_1.isDefined)(data.modelBindingData.content)) {
|
|
1139
|
+
try {
|
|
1140
|
+
const resourceFactoryResolver = functions_extensions_base_1.ResourceFactoryResolver.getInstance();
|
|
1141
|
+
return resourceFactoryResolver.createClient(data.modelBindingData.source, data.modelBindingData);
|
|
1142
|
+
} catch (exception) {
|
|
1143
|
+
throw new Error(`Unable to create client. Please register the extensions library with your function app. Error: ${exception instanceof Error ? exception.message : String(exception)}`);
|
|
1144
|
+
}
|
|
1145
|
+
} else if (data.collectionModelBindingData && (0, nonNull_1.isDefined)(data.collectionModelBindingData.modelBindingData) && data.collectionModelBindingData.modelBindingData.length > 0) {
|
|
1146
|
+
try {
|
|
1147
|
+
const resourceFactoryResolver = functions_extensions_base_1.ResourceFactoryResolver.getInstance();
|
|
1148
|
+
return resourceFactoryResolver.createClient((_a = data.collectionModelBindingData.modelBindingData[0]) === null || _a === void 0 ? void 0 : _a.source, data.collectionModelBindingData.modelBindingData);
|
|
1149
|
+
} catch (exception) {
|
|
1150
|
+
throw new Error(`Unable to create client. Please register the extensions library with your function app. Error: ${exception instanceof Error ? exception.message : String(exception)}`);
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
__name(fromRpcTypedData, "fromRpcTypedData");
|
|
1155
|
+
exports2.fromRpcTypedData = fromRpcTypedData;
|
|
1156
|
+
function tryJsonParse(data) {
|
|
1157
|
+
try {
|
|
1158
|
+
return JSON.parse(data);
|
|
1159
|
+
} catch (_a) {
|
|
1160
|
+
return data;
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
__name(tryJsonParse, "tryJsonParse");
|
|
1164
|
+
},
|
|
1165
|
+
/***/
|
|
1166
|
+
"./src/converters/toCamelCase.ts"(__unused_webpack_module, exports2) {
|
|
1167
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1168
|
+
exports2.toCamelCaseKey = exports2.toCamelCaseValue = void 0;
|
|
1169
|
+
function toCamelCaseValue(data) {
|
|
1170
|
+
if (typeof data !== "object" || data === null) {
|
|
1171
|
+
return data;
|
|
1172
|
+
} else if (Array.isArray(data)) {
|
|
1173
|
+
return data.map(toCamelCaseValue);
|
|
1174
|
+
} else {
|
|
1175
|
+
const result = {};
|
|
1176
|
+
for (const [key, value] of Object.entries(data)) {
|
|
1177
|
+
result[toCamelCaseKey(key)] = toCamelCaseValue(value);
|
|
1178
|
+
}
|
|
1179
|
+
return result;
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
__name(toCamelCaseValue, "toCamelCaseValue");
|
|
1183
|
+
exports2.toCamelCaseValue = toCamelCaseValue;
|
|
1184
|
+
function toCamelCaseKey(key) {
|
|
1185
|
+
return key.charAt(0).toLowerCase() + key.slice(1);
|
|
1186
|
+
}
|
|
1187
|
+
__name(toCamelCaseKey, "toCamelCaseKey");
|
|
1188
|
+
exports2.toCamelCaseKey = toCamelCaseKey;
|
|
1189
|
+
},
|
|
1190
|
+
/***/
|
|
1191
|
+
"./src/converters/toCoreFunctionMetadata.ts"(__unused_webpack_module, exports2, __webpack_require__2) {
|
|
1192
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1193
|
+
exports2.addSdkBindingsFlag = exports2.toCoreFunctionMetadata = void 0;
|
|
1194
|
+
const constants_1 = __webpack_require__2(
|
|
1195
|
+
/*! ../constants */
|
|
1196
|
+
"./src/constants.ts"
|
|
1197
|
+
);
|
|
1198
|
+
const errors_1 = __webpack_require__2(
|
|
1199
|
+
/*! ../errors */
|
|
1200
|
+
"./src/errors.ts"
|
|
1201
|
+
);
|
|
1202
|
+
const isTrigger_1 = __webpack_require__2(
|
|
1203
|
+
/*! ../utils/isTrigger */
|
|
1204
|
+
"./src/utils/isTrigger.ts"
|
|
1205
|
+
);
|
|
1206
|
+
const workerSystemLog_1 = __webpack_require__2(
|
|
1207
|
+
/*! ../utils/workerSystemLog */
|
|
1208
|
+
"./src/utils/workerSystemLog.ts"
|
|
1209
|
+
);
|
|
1210
|
+
const toRpcDuration_1 = __webpack_require__2(
|
|
1211
|
+
/*! ./toRpcDuration */
|
|
1212
|
+
"./src/converters/toRpcDuration.ts"
|
|
1213
|
+
);
|
|
1214
|
+
function toCoreFunctionMetadata(name, options) {
|
|
1215
|
+
var _a;
|
|
1216
|
+
const bindings = {};
|
|
1217
|
+
const bindingNames = [];
|
|
1218
|
+
const trigger = options.trigger;
|
|
1219
|
+
bindings[trigger.name] = Object.assign(Object.assign({}, trigger), { direction: "in", type: (0, isTrigger_1.isTrigger)(trigger.type) ? trigger.type : trigger.type + "Trigger", properties: addSdkBindingsFlag((_a = options.trigger) === null || _a === void 0 ? void 0 : _a.sdkBinding, name, trigger.type, trigger.name, false) });
|
|
1220
|
+
bindingNames.push(trigger.name);
|
|
1221
|
+
if (options.extraInputs) {
|
|
1222
|
+
for (const input of options.extraInputs) {
|
|
1223
|
+
bindings[input.name] = Object.assign(Object.assign({}, input), { direction: "in", properties: addSdkBindingsFlag(input === null || input === void 0 ? void 0 : input.sdkBinding, name, input.type, input.name, true) });
|
|
1224
|
+
bindingNames.push(input.name);
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
if (options.return) {
|
|
1228
|
+
bindings[constants_1.returnBindingKey] = Object.assign(Object.assign({}, options.return), { direction: "out" });
|
|
1229
|
+
bindingNames.push(constants_1.returnBindingKey);
|
|
1230
|
+
}
|
|
1231
|
+
if (options.extraOutputs) {
|
|
1232
|
+
for (const output of options.extraOutputs) {
|
|
1233
|
+
bindings[output.name] = Object.assign(Object.assign({}, output), { direction: "out" });
|
|
1234
|
+
bindingNames.push(output.name);
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
const dupeBindings = bindingNames.filter((v, i) => bindingNames.indexOf(v) !== i);
|
|
1238
|
+
if (dupeBindings.length > 0) {
|
|
1239
|
+
throw new errors_1.AzFuncSystemError(`Duplicate bindings found for function "${name}". Remove a duplicate binding or manually specify the "name" property to make it unique.`);
|
|
1240
|
+
}
|
|
1241
|
+
let retryOptions;
|
|
1242
|
+
if (options.retry) {
|
|
1243
|
+
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") });
|
|
1244
|
+
}
|
|
1245
|
+
return { name, bindings, retryOptions };
|
|
1246
|
+
}
|
|
1247
|
+
__name(toCoreFunctionMetadata, "toCoreFunctionMetadata");
|
|
1248
|
+
exports2.toCoreFunctionMetadata = toCoreFunctionMetadata;
|
|
1249
|
+
function addSdkBindingsFlag(sdkBindingType, functionName, triggerType, bindingOrTriggerName, isBinding) {
|
|
1250
|
+
if (sdkBindingType !== void 0 && sdkBindingType === true) {
|
|
1251
|
+
const entityType = isBinding ? "binding" : "trigger";
|
|
1252
|
+
const logData = {
|
|
1253
|
+
operation: "EnableDeferredBinding",
|
|
1254
|
+
properties: {
|
|
1255
|
+
functionName: functionName || "unknown",
|
|
1256
|
+
entityType,
|
|
1257
|
+
triggerType: triggerType || "unknown",
|
|
1258
|
+
bindingOrTriggerName: bindingOrTriggerName || "unknown",
|
|
1259
|
+
supportsDeferredBinding: true
|
|
1260
|
+
},
|
|
1261
|
+
message: `Enabled Deferred Binding of type '${triggerType || "unknown"}' for function '${functionName || "unknown"}'`
|
|
1262
|
+
};
|
|
1263
|
+
(0, workerSystemLog_1.workerSystemLog)("information", JSON.stringify(logData));
|
|
1264
|
+
return { supportsDeferredBinding: "true" };
|
|
1265
|
+
}
|
|
1266
|
+
return { supportsDeferredBinding: "false" };
|
|
1267
|
+
}
|
|
1268
|
+
__name(addSdkBindingsFlag, "addSdkBindingsFlag");
|
|
1269
|
+
exports2.addSdkBindingsFlag = addSdkBindingsFlag;
|
|
1270
|
+
},
|
|
1271
|
+
/***/
|
|
1272
|
+
"./src/converters/toMcpResourceTriggerOptionsToRpc.ts"(__unused_webpack_module, exports2) {
|
|
1273
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1274
|
+
exports2.convertToMcpResourceTriggerOptionsToRpc = void 0;
|
|
1275
|
+
function convertToMcpResourceTriggerOptionsToRpc(options) {
|
|
1276
|
+
if (!options.uri || typeof options.uri !== "string" || options.uri.trim() === "") {
|
|
1277
|
+
throw new Error('MCP Resource trigger requires a valid "uri" property.');
|
|
1278
|
+
}
|
|
1279
|
+
if (!options.resourceName || typeof options.resourceName !== "string" || options.resourceName.trim() === "") {
|
|
1280
|
+
throw new Error('MCP Resource trigger requires a valid "resourceName" property.');
|
|
1281
|
+
}
|
|
1282
|
+
const result = {
|
|
1283
|
+
uri: options.uri,
|
|
1284
|
+
resourceName: options.resourceName
|
|
1285
|
+
};
|
|
1286
|
+
if (options.title !== void 0) {
|
|
1287
|
+
result.title = options.title;
|
|
1288
|
+
}
|
|
1289
|
+
if (options.description !== void 0) {
|
|
1290
|
+
result.description = options.description;
|
|
1291
|
+
}
|
|
1292
|
+
if (options.mimeType !== void 0) {
|
|
1293
|
+
result.mimeType = options.mimeType;
|
|
1294
|
+
}
|
|
1295
|
+
if (options.size !== void 0) {
|
|
1296
|
+
if (typeof options.size !== "number" || options.size < 0) {
|
|
1297
|
+
throw new Error('MCP Resource trigger "size" must be a non-negative number.');
|
|
1298
|
+
}
|
|
1299
|
+
result.size = options.size;
|
|
1300
|
+
}
|
|
1301
|
+
if (options.metadata !== void 0 && typeof options.metadata === "string" && options.metadata.trim() !== "") {
|
|
1302
|
+
try {
|
|
1303
|
+
JSON.parse(options.metadata);
|
|
1304
|
+
} catch (e) {
|
|
1305
|
+
throw new Error('MCP Resource trigger "metadata" must be a valid JSON string.');
|
|
1306
|
+
}
|
|
1307
|
+
result.metadata = options.metadata;
|
|
1308
|
+
}
|
|
1309
|
+
return result;
|
|
1310
|
+
}
|
|
1311
|
+
__name(convertToMcpResourceTriggerOptionsToRpc, "convertToMcpResourceTriggerOptionsToRpc");
|
|
1312
|
+
exports2.convertToMcpResourceTriggerOptionsToRpc = convertToMcpResourceTriggerOptionsToRpc;
|
|
1313
|
+
},
|
|
1314
|
+
/***/
|
|
1315
|
+
"./src/converters/toMcpToolTriggerOptionsToRpc.ts"(__unused_webpack_module, exports2, __webpack_require__2) {
|
|
1316
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1317
|
+
exports2.converToMcpToolTriggerOptionsToRpc = void 0;
|
|
1318
|
+
const toolProperties_1 = __webpack_require__2(
|
|
1319
|
+
/*! ../utils/toolProperties */
|
|
1320
|
+
"./src/utils/toolProperties.ts"
|
|
1321
|
+
);
|
|
1322
|
+
function converToMcpToolTriggerOptionsToRpc(mcpToolTriggerOptions) {
|
|
1323
|
+
let validatedMetadata;
|
|
1324
|
+
if (mcpToolTriggerOptions.metadata !== void 0 && typeof mcpToolTriggerOptions.metadata === "string" && mcpToolTriggerOptions.metadata.trim() !== "") {
|
|
1325
|
+
try {
|
|
1326
|
+
JSON.parse(mcpToolTriggerOptions.metadata);
|
|
1327
|
+
validatedMetadata = mcpToolTriggerOptions.metadata;
|
|
1328
|
+
} catch (e) {
|
|
1329
|
+
throw new Error('MCP Tool trigger "metadata" must be a valid JSON string.');
|
|
1330
|
+
}
|
|
1331
|
+
}
|
|
1332
|
+
const baseResult = Object.assign({ toolName: mcpToolTriggerOptions.toolName, description: mcpToolTriggerOptions.description }, validatedMetadata !== void 0 && { metadata: validatedMetadata });
|
|
1333
|
+
let normalizedProperties;
|
|
1334
|
+
try {
|
|
1335
|
+
normalizedProperties = (0, toolProperties_1.normalizeToolProperties)(mcpToolTriggerOptions.toolProperties);
|
|
1336
|
+
} catch (error) {
|
|
1337
|
+
if (error instanceof Error && (error.message.includes("Property type is required") || error.message.includes("Property type must be specified"))) {
|
|
1338
|
+
throw error;
|
|
1339
|
+
}
|
|
1340
|
+
normalizedProperties = void 0;
|
|
1341
|
+
}
|
|
1342
|
+
if (normalizedProperties !== void 0) {
|
|
1343
|
+
return Object.assign(Object.assign({}, baseResult), { toolProperties: JSON.stringify(normalizedProperties) });
|
|
1344
|
+
}
|
|
1345
|
+
throw new Error(`Invalid toolProperties for tool '${mcpToolTriggerOptions.toolName}': Expected an array of McpToolProperty or ToolProps objects or ToolProps need a type defined.`);
|
|
1346
|
+
}
|
|
1347
|
+
__name(converToMcpToolTriggerOptionsToRpc, "converToMcpToolTriggerOptionsToRpc");
|
|
1348
|
+
exports2.converToMcpToolTriggerOptionsToRpc = converToMcpToolTriggerOptionsToRpc;
|
|
1349
|
+
},
|
|
1350
|
+
/***/
|
|
1351
|
+
"./src/converters/toRpcDuration.ts"(__unused_webpack_module, exports2, __webpack_require__2) {
|
|
1352
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1353
|
+
exports2.toRpcDuration = void 0;
|
|
1354
|
+
const errors_1 = __webpack_require__2(
|
|
1355
|
+
/*! ../errors */
|
|
1356
|
+
"./src/errors.ts"
|
|
1357
|
+
);
|
|
1358
|
+
const nonNull_1 = __webpack_require__2(
|
|
1359
|
+
/*! ../utils/nonNull */
|
|
1360
|
+
"./src/utils/nonNull.ts"
|
|
1361
|
+
);
|
|
1362
|
+
function toRpcDuration(dateTime, propertyName) {
|
|
1363
|
+
if ((0, nonNull_1.isDefined)(dateTime)) {
|
|
1364
|
+
try {
|
|
1365
|
+
let timeInMilliseconds;
|
|
1366
|
+
if (typeof dateTime === "object") {
|
|
1367
|
+
const minutes = (dateTime.minutes || 0) + (dateTime.hours || 0) * 60;
|
|
1368
|
+
const seconds = (dateTime.seconds || 0) + minutes * 60;
|
|
1369
|
+
timeInMilliseconds = (dateTime.milliseconds || 0) + seconds * 1e3;
|
|
1370
|
+
} else if (typeof dateTime === "number") {
|
|
1371
|
+
timeInMilliseconds = dateTime;
|
|
1372
|
+
}
|
|
1373
|
+
if ((0, nonNull_1.isDefined)(timeInMilliseconds) && timeInMilliseconds >= 0) {
|
|
1374
|
+
return {
|
|
1375
|
+
seconds: Math.round(timeInMilliseconds / 1e3)
|
|
1376
|
+
};
|
|
1377
|
+
}
|
|
1378
|
+
} catch (_a) {
|
|
1379
|
+
}
|
|
1380
|
+
throw new errors_1.AzFuncSystemError(`A 'number' or 'Duration' object was expected instead of a '${typeof dateTime}'. Cannot parse value of '${propertyName}'.`);
|
|
1381
|
+
}
|
|
1382
|
+
return void 0;
|
|
1383
|
+
}
|
|
1384
|
+
__name(toRpcDuration, "toRpcDuration");
|
|
1385
|
+
exports2.toRpcDuration = toRpcDuration;
|
|
1386
|
+
},
|
|
1387
|
+
/***/
|
|
1388
|
+
"./src/converters/toRpcHttp.ts"(__unused_webpack_module, exports2, __webpack_require__2) {
|
|
1389
|
+
var __awaiter = this && this.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
1390
|
+
function adopt(value) {
|
|
1391
|
+
return value instanceof P ? value : new P(function(resolve) {
|
|
1392
|
+
resolve(value);
|
|
1393
|
+
});
|
|
1394
|
+
}
|
|
1395
|
+
__name(adopt, "adopt");
|
|
1396
|
+
return new (P || (P = Promise))(function(resolve, reject) {
|
|
1397
|
+
function fulfilled(value) {
|
|
1398
|
+
try {
|
|
1399
|
+
step(generator.next(value));
|
|
1400
|
+
} catch (e) {
|
|
1401
|
+
reject(e);
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
__name(fulfilled, "fulfilled");
|
|
1405
|
+
function rejected(value) {
|
|
1406
|
+
try {
|
|
1407
|
+
step(generator["throw"](value));
|
|
1408
|
+
} catch (e) {
|
|
1409
|
+
reject(e);
|
|
1410
|
+
}
|
|
1411
|
+
}
|
|
1412
|
+
__name(rejected, "rejected");
|
|
1413
|
+
function step(result) {
|
|
1414
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
1415
|
+
}
|
|
1416
|
+
__name(step, "step");
|
|
1417
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
1418
|
+
});
|
|
1419
|
+
};
|
|
1420
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1421
|
+
exports2.toRpcHttp = void 0;
|
|
1422
|
+
const errors_1 = __webpack_require__2(
|
|
1423
|
+
/*! ../errors */
|
|
1424
|
+
"./src/errors.ts"
|
|
1425
|
+
);
|
|
1426
|
+
const httpProxy_1 = __webpack_require__2(
|
|
1427
|
+
/*! ../http/httpProxy */
|
|
1428
|
+
"./src/http/httpProxy.ts"
|
|
1429
|
+
);
|
|
1430
|
+
const HttpResponse_1 = __webpack_require__2(
|
|
1431
|
+
/*! ../http/HttpResponse */
|
|
1432
|
+
"./src/http/HttpResponse.ts"
|
|
1433
|
+
);
|
|
1434
|
+
const setup_1 = __webpack_require__2(
|
|
1435
|
+
/*! ../setup */
|
|
1436
|
+
"./src/setup.ts"
|
|
1437
|
+
);
|
|
1438
|
+
const toRpcHttpCookie_1 = __webpack_require__2(
|
|
1439
|
+
/*! ./toRpcHttpCookie */
|
|
1440
|
+
"./src/converters/toRpcHttpCookie.ts"
|
|
1441
|
+
);
|
|
1442
|
+
const toRpcTypedData_1 = __webpack_require__2(
|
|
1443
|
+
/*! ./toRpcTypedData */
|
|
1444
|
+
"./src/converters/toRpcTypedData.ts"
|
|
1445
|
+
);
|
|
1446
|
+
function toRpcHttp(invocationId, data) {
|
|
1447
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1448
|
+
if (data === null || data === void 0) {
|
|
1449
|
+
return data;
|
|
1450
|
+
} else if (typeof data !== "object") {
|
|
1451
|
+
throw new errors_1.AzFuncSystemError('The HTTP response must be an object with optional properties "body", "status", "headers", and "cookies".');
|
|
1452
|
+
}
|
|
1453
|
+
const response = data instanceof HttpResponse_1.HttpResponse ? data : new HttpResponse_1.HttpResponse(data);
|
|
1454
|
+
if (setup_1.enableHttpStream) {
|
|
1455
|
+
yield (0, httpProxy_1.sendProxyResponse)(invocationId, response);
|
|
1456
|
+
return;
|
|
1457
|
+
}
|
|
1458
|
+
const rpcResponse = {};
|
|
1459
|
+
rpcResponse.statusCode = response.status.toString();
|
|
1460
|
+
rpcResponse.headers = {};
|
|
1461
|
+
for (const [key, value] of response.headers.entries()) {
|
|
1462
|
+
rpcResponse.headers[key] = value;
|
|
1463
|
+
}
|
|
1464
|
+
rpcResponse.cookies = [];
|
|
1465
|
+
for (const cookie of response.cookies) {
|
|
1466
|
+
rpcResponse.cookies.push((0, toRpcHttpCookie_1.toRpcHttpCookie)(cookie));
|
|
1467
|
+
}
|
|
1468
|
+
rpcResponse.enableContentNegotiation = response.enableContentNegotiation;
|
|
1469
|
+
const bodyBytes = yield response.arrayBuffer();
|
|
1470
|
+
rpcResponse.body = (0, toRpcTypedData_1.toRpcTypedData)(bodyBytes);
|
|
1471
|
+
return { http: rpcResponse };
|
|
1472
|
+
});
|
|
1473
|
+
}
|
|
1474
|
+
__name(toRpcHttp, "toRpcHttp");
|
|
1475
|
+
exports2.toRpcHttp = toRpcHttp;
|
|
1476
|
+
},
|
|
1477
|
+
/***/
|
|
1478
|
+
"./src/converters/toRpcHttpCookie.ts"(__unused_webpack_module, exports2, __webpack_require__2) {
|
|
1479
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1480
|
+
exports2.toRpcHttpCookie = void 0;
|
|
1481
|
+
const toRpcNullable_1 = __webpack_require__2(
|
|
1482
|
+
/*! ./toRpcNullable */
|
|
1483
|
+
"./src/converters/toRpcNullable.ts"
|
|
1484
|
+
);
|
|
1485
|
+
function toRpcHttpCookie(inputCookie) {
|
|
1486
|
+
let rpcSameSite = "none";
|
|
1487
|
+
if (inputCookie && inputCookie.sameSite) {
|
|
1488
|
+
const sameSite = inputCookie.sameSite.toLocaleLowerCase();
|
|
1489
|
+
if (sameSite === "lax") {
|
|
1490
|
+
rpcSameSite = "lax";
|
|
1491
|
+
} else if (sameSite === "strict") {
|
|
1492
|
+
rpcSameSite = "strict";
|
|
1493
|
+
} else if (sameSite === "none") {
|
|
1494
|
+
rpcSameSite = "explicitNone";
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
const rpcCookie = {
|
|
1498
|
+
name: inputCookie && (0, toRpcNullable_1.toRpcString)(inputCookie.name, "cookie.name"),
|
|
1499
|
+
value: inputCookie && (0, toRpcNullable_1.toRpcString)(inputCookie.value, "cookie.value"),
|
|
1500
|
+
domain: (0, toRpcNullable_1.toNullableString)(inputCookie && inputCookie.domain, "cookie.domain"),
|
|
1501
|
+
path: (0, toRpcNullable_1.toNullableString)(inputCookie && inputCookie.path, "cookie.path"),
|
|
1502
|
+
expires: (0, toRpcNullable_1.toNullableTimestamp)(inputCookie && inputCookie.expires, "cookie.expires"),
|
|
1503
|
+
secure: (0, toRpcNullable_1.toNullableBool)(inputCookie && inputCookie.secure, "cookie.secure"),
|
|
1504
|
+
httpOnly: (0, toRpcNullable_1.toNullableBool)(inputCookie && inputCookie.httpOnly, "cookie.httpOnly"),
|
|
1505
|
+
sameSite: rpcSameSite,
|
|
1506
|
+
maxAge: (0, toRpcNullable_1.toNullableDouble)(inputCookie && inputCookie.maxAge, "cookie.maxAge")
|
|
1507
|
+
};
|
|
1508
|
+
return rpcCookie;
|
|
1509
|
+
}
|
|
1510
|
+
__name(toRpcHttpCookie, "toRpcHttpCookie");
|
|
1511
|
+
exports2.toRpcHttpCookie = toRpcHttpCookie;
|
|
1512
|
+
},
|
|
1513
|
+
/***/
|
|
1514
|
+
"./src/converters/toRpcNullable.ts"(__unused_webpack_module, exports2, __webpack_require__2) {
|
|
1515
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1516
|
+
exports2.toNullableTimestamp = exports2.toNullableString = exports2.toRpcString = exports2.toNullableDouble = exports2.toNullableBool = void 0;
|
|
1517
|
+
const errors_1 = __webpack_require__2(
|
|
1518
|
+
/*! ../errors */
|
|
1519
|
+
"./src/errors.ts"
|
|
1520
|
+
);
|
|
1521
|
+
const nonNull_1 = __webpack_require__2(
|
|
1522
|
+
/*! ../utils/nonNull */
|
|
1523
|
+
"./src/utils/nonNull.ts"
|
|
1524
|
+
);
|
|
1525
|
+
function toNullableBool(nullable, propertyName) {
|
|
1526
|
+
if (typeof nullable === "boolean") {
|
|
1527
|
+
return {
|
|
1528
|
+
value: nullable
|
|
1529
|
+
};
|
|
1530
|
+
}
|
|
1531
|
+
if ((0, nonNull_1.isDefined)(nullable)) {
|
|
1532
|
+
throw new errors_1.AzFuncSystemError(`A 'boolean' type was expected instead of a '${typeof nullable}' type. Cannot parse value of '${propertyName}'.`);
|
|
1533
|
+
}
|
|
1534
|
+
return void 0;
|
|
1535
|
+
}
|
|
1536
|
+
__name(toNullableBool, "toNullableBool");
|
|
1537
|
+
exports2.toNullableBool = toNullableBool;
|
|
1538
|
+
function toNullableDouble(nullable, propertyName) {
|
|
1539
|
+
if (typeof nullable === "number") {
|
|
1540
|
+
return {
|
|
1541
|
+
value: nullable
|
|
1542
|
+
};
|
|
1543
|
+
} else if (typeof nullable === "string") {
|
|
1544
|
+
if (!isNaN(Number(nullable))) {
|
|
1545
|
+
const parsedNumber = parseFloat(nullable);
|
|
1546
|
+
return {
|
|
1547
|
+
value: parsedNumber
|
|
1548
|
+
};
|
|
1549
|
+
}
|
|
1550
|
+
}
|
|
1551
|
+
if ((0, nonNull_1.isDefined)(nullable)) {
|
|
1552
|
+
throw new errors_1.AzFuncSystemError(`A 'number' type was expected instead of a '${typeof nullable}' type. Cannot parse value of '${propertyName}'.`);
|
|
1553
|
+
}
|
|
1554
|
+
return void 0;
|
|
1555
|
+
}
|
|
1556
|
+
__name(toNullableDouble, "toNullableDouble");
|
|
1557
|
+
exports2.toNullableDouble = toNullableDouble;
|
|
1558
|
+
function toRpcString(nullable, propertyName) {
|
|
1559
|
+
if (typeof nullable === "string") {
|
|
1560
|
+
return nullable;
|
|
1561
|
+
}
|
|
1562
|
+
if ((0, nonNull_1.isDefined)(nullable)) {
|
|
1563
|
+
throw new errors_1.AzFuncSystemError(`A 'string' type was expected instead of a '${typeof nullable}' type. Cannot parse value of '${propertyName}'.`);
|
|
1564
|
+
}
|
|
1565
|
+
return "";
|
|
1566
|
+
}
|
|
1567
|
+
__name(toRpcString, "toRpcString");
|
|
1568
|
+
exports2.toRpcString = toRpcString;
|
|
1569
|
+
function toNullableString(nullable, propertyName) {
|
|
1570
|
+
if (typeof nullable === "string") {
|
|
1571
|
+
return {
|
|
1572
|
+
value: nullable
|
|
1573
|
+
};
|
|
1574
|
+
}
|
|
1575
|
+
if ((0, nonNull_1.isDefined)(nullable)) {
|
|
1576
|
+
throw new errors_1.AzFuncSystemError(`A 'string' type was expected instead of a '${typeof nullable}' type. Cannot parse value of '${propertyName}'.`);
|
|
1577
|
+
}
|
|
1578
|
+
return void 0;
|
|
1579
|
+
}
|
|
1580
|
+
__name(toNullableString, "toNullableString");
|
|
1581
|
+
exports2.toNullableString = toNullableString;
|
|
1582
|
+
function toNullableTimestamp(dateTime, propertyName) {
|
|
1583
|
+
if ((0, nonNull_1.isDefined)(dateTime)) {
|
|
1584
|
+
try {
|
|
1585
|
+
const timeInMilliseconds = typeof dateTime === "number" ? dateTime : dateTime.getTime();
|
|
1586
|
+
if (timeInMilliseconds && timeInMilliseconds >= 0) {
|
|
1587
|
+
return {
|
|
1588
|
+
value: {
|
|
1589
|
+
seconds: Math.round(timeInMilliseconds / 1e3)
|
|
1590
|
+
}
|
|
1591
|
+
};
|
|
1592
|
+
}
|
|
1593
|
+
} catch (_a) {
|
|
1594
|
+
throw new errors_1.AzFuncSystemError(`A 'number' or 'Date' input was expected instead of a '${typeof dateTime}'. Cannot parse value of '${propertyName}'.`);
|
|
1595
|
+
}
|
|
1596
|
+
}
|
|
1597
|
+
return void 0;
|
|
1598
|
+
}
|
|
1599
|
+
__name(toNullableTimestamp, "toNullableTimestamp");
|
|
1600
|
+
exports2.toNullableTimestamp = toNullableTimestamp;
|
|
1601
|
+
},
|
|
1602
|
+
/***/
|
|
1603
|
+
"./src/converters/toRpcTypedData.ts"(__unused_webpack_module, exports2) {
|
|
1604
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1605
|
+
exports2.toRpcTypedData = void 0;
|
|
1606
|
+
function toRpcTypedData(data) {
|
|
1607
|
+
if (data === null || data === void 0) {
|
|
1608
|
+
return data;
|
|
1609
|
+
} else if (typeof data === "string") {
|
|
1610
|
+
return { string: data };
|
|
1611
|
+
} else if (Buffer.isBuffer(data)) {
|
|
1612
|
+
return { bytes: data };
|
|
1613
|
+
} else if (ArrayBuffer.isView(data)) {
|
|
1614
|
+
const bytes = new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
|
|
1615
|
+
return { bytes };
|
|
1616
|
+
} else if (data instanceof ArrayBuffer) {
|
|
1617
|
+
const bytes = new Uint8Array(data);
|
|
1618
|
+
return { bytes };
|
|
1619
|
+
} else if (typeof data === "number") {
|
|
1620
|
+
if (Number.isInteger(data)) {
|
|
1621
|
+
return { int: data };
|
|
1622
|
+
} else {
|
|
1623
|
+
return { double: data };
|
|
1624
|
+
}
|
|
1625
|
+
} else {
|
|
1626
|
+
return { json: JSON.stringify(data) };
|
|
1627
|
+
}
|
|
1628
|
+
}
|
|
1629
|
+
__name(toRpcTypedData, "toRpcTypedData");
|
|
1630
|
+
exports2.toRpcTypedData = toRpcTypedData;
|
|
1631
|
+
},
|
|
1632
|
+
/***/
|
|
1633
|
+
"./src/errors.ts"(__unused_webpack_module, exports2) {
|
|
1634
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1635
|
+
exports2.isError = exports2.trySetErrorMessage = exports2.ensureErrorType = exports2.ReadOnlyError = exports2.AzFuncRangeError = exports2.AzFuncTypeError = exports2.AzFuncSystemError = void 0;
|
|
1636
|
+
class AzFuncSystemError extends Error {
|
|
1637
|
+
static {
|
|
1638
|
+
__name(this, "AzFuncSystemError");
|
|
1639
|
+
}
|
|
1640
|
+
constructor() {
|
|
1641
|
+
super(...arguments);
|
|
1642
|
+
this.isAzureFunctionsSystemError = true;
|
|
1643
|
+
}
|
|
1644
|
+
}
|
|
1645
|
+
exports2.AzFuncSystemError = AzFuncSystemError;
|
|
1646
|
+
class AzFuncTypeError extends TypeError {
|
|
1647
|
+
static {
|
|
1648
|
+
__name(this, "AzFuncTypeError");
|
|
1649
|
+
}
|
|
1650
|
+
constructor() {
|
|
1651
|
+
super(...arguments);
|
|
1652
|
+
this.isAzureFunctionsSystemError = true;
|
|
1653
|
+
}
|
|
1654
|
+
}
|
|
1655
|
+
exports2.AzFuncTypeError = AzFuncTypeError;
|
|
1656
|
+
class AzFuncRangeError extends RangeError {
|
|
1657
|
+
static {
|
|
1658
|
+
__name(this, "AzFuncRangeError");
|
|
1659
|
+
}
|
|
1660
|
+
constructor() {
|
|
1661
|
+
super(...arguments);
|
|
1662
|
+
this.isAzureFunctionsSystemError = true;
|
|
1663
|
+
}
|
|
1664
|
+
}
|
|
1665
|
+
exports2.AzFuncRangeError = AzFuncRangeError;
|
|
1666
|
+
class ReadOnlyError extends AzFuncTypeError {
|
|
1667
|
+
static {
|
|
1668
|
+
__name(this, "ReadOnlyError");
|
|
1669
|
+
}
|
|
1670
|
+
constructor(propertyName) {
|
|
1671
|
+
super(`Cannot assign to read only property '${propertyName}'`);
|
|
1672
|
+
}
|
|
1673
|
+
}
|
|
1674
|
+
exports2.ReadOnlyError = ReadOnlyError;
|
|
1675
|
+
function ensureErrorType(err) {
|
|
1676
|
+
if (err instanceof Error) {
|
|
1677
|
+
return err;
|
|
1678
|
+
} else {
|
|
1679
|
+
let message;
|
|
1680
|
+
if (err === void 0 || err === null) {
|
|
1681
|
+
message = "Unknown error";
|
|
1682
|
+
} else if (typeof err === "string") {
|
|
1683
|
+
message = err;
|
|
1684
|
+
} else if (typeof err === "object") {
|
|
1685
|
+
message = JSON.stringify(err);
|
|
1686
|
+
} else {
|
|
1687
|
+
message = String(err);
|
|
1688
|
+
}
|
|
1689
|
+
return new Error(message);
|
|
1690
|
+
}
|
|
1691
|
+
}
|
|
1692
|
+
__name(ensureErrorType, "ensureErrorType");
|
|
1693
|
+
exports2.ensureErrorType = ensureErrorType;
|
|
1694
|
+
function trySetErrorMessage(err, message) {
|
|
1695
|
+
try {
|
|
1696
|
+
err.message = message;
|
|
1697
|
+
} catch (_a) {
|
|
1698
|
+
}
|
|
1699
|
+
}
|
|
1700
|
+
__name(trySetErrorMessage, "trySetErrorMessage");
|
|
1701
|
+
exports2.trySetErrorMessage = trySetErrorMessage;
|
|
1702
|
+
function isError(err) {
|
|
1703
|
+
return err !== null && err !== void 0;
|
|
1704
|
+
}
|
|
1705
|
+
__name(isError, "isError");
|
|
1706
|
+
exports2.isError = isError;
|
|
1707
|
+
},
|
|
1708
|
+
/***/
|
|
1709
|
+
"./src/hooks/AppStartContext.ts"(__unused_webpack_module, exports2, __webpack_require__2) {
|
|
1710
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1711
|
+
exports2.AppStartContext = void 0;
|
|
1712
|
+
const HookContext_1 = __webpack_require__2(
|
|
1713
|
+
/*! ./HookContext */
|
|
1714
|
+
"./src/hooks/HookContext.ts"
|
|
1715
|
+
);
|
|
1716
|
+
class AppStartContext extends HookContext_1.HookContext {
|
|
1717
|
+
static {
|
|
1718
|
+
__name(this, "AppStartContext");
|
|
1719
|
+
}
|
|
1720
|
+
}
|
|
1721
|
+
exports2.AppStartContext = AppStartContext;
|
|
1722
|
+
},
|
|
1723
|
+
/***/
|
|
1724
|
+
"./src/hooks/AppTerminateContext.ts"(__unused_webpack_module, exports2, __webpack_require__2) {
|
|
1725
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1726
|
+
exports2.AppTerminateContext = void 0;
|
|
1727
|
+
const HookContext_1 = __webpack_require__2(
|
|
1728
|
+
/*! ./HookContext */
|
|
1729
|
+
"./src/hooks/HookContext.ts"
|
|
1730
|
+
);
|
|
1731
|
+
class AppTerminateContext extends HookContext_1.HookContext {
|
|
1732
|
+
static {
|
|
1733
|
+
__name(this, "AppTerminateContext");
|
|
1734
|
+
}
|
|
1735
|
+
}
|
|
1736
|
+
exports2.AppTerminateContext = AppTerminateContext;
|
|
1737
|
+
},
|
|
1738
|
+
/***/
|
|
1739
|
+
"./src/hooks/HookContext.ts"(__unused_webpack_module, exports2, __webpack_require__2) {
|
|
1740
|
+
var __classPrivateFieldSet = this && this.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
|
|
1741
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
1742
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
1743
|
+
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");
|
|
1744
|
+
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
1745
|
+
};
|
|
1746
|
+
var __classPrivateFieldGet = this && this.__classPrivateFieldGet || function(receiver, state, kind, f) {
|
|
1747
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
1748
|
+
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");
|
|
1749
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
1750
|
+
};
|
|
1751
|
+
var _HookContext_init;
|
|
1752
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1753
|
+
exports2.HookContext = void 0;
|
|
1754
|
+
const errors_1 = __webpack_require__2(
|
|
1755
|
+
/*! ../errors */
|
|
1756
|
+
"./src/errors.ts"
|
|
1757
|
+
);
|
|
1758
|
+
const nonNull_1 = __webpack_require__2(
|
|
1759
|
+
/*! ../utils/nonNull */
|
|
1760
|
+
"./src/utils/nonNull.ts"
|
|
1761
|
+
);
|
|
1762
|
+
class HookContext {
|
|
1763
|
+
static {
|
|
1764
|
+
__name(this, "HookContext");
|
|
1765
|
+
}
|
|
1766
|
+
constructor(init) {
|
|
1767
|
+
var _a;
|
|
1768
|
+
var _b;
|
|
1769
|
+
_HookContext_init.set(this, void 0);
|
|
1770
|
+
__classPrivateFieldSet(this, _HookContext_init, init !== null && init !== void 0 ? init : {}, "f");
|
|
1771
|
+
(_a = (_b = __classPrivateFieldGet(this, _HookContext_init, "f")).hookData) !== null && _a !== void 0 ? _a : _b.hookData = {};
|
|
1772
|
+
}
|
|
1773
|
+
get hookData() {
|
|
1774
|
+
return (0, nonNull_1.nonNullProp)(__classPrivateFieldGet(this, _HookContext_init, "f"), "hookData");
|
|
1775
|
+
}
|
|
1776
|
+
set hookData(_value) {
|
|
1777
|
+
throw new errors_1.ReadOnlyError("hookData");
|
|
1778
|
+
}
|
|
1779
|
+
}
|
|
1780
|
+
exports2.HookContext = HookContext;
|
|
1781
|
+
_HookContext_init = /* @__PURE__ */ new WeakMap();
|
|
1782
|
+
},
|
|
1783
|
+
/***/
|
|
1784
|
+
"./src/hooks/InvocationHookContext.ts"(__unused_webpack_module, exports2, __webpack_require__2) {
|
|
1785
|
+
var __classPrivateFieldSet = this && this.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
|
|
1786
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
1787
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
1788
|
+
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");
|
|
1789
|
+
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
1790
|
+
};
|
|
1791
|
+
var __classPrivateFieldGet = this && this.__classPrivateFieldGet || function(receiver, state, kind, f) {
|
|
1792
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
1793
|
+
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");
|
|
1794
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
1795
|
+
};
|
|
1796
|
+
var _InvocationHookContext_init;
|
|
1797
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1798
|
+
exports2.InvocationHookContext = void 0;
|
|
1799
|
+
const errors_1 = __webpack_require__2(
|
|
1800
|
+
/*! ../errors */
|
|
1801
|
+
"./src/errors.ts"
|
|
1802
|
+
);
|
|
1803
|
+
const InvocationContext_1 = __webpack_require__2(
|
|
1804
|
+
/*! ../InvocationContext */
|
|
1805
|
+
"./src/InvocationContext.ts"
|
|
1806
|
+
);
|
|
1807
|
+
const nonNull_1 = __webpack_require__2(
|
|
1808
|
+
/*! ../utils/nonNull */
|
|
1809
|
+
"./src/utils/nonNull.ts"
|
|
1810
|
+
);
|
|
1811
|
+
const HookContext_1 = __webpack_require__2(
|
|
1812
|
+
/*! ./HookContext */
|
|
1813
|
+
"./src/hooks/HookContext.ts"
|
|
1814
|
+
);
|
|
1815
|
+
class InvocationHookContext extends HookContext_1.HookContext {
|
|
1816
|
+
static {
|
|
1817
|
+
__name(this, "InvocationHookContext");
|
|
1818
|
+
}
|
|
1819
|
+
constructor(init) {
|
|
1820
|
+
var _a, _b;
|
|
1821
|
+
var _c, _d;
|
|
1822
|
+
super(init);
|
|
1823
|
+
_InvocationHookContext_init.set(this, void 0);
|
|
1824
|
+
__classPrivateFieldSet(this, _InvocationHookContext_init, init !== null && init !== void 0 ? init : {}, "f");
|
|
1825
|
+
(_a = (_c = __classPrivateFieldGet(this, _InvocationHookContext_init, "f")).inputs) !== null && _a !== void 0 ? _a : _c.inputs = [];
|
|
1826
|
+
(_b = (_d = __classPrivateFieldGet(this, _InvocationHookContext_init, "f")).invocationContext) !== null && _b !== void 0 ? _b : _d.invocationContext = new InvocationContext_1.InvocationContext();
|
|
1827
|
+
}
|
|
1828
|
+
get invocationContext() {
|
|
1829
|
+
return (0, nonNull_1.nonNullProp)(__classPrivateFieldGet(this, _InvocationHookContext_init, "f"), "invocationContext");
|
|
1830
|
+
}
|
|
1831
|
+
set invocationContext(_value) {
|
|
1832
|
+
throw new errors_1.ReadOnlyError("invocationContext");
|
|
1833
|
+
}
|
|
1834
|
+
get inputs() {
|
|
1835
|
+
return (0, nonNull_1.nonNullProp)(__classPrivateFieldGet(this, _InvocationHookContext_init, "f"), "inputs");
|
|
1836
|
+
}
|
|
1837
|
+
set inputs(value) {
|
|
1838
|
+
__classPrivateFieldGet(this, _InvocationHookContext_init, "f").inputs = value;
|
|
1839
|
+
}
|
|
1840
|
+
}
|
|
1841
|
+
exports2.InvocationHookContext = InvocationHookContext;
|
|
1842
|
+
_InvocationHookContext_init = /* @__PURE__ */ new WeakMap();
|
|
1843
|
+
},
|
|
1844
|
+
/***/
|
|
1845
|
+
"./src/hooks/LogHookContext.ts"(__unused_webpack_module, exports2, __webpack_require__2) {
|
|
1846
|
+
var __classPrivateFieldSet = this && this.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
|
|
1847
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
1848
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
1849
|
+
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");
|
|
1850
|
+
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
1851
|
+
};
|
|
1852
|
+
var __classPrivateFieldGet = this && this.__classPrivateFieldGet || function(receiver, state, kind, f) {
|
|
1853
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
1854
|
+
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");
|
|
1855
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
1856
|
+
};
|
|
1857
|
+
var _LogHookContext_init;
|
|
1858
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1859
|
+
exports2.LogHookContext = void 0;
|
|
1860
|
+
const errors_1 = __webpack_require__2(
|
|
1861
|
+
/*! ../errors */
|
|
1862
|
+
"./src/errors.ts"
|
|
1863
|
+
);
|
|
1864
|
+
const nonNull_1 = __webpack_require__2(
|
|
1865
|
+
/*! ../utils/nonNull */
|
|
1866
|
+
"./src/utils/nonNull.ts"
|
|
1867
|
+
);
|
|
1868
|
+
const HookContext_1 = __webpack_require__2(
|
|
1869
|
+
/*! ./HookContext */
|
|
1870
|
+
"./src/hooks/HookContext.ts"
|
|
1871
|
+
);
|
|
1872
|
+
class LogHookContext extends HookContext_1.HookContext {
|
|
1873
|
+
static {
|
|
1874
|
+
__name(this, "LogHookContext");
|
|
1875
|
+
}
|
|
1876
|
+
constructor(init) {
|
|
1877
|
+
var _a, _b, _c;
|
|
1878
|
+
var _d, _e, _f;
|
|
1879
|
+
super(init);
|
|
1880
|
+
_LogHookContext_init.set(this, void 0);
|
|
1881
|
+
__classPrivateFieldSet(this, _LogHookContext_init, init !== null && init !== void 0 ? init : {}, "f");
|
|
1882
|
+
(_a = (_d = __classPrivateFieldGet(this, _LogHookContext_init, "f")).level) !== null && _a !== void 0 ? _a : _d.level = "information";
|
|
1883
|
+
(_b = (_e = __classPrivateFieldGet(this, _LogHookContext_init, "f")).message) !== null && _b !== void 0 ? _b : _e.message = "unknown";
|
|
1884
|
+
(_c = (_f = __classPrivateFieldGet(this, _LogHookContext_init, "f")).category) !== null && _c !== void 0 ? _c : _f.category = "user";
|
|
1885
|
+
}
|
|
1886
|
+
get level() {
|
|
1887
|
+
return (0, nonNull_1.nonNullProp)(__classPrivateFieldGet(this, _LogHookContext_init, "f"), "level");
|
|
1888
|
+
}
|
|
1889
|
+
set level(value) {
|
|
1890
|
+
__classPrivateFieldGet(this, _LogHookContext_init, "f").level = value;
|
|
1891
|
+
}
|
|
1892
|
+
get message() {
|
|
1893
|
+
return (0, nonNull_1.nonNullProp)(__classPrivateFieldGet(this, _LogHookContext_init, "f"), "message");
|
|
1894
|
+
}
|
|
1895
|
+
set message(value) {
|
|
1896
|
+
__classPrivateFieldGet(this, _LogHookContext_init, "f").message = value;
|
|
1897
|
+
}
|
|
1898
|
+
get category() {
|
|
1899
|
+
return (0, nonNull_1.nonNullProp)(__classPrivateFieldGet(this, _LogHookContext_init, "f"), "category");
|
|
1900
|
+
}
|
|
1901
|
+
set category(_value) {
|
|
1902
|
+
throw new errors_1.ReadOnlyError("category");
|
|
1903
|
+
}
|
|
1904
|
+
get invocationContext() {
|
|
1905
|
+
return __classPrivateFieldGet(this, _LogHookContext_init, "f").invocationContext;
|
|
1906
|
+
}
|
|
1907
|
+
set invocationContext(_value) {
|
|
1908
|
+
throw new errors_1.ReadOnlyError("invocationContext");
|
|
1909
|
+
}
|
|
1910
|
+
}
|
|
1911
|
+
exports2.LogHookContext = LogHookContext;
|
|
1912
|
+
_LogHookContext_init = /* @__PURE__ */ new WeakMap();
|
|
1913
|
+
},
|
|
1914
|
+
/***/
|
|
1915
|
+
"./src/hooks/PostInvocationContext.ts"(__unused_webpack_module, exports2, __webpack_require__2) {
|
|
1916
|
+
var __classPrivateFieldSet = this && this.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
|
|
1917
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
1918
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
1919
|
+
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");
|
|
1920
|
+
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
1921
|
+
};
|
|
1922
|
+
var __classPrivateFieldGet = this && this.__classPrivateFieldGet || function(receiver, state, kind, f) {
|
|
1923
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
1924
|
+
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");
|
|
1925
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
1926
|
+
};
|
|
1927
|
+
var _PostInvocationContext_init;
|
|
1928
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1929
|
+
exports2.PostInvocationContext = void 0;
|
|
1930
|
+
const InvocationHookContext_1 = __webpack_require__2(
|
|
1931
|
+
/*! ./InvocationHookContext */
|
|
1932
|
+
"./src/hooks/InvocationHookContext.ts"
|
|
1933
|
+
);
|
|
1934
|
+
class PostInvocationContext extends InvocationHookContext_1.InvocationHookContext {
|
|
1935
|
+
static {
|
|
1936
|
+
__name(this, "PostInvocationContext");
|
|
1937
|
+
}
|
|
1938
|
+
constructor(init) {
|
|
1939
|
+
super(init);
|
|
1940
|
+
_PostInvocationContext_init.set(this, void 0);
|
|
1941
|
+
__classPrivateFieldSet(this, _PostInvocationContext_init, init !== null && init !== void 0 ? init : {}, "f");
|
|
1942
|
+
}
|
|
1943
|
+
get result() {
|
|
1944
|
+
return __classPrivateFieldGet(this, _PostInvocationContext_init, "f").result;
|
|
1945
|
+
}
|
|
1946
|
+
set result(value) {
|
|
1947
|
+
__classPrivateFieldGet(this, _PostInvocationContext_init, "f").result = value;
|
|
1948
|
+
}
|
|
1949
|
+
get error() {
|
|
1950
|
+
return __classPrivateFieldGet(this, _PostInvocationContext_init, "f").error;
|
|
1951
|
+
}
|
|
1952
|
+
set error(value) {
|
|
1953
|
+
__classPrivateFieldGet(this, _PostInvocationContext_init, "f").error = value;
|
|
1954
|
+
}
|
|
1955
|
+
}
|
|
1956
|
+
exports2.PostInvocationContext = PostInvocationContext;
|
|
1957
|
+
_PostInvocationContext_init = /* @__PURE__ */ new WeakMap();
|
|
1958
|
+
},
|
|
1959
|
+
/***/
|
|
1960
|
+
"./src/hooks/PreInvocationContext.ts"(__unused_webpack_module, exports2, __webpack_require__2) {
|
|
1961
|
+
var __classPrivateFieldSet = this && this.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
|
|
1962
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
1963
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
1964
|
+
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");
|
|
1965
|
+
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
1966
|
+
};
|
|
1967
|
+
var __classPrivateFieldGet = this && this.__classPrivateFieldGet || function(receiver, state, kind, f) {
|
|
1968
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
1969
|
+
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");
|
|
1970
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
1971
|
+
};
|
|
1972
|
+
var _PreInvocationContext_init;
|
|
1973
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1974
|
+
exports2.PreInvocationContext = void 0;
|
|
1975
|
+
const nonNull_1 = __webpack_require__2(
|
|
1976
|
+
/*! ../utils/nonNull */
|
|
1977
|
+
"./src/utils/nonNull.ts"
|
|
1978
|
+
);
|
|
1979
|
+
const InvocationHookContext_1 = __webpack_require__2(
|
|
1980
|
+
/*! ./InvocationHookContext */
|
|
1981
|
+
"./src/hooks/InvocationHookContext.ts"
|
|
1982
|
+
);
|
|
1983
|
+
class PreInvocationContext extends InvocationHookContext_1.InvocationHookContext {
|
|
1984
|
+
static {
|
|
1985
|
+
__name(this, "PreInvocationContext");
|
|
1986
|
+
}
|
|
1987
|
+
constructor(init) {
|
|
1988
|
+
var _a;
|
|
1989
|
+
var _b;
|
|
1990
|
+
super(init);
|
|
1991
|
+
_PreInvocationContext_init.set(this, void 0);
|
|
1992
|
+
__classPrivateFieldSet(this, _PreInvocationContext_init, init !== null && init !== void 0 ? init : {}, "f");
|
|
1993
|
+
(_a = (_b = __classPrivateFieldGet(this, _PreInvocationContext_init, "f")).functionCallback) !== null && _a !== void 0 ? _a : _b.functionCallback = () => {
|
|
1994
|
+
};
|
|
1995
|
+
}
|
|
1996
|
+
get functionHandler() {
|
|
1997
|
+
return (0, nonNull_1.nonNullProp)(__classPrivateFieldGet(this, _PreInvocationContext_init, "f"), "functionCallback");
|
|
1998
|
+
}
|
|
1999
|
+
set functionHandler(value) {
|
|
2000
|
+
__classPrivateFieldGet(this, _PreInvocationContext_init, "f").functionCallback = value;
|
|
2001
|
+
}
|
|
2002
|
+
}
|
|
2003
|
+
exports2.PreInvocationContext = PreInvocationContext;
|
|
2004
|
+
_PreInvocationContext_init = /* @__PURE__ */ new WeakMap();
|
|
2005
|
+
},
|
|
2006
|
+
/***/
|
|
2007
|
+
"./src/hooks/registerHook.ts"(__unused_webpack_module, exports2, __webpack_require__2) {
|
|
2008
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
2009
|
+
exports2.log = exports2.postInvocation = exports2.preInvocation = exports2.appTerminate = exports2.appStart = void 0;
|
|
2010
|
+
const errors_1 = __webpack_require__2(
|
|
2011
|
+
/*! ../errors */
|
|
2012
|
+
"./src/errors.ts"
|
|
2013
|
+
);
|
|
2014
|
+
const Disposable_1 = __webpack_require__2(
|
|
2015
|
+
/*! ../utils/Disposable */
|
|
2016
|
+
"./src/utils/Disposable.ts"
|
|
2017
|
+
);
|
|
2018
|
+
const tryGetCoreApiLazy_1 = __webpack_require__2(
|
|
2019
|
+
/*! ../utils/tryGetCoreApiLazy */
|
|
2020
|
+
"./src/utils/tryGetCoreApiLazy.ts"
|
|
2021
|
+
);
|
|
2022
|
+
const AppStartContext_1 = __webpack_require__2(
|
|
2023
|
+
/*! ./AppStartContext */
|
|
2024
|
+
"./src/hooks/AppStartContext.ts"
|
|
2025
|
+
);
|
|
2026
|
+
const AppTerminateContext_1 = __webpack_require__2(
|
|
2027
|
+
/*! ./AppTerminateContext */
|
|
2028
|
+
"./src/hooks/AppTerminateContext.ts"
|
|
2029
|
+
);
|
|
2030
|
+
const LogHookContext_1 = __webpack_require__2(
|
|
2031
|
+
/*! ./LogHookContext */
|
|
2032
|
+
"./src/hooks/LogHookContext.ts"
|
|
2033
|
+
);
|
|
2034
|
+
const PostInvocationContext_1 = __webpack_require__2(
|
|
2035
|
+
/*! ./PostInvocationContext */
|
|
2036
|
+
"./src/hooks/PostInvocationContext.ts"
|
|
2037
|
+
);
|
|
2038
|
+
const PreInvocationContext_1 = __webpack_require__2(
|
|
2039
|
+
/*! ./PreInvocationContext */
|
|
2040
|
+
"./src/hooks/PreInvocationContext.ts"
|
|
2041
|
+
);
|
|
2042
|
+
function registerHook(hookName, callback) {
|
|
2043
|
+
const coreApi = (0, tryGetCoreApiLazy_1.tryGetCoreApiLazy)();
|
|
2044
|
+
if (!coreApi) {
|
|
2045
|
+
console.warn(`WARNING: Skipping call to register ${hookName} hook because the "@azure/functions" package is in test mode.`);
|
|
2046
|
+
return new Disposable_1.Disposable(() => {
|
|
2047
|
+
console.warn(`WARNING: Skipping call to dispose ${hookName} hook because the "@azure/functions" package is in test mode.`);
|
|
2048
|
+
});
|
|
2049
|
+
} else {
|
|
2050
|
+
return coreApi.registerHook(hookName, callback);
|
|
2051
|
+
}
|
|
2052
|
+
}
|
|
2053
|
+
__name(registerHook, "registerHook");
|
|
2054
|
+
function appStart(handler2) {
|
|
2055
|
+
return registerHook("appStart", (coreContext) => {
|
|
2056
|
+
return handler2(new AppStartContext_1.AppStartContext(coreContext));
|
|
2057
|
+
});
|
|
2058
|
+
}
|
|
2059
|
+
__name(appStart, "appStart");
|
|
2060
|
+
exports2.appStart = appStart;
|
|
2061
|
+
function appTerminate(handler2) {
|
|
2062
|
+
return registerHook("appTerminate", (coreContext) => {
|
|
2063
|
+
return handler2(new AppTerminateContext_1.AppTerminateContext(coreContext));
|
|
2064
|
+
});
|
|
2065
|
+
}
|
|
2066
|
+
__name(appTerminate, "appTerminate");
|
|
2067
|
+
exports2.appTerminate = appTerminate;
|
|
2068
|
+
function preInvocation(handler2) {
|
|
2069
|
+
return registerHook("preInvocation", (coreContext) => {
|
|
2070
|
+
return handler2(new PreInvocationContext_1.PreInvocationContext(coreContext));
|
|
2071
|
+
});
|
|
2072
|
+
}
|
|
2073
|
+
__name(preInvocation, "preInvocation");
|
|
2074
|
+
exports2.preInvocation = preInvocation;
|
|
2075
|
+
function postInvocation(handler2) {
|
|
2076
|
+
return registerHook("postInvocation", (coreContext) => {
|
|
2077
|
+
return handler2(new PostInvocationContext_1.PostInvocationContext(coreContext));
|
|
2078
|
+
});
|
|
2079
|
+
}
|
|
2080
|
+
__name(postInvocation, "postInvocation");
|
|
2081
|
+
exports2.postInvocation = postInvocation;
|
|
2082
|
+
function log(handler2) {
|
|
2083
|
+
try {
|
|
2084
|
+
return registerHook("log", (coreContext) => {
|
|
2085
|
+
return handler2(new LogHookContext_1.LogHookContext(coreContext));
|
|
2086
|
+
});
|
|
2087
|
+
} catch (err) {
|
|
2088
|
+
const error = (0, errors_1.ensureErrorType)(err);
|
|
2089
|
+
if (error.name === "RangeError" && error.isAzureFunctionsSystemError) {
|
|
2090
|
+
throw new errors_1.AzFuncSystemError(`Log hooks require Azure Functions Host v4.34 or higher.`);
|
|
2091
|
+
} else {
|
|
2092
|
+
throw err;
|
|
2093
|
+
}
|
|
2094
|
+
}
|
|
2095
|
+
}
|
|
2096
|
+
__name(log, "log");
|
|
2097
|
+
exports2.log = log;
|
|
2098
|
+
},
|
|
2099
|
+
/***/
|
|
2100
|
+
"./src/http/HttpRequest.ts"(__unused_webpack_module, exports2, __webpack_require__2) {
|
|
2101
|
+
var __awaiter = this && this.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
2102
|
+
function adopt(value) {
|
|
2103
|
+
return value instanceof P ? value : new P(function(resolve) {
|
|
2104
|
+
resolve(value);
|
|
2105
|
+
});
|
|
2106
|
+
}
|
|
2107
|
+
__name(adopt, "adopt");
|
|
2108
|
+
return new (P || (P = Promise))(function(resolve, reject) {
|
|
2109
|
+
function fulfilled(value) {
|
|
2110
|
+
try {
|
|
2111
|
+
step(generator.next(value));
|
|
2112
|
+
} catch (e) {
|
|
2113
|
+
reject(e);
|
|
2114
|
+
}
|
|
2115
|
+
}
|
|
2116
|
+
__name(fulfilled, "fulfilled");
|
|
2117
|
+
function rejected(value) {
|
|
2118
|
+
try {
|
|
2119
|
+
step(generator["throw"](value));
|
|
2120
|
+
} catch (e) {
|
|
2121
|
+
reject(e);
|
|
2122
|
+
}
|
|
2123
|
+
}
|
|
2124
|
+
__name(rejected, "rejected");
|
|
2125
|
+
function step(result) {
|
|
2126
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
2127
|
+
}
|
|
2128
|
+
__name(step, "step");
|
|
2129
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
2130
|
+
});
|
|
2131
|
+
};
|
|
2132
|
+
var __classPrivateFieldSet = this && this.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
|
|
2133
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
2134
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
2135
|
+
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");
|
|
2136
|
+
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
2137
|
+
};
|
|
2138
|
+
var __classPrivateFieldGet = this && this.__classPrivateFieldGet || function(receiver, state, kind, f) {
|
|
2139
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
2140
|
+
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");
|
|
2141
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
2142
|
+
};
|
|
2143
|
+
var __rest = this && this.__rest || function(s, e) {
|
|
2144
|
+
var t = {};
|
|
2145
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
2146
|
+
t[p] = s[p];
|
|
2147
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
2148
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
2149
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
2150
|
+
t[p[i]] = s[p[i]];
|
|
2151
|
+
}
|
|
2152
|
+
return t;
|
|
2153
|
+
};
|
|
2154
|
+
var _HttpRequest_cachedUser, _HttpRequest_nativeReq, _HttpRequest_init;
|
|
2155
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
2156
|
+
exports2.createStreamRequest = exports2.HttpRequest = void 0;
|
|
2157
|
+
const url_1 = __webpack_require__2(
|
|
2158
|
+
/*! url */
|
|
2159
|
+
"url"
|
|
2160
|
+
);
|
|
2161
|
+
const fromRpcNullable_1 = __webpack_require__2(
|
|
2162
|
+
/*! ../converters/fromRpcNullable */
|
|
2163
|
+
"./src/converters/fromRpcNullable.ts"
|
|
2164
|
+
);
|
|
2165
|
+
const fromRpcTypedData_1 = __webpack_require__2(
|
|
2166
|
+
/*! ../converters/fromRpcTypedData */
|
|
2167
|
+
"./src/converters/fromRpcTypedData.ts"
|
|
2168
|
+
);
|
|
2169
|
+
const errors_1 = __webpack_require__2(
|
|
2170
|
+
/*! ../errors */
|
|
2171
|
+
"./src/errors.ts"
|
|
2172
|
+
);
|
|
2173
|
+
const nonNull_1 = __webpack_require__2(
|
|
2174
|
+
/*! ../utils/nonNull */
|
|
2175
|
+
"./src/utils/nonNull.ts"
|
|
2176
|
+
);
|
|
2177
|
+
const extractHttpUserFromHeaders_1 = __webpack_require__2(
|
|
2178
|
+
/*! ./extractHttpUserFromHeaders */
|
|
2179
|
+
"./src/http/extractHttpUserFromHeaders.ts"
|
|
2180
|
+
);
|
|
2181
|
+
class HttpRequest {
|
|
2182
|
+
static {
|
|
2183
|
+
__name(this, "HttpRequest");
|
|
2184
|
+
}
|
|
2185
|
+
constructor(init) {
|
|
2186
|
+
var _a, _b, _c;
|
|
2187
|
+
_HttpRequest_cachedUser.set(this, void 0);
|
|
2188
|
+
_HttpRequest_nativeReq.set(this, void 0);
|
|
2189
|
+
_HttpRequest_init.set(this, void 0);
|
|
2190
|
+
__classPrivateFieldSet(this, _HttpRequest_init, init, "f");
|
|
2191
|
+
let nativeReq = init.nativeRequest;
|
|
2192
|
+
if (!nativeReq) {
|
|
2193
|
+
const url = (0, nonNull_1.nonNullProp)(init, "url");
|
|
2194
|
+
let body;
|
|
2195
|
+
if ((_a = init.body) === null || _a === void 0 ? void 0 : _a.bytes) {
|
|
2196
|
+
body = Buffer.from((_b = init.body) === null || _b === void 0 ? void 0 : _b.bytes);
|
|
2197
|
+
} else if ((_c = init.body) === null || _c === void 0 ? void 0 : _c.string) {
|
|
2198
|
+
body = init.body.string;
|
|
2199
|
+
}
|
|
2200
|
+
nativeReq = new Request(url, {
|
|
2201
|
+
body,
|
|
2202
|
+
method: (0, nonNull_1.nonNullProp)(init, "method"),
|
|
2203
|
+
headers: (0, fromRpcNullable_1.fromNullableMapping)(init.nullableHeaders, init.headers)
|
|
2204
|
+
});
|
|
2205
|
+
}
|
|
2206
|
+
__classPrivateFieldSet(this, _HttpRequest_nativeReq, nativeReq, "f");
|
|
2207
|
+
if (init.nullableQuery || init.query) {
|
|
2208
|
+
this.query = new url_1.URLSearchParams((0, fromRpcNullable_1.fromNullableMapping)(init.nullableQuery, init.query));
|
|
2209
|
+
} else {
|
|
2210
|
+
this.query = new URL(__classPrivateFieldGet(this, _HttpRequest_nativeReq, "f").url).searchParams;
|
|
2211
|
+
}
|
|
2212
|
+
this.params = (0, fromRpcNullable_1.fromNullableMapping)(init.nullableParams, init.params);
|
|
2213
|
+
}
|
|
2214
|
+
get url() {
|
|
2215
|
+
return __classPrivateFieldGet(this, _HttpRequest_nativeReq, "f").url;
|
|
2216
|
+
}
|
|
2217
|
+
get method() {
|
|
2218
|
+
return __classPrivateFieldGet(this, _HttpRequest_nativeReq, "f").method;
|
|
2219
|
+
}
|
|
2220
|
+
get headers() {
|
|
2221
|
+
return __classPrivateFieldGet(this, _HttpRequest_nativeReq, "f").headers;
|
|
2222
|
+
}
|
|
2223
|
+
get user() {
|
|
2224
|
+
if (__classPrivateFieldGet(this, _HttpRequest_cachedUser, "f") === void 0) {
|
|
2225
|
+
__classPrivateFieldSet(this, _HttpRequest_cachedUser, (0, extractHttpUserFromHeaders_1.extractHttpUserFromHeaders)(this.headers), "f");
|
|
2226
|
+
}
|
|
2227
|
+
return __classPrivateFieldGet(this, _HttpRequest_cachedUser, "f");
|
|
2228
|
+
}
|
|
2229
|
+
get body() {
|
|
2230
|
+
return __classPrivateFieldGet(this, _HttpRequest_nativeReq, "f").body;
|
|
2231
|
+
}
|
|
2232
|
+
get bodyUsed() {
|
|
2233
|
+
return __classPrivateFieldGet(this, _HttpRequest_nativeReq, "f").bodyUsed;
|
|
2234
|
+
}
|
|
2235
|
+
arrayBuffer() {
|
|
2236
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2237
|
+
return __classPrivateFieldGet(this, _HttpRequest_nativeReq, "f").arrayBuffer();
|
|
2238
|
+
});
|
|
2239
|
+
}
|
|
2240
|
+
blob() {
|
|
2241
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2242
|
+
return __classPrivateFieldGet(this, _HttpRequest_nativeReq, "f").blob();
|
|
2243
|
+
});
|
|
2244
|
+
}
|
|
2245
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
2246
|
+
formData() {
|
|
2247
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2248
|
+
return __classPrivateFieldGet(this, _HttpRequest_nativeReq, "f").formData();
|
|
2249
|
+
});
|
|
2250
|
+
}
|
|
2251
|
+
json() {
|
|
2252
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2253
|
+
return __classPrivateFieldGet(this, _HttpRequest_nativeReq, "f").json();
|
|
2254
|
+
});
|
|
2255
|
+
}
|
|
2256
|
+
text() {
|
|
2257
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2258
|
+
return __classPrivateFieldGet(this, _HttpRequest_nativeReq, "f").text();
|
|
2259
|
+
});
|
|
2260
|
+
}
|
|
2261
|
+
clone() {
|
|
2262
|
+
const _a = __classPrivateFieldGet(this, _HttpRequest_init, "f"), { nativeRequest: _nativeRequest } = _a, initWithoutNativeReq = __rest(_a, ["nativeRequest"]);
|
|
2263
|
+
const newInit = structuredClone(initWithoutNativeReq);
|
|
2264
|
+
newInit.nativeRequest = __classPrivateFieldGet(this, _HttpRequest_nativeReq, "f").clone();
|
|
2265
|
+
return new HttpRequest(newInit);
|
|
2266
|
+
}
|
|
2267
|
+
}
|
|
2268
|
+
exports2.HttpRequest = HttpRequest;
|
|
2269
|
+
_HttpRequest_cachedUser = /* @__PURE__ */ new WeakMap(), _HttpRequest_nativeReq = /* @__PURE__ */ new WeakMap(), _HttpRequest_init = /* @__PURE__ */ new WeakMap();
|
|
2270
|
+
function createStreamRequest(proxyReq, triggerMetadata) {
|
|
2271
|
+
var _a;
|
|
2272
|
+
const hostHeaderName = "x-forwarded-host";
|
|
2273
|
+
const protoHeaderName = "x-forwarded-proto";
|
|
2274
|
+
const host = proxyReq.headers[hostHeaderName];
|
|
2275
|
+
const proto = proxyReq.headers[protoHeaderName];
|
|
2276
|
+
if (typeof host !== "string" || typeof proto !== "string") {
|
|
2277
|
+
throw new errors_1.AzFuncSystemError(`Expected headers "${hostHeaderName}" and "${protoHeaderName}" to be set.`);
|
|
2278
|
+
}
|
|
2279
|
+
const url = `${proto}://${host}${(0, nonNull_1.nonNullProp)(proxyReq, "url")}`;
|
|
2280
|
+
let body;
|
|
2281
|
+
const lowerMethod = (_a = proxyReq.method) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
2282
|
+
if (lowerMethod !== "get" && lowerMethod !== "head") {
|
|
2283
|
+
body = proxyReq;
|
|
2284
|
+
}
|
|
2285
|
+
const { Query: rpcQueryIgnored, Headers: rpcHeaders } = triggerMetadata, rpcParams = __rest(triggerMetadata, ["Query", "Headers"]);
|
|
2286
|
+
let headers;
|
|
2287
|
+
const headersData = (0, fromRpcTypedData_1.fromRpcTypedData)(rpcHeaders);
|
|
2288
|
+
if (typeof headersData === "object" && (0, nonNull_1.isDefined)(headersData)) {
|
|
2289
|
+
headers = headersData;
|
|
2290
|
+
}
|
|
2291
|
+
const nativeReq = new Request(url, {
|
|
2292
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
2293
|
+
body,
|
|
2294
|
+
duplex: "half",
|
|
2295
|
+
method: (0, nonNull_1.nonNullProp)(proxyReq, "method"),
|
|
2296
|
+
headers
|
|
2297
|
+
});
|
|
2298
|
+
const params = {};
|
|
2299
|
+
for (const [key, rpcValue] of Object.entries(rpcParams)) {
|
|
2300
|
+
if ((0, nonNull_1.isDefined)(rpcValue.string)) {
|
|
2301
|
+
params[key] = rpcValue.string;
|
|
2302
|
+
}
|
|
2303
|
+
}
|
|
2304
|
+
return new HttpRequest({
|
|
2305
|
+
nativeRequest: nativeReq,
|
|
2306
|
+
params
|
|
2307
|
+
});
|
|
2308
|
+
}
|
|
2309
|
+
__name(createStreamRequest, "createStreamRequest");
|
|
2310
|
+
exports2.createStreamRequest = createStreamRequest;
|
|
2311
|
+
},
|
|
2312
|
+
/***/
|
|
2313
|
+
"./src/http/HttpResponse.ts"(__unused_webpack_module, exports2, __webpack_require__2) {
|
|
2314
|
+
var __awaiter = this && this.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
2315
|
+
function adopt(value) {
|
|
2316
|
+
return value instanceof P ? value : new P(function(resolve) {
|
|
2317
|
+
resolve(value);
|
|
2318
|
+
});
|
|
2319
|
+
}
|
|
2320
|
+
__name(adopt, "adopt");
|
|
2321
|
+
return new (P || (P = Promise))(function(resolve, reject) {
|
|
2322
|
+
function fulfilled(value) {
|
|
2323
|
+
try {
|
|
2324
|
+
step(generator.next(value));
|
|
2325
|
+
} catch (e) {
|
|
2326
|
+
reject(e);
|
|
2327
|
+
}
|
|
2328
|
+
}
|
|
2329
|
+
__name(fulfilled, "fulfilled");
|
|
2330
|
+
function rejected(value) {
|
|
2331
|
+
try {
|
|
2332
|
+
step(generator["throw"](value));
|
|
2333
|
+
} catch (e) {
|
|
2334
|
+
reject(e);
|
|
2335
|
+
}
|
|
2336
|
+
}
|
|
2337
|
+
__name(rejected, "rejected");
|
|
2338
|
+
function step(result) {
|
|
2339
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
2340
|
+
}
|
|
2341
|
+
__name(step, "step");
|
|
2342
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
2343
|
+
});
|
|
2344
|
+
};
|
|
2345
|
+
var __classPrivateFieldSet = this && this.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
|
|
2346
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
2347
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
2348
|
+
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");
|
|
2349
|
+
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
2350
|
+
};
|
|
2351
|
+
var __classPrivateFieldGet = this && this.__classPrivateFieldGet || function(receiver, state, kind, f) {
|
|
2352
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
2353
|
+
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");
|
|
2354
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
2355
|
+
};
|
|
2356
|
+
var _HttpResponse_nativeRes, _HttpResponse_init;
|
|
2357
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
2358
|
+
exports2.HttpResponse = void 0;
|
|
2359
|
+
const nonNull_1 = __webpack_require__2(
|
|
2360
|
+
/*! ../utils/nonNull */
|
|
2361
|
+
"./src/utils/nonNull.ts"
|
|
2362
|
+
);
|
|
2363
|
+
class HttpResponse {
|
|
2364
|
+
static {
|
|
2365
|
+
__name(this, "HttpResponse");
|
|
2366
|
+
}
|
|
2367
|
+
constructor(init) {
|
|
2368
|
+
var _a;
|
|
2369
|
+
_HttpResponse_nativeRes.set(this, void 0);
|
|
2370
|
+
_HttpResponse_init.set(this, void 0);
|
|
2371
|
+
init !== null && init !== void 0 ? init : init = {};
|
|
2372
|
+
__classPrivateFieldSet(this, _HttpResponse_init, init, "f");
|
|
2373
|
+
if (init.nativeResponse) {
|
|
2374
|
+
__classPrivateFieldSet(this, _HttpResponse_nativeRes, init.nativeResponse, "f");
|
|
2375
|
+
} else {
|
|
2376
|
+
const resInit = { status: init.status, headers: init.headers };
|
|
2377
|
+
if ((0, nonNull_1.isDefined)(init.jsonBody)) {
|
|
2378
|
+
const jsonBody = JSON.stringify(init.jsonBody);
|
|
2379
|
+
const jsonHeaders = new Headers(resInit.headers);
|
|
2380
|
+
if (!jsonHeaders.has("content-type")) {
|
|
2381
|
+
jsonHeaders.set("content-type", "application/json");
|
|
2382
|
+
}
|
|
2383
|
+
__classPrivateFieldSet(this, _HttpResponse_nativeRes, new Response(jsonBody, Object.assign(Object.assign({}, resInit), { headers: jsonHeaders })), "f");
|
|
2384
|
+
} else {
|
|
2385
|
+
__classPrivateFieldSet(this, _HttpResponse_nativeRes, new Response(init.body, resInit), "f");
|
|
2386
|
+
}
|
|
2387
|
+
}
|
|
2388
|
+
this.cookies = (_a = init.cookies) !== null && _a !== void 0 ? _a : [];
|
|
2389
|
+
this.enableContentNegotiation = !!init.enableContentNegotiation;
|
|
2390
|
+
}
|
|
2391
|
+
get status() {
|
|
2392
|
+
return __classPrivateFieldGet(this, _HttpResponse_nativeRes, "f").status;
|
|
2393
|
+
}
|
|
2394
|
+
get headers() {
|
|
2395
|
+
return __classPrivateFieldGet(this, _HttpResponse_nativeRes, "f").headers;
|
|
2396
|
+
}
|
|
2397
|
+
get body() {
|
|
2398
|
+
return __classPrivateFieldGet(this, _HttpResponse_nativeRes, "f").body;
|
|
2399
|
+
}
|
|
2400
|
+
get bodyUsed() {
|
|
2401
|
+
return __classPrivateFieldGet(this, _HttpResponse_nativeRes, "f").bodyUsed;
|
|
2402
|
+
}
|
|
2403
|
+
arrayBuffer() {
|
|
2404
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2405
|
+
return __classPrivateFieldGet(this, _HttpResponse_nativeRes, "f").arrayBuffer();
|
|
2406
|
+
});
|
|
2407
|
+
}
|
|
2408
|
+
blob() {
|
|
2409
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2410
|
+
return __classPrivateFieldGet(this, _HttpResponse_nativeRes, "f").blob();
|
|
2411
|
+
});
|
|
2412
|
+
}
|
|
2413
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
2414
|
+
formData() {
|
|
2415
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2416
|
+
return __classPrivateFieldGet(this, _HttpResponse_nativeRes, "f").formData();
|
|
2417
|
+
});
|
|
2418
|
+
}
|
|
2419
|
+
json() {
|
|
2420
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2421
|
+
return __classPrivateFieldGet(this, _HttpResponse_nativeRes, "f").json();
|
|
2422
|
+
});
|
|
2423
|
+
}
|
|
2424
|
+
text() {
|
|
2425
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2426
|
+
return __classPrivateFieldGet(this, _HttpResponse_nativeRes, "f").text();
|
|
2427
|
+
});
|
|
2428
|
+
}
|
|
2429
|
+
clone() {
|
|
2430
|
+
const newInit = structuredClone(__classPrivateFieldGet(this, _HttpResponse_init, "f"));
|
|
2431
|
+
newInit.nativeResponse = __classPrivateFieldGet(this, _HttpResponse_nativeRes, "f").clone();
|
|
2432
|
+
return new HttpResponse(newInit);
|
|
2433
|
+
}
|
|
2434
|
+
}
|
|
2435
|
+
exports2.HttpResponse = HttpResponse;
|
|
2436
|
+
_HttpResponse_nativeRes = /* @__PURE__ */ new WeakMap(), _HttpResponse_init = /* @__PURE__ */ new WeakMap();
|
|
2437
|
+
},
|
|
2438
|
+
/***/
|
|
2439
|
+
"./src/http/extractHttpUserFromHeaders.ts"(__unused_webpack_module, exports2, __webpack_require__2) {
|
|
2440
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
2441
|
+
exports2.extractHttpUserFromHeaders = void 0;
|
|
2442
|
+
const nonNull_1 = __webpack_require__2(
|
|
2443
|
+
/*! ../utils/nonNull */
|
|
2444
|
+
"./src/utils/nonNull.ts"
|
|
2445
|
+
);
|
|
2446
|
+
function extractHttpUserFromHeaders(headers) {
|
|
2447
|
+
let user = null;
|
|
2448
|
+
const clientPrincipal = headers.get("x-ms-client-principal");
|
|
2449
|
+
if (clientPrincipal) {
|
|
2450
|
+
const claimsPrincipalData = JSON.parse(Buffer.from(clientPrincipal, "base64").toString("utf-8"));
|
|
2451
|
+
if (claimsPrincipalData["identityProvider"]) {
|
|
2452
|
+
user = {
|
|
2453
|
+
type: "StaticWebApps",
|
|
2454
|
+
id: claimsPrincipalData["userId"],
|
|
2455
|
+
username: claimsPrincipalData["userDetails"],
|
|
2456
|
+
identityProvider: claimsPrincipalData["identityProvider"],
|
|
2457
|
+
claimsPrincipalData
|
|
2458
|
+
};
|
|
2459
|
+
} else {
|
|
2460
|
+
user = {
|
|
2461
|
+
type: "AppService",
|
|
2462
|
+
id: (0, nonNull_1.nonNullValue)(headers.get("x-ms-client-principal-id"), "user-id"),
|
|
2463
|
+
username: (0, nonNull_1.nonNullValue)(headers.get("x-ms-client-principal-name"), "user-name"),
|
|
2464
|
+
identityProvider: (0, nonNull_1.nonNullValue)(headers.get("x-ms-client-principal-idp"), "user-idp"),
|
|
2465
|
+
claimsPrincipalData
|
|
2466
|
+
};
|
|
2467
|
+
}
|
|
2468
|
+
}
|
|
2469
|
+
return user;
|
|
2470
|
+
}
|
|
2471
|
+
__name(extractHttpUserFromHeaders, "extractHttpUserFromHeaders");
|
|
2472
|
+
exports2.extractHttpUserFromHeaders = extractHttpUserFromHeaders;
|
|
2473
|
+
},
|
|
2474
|
+
/***/
|
|
2475
|
+
"./src/http/httpProxy.ts"(__unused_webpack_module, exports2, __webpack_require__2) {
|
|
2476
|
+
var __awaiter = this && this.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
2477
|
+
function adopt(value) {
|
|
2478
|
+
return value instanceof P ? value : new P(function(resolve) {
|
|
2479
|
+
resolve(value);
|
|
2480
|
+
});
|
|
2481
|
+
}
|
|
2482
|
+
__name(adopt, "adopt");
|
|
2483
|
+
return new (P || (P = Promise))(function(resolve, reject) {
|
|
2484
|
+
function fulfilled(value) {
|
|
2485
|
+
try {
|
|
2486
|
+
step(generator.next(value));
|
|
2487
|
+
} catch (e) {
|
|
2488
|
+
reject(e);
|
|
2489
|
+
}
|
|
2490
|
+
}
|
|
2491
|
+
__name(fulfilled, "fulfilled");
|
|
2492
|
+
function rejected(value) {
|
|
2493
|
+
try {
|
|
2494
|
+
step(generator["throw"](value));
|
|
2495
|
+
} catch (e) {
|
|
2496
|
+
reject(e);
|
|
2497
|
+
}
|
|
2498
|
+
}
|
|
2499
|
+
__name(rejected, "rejected");
|
|
2500
|
+
function step(result) {
|
|
2501
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
2502
|
+
}
|
|
2503
|
+
__name(step, "step");
|
|
2504
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
2505
|
+
});
|
|
2506
|
+
};
|
|
2507
|
+
var __asyncValues = this && this.__asyncValues || function(o) {
|
|
2508
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
2509
|
+
var m = o[Symbol.asyncIterator], i;
|
|
2510
|
+
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
|
|
2511
|
+
return this;
|
|
2512
|
+
}, i);
|
|
2513
|
+
function verb(n) {
|
|
2514
|
+
i[n] = o[n] && function(v) {
|
|
2515
|
+
return new Promise(function(resolve, reject) {
|
|
2516
|
+
v = o[n](v), settle(resolve, reject, v.done, v.value);
|
|
2517
|
+
});
|
|
2518
|
+
};
|
|
2519
|
+
}
|
|
2520
|
+
__name(verb, "verb");
|
|
2521
|
+
function settle(resolve, reject, d, v) {
|
|
2522
|
+
Promise.resolve(v).then(function(v2) {
|
|
2523
|
+
resolve({ value: v2, done: d });
|
|
2524
|
+
}, reject);
|
|
2525
|
+
}
|
|
2526
|
+
__name(settle, "settle");
|
|
2527
|
+
};
|
|
2528
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
2529
|
+
exports2.setupHttpProxy = exports2.sendProxyResponse = exports2.waitForProxyRequest = void 0;
|
|
2530
|
+
const cookie_1 = __webpack_require__2(
|
|
2531
|
+
/*! cookie */
|
|
2532
|
+
"cookie"
|
|
2533
|
+
);
|
|
2534
|
+
const events_1 = __webpack_require__2(
|
|
2535
|
+
/*! events */
|
|
2536
|
+
"events"
|
|
2537
|
+
);
|
|
2538
|
+
const http = __webpack_require__2(
|
|
2539
|
+
/*! http */
|
|
2540
|
+
"http"
|
|
2541
|
+
);
|
|
2542
|
+
const net = __webpack_require__2(
|
|
2543
|
+
/*! net */
|
|
2544
|
+
"net"
|
|
2545
|
+
);
|
|
2546
|
+
const errors_1 = __webpack_require__2(
|
|
2547
|
+
/*! ../errors */
|
|
2548
|
+
"./src/errors.ts"
|
|
2549
|
+
);
|
|
2550
|
+
const nonNull_1 = __webpack_require__2(
|
|
2551
|
+
/*! ../utils/nonNull */
|
|
2552
|
+
"./src/utils/nonNull.ts"
|
|
2553
|
+
);
|
|
2554
|
+
const workerSystemLog_1 = __webpack_require__2(
|
|
2555
|
+
/*! ../utils/workerSystemLog */
|
|
2556
|
+
"./src/utils/workerSystemLog.ts"
|
|
2557
|
+
);
|
|
2558
|
+
const requests = {};
|
|
2559
|
+
const responses = {};
|
|
2560
|
+
const minPort = 55e3;
|
|
2561
|
+
const maxPort = 55025;
|
|
2562
|
+
const invocRequestEmitter = new events_1.EventEmitter();
|
|
2563
|
+
function waitForProxyRequest(invocationId) {
|
|
2564
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2565
|
+
return new Promise((resolve, _reject) => {
|
|
2566
|
+
const req = requests[invocationId];
|
|
2567
|
+
if (req) {
|
|
2568
|
+
resolve(req);
|
|
2569
|
+
delete requests[invocationId];
|
|
2570
|
+
} else {
|
|
2571
|
+
invocRequestEmitter.once(invocationId, () => {
|
|
2572
|
+
const req2 = requests[invocationId];
|
|
2573
|
+
if (req2) {
|
|
2574
|
+
resolve(req2);
|
|
2575
|
+
delete requests[invocationId];
|
|
2576
|
+
}
|
|
2577
|
+
});
|
|
2578
|
+
}
|
|
2579
|
+
});
|
|
2580
|
+
});
|
|
2581
|
+
}
|
|
2582
|
+
__name(waitForProxyRequest, "waitForProxyRequest");
|
|
2583
|
+
exports2.waitForProxyRequest = waitForProxyRequest;
|
|
2584
|
+
const invocationIdHeader = "x-ms-invocation-id";
|
|
2585
|
+
function sendProxyResponse(invocationId, userRes) {
|
|
2586
|
+
var _a, e_1, _b, _c;
|
|
2587
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2588
|
+
const proxyRes = (0, nonNull_1.nonNullProp)(responses, invocationId);
|
|
2589
|
+
delete responses[invocationId];
|
|
2590
|
+
for (const [key, val] of userRes.headers.entries()) {
|
|
2591
|
+
proxyRes.setHeader(key, val);
|
|
2592
|
+
}
|
|
2593
|
+
proxyRes.setHeader(invocationIdHeader, invocationId);
|
|
2594
|
+
proxyRes.statusCode = userRes.status;
|
|
2595
|
+
if (userRes.cookies.length > 0) {
|
|
2596
|
+
setCookies(userRes, proxyRes);
|
|
2597
|
+
}
|
|
2598
|
+
if (userRes.body) {
|
|
2599
|
+
try {
|
|
2600
|
+
for (var _d = true, _e = __asyncValues(userRes.body.values()), _f; _f = yield _e.next(), _a = _f.done, !_a; ) {
|
|
2601
|
+
_c = _f.value;
|
|
2602
|
+
_d = false;
|
|
2603
|
+
try {
|
|
2604
|
+
const chunk = _c;
|
|
2605
|
+
proxyRes.write(chunk);
|
|
2606
|
+
} finally {
|
|
2607
|
+
_d = true;
|
|
2608
|
+
}
|
|
2609
|
+
}
|
|
2610
|
+
} catch (e_1_1) {
|
|
2611
|
+
e_1 = { error: e_1_1 };
|
|
2612
|
+
} finally {
|
|
2613
|
+
try {
|
|
2614
|
+
if (!_d && !_a && (_b = _e.return)) yield _b.call(_e);
|
|
2615
|
+
} finally {
|
|
2616
|
+
if (e_1) throw e_1.error;
|
|
2617
|
+
}
|
|
2618
|
+
}
|
|
2619
|
+
}
|
|
2620
|
+
proxyRes.end();
|
|
2621
|
+
});
|
|
2622
|
+
}
|
|
2623
|
+
__name(sendProxyResponse, "sendProxyResponse");
|
|
2624
|
+
exports2.sendProxyResponse = sendProxyResponse;
|
|
2625
|
+
function setCookies(userRes, proxyRes) {
|
|
2626
|
+
const serializedCookies = userRes.cookies.map((c) => {
|
|
2627
|
+
let sameSite;
|
|
2628
|
+
switch (c.sameSite) {
|
|
2629
|
+
case "Lax":
|
|
2630
|
+
sameSite = "lax";
|
|
2631
|
+
break;
|
|
2632
|
+
case "None":
|
|
2633
|
+
sameSite = "none";
|
|
2634
|
+
break;
|
|
2635
|
+
case "Strict":
|
|
2636
|
+
sameSite = "strict";
|
|
2637
|
+
break;
|
|
2638
|
+
default:
|
|
2639
|
+
sameSite = c.sameSite;
|
|
2640
|
+
}
|
|
2641
|
+
return (0, cookie_1.serialize)(c.name, c.value, {
|
|
2642
|
+
domain: c.domain,
|
|
2643
|
+
path: c.path,
|
|
2644
|
+
expires: typeof c.expires === "number" ? new Date(c.expires) : c.expires,
|
|
2645
|
+
secure: c.secure,
|
|
2646
|
+
httpOnly: c.httpOnly,
|
|
2647
|
+
sameSite,
|
|
2648
|
+
maxAge: c.maxAge
|
|
2649
|
+
});
|
|
2650
|
+
});
|
|
2651
|
+
proxyRes.setHeader("Set-Cookie", serializedCookies);
|
|
2652
|
+
}
|
|
2653
|
+
__name(setCookies, "setCookies");
|
|
2654
|
+
function setupHttpProxy() {
|
|
2655
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2656
|
+
return new Promise((resolve, reject) => {
|
|
2657
|
+
const server = http.createServer();
|
|
2658
|
+
server.on("request", (req, res) => {
|
|
2659
|
+
const invocationId = req.headers[invocationIdHeader];
|
|
2660
|
+
if (typeof invocationId === "string") {
|
|
2661
|
+
requests[invocationId] = req;
|
|
2662
|
+
responses[invocationId] = res;
|
|
2663
|
+
invocRequestEmitter.emit(invocationId);
|
|
2664
|
+
} else {
|
|
2665
|
+
(0, workerSystemLog_1.workerSystemLog)("error", `Http proxy request missing header ${invocationIdHeader}`);
|
|
2666
|
+
}
|
|
2667
|
+
});
|
|
2668
|
+
server.on("error", (err) => {
|
|
2669
|
+
err = (0, errors_1.ensureErrorType)(err);
|
|
2670
|
+
(0, workerSystemLog_1.workerSystemLog)("error", `Http proxy error: ${err.stack || err.message}`);
|
|
2671
|
+
});
|
|
2672
|
+
server.listen(() => {
|
|
2673
|
+
const address = server.address();
|
|
2674
|
+
if (address !== null && typeof address === "object") {
|
|
2675
|
+
if (address.port === 0) {
|
|
2676
|
+
(0, workerSystemLog_1.workerSystemLog)("debug", `Port 0 assigned. Finding open port.`);
|
|
2677
|
+
findOpenPort((openPort) => {
|
|
2678
|
+
server.close();
|
|
2679
|
+
server.listen(openPort, () => {
|
|
2680
|
+
(0, workerSystemLog_1.workerSystemLog)("debug", `Server is now listening on found open port: ${openPort}`);
|
|
2681
|
+
});
|
|
2682
|
+
resolve(`http://localhost:${openPort}/`);
|
|
2683
|
+
});
|
|
2684
|
+
} else {
|
|
2685
|
+
(0, workerSystemLog_1.workerSystemLog)("debug", `Auto-assigned port is valid. Port: ${address.port}`);
|
|
2686
|
+
resolve(`http://localhost:${address.port}/`);
|
|
2687
|
+
}
|
|
2688
|
+
} else {
|
|
2689
|
+
reject(new errors_1.AzFuncSystemError("Unexpected server address during http proxy setup"));
|
|
2690
|
+
}
|
|
2691
|
+
});
|
|
2692
|
+
server.on("close", () => {
|
|
2693
|
+
(0, workerSystemLog_1.workerSystemLog)("information", "Http proxy closing");
|
|
2694
|
+
});
|
|
2695
|
+
});
|
|
2696
|
+
});
|
|
2697
|
+
}
|
|
2698
|
+
__name(setupHttpProxy, "setupHttpProxy");
|
|
2699
|
+
exports2.setupHttpProxy = setupHttpProxy;
|
|
2700
|
+
function findOpenPort(callback) {
|
|
2701
|
+
const server = net.createServer();
|
|
2702
|
+
function tryPort(port) {
|
|
2703
|
+
if (port > maxPort) {
|
|
2704
|
+
throw new errors_1.AzFuncSystemError(`No available ports found between ${minPort} and ${maxPort}. To enable HTTP streaming, please open a port in this range.`);
|
|
2705
|
+
}
|
|
2706
|
+
server.once("error", () => {
|
|
2707
|
+
tryPort(port + 1);
|
|
2708
|
+
});
|
|
2709
|
+
server.once("listening", () => {
|
|
2710
|
+
const address = server.address();
|
|
2711
|
+
if (address !== null && typeof address === "object") {
|
|
2712
|
+
port = address.port;
|
|
2713
|
+
server.close();
|
|
2714
|
+
callback(port);
|
|
2715
|
+
}
|
|
2716
|
+
});
|
|
2717
|
+
server.listen(port);
|
|
2718
|
+
}
|
|
2719
|
+
__name(tryPort, "tryPort");
|
|
2720
|
+
tryPort(minPort);
|
|
2721
|
+
}
|
|
2722
|
+
__name(findOpenPort, "findOpenPort");
|
|
2723
|
+
},
|
|
2724
|
+
/***/
|
|
2725
|
+
"./src/index.ts"(__unused_webpack_module, exports2, __webpack_require__2) {
|
|
2726
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
2727
|
+
exports2.MySqlChangeOperation = exports2.SqlChangeOperation = exports2.arg = exports2.Disposable = exports2.trigger = exports2.output = exports2.InvocationContext = exports2.input = exports2.HttpResponse = exports2.HttpRequest = exports2.PreInvocationContext = exports2.PostInvocationContext = exports2.LogHookContext = exports2.InvocationHookContext = exports2.HookContext = exports2.AppTerminateContext = exports2.AppStartContext = exports2.app = void 0;
|
|
2728
|
+
exports2.app = __webpack_require__2(
|
|
2729
|
+
/*! ./app */
|
|
2730
|
+
"./src/app.ts"
|
|
2731
|
+
);
|
|
2732
|
+
var AppStartContext_1 = __webpack_require__2(
|
|
2733
|
+
/*! ./hooks/AppStartContext */
|
|
2734
|
+
"./src/hooks/AppStartContext.ts"
|
|
2735
|
+
);
|
|
2736
|
+
Object.defineProperty(exports2, "AppStartContext", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
2737
|
+
return AppStartContext_1.AppStartContext;
|
|
2738
|
+
}, "get") });
|
|
2739
|
+
var AppTerminateContext_1 = __webpack_require__2(
|
|
2740
|
+
/*! ./hooks/AppTerminateContext */
|
|
2741
|
+
"./src/hooks/AppTerminateContext.ts"
|
|
2742
|
+
);
|
|
2743
|
+
Object.defineProperty(exports2, "AppTerminateContext", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
2744
|
+
return AppTerminateContext_1.AppTerminateContext;
|
|
2745
|
+
}, "get") });
|
|
2746
|
+
var HookContext_1 = __webpack_require__2(
|
|
2747
|
+
/*! ./hooks/HookContext */
|
|
2748
|
+
"./src/hooks/HookContext.ts"
|
|
2749
|
+
);
|
|
2750
|
+
Object.defineProperty(exports2, "HookContext", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
2751
|
+
return HookContext_1.HookContext;
|
|
2752
|
+
}, "get") });
|
|
2753
|
+
var InvocationHookContext_1 = __webpack_require__2(
|
|
2754
|
+
/*! ./hooks/InvocationHookContext */
|
|
2755
|
+
"./src/hooks/InvocationHookContext.ts"
|
|
2756
|
+
);
|
|
2757
|
+
Object.defineProperty(exports2, "InvocationHookContext", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
2758
|
+
return InvocationHookContext_1.InvocationHookContext;
|
|
2759
|
+
}, "get") });
|
|
2760
|
+
var LogHookContext_1 = __webpack_require__2(
|
|
2761
|
+
/*! ./hooks/LogHookContext */
|
|
2762
|
+
"./src/hooks/LogHookContext.ts"
|
|
2763
|
+
);
|
|
2764
|
+
Object.defineProperty(exports2, "LogHookContext", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
2765
|
+
return LogHookContext_1.LogHookContext;
|
|
2766
|
+
}, "get") });
|
|
2767
|
+
var PostInvocationContext_1 = __webpack_require__2(
|
|
2768
|
+
/*! ./hooks/PostInvocationContext */
|
|
2769
|
+
"./src/hooks/PostInvocationContext.ts"
|
|
2770
|
+
);
|
|
2771
|
+
Object.defineProperty(exports2, "PostInvocationContext", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
2772
|
+
return PostInvocationContext_1.PostInvocationContext;
|
|
2773
|
+
}, "get") });
|
|
2774
|
+
var PreInvocationContext_1 = __webpack_require__2(
|
|
2775
|
+
/*! ./hooks/PreInvocationContext */
|
|
2776
|
+
"./src/hooks/PreInvocationContext.ts"
|
|
2777
|
+
);
|
|
2778
|
+
Object.defineProperty(exports2, "PreInvocationContext", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
2779
|
+
return PreInvocationContext_1.PreInvocationContext;
|
|
2780
|
+
}, "get") });
|
|
2781
|
+
var HttpRequest_1 = __webpack_require__2(
|
|
2782
|
+
/*! ./http/HttpRequest */
|
|
2783
|
+
"./src/http/HttpRequest.ts"
|
|
2784
|
+
);
|
|
2785
|
+
Object.defineProperty(exports2, "HttpRequest", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
2786
|
+
return HttpRequest_1.HttpRequest;
|
|
2787
|
+
}, "get") });
|
|
2788
|
+
var HttpResponse_1 = __webpack_require__2(
|
|
2789
|
+
/*! ./http/HttpResponse */
|
|
2790
|
+
"./src/http/HttpResponse.ts"
|
|
2791
|
+
);
|
|
2792
|
+
Object.defineProperty(exports2, "HttpResponse", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
2793
|
+
return HttpResponse_1.HttpResponse;
|
|
2794
|
+
}, "get") });
|
|
2795
|
+
exports2.input = __webpack_require__2(
|
|
2796
|
+
/*! ./input */
|
|
2797
|
+
"./src/input.ts"
|
|
2798
|
+
);
|
|
2799
|
+
var InvocationContext_1 = __webpack_require__2(
|
|
2800
|
+
/*! ./InvocationContext */
|
|
2801
|
+
"./src/InvocationContext.ts"
|
|
2802
|
+
);
|
|
2803
|
+
Object.defineProperty(exports2, "InvocationContext", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
2804
|
+
return InvocationContext_1.InvocationContext;
|
|
2805
|
+
}, "get") });
|
|
2806
|
+
exports2.output = __webpack_require__2(
|
|
2807
|
+
/*! ./output */
|
|
2808
|
+
"./src/output.ts"
|
|
2809
|
+
);
|
|
2810
|
+
exports2.trigger = __webpack_require__2(
|
|
2811
|
+
/*! ./trigger */
|
|
2812
|
+
"./src/trigger.ts"
|
|
2813
|
+
);
|
|
2814
|
+
var Disposable_1 = __webpack_require__2(
|
|
2815
|
+
/*! ./utils/Disposable */
|
|
2816
|
+
"./src/utils/Disposable.ts"
|
|
2817
|
+
);
|
|
2818
|
+
Object.defineProperty(exports2, "Disposable", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
2819
|
+
return Disposable_1.Disposable;
|
|
2820
|
+
}, "get") });
|
|
2821
|
+
var toolProperties_1 = __webpack_require__2(
|
|
2822
|
+
/*! ./utils/toolProperties */
|
|
2823
|
+
"./src/utils/toolProperties.ts"
|
|
2824
|
+
);
|
|
2825
|
+
Object.defineProperty(exports2, "arg", { enumerable: true, get: /* @__PURE__ */ __name(function() {
|
|
2826
|
+
return toolProperties_1.arg;
|
|
2827
|
+
}, "get") });
|
|
2828
|
+
var SqlChangeOperation;
|
|
2829
|
+
(function(SqlChangeOperation2) {
|
|
2830
|
+
SqlChangeOperation2[SqlChangeOperation2["Insert"] = 0] = "Insert";
|
|
2831
|
+
SqlChangeOperation2[SqlChangeOperation2["Update"] = 1] = "Update";
|
|
2832
|
+
SqlChangeOperation2[SqlChangeOperation2["Delete"] = 2] = "Delete";
|
|
2833
|
+
})(SqlChangeOperation = exports2.SqlChangeOperation || (exports2.SqlChangeOperation = {}));
|
|
2834
|
+
var MySqlChangeOperation;
|
|
2835
|
+
(function(MySqlChangeOperation2) {
|
|
2836
|
+
MySqlChangeOperation2[MySqlChangeOperation2["Update"] = 0] = "Update";
|
|
2837
|
+
})(MySqlChangeOperation = exports2.MySqlChangeOperation || (exports2.MySqlChangeOperation = {}));
|
|
2838
|
+
},
|
|
2839
|
+
/***/
|
|
2840
|
+
"./src/input.ts"(__unused_webpack_module, exports2, __webpack_require__2) {
|
|
2841
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
2842
|
+
exports2.generic = exports2.webPubSubContext = exports2.webPubSubConnection = exports2.mySql = exports2.sql = exports2.cosmosDB = exports2.table = exports2.storageBlob = void 0;
|
|
2843
|
+
const addBindingName_1 = __webpack_require__2(
|
|
2844
|
+
/*! ./addBindingName */
|
|
2845
|
+
"./src/addBindingName.ts"
|
|
2846
|
+
);
|
|
2847
|
+
function storageBlob(options) {
|
|
2848
|
+
return addInputBindingName(Object.assign(Object.assign({}, options), { type: "blob" }));
|
|
2849
|
+
}
|
|
2850
|
+
__name(storageBlob, "storageBlob");
|
|
2851
|
+
exports2.storageBlob = storageBlob;
|
|
2852
|
+
function table(options) {
|
|
2853
|
+
return addInputBindingName(Object.assign(Object.assign({}, options), { type: "table" }));
|
|
2854
|
+
}
|
|
2855
|
+
__name(table, "table");
|
|
2856
|
+
exports2.table = table;
|
|
2857
|
+
function cosmosDB(options) {
|
|
2858
|
+
return addInputBindingName(Object.assign(Object.assign({}, options), { type: "cosmosDB" }));
|
|
2859
|
+
}
|
|
2860
|
+
__name(cosmosDB, "cosmosDB");
|
|
2861
|
+
exports2.cosmosDB = cosmosDB;
|
|
2862
|
+
function sql(options) {
|
|
2863
|
+
return addInputBindingName(Object.assign(Object.assign({}, options), { type: "sql" }));
|
|
2864
|
+
}
|
|
2865
|
+
__name(sql, "sql");
|
|
2866
|
+
exports2.sql = sql;
|
|
2867
|
+
function mySql(options) {
|
|
2868
|
+
return addInputBindingName(Object.assign(Object.assign({}, options), { type: "mysql" }));
|
|
2869
|
+
}
|
|
2870
|
+
__name(mySql, "mySql");
|
|
2871
|
+
exports2.mySql = mySql;
|
|
2872
|
+
function webPubSubConnection(options) {
|
|
2873
|
+
return addInputBindingName(Object.assign(Object.assign({}, options), { type: "webPubSubConnection" }));
|
|
2874
|
+
}
|
|
2875
|
+
__name(webPubSubConnection, "webPubSubConnection");
|
|
2876
|
+
exports2.webPubSubConnection = webPubSubConnection;
|
|
2877
|
+
function webPubSubContext(options) {
|
|
2878
|
+
return addInputBindingName(Object.assign(Object.assign({}, options), { type: "webPubSubContext" }));
|
|
2879
|
+
}
|
|
2880
|
+
__name(webPubSubContext, "webPubSubContext");
|
|
2881
|
+
exports2.webPubSubContext = webPubSubContext;
|
|
2882
|
+
function generic(options) {
|
|
2883
|
+
return addInputBindingName(options);
|
|
2884
|
+
}
|
|
2885
|
+
__name(generic, "generic");
|
|
2886
|
+
exports2.generic = generic;
|
|
2887
|
+
function addInputBindingName(binding) {
|
|
2888
|
+
return (0, addBindingName_1.addBindingName)(binding, "Input");
|
|
2889
|
+
}
|
|
2890
|
+
__name(addInputBindingName, "addInputBindingName");
|
|
2891
|
+
},
|
|
2892
|
+
/***/
|
|
2893
|
+
"./src/output.ts"(__unused_webpack_module, exports2, __webpack_require__2) {
|
|
2894
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
2895
|
+
exports2.generic = exports2.webPubSub = exports2.mySql = exports2.sql = exports2.cosmosDB = exports2.eventGrid = exports2.eventHub = exports2.serviceBusTopic = exports2.serviceBusQueue = exports2.storageQueue = exports2.table = exports2.storageBlob = exports2.http = void 0;
|
|
2896
|
+
const addBindingName_1 = __webpack_require__2(
|
|
2897
|
+
/*! ./addBindingName */
|
|
2898
|
+
"./src/addBindingName.ts"
|
|
2899
|
+
);
|
|
2900
|
+
function http(options) {
|
|
2901
|
+
return addOutputBindingName(Object.assign(Object.assign({}, options), { type: "http" }));
|
|
2902
|
+
}
|
|
2903
|
+
__name(http, "http");
|
|
2904
|
+
exports2.http = http;
|
|
2905
|
+
function storageBlob(options) {
|
|
2906
|
+
return addOutputBindingName(Object.assign(Object.assign({}, options), { type: "blob" }));
|
|
2907
|
+
}
|
|
2908
|
+
__name(storageBlob, "storageBlob");
|
|
2909
|
+
exports2.storageBlob = storageBlob;
|
|
2910
|
+
function table(options) {
|
|
2911
|
+
return addOutputBindingName(Object.assign(Object.assign({}, options), { type: "table" }));
|
|
2912
|
+
}
|
|
2913
|
+
__name(table, "table");
|
|
2914
|
+
exports2.table = table;
|
|
2915
|
+
function storageQueue(options) {
|
|
2916
|
+
return addOutputBindingName(Object.assign(Object.assign({}, options), { type: "queue" }));
|
|
2917
|
+
}
|
|
2918
|
+
__name(storageQueue, "storageQueue");
|
|
2919
|
+
exports2.storageQueue = storageQueue;
|
|
2920
|
+
function serviceBusQueue(options) {
|
|
2921
|
+
return addOutputBindingName(Object.assign(Object.assign({}, options), { type: "serviceBus" }));
|
|
2922
|
+
}
|
|
2923
|
+
__name(serviceBusQueue, "serviceBusQueue");
|
|
2924
|
+
exports2.serviceBusQueue = serviceBusQueue;
|
|
2925
|
+
function serviceBusTopic(options) {
|
|
2926
|
+
return addOutputBindingName(Object.assign(Object.assign({}, options), { type: "serviceBus" }));
|
|
2927
|
+
}
|
|
2928
|
+
__name(serviceBusTopic, "serviceBusTopic");
|
|
2929
|
+
exports2.serviceBusTopic = serviceBusTopic;
|
|
2930
|
+
function eventHub(options) {
|
|
2931
|
+
return addOutputBindingName(Object.assign(Object.assign({}, options), { type: "eventHub" }));
|
|
2932
|
+
}
|
|
2933
|
+
__name(eventHub, "eventHub");
|
|
2934
|
+
exports2.eventHub = eventHub;
|
|
2935
|
+
function eventGrid(options) {
|
|
2936
|
+
return addOutputBindingName(Object.assign(Object.assign({}, options), { type: "eventGrid" }));
|
|
2937
|
+
}
|
|
2938
|
+
__name(eventGrid, "eventGrid");
|
|
2939
|
+
exports2.eventGrid = eventGrid;
|
|
2940
|
+
function cosmosDB(options) {
|
|
2941
|
+
return addOutputBindingName(Object.assign(Object.assign({}, options), { type: "cosmosDB" }));
|
|
2942
|
+
}
|
|
2943
|
+
__name(cosmosDB, "cosmosDB");
|
|
2944
|
+
exports2.cosmosDB = cosmosDB;
|
|
2945
|
+
function sql(options) {
|
|
2946
|
+
return addOutputBindingName(Object.assign(Object.assign({}, options), { type: "sql" }));
|
|
2947
|
+
}
|
|
2948
|
+
__name(sql, "sql");
|
|
2949
|
+
exports2.sql = sql;
|
|
2950
|
+
function mySql(options) {
|
|
2951
|
+
return addOutputBindingName(Object.assign(Object.assign({}, options), { type: "mysql" }));
|
|
2952
|
+
}
|
|
2953
|
+
__name(mySql, "mySql");
|
|
2954
|
+
exports2.mySql = mySql;
|
|
2955
|
+
function webPubSub(options) {
|
|
2956
|
+
return addOutputBindingName(Object.assign(Object.assign({}, options), { type: "webPubSub" }));
|
|
2957
|
+
}
|
|
2958
|
+
__name(webPubSub, "webPubSub");
|
|
2959
|
+
exports2.webPubSub = webPubSub;
|
|
2960
|
+
function generic(options) {
|
|
2961
|
+
return addOutputBindingName(options);
|
|
2962
|
+
}
|
|
2963
|
+
__name(generic, "generic");
|
|
2964
|
+
exports2.generic = generic;
|
|
2965
|
+
function addOutputBindingName(binding) {
|
|
2966
|
+
return (0, addBindingName_1.addBindingName)(binding, "Output");
|
|
2967
|
+
}
|
|
2968
|
+
__name(addOutputBindingName, "addOutputBindingName");
|
|
2969
|
+
},
|
|
2970
|
+
/***/
|
|
2971
|
+
"./src/setup.ts"(__unused_webpack_module, exports2, __webpack_require__2) {
|
|
2972
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
2973
|
+
exports2.setup = exports2.capabilities = exports2.enableHttpStream = exports2.lockSetup = void 0;
|
|
2974
|
+
const errors_1 = __webpack_require__2(
|
|
2975
|
+
/*! ./errors */
|
|
2976
|
+
"./src/errors.ts"
|
|
2977
|
+
);
|
|
2978
|
+
const nonNull_1 = __webpack_require__2(
|
|
2979
|
+
/*! ./utils/nonNull */
|
|
2980
|
+
"./src/utils/nonNull.ts"
|
|
2981
|
+
);
|
|
2982
|
+
const tryGetCoreApiLazy_1 = __webpack_require__2(
|
|
2983
|
+
/*! ./utils/tryGetCoreApiLazy */
|
|
2984
|
+
"./src/utils/tryGetCoreApiLazy.ts"
|
|
2985
|
+
);
|
|
2986
|
+
const workerSystemLog_1 = __webpack_require__2(
|
|
2987
|
+
/*! ./utils/workerSystemLog */
|
|
2988
|
+
"./src/utils/workerSystemLog.ts"
|
|
2989
|
+
);
|
|
2990
|
+
let setupLocked = false;
|
|
2991
|
+
function lockSetup() {
|
|
2992
|
+
setupLocked = true;
|
|
2993
|
+
}
|
|
2994
|
+
__name(lockSetup, "lockSetup");
|
|
2995
|
+
exports2.lockSetup = lockSetup;
|
|
2996
|
+
exports2.enableHttpStream = false;
|
|
2997
|
+
exports2.capabilities = {};
|
|
2998
|
+
function setup(opts) {
|
|
2999
|
+
if (setupLocked) {
|
|
3000
|
+
throw new errors_1.AzFuncSystemError("Setup options can't be changed after app startup has finished.");
|
|
3001
|
+
}
|
|
3002
|
+
if (opts.enableHttpStream) {
|
|
3003
|
+
const coreApi = (0, tryGetCoreApiLazy_1.tryGetCoreApiLazy)();
|
|
3004
|
+
if (coreApi && !coreApi.log) {
|
|
3005
|
+
throw new errors_1.AzFuncSystemError(`HTTP streaming requires Azure Functions Host v4.28 or higher.`);
|
|
3006
|
+
}
|
|
3007
|
+
}
|
|
3008
|
+
if ((0, nonNull_1.isDefined)(opts.enableHttpStream)) {
|
|
3009
|
+
exports2.enableHttpStream = opts.enableHttpStream;
|
|
3010
|
+
}
|
|
3011
|
+
if (opts.capabilities) {
|
|
3012
|
+
for (let [key, val] of Object.entries(opts.capabilities)) {
|
|
3013
|
+
if ((0, nonNull_1.isDefined)(val)) {
|
|
3014
|
+
val = String(val);
|
|
3015
|
+
(0, workerSystemLog_1.workerSystemLog)("debug", `Capability ${key} set to ${val}.`);
|
|
3016
|
+
exports2.capabilities[key] = val;
|
|
3017
|
+
}
|
|
3018
|
+
}
|
|
3019
|
+
}
|
|
3020
|
+
if (exports2.enableHttpStream) {
|
|
3021
|
+
(0, workerSystemLog_1.workerSystemLog)("debug", `HTTP streaming enabled.`);
|
|
3022
|
+
}
|
|
3023
|
+
}
|
|
3024
|
+
__name(setup, "setup");
|
|
3025
|
+
exports2.setup = setup;
|
|
3026
|
+
},
|
|
3027
|
+
/***/
|
|
3028
|
+
"./src/trigger.ts"(__unused_webpack_module, exports2, __webpack_require__2) {
|
|
3029
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3030
|
+
exports2.generic = exports2.mcpResource = exports2.mcpTool = exports2.webPubSub = exports2.mySql = exports2.sql = exports2.warmup = exports2.cosmosDB = exports2.eventGrid = exports2.eventHub = exports2.serviceBusTopic = exports2.serviceBusQueue = exports2.storageQueue = exports2.storageBlob = exports2.timer = exports2.http = void 0;
|
|
3031
|
+
const addBindingName_1 = __webpack_require__2(
|
|
3032
|
+
/*! ./addBindingName */
|
|
3033
|
+
"./src/addBindingName.ts"
|
|
3034
|
+
);
|
|
3035
|
+
const toMcpResourceTriggerOptionsToRpc_1 = __webpack_require__2(
|
|
3036
|
+
/*! ./converters/toMcpResourceTriggerOptionsToRpc */
|
|
3037
|
+
"./src/converters/toMcpResourceTriggerOptionsToRpc.ts"
|
|
3038
|
+
);
|
|
3039
|
+
const toMcpToolTriggerOptionsToRpc_1 = __webpack_require__2(
|
|
3040
|
+
/*! ./converters/toMcpToolTriggerOptionsToRpc */
|
|
3041
|
+
"./src/converters/toMcpToolTriggerOptionsToRpc.ts"
|
|
3042
|
+
);
|
|
3043
|
+
function http(options) {
|
|
3044
|
+
return addTriggerBindingName(Object.assign(Object.assign({}, options), { authLevel: options.authLevel || "anonymous", methods: options.methods || ["GET", "POST"], type: "httpTrigger" }));
|
|
3045
|
+
}
|
|
3046
|
+
__name(http, "http");
|
|
3047
|
+
exports2.http = http;
|
|
3048
|
+
function timer(options) {
|
|
3049
|
+
return addTriggerBindingName(Object.assign(Object.assign({}, options), { type: "timerTrigger" }));
|
|
3050
|
+
}
|
|
3051
|
+
__name(timer, "timer");
|
|
3052
|
+
exports2.timer = timer;
|
|
3053
|
+
function storageBlob(options) {
|
|
3054
|
+
return addTriggerBindingName(Object.assign(Object.assign({}, options), { type: "blobTrigger" }));
|
|
3055
|
+
}
|
|
3056
|
+
__name(storageBlob, "storageBlob");
|
|
3057
|
+
exports2.storageBlob = storageBlob;
|
|
3058
|
+
function storageQueue(options) {
|
|
3059
|
+
return addTriggerBindingName(Object.assign(Object.assign({}, options), { type: "queueTrigger" }));
|
|
3060
|
+
}
|
|
3061
|
+
__name(storageQueue, "storageQueue");
|
|
3062
|
+
exports2.storageQueue = storageQueue;
|
|
3063
|
+
function serviceBusQueue(options) {
|
|
3064
|
+
return addTriggerBindingName(Object.assign(Object.assign({}, options), { type: "serviceBusTrigger" }));
|
|
3065
|
+
}
|
|
3066
|
+
__name(serviceBusQueue, "serviceBusQueue");
|
|
3067
|
+
exports2.serviceBusQueue = serviceBusQueue;
|
|
3068
|
+
function serviceBusTopic(options) {
|
|
3069
|
+
return addTriggerBindingName(Object.assign(Object.assign({}, options), { type: "serviceBusTrigger" }));
|
|
3070
|
+
}
|
|
3071
|
+
__name(serviceBusTopic, "serviceBusTopic");
|
|
3072
|
+
exports2.serviceBusTopic = serviceBusTopic;
|
|
3073
|
+
function eventHub(options) {
|
|
3074
|
+
return addTriggerBindingName(Object.assign(Object.assign({}, options), { type: "eventHubTrigger" }));
|
|
3075
|
+
}
|
|
3076
|
+
__name(eventHub, "eventHub");
|
|
3077
|
+
exports2.eventHub = eventHub;
|
|
3078
|
+
function eventGrid(options) {
|
|
3079
|
+
return addTriggerBindingName(Object.assign(Object.assign({}, options), { type: "eventGridTrigger" }));
|
|
3080
|
+
}
|
|
3081
|
+
__name(eventGrid, "eventGrid");
|
|
3082
|
+
exports2.eventGrid = eventGrid;
|
|
3083
|
+
function cosmosDB(options) {
|
|
3084
|
+
return addTriggerBindingName(Object.assign(Object.assign({}, options), { type: "cosmosDBTrigger" }));
|
|
3085
|
+
}
|
|
3086
|
+
__name(cosmosDB, "cosmosDB");
|
|
3087
|
+
exports2.cosmosDB = cosmosDB;
|
|
3088
|
+
function warmup(options) {
|
|
3089
|
+
return addTriggerBindingName(Object.assign(Object.assign({}, options), { type: "warmupTrigger" }));
|
|
3090
|
+
}
|
|
3091
|
+
__name(warmup, "warmup");
|
|
3092
|
+
exports2.warmup = warmup;
|
|
3093
|
+
function sql(options) {
|
|
3094
|
+
return addTriggerBindingName(Object.assign(Object.assign({}, options), { type: "sqlTrigger" }));
|
|
3095
|
+
}
|
|
3096
|
+
__name(sql, "sql");
|
|
3097
|
+
exports2.sql = sql;
|
|
3098
|
+
function mySql(options) {
|
|
3099
|
+
return addTriggerBindingName(Object.assign(Object.assign({}, options), { type: "mysqlTrigger" }));
|
|
3100
|
+
}
|
|
3101
|
+
__name(mySql, "mySql");
|
|
3102
|
+
exports2.mySql = mySql;
|
|
3103
|
+
function webPubSub(options) {
|
|
3104
|
+
return addTriggerBindingName(Object.assign(Object.assign({}, options), { type: "webPubSubTrigger" }));
|
|
3105
|
+
}
|
|
3106
|
+
__name(webPubSub, "webPubSub");
|
|
3107
|
+
exports2.webPubSub = webPubSub;
|
|
3108
|
+
function mcpTool(options) {
|
|
3109
|
+
return addTriggerBindingName(Object.assign(Object.assign({}, (0, toMcpToolTriggerOptionsToRpc_1.converToMcpToolTriggerOptionsToRpc)(options)), { type: "mcpToolTrigger" }));
|
|
3110
|
+
}
|
|
3111
|
+
__name(mcpTool, "mcpTool");
|
|
3112
|
+
exports2.mcpTool = mcpTool;
|
|
3113
|
+
function mcpResource(options) {
|
|
3114
|
+
return addTriggerBindingName(Object.assign(Object.assign({}, (0, toMcpResourceTriggerOptionsToRpc_1.convertToMcpResourceTriggerOptionsToRpc)(options)), { type: "mcpResourceTrigger" }));
|
|
3115
|
+
}
|
|
3116
|
+
__name(mcpResource, "mcpResource");
|
|
3117
|
+
exports2.mcpResource = mcpResource;
|
|
3118
|
+
function generic(options) {
|
|
3119
|
+
return addTriggerBindingName(options);
|
|
3120
|
+
}
|
|
3121
|
+
__name(generic, "generic");
|
|
3122
|
+
exports2.generic = generic;
|
|
3123
|
+
function addTriggerBindingName(binding) {
|
|
3124
|
+
return (0, addBindingName_1.addBindingName)(binding, "Trigger");
|
|
3125
|
+
}
|
|
3126
|
+
__name(addTriggerBindingName, "addTriggerBindingName");
|
|
3127
|
+
},
|
|
3128
|
+
/***/
|
|
3129
|
+
"./src/utils/Disposable.ts"(__unused_webpack_module, exports2) {
|
|
3130
|
+
var __classPrivateFieldSet = this && this.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
|
|
3131
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3132
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
3133
|
+
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");
|
|
3134
|
+
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
3135
|
+
};
|
|
3136
|
+
var __classPrivateFieldGet = this && this.__classPrivateFieldGet || function(receiver, state, kind, f) {
|
|
3137
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3138
|
+
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");
|
|
3139
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
3140
|
+
};
|
|
3141
|
+
var _Disposable_callOnDispose;
|
|
3142
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3143
|
+
exports2.Disposable = void 0;
|
|
3144
|
+
class Disposable {
|
|
3145
|
+
static {
|
|
3146
|
+
__name(this, "Disposable");
|
|
3147
|
+
}
|
|
3148
|
+
static from(...inDisposables) {
|
|
3149
|
+
let disposables = inDisposables;
|
|
3150
|
+
return new Disposable(function() {
|
|
3151
|
+
if (disposables) {
|
|
3152
|
+
for (const disposable of disposables) {
|
|
3153
|
+
if (disposable && typeof disposable.dispose === "function") {
|
|
3154
|
+
disposable.dispose();
|
|
3155
|
+
}
|
|
3156
|
+
}
|
|
3157
|
+
disposables = void 0;
|
|
3158
|
+
}
|
|
3159
|
+
});
|
|
3160
|
+
}
|
|
3161
|
+
constructor(callOnDispose) {
|
|
3162
|
+
_Disposable_callOnDispose.set(this, void 0);
|
|
3163
|
+
__classPrivateFieldSet(this, _Disposable_callOnDispose, callOnDispose, "f");
|
|
3164
|
+
}
|
|
3165
|
+
dispose() {
|
|
3166
|
+
if (typeof __classPrivateFieldGet(this, _Disposable_callOnDispose, "f") === "function") {
|
|
3167
|
+
__classPrivateFieldGet(this, _Disposable_callOnDispose, "f").call(this);
|
|
3168
|
+
__classPrivateFieldSet(this, _Disposable_callOnDispose, void 0, "f");
|
|
3169
|
+
}
|
|
3170
|
+
}
|
|
3171
|
+
}
|
|
3172
|
+
exports2.Disposable = Disposable;
|
|
3173
|
+
_Disposable_callOnDispose = /* @__PURE__ */ new WeakMap();
|
|
3174
|
+
},
|
|
3175
|
+
/***/
|
|
3176
|
+
"./src/utils/fallbackLogHandler.ts"(__unused_webpack_module, exports2) {
|
|
3177
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3178
|
+
exports2.fallbackLogHandler = void 0;
|
|
3179
|
+
function fallbackLogHandler(level, ...args) {
|
|
3180
|
+
switch (level) {
|
|
3181
|
+
case "trace":
|
|
3182
|
+
console.trace(...args);
|
|
3183
|
+
break;
|
|
3184
|
+
case "debug":
|
|
3185
|
+
console.debug(...args);
|
|
3186
|
+
break;
|
|
3187
|
+
case "information":
|
|
3188
|
+
console.info(...args);
|
|
3189
|
+
break;
|
|
3190
|
+
case "warning":
|
|
3191
|
+
console.warn(...args);
|
|
3192
|
+
break;
|
|
3193
|
+
case "critical":
|
|
3194
|
+
case "error":
|
|
3195
|
+
console.error(...args);
|
|
3196
|
+
break;
|
|
3197
|
+
default:
|
|
3198
|
+
console.log(...args);
|
|
3199
|
+
}
|
|
3200
|
+
}
|
|
3201
|
+
__name(fallbackLogHandler, "fallbackLogHandler");
|
|
3202
|
+
exports2.fallbackLogHandler = fallbackLogHandler;
|
|
3203
|
+
},
|
|
3204
|
+
/***/
|
|
3205
|
+
"./src/utils/getRandomHexString.ts"(__unused_webpack_module, exports2, __webpack_require__2) {
|
|
3206
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3207
|
+
exports2.getStringHash = exports2.getRandomHexString = void 0;
|
|
3208
|
+
const crypto = __webpack_require__2(
|
|
3209
|
+
/*! crypto */
|
|
3210
|
+
"crypto"
|
|
3211
|
+
);
|
|
3212
|
+
function getRandomHexString(length = 10) {
|
|
3213
|
+
const buffer = crypto.randomBytes(Math.ceil(length / 2));
|
|
3214
|
+
return buffer.toString("hex").slice(0, length);
|
|
3215
|
+
}
|
|
3216
|
+
__name(getRandomHexString, "getRandomHexString");
|
|
3217
|
+
exports2.getRandomHexString = getRandomHexString;
|
|
3218
|
+
function getStringHash(data, length = 10) {
|
|
3219
|
+
return crypto.createHash("sha256").update(data).digest("hex").slice(0, length);
|
|
3220
|
+
}
|
|
3221
|
+
__name(getStringHash, "getStringHash");
|
|
3222
|
+
exports2.getStringHash = getStringHash;
|
|
3223
|
+
},
|
|
3224
|
+
/***/
|
|
3225
|
+
"./src/utils/isTrigger.ts"(__unused_webpack_module, exports2) {
|
|
3226
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3227
|
+
exports2.isTimerTrigger = exports2.isHttpTrigger = exports2.isTrigger = void 0;
|
|
3228
|
+
function isTrigger(typeName) {
|
|
3229
|
+
return !!typeName && /trigger$/i.test(typeName);
|
|
3230
|
+
}
|
|
3231
|
+
__name(isTrigger, "isTrigger");
|
|
3232
|
+
exports2.isTrigger = isTrigger;
|
|
3233
|
+
function isHttpTrigger(typeName) {
|
|
3234
|
+
return (typeName === null || typeName === void 0 ? void 0 : typeName.toLowerCase()) === "httptrigger";
|
|
3235
|
+
}
|
|
3236
|
+
__name(isHttpTrigger, "isHttpTrigger");
|
|
3237
|
+
exports2.isHttpTrigger = isHttpTrigger;
|
|
3238
|
+
function isTimerTrigger(typeName) {
|
|
3239
|
+
return (typeName === null || typeName === void 0 ? void 0 : typeName.toLowerCase()) === "timertrigger";
|
|
3240
|
+
}
|
|
3241
|
+
__name(isTimerTrigger, "isTimerTrigger");
|
|
3242
|
+
exports2.isTimerTrigger = isTimerTrigger;
|
|
3243
|
+
},
|
|
3244
|
+
/***/
|
|
3245
|
+
"./src/utils/nonNull.ts"(__unused_webpack_module, exports2, __webpack_require__2) {
|
|
3246
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3247
|
+
exports2.isDefined = exports2.copyPropIfDefined = exports2.nonNullValue = exports2.nonNullProp = void 0;
|
|
3248
|
+
const errors_1 = __webpack_require__2(
|
|
3249
|
+
/*! ../errors */
|
|
3250
|
+
"./src/errors.ts"
|
|
3251
|
+
);
|
|
3252
|
+
function nonNullProp(source, name) {
|
|
3253
|
+
const value = source[name];
|
|
3254
|
+
return nonNullValue(value, name);
|
|
3255
|
+
}
|
|
3256
|
+
__name(nonNullProp, "nonNullProp");
|
|
3257
|
+
exports2.nonNullProp = nonNullProp;
|
|
3258
|
+
function nonNullValue(value, propertyNameOrMessage) {
|
|
3259
|
+
if (value === null || value === void 0) {
|
|
3260
|
+
throw new errors_1.AzFuncSystemError("Internal error: Expected value to be neither null nor undefined" + (propertyNameOrMessage ? `: ${propertyNameOrMessage}` : ""));
|
|
3261
|
+
}
|
|
3262
|
+
return value;
|
|
3263
|
+
}
|
|
3264
|
+
__name(nonNullValue, "nonNullValue");
|
|
3265
|
+
exports2.nonNullValue = nonNullValue;
|
|
3266
|
+
function copyPropIfDefined(source, destination, key) {
|
|
3267
|
+
if (source[key] !== null && source[key] !== void 0) {
|
|
3268
|
+
destination[key] = source[key];
|
|
3269
|
+
}
|
|
3270
|
+
}
|
|
3271
|
+
__name(copyPropIfDefined, "copyPropIfDefined");
|
|
3272
|
+
exports2.copyPropIfDefined = copyPropIfDefined;
|
|
3273
|
+
function isDefined(data) {
|
|
3274
|
+
return data !== null && data !== void 0;
|
|
3275
|
+
}
|
|
3276
|
+
__name(isDefined, "isDefined");
|
|
3277
|
+
exports2.isDefined = isDefined;
|
|
3278
|
+
},
|
|
3279
|
+
/***/
|
|
3280
|
+
"./src/utils/toolProperties.ts"(__unused_webpack_module, exports2) {
|
|
3281
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3282
|
+
exports2.normalizeToolProperties = exports2.isToolProperties = exports2.convertToolProperties = exports2.arg = exports2.ToolPropertyBuilder = void 0;
|
|
3283
|
+
class ToolPropertyBuilder {
|
|
3284
|
+
static {
|
|
3285
|
+
__name(this, "ToolPropertyBuilder");
|
|
3286
|
+
}
|
|
3287
|
+
constructor() {
|
|
3288
|
+
this.property = {};
|
|
3289
|
+
}
|
|
3290
|
+
// Implement McpToolProperty interface with getters
|
|
3291
|
+
get propertyName() {
|
|
3292
|
+
return this.property.propertyName || "";
|
|
3293
|
+
}
|
|
3294
|
+
get propertyType() {
|
|
3295
|
+
if (!this.property.propertyType) {
|
|
3296
|
+
throw new Error("Property type must be specified (use .string(), .number(), etc.)");
|
|
3297
|
+
}
|
|
3298
|
+
return this.property.propertyType;
|
|
3299
|
+
}
|
|
3300
|
+
get description() {
|
|
3301
|
+
return this.property.description || "";
|
|
3302
|
+
}
|
|
3303
|
+
get isRequired() {
|
|
3304
|
+
var _a;
|
|
3305
|
+
return (_a = this.property.isRequired) !== null && _a !== void 0 ? _a : true;
|
|
3306
|
+
}
|
|
3307
|
+
get isArray() {
|
|
3308
|
+
var _a;
|
|
3309
|
+
return (_a = this.property.isArray) !== null && _a !== void 0 ? _a : false;
|
|
3310
|
+
}
|
|
3311
|
+
/**
|
|
3312
|
+
* Set the property type to string
|
|
3313
|
+
*/
|
|
3314
|
+
string() {
|
|
3315
|
+
this.property.propertyType = "string";
|
|
3316
|
+
return this;
|
|
3317
|
+
}
|
|
3318
|
+
/**
|
|
3319
|
+
* Set the property type to double
|
|
3320
|
+
*/
|
|
3321
|
+
double() {
|
|
3322
|
+
this.property.propertyType = "number";
|
|
3323
|
+
return this;
|
|
3324
|
+
}
|
|
3325
|
+
/**
|
|
3326
|
+
* Set the property type to long
|
|
3327
|
+
*/
|
|
3328
|
+
long() {
|
|
3329
|
+
this.property.propertyType = "number";
|
|
3330
|
+
return this;
|
|
3331
|
+
}
|
|
3332
|
+
/**
|
|
3333
|
+
* Set the property type to number
|
|
3334
|
+
*/
|
|
3335
|
+
number() {
|
|
3336
|
+
this.property.propertyType = "number";
|
|
3337
|
+
return this;
|
|
3338
|
+
}
|
|
3339
|
+
/**
|
|
3340
|
+
* Set the property type to boolean
|
|
3341
|
+
*/
|
|
3342
|
+
boolean() {
|
|
3343
|
+
this.property.propertyType = "boolean";
|
|
3344
|
+
return this;
|
|
3345
|
+
}
|
|
3346
|
+
/**
|
|
3347
|
+
* Set the property type to object
|
|
3348
|
+
*/
|
|
3349
|
+
object() {
|
|
3350
|
+
this.property.propertyType = "object";
|
|
3351
|
+
return this;
|
|
3352
|
+
}
|
|
3353
|
+
/**
|
|
3354
|
+
* Set the property type to long
|
|
3355
|
+
*/
|
|
3356
|
+
integer() {
|
|
3357
|
+
this.property.propertyType = "integer";
|
|
3358
|
+
return this;
|
|
3359
|
+
}
|
|
3360
|
+
/**
|
|
3361
|
+
* Set the property type to long
|
|
3362
|
+
*/
|
|
3363
|
+
datetime() {
|
|
3364
|
+
this.property.propertyType = "string";
|
|
3365
|
+
return this;
|
|
3366
|
+
}
|
|
3367
|
+
/**
|
|
3368
|
+
* Set the description for the property
|
|
3369
|
+
* @param description - Description of the property's purpose
|
|
3370
|
+
*/
|
|
3371
|
+
describe(description) {
|
|
3372
|
+
this.property.description = description;
|
|
3373
|
+
return this;
|
|
3374
|
+
}
|
|
3375
|
+
/**
|
|
3376
|
+
* Mark the property as optional
|
|
3377
|
+
*/
|
|
3378
|
+
optional() {
|
|
3379
|
+
this.property.isRequired = false;
|
|
3380
|
+
return this;
|
|
3381
|
+
}
|
|
3382
|
+
/**
|
|
3383
|
+
* Mark the property as an array type
|
|
3384
|
+
*/
|
|
3385
|
+
asArray() {
|
|
3386
|
+
this.property.isArray = true;
|
|
3387
|
+
return this;
|
|
3388
|
+
}
|
|
3389
|
+
}
|
|
3390
|
+
exports2.ToolPropertyBuilder = ToolPropertyBuilder;
|
|
3391
|
+
exports2.arg = {
|
|
3392
|
+
/**
|
|
3393
|
+
* Start building a string property
|
|
3394
|
+
*/
|
|
3395
|
+
string() {
|
|
3396
|
+
return new ToolPropertyBuilder().string();
|
|
3397
|
+
},
|
|
3398
|
+
/**
|
|
3399
|
+
* Start building a number property
|
|
3400
|
+
*/
|
|
3401
|
+
integer() {
|
|
3402
|
+
return new ToolPropertyBuilder().integer();
|
|
3403
|
+
},
|
|
3404
|
+
/**
|
|
3405
|
+
* Start building a number property
|
|
3406
|
+
*/
|
|
3407
|
+
number() {
|
|
3408
|
+
return new ToolPropertyBuilder().number();
|
|
3409
|
+
},
|
|
3410
|
+
/**
|
|
3411
|
+
* Start building a long property
|
|
3412
|
+
*/
|
|
3413
|
+
long() {
|
|
3414
|
+
return new ToolPropertyBuilder().long();
|
|
3415
|
+
},
|
|
3416
|
+
/**
|
|
3417
|
+
* Start building a double property
|
|
3418
|
+
*/
|
|
3419
|
+
double() {
|
|
3420
|
+
return new ToolPropertyBuilder().double();
|
|
3421
|
+
},
|
|
3422
|
+
/**
|
|
3423
|
+
* Start building a boolean property
|
|
3424
|
+
*/
|
|
3425
|
+
boolean() {
|
|
3426
|
+
return new ToolPropertyBuilder().boolean();
|
|
3427
|
+
},
|
|
3428
|
+
/**
|
|
3429
|
+
* Start building a datetime property
|
|
3430
|
+
*/
|
|
3431
|
+
datetime() {
|
|
3432
|
+
return new ToolPropertyBuilder().datetime();
|
|
3433
|
+
},
|
|
3434
|
+
/**
|
|
3435
|
+
* Start building an object property
|
|
3436
|
+
*/
|
|
3437
|
+
object() {
|
|
3438
|
+
return new ToolPropertyBuilder().object();
|
|
3439
|
+
}
|
|
3440
|
+
};
|
|
3441
|
+
function convertToolProperties(args) {
|
|
3442
|
+
return Object.entries(args).map(([propertyName, property]) => {
|
|
3443
|
+
var _a, _b;
|
|
3444
|
+
return {
|
|
3445
|
+
propertyName,
|
|
3446
|
+
propertyType: property.propertyType,
|
|
3447
|
+
description: property.description || "",
|
|
3448
|
+
isRequired: (_a = property.isRequired) !== null && _a !== void 0 ? _a : true,
|
|
3449
|
+
isArray: (_b = property.isArray) !== null && _b !== void 0 ? _b : false
|
|
3450
|
+
// Default to false
|
|
3451
|
+
};
|
|
3452
|
+
});
|
|
3453
|
+
}
|
|
3454
|
+
__name(convertToolProperties, "convertToolProperties");
|
|
3455
|
+
exports2.convertToolProperties = convertToolProperties;
|
|
3456
|
+
function isToolProperties(properties) {
|
|
3457
|
+
return typeof properties === "object" && properties !== null && !Array.isArray(properties) && Object.values(properties).every((prop) => typeof prop === "object" && prop !== null && "propertyType" in prop && "description" in prop && "isRequired" in prop && "isArray" in prop);
|
|
3458
|
+
}
|
|
3459
|
+
__name(isToolProperties, "isToolProperties");
|
|
3460
|
+
exports2.isToolProperties = isToolProperties;
|
|
3461
|
+
function validateToolProperty(property, propertyName) {
|
|
3462
|
+
const nameContext = propertyName ? ` for property '${propertyName}'` : "";
|
|
3463
|
+
if (!property.propertyType || property.propertyType.trim() === "") {
|
|
3464
|
+
throw new Error(`Property type is required${nameContext}`);
|
|
3465
|
+
}
|
|
3466
|
+
if (property.description === void 0 || property.description === null) {
|
|
3467
|
+
property.description = "";
|
|
3468
|
+
}
|
|
3469
|
+
}
|
|
3470
|
+
__name(validateToolProperty, "validateToolProperty");
|
|
3471
|
+
function normalizeToolProperties(properties) {
|
|
3472
|
+
if (!properties) {
|
|
3473
|
+
return void 0;
|
|
3474
|
+
}
|
|
3475
|
+
if (Array.isArray(properties)) {
|
|
3476
|
+
properties.forEach((property, index) => {
|
|
3477
|
+
validateToolProperty(property, property.propertyName || `index ${index}`);
|
|
3478
|
+
});
|
|
3479
|
+
return properties;
|
|
3480
|
+
}
|
|
3481
|
+
if (isToolProperties(properties)) {
|
|
3482
|
+
const converted = convertToolProperties(properties);
|
|
3483
|
+
return converted;
|
|
3484
|
+
}
|
|
3485
|
+
throw new Error("Invalid tool properties format");
|
|
3486
|
+
}
|
|
3487
|
+
__name(normalizeToolProperties, "normalizeToolProperties");
|
|
3488
|
+
exports2.normalizeToolProperties = normalizeToolProperties;
|
|
3489
|
+
},
|
|
3490
|
+
/***/
|
|
3491
|
+
"./src/utils/tryGetCoreApiLazy.ts"(__unused_webpack_module, exports2, __webpack_require__2) {
|
|
3492
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3493
|
+
exports2.tryGetCoreApiLazy = void 0;
|
|
3494
|
+
let coreApi;
|
|
3495
|
+
function tryGetCoreApiLazy() {
|
|
3496
|
+
if (coreApi === void 0) {
|
|
3497
|
+
try {
|
|
3498
|
+
coreApi = __webpack_require__2(
|
|
3499
|
+
/*! @azure/functions-core */
|
|
3500
|
+
"@azure/functions-core"
|
|
3501
|
+
);
|
|
3502
|
+
} catch (_a) {
|
|
3503
|
+
coreApi = null;
|
|
3504
|
+
}
|
|
3505
|
+
}
|
|
3506
|
+
return coreApi;
|
|
3507
|
+
}
|
|
3508
|
+
__name(tryGetCoreApiLazy, "tryGetCoreApiLazy");
|
|
3509
|
+
exports2.tryGetCoreApiLazy = tryGetCoreApiLazy;
|
|
3510
|
+
},
|
|
3511
|
+
/***/
|
|
3512
|
+
"./src/utils/workerSystemLog.ts"(__unused_webpack_module, exports2, __webpack_require__2) {
|
|
3513
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3514
|
+
exports2.workerSystemLog = void 0;
|
|
3515
|
+
const util_1 = __webpack_require__2(
|
|
3516
|
+
/*! util */
|
|
3517
|
+
"util"
|
|
3518
|
+
);
|
|
3519
|
+
const fallbackLogHandler_1 = __webpack_require__2(
|
|
3520
|
+
/*! ./fallbackLogHandler */
|
|
3521
|
+
"./src/utils/fallbackLogHandler.ts"
|
|
3522
|
+
);
|
|
3523
|
+
const tryGetCoreApiLazy_1 = __webpack_require__2(
|
|
3524
|
+
/*! ./tryGetCoreApiLazy */
|
|
3525
|
+
"./src/utils/tryGetCoreApiLazy.ts"
|
|
3526
|
+
);
|
|
3527
|
+
function workerSystemLog(level, ...args) {
|
|
3528
|
+
const coreApi = (0, tryGetCoreApiLazy_1.tryGetCoreApiLazy)();
|
|
3529
|
+
if (coreApi && coreApi.log) {
|
|
3530
|
+
coreApi.log(level, "system", (0, util_1.format)(...args));
|
|
3531
|
+
} else {
|
|
3532
|
+
(0, fallbackLogHandler_1.fallbackLogHandler)(level, ...args);
|
|
3533
|
+
}
|
|
3534
|
+
}
|
|
3535
|
+
__name(workerSystemLog, "workerSystemLog");
|
|
3536
|
+
exports2.workerSystemLog = workerSystemLog;
|
|
3537
|
+
},
|
|
3538
|
+
/***/
|
|
3539
|
+
"@azure/functions-core"(module2) {
|
|
3540
|
+
module2.exports = __require("@azure/functions-core");
|
|
3541
|
+
},
|
|
3542
|
+
/***/
|
|
3543
|
+
"@azure/functions-extensions-base"(module2) {
|
|
3544
|
+
module2.exports = require_azure_functions_extensions_base();
|
|
3545
|
+
},
|
|
3546
|
+
/***/
|
|
3547
|
+
"cookie"(module2) {
|
|
3548
|
+
module2.exports = require_cookie();
|
|
3549
|
+
},
|
|
3550
|
+
/***/
|
|
3551
|
+
"crypto"(module2) {
|
|
3552
|
+
module2.exports = __require("crypto");
|
|
3553
|
+
},
|
|
3554
|
+
/***/
|
|
3555
|
+
"events"(module2) {
|
|
3556
|
+
module2.exports = __require("events");
|
|
3557
|
+
},
|
|
3558
|
+
/***/
|
|
3559
|
+
"http"(module2) {
|
|
3560
|
+
module2.exports = __require("http");
|
|
3561
|
+
},
|
|
3562
|
+
/***/
|
|
3563
|
+
"net"(module2) {
|
|
3564
|
+
module2.exports = __require("net");
|
|
3565
|
+
},
|
|
3566
|
+
/***/
|
|
3567
|
+
"url"(module2) {
|
|
3568
|
+
module2.exports = __require("url");
|
|
3569
|
+
},
|
|
3570
|
+
/***/
|
|
3571
|
+
"util"(module2) {
|
|
3572
|
+
module2.exports = __require("util");
|
|
3573
|
+
}
|
|
3574
|
+
/******/
|
|
3575
|
+
};
|
|
3576
|
+
var __webpack_module_cache__ = {};
|
|
3577
|
+
function __webpack_require__(moduleId) {
|
|
3578
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
3579
|
+
if (cachedModule !== void 0) {
|
|
3580
|
+
return cachedModule.exports;
|
|
3581
|
+
}
|
|
3582
|
+
if (__webpack_modules__[moduleId] === void 0) {
|
|
3583
|
+
var e = new Error("Cannot find module '" + moduleId + "'");
|
|
3584
|
+
e.code = "MODULE_NOT_FOUND";
|
|
3585
|
+
throw e;
|
|
3586
|
+
}
|
|
3587
|
+
var module2 = __webpack_module_cache__[moduleId] = {
|
|
3588
|
+
/******/
|
|
3589
|
+
// no module.id needed
|
|
3590
|
+
/******/
|
|
3591
|
+
// no module.loaded needed
|
|
3592
|
+
/******/
|
|
3593
|
+
exports: {}
|
|
3594
|
+
/******/
|
|
3595
|
+
};
|
|
3596
|
+
__webpack_modules__[moduleId].call(module2.exports, module2, module2.exports, __webpack_require__);
|
|
3597
|
+
return module2.exports;
|
|
3598
|
+
}
|
|
3599
|
+
__name(__webpack_require__, "__webpack_require__");
|
|
3600
|
+
var __webpack_exports__ = __webpack_require__("./src/index.ts");
|
|
3601
|
+
module.exports = __webpack_exports__;
|
|
3602
|
+
})();
|
|
3603
|
+
}
|
|
3604
|
+
});
|
|
3605
|
+
|
|
3606
|
+
// src/trigger.ts
|
|
3607
|
+
init_cjs_shim();
|
|
3608
|
+
var import_functions = __toESM(require_azure_functions(), 1);
|
|
3609
|
+
var getAuthLevel = /* @__PURE__ */ __name((level) => {
|
|
3610
|
+
switch (level) {
|
|
3611
|
+
case "function":
|
|
3612
|
+
return "function";
|
|
3613
|
+
case "admin":
|
|
3614
|
+
return "admin";
|
|
3615
|
+
case "anonymous":
|
|
3616
|
+
return "anonymous";
|
|
3617
|
+
}
|
|
3618
|
+
return "anonymous";
|
|
3619
|
+
}, "getAuthLevel");
|
|
3620
|
+
import_functions.app.http("server", {
|
|
3621
|
+
handler,
|
|
3622
|
+
authLevel: getAuthLevel(process.env.SERVER_AUTH_LEVEL),
|
|
3623
|
+
route: "{*url}",
|
|
3624
|
+
methods: ["DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT"]
|
|
3625
|
+
});
|
|
256
3626
|
/*! Bundled license information:
|
|
257
3627
|
|
|
258
3628
|
cookie/index.js:
|
|
@@ -262,4 +3632,5 @@ cookie/index.js:
|
|
|
262
3632
|
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
263
3633
|
* MIT Licensed
|
|
264
3634
|
*)
|
|
265
|
-
|
|
3635
|
+
*/
|
|
3636
|
+
//# sourceMappingURL=trigger.js.map
|