From c346a70cce2104ff99aba32e7757d1de419fb109 Mon Sep 17 00:00:00 2001 From: Michael Wolf Date: Sun, 16 Nov 2025 15:56:27 -0600 Subject: [PATCH] Drop deno dir --- deno/.dir-locals.el | 1 - deno/app.ts | 84 ------------------ deno/config.ts | 11 --- deno/content-types.ts | 38 -------- deno/deno.json | 15 ---- deno/deno.lock | 202 ------------------------------------------ deno/deps.ts | 7 -- deno/extensible.ts | 0 deno/handlers.ts | 19 ---- deno/http-codes.ts | 43 --------- deno/interfaces.ts | 3 - deno/logging.ts | 44 --------- deno/main.ts | 8 -- deno/main_test.ts | 6 -- deno/routes.ts | 82 ----------------- deno/run.sh | 11 --- deno/services.ts | 28 ------ deno/types.ts | 63 ------------- 18 files changed, 665 deletions(-) delete mode 100644 deno/.dir-locals.el delete mode 100644 deno/app.ts delete mode 100644 deno/config.ts delete mode 100644 deno/content-types.ts delete mode 100644 deno/deno.json delete mode 100644 deno/deno.lock delete mode 100644 deno/deps.ts delete mode 100644 deno/extensible.ts delete mode 100644 deno/handlers.ts delete mode 100644 deno/http-codes.ts delete mode 100644 deno/interfaces.ts delete mode 100644 deno/logging.ts delete mode 100644 deno/main.ts delete mode 100644 deno/main_test.ts delete mode 100644 deno/routes.ts delete mode 100755 deno/run.sh delete mode 100644 deno/services.ts delete mode 100644 deno/types.ts diff --git a/deno/.dir-locals.el b/deno/.dir-locals.el deleted file mode 100644 index 228c482..0000000 --- a/deno/.dir-locals.el +++ /dev/null @@ -1 +0,0 @@ -((typescript-mode . ((lsp-disabled-clients . (ts-ls))))) diff --git a/deno/app.ts b/deno/app.ts deleted file mode 100644 index d251eab..0000000 --- a/deno/app.ts +++ /dev/null @@ -1,84 +0,0 @@ -import { services } from "./services.ts"; -import { - DenoRequest, - DenoResponse, - InternalHandler, - massageMethod, - Method, - ProcessedRoute, - Request as Request, - Route, -} from "./types.ts"; - -import { routes } from "./routes.ts"; - -services.logging.log({ source: "logging", text: ["1"] }); -const processedRoutes: { [K in Method]: ProcessedRoute[] } = { - "GET": [], - "POST": [], - "PUT": [], - "PATCH": [], - "DELETE": [], -}; - -function isPromise(value: T | Promise): value is Promise { - return typeof (value as any)?.then === "function"; -} - -routes.forEach( - (route: Route, _idx: number, _allRoutes: Route[]) => { - const pattern: URLPattern = new URLPattern({ pathname: route.path }); - const methodList = route.methods; - - const handler: InternalHandler = async (denoRequest: DenoRequest) => { - const method = massageMethod(denoRequest.method); - - if (!methodList.includes(method)) { - // XXX: Worth asserting this? - } - - const p = new URL(denoRequest.url); - const path = p.pathname; - - const req: Request = { - pattern: route.path, - path, - method, - parameters: { one: 1, two: 2 }, - denoRequest, - }; - - const retval = route.handler(req); - if (isPromise(retval)) { - return await retval; - } else { - return retval; - } - }; - - for (const [_idx, method] of methodList.entries()) { - const pr: ProcessedRoute = { pattern, method, handler }; - - processedRoutes[method].push(pr); - } - }, -); - -async function handler(req: DenoRequest): Promise { - const m = req.method; - const m1 = massageMethod(m); - - const byMethod = processedRoutes[m1]; - for (const [_idx, pr] of byMethod.entries()) { - const match = pr.pattern.exec(req.url); - if (match) { - const resp = await pr.handler(req); - - return new globalThis.Response(resp.result); - } - } - - return new globalThis.Response("not found", { status: 404 }); -} - -Deno.serve(handler); diff --git a/deno/config.ts b/deno/config.ts deleted file mode 100644 index 0b3dfe0..0000000 --- a/deno/config.ts +++ /dev/null @@ -1,11 +0,0 @@ -const config = { - database: { - user: "abc123", - password: "abc123", - host: "localhost", - port: "5432", - database: "abc123", - }, -}; - -export { config }; diff --git a/deno/content-types.ts b/deno/content-types.ts deleted file mode 100644 index ac73350..0000000 --- a/deno/content-types.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { Extensible } from "./interfaces.ts"; - -export type ContentType = string; - -const contentTypes = { - text: { - plain: "text/plain", - html: "text/html", - css: "text/css", - javascript: "text/javascript", - xml: "text/xml", - }, - image: { - jpeg: "image/jpeg", - png: "image/png", - gif: "image/gif", - svgPlusXml: "image/svg+xml", - webp: "image/webp", - }, - audio: { - "mpeg": "audio/mpeg", - "wav": "audio/wav", - }, - video: { - mp4: "video/mp4", - webm: "video/webm", - xMsvideo: "video/x-msvideo", - }, - application: { - json: "application/json", - pdf: "application/pdf", - zip: "application/zip", - xWwwFormUrlencoded: "x-www-form-urlencoded", - octetStream: "octet-stream", - }, -}; - -export { contentTypes }; diff --git a/deno/deno.json b/deno/deno.json deleted file mode 100644 index 4d3c22e..0000000 --- a/deno/deno.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "compilerOptions": { - "lib": ["deno.ns", "dom"] - }, - "tasks": { - "dev": "deno run --watch main.ts" - }, - "imports": { - "@std/assert": "jsr:@std/assert@1", - "zod": "npm:zod@^3.24.2" - }, - "fmt": { - "indentWidth": 4 - } -} diff --git a/deno/deno.lock b/deno/deno.lock deleted file mode 100644 index f8ce1e4..0000000 --- a/deno/deno.lock +++ /dev/null @@ -1,202 +0,0 @@ -{ - "version": "4", - "specifiers": { - "jsr:@std/assert@1": "1.0.11", - "jsr:@std/async@1": "1.0.10", - "jsr:@std/bytes@1": "1.0.5", - "jsr:@std/bytes@^1.0.2-rc.3": "1.0.5", - "jsr:@std/internal@^1.0.5": "1.0.5", - "jsr:@std/io@0.224.5": "0.224.5", - "npm:zod@^3.24.2": "3.24.2" - }, - "jsr": { - "@std/assert@1.0.11": { - "integrity": "2461ef3c368fe88bc60e186e7744a93112f16fd110022e113a0849e94d1c83c1", - "dependencies": [ - "jsr:@std/internal" - ] - }, - "@std/async@1.0.10": { - "integrity": "2ff1b1c7d33d1416159989b0f69e59ec7ee8cb58510df01e454def2108b3dbec" - }, - "@std/bytes@1.0.5": { - "integrity": "4465dd739d7963d964c809202ebea6d5c6b8e3829ef25c6a224290fbb8a1021e" - }, - "@std/internal@1.0.5": { - "integrity": "54a546004f769c1ac9e025abd15a76b6671ddc9687e2313b67376125650dc7ba" - }, - "@std/io@0.224.5": { - "integrity": "cb84fe655d1273fca94efcff411465027a8b0b4225203f19d6ee98d9c8920a2d", - "dependencies": [ - "jsr:@std/bytes@^1.0.2-rc.3" - ] - } - }, - "npm": { - "zod@3.24.2": { - "integrity": "sha512-lY7CDW43ECgW9u1TcT3IoXHflywfVqDYze4waEz812jR/bZ8FHDsl7pFQoSZTz5N+2NqRXs8GBwnAwo3ZNxqhQ==" - } - }, - "redirects": { - "https://deno.land/x/random_number/mod.ts": "https://deno.land/x/random_number@2.0.0/mod.ts", - "https://deno.land/x/sleep/mod.ts": "https://deno.land/x/sleep@v1.3.0/mod.ts" - }, - "remote": { - "https://deno.land/std@0.214.0/assert/assert.ts": "bec068b2fccdd434c138a555b19a2c2393b71dfaada02b7d568a01541e67cdc5", - "https://deno.land/std@0.214.0/assert/assertion_error.ts": "9f689a101ee586c4ce92f52fa7ddd362e86434ffdf1f848e45987dc7689976b8", - "https://deno.land/std@0.214.0/async/delay.ts": "8e1d18fe8b28ff95885e2bc54eccec1713f57f756053576d8228e6ca110793ad", - "https://deno.land/std@0.214.0/bytes/copy.ts": "f29c03168853720dfe82eaa57793d0b9e3543ebfe5306684182f0f1e3bfd422a", - "https://deno.land/std@0.214.0/crypto/_fnv/fnv32.ts": "ba2c5ef976b9f047d7ce2d33dfe18671afc75154bcf20ef89d932b2fe8820535", - "https://deno.land/std@0.214.0/crypto/_fnv/fnv64.ts": "580cadfe2ff333fe253d15df450f927c8ac7e408b704547be26aab41b5772558", - "https://deno.land/std@0.214.0/crypto/_fnv/mod.ts": "8dbb60f062a6e77b82f7a62ac11fabfba52c3cd408c21916b130d8f57a880f96", - "https://deno.land/std@0.214.0/crypto/_fnv/util.ts": "27b36ce3440d0a180af6bf1cfc2c326f68823288540a354dc1d636b781b9b75f", - "https://deno.land/std@0.214.0/crypto/_wasm/lib/deno_std_wasm_crypto.generated.mjs": "76c727912539737def4549bb62a96897f37eb334b979f49c57b8af7a1617635e", - "https://deno.land/std@0.214.0/crypto/_wasm/mod.ts": "c55f91473846827f077dfd7e5fc6e2726dee5003b6a5747610707cdc638a22ba", - "https://deno.land/std@0.214.0/crypto/crypto.ts": "4448f8461c797adba8d70a2c60f7795a546d7a0926e96366391bffdd06491c16", - "https://deno.land/std@0.214.0/datetime/_common.ts": "a62214c1924766e008e27d3d843ceba4b545dc2aa9880de0ecdef9966d5736b6", - "https://deno.land/std@0.214.0/datetime/parse.ts": "bb248bbcb3cd54bcaf504a1ee670fc4695e429d9019c06af954bbe2bcb8f1d02", - "https://deno.land/std@0.214.0/encoding/_util.ts": "beacef316c1255da9bc8e95afb1fa56ed69baef919c88dc06ae6cb7a6103d376", - "https://deno.land/std@0.214.0/encoding/base64.ts": "96e61a556d933201266fea84ae500453293f2aff130057b579baafda096a96bc", - "https://deno.land/std@0.214.0/encoding/hex.ts": "4d47d3b25103cf81a2ed38f54b394d39a77b63338e1eaa04b70c614cb45ec2e6", - "https://deno.land/std@0.214.0/fmt/colors.ts": "aeaee795471b56fc62a3cb2e174ed33e91551b535f44677f6320336aabb54fbb", - "https://deno.land/std@0.214.0/io/buf_reader.ts": "c73aad99491ee6db3d6b001fa4a780e9245c67b9296f5bad9c0fa7384e35d47a", - "https://deno.land/std@0.214.0/io/buf_writer.ts": "f82f640c8b3a820f600a8da429ad0537037c7d6a78426bbca2396fb1f75d3ef4", - "https://deno.land/std@0.214.0/io/types.ts": "748bbb3ac96abda03594ef5a0db15ce5450dcc6c0d841c8906f8b10ac8d32c96", - "https://deno.land/std@0.214.0/path/_common/assert_path.ts": "2ca275f36ac1788b2acb60fb2b79cb06027198bc2ba6fb7e163efaedde98c297", - "https://deno.land/std@0.214.0/path/_common/basename.ts": "569744855bc8445f3a56087fd2aed56bdad39da971a8d92b138c9913aecc5fa2", - "https://deno.land/std@0.214.0/path/_common/common.ts": "6157c7ec1f4db2b4a9a187efd6ce76dcaf1e61cfd49f87e40d4ea102818df031", - "https://deno.land/std@0.214.0/path/_common/constants.ts": "dc5f8057159f4b48cd304eb3027e42f1148cf4df1fb4240774d3492b5d12ac0c", - "https://deno.land/std@0.214.0/path/_common/dirname.ts": "684df4aa71a04bbcc346c692c8485594fc8a90b9408dfbc26ff32cf3e0c98cc8", - "https://deno.land/std@0.214.0/path/_common/format.ts": "92500e91ea5de21c97f5fe91e178bae62af524b72d5fcd246d6d60ae4bcada8b", - "https://deno.land/std@0.214.0/path/_common/from_file_url.ts": "d672bdeebc11bf80e99bf266f886c70963107bdd31134c4e249eef51133ceccf", - "https://deno.land/std@0.214.0/path/_common/glob_to_reg_exp.ts": "2007aa87bed6eb2c8ae8381adcc3125027543d9ec347713c1ad2c68427330770", - "https://deno.land/std@0.214.0/path/_common/normalize.ts": "684df4aa71a04bbcc346c692c8485594fc8a90b9408dfbc26ff32cf3e0c98cc8", - "https://deno.land/std@0.214.0/path/_common/normalize_string.ts": "dfdf657a1b1a7db7999f7c575ee7e6b0551d9c20f19486c6c3f5ff428384c965", - "https://deno.land/std@0.214.0/path/_common/relative.ts": "faa2753d9b32320ed4ada0733261e3357c186e5705678d9dd08b97527deae607", - "https://deno.land/std@0.214.0/path/_common/strip_trailing_separators.ts": "7024a93447efcdcfeaa9339a98fa63ef9d53de363f1fbe9858970f1bba02655a", - "https://deno.land/std@0.214.0/path/_common/to_file_url.ts": "7f76adbc83ece1bba173e6e98a27c647712cab773d3f8cbe0398b74afc817883", - "https://deno.land/std@0.214.0/path/_interface.ts": "a1419fcf45c0ceb8acdccc94394e3e94f99e18cfd32d509aab514c8841799600", - "https://deno.land/std@0.214.0/path/_os.ts": "8fb9b90fb6b753bd8c77cfd8a33c2ff6c5f5bc185f50de8ca4ac6a05710b2c15", - "https://deno.land/std@0.214.0/path/basename.ts": "5d341aadb7ada266e2280561692c165771d071c98746fcb66da928870cd47668", - "https://deno.land/std@0.214.0/path/common.ts": "03e52e22882402c986fe97ca3b5bb4263c2aa811c515ce84584b23bac4cc2643", - "https://deno.land/std@0.214.0/path/constants.ts": "0c206169ca104938ede9da48ac952de288f23343304a1c3cb6ec7625e7325f36", - "https://deno.land/std@0.214.0/path/dirname.ts": "85bd955bf31d62c9aafdd7ff561c4b5fb587d11a9a5a45e2b01aedffa4238a7c", - "https://deno.land/std@0.214.0/path/extname.ts": "593303db8ae8c865cbd9ceec6e55d4b9ac5410c1e276bfd3131916591b954441", - "https://deno.land/std@0.214.0/path/format.ts": "98fad25f1af7b96a48efb5b67378fcc8ed77be895df8b9c733b86411632162af", - "https://deno.land/std@0.214.0/path/from_file_url.ts": "911833ae4fd10a1c84f6271f36151ab785955849117dc48c6e43b929504ee069", - "https://deno.land/std@0.214.0/path/glob_to_regexp.ts": "83c5fd36a8c86f5e72df9d0f45317f9546afa2ce39acaafe079d43a865aced08", - "https://deno.land/std@0.214.0/path/is_absolute.ts": "4791afc8bfd0c87f0526eaa616b0d16e7b3ab6a65b62942e50eac68de4ef67d7", - "https://deno.land/std@0.214.0/path/is_glob.ts": "a65f6195d3058c3050ab905705891b412ff942a292bcbaa1a807a74439a14141", - "https://deno.land/std@0.214.0/path/join.ts": "ae2ec5ca44c7e84a235fd532e4a0116bfb1f2368b394db1c4fb75e3c0f26a33a", - "https://deno.land/std@0.214.0/path/join_globs.ts": "e9589869a33dc3982101898ee50903db918ca00ad2614dbe3934d597d7b1fbea", - "https://deno.land/std@0.214.0/path/mod.ts": "ffeaccb713dbe6c72e015b7c767f753f8ec5fbc3b621ff5eeee486ffc2c0ddda", - "https://deno.land/std@0.214.0/path/normalize.ts": "4155743ccceeed319b350c1e62e931600272fad8ad00c417b91df093867a8352", - "https://deno.land/std@0.214.0/path/normalize_glob.ts": "98ee8268fad271193603271c203ae973280b5abfbdd2cbca1053fd2af71869ca", - "https://deno.land/std@0.214.0/path/parse.ts": "65e8e285f1a63b714e19ef24b68f56e76934c3df0b6e65fd440d3991f4f8aefb", - "https://deno.land/std@0.214.0/path/posix/_util.ts": "1e3937da30f080bfc99fe45d7ed23c47dd8585c5e473b2d771380d3a6937cf9d", - "https://deno.land/std@0.214.0/path/posix/basename.ts": "39ee27a29f1f35935d3603ccf01d53f3d6e0c5d4d0f84421e65bd1afeff42843", - "https://deno.land/std@0.214.0/path/posix/common.ts": "26f60ccc8b2cac3e1613000c23ac5a7d392715d479e5be413473a37903a2b5d4", - "https://deno.land/std@0.214.0/path/posix/constants.ts": "93481efb98cdffa4c719c22a0182b994e5a6aed3047e1962f6c2c75b7592bef1", - "https://deno.land/std@0.214.0/path/posix/dirname.ts": "6535d2bdd566118963537b9dda8867ba9e2a361015540dc91f5afbb65c0cce8b", - "https://deno.land/std@0.214.0/path/posix/extname.ts": "8d36ae0082063c5e1191639699e6f77d3acf501600a3d87b74943f0ae5327427", - "https://deno.land/std@0.214.0/path/posix/format.ts": "185e9ee2091a42dd39e2a3b8e4925370ee8407572cee1ae52838aed96310c5c1", - "https://deno.land/std@0.214.0/path/posix/from_file_url.ts": "951aee3a2c46fd0ed488899d024c6352b59154c70552e90885ed0c2ab699bc40", - "https://deno.land/std@0.214.0/path/posix/glob_to_regexp.ts": "54d3ff40f309e3732ab6e5b19d7111d2d415248bcd35b67a99defcbc1972e697", - "https://deno.land/std@0.214.0/path/posix/is_absolute.ts": "cebe561ad0ae294f0ce0365a1879dcfca8abd872821519b4fcc8d8967f888ede", - "https://deno.land/std@0.214.0/path/posix/is_glob.ts": "8a8b08c08bf731acf2c1232218f1f45a11131bc01de81e5f803450a5914434b9", - "https://deno.land/std@0.214.0/path/posix/join.ts": "aef88d5fa3650f7516730865dbb951594d1a955b785e2450dbee93b8e32694f3", - "https://deno.land/std@0.214.0/path/posix/join_globs.ts": "ee2f4676c5b8a0dfa519da58b8ade4d1c4aa8dd3fe35619edec883ae9df1f8c9", - "https://deno.land/std@0.214.0/path/posix/mod.ts": "563a18c2b3ddc62f3e4a324ff0f583e819b8602a72ad880cb98c9e2e34f8db5b", - "https://deno.land/std@0.214.0/path/posix/normalize.ts": "baeb49816a8299f90a0237d214cef46f00ba3e95c0d2ceb74205a6a584b58a91", - "https://deno.land/std@0.214.0/path/posix/normalize_glob.ts": "65f0138fa518ef9ece354f32889783fc38cdf985fb02dcf1c3b14fa47d665640", - "https://deno.land/std@0.214.0/path/posix/parse.ts": "d5bac4eb21262ab168eead7e2196cb862940c84cee572eafedd12a0d34adc8fb", - "https://deno.land/std@0.214.0/path/posix/relative.ts": "3907d6eda41f0ff723d336125a1ad4349112cd4d48f693859980314d5b9da31c", - "https://deno.land/std@0.214.0/path/posix/resolve.ts": "bac20d9921beebbbb2b73706683b518b1d0c1b1da514140cee409e90d6b2913a", - "https://deno.land/std@0.214.0/path/posix/separator.ts": "c9ecae5c843170118156ac5d12dc53e9caf6a1a4c96fc8b1a0ab02dff5c847b0", - "https://deno.land/std@0.214.0/path/posix/to_file_url.ts": "7aa752ba66a35049e0e4a4be5a0a31ac6b645257d2e031142abb1854de250aaf", - "https://deno.land/std@0.214.0/path/posix/to_namespaced_path.ts": "28b216b3c76f892a4dca9734ff1cc0045d135532bfd9c435ae4858bfa5a2ebf0", - "https://deno.land/std@0.214.0/path/relative.ts": "ab739d727180ed8727e34ed71d976912461d98e2b76de3d3de834c1066667add", - "https://deno.land/std@0.214.0/path/resolve.ts": "a6f977bdb4272e79d8d0ed4333e3d71367cc3926acf15ac271f1d059c8494d8d", - "https://deno.land/std@0.214.0/path/separator.ts": "c6c890507f944a1f5cb7d53b8d638d6ce3cf0f34609c8d84a10c1eaa400b77a9", - "https://deno.land/std@0.214.0/path/to_file_url.ts": "88f049b769bce411e2d2db5bd9e6fd9a185a5fbd6b9f5ad8f52bef517c4ece1b", - "https://deno.land/std@0.214.0/path/to_namespaced_path.ts": "b706a4103b104cfadc09600a5f838c2ba94dbcdb642344557122dda444526e40", - "https://deno.land/std@0.214.0/path/windows/_util.ts": "d5f47363e5293fced22c984550d5e70e98e266cc3f31769e1710511803d04808", - "https://deno.land/std@0.214.0/path/windows/basename.ts": "e2dbf31d1d6385bfab1ce38c333aa290b6d7ae9e0ecb8234a654e583cf22f8fe", - "https://deno.land/std@0.214.0/path/windows/common.ts": "26f60ccc8b2cac3e1613000c23ac5a7d392715d479e5be413473a37903a2b5d4", - "https://deno.land/std@0.214.0/path/windows/constants.ts": "5afaac0a1f67b68b0a380a4ef391bf59feb55856aa8c60dfc01bd3b6abb813f5", - "https://deno.land/std@0.214.0/path/windows/dirname.ts": "33e421be5a5558a1346a48e74c330b8e560be7424ed7684ea03c12c21b627bc9", - "https://deno.land/std@0.214.0/path/windows/extname.ts": "165a61b00d781257fda1e9606a48c78b06815385e7d703232548dbfc95346bef", - "https://deno.land/std@0.214.0/path/windows/format.ts": "bbb5ecf379305b472b1082cd2fdc010e44a0020030414974d6029be9ad52aeb6", - "https://deno.land/std@0.214.0/path/windows/from_file_url.ts": "ced2d587b6dff18f963f269d745c4a599cf82b0c4007356bd957cb4cb52efc01", - "https://deno.land/std@0.214.0/path/windows/glob_to_regexp.ts": "6dcd1242bd8907aa9660cbdd7c93446e6927b201112b0cba37ca5d80f81be51b", - "https://deno.land/std@0.214.0/path/windows/is_absolute.ts": "4a8f6853f8598cf91a835f41abed42112cebab09478b072e4beb00ec81f8ca8a", - "https://deno.land/std@0.214.0/path/windows/is_glob.ts": "8a8b08c08bf731acf2c1232218f1f45a11131bc01de81e5f803450a5914434b9", - "https://deno.land/std@0.214.0/path/windows/join.ts": "e0b3356615c1a75c56ebb6a7311157911659e11fd533d80d724800126b761ac3", - "https://deno.land/std@0.214.0/path/windows/join_globs.ts": "ee2f4676c5b8a0dfa519da58b8ade4d1c4aa8dd3fe35619edec883ae9df1f8c9", - "https://deno.land/std@0.214.0/path/windows/mod.ts": "7d6062927bda47c47847ffb55d8f1a37b0383840aee5c7dfc93984005819689c", - "https://deno.land/std@0.214.0/path/windows/normalize.ts": "78126170ab917f0ca355a9af9e65ad6bfa5be14d574c5fb09bb1920f52577780", - "https://deno.land/std@0.214.0/path/windows/normalize_glob.ts": "179c86ba89f4d3fe283d2addbe0607341f79ee9b1ae663abcfb3439db2e97810", - "https://deno.land/std@0.214.0/path/windows/parse.ts": "b9239edd892a06a06625c1b58425e199f018ce5649ace024d144495c984da734", - "https://deno.land/std@0.214.0/path/windows/relative.ts": "3e1abc7977ee6cc0db2730d1f9cb38be87b0ce4806759d271a70e4997fc638d7", - "https://deno.land/std@0.214.0/path/windows/resolve.ts": "75b2e3e1238d840782cee3d8864d82bfaa593c7af8b22f19c6422cf82f330ab3", - "https://deno.land/std@0.214.0/path/windows/separator.ts": "e51c5522140eff4f8402617c5c68a201fdfa3a1a8b28dc23587cff931b665e43", - "https://deno.land/std@0.214.0/path/windows/to_file_url.ts": "1cd63fd35ec8d1370feaa4752eccc4cc05ea5362a878be8dc7db733650995484", - "https://deno.land/std@0.214.0/path/windows/to_namespaced_path.ts": "4ffa4fb6fae321448d5fe810b3ca741d84df4d7897e61ee29be961a6aac89a4c", - "https://deno.land/x/memcached@v1.0.0/mod.ts": "3c8528631e603638ded48f8fadcf61cde00fb1d2054e8647cc033bc9f2ea5867", - "https://deno.land/x/postgres@v0.19.3/client.ts": "d141c65c20484c545a1119c9af7a52dcc24f75c1a5633de2b9617b0f4b2ed5c1", - "https://deno.land/x/postgres@v0.19.3/client/error.ts": "05b0e35d65caf0ba21f7f6fab28c0811da83cd8b4897995a2f411c2c83391036", - "https://deno.land/x/postgres@v0.19.3/connection/auth.ts": "db15c1659742ef4d2791b32834950278dc7a40cb931f8e434e6569298e58df51", - "https://deno.land/x/postgres@v0.19.3/connection/connection.ts": "198a0ecf92a0d2aa72db3bb88b8f412d3b1f6b87d464d5f7bff9aa3b6aff8370", - "https://deno.land/x/postgres@v0.19.3/connection/connection_params.ts": "463d7a9ed559f537a55d6928cab62e1c31b808d08cd0411b6ae461d0c0183c93", - "https://deno.land/x/postgres@v0.19.3/connection/message.ts": "20da5d80fc4d7ddb7b850083e0b3fa8734eb26642221dad89c62e27d78e57a4d", - "https://deno.land/x/postgres@v0.19.3/connection/message_code.ts": "12bcb110df6945152f9f6c63128786558d7ad1e61006920daaa16ef85b3bab7d", - "https://deno.land/x/postgres@v0.19.3/connection/packet.ts": "050aeff1fc13c9349e89451a155ffcd0b1343dc313a51f84439e3e45f64b56c8", - "https://deno.land/x/postgres@v0.19.3/connection/scram.ts": "532d4d58b565a2ab48fb5e1e14dc9bfb3bb283d535011e371e698eb4a89dd994", - "https://deno.land/x/postgres@v0.19.3/debug.ts": "8add17699191f11e6830b8c95d9de25857d221bb2cf6c4ae22254d395895c1f9", - "https://deno.land/x/postgres@v0.19.3/deps.ts": "c312038fe64b8368f8a294119f11d8f235fe67de84d7c3b0ef67b3a56628171a", - "https://deno.land/x/postgres@v0.19.3/mod.ts": "4930c7b44f8d16ea71026f7e3ef22a2322d84655edceacd55f7461a9218d8560", - "https://deno.land/x/postgres@v0.19.3/pool.ts": "2289f029e7a3bd3d460d4faa71399a920b7406c92a97c0715d6e31dbf1380ec3", - "https://deno.land/x/postgres@v0.19.3/query/array_parser.ts": "ff72d3e026e3022a1a223a6530be5663f8ebbd911ed978291314e7fe6c2f2464", - "https://deno.land/x/postgres@v0.19.3/query/decode.ts": "3e89ad2a662eab66a4f4e195ff0924d71d199af3c2f5637d1ae650301a03fa9b", - "https://deno.land/x/postgres@v0.19.3/query/decoders.ts": "6a73da1024086ab91e233648c850dccbde59248b90d87054bbbd7f0bf4a50681", - "https://deno.land/x/postgres@v0.19.3/query/encode.ts": "5b1c305bc7352a6f9fe37f235dddfc23e26419c77a133b4eaea42cf136481aa6", - "https://deno.land/x/postgres@v0.19.3/query/oid.ts": "21fc714ac212350ba7df496f88ea9e01a4ee0458911d0f2b6a81498e12e7af4c", - "https://deno.land/x/postgres@v0.19.3/query/query.ts": "510f9a27da87ed7b31b5cbcd14bf3028b441ac2ddc368483679d0b86a9d9f213", - "https://deno.land/x/postgres@v0.19.3/query/transaction.ts": "8f4eef68f8e9b4be216199404315e6e08fe1fe98afb2e640bffd077662f79678", - "https://deno.land/x/postgres@v0.19.3/query/types.ts": "540f6f973d493d63f2c0059a09f3368071f57931bba68bea408a635a3e0565d6", - "https://deno.land/x/postgres@v0.19.3/utils/deferred.ts": "5420531adb6c3ea29ca8aac57b9b59bd3e4b9a938a4996bbd0947a858f611080", - "https://deno.land/x/postgres@v0.19.3/utils/utils.ts": "ca47193ea03ff5b585e487a06f106d367e509263a960b787197ce0c03113a738", - "https://deno.land/x/random_number@2.0.0/mod.ts": "83010e4a0192b015ba4491d8bb8c73a458f352ebc613b847ff6349961d1c7827", - "https://deno.land/x/redis@v0.37.1/backoff.ts": "33e4a6e245f8743fbae0ce583993a671a3ac2ecee433a3e7f0bd77b5dd541d84", - "https://deno.land/x/redis@v0.37.1/command.ts": "2d1da4b32495ea852bdff0c2e7fd191a056779a696b9f83fb648c5ebac45cfc3", - "https://deno.land/x/redis@v0.37.1/connection.ts": "cee30a6310298441de17d1028d4ce3fd239dcf05a92294fba7173a922d0596cb", - "https://deno.land/x/redis@v0.37.1/deps/std/async.ts": "5a588aefb041cca49f0e6b7e3c397119693a3e07bea89c54cf7fe4a412e37bbf", - "https://deno.land/x/redis@v0.37.1/deps/std/bytes.ts": "f5b437ebcac77600101a81ef457188516e4944b3c2a931dff5ced3fa0c239b62", - "https://deno.land/x/redis@v0.37.1/deps/std/io.ts": "b7505c5e738384f5f7a021d7bbd78380490c059cc7c83cd8dada1f86ec16e835", - "https://deno.land/x/redis@v0.37.1/errors.ts": "8293f56a70ea8388cb80b6e1caa15d350ed1719529fc06573b01a443d0caad69", - "https://deno.land/x/redis@v0.37.1/events.ts": "704767b1beed2d5acfd5e86bd1ef93befdc8a8f8c8bb4ae1b4485664a8a6a625", - "https://deno.land/x/redis@v0.37.1/executor.ts": "5ac4c1f7bec44d12ebc0f3702bf074bd3ba6c1aae74953582f6358d2948718e7", - "https://deno.land/x/redis@v0.37.1/internal/encoding.ts": "0525f7f444a96b92cd36423abdfe221f8d8de4a018dc5cb6750a428a5fc897c2", - "https://deno.land/x/redis@v0.37.1/internal/symbols.ts": "e36097bab1da1c9fe84a3bb9cb0ed1ec10c3dc7dd0b557769c5c54e15d110dd2", - "https://deno.land/x/redis@v0.37.1/mod.ts": "e11d9384c2ffe1b3d81ce0ad275254519990635ad1ba39f46d49a73b3c35238d", - "https://deno.land/x/redis@v0.37.1/pipeline.ts": "974fff59bf0befa2ad7eee50ecba40006c47364f5e3285e1335c9f9541b7ebae", - "https://deno.land/x/redis@v0.37.1/protocol/deno_streams/command.ts": "5c5e5fb639cae22c1f9bfdc87631edcd67bb28bf8590161ae484d293b733aa01", - "https://deno.land/x/redis@v0.37.1/protocol/deno_streams/mod.ts": "b084bf64d6b795f6c1d0b360d9be221e246a9c033e5d88fd1e82fa14f711d25b", - "https://deno.land/x/redis@v0.37.1/protocol/deno_streams/reply.ts": "639de34541f207f793393a3cd45f9a23ef308f094d9d3d6ce62f84b175d3af47", - "https://deno.land/x/redis@v0.37.1/protocol/shared/command.ts": "e75f6be115ff73bd865e01be4e2a28077a9993b1e0c54ed96b6825bfe997d382", - "https://deno.land/x/redis@v0.37.1/protocol/shared/protocol.ts": "5b9284ee28ec74dfc723c7c7f07dca8d5f9d303414f36689503622dfdde12551", - "https://deno.land/x/redis@v0.37.1/protocol/shared/reply.ts": "3311ff66357bacbd60785cb43b97539c341d8a7d963bc5e80cb864ac81909ea5", - "https://deno.land/x/redis@v0.37.1/protocol/shared/types.ts": "c6bf2b9eafd69e358a972823d94b8b478c00bac195b87b33b7437de2a9bb7fb4", - "https://deno.land/x/redis@v0.37.1/pubsub.ts": "a36892455b0a4a50af169332a165b0985cc90d84486087f036e507e3137b2afb", - "https://deno.land/x/redis@v0.37.1/redis.ts": "4904772596c8a82d7112092e7edea45243eae38809b2f2ea8db61a4207fe246b", - "https://deno.land/x/redis@v0.37.1/stream.ts": "d43076815d046eb8428fcd2799544a9fd07b3480099f5fc67d2ba12fdc73725f", - "https://deno.land/x/sleep@v1.3.0/mod.ts": "e9955ecd3228a000e29d46726cd6ab14b65cf83904e9b365f3a8d64ec61c1af3", - "https://deno.land/x/sleep@v1.3.0/sleep.ts": "b6abaca093b094b0c2bba94f287b19a60946a8d15764d168f83fcf555f5bb59e" - }, - "workspace": { - "dependencies": [ - "jsr:@std/assert@1", - "npm:zod@^3.24.2" - ] - } -} diff --git a/deno/deps.ts b/deno/deps.ts deleted file mode 100644 index 869fb08..0000000 --- a/deno/deps.ts +++ /dev/null @@ -1,7 +0,0 @@ -// Database -export { Client as PostgresClient } from "https://deno.land/x/postgres@v0.19.3/mod.ts"; -export type { ClientOptions as PostgresOptions } from "https://deno.land/x/postgres@v0.19.3/mod.ts"; - -// Redis -export { connect as redisConnect } from "https://deno.land/x/redis@v0.37.1/mod.ts"; -export type { Redis } from "https://deno.land/x/redis@v0.37.1/mod.ts"; diff --git a/deno/extensible.ts b/deno/extensible.ts deleted file mode 100644 index e69de29..0000000 diff --git a/deno/handlers.ts b/deno/handlers.ts deleted file mode 100644 index 4d63937..0000000 --- a/deno/handlers.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { contentTypes } from "./content-types.ts"; -import { httpCodes } from "./http-codes.ts"; -import { services } from "./services.ts"; -import { Request,Handler, Response } from "./types.ts"; - -const multiHandler: Handler = (req: Request): Response => { - const code = httpCodes.success.OK; - const rn = services.random.randomNumber(); - - const retval: Response = { - code, - result: `that was ${req.method} (${rn})`, - contentType: contentTypes.text.plain, - }; - - return retval; -}; - -export { multiHandler }; diff --git a/deno/http-codes.ts b/deno/http-codes.ts deleted file mode 100644 index b63b33c..0000000 --- a/deno/http-codes.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { Extensible } from "./interfaces.ts"; - -export type HttpCode = { - code: number; - name: string; - description?: string; -}; -type Group = "success" | "redirection" | "clientErrors" | "serverErrors"; -type CodeDefinitions = { - [K in Group]: { - [K: string]: HttpCode; - }; -}; -// FIXME: Figure out how to brand CodeDefinitions in a way that isn't -// tedious. - -const httpCodes: CodeDefinitions = { - success: { - OK: { code: 200, name: "OK", "description": "" }, - Created: { code: 201, name: "Created" }, - Accepted: { code: 202, name: "Accepted" }, - NoContent: { code: 204, name: "No content" }, - }, - redirection: { - // later - }, - clientErrors: { - BadRequest: { code: 400, name: "Bad Request" }, - Unauthorized: { code: 401, name: "Unauthorized" }, - Forbidden: { code: 403, name: "Forbidden" }, - NotFound: { code: 404, name: "Not Found" }, - MethodNotAllowed: { code: 405, name: "Method Not Allowed" }, - NotAcceptable: { code: 406, name: "Not Acceptable" }, - // More later - }, - serverErrors: { - InternalServerError: { code: 500, name: "Internal Server Error" }, - NotImplemented: { code: 500, name: "Not implemented" }, - // more later - }, -}; - -export { httpCodes }; diff --git a/deno/interfaces.ts b/deno/interfaces.ts deleted file mode 100644 index 48dd302..0000000 --- a/deno/interfaces.ts +++ /dev/null @@ -1,3 +0,0 @@ -type Brand = K & { readonly __brand: T }; - -export type Extensible = Brand<"Extensible", {}>; diff --git a/deno/logging.ts b/deno/logging.ts deleted file mode 100644 index d95ecac..0000000 --- a/deno/logging.ts +++ /dev/null @@ -1,44 +0,0 @@ -// internal-logging.ts - -// FIXME: Move this to somewhere more appropriate -type AtLeastOne = [T, ...T[]]; - -type MessageSource = "logging" | "diagnostic" | "user"; - -type Message = { - // FIXME: number probably isn't what we want here - timestamp?: number; - source: MessageSource; - - text: AtLeastOne; -}; - -const m1: Message = { timestamp: 123, source: "logging", text: ["foo"] }; -const m2: Message = { - timestamp: 321, - source: "diagnostic", - text: ["ok", "whatever"], -}; - -type FilterArgument = { - limit?: number; - before?: number; - after?: number; - - // FIXME: add offsets to use instead of or in addition to before/after - - match?: (string | RegExp)[]; -}; - -const log = (_message: Message) => { - // WRITEME -}; - -const getLogs = (filter: FilterArgument) => { - // WRITEME -}; - -// FIXME: there's scope for more specialized functions although they -// probably should be defined in terms of the basic ones here. - -export { getLogs, log }; diff --git a/deno/main.ts b/deno/main.ts deleted file mode 100644 index 3678714..0000000 --- a/deno/main.ts +++ /dev/null @@ -1,8 +0,0 @@ -export function add(a: number, b: number): number { - return a + b; -} - -// Learn more at https://docs.deno.com/runtime/manual/examples/module_metadata#concepts -if (import.meta.main) { - console.log("Add 2 + 3 =", add(2, 3)); -} diff --git a/deno/main_test.ts b/deno/main_test.ts deleted file mode 100644 index 6bdafb8..0000000 --- a/deno/main_test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { assertEquals } from "@std/assert"; -import { add } from "./main.ts"; - -Deno.test(function addTest() { - assertEquals(add(2, 3), 5); -}); diff --git a/deno/routes.ts b/deno/routes.ts deleted file mode 100644 index 7df6339..0000000 --- a/deno/routes.ts +++ /dev/null @@ -1,82 +0,0 @@ -/// - -import { sleep } from "https://deno.land/x/sleep/mod.ts"; - -import { HttpCode, httpCodes } from "./http-codes.ts"; -import { ContentType, contentTypes } from "./content-types.ts"; -import { services } from "./services.ts"; -import { multiHandler } from "./handlers.ts"; -import { - DenoRequest, - Handler, - Method, - ProcessedRoute, - Request, - Response, - Route, - UserRequest, -} from "./types.ts"; - -// FIXME: Obviously put this somewhere else -const okText = (out: string) => { - const code = httpCodes.success.OK; - - return { - code, - result: out, - contentType: contentTypes.text.plain, - }; -}; - -const routes: Route[] = [ - { - path: "/slow", - methods: ["GET"], - handler: async (_req: Request) => { - console.log("starting slow request"); - await sleep(2); - console.log("finishing slow request"); - return okText("that was slow"); - }, - }, - { - path: "/list", - methods: ["GET"], - handler: (_req: Request) => { - const code = httpCodes.success.OK; - const lr = (rr: Route[]) => { - const ret = rr.map((r: Route) => { - return r.path; - }); - - return ret; - }; - - const listing = lr(routes).join(", "); - return { - code, - result: listing + "\n", - contentType: contentTypes.text.plain, - }; - }, - }, - { - path: "/ok", - methods: ["GET", "POST", "PUT"], - handler: multiHandler, - }, - { - path: "/alsook", - methods: ["GET"], - handler: (_req) => { - const code = httpCodes.success.OK; - return { - code, - result: "it is also ok", - contentType: contentTypes.text.plain, - }; - }, - }, -]; - -export { routes }; diff --git a/deno/run.sh b/deno/run.sh deleted file mode 100755 index 713aad1..0000000 --- a/deno/run.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -set -e - -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -cd "$DIR" - -deno run --allow-net --unstable-sloppy-imports --watch app.ts - - diff --git a/deno/services.ts b/deno/services.ts deleted file mode 100644 index 94a476d..0000000 --- a/deno/services.ts +++ /dev/null @@ -1,28 +0,0 @@ -// services.ts - -import { randomNumber } from "https://deno.land/x/random_number/mod.ts"; -import { config } from "./config.ts"; -import { getLogs, log } from "./logging.ts"; - -//const database = Client({ - -//}) - -const database = {}; - -const logging = { - log, - getLogs, -}; - -const random = { - randomNumber, -}; - -const services = { - database, - logging, - random, -}; - -export { services }; diff --git a/deno/types.ts b/deno/types.ts deleted file mode 100644 index b98cd9e..0000000 --- a/deno/types.ts +++ /dev/null @@ -1,63 +0,0 @@ -// types.ts - -// FIXME: split this up into types used by app developers and types internal -// to the framework. - -// FIXME: the use of types like Request and Response cause problems because it's -// easy to forget to import them and then all sorts of random typechecking errors -// start showing up even if the code is sound. So find other names for them. - -import { z } from "zod"; -import { HttpCode, httpCodes } from "./http-codes.ts"; -import { ContentType, contentTypes } from "./content-types.ts"; - -const methodParser = z.union([ - z.literal("GET"), - z.literal("POST"), - z.literal("PUT"), - z.literal("PATCH"), - z.literal("DELETE"), -]); - -export type Method = z.infer; - -const massageMethod = (input: string): Method => { - const r = methodParser.parse(input.toUpperCase()); - - return r; -}; - -export type DenoRequest = globalThis.Request; -export type DenoResponse = globalThis.Response; -export type UserRequest = {}; -export type Request = { - pattern: string; - path: string; - method: Method; - parameters: object; - denoRequest: globalThis.Request; -}; - -export type InternalHandler = (req: DenoRequest) => Promise; - -export type Handler = (req: Request) => Promise | Response; -export type ProcessedRoute = { - pattern: URLPattern; - method: Method; - handler: InternalHandler; -}; - -export type Response = { - code: HttpCode; - contentType: ContentType; - result: string; -}; - -export type Route = { - path: string; - methods: Method[]; - handler: Handler; - interruptable?: boolean; -}; - -export { massageMethod };