@temporary-name/server 1.9.3-alpha.f9f5ce625d5edee78250b87b3a64f1d9760c2244 → 1.9.3-alpha.fb7e3a67f82deaeffad5063e136b2f3c03c4b5b3

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.
Files changed (46) hide show
  1. package/dist/adapters/aws-lambda/index.d.mts +5 -6
  2. package/dist/adapters/aws-lambda/index.d.ts +5 -6
  3. package/dist/adapters/aws-lambda/index.mjs +5 -6
  4. package/dist/adapters/fetch/index.d.mts +8 -85
  5. package/dist/adapters/fetch/index.d.ts +8 -85
  6. package/dist/adapters/fetch/index.mjs +17 -157
  7. package/dist/adapters/node/index.d.mts +9 -63
  8. package/dist/adapters/node/index.d.ts +9 -63
  9. package/dist/adapters/node/index.mjs +15 -122
  10. package/dist/handler/index.d.mts +28 -0
  11. package/dist/handler/index.d.ts +28 -0
  12. package/dist/handler/index.mjs +8 -0
  13. package/dist/helpers/index.mjs +3 -29
  14. package/dist/index.d.mts +356 -206
  15. package/dist/index.d.ts +356 -206
  16. package/dist/index.mjs +466 -163
  17. package/dist/openapi/index.d.mts +18 -53
  18. package/dist/openapi/index.d.ts +18 -53
  19. package/dist/openapi/index.mjs +391 -368
  20. package/dist/shared/server.-tR-4rQ5.mjs +523 -0
  21. package/dist/shared/server.BwcJq6aP.d.mts +808 -0
  22. package/dist/shared/server.BwcJq6aP.d.ts +808 -0
  23. package/dist/shared/server.C1RJffw4.mjs +30 -0
  24. package/dist/shared/server.CjPiuQYH.d.mts +51 -0
  25. package/dist/shared/server.CjPiuQYH.d.ts +51 -0
  26. package/dist/shared/server.D2NXNHIf.mjs +156 -0
  27. package/dist/shared/server.Deg5phAY.d.ts +39 -0
  28. package/dist/shared/server.DvgWQUGK.mjs +496 -0
  29. package/dist/shared/server.hAH-LVh_.d.mts +39 -0
  30. package/dist/shared/server.n1y5fcVQ.mjs +315 -0
  31. package/package.json +13 -31
  32. package/dist/adapters/standard/index.d.mts +0 -30
  33. package/dist/adapters/standard/index.d.ts +0 -30
  34. package/dist/adapters/standard/index.mjs +0 -9
  35. package/dist/plugins/index.d.mts +0 -84
  36. package/dist/plugins/index.d.ts +0 -84
  37. package/dist/plugins/index.mjs +0 -122
  38. package/dist/shared/server.7aL9gcoU.d.mts +0 -23
  39. package/dist/shared/server.BL2R5jcp.d.mts +0 -228
  40. package/dist/shared/server.BL2R5jcp.d.ts +0 -228
  41. package/dist/shared/server.CVBLzkro.mjs +0 -255
  42. package/dist/shared/server.ClhVCxfg.mjs +0 -413
  43. package/dist/shared/server.D6Qs_UcF.d.mts +0 -55
  44. package/dist/shared/server.DFptr1Nz.d.ts +0 -23
  45. package/dist/shared/server.DpoO_ER_.d.ts +0 -55
  46. package/dist/shared/server.JtIZ8YG7.mjs +0 -237
