silgi 0.43.29 → 0.50.1
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 +103 -1
- package/dist/_virtual/_rolldown/runtime.mjs +5 -0
- package/dist/adapters/_fetch-adapter.d.mts +18 -0
- package/dist/adapters/_fetch-adapter.mjs +53 -0
- package/dist/adapters/astro.d.mts +15 -0
- package/dist/adapters/astro.mjs +31 -0
- package/dist/adapters/aws-lambda.d.mts +42 -0
- package/dist/adapters/aws-lambda.mjs +92 -0
- package/dist/adapters/express.d.mts +16 -0
- package/dist/adapters/express.mjs +110 -0
- package/dist/adapters/message-port.d.mts +42 -0
- package/dist/adapters/message-port.mjs +132 -0
- package/dist/adapters/nestjs.d.mts +25 -0
- package/dist/adapters/nestjs.mjs +83 -0
- package/dist/adapters/nextjs.d.mts +14 -0
- package/dist/adapters/nextjs.mjs +29 -0
- package/dist/adapters/peer.d.mts +27 -0
- package/dist/adapters/peer.mjs +36 -0
- package/dist/adapters/remix.d.mts +15 -0
- package/dist/adapters/remix.mjs +30 -0
- package/dist/adapters/solidstart.d.mts +12 -0
- package/dist/adapters/solidstart.mjs +29 -0
- package/dist/adapters/sveltekit.d.mts +14 -0
- package/dist/adapters/sveltekit.mjs +30 -0
- package/dist/broker/index.d.mts +62 -0
- package/dist/broker/index.mjs +153 -0
- package/dist/broker/nats.d.mts +33 -0
- package/dist/broker/nats.mjs +31 -0
- package/dist/broker/redis.d.mts +51 -0
- package/dist/broker/redis.mjs +92 -0
- package/dist/builder.d.mts +55 -0
- package/dist/builder.mjs +70 -0
- package/dist/callable.d.mts +19 -0
- package/dist/callable.mjs +42 -0
- package/dist/caller.mjs +90 -0
- package/dist/client/adapters/fetch/index.d.mts +15 -0
- package/dist/client/adapters/fetch/index.mjs +57 -0
- package/dist/client/adapters/ofetch/index.d.mts +55 -0
- package/dist/client/adapters/ofetch/index.mjs +91 -0
- package/dist/client/adapters/websocket/index.d.mts +20 -0
- package/dist/client/adapters/websocket/index.mjs +101 -0
- package/dist/client/client.d.mts +37 -0
- package/dist/client/client.mjs +80 -0
- package/dist/client/consume.d.mts +50 -0
- package/dist/client/consume.mjs +66 -0
- package/dist/client/dynamic-link.d.mts +16 -0
- package/dist/client/dynamic-link.mjs +19 -0
- package/dist/client/index.d.mts +6 -0
- package/dist/client/index.mjs +5 -0
- package/dist/client/interceptor.d.mts +31 -0
- package/dist/client/interceptor.mjs +34 -0
- package/dist/client/openapi.d.mts +29 -0
- package/dist/client/openapi.mjs +89 -0
- package/dist/client/plugins/batch.d.mts +26 -0
- package/dist/client/plugins/batch.mjs +64 -0
- package/dist/client/plugins/circuit-breaker.d.mts +24 -0
- package/dist/client/plugins/circuit-breaker.mjs +60 -0
- package/dist/client/plugins/csrf.d.mts +13 -0
- package/dist/client/plugins/csrf.mjs +20 -0
- package/dist/client/plugins/dedupe.d.mts +10 -0
- package/dist/client/plugins/dedupe.mjs +28 -0
- package/dist/client/plugins/index.d.mts +8 -0
- package/dist/client/plugins/index.mjs +8 -0
- package/dist/client/plugins/otel.d.mts +12 -0
- package/dist/client/plugins/otel.mjs +27 -0
- package/dist/client/plugins/retry.d.mts +34 -0
- package/dist/client/plugins/retry.mjs +79 -0
- package/dist/client/plugins/timeout.d.mts +10 -0
- package/dist/client/plugins/timeout.mjs +14 -0
- package/dist/client/server.d.mts +16 -0
- package/dist/client/server.mjs +59 -0
- package/dist/client/types.d.mts +29 -0
- package/dist/codec/devalue.d.mts +21 -0
- package/dist/codec/devalue.mjs +33 -0
- package/dist/codec/msgpack.d.mts +18 -0
- package/dist/codec/msgpack.mjs +45 -0
- package/dist/codec/sanitize.mjs +38 -0
- package/dist/codegen/emitters.d.mts +51 -0
- package/dist/codegen/emitters.mjs +143 -0
- package/dist/codegen/generate.d.mts +25 -0
- package/dist/codegen/generate.mjs +224 -0
- package/dist/codegen/index.d.mts +44 -0
- package/dist/codegen/index.mjs +103 -0
- package/dist/codegen/parse.d.mts +124 -0
- package/dist/codegen/parse.mjs +135 -0
- package/dist/codegen/preserve.d.mts +21 -0
- package/dist/codegen/preserve.mjs +62 -0
- package/dist/codegen/schema-to-code.d.mts +57 -0
- package/dist/codegen/schema-to-code.mjs +167 -0
- package/dist/compile.d.mts +46 -0
- package/dist/compile.mjs +332 -0
- package/dist/core/codec.mjs +67 -0
- package/dist/core/context-bridge.mjs +11 -0
- package/dist/core/dispatch.mjs +62 -0
- package/dist/core/error.d.mts +99 -60
- package/dist/core/error.mjs +125 -92
- package/dist/core/handler.d.mts +6 -0
- package/dist/core/handler.mjs +153 -0
- package/dist/core/input.mjs +49 -0
- package/dist/core/iterator.d.mts +17 -0
- package/dist/core/iterator.mjs +79 -0
- package/dist/core/router-utils.mjs +22 -0
- package/dist/core/schema.d.mts +20 -0
- package/dist/core/schema.mjs +33 -0
- package/dist/core/serve.d.mts +51 -0
- package/dist/core/serve.mjs +76 -0
- package/dist/core/sse.d.mts +18 -0
- package/dist/core/sse.mjs +110 -0
- package/dist/core/storage.d.mts +17 -4
- package/dist/core/storage.mjs +60 -13
- package/dist/core/task.d.mts +62 -0
- package/dist/core/task.mjs +165 -0
- package/dist/core/trace-map.d.mts +13 -0
- package/dist/core/trace-map.mjs +13 -0
- package/dist/core/url.mjs +28 -0
- package/dist/core/utils.mjs +24 -0
- package/dist/index.d.mts +17 -21
- package/dist/index.mjs +14 -22
- package/dist/integrations/ai/index.d.mts +25 -0
- package/dist/integrations/ai/index.mjs +117 -0
- package/dist/integrations/better-auth/index.d.mts +41 -0
- package/dist/integrations/better-auth/index.mjs +331 -0
- package/dist/integrations/drizzle/index.d.mts +27 -0
- package/dist/integrations/drizzle/index.mjs +285 -0
- package/dist/integrations/hey-api/index.d.mts +2 -0
- package/dist/integrations/hey-api/index.mjs +2 -0
- package/dist/integrations/hey-api/to-client.d.mts +20 -0
- package/dist/integrations/hey-api/to-client.mjs +39 -0
- package/dist/integrations/pinia-colada/general-utils.d.mts +13 -0
- package/dist/integrations/pinia-colada/general-utils.mjs +9 -0
- package/dist/integrations/pinia-colada/index.d.mts +6 -0
- package/dist/integrations/pinia-colada/index.mjs +5 -0
- package/dist/integrations/pinia-colada/key.d.mts +11 -0
- package/dist/integrations/pinia-colada/key.mjs +11 -0
- package/dist/integrations/pinia-colada/procedure-utils.d.mts +25 -0
- package/dist/integrations/pinia-colada/procedure-utils.mjs +33 -0
- package/dist/integrations/pinia-colada/router-utils.d.mts +17 -0
- package/dist/integrations/pinia-colada/router-utils.mjs +30 -0
- package/dist/integrations/pinia-colada/types.d.mts +25 -0
- package/dist/integrations/react/index.d.mts +83 -0
- package/dist/integrations/react/index.mjs +196 -0
- package/dist/integrations/tanstack-query/index.d.mts +120 -0
- package/dist/integrations/tanstack-query/index.mjs +100 -0
- package/dist/integrations/tanstack-query/ssr.d.mts +60 -0
- package/dist/integrations/tanstack-query/ssr.mjs +102 -0
- package/dist/integrations/zod/converter.d.mts +75 -0
- package/dist/integrations/zod/converter.mjs +345 -0
- package/dist/integrations/zod/index.d.mts +2 -0
- package/dist/integrations/zod/index.mjs +2 -0
- package/dist/lazy.d.mts +22 -0
- package/dist/lazy.mjs +34 -0
- package/dist/lifecycle.d.mts +36 -0
- package/dist/lifecycle.mjs +46 -0
- package/dist/map-input.d.mts +17 -0
- package/dist/map-input.mjs +47 -0
- package/dist/plugins/analytics/accumulator.d.mts +24 -0
- package/dist/plugins/analytics/accumulator.mjs +91 -0
- package/dist/plugins/analytics/alerts.d.mts +59 -0
- package/dist/plugins/analytics/alerts.mjs +140 -0
- package/dist/plugins/analytics/collector.d.mts +38 -0
- package/dist/plugins/analytics/collector.mjs +275 -0
- package/dist/plugins/analytics/cost.d.mts +61 -0
- package/dist/plugins/analytics/cost.mjs +97 -0
- package/dist/plugins/analytics/export.d.mts +7 -0
- package/dist/plugins/analytics/export.mjs +86 -0
- package/dist/plugins/analytics/normalize.mjs +144 -0
- package/dist/plugins/analytics/query.mjs +164 -0
- package/dist/plugins/analytics/request-id.mjs +34 -0
- package/dist/plugins/analytics/routes.d.mts +11 -0
- package/dist/plugins/analytics/routes.mjs +211 -0
- package/dist/plugins/analytics/sse.d.mts +31 -0
- package/dist/plugins/analytics/sse.mjs +74 -0
- package/dist/plugins/analytics/store.mjs +103 -0
- package/dist/plugins/analytics/timeseries.d.mts +50 -0
- package/dist/plugins/analytics/timeseries.mjs +169 -0
- package/dist/plugins/analytics/trace.d.mts +48 -0
- package/dist/plugins/analytics/trace.mjs +83 -0
- package/dist/plugins/analytics/types.d.mts +145 -0
- package/dist/plugins/analytics/types.mjs +40 -0
- package/dist/plugins/analytics/utils.d.mts +4 -0
- package/dist/plugins/analytics/utils.mjs +56 -0
- package/dist/plugins/analytics.d.mts +18 -0
- package/dist/plugins/analytics.mjs +188 -0
- package/dist/plugins/batch-server.d.mts +20 -0
- package/dist/plugins/batch-server.mjs +91 -0
- package/dist/plugins/body-limit.d.mts +19 -0
- package/dist/plugins/body-limit.mjs +49 -0
- package/dist/plugins/cache.d.mts +170 -0
- package/dist/plugins/cache.mjs +212 -0
- package/dist/plugins/coerce.d.mts +24 -0
- package/dist/plugins/coerce.mjs +70 -0
- package/dist/plugins/cookies.d.mts +14 -0
- package/dist/plugins/cookies.mjs +48 -0
- package/dist/plugins/cors.d.mts +43 -0
- package/dist/plugins/cors.mjs +62 -0
- package/dist/plugins/file-upload.d.mts +38 -0
- package/dist/plugins/file-upload.mjs +102 -0
- package/dist/plugins/index.d.mts +18 -0
- package/dist/plugins/index.mjs +17 -0
- package/dist/plugins/otel.d.mts +35 -0
- package/dist/plugins/otel.mjs +40 -0
- package/dist/plugins/pino.d.mts +60 -0
- package/dist/plugins/pino.mjs +42 -0
- package/dist/plugins/pubsub.d.mts +50 -0
- package/dist/plugins/pubsub.mjs +53 -0
- package/dist/plugins/ratelimit.d.mts +53 -0
- package/dist/plugins/ratelimit.mjs +92 -0
- package/dist/plugins/signing.d.mts +41 -0
- package/dist/plugins/signing.mjs +118 -0
- package/dist/plugins/strict-get.d.mts +10 -0
- package/dist/plugins/strict-get.mjs +33 -0
- package/dist/scalar.d.mts +49 -0
- package/dist/scalar.mjs +311 -0
- package/dist/silgi.d.mts +144 -0
- package/dist/silgi.mjs +164 -0
- package/dist/trpc-interop.d.mts +22 -0
- package/dist/trpc-interop.mjs +68 -0
- package/dist/types.d.mts +108 -0
- package/dist/ws.d.mts +88 -0
- package/dist/ws.mjs +205 -0
- package/lib/dashboard/index.html +120 -0
- package/lib/ocache.d.mts +1 -0
- package/lib/ocache.mjs +1 -0
- package/lib/ofetch.d.mts +1 -0
- package/lib/ofetch.mjs +1 -0
- package/lib/srvx.d.mts +1 -0
- package/lib/srvx.mjs +1 -0
- package/lib/unstorage.d.mts +1 -0
- package/lib/unstorage.mjs +1 -0
- package/package.json +313 -150
- package/dist/build.d.mts +0 -3
- package/dist/build.mjs +0 -4
- package/dist/cli/build/build.mjs +0 -15
- package/dist/cli/build/dev.d.mts +0 -10
- package/dist/cli/build/dev.mjs +0 -92
- package/dist/cli/build/prepare.d.mts +0 -6
- package/dist/cli/build/prepare.mjs +0 -15
- package/dist/cli/commands/commands.mjs +0 -90
- package/dist/cli/commands/env.mjs +0 -53
- package/dist/cli/commands/init.mjs +0 -84
- package/dist/cli/commands/install.mjs +0 -52
- package/dist/cli/commands/prepare.mjs +0 -65
- package/dist/cli/commands/reset.mjs +0 -46
- package/dist/cli/commands/run.mjs +0 -31
- package/dist/cli/commands/watch.mjs +0 -153
- package/dist/cli/config/defaults.mjs +0 -117
- package/dist/cli/config/index.d.mts +0 -3
- package/dist/cli/config/index.mjs +0 -4
- package/dist/cli/config/loader.d.mts +0 -6
- package/dist/cli/config/loader.mjs +0 -71
- package/dist/cli/config/resolvers/compatibility.mjs +0 -71
- package/dist/cli/config/resolvers/imports.mjs +0 -35
- package/dist/cli/config/resolvers/paths.mjs +0 -98
- package/dist/cli/config/resolvers/storage.mjs +0 -23
- package/dist/cli/config/resolvers/url.mjs +0 -9
- package/dist/cli/config/types.d.mts +0 -14
- package/dist/cli/config/types.mjs +0 -147
- package/dist/cli/core/apiful.mjs +0 -36
- package/dist/cli/core/devServer.mjs +0 -10
- package/dist/cli/core/env.mjs +0 -68
- package/dist/cli/core/installPackage.mjs +0 -60
- package/dist/cli/core/runtimeConfig.mjs +0 -70
- package/dist/cli/core/scan.mjs +0 -35
- package/dist/cli/core/silgi.mjs +0 -111
- package/dist/cli/framework/emptyFramework.mjs +0 -7
- package/dist/cli/framework/h3.mjs +0 -55
- package/dist/cli/framework/index.mjs +0 -15
- package/dist/cli/framework/nitro.mjs +0 -24
- package/dist/cli/framework/nuxt.mjs +0 -10
- package/dist/cli/index.d.mts +0 -1
- package/dist/cli/index.mjs +0 -29
- package/dist/cli/module/exportScan.mjs +0 -180
- package/dist/cli/module/install.mjs +0 -49
- package/dist/cli/module/scan.mjs +0 -193
- package/dist/cli/scan/prepareCommands.mjs +0 -40
- package/dist/cli/scan/prepareConfigs.mjs +0 -33
- package/dist/cli/scan/prepareCoreFile.mjs +0 -118
- package/dist/cli/scan/prepareScanFile.mjs +0 -59
- package/dist/cli/scan/prepareSchema.mjs +0 -128
- package/dist/cli/scan/scanExportFile.mjs +0 -288
- package/dist/cli/scan/writeCoreFile.mjs +0 -22
- package/dist/cli/scan/writeTypesAndFiles.mjs +0 -72
- package/dist/cli/utils/cancel.mjs +0 -14
- package/dist/cli/utils/common.mjs +0 -15
- package/dist/cli/utils/compatibility.mjs +0 -33
- package/dist/cli/utils/debug.mjs +0 -11
- package/dist/cli/utils/ignore.mjs +0 -56
- package/dist/cli/utils/processManager.mjs +0 -170
- package/dist/cli/utils/readScanFile.mjs +0 -58
- package/dist/cli/utils/storage.mjs +0 -23
- package/dist/core/context.d.mts +0 -30
- package/dist/core/context.mjs +0 -32
- package/dist/core/createSilgi.d.mts +0 -6
- package/dist/core/createSilgi.mjs +0 -153
- package/dist/core/event.d.mts +0 -26
- package/dist/core/event.mjs +0 -44
- package/dist/core/index.d.mts +0 -25
- package/dist/core/index.mjs +0 -30
- package/dist/core/orchestrate.mjs +0 -115
- package/dist/core/response.d.mts +0 -20
- package/dist/core/response.mjs +0 -105
- package/dist/core/silgi.d.mts +0 -19
- package/dist/core/silgi.mjs +0 -141
- package/dist/core/silgiApp.d.mts +0 -9
- package/dist/core/silgiApp.mjs +0 -23
- package/dist/core/unctx.d.mts +0 -21
- package/dist/core/unctx.mjs +0 -35
- package/dist/core/utils/event-stream.d.mts +0 -53
- package/dist/core/utils/event-stream.mjs +0 -38
- package/dist/core/utils/event.d.mts +0 -8
- package/dist/core/utils/event.mjs +0 -12
- package/dist/core/utils/internal/event-stream.d.mts +0 -45
- package/dist/core/utils/internal/event-stream.mjs +0 -137
- package/dist/core/utils/internal/obj.mjs +0 -9
- package/dist/core/utils/internal/object.mjs +0 -29
- package/dist/core/utils/internal/query.mjs +0 -73
- package/dist/core/utils/internal/req.mjs +0 -35
- package/dist/core/utils/merge.d.mts +0 -14
- package/dist/core/utils/merge.mjs +0 -27
- package/dist/core/utils/middleware.d.mts +0 -14
- package/dist/core/utils/middleware.mjs +0 -12
- package/dist/core/utils/request.mjs +0 -35
- package/dist/core/utils/resolver.d.mts +0 -7
- package/dist/core/utils/resolver.mjs +0 -29
- package/dist/core/utils/runtime.d.mts +0 -7
- package/dist/core/utils/runtime.mjs +0 -20
- package/dist/core/utils/sanitize.mjs +0 -22
- package/dist/core/utils/schema.d.mts +0 -34
- package/dist/core/utils/schema.mjs +0 -33
- package/dist/core/utils/service.d.mts +0 -13
- package/dist/core/utils/service.mjs +0 -19
- package/dist/core/utils/shared.d.mts +0 -6
- package/dist/core/utils/shared.mjs +0 -7
- package/dist/core/utils/storage.d.mts +0 -24
- package/dist/core/utils/storage.mjs +0 -54
- package/dist/kit/add/add-commands.d.mts +0 -6
- package/dist/kit/add/add-commands.mjs +0 -12
- package/dist/kit/add/add-core-file.d.mts +0 -9
- package/dist/kit/add/add-core-file.mjs +0 -11
- package/dist/kit/add/add-imports.d.mts +0 -14
- package/dist/kit/add/add-imports.mjs +0 -56
- package/dist/kit/add/add-npm.d.mts +0 -14
- package/dist/kit/add/add-npm.mjs +0 -23
- package/dist/kit/define.d.mts +0 -28
- package/dist/kit/define.mjs +0 -25
- package/dist/kit/errors.d.mts +0 -6
- package/dist/kit/errors.mjs +0 -11
- package/dist/kit/esm.d.mts +0 -11
- package/dist/kit/esm.mjs +0 -21
- package/dist/kit/fs.d.mts +0 -4
- package/dist/kit/fs.mjs +0 -13
- package/dist/kit/function-utils.d.mts +0 -27
- package/dist/kit/function-utils.mjs +0 -75
- package/dist/kit/gen.d.mts +0 -5
- package/dist/kit/gen.mjs +0 -26
- package/dist/kit/hash.d.mts +0 -4
- package/dist/kit/hash.mjs +0 -10
- package/dist/kit/index.d.mts +0 -22
- package/dist/kit/index.mjs +0 -23
- package/dist/kit/isFramework.d.mts +0 -6
- package/dist/kit/isFramework.mjs +0 -21
- package/dist/kit/logger.d.mts +0 -6
- package/dist/kit/logger.mjs +0 -10
- package/dist/kit/migration.d.mts +0 -113
- package/dist/kit/migration.mjs +0 -301
- package/dist/kit/module.d.mts +0 -14
- package/dist/kit/module.mjs +0 -53
- package/dist/kit/path.d.mts +0 -7
- package/dist/kit/path.mjs +0 -26
- package/dist/kit/preset.d.mts +0 -8
- package/dist/kit/preset.mjs +0 -11
- package/dist/kit/resolve.d.mts +0 -37
- package/dist/kit/resolve.mjs +0 -82
- package/dist/kit/template.d.mts +0 -19
- package/dist/kit/template.mjs +0 -91
- package/dist/kit/useRequest.d.mts +0 -19
- package/dist/kit/useRequest.mjs +0 -63
- package/dist/kit/utils.d.mts +0 -34
- package/dist/kit/utils.mjs +0 -91
- package/dist/package.mjs +0 -176
- package/dist/presets/_all.gen.d.mts +0 -6
- package/dist/presets/_all.gen.mjs +0 -18
- package/dist/presets/_resolve.d.mts +0 -12
- package/dist/presets/_resolve.mjs +0 -57
- package/dist/presets/_types.gen.d.mts +0 -8
- package/dist/presets/_types.gen.mjs +0 -5
- package/dist/presets/h3/preset.d.mts +0 -6
- package/dist/presets/h3/preset.mjs +0 -35
- package/dist/presets/hono/preset.d.mts +0 -6
- package/dist/presets/hono/preset.mjs +0 -30
- package/dist/presets/index.d.mts +0 -3
- package/dist/presets/index.mjs +0 -3
- package/dist/presets/nitro/preset.d.mts +0 -6
- package/dist/presets/nitro/preset.mjs +0 -37
- package/dist/presets/npmpackage/preset.d.mts +0 -6
- package/dist/presets/npmpackage/preset.mjs +0 -29
- package/dist/presets/nuxt/preset.d.mts +0 -6
- package/dist/presets/nuxt/preset.mjs +0 -41
- package/dist/runtime/index.d.mts +0 -4
- package/dist/runtime/index.mjs +0 -5
- package/dist/runtime/internal/config.d.mts +0 -11
- package/dist/runtime/internal/config.mjs +0 -97
- package/dist/runtime/internal/debug.d.mts +0 -6
- package/dist/runtime/internal/debug.mjs +0 -11
- package/dist/runtime/internal/defu.d.mts +0 -4
- package/dist/runtime/internal/defu.mjs +0 -9
- package/dist/runtime/internal/index.d.mts +0 -7
- package/dist/runtime/internal/index.mjs +0 -8
- package/dist/runtime/internal/nitro.d.mts +0 -6
- package/dist/runtime/internal/nitro.mjs +0 -36
- package/dist/runtime/internal/nuxt.d.mts +0 -12
- package/dist/runtime/internal/nuxt.mjs +0 -16
- package/dist/runtime/internal/ofetch.d.mts +0 -8
- package/dist/runtime/internal/ofetch.mjs +0 -39
- package/dist/runtime/internal/plugin.d.mts +0 -7
- package/dist/runtime/internal/plugin.mjs +0 -8
- package/dist/types/cliConfig.d.mts +0 -288
- package/dist/types/cliConfig.mjs +0 -0
- package/dist/types/cliHooks.d.mts +0 -142
- package/dist/types/cliHooks.mjs +0 -0
- package/dist/types/compatibility.d.mts +0 -13
- package/dist/types/compatibility.mjs +0 -0
- package/dist/types/config.d.mts +0 -46
- package/dist/types/config.mjs +0 -0
- package/dist/types/dotenv.d.mts +0 -29
- package/dist/types/dotenv.mjs +0 -0
- package/dist/types/event.d.mts +0 -63
- package/dist/types/event.mjs +0 -0
- package/dist/types/global.d.mts +0 -24
- package/dist/types/global.mjs +0 -0
- package/dist/types/helper.d.mts +0 -25
- package/dist/types/helper.mjs +0 -0
- package/dist/types/hooks.d.mts +0 -37
- package/dist/types/hooks.mjs +0 -0
- package/dist/types/index.d.mts +0 -26
- package/dist/types/index.mjs +0 -0
- package/dist/types/kits.d.mts +0 -32
- package/dist/types/kits.mjs +0 -0
- package/dist/types/middleware.d.mts +0 -31
- package/dist/types/middleware.mjs +0 -0
- package/dist/types/module.d.mts +0 -102
- package/dist/types/module.mjs +0 -0
- package/dist/types/preset.d.mts +0 -20
- package/dist/types/preset.mjs +0 -0
- package/dist/types/route.d.mts +0 -59
- package/dist/types/route.mjs +0 -0
- package/dist/types/runtime/index.d.mts +0 -5
- package/dist/types/runtime/index.mjs +0 -0
- package/dist/types/runtime/nuxt.d.mts +0 -13
- package/dist/types/runtime/nuxt.mjs +0 -0
- package/dist/types/runtime/ofetch.d.mts +0 -14
- package/dist/types/runtime/ofetch.mjs +0 -0
- package/dist/types/runtime/plugin.d.mts +0 -8
- package/dist/types/runtime/plugin.mjs +0 -0
- package/dist/types/runtime/silgi.d.mts +0 -11
- package/dist/types/runtime/silgi.mjs +0 -0
- package/dist/types/schema.d.mts +0 -86
- package/dist/types/schema.mjs +0 -0
- package/dist/types/service.d.mts +0 -102
- package/dist/types/service.mjs +0 -0
- package/dist/types/shared.d.mts +0 -19
- package/dist/types/shared.mjs +0 -0
- package/dist/types/silgi.d.mts +0 -71
- package/dist/types/silgi.mjs +0 -0
- package/dist/types/silgiCLI.d.mts +0 -118
- package/dist/types/silgiCLI.mjs +0 -0
- package/dist/types/standard-schema.d.mts +0 -61
- package/dist/types/standard-schema.mjs +0 -0
- package/dist/types/storage.d.mts +0 -30
- package/dist/types/storage.mjs +0 -0
- package/dist/types/tree-kill.d.mts +0 -18
- package/dist/types/tree-kill.mjs +0 -0
- package/lib/config.d.mts +0 -7
- package/lib/config.mjs +0 -5
- package/lib/meta.d.mts +0 -4
- package/lib/meta.mjs +0 -6
- package/lib/runtime-meta.d.mts +0 -4
- package/lib/runtime-meta.mjs +0 -32
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
//#region src/core/utils/internal/event-stream.ts
|
|
2
|
-
/**
|
|
3
|
-
* A helper class for [server sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#event_stream_format)
|
|
4
|
-
*/
|
|
5
|
-
var EventStream = class {
|
|
6
|
-
_event;
|
|
7
|
-
_transformStream = new TransformStream();
|
|
8
|
-
_writer;
|
|
9
|
-
_encoder = new TextEncoder();
|
|
10
|
-
_writerIsClosed = false;
|
|
11
|
-
_paused = false;
|
|
12
|
-
_unsentData;
|
|
13
|
-
_disposed = false;
|
|
14
|
-
_handled = false;
|
|
15
|
-
constructor(event, opts = {}) {
|
|
16
|
-
this._event = event;
|
|
17
|
-
this._writer = this._transformStream.writable.getWriter();
|
|
18
|
-
this._writer.closed.then(() => {
|
|
19
|
-
this._writerIsClosed = true;
|
|
20
|
-
});
|
|
21
|
-
if (opts.autoclose !== false) this._event?.runtime?.node?.res?.once("close", () => this.close());
|
|
22
|
-
}
|
|
23
|
-
async push(message) {
|
|
24
|
-
if (typeof message === "string") {
|
|
25
|
-
await this._sendEvent({ data: message });
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
if (Array.isArray(message)) {
|
|
29
|
-
if (message.length === 0) return;
|
|
30
|
-
if (typeof message[0] === "string") {
|
|
31
|
-
const msgs = [];
|
|
32
|
-
for (const item of message) msgs.push({ data: item });
|
|
33
|
-
await this._sendEvents(msgs);
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
await this._sendEvents(message);
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
await this._sendEvent(message);
|
|
40
|
-
}
|
|
41
|
-
async _sendEvent(message) {
|
|
42
|
-
if (this._writerIsClosed) return;
|
|
43
|
-
if (this._paused && !this._unsentData) {
|
|
44
|
-
this._unsentData = formatEventStreamMessage(message);
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
if (this._paused) {
|
|
48
|
-
this._unsentData += formatEventStreamMessage(message);
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
await this._writer.write(this._encoder.encode(formatEventStreamMessage(message))).catch();
|
|
52
|
-
}
|
|
53
|
-
async _sendEvents(messages) {
|
|
54
|
-
if (this._writerIsClosed) return;
|
|
55
|
-
const payload = formatEventStreamMessages(messages);
|
|
56
|
-
if (this._paused && !this._unsentData) {
|
|
57
|
-
this._unsentData = payload;
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
if (this._paused) {
|
|
61
|
-
this._unsentData += payload;
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
await this._writer.write(this._encoder.encode(payload)).catch();
|
|
65
|
-
}
|
|
66
|
-
pause() {
|
|
67
|
-
this._paused = true;
|
|
68
|
-
}
|
|
69
|
-
get isPaused() {
|
|
70
|
-
return this._paused;
|
|
71
|
-
}
|
|
72
|
-
async resume() {
|
|
73
|
-
this._paused = false;
|
|
74
|
-
await this.flush();
|
|
75
|
-
}
|
|
76
|
-
async flush() {
|
|
77
|
-
if (this._writerIsClosed) return;
|
|
78
|
-
if (this._unsentData?.length) {
|
|
79
|
-
await this._writer.write(this._encoder.encode(this._unsentData));
|
|
80
|
-
this._unsentData = void 0;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Close the stream and the connection if the stream is being sent to the client
|
|
85
|
-
*/
|
|
86
|
-
async close() {
|
|
87
|
-
if (this._disposed) return;
|
|
88
|
-
if (!this._writerIsClosed) try {
|
|
89
|
-
await this._writer.close();
|
|
90
|
-
} catch {}
|
|
91
|
-
this._disposed = true;
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Triggers callback when the writable stream is closed.
|
|
95
|
-
* It is also triggered after calling the `close()` method.
|
|
96
|
-
*/
|
|
97
|
-
onClosed(cb) {
|
|
98
|
-
this._writer.closed.then(cb);
|
|
99
|
-
}
|
|
100
|
-
async send() {
|
|
101
|
-
setEventStreamHeaders(this._event);
|
|
102
|
-
this._event.res.status = 200;
|
|
103
|
-
this._handled = true;
|
|
104
|
-
return this._transformStream.readable;
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
function formatEventStreamMessage(message) {
|
|
108
|
-
let result = "";
|
|
109
|
-
if (message.id) result += `id: ${message.id}\n`;
|
|
110
|
-
if (message.event) result += `event: ${message.event}\n`;
|
|
111
|
-
if (typeof message.retry === "number" && Number.isInteger(message.retry)) result += `retry: ${message.retry}\n`;
|
|
112
|
-
result += `data: ${message.data}\n\n`;
|
|
113
|
-
return result;
|
|
114
|
-
}
|
|
115
|
-
function formatEventStreamMessages(messages) {
|
|
116
|
-
let result = "";
|
|
117
|
-
for (const msg of messages) result += formatEventStreamMessage(msg);
|
|
118
|
-
return result;
|
|
119
|
-
}
|
|
120
|
-
function setEventStreamHeaders(event) {
|
|
121
|
-
event.res.headers.set("content-type", "text/event-stream");
|
|
122
|
-
event.res.headers.set("cache-control", "private, no-cache, no-store, no-transform, must-revalidate, max-age=0");
|
|
123
|
-
event.res.headers.set("x-accel-buffering", "no");
|
|
124
|
-
if (!isHttp2Request(event)) event.res.headers.set("connection", "keep-alive");
|
|
125
|
-
}
|
|
126
|
-
function isHttp2Request(event) {
|
|
127
|
-
const rawHeaders = event.req.headers;
|
|
128
|
-
if (typeof rawHeaders.get === "function") try {
|
|
129
|
-
return rawHeaders.has(":path") || rawHeaders.has(":method");
|
|
130
|
-
} catch {
|
|
131
|
-
return false;
|
|
132
|
-
}
|
|
133
|
-
return ":path" in rawHeaders || ":method" in rawHeaders;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
//#endregion
|
|
137
|
-
export { EventStream };
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { EmptyObject } from "./obj.mjs";
|
|
2
|
-
|
|
3
|
-
//#region src/core/utils/internal/object.ts
|
|
4
|
-
/**
|
|
5
|
-
* Checks if a certain input has a given property.
|
|
6
|
-
* @param obj - The input to check.
|
|
7
|
-
* @param prop - The property to check for.
|
|
8
|
-
* @returns A boolean indicating whether the input is an object and has the property.
|
|
9
|
-
*/
|
|
10
|
-
function hasProp(obj, prop) {
|
|
11
|
-
try {
|
|
12
|
-
return prop in obj;
|
|
13
|
-
} catch {
|
|
14
|
-
return false;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
function isJSONSerializable(value, _type) {
|
|
18
|
-
if (value === null || value === void 0) return true;
|
|
19
|
-
if (_type !== "object") return _type === "boolean" || _type === "number" || _type === "string";
|
|
20
|
-
if (typeof value.toJSON === "function") return true;
|
|
21
|
-
if (Array.isArray(value)) return true;
|
|
22
|
-
if (typeof value.pipe === "function" || typeof value.pipeTo === "function") return false;
|
|
23
|
-
if (value instanceof EmptyObject) return true;
|
|
24
|
-
const proto = Object.getPrototypeOf(value);
|
|
25
|
-
return proto === Object.prototype || proto === null;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
//#endregion
|
|
29
|
-
export { hasProp, isJSONSerializable };
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { EmptyObject } from "./obj.mjs";
|
|
2
|
-
|
|
3
|
-
//#region src/core/utils/internal/query.ts
|
|
4
|
-
const plusRegex = /\+/g;
|
|
5
|
-
function parseQuery(input) {
|
|
6
|
-
const params = new EmptyObject();
|
|
7
|
-
if (!input || input === "?") return params;
|
|
8
|
-
const inputLength = input.length;
|
|
9
|
-
let key = "";
|
|
10
|
-
let value = "";
|
|
11
|
-
let startingIndex = -1;
|
|
12
|
-
let equalityIndex = -1;
|
|
13
|
-
let shouldDecodeKey = false;
|
|
14
|
-
let shouldDecodeValue = false;
|
|
15
|
-
let keyHasPlus = false;
|
|
16
|
-
let valueHasPlus = false;
|
|
17
|
-
let hasBothKeyValuePair = false;
|
|
18
|
-
let c = 0;
|
|
19
|
-
for (let i = 0; i < inputLength + 1; i++) {
|
|
20
|
-
c = i === inputLength ? 38 : input.charCodeAt(i);
|
|
21
|
-
switch (c) {
|
|
22
|
-
case 38: {
|
|
23
|
-
hasBothKeyValuePair = equalityIndex > startingIndex;
|
|
24
|
-
if (!hasBothKeyValuePair) equalityIndex = i;
|
|
25
|
-
key = input.slice(startingIndex + 1, equalityIndex);
|
|
26
|
-
if (hasBothKeyValuePair || key.length > 0) {
|
|
27
|
-
if (keyHasPlus) key = key.replace(plusRegex, " ");
|
|
28
|
-
if (shouldDecodeKey) try {
|
|
29
|
-
key = decodeURIComponent(key);
|
|
30
|
-
} catch {}
|
|
31
|
-
if (hasBothKeyValuePair) {
|
|
32
|
-
value = input.slice(equalityIndex + 1, i);
|
|
33
|
-
if (valueHasPlus) value = value.replace(plusRegex, " ");
|
|
34
|
-
if (shouldDecodeValue) try {
|
|
35
|
-
value = decodeURIComponent(value);
|
|
36
|
-
} catch {}
|
|
37
|
-
}
|
|
38
|
-
const currentValue = params[key];
|
|
39
|
-
if (currentValue === void 0) params[key] = value;
|
|
40
|
-
else if (Array.isArray(currentValue)) currentValue.push(value);
|
|
41
|
-
else params[key] = [currentValue, value];
|
|
42
|
-
}
|
|
43
|
-
value = "";
|
|
44
|
-
startingIndex = i;
|
|
45
|
-
equalityIndex = i;
|
|
46
|
-
shouldDecodeKey = false;
|
|
47
|
-
shouldDecodeValue = false;
|
|
48
|
-
keyHasPlus = false;
|
|
49
|
-
valueHasPlus = false;
|
|
50
|
-
break;
|
|
51
|
-
}
|
|
52
|
-
case 61: {
|
|
53
|
-
if (equalityIndex <= startingIndex) equalityIndex = i;
|
|
54
|
-
else shouldDecodeValue = true;
|
|
55
|
-
break;
|
|
56
|
-
}
|
|
57
|
-
case 43: {
|
|
58
|
-
if (equalityIndex > startingIndex) valueHasPlus = true;
|
|
59
|
-
else keyHasPlus = true;
|
|
60
|
-
break;
|
|
61
|
-
}
|
|
62
|
-
case 37: {
|
|
63
|
-
if (equalityIndex > startingIndex) shouldDecodeValue = true;
|
|
64
|
-
else shouldDecodeKey = true;
|
|
65
|
-
break;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
return params;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
//#endregion
|
|
73
|
-
export { parseQuery };
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { createError } from "../../error.mjs";
|
|
2
|
-
import { Buffer } from "node:buffer";
|
|
3
|
-
|
|
4
|
-
//#region src/core/utils/internal/req.ts
|
|
5
|
-
async function parseRequestInput(req) {
|
|
6
|
-
const contentType = req.headers.get("content-type") || "";
|
|
7
|
-
if (contentType.startsWith("application/json")) {
|
|
8
|
-
const text = await req.text();
|
|
9
|
-
if (!text) return void 0;
|
|
10
|
-
try {
|
|
11
|
-
return JSON.parse(text);
|
|
12
|
-
} catch {
|
|
13
|
-
throw createError({
|
|
14
|
-
statusCode: 400,
|
|
15
|
-
statusMessage: "Invalid JSON",
|
|
16
|
-
data: text
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
if (contentType.startsWith("application/x-www-form-urlencoded")) {
|
|
21
|
-
const text = await req.text();
|
|
22
|
-
return Object.fromEntries(new URLSearchParams(text));
|
|
23
|
-
}
|
|
24
|
-
if (contentType.startsWith("text/")) return await req.text();
|
|
25
|
-
if (contentType.startsWith("application/octet-stream")) {
|
|
26
|
-
const buffer = await req.arrayBuffer();
|
|
27
|
-
if (typeof File !== "undefined") return new File([buffer], "uploaded.bin", { type: contentType });
|
|
28
|
-
if (typeof Buffer !== "undefined") return Buffer.from(buffer);
|
|
29
|
-
return new Uint8Array(buffer);
|
|
30
|
-
}
|
|
31
|
-
return await req.text();
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
//#endregion
|
|
35
|
-
export { parseRequestInput };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { MergeAll } from "silgi/types";
|
|
2
|
-
|
|
3
|
-
//#region src/core/utils/merge.d.ts
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Merges multiple service definition objects into a single object.
|
|
7
|
-
* Performs a complete deep merge of all service definition objects.
|
|
8
|
-
* @template T - A tuple type representing the array of service definition objects to merge.
|
|
9
|
-
* @param {T} schemas - An array of service definition objects created by `createSchema`.
|
|
10
|
-
* @returns {MergeAll<T>} A single object containing all merged service definitions.
|
|
11
|
-
*/
|
|
12
|
-
declare function deepMergeObjects<T extends readonly Record<string, any>[]>(schemas: [...T]): MergeAll<T>;
|
|
13
|
-
//#endregion
|
|
14
|
-
export { deepMergeObjects as deepMergeObjects$1 };
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
//#region src/core/utils/merge.ts
|
|
2
|
-
/**
|
|
3
|
-
* Deeply merges two objects. Arrays and non-objects are overwritten.
|
|
4
|
-
*/
|
|
5
|
-
function deepMerge(target, source) {
|
|
6
|
-
if (typeof target !== "object" || target === null) return source;
|
|
7
|
-
if (typeof source !== "object" || source === null) return source;
|
|
8
|
-
const result = Array.isArray(target) ? [...target] : { ...target };
|
|
9
|
-
for (const key of Object.keys(source)) if (key in target) result[key] = deepMerge(target[key], source[key]);
|
|
10
|
-
else result[key] = source[key];
|
|
11
|
-
return result;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Merges multiple service definition objects into a single object.
|
|
15
|
-
* Performs a complete deep merge of all service definition objects.
|
|
16
|
-
* @template T - A tuple type representing the array of service definition objects to merge.
|
|
17
|
-
* @param {T} schemas - An array of service definition objects created by `createSchema`.
|
|
18
|
-
* @returns {MergeAll<T>} A single object containing all merged service definitions.
|
|
19
|
-
*/
|
|
20
|
-
function deepMergeObjects(schemas) {
|
|
21
|
-
let merged = {};
|
|
22
|
-
for (const schema of schemas) merged = deepMerge(merged, schema);
|
|
23
|
-
return merged;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
//#endregion
|
|
27
|
-
export { deepMergeObjects };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { CreateMiddlewareParams, HTTPMethod, MiddlewarePath, MiddlewareSetup, Routers, WildcardVariants } from "silgi/types";
|
|
2
|
-
|
|
3
|
-
//#region src/core/utils/middleware.d.ts
|
|
4
|
-
type CreateMiddlewareResult<Path extends string, UsedMethod extends readonly HTTPMethod[] = readonly HTTPMethod[], Key extends string = string> = { [K in `${Key}:${Path}`]: {
|
|
5
|
-
setup: MiddlewareSetup;
|
|
6
|
-
methods?: UsedMethod;
|
|
7
|
-
key: Key;
|
|
8
|
-
path: Path;
|
|
9
|
-
} };
|
|
10
|
-
declare function createMiddleware<S extends WildcardVariants<keyof Routers>, UsedMethod extends readonly HTTPMethod[] = readonly HTTPMethod[], Path extends MiddlewarePath<S> = MiddlewarePath<S>, Key extends string = string>(params: CreateMiddlewareParams<S, UsedMethod, Key> & {
|
|
11
|
-
path: Path;
|
|
12
|
-
}): CreateMiddlewareResult<Path, UsedMethod, Key>;
|
|
13
|
-
//#endregion
|
|
14
|
-
export { CreateMiddlewareResult, createMiddleware as createMiddleware$1 };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
//#region src/core/utils/middleware.ts
|
|
2
|
-
function createMiddleware(params) {
|
|
3
|
-
return { [`${params.key}:${params.path}`]: {
|
|
4
|
-
setup: params.setup,
|
|
5
|
-
methods: params.methods?.length ? params.methods : ["ALL"],
|
|
6
|
-
key: params.key,
|
|
7
|
-
path: params.path
|
|
8
|
-
} };
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
//#endregion
|
|
12
|
-
export { createMiddleware };
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { parseQuery } from "./internal/query.mjs";
|
|
2
|
-
|
|
3
|
-
//#region src/core/utils/request.ts
|
|
4
|
-
/**
|
|
5
|
-
* Get parsed query string object from the request URL.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* app.get("/", (event) => {
|
|
9
|
-
* const query = getQuery(event); // { key: "value", key2: ["value1", "value2"] }
|
|
10
|
-
* });
|
|
11
|
-
*/
|
|
12
|
-
function getQuery(event) {
|
|
13
|
-
return parseQuery(event.url.search.slice(1));
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Get matched route params.
|
|
17
|
-
*
|
|
18
|
-
* If `decode` option is `true`, it will decode the matched route params using `decodeURIComponent`.
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* app.get("/", (event) => {
|
|
22
|
-
* const params = getRouterParams(event); // { key: "value" }
|
|
23
|
-
* });
|
|
24
|
-
*/
|
|
25
|
-
function getRouterParams(event, opts = {}) {
|
|
26
|
-
let params = event.context.params || {};
|
|
27
|
-
if (opts.decode) {
|
|
28
|
-
params = { ...params };
|
|
29
|
-
for (const key in params) if (params[key] !== void 0) params[key] = decodeURIComponent(params[key]);
|
|
30
|
-
}
|
|
31
|
-
return params;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
//#endregion
|
|
35
|
-
export { getQuery, getRouterParams };
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Resolvers, SilgiURL } from "silgi/types";
|
|
2
|
-
|
|
3
|
-
//#region src/core/utils/resolver.d.ts
|
|
4
|
-
declare function createResolver(resolver: Resolvers): Resolvers;
|
|
5
|
-
declare function getUrlPrefix(path: string, method?: string): SilgiURL;
|
|
6
|
-
//#endregion
|
|
7
|
-
export { createResolver as createResolver$3, getUrlPrefix as getUrlPrefix$1 };
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { createError } from "../error.mjs";
|
|
2
|
-
import { FastURL } from "srvx";
|
|
3
|
-
|
|
4
|
-
//#region src/core/utils/resolver.ts
|
|
5
|
-
function createResolver(resolver) {
|
|
6
|
-
return resolver;
|
|
7
|
-
}
|
|
8
|
-
function getUrlPrefix(path, method) {
|
|
9
|
-
const parse = path.includes("://") ? new FastURL(path) : new URL(path, "http://localhost");
|
|
10
|
-
const cleanedPath = parse.pathname + parse.search + parse.hash;
|
|
11
|
-
const segments = cleanedPath.split("/").filter(Boolean);
|
|
12
|
-
if (segments.length < 2) throw createError({
|
|
13
|
-
statusCode: 400,
|
|
14
|
-
statusMessage: "Invalid URL format",
|
|
15
|
-
data: { cleanedPath }
|
|
16
|
-
});
|
|
17
|
-
const prefix = `/${segments[0]}`;
|
|
18
|
-
const namespace = segments[1];
|
|
19
|
-
return {
|
|
20
|
-
namespaceName: namespace,
|
|
21
|
-
prefixName: prefix,
|
|
22
|
-
raw: path,
|
|
23
|
-
path: cleanedPath,
|
|
24
|
-
methodName: method || "GET"
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
//#endregion
|
|
29
|
-
export { createResolver, getUrlPrefix };
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
//#region src/core/utils/runtime.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* Recursively replaces values starting with 'runtime.' with their actual values from runtime config
|
|
4
|
-
*/
|
|
5
|
-
declare function replaceRuntimeValues(obj: any, runtime: any): any;
|
|
6
|
-
//#endregion
|
|
7
|
-
export { replaceRuntimeValues as replaceRuntimeValues$1 };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
//#region src/core/utils/runtime.ts
|
|
2
|
-
/**
|
|
3
|
-
* Recursively replaces values starting with 'runtime.' with their actual values from runtime config
|
|
4
|
-
*/
|
|
5
|
-
function replaceRuntimeValues(obj, runtime) {
|
|
6
|
-
if (!obj || typeof obj !== "object") return obj;
|
|
7
|
-
for (const key in obj) if (typeof obj[key] === "string" && obj[key].startsWith("runtime.")) {
|
|
8
|
-
const runtimePath = obj[key].substring(8).split(".");
|
|
9
|
-
let value = runtime;
|
|
10
|
-
for (const segment of runtimePath) {
|
|
11
|
-
if (value === void 0 || value === null) break;
|
|
12
|
-
value = value[segment];
|
|
13
|
-
}
|
|
14
|
-
if (value !== void 0) obj[key] = value;
|
|
15
|
-
} else if (typeof obj[key] === "object" && obj[key] !== null) obj[key] = replaceRuntimeValues(obj[key], runtime);
|
|
16
|
-
return obj;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
//#endregion
|
|
20
|
-
export { replaceRuntimeValues };
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
//#region src/core/utils/sanitize.ts
|
|
2
|
-
const DISALLOWED_STATUS_CHARS = /[^\u0009\u0020-\u007E]/g;
|
|
3
|
-
/**
|
|
4
|
-
* Make sure the status message is safe to use in a response.
|
|
5
|
-
*
|
|
6
|
-
* Allowed characters: horizontal tabs, spaces or visible ascii characters: https://www.rfc-editor.org/rfc/rfc7230#section-3.1.2
|
|
7
|
-
*/
|
|
8
|
-
function sanitizeStatusMessage(statusMessage = "") {
|
|
9
|
-
return statusMessage.replace(DISALLOWED_STATUS_CHARS, "");
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Make sure the status code is a valid HTTP status code.
|
|
13
|
-
*/
|
|
14
|
-
function sanitizeStatusCode(statusCode, defaultStatusCode = 200) {
|
|
15
|
-
if (!statusCode) return defaultStatusCode;
|
|
16
|
-
if (typeof statusCode === "string") statusCode = Number.parseInt(statusCode, 10);
|
|
17
|
-
if (statusCode < 100 || statusCode > 999) return defaultStatusCode;
|
|
18
|
-
return statusCode;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
//#endregion
|
|
22
|
-
export { sanitizeStatusCode, sanitizeStatusMessage };
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { BaseMethodSchema } from "silgi/types";
|
|
2
|
-
|
|
3
|
-
//#region src/core/utils/schema.d.ts
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Creates a type-safe API route schema definition.
|
|
7
|
-
*
|
|
8
|
-
* This utility function helps you define API schemas with proper typing for
|
|
9
|
-
* input, output, path parameters, and query parameters.
|
|
10
|
-
*
|
|
11
|
-
* @template Key - API key
|
|
12
|
-
* @template Schema - Schema definition type
|
|
13
|
-
*
|
|
14
|
-
* @param params - Schema configuration parameters
|
|
15
|
-
* @param params.key - Unique key for the schema
|
|
16
|
-
* @param params.setup - Schema definition for the specified methods
|
|
17
|
-
* @returns Route schema object with complete type information
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* // Define a user API schema
|
|
21
|
-
* const userSchema = createSchema({
|
|
22
|
-
* key: '/api/v1/users',
|
|
23
|
-
* setup: {
|
|
24
|
-
* output: z.object({
|
|
25
|
-
* users: z.array(z.object({ id: z.string(), name: z.string() }))
|
|
26
|
-
* })
|
|
27
|
-
* }
|
|
28
|
-
* });
|
|
29
|
-
*/
|
|
30
|
-
declare function createSchema<Key extends string, Schema extends BaseMethodSchema>(params: {
|
|
31
|
-
key: Key;
|
|
32
|
-
} & Schema): { [K in Key]: Schema };
|
|
33
|
-
//#endregion
|
|
34
|
-
export { createSchema as createSchema$1 };
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
//#region src/core/utils/schema.ts
|
|
2
|
-
/**
|
|
3
|
-
* Creates a type-safe API route schema definition.
|
|
4
|
-
*
|
|
5
|
-
* This utility function helps you define API schemas with proper typing for
|
|
6
|
-
* input, output, path parameters, and query parameters.
|
|
7
|
-
*
|
|
8
|
-
* @template Key - API key
|
|
9
|
-
* @template Schema - Schema definition type
|
|
10
|
-
*
|
|
11
|
-
* @param params - Schema configuration parameters
|
|
12
|
-
* @param params.key - Unique key for the schema
|
|
13
|
-
* @param params.setup - Schema definition for the specified methods
|
|
14
|
-
* @returns Route schema object with complete type information
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* // Define a user API schema
|
|
18
|
-
* const userSchema = createSchema({
|
|
19
|
-
* key: '/api/v1/users',
|
|
20
|
-
* setup: {
|
|
21
|
-
* output: z.object({
|
|
22
|
-
* users: z.array(z.object({ id: z.string(), name: z.string() }))
|
|
23
|
-
* })
|
|
24
|
-
* }
|
|
25
|
-
* });
|
|
26
|
-
*/
|
|
27
|
-
function createSchema(params) {
|
|
28
|
-
const { key,...object } = params;
|
|
29
|
-
return { [key]: object };
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
//#endregion
|
|
33
|
-
export { createSchema };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { HTTPMethod, Routers, ServiceSetup, StandardSchemaV1, WebSocketServiceSetup } from "silgi/types";
|
|
2
|
-
|
|
3
|
-
//#region src/core/utils/service.d.ts
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* ServiceSetup tipinden oluşan bir yardımcı fonksiyon.
|
|
7
|
-
* Tip güvenliğini artırmak için ServiceSetup objesini doğrudan döndürür.
|
|
8
|
-
*/
|
|
9
|
-
declare function defineServiceSetup<Method extends HTTPMethod, Path extends keyof Routers, Input extends StandardSchemaV1 = StandardSchemaV1, Output extends StandardSchemaV1 = StandardSchemaV1, PathParams extends StandardSchemaV1 | undefined | never = undefined, QueryParams extends StandardSchemaV1 | undefined | never = undefined, Resolved extends boolean = false, HiddenParameters extends boolean = false>(setup: Omit<ServiceSetup<Method, Path, Input, Output, PathParams, QueryParams, Resolved, HiddenParameters>, "method" | "path">): Omit<ServiceSetup<Method, Path, Input, Output, PathParams, QueryParams, Resolved, HiddenParameters>, "method" | "path">;
|
|
10
|
-
declare function createService<Path extends string, Method extends HTTPMethod, Input extends StandardSchemaV1 = StandardSchemaV1, Output extends StandardSchemaV1 = StandardSchemaV1, PathParams extends StandardSchemaV1 | undefined | never = undefined, QueryParams extends StandardSchemaV1 | undefined | never = undefined, Resolved extends boolean = false, HiddenParameters extends boolean = false>(params: ServiceSetup<Method, Path, Input, Output, PathParams, QueryParams, Resolved, HiddenParameters>): Record<`http:${Method}:${Path}`, ServiceSetup<Method, Path, Input, Output, PathParams, QueryParams, Resolved, HiddenParameters>>;
|
|
11
|
-
declare function createWebSocket<Path extends string, Method extends HTTPMethod>(params: WebSocketServiceSetup<Method, Path>): Record<`websocket:${Method}:${Path}`, WebSocketServiceSetup<Method, Path>>;
|
|
12
|
-
//#endregion
|
|
13
|
-
export { createService as createService$1, createWebSocket as createWebSocket$1, defineServiceSetup as defineServiceSetup$1 };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
//#region src/core/utils/service.ts
|
|
2
|
-
/**
|
|
3
|
-
* ServiceSetup tipinden oluşan bir yardımcı fonksiyon.
|
|
4
|
-
* Tip güvenliğini artırmak için ServiceSetup objesini doğrudan döndürür.
|
|
5
|
-
*/
|
|
6
|
-
function defineServiceSetup(setup) {
|
|
7
|
-
return setup;
|
|
8
|
-
}
|
|
9
|
-
function createService(params) {
|
|
10
|
-
const method = params.method || "ALL";
|
|
11
|
-
return { [`http:${method}:${params.path}`]: params };
|
|
12
|
-
}
|
|
13
|
-
function createWebSocket(params) {
|
|
14
|
-
const method = params.method || "ALL";
|
|
15
|
-
return { [`websocket:${method}:${params.path}`]: params };
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
//#endregion
|
|
19
|
-
export { createService, createWebSocket, defineServiceSetup };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Storage, StorageValue } from "unstorage";
|
|
2
|
-
import { Silgi, StorageConfig } from "silgi/types";
|
|
3
|
-
|
|
4
|
-
//#region src/core/utils/storage.d.ts
|
|
5
|
-
declare function createStorage$1(silgi: Silgi): Promise<Storage<StorageValue>>;
|
|
6
|
-
// export async function snapshotStorage(silgi: Silgi) {
|
|
7
|
-
// const data: Record<string, any> = {}
|
|
8
|
-
// const allKeys = [
|
|
9
|
-
// ...new Set(
|
|
10
|
-
// await Promise.all(
|
|
11
|
-
// silgi.options.bundledStorage.map((base: string | undefined) => silgi.storage.getKeys(base)),
|
|
12
|
-
// ).then(r => r.flat()),
|
|
13
|
-
// ),
|
|
14
|
-
// ]
|
|
15
|
-
// await Promise.all(
|
|
16
|
-
// allKeys.map(async (key) => {
|
|
17
|
-
// data[key] = await silgi.storage.getItem(key)
|
|
18
|
-
// }),
|
|
19
|
-
// )
|
|
20
|
-
// return data
|
|
21
|
-
// }
|
|
22
|
-
declare function useSilgiStorage<T extends StorageValue = StorageValue>(base?: StorageConfig<T>["base"] | (string & {})): Storage<T>;
|
|
23
|
-
//#endregion
|
|
24
|
-
export { createStorage$1, useSilgiStorage as useSilgiStorage$1 };
|