arri 0.0.5 → 0.0.7

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.
@@ -2,6 +2,35 @@
2
2
 
3
3
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
4
4
 
5
+ function getDefaultExportFromCjs (x) {
6
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
7
+ }
8
+
9
+ function getAugmentedNamespace(n) {
10
+ if (n.__esModule) return n;
11
+ var f = n.default;
12
+ if (typeof f == "function") {
13
+ var a = function a () {
14
+ if (this instanceof a) {
15
+ return Reflect.construct(f, arguments, this.constructor);
16
+ }
17
+ return f.apply(this, arguments);
18
+ };
19
+ a.prototype = f.prototype;
20
+ } else a = {};
21
+ Object.defineProperty(a, '__esModule', {value: true});
22
+ Object.keys(n).forEach(function (k) {
23
+ var d = Object.getOwnPropertyDescriptor(n, k);
24
+ Object.defineProperty(a, k, d.get ? d : {
25
+ enumerable: true,
26
+ get: function () {
27
+ return n[k];
28
+ }
29
+ });
30
+ });
31
+ return a;
32
+ }
33
+
5
34
  var typebox = {};
6
35
 
7
36
  (function (exports) {
@@ -285,7 +314,7 @@ var typebox = {};
285
314
  function TConstructor(schema) {
286
315
  // prettier-ignore
287
316
  return (TKindOf(schema, 'Constructor') &&
288
- schema.type === 'constructor' &&
317
+ schema.type === 'Constructor' &&
289
318
  IsOptionalString(schema.$id) &&
290
319
  ValueGuard.IsArray(schema.parameters) &&
291
320
  schema.parameters.every(schema => TSchema(schema)) &&
@@ -308,7 +337,7 @@ var typebox = {};
308
337
  function TFunction(schema) {
309
338
  // prettier-ignore
310
339
  return (TKindOf(schema, 'Function') &&
311
- schema.type === 'function' &&
340
+ schema.type === 'Function' &&
312
341
  IsOptionalString(schema.$id) &&
313
342
  ValueGuard.IsArray(schema.parameters) &&
314
343
  schema.parameters.every(schema => TSchema(schema)) &&
@@ -2277,7 +2306,7 @@ var typebox = {};
2277
2306
  /** `[JavaScript]` Creates a Constructor type */
2278
2307
  Constructor(parameters, returns, options) {
2279
2308
  const [clonedParameters, clonedReturns] = [TypeClone.Rest(parameters), TypeClone.Type(returns)];
2280
- return this.Create({ ...options, [exports.Kind]: 'Constructor', type: 'constructor', parameters: clonedParameters, returns: clonedReturns });
2309
+ return this.Create({ ...options, [exports.Kind]: 'Constructor', type: 'Constructor', parameters: clonedParameters, returns: clonedReturns });
2281
2310
  }
2282
2311
  /** `[JavaScript]` Creates a Date type */
2283
2312
  Date(options = {}) {
@@ -2286,7 +2315,7 @@ var typebox = {};
2286
2315
  /** `[JavaScript]` Creates a Function type */
2287
2316
  Function(parameters, returns, options) {
2288
2317
  const [clonedParameters, clonedReturns] = [TypeClone.Rest(parameters), TypeClone.Type(returns)];
2289
- return this.Create({ ...options, [exports.Kind]: 'Function', type: 'function', parameters: clonedParameters, returns: clonedReturns });
2318
+ return this.Create({ ...options, [exports.Kind]: 'Function', type: 'Function', parameters: clonedParameters, returns: clonedReturns });
2290
2319
  }
2291
2320
  /** `[JavaScript]` Extracts the InstanceType from the given Constructor type */
2292
2321
  InstanceType(schema, options = {}) {
@@ -2343,7 +2372,23 @@ var typebox = {};
2343
2372
  exports.Type = new JavaScriptTypeBuilder();
2344
2373
  } (typebox));
2345
2374
 
2375
+ const HASH_RE = /#/g;
2376
+ const AMPERSAND_RE = /&/g;
2377
+ const EQUAL_RE = /=/g;
2346
2378
  const PLUS_RE = /\+/g;
2379
+ const ENC_CARET_RE = /%5e/gi;
2380
+ const ENC_BACKTICK_RE = /%60/gi;
2381
+ const ENC_PIPE_RE = /%7c/gi;
2382
+ const ENC_SPACE_RE = /%20/gi;
2383
+ function encode(text) {
2384
+ return encodeURI("" + text).replace(ENC_PIPE_RE, "|");
2385
+ }
2386
+ function encodeQueryValue(input) {
2387
+ return encode(typeof input === "string" ? input : JSON.stringify(input)).replace(PLUS_RE, "%2B").replace(ENC_SPACE_RE, "+").replace(HASH_RE, "%23").replace(AMPERSAND_RE, "%26").replace(ENC_BACKTICK_RE, "`").replace(ENC_CARET_RE, "^");
2388
+ }
2389
+ function encodeQueryKey(text) {
2390
+ return encodeQueryValue(text).replace(EQUAL_RE, "%3D");
2391
+ }
2347
2392
  function decode(text = "") {
2348
2393
  try {
2349
2394
  return decodeURIComponent("" + text);
@@ -2383,6 +2428,21 @@ function parseQuery(parametersString = "") {
2383
2428
  }
2384
2429
  return object;
2385
2430
  }
2431
+ function encodeQueryItem(key, value) {
2432
+ if (typeof value === "number" || typeof value === "boolean") {
2433
+ value = String(value);
2434
+ }
2435
+ if (!value) {
2436
+ return encodeQueryKey(key);
2437
+ }
2438
+ if (Array.isArray(value)) {
2439
+ return value.map((_value) => `${encodeQueryKey(key)}=${encodeQueryValue(_value)}`).join("&");
2440
+ }
2441
+ return `${encodeQueryKey(key)}=${encodeQueryValue(value)}`;
2442
+ }
2443
+ function stringifyQuery(query) {
2444
+ return Object.keys(query).filter((k) => query[k] !== void 0).map((k) => encodeQueryItem(k, query[k])).filter(Boolean).join("&");
2445
+ }
2386
2446
  const PROTOCOL_STRICT_REGEX = /^[\s\w\0+.-]{2,}:([/\\]{1,2})/;
2387
2447
  const PROTOCOL_REGEX = /^[\s\w\0+.-]{2,}:([/\\]{2})?/;
2388
2448
  const PROTOCOL_RELATIVE_REGEX = /^([/\\]\s*){2,}[^/\\]/;
@@ -2412,9 +2472,54 @@ function withoutTrailingSlash(input = "", queryParameters = false) {
2412
2472
  const [s0, ...s] = input.split("?");
2413
2473
  return (s0.slice(0, -1) || "/") + (s.length > 0 ? `?${s.join("?")}` : "");
2414
2474
  }
2475
+ function withTrailingSlash(input = "", queryParameters = false) {
2476
+ if (!queryParameters) {
2477
+ return input.endsWith("/") ? input : input + "/";
2478
+ }
2479
+ if (hasTrailingSlash(input, true)) {
2480
+ return input || "/";
2481
+ }
2482
+ const [s0, ...s] = input.split("?");
2483
+ return s0 + "/" + (s.length > 0 ? `?${s.join("?")}` : "");
2484
+ }
2485
+ function withBase(input, base) {
2486
+ if (isEmptyURL(base) || hasProtocol(input)) {
2487
+ return input;
2488
+ }
2489
+ const _base = withoutTrailingSlash(base);
2490
+ if (input.startsWith(_base)) {
2491
+ return input;
2492
+ }
2493
+ return joinURL(_base, input);
2494
+ }
2495
+ function withQuery(input, query) {
2496
+ const parsed = parseURL(input);
2497
+ const mergedQuery = { ...parseQuery(parsed.search), ...query };
2498
+ parsed.search = stringifyQuery(mergedQuery);
2499
+ return stringifyParsedURL(parsed);
2500
+ }
2415
2501
  function getQuery$1(input) {
2416
2502
  return parseQuery(parseURL(input).search);
2417
2503
  }
2504
+ function isEmptyURL(url) {
2505
+ return !url || url === "/";
2506
+ }
2507
+ function isNonEmptyURL(url) {
2508
+ return url && url !== "/";
2509
+ }
2510
+ const JOIN_LEADING_SLASH_RE = /^\.?\//;
2511
+ function joinURL(base, ...input) {
2512
+ let url = base || "";
2513
+ for (const segment of input.filter((url2) => isNonEmptyURL(url2))) {
2514
+ if (url) {
2515
+ const _segment = segment.replace(JOIN_LEADING_SLASH_RE, "");
2516
+ url = withTrailingSlash(url) + _segment;
2517
+ } else {
2518
+ url = segment;
2519
+ }
2520
+ }
2521
+ return url;
2522
+ }
2418
2523
 
2419
2524
  function parseURL(input = "", defaultProto) {
2420
2525
  const _specialProtoMatch = input.match(
@@ -2457,6 +2562,15 @@ function parsePath(input = "") {
2457
2562
  hash
2458
2563
  };
2459
2564
  }
2565
+ function stringifyParsedURL(parsed) {
2566
+ const pathname = parsed.pathname || "";
2567
+ const search = parsed.search ? (parsed.search.startsWith("?") ? "" : "?") + parsed.search : "";
2568
+ const hash = parsed.hash || "";
2569
+ const auth = parsed.auth ? parsed.auth + "@" : "";
2570
+ const host = parsed.host || "";
2571
+ const proto = parsed.protocol ? parsed.protocol + "//" : "";
2572
+ return proto + auth + host + pathname + search + hash;
2573
+ }
2460
2574
 
2461
2575
  const NODE_TYPES = {
2462
2576
  NORMAL: 0,
@@ -2739,12 +2853,29 @@ function destr(value, options = {}) {
2739
2853
  }
2740
2854
  }
2741
2855
 
2856
+ function hasProp(obj, prop) {
2857
+ try {
2858
+ return prop in obj;
2859
+ } catch {
2860
+ return false;
2861
+ }
2862
+ }
2863
+
2864
+ var __defProp$1 = Object.defineProperty;
2865
+ var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2866
+ var __publicField$1 = (obj, key, value) => {
2867
+ __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
2868
+ return value;
2869
+ };
2742
2870
  class H3Error extends Error {
2743
2871
  constructor(message, opts = {}) {
2744
2872
  super(message, opts);
2745
- this.statusCode = 500;
2746
- this.fatal = false;
2747
- this.unhandled = false;
2873
+ __publicField$1(this, "statusCode", 500);
2874
+ __publicField$1(this, "fatal", false);
2875
+ __publicField$1(this, "unhandled", false);
2876
+ __publicField$1(this, "statusMessage");
2877
+ __publicField$1(this, "data");
2878
+ __publicField$1(this, "cause");
2748
2879
  if (opts.cause && !this.cause) {
2749
2880
  this.cause = opts.cause;
2750
2881
  }
@@ -2763,7 +2894,7 @@ class H3Error extends Error {
2763
2894
  return obj;
2764
2895
  }
2765
2896
  }
2766
- H3Error.__h3_error__ = true;
2897
+ __publicField$1(H3Error, "__h3_error__", true);
2767
2898
  function createError(input) {
2768
2899
  if (typeof input === "string") {
2769
2900
  return new H3Error(input);
@@ -2774,7 +2905,7 @@ function createError(input) {
2774
2905
  const err = new H3Error(input.message ?? input.statusMessage ?? "", {
2775
2906
  cause: input.cause || input
2776
2907
  });
2777
- if ("stack" in input) {
2908
+ if (hasProp(input, "stack")) {
2778
2909
  try {
2779
2910
  Object.defineProperty(err, "stack", {
2780
2911
  get() {
@@ -2973,7 +3104,7 @@ function readRawBody(event, encoding = "utf8") {
2973
3104
  }
2974
3105
  async function readBody(event, options = {}) {
2975
3106
  const request = event.node.req;
2976
- if (ParsedBodySymbol in request) {
3107
+ if (hasProp(request, ParsedBodySymbol)) {
2977
3108
  return request[ParsedBodySymbol];
2978
3109
  }
2979
3110
  const contentType = request.headers["content-type"] || "";
@@ -3013,7 +3144,7 @@ function _parseURLEncodedBody(body) {
3013
3144
  const form = new URLSearchParams(body);
3014
3145
  const parsedForm = /* @__PURE__ */ Object.create(null);
3015
3146
  for (const [key, value] of form.entries()) {
3016
- if (key in parsedForm) {
3147
+ if (hasProp(parsedForm, key)) {
3017
3148
  if (!Array.isArray(parsedForm[key])) {
3018
3149
  parsedForm[key] = [parsedForm[key]];
3019
3150
  }
@@ -3175,7 +3306,7 @@ function sendStream(event, stream) {
3175
3306
  event._handled = true;
3176
3307
  return Promise.resolve();
3177
3308
  }
3178
- if ("pipeTo" in stream) {
3309
+ if (hasProp(stream, "pipeTo") && typeof stream.pipeTo === "function") {
3179
3310
  return stream.pipeTo(
3180
3311
  new WritableStream({
3181
3312
  write(chunk) {
@@ -3186,7 +3317,7 @@ function sendStream(event, stream) {
3186
3317
  event.node.res.end();
3187
3318
  });
3188
3319
  }
3189
- if (typeof stream.pipe === "function") {
3320
+ if (hasProp(stream, "pipe") && typeof stream.pipe === "function") {
3190
3321
  return new Promise((resolve, reject) => {
3191
3322
  stream.pipe(event.node.res);
3192
3323
  if (stream.on) {
@@ -3242,6 +3373,90 @@ function isPreflightRequest(event) {
3242
3373
  return event.method === "OPTIONS" && !!origin && !!accessControlRequestMethod;
3243
3374
  }
3244
3375
 
3376
+ var __defProp$2 = Object.defineProperty;
3377
+ var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3378
+ var __publicField$2 = (obj, key, value) => {
3379
+ __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
3380
+ return value;
3381
+ };
3382
+ class H3Event {
3383
+ constructor(req, res) {
3384
+ __publicField$2(this, "__is_event__", true);
3385
+ // Context
3386
+ __publicField$2(this, "node");
3387
+ // Node
3388
+ __publicField$2(this, "web");
3389
+ // Web
3390
+ __publicField$2(this, "context", {});
3391
+ // Shared
3392
+ // Request
3393
+ __publicField$2(this, "_method");
3394
+ __publicField$2(this, "_path");
3395
+ __publicField$2(this, "_headers");
3396
+ __publicField$2(this, "_requestBody");
3397
+ // Response
3398
+ __publicField$2(this, "_handled", false);
3399
+ this.node = { req, res };
3400
+ }
3401
+ // --- Request ---
3402
+ get method() {
3403
+ if (!this._method) {
3404
+ this._method = (this.node.req.method || "GET").toUpperCase();
3405
+ }
3406
+ return this._method;
3407
+ }
3408
+ get path() {
3409
+ return this._path || this.node.req.url || "/";
3410
+ }
3411
+ get headers() {
3412
+ if (!this._headers) {
3413
+ this._headers = _normalizeNodeHeaders(this.node.req.headers);
3414
+ }
3415
+ return this._headers;
3416
+ }
3417
+ // --- Respoonse ---
3418
+ get handled() {
3419
+ return this._handled || this.node.res.writableEnded || this.node.res.headersSent;
3420
+ }
3421
+ respondWith(response) {
3422
+ return Promise.resolve(response).then(
3423
+ (_response) => sendWebResponse(this, _response)
3424
+ );
3425
+ }
3426
+ // --- Utils ---
3427
+ toString() {
3428
+ return `[${this.method}] ${this.path}`;
3429
+ }
3430
+ toJSON() {
3431
+ return this.toString();
3432
+ }
3433
+ // --- Deprecated ---
3434
+ /** @deprecated Please use `event.node.req` instead. **/
3435
+ get req() {
3436
+ return this.node.req;
3437
+ }
3438
+ /** @deprecated Please use `event.node.res` instead. **/
3439
+ get res() {
3440
+ return this.node.res;
3441
+ }
3442
+ }
3443
+ function createEvent(req, res) {
3444
+ return new H3Event(req, res);
3445
+ }
3446
+ function _normalizeNodeHeaders(nodeHeaders) {
3447
+ const headers = new Headers();
3448
+ for (const [name, value] of Object.entries(nodeHeaders)) {
3449
+ if (Array.isArray(value)) {
3450
+ for (const item of value) {
3451
+ headers.append(name, item);
3452
+ }
3453
+ } else if (value) {
3454
+ headers.set(name, value);
3455
+ }
3456
+ }
3457
+ return headers;
3458
+ }
3459
+
3245
3460
  function defineEventHandler(handler) {
3246
3461
  if (typeof handler === "function") {
3247
3462
  return Object.assign(handler, { __is_handler__: true });
@@ -3278,7 +3493,7 @@ async function _callHandler(event, handler, hooks) {
3278
3493
  }
3279
3494
  const eventHandler = defineEventHandler;
3280
3495
  function isEventHandler(input) {
3281
- return "__is_handler__" in input;
3496
+ return hasProp(input, "__is_handler__");
3282
3497
  }
3283
3498
  function toEventHandler(input, _, _route) {
3284
3499
  if (!isEventHandler(input)) {
@@ -3565,6 +3780,30 @@ function createRouter(opts = {}) {
3565
3780
  });
3566
3781
  return router;
3567
3782
  }
3783
+ function toNodeListener(app) {
3784
+ const toNodeHandle = async function(req, res) {
3785
+ const event = createEvent(req, res);
3786
+ try {
3787
+ await app.handler(event);
3788
+ } catch (_error) {
3789
+ const error = createError(_error);
3790
+ if (!isError(_error)) {
3791
+ error.unhandled = true;
3792
+ }
3793
+ if (app.options.onError) {
3794
+ await app.options.onError(error, event);
3795
+ }
3796
+ if (event.handled) {
3797
+ return;
3798
+ }
3799
+ if (error.unhandled || error.fatal) {
3800
+ console.error("[h3]", error.fatal ? "[fatal]" : "[unhandled]", error);
3801
+ }
3802
+ await sendError(event, error, !!app.options.debug);
3803
+ }
3804
+ };
3805
+ return toNodeHandle;
3806
+ }
3568
3807
 
3569
3808
  var value$1 = {};
3570
3809
 
@@ -8055,6 +8294,17 @@ function isProcedureDefinition(input) {
8055
8294
  }
8056
8295
  return isHttpMethod(input.method) && typeof input.path === "string" && (typeof input.params === "string" || typeof input.params === "undefined") && (typeof input.response === "string" || typeof input.response === "undefined");
8057
8296
  }
8297
+ function isServiceDefinition(input) {
8298
+ if (typeof input !== "object") {
8299
+ return false;
8300
+ }
8301
+ for (const key of Object.keys(input)) {
8302
+ if (typeof input[key] !== "object") {
8303
+ return false;
8304
+ }
8305
+ }
8306
+ return true;
8307
+ }
8058
8308
  function unflattenObject(data) {
8059
8309
  if (Object(data) !== data || Array.isArray(data))
8060
8310
  return data;
@@ -8072,6 +8322,9 @@ function unflattenObject(data) {
8072
8322
  }
8073
8323
  return result[""] || result;
8074
8324
  }
8325
+ function unflattenProcedures(procedures) {
8326
+ return unflattenObject(procedures);
8327
+ }
8075
8328
  const removeDisallowedChars = (input, disallowedChars) => {
8076
8329
  let result = input;
8077
8330
  for (const char of disallowedChars) {
@@ -8485,12 +8738,16 @@ exports.ArriServer = ArriServer;
8485
8738
  exports.ErrorResponse = ErrorResponse;
8486
8739
  exports.HttpMethodValues = HttpMethodValues;
8487
8740
  exports.camelCase = camelCase;
8741
+ exports.commonjsGlobal = commonjsGlobal;
8488
8742
  exports.createRpcDefinition = createRpcDefinition;
8489
8743
  exports.defineError = defineError;
8490
8744
  exports.defineMiddleware = defineMiddleware;
8491
8745
  exports.defineRoute = defineRoute;
8492
8746
  exports.defineRpc = defineRpc;
8747
+ exports.destr = destr;
8493
8748
  exports.errorResponseFromValidationErrors = errorResponseFromValidationErrors;
8749
+ exports.getAugmentedNamespace = getAugmentedNamespace;
8750
+ exports.getDefaultExportFromCjs = getDefaultExportFromCjs;
8494
8751
  exports.getRpcParamDefinition = getRpcParamDefinition;
8495
8752
  exports.getRpcParamName = getRpcParamName;
8496
8753
  exports.getRpcPath = getRpcPath;
@@ -8503,7 +8760,16 @@ exports.isJsonSchemaObject = isJsonSchemaObject;
8503
8760
  exports.isJsonSchemaScalarType = isJsonSchemaScalarType;
8504
8761
  exports.isProcedureDefinition = isProcedureDefinition;
8505
8762
  exports.isRpc = isRpc;
8763
+ exports.isServiceDefinition = isServiceDefinition;
8764
+ exports.joinURL = joinURL;
8765
+ exports.kebabCase = kebabCase;
8506
8766
  exports.pascalCase = pascalCase;
8507
8767
  exports.registerRoute = registerRoute;
8508
8768
  exports.registerRpc = registerRpc;
8769
+ exports.removeDisallowedChars = removeDisallowedChars;
8770
+ exports.toNodeListener = toNodeListener;
8771
+ exports.typebox = typebox;
8509
8772
  exports.unflattenObject = unflattenObject;
8773
+ exports.unflattenProcedures = unflattenProcedures;
8774
+ exports.withBase = withBase;
8775
+ exports.withQuery = withQuery;
package/package.json CHANGED
@@ -11,17 +11,18 @@
11
11
  "arri": "./dist/cli.mjs"
12
12
  },
13
13
  "dependencies": {
14
- "@sinclair/typebox": "^0.31.4",
15
- "h3": "^1.8.0",
14
+ "@sinclair/typebox": "^0.31.5",
15
+ "h3": "^1.8.1",
16
16
  "scule": "^1.0.0",
17
17
  "citty": "^0.1.3",
18
+ "ofetch": "^1.3.3",
18
19
  "pathe": "^1.1.1",
19
20
  "globby": "^13.2.2",
20
21
  "c12": "^1.4.2",
21
22
  "chokidar": "^3.5.3",
22
- "listhen": "^1.4.0"
23
+ "listhen": "^1.4.3"
23
24
  },
24
- "version": "0.0.5",
25
+ "version": "0.0.7",
25
26
  "repository": {
26
27
  "url": "https://github.com/modiimedia/arri"
27
28
  }
@@ -1,6 +1,13 @@
1
1
  import { TObject, Static, TVoid, TSchema } from '@sinclair/typebox';
2
2
  import { H3Event, Router, App, AppOptions } from 'h3';
3
3
 
4
+ interface ApplicationDefinition {
5
+ schemaVersion: "0.0.1";
6
+ description: string;
7
+ procedures: Record<string, ProcedureDefinition>;
8
+ models: Record<string, JsonSchemaObject>;
9
+ errors: Omit<TObject, symbol>;
10
+ }
4
11
  interface ProcedureDefinition {
5
12
  path: string;
6
13
  description?: string;
@@ -11,13 +18,6 @@ interface ProcedureDefinition {
11
18
  interface ServiceDefinition {
12
19
  [key: string]: ProcedureDefinition | ServiceDefinition;
13
20
  }
14
- interface ApplicationDefinition {
15
- schemaVersion: "0.0.1";
16
- description: string;
17
- procedures: Record<string, ProcedureDefinition>;
18
- models: Record<string, JsonSchemaObject>;
19
- errors: Omit<TObject, symbol>;
20
- }
21
21
  declare const JsonSchemaScalarTypeValues: readonly ["integer", "number", "bigint", "string", "boolean", "Date"];
22
22
  declare const JsonSchemaNullTypeValues: readonly ["null", "undefined"];
23
23
  type JsonSchemaType = JsonSchemaScalarType | JsonSchemaNullType | JsonSchemaComplexType;
@@ -1,6 +1,13 @@
1
1
  import { TObject, Static, TVoid, TSchema } from '@sinclair/typebox';
2
2
  import { H3Event, Router, App, AppOptions } from 'h3';
3
3
 
4
+ interface ApplicationDefinition {
5
+ schemaVersion: "0.0.1";
6
+ description: string;
7
+ procedures: Record<string, ProcedureDefinition>;
8
+ models: Record<string, JsonSchemaObject>;
9
+ errors: Omit<TObject, symbol>;
10
+ }
4
11
  interface ProcedureDefinition {
5
12
  path: string;
6
13
  description?: string;
@@ -11,13 +18,6 @@ interface ProcedureDefinition {
11
18
  interface ServiceDefinition {
12
19
  [key: string]: ProcedureDefinition | ServiceDefinition;
13
20
  }
14
- interface ApplicationDefinition {
15
- schemaVersion: "0.0.1";
16
- description: string;
17
- procedures: Record<string, ProcedureDefinition>;
18
- models: Record<string, JsonSchemaObject>;
19
- errors: Omit<TObject, symbol>;
20
- }
21
21
  declare const JsonSchemaScalarTypeValues: readonly ["integer", "number", "bigint", "string", "boolean", "Date"];
22
22
  declare const JsonSchemaNullTypeValues: readonly ["null", "undefined"];
23
23
  type JsonSchemaType = JsonSchemaScalarType | JsonSchemaNullType | JsonSchemaComplexType;
@@ -1,6 +1,13 @@
1
1
  import { TObject, Static, TVoid, TSchema } from '@sinclair/typebox';
2
2
  import { H3Event, Router, App, AppOptions } from 'h3';
3
3
 
4
+ interface ApplicationDefinition {
5
+ schemaVersion: "0.0.1";
6
+ description: string;
7
+ procedures: Record<string, ProcedureDefinition>;
8
+ models: Record<string, JsonSchemaObject>;
9
+ errors: Omit<TObject, symbol>;
10
+ }
4
11
  interface ProcedureDefinition {
5
12
  path: string;
6
13
  description?: string;
@@ -11,13 +18,6 @@ interface ProcedureDefinition {
11
18
  interface ServiceDefinition {
12
19
  [key: string]: ProcedureDefinition | ServiceDefinition;
13
20
  }
14
- interface ApplicationDefinition {
15
- schemaVersion: "0.0.1";
16
- description: string;
17
- procedures: Record<string, ProcedureDefinition>;
18
- models: Record<string, JsonSchemaObject>;
19
- errors: Omit<TObject, symbol>;
20
- }
21
21
  declare const JsonSchemaScalarTypeValues: readonly ["integer", "number", "bigint", "string", "boolean", "Date"];
22
22
  declare const JsonSchemaNullTypeValues: readonly ["null", "undefined"];
23
23
  type JsonSchemaType = JsonSchemaScalarType | JsonSchemaNullType | JsonSchemaComplexType;