@@ -0,0 +1,496 @@
1
+ import * as z from '@temporary-name/zod';
2
+ import { HTTPMethods } from '@temporary-name/shared';
3
+
4
+ class ValidationError extends Error {
5
+ issues;
6
+ data;
7
+ constructor(options) {
8
+ super("Validation error");
9
+ this.issues = options.issues;
10
+ this.data = options.data;
11
+ }
12
+ }
13
+ class APIError extends Error {
14
+ extra;
15
+ static extraSchema = {};
16
+ static status;
17
+ static type;
18
+ static staticDefaultMessage = void 0;
19
+ constructor(...args) {
20
+ const { message, cause, ...extra } = args[0] ?? {};
21
+ super(message, { cause });
22
+ this.message = message ?? this.constructor.defaultMessage;
23
+ this.extra = extra;
24
+ }
25
+ static get defaultMessage() {
26
+ return this.staticDefaultMessage ?? this.type.split("_").map((word) => word[0]?.toUpperCase() + word.slice(1)).join(" ");
27
+ }
28
+ toJSON() {
29
+ return {
30
+ type: this.constructor.type,
31
+ message: this.message,
32
+ ...this.extra
33
+ };
34
+ }
35
+ }
36
+ class BadRequestError extends APIError {
37
+ static status = 400;
38
+ static type = "bad_request";
39
+ static extraSchema = { code: z.string() };
40
+ }
41
+ class UnauthorizedError extends APIError {
42
+ static status = 401;
43
+ static type = "unauthorized";
44
+ }
45
+ class ForbiddenError extends APIError {
46
+ static status = 403;
47
+ static type = "forbidden";
48
+ }
49
+ class NotFoundError extends APIError {
50
+ static status = 404;
51
+ static type = "not_found";
52
+ }
53
+ class InternalServerError extends APIError {
54
+ static status = 500;
55
+ static type = "internal_server_error";
56
+ }
57
+ const COMMON_ERRORS = {
58
+ BadRequestError,
59
+ UnauthorizedError,
60
+ ForbiddenError,
61
+ NotFoundError,
62
+ MethodNotAllowedError: class MethodNotAllowedError extends APIError {
63
+ static status = 405;
64
+ static type = "method_not_allowed";
65
+ },
66
+ NotAcceptableError: class NotAcceptableError extends APIError {
67
+ static status = 406;
68
+ static type = "not_acceptable";
69
+ },
70
+ RequestTimeoutError: class RequestTimeoutError extends APIError {
71
+ static status = 408;
72
+ static type = "request_timeout";
73
+ },
74
+ ConflictError: class ConflictError extends APIError {
75
+ static status = 409;
76
+ static type = "conflict";
77
+ },
78
+ PreconditionFailedError: class PreconditionFailedError extends APIError {
79
+ static status = 412;
80
+ static type = "precondition_failed";
81
+ },
82
+ ContentTooLargeError: class ContentTooLargeError extends APIError {
83
+ static status = 413;
84
+ static type = "content_too_large";
85
+ },
86
+ UnsupportedMediaTypeError: class UnsupportedMediaTypeError extends APIError {
87
+ static status = 415;
88
+ static type = "unsupported_media_type";
89
+ },
90
+ UnprocessableContentError: class UnprocessableContentError extends APIError {
91
+ static status = 422;
92
+ static type = "unprocessable_content";
93
+ },
94
+ TooManyRequestsError: class TooManyRequestsError extends APIError {
95
+ static status = 429;
96
+ static type = "too_many_requests";
97
+ },
98
+ InternalServerError,
99
+ NotImplementedError: class NotImplementedError extends APIError {
100
+ static status = 501;
101
+ static type = "not_implemented";
102
+ },
103
+ BadGatewayError: class BadGatewayError extends APIError {
104
+ static status = 502;
105
+ static type = "bad_gateway";
106
+ },
107
+ ServiceUnavailableError: class ServiceUnavailableError extends APIError {
108
+ static status = 503;
109
+ static type = "service_unavailable";
110
+ },
111
+ GatewayTimeoutError: class GatewayTimeoutError extends APIError {
112
+ static status = 504;
113
+ static type = "gateway_timeout";
114
+ }
115
+ };
116
+ const DEFAULT_ERRORS_CONFIG = {
117
+ BadRequestError: { extraFields: { code: z.string() } },
118
+ UnauthorizedError: true,
119
+ ForbiddenError: true,
120
+ NotFoundError: true,
121
+ InternalServerError: true
122
+ };
123
+ function makeErrors(config) {
124
+ const configWithDefaults = { ...DEFAULT_ERRORS_CONFIG, ...config };
125
+ const errors = {};
126
+ for (const [key, value] of Object.entries(configWithDefaults)) {
127
+ if (key in COMMON_ERRORS) {
128
+ const errorClass = COMMON_ERRORS[key];
129
+ if (value === true) {
130
+ errors[key] = errorClass;
131
+ } else if (typeof value === "object") {
132
+ if ("extends" in value && value["extends"] !== key) {
133
+ throw new Error(
134
+ `Invalid error config for ${key}: cannot use extends for pre-defined error class. Please us a different name or remove extends.`
135
+ );
136
+ }
137
+ const extraSchema = value.extraFields;
138
+ const childErrorClass = class extends errorClass {
139
+ static extraSchema = { ...errorClass.extraSchema, ...extraSchema };
140
+ };
141
+ Object.defineProperty(childErrorClass, "name", { value: key });
142
+ errors[key] = childErrorClass;
143
+ }
144
+ } else {
145
+ if (typeof value === "boolean") {
146
+ throw new Error(
147
+ `Unknown error class ${key}: custom error classes should be defined as a class, not a boolean`
148
+ );
149
+ }
150
+ if (!("status" in value) || !("type" in value)) {
151
+ throw new Error(
152
+ `Invalid error config for ${key}: custom error classes must have a "status" and "type" property`
153
+ );
154
+ }
155
+ const { status, type, defaultMessage, extraFields } = value;
156
+ const childErrorClass = class extends APIError {
157
+ static status = status;
158
+ static type = type;
159
+ static staticDefaultMessage = defaultMessage;
160
+ static extraSchema = extraFields ?? {};
161
+ };
162
+ Object.defineProperty(childErrorClass, "name", { value: key });
163
+ errors[key] = childErrorClass;
164
+ }
165
+ }
166
+ return errors;
167
+ }
168
+ function isAPIErrorStatus(status) {
169
+ return status < 200 || status >= 400;
170
+ }
171
+ function toAPIError(error) {
172
+ if (error instanceof APIError) {
173
+ return error;
174
+ }
175
+ return new InternalServerError({
176
+ message: error instanceof Error ? error.message : void 0,
177
+ cause: error
178
+ });
179
+ }
180
+ function encodeError(error) {
181
+ return {
182
+ status: error.constructor.status,
183
+ headers: new Headers(),
184
+ body: error.toJSON()
185
+ };
186
+ }
187
+
188
+ function isStartWithMiddlewares(middlewares, compare) {
189
+ if (compare.length > middlewares.length) {
190
+ return false;
191
+ }
192
+ for (let i = 0; i < middlewares.length; i++) {
193
+ if (compare[i] === void 0) {
194
+ return true;
195
+ }
196
+ if (middlewares[i] !== compare[i]) {
197
+ return false;
198
+ }
199
+ }
200
+ return true;
201
+ }
202
+ function mergeMiddlewares(first, second, options) {
203
+ if (options.dedupeLeading && isStartWithMiddlewares(second, first)) {
204
+ return second;
205
+ }
206
+ return [...first, ...second];
207
+ }
208
+ function addMiddleware(middlewares, addition) {
209
+ return [...middlewares, addition];
210
+ }
211
+
212
+ class Contract {
213
+ /**
214
+ * This property holds the defined options.
215
+ */
216
+ "~orpc";
217
+ constructor(def) {
218
+ this["~orpc"] = def;
219
+ }
220
+ }
221
+ class Procedure extends Contract {
222
+ }
223
+ function isProcedure(item) {
224
+ return item instanceof Procedure || // This is so we'll return true for Proxy-wrapped Procedures e.g. as returned by `callable`
225
+ (typeof item === "object" || typeof item === "function") && item !== null && "~orpc" in item && typeof item["~orpc"] === "object" && item["~orpc"] !== null && "route" in item["~orpc"] && "meta" in item["~orpc"] && "middlewares" in item["~orpc"] && "inputValidationIndex" in item["~orpc"] && "outputValidationIndex" in item["~orpc"] && "handler" in item["~orpc"];
226
+ }
227
+
228
+ function mergeRoute(a, b) {
229
+ return { ...a, ...b };
230
+ }
231
+ function prefixRoute(route, prefix) {
232
+ if (!route.path) {
233
+ return route;
234
+ }
235
+ return {
236
+ ...route,
237
+ path: `${prefix}${route.path}`
238
+ };
239
+ }
240
+ function unshiftTagRoute(route, tags) {
241
+ return {
242
+ ...route,
243
+ tags: [...tags, ...route.tags ?? []]
244
+ };
245
+ }
246
+ function mergePrefix(a, b) {
247
+ return a ? `${a}${b}` : b;
248
+ }
249
+ function mergeTags(a, b) {
250
+ return a ? [...a, ...b] : b;
251
+ }
252
+ function enhanceRoute(route, options) {
253
+ let router = route;
254
+ if (options.prefix) {
255
+ router = prefixRoute(router, options.prefix);
256
+ }
257
+ if (options.tags?.length) {
258
+ router = unshiftTagRoute(router, options.tags);
259
+ }
260
+ return router;
261
+ }
262
+
263
+ function getRouter(router, path) {
264
+ let current = router;
265
+ for (let i = 0; i < path.length; i++) {
266
+ const segment = path[i];
267
+ if (!current) {
268
+ return void 0;
269
+ }
270
+ if (isProcedure(current)) {
271
+ return void 0;
272
+ }
273
+ if (!isLazy(current)) {
274
+ current = current[segment];
275
+ continue;
276
+ }
277
+ const lazied = current;
278
+ const rest = path.slice(i);
279
+ return lazyInternal(async () => {
280
+ const unwrapped = await unlazy(lazied);
281
+ const next = getRouter(unwrapped.default, rest);
282
+ return unlazy(next);
283
+ }, getLazyMeta(lazied));
284
+ }
285
+ return current;
286
+ }
287
+ function createAccessibleLazyRouter(lazied) {
288
+ const recursive = new Proxy(lazied, {
289
+ get(target, key) {
290
+ if (typeof key !== "string") {
291
+ return Reflect.get(target, key);
292
+ }
293
+ const next = getRouter(lazied, [key]);
294
+ return createAccessibleLazyRouter(next);
295
+ }
296
+ });
297
+ return recursive;
298
+ }
299
+ function enhanceRouter(router, options) {
300
+ if (isLazy(router)) {
301
+ const laziedMeta = getLazyMeta(router);
302
+ const enhancedPrefix = laziedMeta?.prefix ? mergePrefix(options.prefix, laziedMeta?.prefix) : options.prefix;
303
+ const enhanced2 = lazyInternal(
304
+ async () => {
305
+ const { default: unlaziedRouter } = await unlazy(router);
306
+ const enhanced3 = enhanceRouter(unlaziedRouter, options);
307
+ return unlazy(enhanced3);
308
+ },
309
+ {
310
+ ...laziedMeta,
311
+ prefix: enhancedPrefix
312
+ }
313
+ );
314
+ const accessible = createAccessibleLazyRouter(enhanced2);
315
+ return accessible;
316
+ }
317
+ if (isProcedure(router)) {
318
+ const newMiddlewares = mergeMiddlewares(options.middlewares, router["~orpc"].middlewares, {
319
+ dedupeLeading: options.dedupeLeadingMiddlewares
320
+ });
321
+ const newMiddlewareAdded = newMiddlewares.length - router["~orpc"].middlewares.length;
322
+ const enhanced2 = new Procedure({
323
+ ...router["~orpc"],
324
+ route: enhanceRoute(router["~orpc"].route, options),
325
+ middlewares: newMiddlewares,
326
+ inputValidationIndex: router["~orpc"].inputValidationIndex + newMiddlewareAdded,
327
+ outputValidationIndex: router["~orpc"].outputValidationIndex + newMiddlewareAdded
328
+ });
329
+ return enhanced2;
330
+ }
331
+ const enhanced = {};
332
+ for (const key in router) {
333
+ enhanced[key] = enhanceRouter(router[key], options);
334
+ }
335
+ return enhanced;
336
+ }
337
+ function traverseContractProcedures(options, callback, lazyOptions = []) {
338
+ const currentRouter = options.router;
339
+ if (isLazy(currentRouter)) {
340
+ lazyOptions.push({
341
+ router: currentRouter,
342
+ path: options.path
343
+ });
344
+ } else if (currentRouter instanceof Contract) {
345
+ callback({
346
+ contract: currentRouter,
347
+ path: options.path
348
+ });
349
+ } else if (typeof currentRouter === "string") {
350
+ throw new Error("Unexpected: got string instead of router");
351
+ } else {
352
+ for (const key in currentRouter) {
353
+ traverseContractProcedures(
354
+ {
355
+ router: currentRouter[key],
356
+ path: [...options.path, key]
357
+ },
358
+ callback,
359
+ lazyOptions
360
+ );
361
+ }
362
+ }
363
+ return lazyOptions;
364
+ }
365
+ async function resolveContractProcedures(options, callback) {
366
+ const pending = [options];
367
+ for (const options2 of pending) {
368
+ const lazyOptions = traverseContractProcedures(options2, callback);
369
+ for (const options3 of lazyOptions) {
370
+ const { default: router } = await unlazy(options3.router);
371
+ pending.push({
372
+ router,
373
+ path: options3.path
374
+ });
375
+ }
376
+ }
377
+ }
378
+ async function unlazyRouter(router) {
379
+ if (isProcedure(router)) {
380
+ return router;
381
+ }
382
+ const unlazied = {};
383
+ for (const key in router) {
384
+ const item = router[key];
385
+ const { default: unlaziedRouter } = await unlazy(item);
386
+ unlazied[key] = await unlazyRouter(unlaziedRouter);
387
+ }
388
+ return unlazied;
389
+ }
390
+
391
+ const LAZY_SYMBOL = Symbol("ORPC_LAZY_SYMBOL");
392
+ function lazyInternal(loader, meta = {}) {
393
+ return {
394
+ [LAZY_SYMBOL]: {
395
+ loader,
396
+ meta
397
+ }
398
+ };
399
+ }
400
+ function lazy(prefix, loader) {
401
+ return enhanceRouter(lazyInternal(loader), {
402
+ middlewares: [],
403
+ dedupeLeadingMiddlewares: true,
404
+ prefix
405
+ });
406
+ }
407
+ function isLazy(item) {
408
+ return (typeof item === "object" || typeof item === "function") && item !== null && LAZY_SYMBOL in item;
409
+ }
410
+ function getLazyMeta(lazied) {
411
+ return lazied[LAZY_SYMBOL].meta;
412
+ }
413
+ function unlazy(lazied) {
414
+ return isLazy(lazied) ? lazied[LAZY_SYMBOL].loader() : Promise.resolve({ default: lazied });
415
+ }
416
+
417
+ const endpointRegex = new RegExp(`^(${HTTPMethods.join("|")})`);
418
+ function isDevelopment() {
419
+ return process.env.NODE_ENV === "development";
420
+ }
421
+ function standardizeHTTPPath(path) {
422
+ return `/${path.replace(/\/{2,}/g, "/").replace(/^\/|\/$/g, "")}`;
423
+ }
424
+ function getDynamicParams(path) {
425
+ return path ? standardizeHTTPPath(path).match(/\/\{[^}]+\}/g)?.map((v) => ({
426
+ raw: v,
427
+ name: v.match(/\{\+?([^}]+)\}/)[1]
428
+ })) : void 0;
429
+ }
430
+ function parseEndpointDefinition(stringsOrEndpoint, values) {
431
+ let method, path, pathSchema;
432
+ if (stringsOrEndpoint instanceof Array) {
433
+ let endpoint = stringsOrEndpoint[0];
434
+ if (endpoint === void 0 || !endpointRegex.test(endpoint)) {
435
+ throw new Error(".endpoint() must start with a valid HTTP endpoint string.");
436
+ }
437
+ const shape = {};
438
+ for (let i = 1; i < stringsOrEndpoint.length; i++) {
439
+ const str = stringsOrEndpoint[i];
440
+ const value = values[i - 1];
441
+ if (typeof value !== "object" || value instanceof z.core.$ZodType) {
442
+ throw new Error(
443
+ `Each template value for .endpoint must be an object with a single key, whose value is a ZodType.`
444
+ );
445
+ }
446
+ const valueEntries = Object.entries(value);
447
+ if (valueEntries.length !== 1) {
448
+ throw new Error(
449
+ `Each template value for .endpoint must be an object with a single key, whose value is a ZodType.`
450
+ );
451
+ }
452
+ const [key, schema] = valueEntries[0];
453
+ endpoint += `{${key}}${str}`;
454
+ if (key in schema) {
455
+ throw new Error(`Duplicate path parameter name "${key}" in endpoint.`);
456
+ }
457
+ shape[key] = schema;
458
+ }
459
+ [method, path] = endpoint.split(" ", 2);
460
+ pathSchema = z.object(shape);
461
+ } else if (values.length <= 1) {
462
+ const endpoint = stringsOrEndpoint;
463
+ const schema = values[0];
464
+ [method, path] = endpoint.split(" ", 2);
465
+ const pathParamNames = getDynamicParams(path)?.map((p) => p.name) ?? [];
466
+ let schemaKeys;
467
+ if (schema instanceof z.core.$ZodType) {
468
+ if (schema instanceof z.core.$ZodObject) {
469
+ schemaKeys = Object.keys(schema._zod.def.shape);
470
+ pathSchema = schema;
471
+ } else {
472
+ throw new Error(
473
+ `Path schema for endpoint "${endpoint}" must be a ZodObject schema (or object where each value is a ZodType).`
474
+ );
475
+ }
476
+ } else if (typeof schema === "object") {
477
+ schemaKeys = Object.keys(schema);
478
+ pathSchema = z.object(schema);
479
+ } else if (schema !== void 0) {
480
+ throw new Error(
481
+ `Path schema for endpoint "${endpoint}" must be a ZodObject schema (or object where each value is a ZodType).`
482
+ );
483
+ } else {
484
+ schemaKeys = [];
485
+ pathSchema = z.object({});
486
+ }
487
+ if (pathParamNames.length !== schemaKeys.length || !pathParamNames.every((name) => schemaKeys.includes(name))) {
488
+ throw new Error(`Path schema keys do not match dynamic parameters in endpoint "${endpoint}".`);
489
+ }
490
+ } else {
491
+ throw new Error("Invalid arguments for .endpoint() method.");
492
+ }
493
+ return { method, path, pathSchema };
494
+ }
495
+
496
+ export { APIError as A, BadRequestError as B, Contract as C, endpointRegex as D, isDevelopment as E, ForbiddenError as F, InternalServerError as I, LAZY_SYMBOL as L, NotFoundError as N, Procedure as P, UnauthorizedError as U, ValidationError as V, mergeTags as a, enhanceRouter as b, mergeRoute as c, prefixRoute as d, encodeError as e, addMiddleware as f, getDynamicParams as g, getLazyMeta as h, isAPIErrorStatus as i, isProcedure as j, makeErrors as k, lazyInternal as l, mergePrefix as m, lazy as n, isLazy as o, parseEndpointDefinition as p, isStartWithMiddlewares as q, resolveContractProcedures as r, standardizeHTTPPath as s, toAPIError as t, unlazy as u, mergeMiddlewares as v, getRouter as w, createAccessibleLazyRouter as x, traverseContractProcedures as y, unlazyRouter as z };
@@ -0,0 +1,39 @@
1
+ import { HTTPPath, StandardResponse, StandardLazyRequest } from '@temporary-name/shared';
2
+ import { C as Context, m as Router } from './server.BwcJq6aP.mjs';
3
+
4
+ interface StandardHandleOptions<T extends Context> {
5
+ prefix?: HTTPPath;
6
+ context: T;
7
+ }
8
+ type StandardHandleResult = {
9
+ matched: true;
10
+ response: StandardResponse;
11
+ } | {
12
+ matched: false;
13
+ response: undefined;
14
+ };
15
+ declare class StandardHandler<T extends Context> {
16
+ private readonly matcher;
17
+ constructor(router: Router<T>);
18
+ handle(request: StandardLazyRequest, options: StandardHandleOptions<T>): Promise<StandardHandleResult>;
19
+ }
20
+
21
+ type FriendlyStandardHandleOptions<T extends Context> = Omit<StandardHandleOptions<T>, 'context'> & (object extends T ? {
22
+ context?: T;
23
+ } : {
24
+ context: T;
25
+ });
26
+ declare function resolveFriendlyStandardHandleOptions<T extends Context>(options: FriendlyStandardHandleOptions<T>): StandardHandleOptions<T>;
27
+ /**
28
+ * {@link https://github.com/unjs/rou3}
29
+ *
30
+ * @internal
31
+ */
32
+ declare function toRou3Pattern(path: HTTPPath): string;
33
+ /**
34
+ * @internal
35
+ */
36
+ declare function decodeParams(params: Record<string, string>): Record<string, string>;
37
+
38
+ export { StandardHandler as b, decodeParams as d, resolveFriendlyStandardHandleOptions as r, toRou3Pattern as t };
39
+ export type { FriendlyStandardHandleOptions as F, StandardHandleOptions as S, StandardHandleResult as a };