silgi 0.43.28 → 0.50.0
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 +314 -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 -91
- 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,170 +0,0 @@
|
|
|
1
|
-
import consola from "consola";
|
|
2
|
-
import { execSync } from "node:child_process";
|
|
3
|
-
|
|
4
|
-
//#region src/cli/utils/processManager.ts
|
|
5
|
-
const isWindows = process.platform === "win32";
|
|
6
|
-
/**
|
|
7
|
-
* Get all processes using a specific port
|
|
8
|
-
*/
|
|
9
|
-
async function getProcessesOnPort(port) {
|
|
10
|
-
const processes = [];
|
|
11
|
-
try {
|
|
12
|
-
if (isWindows) {
|
|
13
|
-
const output = execSync("netstat -ano", { encoding: "utf8" });
|
|
14
|
-
const lines = output.split("\n");
|
|
15
|
-
for (const line of lines) if (line.includes(`:${port}`) && line.includes("LISTENING")) {
|
|
16
|
-
const parts = line.trim().split(/\s+/);
|
|
17
|
-
const pidStr = parts[parts.length - 1];
|
|
18
|
-
if (!pidStr) continue;
|
|
19
|
-
const pid = Number.parseInt(pidStr);
|
|
20
|
-
if (pid && pid !== 0 && !Number.isNaN(pid)) try {
|
|
21
|
-
const taskList = execSync(`tasklist /FI "PID eq ${pid}" /FO CSV`, { encoding: "utf8" });
|
|
22
|
-
const lines$1 = taskList.split("\n");
|
|
23
|
-
const processLine = lines$1[1];
|
|
24
|
-
if (processLine) {
|
|
25
|
-
const namePart = processLine.split(",")[0];
|
|
26
|
-
if (namePart) {
|
|
27
|
-
const name = namePart.replace(/"/g, "");
|
|
28
|
-
processes.push({
|
|
29
|
-
pid,
|
|
30
|
-
name,
|
|
31
|
-
port
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
} catch {
|
|
36
|
-
processes.push({
|
|
37
|
-
pid,
|
|
38
|
-
name: "unknown",
|
|
39
|
-
port
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
} else try {
|
|
44
|
-
const output = execSync(`lsof -i:${port} -P -n`, { encoding: "utf8" });
|
|
45
|
-
const lines = output.split("\n").slice(1);
|
|
46
|
-
for (const line of lines) if (line.trim()) {
|
|
47
|
-
const parts = line.trim().split(/\s+/);
|
|
48
|
-
const name = parts[0];
|
|
49
|
-
const pidStr = parts[1];
|
|
50
|
-
if (!name || !pidStr) continue;
|
|
51
|
-
const pid = Number.parseInt(pidStr);
|
|
52
|
-
if (pid && !Number.isNaN(pid) && !processes.some((p) => p.pid === pid)) processes.push({
|
|
53
|
-
pid,
|
|
54
|
-
name,
|
|
55
|
-
port
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
} catch {}
|
|
59
|
-
} catch (error) {
|
|
60
|
-
consola.debug(`Failed to get processes on port ${port}:`, error);
|
|
61
|
-
}
|
|
62
|
-
return processes;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Kill a process and all its children
|
|
66
|
-
*/
|
|
67
|
-
async function killProcessTree(pid, signal = "SIGKILL") {
|
|
68
|
-
try {
|
|
69
|
-
if (isWindows) {
|
|
70
|
-
execSync(`taskkill /F /T /PID ${pid}`, { stdio: "ignore" });
|
|
71
|
-
return true;
|
|
72
|
-
} else try {
|
|
73
|
-
process.kill(-pid, signal);
|
|
74
|
-
return true;
|
|
75
|
-
} catch {
|
|
76
|
-
process.kill(pid, signal);
|
|
77
|
-
return true;
|
|
78
|
-
}
|
|
79
|
-
} catch (error) {
|
|
80
|
-
consola.debug(`Failed to kill process ${pid}:`, error);
|
|
81
|
-
return false;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Kill all processes on a specific port
|
|
86
|
-
*/
|
|
87
|
-
async function killPortProcesses(port) {
|
|
88
|
-
const processes = await getProcessesOnPort(port);
|
|
89
|
-
let killedCount = 0;
|
|
90
|
-
for (const proc of processes) {
|
|
91
|
-
consola.info(`Killing ${proc.name} (PID: ${proc.pid}) on port ${port}`);
|
|
92
|
-
if (await killProcessTree(proc.pid)) killedCount++;
|
|
93
|
-
}
|
|
94
|
-
return killedCount;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Find and kill all Node.js processes in a directory
|
|
98
|
-
*/
|
|
99
|
-
async function killNodeProcessesInDirectory(directory) {
|
|
100
|
-
let killedCount = 0;
|
|
101
|
-
try {
|
|
102
|
-
if (isWindows) {
|
|
103
|
-
const output = execSync("wmic process where \"name='node.exe'\" get ProcessId,CommandLine /FORMAT:CSV", {
|
|
104
|
-
encoding: "utf8",
|
|
105
|
-
stdio: [
|
|
106
|
-
"ignore",
|
|
107
|
-
"pipe",
|
|
108
|
-
"ignore"
|
|
109
|
-
]
|
|
110
|
-
});
|
|
111
|
-
const lines = output.split("\n");
|
|
112
|
-
for (const line of lines) if (line.includes(directory)) {
|
|
113
|
-
const parts = line.split(",");
|
|
114
|
-
const pidStr = parts[parts.length - 1];
|
|
115
|
-
if (!pidStr) continue;
|
|
116
|
-
const pid = Number.parseInt(pidStr);
|
|
117
|
-
if (pid && !Number.isNaN(pid)) {
|
|
118
|
-
consola.info(`Killing node process ${pid} in ${directory}`);
|
|
119
|
-
if (await killProcessTree(pid)) killedCount++;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
} else {
|
|
123
|
-
const output = execSync("ps aux", { encoding: "utf8" });
|
|
124
|
-
const lines = output.split("\n");
|
|
125
|
-
for (const line of lines) if (line.includes("node") && line.includes(directory)) {
|
|
126
|
-
const parts = line.trim().split(/\s+/);
|
|
127
|
-
const pidStr = parts[1];
|
|
128
|
-
if (!pidStr) continue;
|
|
129
|
-
const pid = Number.parseInt(pidStr);
|
|
130
|
-
if (pid && !Number.isNaN(pid)) {
|
|
131
|
-
consola.info(`Killing node process ${pid} in ${directory}`);
|
|
132
|
-
if (await killProcessTree(pid)) killedCount++;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
} catch (error) {
|
|
137
|
-
consola.debug("Failed to find node processes:", error);
|
|
138
|
-
}
|
|
139
|
-
return killedCount;
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Aggressive cleanup: kill all processes on common dev ports
|
|
143
|
-
*/
|
|
144
|
-
async function aggressiveCleanup() {
|
|
145
|
-
const commonPorts = [
|
|
146
|
-
3e3,
|
|
147
|
-
3001,
|
|
148
|
-
4e3,
|
|
149
|
-
5e3,
|
|
150
|
-
5173,
|
|
151
|
-
8080,
|
|
152
|
-
8e3,
|
|
153
|
-
9e3
|
|
154
|
-
];
|
|
155
|
-
consola.info("Performing aggressive cleanup...");
|
|
156
|
-
for (const port of commonPorts) {
|
|
157
|
-
const processes = await getProcessesOnPort(port);
|
|
158
|
-
if (processes.length > 0) {
|
|
159
|
-
consola.info(`Found ${processes.length} process(es) on port ${port}`);
|
|
160
|
-
await killPortProcesses(port);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
const cwd = process.cwd();
|
|
164
|
-
const killedInDir = await killNodeProcessesInDirectory(cwd);
|
|
165
|
-
if (killedInDir > 0) consola.info(`Killed ${killedInDir} node process(es) in ${cwd}`);
|
|
166
|
-
consola.success("Aggressive cleanup complete");
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
//#endregion
|
|
170
|
-
export { aggressiveCleanup, killPortProcesses, killProcessTree };
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { consola as consola$1 } from "consola";
|
|
2
|
-
import { resolve } from "pathe";
|
|
3
|
-
import { createUnimport } from "unimport";
|
|
4
|
-
import { promises } from "node:fs";
|
|
5
|
-
import { createJiti } from "dev-jiti";
|
|
6
|
-
|
|
7
|
-
//#region src/cli/utils/readScanFile.ts
|
|
8
|
-
async function readScanFile(silgi) {
|
|
9
|
-
const path = resolve(silgi.options.silgi.serverDir, "scan.ts");
|
|
10
|
-
const context = await promises.readFile(path, { encoding: "utf-8" });
|
|
11
|
-
silgi.unimport = createUnimport(silgi.options.imports || {});
|
|
12
|
-
await silgi.unimport.init();
|
|
13
|
-
const injectedResult = await silgi.unimport.injectImports(context, path);
|
|
14
|
-
if (!injectedResult) throw new Error("Failed to inject imports");
|
|
15
|
-
const jiti = createJiti(silgi.options.rootDir, {
|
|
16
|
-
fsCache: true,
|
|
17
|
-
moduleCache: false,
|
|
18
|
-
debug: silgi.options.debug === true,
|
|
19
|
-
alias: silgi.options.alias
|
|
20
|
-
});
|
|
21
|
-
try {
|
|
22
|
-
const scanFile = await jiti.evalModule(injectedResult.code, {
|
|
23
|
-
filename: path,
|
|
24
|
-
async: true,
|
|
25
|
-
conditions: silgi.options.conditions
|
|
26
|
-
}, async (data, name) => {
|
|
27
|
-
return (await silgi.unimport.injectImports(data, name)).code;
|
|
28
|
-
});
|
|
29
|
-
silgi.schemas = scanFile.schemas || {};
|
|
30
|
-
silgi.services = scanFile.services || {};
|
|
31
|
-
silgi.shareds = scanFile.shareds || {};
|
|
32
|
-
silgi.resolvers = scanFile.resolvers || {};
|
|
33
|
-
return {
|
|
34
|
-
context,
|
|
35
|
-
object: {
|
|
36
|
-
schemas: scanFile.schemas,
|
|
37
|
-
services: scanFile.services,
|
|
38
|
-
shareds: scanFile.shareds
|
|
39
|
-
},
|
|
40
|
-
path
|
|
41
|
-
};
|
|
42
|
-
} catch (error) {
|
|
43
|
-
if (silgi.options.debug) console.error("Failed to read scan.ts file:", error);
|
|
44
|
-
else consola$1.withTag("silgi").error(error);
|
|
45
|
-
return {
|
|
46
|
-
context,
|
|
47
|
-
object: {
|
|
48
|
-
schemas: {},
|
|
49
|
-
services: {},
|
|
50
|
-
shareds: {}
|
|
51
|
-
},
|
|
52
|
-
path
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
//#endregion
|
|
58
|
-
export { readScanFile };
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { replaceRuntimeValues } from "silgi";
|
|
2
|
-
import { useRuntimeConfig } from "silgi/runtime";
|
|
3
|
-
import { klona } from "klona";
|
|
4
|
-
import { builtinDrivers, createStorage } from "unstorage";
|
|
5
|
-
|
|
6
|
-
//#region src/cli/utils/storage.ts
|
|
7
|
-
async function createStorageCLI(silgi) {
|
|
8
|
-
const storage = createStorage();
|
|
9
|
-
const runtime = useRuntimeConfig();
|
|
10
|
-
const mounts = klona({
|
|
11
|
-
...silgi.options.storage,
|
|
12
|
-
...silgi.options.devStorage
|
|
13
|
-
});
|
|
14
|
-
for (const [path, opts] of Object.entries(mounts)) if (opts.driver) {
|
|
15
|
-
const driver = await import(builtinDrivers[opts.driver] || opts.driver).then((r) => r.default || r);
|
|
16
|
-
const processedOpts = replaceRuntimeValues({ ...opts }, runtime);
|
|
17
|
-
storage.mount(path, driver(processedOpts));
|
|
18
|
-
} else silgi.logger.warn(`No \`driver\` set for storage mount point "${path}".`);
|
|
19
|
-
return storage;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
//#endregion
|
|
23
|
-
export { createStorageCLI };
|
package/dist/core/context.d.mts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { SilgiRuntimeConfig } from "silgi/types";
|
|
2
|
-
|
|
3
|
-
//#region src/core/context.d.ts
|
|
4
|
-
declare function updateRuntimeStorage(runtime: any): void;
|
|
5
|
-
/** Direct access to the silgi context with asyncLocalStorage - see https://github.com/unjs/unctx. */
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Get access to silgi instance.
|
|
9
|
-
*
|
|
10
|
-
* Throws an error if silgi instance is unavailable.
|
|
11
|
-
* @example
|
|
12
|
-
* ```js
|
|
13
|
-
* const runtime = useRuntime()
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
|
-
declare function useRuntime(): SilgiRuntimeConfig;
|
|
17
|
-
/**
|
|
18
|
-
* Get access to Runtime instance.
|
|
19
|
-
*
|
|
20
|
-
* Returns null if Runtime instance is unavailable.
|
|
21
|
-
* @example
|
|
22
|
-
* ```js
|
|
23
|
-
* const runtime = tryUseRuntime()
|
|
24
|
-
* if (runtime) {
|
|
25
|
-
* // Do something
|
|
26
|
-
* }
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
|
-
//#endregion
|
|
30
|
-
export { updateRuntimeStorage as updateRuntimeStorage$1, useRuntime as useRuntime$1 };
|
package/dist/core/context.mjs
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { createContext } from "unctx";
|
|
2
|
-
import { AsyncLocalStorage } from "node:async_hooks";
|
|
3
|
-
|
|
4
|
-
//#region src/core/context.ts
|
|
5
|
-
/** async local storage for the name of the current silgi instance */
|
|
6
|
-
const asyncRuntimeStorage = createContext({
|
|
7
|
-
asyncContext: true,
|
|
8
|
-
AsyncLocalStorage
|
|
9
|
-
});
|
|
10
|
-
function updateRuntimeStorage(runtime) {
|
|
11
|
-
if (asyncRuntimeStorage.tryUse()) {
|
|
12
|
-
asyncRuntimeStorage.unset();
|
|
13
|
-
asyncRuntimeStorage.set(runtime);
|
|
14
|
-
} else asyncRuntimeStorage.set(runtime);
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Get access to silgi instance.
|
|
18
|
-
*
|
|
19
|
-
* Throws an error if silgi instance is unavailable.
|
|
20
|
-
* @example
|
|
21
|
-
* ```js
|
|
22
|
-
* const runtime = useRuntime()
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
function useRuntime() {
|
|
26
|
-
const instance = asyncRuntimeStorage.tryUse();
|
|
27
|
-
if (!instance) throw new Error("Runtime instance is unavailable!");
|
|
28
|
-
return instance;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
//#endregion
|
|
32
|
-
export { updateRuntimeStorage, useRuntime };
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import { silgiCtx } from "./unctx.mjs";
|
|
2
|
-
import { createStorage, useSilgiStorage } from "./utils/storage.mjs";
|
|
3
|
-
import { createConsola } from "consola";
|
|
4
|
-
import { createHooks } from "hookable";
|
|
5
|
-
import { getServicePath } from "silgi/kit";
|
|
6
|
-
import { sharedRuntimeConfig, useRuntimeConfig } from "silgi/runtime";
|
|
7
|
-
import { defu } from "defu";
|
|
8
|
-
import { toJsonSchema } from "@standard-community/standard-json";
|
|
9
|
-
import { addRoute, createRouter } from "rou3";
|
|
10
|
-
|
|
11
|
-
//#region src/core/createSilgi.ts
|
|
12
|
-
async function runSilgiPlugins(silgi) {
|
|
13
|
-
for (const plugin of silgi.plugins) try {
|
|
14
|
-
await plugin(silgi);
|
|
15
|
-
} catch (error) {
|
|
16
|
-
silgi.captureError(silgi, error, { tags: ["plugin"] });
|
|
17
|
-
throw error;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
async function createSilgi(config) {
|
|
21
|
-
const hooks = createHooks();
|
|
22
|
-
const silgi = {
|
|
23
|
-
router: void 0,
|
|
24
|
-
_middlewareRouter: void 0,
|
|
25
|
-
routerPrefixs: [],
|
|
26
|
-
schemas: config.schemas ?? {},
|
|
27
|
-
services: config.services ?? {},
|
|
28
|
-
resolvers: config.resolvers ?? [],
|
|
29
|
-
middlewares: config.middlewares ?? {},
|
|
30
|
-
globalMiddlewares: config.globalMiddlewares ?? [],
|
|
31
|
-
shared: config.shared ?? {},
|
|
32
|
-
plugins: config.plugins ?? [],
|
|
33
|
-
framework: config.framework ?? {},
|
|
34
|
-
storage: config.options.putStorage ?? void 0,
|
|
35
|
-
options: config.options ?? {},
|
|
36
|
-
hooks,
|
|
37
|
-
callHook: hooks.callHook,
|
|
38
|
-
addHooks: hooks.addHooks,
|
|
39
|
-
hook: hooks.hook,
|
|
40
|
-
ready: () => {
|
|
41
|
-
return hooks.callHook("ready", silgi);
|
|
42
|
-
},
|
|
43
|
-
envOptions: config.envOptions ?? {},
|
|
44
|
-
close: () => hooks.callHook("close", silgi),
|
|
45
|
-
logger: createConsola(defu(config.options?.consolaOptions ?? {}, { tag: "silgi" })).withTag("silgi"),
|
|
46
|
-
captureError: config.captureError ?? (() => {}),
|
|
47
|
-
websocket: config.websocket ?? void 0
|
|
48
|
-
};
|
|
49
|
-
sharedRuntimeConfig(silgi.options.runtimeConfig);
|
|
50
|
-
if (!silgi.router) silgi.router = createRouter();
|
|
51
|
-
for (const [_route, object] of Object.entries(silgi.services)) {
|
|
52
|
-
const { method, type } = getServicePath(_route);
|
|
53
|
-
if (!object) continue;
|
|
54
|
-
const path = String(object.path);
|
|
55
|
-
const routeParts = path.split("/").filter(Boolean);
|
|
56
|
-
if (routeParts.length > 0) {
|
|
57
|
-
const prefix = `/${routeParts[0]}`;
|
|
58
|
-
const prefixKey = `${type}:${prefix}`;
|
|
59
|
-
if (!silgi.routerPrefixs.includes(prefixKey)) silgi.routerPrefixs.push(prefixKey);
|
|
60
|
-
}
|
|
61
|
-
let routeWithParams = path;
|
|
62
|
-
let pathParamNames = {};
|
|
63
|
-
let queryParamNames = {};
|
|
64
|
-
if (object.pathParams) {
|
|
65
|
-
const jsonSchema = await toJsonSchema(object.pathParams);
|
|
66
|
-
if (jsonSchema && jsonSchema.properties) {
|
|
67
|
-
pathParamNames = Object.keys(jsonSchema.properties).reduce((acc, key) => {
|
|
68
|
-
const prop = jsonSchema.properties?.[key];
|
|
69
|
-
if (typeof prop === "object" && prop !== null && "type" in prop) acc[key] = prop.type ?? "string";
|
|
70
|
-
else acc[key] = "string";
|
|
71
|
-
return acc;
|
|
72
|
-
}, {});
|
|
73
|
-
const paramNames = Object.keys(jsonSchema.properties);
|
|
74
|
-
if (paramNames.length > 0) {
|
|
75
|
-
const routeParts$1 = routeWithParams.split("/");
|
|
76
|
-
const lastParts = routeParts$1.slice(-paramNames.length);
|
|
77
|
-
const alreadyHasParams = paramNames.every((name, idx) => lastParts[idx] === `:${name}`);
|
|
78
|
-
if (!alreadyHasParams) {
|
|
79
|
-
routeWithParams = routeWithParams.replace(/\/+$/, "");
|
|
80
|
-
for (const param of paramNames) routeWithParams += `/:${param}`;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
if (object.queryParams) {
|
|
86
|
-
const jsonSchema = await toJsonSchema(object.queryParams);
|
|
87
|
-
if (jsonSchema && jsonSchema.properties) queryParamNames = Object.keys(jsonSchema.properties).reduce((acc, key) => {
|
|
88
|
-
const prop = jsonSchema.properties?.[key];
|
|
89
|
-
if (typeof prop === "object" && prop !== null && "type" in prop) acc[key] = prop.type ?? "string";
|
|
90
|
-
else acc[key] = "string";
|
|
91
|
-
return acc;
|
|
92
|
-
}, {});
|
|
93
|
-
}
|
|
94
|
-
addRoute(silgi.router, method, routeWithParams, {
|
|
95
|
-
method,
|
|
96
|
-
route: routeWithParams,
|
|
97
|
-
service: object,
|
|
98
|
-
queryParams: queryParamNames,
|
|
99
|
-
pathParams: pathParamNames
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
if (!silgi._middlewareRouter) silgi._middlewareRouter = createRouter();
|
|
103
|
-
for (const [route, routeObject] of Object.entries(silgi.middlewares)) {
|
|
104
|
-
let _key = "";
|
|
105
|
-
let _route = "";
|
|
106
|
-
if (route.includes(":")) {
|
|
107
|
-
const [methodPart, ...routeParts] = route.split(":");
|
|
108
|
-
_key = (methodPart ?? "").toUpperCase();
|
|
109
|
-
if (_key === "GLOBAL") _key = "";
|
|
110
|
-
_route = routeParts.join(":");
|
|
111
|
-
}
|
|
112
|
-
if (_route === "global") {
|
|
113
|
-
for (const method of routeObject.methods?.length ? routeObject.methods : ["ALL"]) silgi.globalMiddlewares.push({
|
|
114
|
-
middleware: routeObject.setup,
|
|
115
|
-
method: method === "ALL" ? "" : method.toUpperCase(),
|
|
116
|
-
route: _route
|
|
117
|
-
});
|
|
118
|
-
continue;
|
|
119
|
-
}
|
|
120
|
-
const methods = routeObject.methods?.length ? routeObject.methods : ["ALL"];
|
|
121
|
-
for (const method of methods) {
|
|
122
|
-
const globalMethod = method === "ALL" ? "" : method.toUpperCase();
|
|
123
|
-
addRoute(silgi._middlewareRouter, globalMethod, _route, {
|
|
124
|
-
middleware: routeObject.setup,
|
|
125
|
-
method,
|
|
126
|
-
route: _route
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
silgi.hooks.addHooks(silgi.options.hooks);
|
|
131
|
-
await runSilgiPlugins(silgi);
|
|
132
|
-
if (!silgi.storage) silgi.storage = await createStorage(silgi);
|
|
133
|
-
silgi.shared.storage = (...data) => {
|
|
134
|
-
return useSilgiStorage(...data);
|
|
135
|
-
};
|
|
136
|
-
silgi.shared.useRuntimeConfig = useRuntimeConfig;
|
|
137
|
-
if (silgiCtx.tryUse()) {
|
|
138
|
-
silgiCtx.unset();
|
|
139
|
-
silgiCtx.set(silgi);
|
|
140
|
-
} else {
|
|
141
|
-
silgiCtx.set(silgi);
|
|
142
|
-
silgi.hook("close", () => silgiCtx.unset());
|
|
143
|
-
}
|
|
144
|
-
hooks.hookOnce("close", async () => {
|
|
145
|
-
hooks.removeAllHooks();
|
|
146
|
-
await silgi.storage.dispose();
|
|
147
|
-
});
|
|
148
|
-
silgi.logger.info("Silgi Start");
|
|
149
|
-
return silgi;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
//#endregion
|
|
153
|
-
export { createSilgi };
|
package/dist/core/event.d.mts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { ServerRequest, ServerRuntimeContext } from "srvx";
|
|
2
|
-
import { SilgiEvent, SilgiRuntimeContext } from "silgi/types";
|
|
3
|
-
|
|
4
|
-
//#region src/core/event.d.ts
|
|
5
|
-
declare class SilgiHttpEvent implements SilgiEvent {
|
|
6
|
-
static __is_event__: boolean;
|
|
7
|
-
req: ServerRequest;
|
|
8
|
-
url: URL;
|
|
9
|
-
context: SilgiRuntimeContext;
|
|
10
|
-
_res?: SilgiEventResponse;
|
|
11
|
-
constructor(req: ServerRequest, context?: SilgiRuntimeContext);
|
|
12
|
-
_chain: Promise<unknown> | undefined;
|
|
13
|
-
[x: string]: unknown;
|
|
14
|
-
get res(): SilgiEventResponse;
|
|
15
|
-
get runtime(): ServerRuntimeContext | undefined;
|
|
16
|
-
toString(): string;
|
|
17
|
-
toJSON(): string;
|
|
18
|
-
}
|
|
19
|
-
declare class SilgiEventResponse {
|
|
20
|
-
status?: number;
|
|
21
|
-
statusText?: string;
|
|
22
|
-
_headers?: Headers;
|
|
23
|
-
get headers(): Headers;
|
|
24
|
-
}
|
|
25
|
-
//#endregion
|
|
26
|
-
export { SilgiHttpEvent as SilgiHttpEvent$1 };
|
package/dist/core/event.mjs
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { EmptyObject } from "./utils/internal/obj.mjs";
|
|
2
|
-
import { FastURL } from "srvx";
|
|
3
|
-
|
|
4
|
-
//#region src/core/event.ts
|
|
5
|
-
var SilgiHttpEvent = class {
|
|
6
|
-
static __is_event__ = true;
|
|
7
|
-
req;
|
|
8
|
-
url;
|
|
9
|
-
context;
|
|
10
|
-
_res;
|
|
11
|
-
constructor(req, context) {
|
|
12
|
-
this.context = context || new EmptyObject();
|
|
13
|
-
this.context.protocol = "HTTP";
|
|
14
|
-
this.req = req;
|
|
15
|
-
const _url = req._url;
|
|
16
|
-
this.url = _url && _url instanceof URL ? _url : new FastURL(req.url);
|
|
17
|
-
}
|
|
18
|
-
_chain;
|
|
19
|
-
get res() {
|
|
20
|
-
if (!this._res) this._res = new SilgiEventResponse();
|
|
21
|
-
return this._res;
|
|
22
|
-
}
|
|
23
|
-
get runtime() {
|
|
24
|
-
return this.req.runtime;
|
|
25
|
-
}
|
|
26
|
-
toString() {
|
|
27
|
-
return `[${this.req.method}] ${this.req.url}`;
|
|
28
|
-
}
|
|
29
|
-
toJSON() {
|
|
30
|
-
return this.toString();
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
var SilgiEventResponse = class {
|
|
34
|
-
status;
|
|
35
|
-
statusText;
|
|
36
|
-
_headers;
|
|
37
|
-
get headers() {
|
|
38
|
-
if (!this._headers) this._headers = new Headers();
|
|
39
|
-
return this._headers;
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
//#endregion
|
|
44
|
-
export { SilgiHttpEvent };
|
package/dist/core/index.d.mts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { updateRuntimeStorage$1 as updateRuntimeStorage, useRuntime$1 as useRuntime } from "./context.mjs";
|
|
2
|
-
import { createSilgi$1 as createSilgi } from "./createSilgi.mjs";
|
|
3
|
-
import { SilgiError$1 as SilgiError, createError$1 as createError, isError$1 as isError } from "./error.mjs";
|
|
4
|
-
import { SilgiHttpEvent$1 as SilgiHttpEvent } from "./event.mjs";
|
|
5
|
-
import { handleResponse$1 as handleResponse, kHandled$1 as kHandled, kNotFound$1 as kNotFound } from "./response.mjs";
|
|
6
|
-
import { getWebsocket$1 as getWebsocket, handler$1 as handler, middleware$1 as middleware, silgiFetch$1 as silgiFetch } from "./silgi.mjs";
|
|
7
|
-
import { silgiCLICtx$1 as silgiCLICtx, tryUseSilgiCLI$1 as tryUseSilgiCLI, useSilgiCLI$1 as useSilgiCLI } from "./silgiApp.mjs";
|
|
8
|
-
import { storageMount$1 as storageMount } from "./storage.mjs";
|
|
9
|
-
import { silgiCtx$1 as silgiCtx, tryUseSilgi$1 as tryUseSilgi, useSilgi$1 as useSilgi } from "./unctx.mjs";
|
|
10
|
-
import { createEventStream$1 as createEventStream } from "./utils/event-stream.mjs";
|
|
11
|
-
import { getEvent$1 as getEvent, getEventContext$1 as getEventContext } from "./utils/event.mjs";
|
|
12
|
-
import { deepMergeObjects$1 as deepMergeObjects } from "./utils/merge.mjs";
|
|
13
|
-
import { createMiddleware$1 as createMiddleware } from "./utils/middleware.mjs";
|
|
14
|
-
import { createResolver$3 as createResolver, getUrlPrefix$1 as getUrlPrefix } from "./utils/resolver.mjs";
|
|
15
|
-
import { replaceRuntimeValues$1 as replaceRuntimeValues } from "./utils/runtime.mjs";
|
|
16
|
-
import { createSchema$1 as createSchema } from "./utils/schema.mjs";
|
|
17
|
-
import { createService$1 as createService, createWebSocket$1 as createWebSocket, defineServiceSetup$1 as defineServiceSetup } from "./utils/service.mjs";
|
|
18
|
-
import { createShared$1 as createShared } from "./utils/shared.mjs";
|
|
19
|
-
import { createStorage$1 as createStorage, useSilgiStorage$1 as useSilgiStorage } from "./utils/storage.mjs";
|
|
20
|
-
|
|
21
|
-
//#region src/core/index.d.ts
|
|
22
|
-
// TODO: bunlari yinede destekle.
|
|
23
|
-
declare const autoImportTypes: string[];
|
|
24
|
-
//#endregion
|
|
25
|
-
export { SilgiError, SilgiHttpEvent, autoImportTypes, createError, createEventStream, createMiddleware, createResolver, createSchema, createService, createShared, createSilgi, createStorage, createWebSocket, deepMergeObjects, defineServiceSetup, getEvent, getEventContext, getUrlPrefix, getWebsocket, handleResponse, handler, isError, kHandled, kNotFound, middleware, replaceRuntimeValues, silgiCLICtx, silgiCtx, silgiFetch, storageMount, tryUseSilgi, tryUseSilgiCLI, updateRuntimeStorage, useRuntime, useSilgi, useSilgiCLI, useSilgiStorage };
|
package/dist/core/index.mjs
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { silgiCLICtx, tryUseSilgiCLI, useSilgiCLI } from "./silgiApp.mjs";
|
|
2
|
-
import { updateRuntimeStorage, useRuntime } from "./context.mjs";
|
|
3
|
-
import { silgiCtx, tryUseSilgi, useSilgi } from "./unctx.mjs";
|
|
4
|
-
import { SilgiError, createError, isError } from "./error.mjs";
|
|
5
|
-
import { replaceRuntimeValues } from "./utils/runtime.mjs";
|
|
6
|
-
import { createStorage, useSilgiStorage } from "./utils/storage.mjs";
|
|
7
|
-
import { createSilgi } from "./createSilgi.mjs";
|
|
8
|
-
import { SilgiHttpEvent } from "./event.mjs";
|
|
9
|
-
import { handleResponse, kHandled, kNotFound } from "./response.mjs";
|
|
10
|
-
import { createResolver, getUrlPrefix } from "./utils/resolver.mjs";
|
|
11
|
-
import { getWebsocket, handler, middleware, silgiFetch } from "./silgi.mjs";
|
|
12
|
-
import { storageMount } from "./storage.mjs";
|
|
13
|
-
import { createEventStream } from "./utils/event-stream.mjs";
|
|
14
|
-
import { getEvent, getEventContext } from "./utils/event.mjs";
|
|
15
|
-
import { deepMergeObjects } from "./utils/merge.mjs";
|
|
16
|
-
import { createMiddleware } from "./utils/middleware.mjs";
|
|
17
|
-
import { createSchema } from "./utils/schema.mjs";
|
|
18
|
-
import { createService, createWebSocket, defineServiceSetup } from "./utils/service.mjs";
|
|
19
|
-
import { createShared } from "./utils/shared.mjs";
|
|
20
|
-
|
|
21
|
-
//#region src/core/index.ts
|
|
22
|
-
const autoImportTypes = [
|
|
23
|
-
"ExtractInputFromURI",
|
|
24
|
-
"ExtractOutputFromURI",
|
|
25
|
-
"ExtractPathParamsFromURI",
|
|
26
|
-
"ExtractQueryParamsFromURI"
|
|
27
|
-
];
|
|
28
|
-
|
|
29
|
-
//#endregion
|
|
30
|
-
export { SilgiError, SilgiHttpEvent, autoImportTypes, createError, createEventStream, createMiddleware, createResolver, createSchema, createService, createShared, createSilgi, createStorage, createWebSocket, deepMergeObjects, defineServiceSetup, getEvent, getEventContext, getUrlPrefix, getWebsocket, handleResponse, handler, isError, kHandled, kNotFound, middleware, replaceRuntimeValues, silgiCLICtx, silgiCtx, silgiFetch, storageMount, tryUseSilgi, tryUseSilgiCLI, updateRuntimeStorage, useRuntime, useSilgi, useSilgiCLI, useSilgiStorage };
|