silgi 0.43.29 → 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 -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
package/dist/presets/index.mjs
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { addNPMPackage, defineSilgiPreset } from "silgi/kit";
|
|
2
|
-
|
|
3
|
-
//#region src/presets/nitro/preset.ts
|
|
4
|
-
const nitro = defineSilgiPreset({
|
|
5
|
-
static: true,
|
|
6
|
-
output: {
|
|
7
|
-
dir: "{{ rootDir }}/.output",
|
|
8
|
-
publicDir: "{{ output.dir }}/public"
|
|
9
|
-
},
|
|
10
|
-
prerender: { crawlLinks: true },
|
|
11
|
-
envOptions: { prefix: "NITRO_" },
|
|
12
|
-
imports: { dirs: [
|
|
13
|
-
"!{{ serverDir }}/runtime/**",
|
|
14
|
-
"!{{ serverDir }}/api/**",
|
|
15
|
-
"!{{ serverDir }}/routes/**",
|
|
16
|
-
"!{{ serverDir }}/modules/**",
|
|
17
|
-
"!{{ serverDir }}/assets/**",
|
|
18
|
-
"!{{ serverDir }}/public/**",
|
|
19
|
-
"!{{ silgi.serverDir }}/**"
|
|
20
|
-
] },
|
|
21
|
-
hooks: { ready: async () => {
|
|
22
|
-
await addNPMPackage({
|
|
23
|
-
name: "h3",
|
|
24
|
-
isDev: true
|
|
25
|
-
});
|
|
26
|
-
} },
|
|
27
|
-
storages: ["data", "/assets"]
|
|
28
|
-
}, {
|
|
29
|
-
name: "nitro",
|
|
30
|
-
static: true,
|
|
31
|
-
url: import.meta.url
|
|
32
|
-
});
|
|
33
|
-
const presets = [nitro];
|
|
34
|
-
var preset_default = presets;
|
|
35
|
-
|
|
36
|
-
//#endregion
|
|
37
|
-
export { preset_default as default };
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { defineSilgiPreset } from "silgi/kit";
|
|
2
|
-
|
|
3
|
-
//#region src/presets/npmpackage/preset.ts
|
|
4
|
-
const npmPackage = defineSilgiPreset({
|
|
5
|
-
output: {
|
|
6
|
-
dir: "{{ rootDir }}/.output",
|
|
7
|
-
publicDir: "{{ output.dir }}/public"
|
|
8
|
-
},
|
|
9
|
-
clientDir: "{{ rootDir }}/src/silgi/client",
|
|
10
|
-
serverDir: "{{ rootDir }}/src",
|
|
11
|
-
silgi: { serverDir: "{{ serverDir }}/silgi" },
|
|
12
|
-
modules: ["./src"],
|
|
13
|
-
typescript: { removeFileExtension: true },
|
|
14
|
-
imports: { dirs: [
|
|
15
|
-
"!{{ serverDir }}/runtime/**",
|
|
16
|
-
"!{{ silgi.serverDir }}/**",
|
|
17
|
-
"!{{ serverDir }}/module.ts",
|
|
18
|
-
"!{{ serverDir }}/types/**"
|
|
19
|
-
] }
|
|
20
|
-
}, {
|
|
21
|
-
name: "npm-package",
|
|
22
|
-
compatibilityDate: "2025-02-04",
|
|
23
|
-
url: import.meta.url
|
|
24
|
-
});
|
|
25
|
-
const presets = [npmPackage];
|
|
26
|
-
var preset_default = presets;
|
|
27
|
-
|
|
28
|
-
//#endregion
|
|
29
|
-
export { preset_default as default };
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { addNPMPackage, defineSilgiPreset } from "silgi/kit";
|
|
2
|
-
|
|
3
|
-
//#region src/presets/nuxt/preset.ts
|
|
4
|
-
const nuxt = defineSilgiPreset({
|
|
5
|
-
static: true,
|
|
6
|
-
output: {
|
|
7
|
-
dir: "{{ rootDir }}/.output",
|
|
8
|
-
publicDir: "{{ output.dir }}/public"
|
|
9
|
-
},
|
|
10
|
-
clientDir: "{{ rootDir }}/app",
|
|
11
|
-
prerender: { crawlLinks: true },
|
|
12
|
-
envOptions: {
|
|
13
|
-
prefix: "NITRO_",
|
|
14
|
-
altPrefix: "NUXT_"
|
|
15
|
-
},
|
|
16
|
-
imports: { dirs: [
|
|
17
|
-
"!{{ serverDir }}/runtime/**",
|
|
18
|
-
"!{{ serverDir }}/api/**",
|
|
19
|
-
"!{{ serverDir }}/routes/**",
|
|
20
|
-
"!{{ serverDir }}/modules/**",
|
|
21
|
-
"!{{ serverDir }}/assets/**",
|
|
22
|
-
"!{{ serverDir }}/public/**",
|
|
23
|
-
"!{{ silgi.serverDir }}/**"
|
|
24
|
-
] },
|
|
25
|
-
hooks: { ready: async () => {
|
|
26
|
-
await addNPMPackage({
|
|
27
|
-
name: "h3",
|
|
28
|
-
isDev: true
|
|
29
|
-
});
|
|
30
|
-
} },
|
|
31
|
-
storages: ["data", "/assets"]
|
|
32
|
-
}, {
|
|
33
|
-
name: "nuxt",
|
|
34
|
-
static: true,
|
|
35
|
-
url: import.meta.url
|
|
36
|
-
});
|
|
37
|
-
const presets = [nuxt];
|
|
38
|
-
var preset_default = presets;
|
|
39
|
-
|
|
40
|
-
//#endregion
|
|
41
|
-
export { preset_default as default };
|
package/dist/runtime/index.d.mts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { initRuntimeConfig, sharedRuntimeConfig, useRuntimeConfig } from "./internal/config.mjs";
|
|
2
|
-
import { defineSilgiPlugin } from "./internal/plugin.mjs";
|
|
3
|
-
import { mergeDeep } from "./internal/defu.mjs";
|
|
4
|
-
export { defineSilgiPlugin, initRuntimeConfig, mergeDeep, sharedRuntimeConfig, useRuntimeConfig };
|
package/dist/runtime/index.mjs
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { initRuntimeConfig, sharedRuntimeConfig, useRuntimeConfig } from "./internal/config.mjs";
|
|
2
|
-
import { defineSilgiPlugin } from "./internal/plugin.mjs";
|
|
3
|
-
import { mergeDeep } from "./internal/defu.mjs";
|
|
4
|
-
|
|
5
|
-
export { defineSilgiPlugin, initRuntimeConfig, mergeDeep, sharedRuntimeConfig, useRuntimeConfig };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { EnvOptions, SilgiEvent, SilgiRuntimeConfig } from "silgi/types";
|
|
2
|
-
|
|
3
|
-
//#region src/runtime/internal/config.d.ts
|
|
4
|
-
declare function updateEnvOptions(runtime: SilgiRuntimeConfig): EnvOptions;
|
|
5
|
-
declare function sharedRuntimeConfig(runtime: SilgiRuntimeConfig, force?: boolean): SilgiRuntimeConfig;
|
|
6
|
-
declare function useRuntimeConfig<T extends SilgiRuntimeConfig>(event?: SilgiEvent, localRuntimeConfig?: SilgiRuntimeConfig, force?: boolean): SilgiRuntimeConfig;
|
|
7
|
-
declare function initRuntimeConfig(envOptions?: EnvOptions, inlineRuntimeConfig?: Record<string, any>): Readonly<Record<string, any>>;
|
|
8
|
-
declare function updateRuntimeConfig(runtimeConfig: Record<string, unknown>): void;
|
|
9
|
-
declare function applyEnv(obj: Record<string, any>, opts: EnvOptions, parentKey?: string): Record<string, any>;
|
|
10
|
-
//#endregion
|
|
11
|
-
export { applyEnv, initRuntimeConfig, sharedRuntimeConfig, updateEnvOptions, updateRuntimeConfig, useRuntimeConfig };
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { updateRuntimeStorage, useRuntime, useSilgi } from "silgi";
|
|
2
|
-
import { defu } from "defu";
|
|
3
|
-
import { snakeCase } from "scule";
|
|
4
|
-
import { klona } from "klona";
|
|
5
|
-
import destr from "destr";
|
|
6
|
-
|
|
7
|
-
//#region src/runtime/internal/config.ts
|
|
8
|
-
function updateEnvOptions(runtime) {
|
|
9
|
-
const envOptions = {
|
|
10
|
-
prefix: "NITRO_",
|
|
11
|
-
altPrefix: runtime?.silgi?.envPrefix ?? process.env.NITRO_ENV_PREFIX ?? "_",
|
|
12
|
-
silgiPrefix: "SILGI_",
|
|
13
|
-
envExpansion: runtime?.silgi?.envExpansion ?? process.env.NITRO_ENV_EXPANSION ?? false
|
|
14
|
-
};
|
|
15
|
-
return envOptions;
|
|
16
|
-
}
|
|
17
|
-
let inlineRuntimeConfig;
|
|
18
|
-
function sharedRuntimeConfig(runtime, force) {
|
|
19
|
-
if (inlineRuntimeConfig && !force) return inlineRuntimeConfig;
|
|
20
|
-
inlineRuntimeConfig = _deepFreeze(applyEnv(klona(runtime ?? {}), updateEnvOptions(runtime)));
|
|
21
|
-
updateRuntimeStorage(inlineRuntimeConfig);
|
|
22
|
-
return inlineRuntimeConfig;
|
|
23
|
-
}
|
|
24
|
-
function useRuntimeConfig(event, localRuntimeConfig, force) {
|
|
25
|
-
if (localRuntimeConfig) return sharedRuntimeConfig(localRuntimeConfig, force);
|
|
26
|
-
const runtime = useRuntime();
|
|
27
|
-
if (!event) return sharedRuntimeConfig(runtime);
|
|
28
|
-
if (event.context.silgi.runtimeConfig) return event.context.silgi.runtimeConfig;
|
|
29
|
-
const runtimeConfig = klona(runtime);
|
|
30
|
-
const envOptions = updateEnvOptions(runtime);
|
|
31
|
-
applyEnv(runtimeConfig, envOptions);
|
|
32
|
-
event.context.silgi.runtimeConfig = runtimeConfig;
|
|
33
|
-
return runtimeConfig;
|
|
34
|
-
}
|
|
35
|
-
function initRuntimeConfig(envOptions = {}, inlineRuntimeConfig$1 = {}) {
|
|
36
|
-
const finalEnvOptions = {
|
|
37
|
-
prefix: "NITRO_",
|
|
38
|
-
altPrefix: inlineRuntimeConfig$1?.nitro?.envPrefix ?? process.env.NITRO_ENV_PREFIX ?? "_",
|
|
39
|
-
silgiPrefix: "SILGI_",
|
|
40
|
-
envExpansion: inlineRuntimeConfig$1?.nitro?.envExpansion ?? process.env.NITRO_ENV_EXPANSION ?? false,
|
|
41
|
-
...envOptions
|
|
42
|
-
};
|
|
43
|
-
return _deepFreeze(applyEnv(klona(inlineRuntimeConfig$1), finalEnvOptions));
|
|
44
|
-
}
|
|
45
|
-
function updateRuntimeConfig(runtimeConfig) {
|
|
46
|
-
const nuxt = useSilgi();
|
|
47
|
-
Object.assign(nuxt.options.nitro.runtimeConfig, defu(runtimeConfig, nuxt.options.nitro.runtimeConfig));
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* https://github.com/nitrojs/nitro/blob/main/src/runtime/internal/utils.env.ts.
|
|
51
|
-
*
|
|
52
|
-
* These utils will be replaced by util exposed from nitropack. See https://github.com/nitrojs/nitro/pull/2404
|
|
53
|
-
* for more context and future plans.)
|
|
54
|
-
*
|
|
55
|
-
* @internal
|
|
56
|
-
*/
|
|
57
|
-
function getEnv(key, opts, env = process.env) {
|
|
58
|
-
const envKey = snakeCase(key).toUpperCase();
|
|
59
|
-
return destr(env[opts.prefix + envKey] ?? env[opts.altPrefix + envKey] ?? env[opts.silgiPrefix + envKey]);
|
|
60
|
-
}
|
|
61
|
-
function _isObject(input) {
|
|
62
|
-
return typeof input === "object" && !Array.isArray(input);
|
|
63
|
-
}
|
|
64
|
-
function applyEnv(obj, opts, parentKey = "") {
|
|
65
|
-
for (const key in obj) {
|
|
66
|
-
const subKey = parentKey ? `${parentKey}_${key}` : key;
|
|
67
|
-
const envValue = getEnv(subKey, opts);
|
|
68
|
-
if (_isObject(obj[key])) if (_isObject(envValue)) {
|
|
69
|
-
obj[key] = {
|
|
70
|
-
...obj[key],
|
|
71
|
-
...envValue
|
|
72
|
-
};
|
|
73
|
-
applyEnv(obj[key], opts, subKey);
|
|
74
|
-
} else if (envValue === void 0) applyEnv(obj[key], opts, subKey);
|
|
75
|
-
else obj[key] = envValue ?? obj[key];
|
|
76
|
-
else obj[key] = envValue ?? obj[key];
|
|
77
|
-
if (opts.envExpansion && typeof obj[key] === "string") obj[key] = _expandFromEnv(obj[key]);
|
|
78
|
-
}
|
|
79
|
-
return obj;
|
|
80
|
-
}
|
|
81
|
-
const envExpandRx = /\{\{([^{}]*)\}\}/g;
|
|
82
|
-
function _expandFromEnv(value, env = process.env) {
|
|
83
|
-
return value.replace(envExpandRx, (match, key) => {
|
|
84
|
-
return env[key] || match;
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
function _deepFreeze(object) {
|
|
88
|
-
const propNames = Object.getOwnPropertyNames(object);
|
|
89
|
-
for (const name of propNames) {
|
|
90
|
-
const value = object[name];
|
|
91
|
-
if (value && typeof value === "object") _deepFreeze(value);
|
|
92
|
-
}
|
|
93
|
-
return Object.freeze(object);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
//#endregion
|
|
97
|
-
export { applyEnv, initRuntimeConfig, sharedRuntimeConfig, updateEnvOptions, updateRuntimeConfig, useRuntimeConfig };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { defineSilgiPlugin } from "./plugin.mjs";
|
|
2
|
-
import { createDebugger } from "hookable";
|
|
3
|
-
|
|
4
|
-
//#region src/runtime/internal/debug.ts
|
|
5
|
-
const debugPlugin = defineSilgiPlugin((silgi) => {
|
|
6
|
-
createDebugger(silgi.hooks, { tag: "silgi-runtime" });
|
|
7
|
-
});
|
|
8
|
-
var debug_default = debugPlugin;
|
|
9
|
-
|
|
10
|
-
//#endregion
|
|
11
|
-
export { debugPlugin, debug_default as default };
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { defineSilgiPlugin, silgiPlugin } from "./plugin.mjs";
|
|
2
|
-
import { mergeDeep } from "./defu.mjs";
|
|
3
|
-
import { debugPlugin } from "./debug.mjs";
|
|
4
|
-
import { addNitroApp } from "./nitro.mjs";
|
|
5
|
-
import { useSilgiFetch } from "./nuxt.mjs";
|
|
6
|
-
import { createSilgiFetch, silgi$fetch } from "./ofetch.mjs";
|
|
7
|
-
export { addNitroApp, createSilgiFetch, debugPlugin, defineSilgiPlugin, mergeDeep, silgi$fetch, silgiPlugin, useSilgiFetch };
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { defineSilgiPlugin, silgiPlugin } from "./plugin.mjs";
|
|
2
|
-
import { mergeDeep } from "./defu.mjs";
|
|
3
|
-
import { debugPlugin } from "./debug.mjs";
|
|
4
|
-
import { addNitroApp } from "./nitro.mjs";
|
|
5
|
-
import { useSilgiFetch } from "./nuxt.mjs";
|
|
6
|
-
import { createSilgiFetch, silgi$fetch } from "./ofetch.mjs";
|
|
7
|
-
|
|
8
|
-
export { addNitroApp, createSilgiFetch, debugPlugin, defineSilgiPlugin, mergeDeep, silgi$fetch, silgiPlugin, useSilgiFetch };
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import consola from "consola";
|
|
2
|
-
import { silgiFetch, useSilgi } from "silgi";
|
|
3
|
-
import { defineEventHandler, toWebRequest } from "h3";
|
|
4
|
-
|
|
5
|
-
//#region src/runtime/internal/nitro.ts
|
|
6
|
-
async function addNitroApp(silgiContext = useSilgi()) {
|
|
7
|
-
const nitro = silgiContext.framework?.nitro;
|
|
8
|
-
if (!nitro) throw new Error("Nitro framework not found");
|
|
9
|
-
const prefixs = silgiContext.routerPrefixs;
|
|
10
|
-
for (const prefix of prefixs) {
|
|
11
|
-
let type = "http";
|
|
12
|
-
let path = "";
|
|
13
|
-
const parts = prefix.split(":");
|
|
14
|
-
type = parts[0] ? parts[0].toUpperCase() : "HTTP";
|
|
15
|
-
path = parts[1] ?? "";
|
|
16
|
-
if (type === "HTTP") nitro.router.use(`${path}/**`, defineEventHandler(async (event) => {
|
|
17
|
-
const evet = toWebRequest(event);
|
|
18
|
-
try {
|
|
19
|
-
const resolvedRoute = await silgiFetch(evet);
|
|
20
|
-
return resolvedRoute;
|
|
21
|
-
} catch (error) {
|
|
22
|
-
consola.error("Error in Nitro route:", error);
|
|
23
|
-
throw error;
|
|
24
|
-
}
|
|
25
|
-
}));
|
|
26
|
-
}
|
|
27
|
-
const webhookServices = Object.entries(silgiContext.services).filter(([key]) => key.startsWith("websocket:")).map(([, value]) => value);
|
|
28
|
-
for (const webhook of webhookServices) nitro.router.use(webhook.path, defineEventHandler({
|
|
29
|
-
handler: () => {},
|
|
30
|
-
websocket: webhook.websocket || {}
|
|
31
|
-
}));
|
|
32
|
-
}
|
|
33
|
-
var nitro_default = addNitroApp;
|
|
34
|
-
|
|
35
|
-
//#endregion
|
|
36
|
-
export { addNitroApp, nitro_default as default };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { AsyncData, UseFetchOptions } from "nuxt/app";
|
|
2
|
-
import { AllPaths, ExtractPathParams, SilgiRouterTypes, TrimAfterFourSlashes } from "silgi/types";
|
|
3
|
-
import { FetchError } from "ofetch";
|
|
4
|
-
|
|
5
|
-
//#region src/runtime/internal/nuxt.d.ts
|
|
6
|
-
declare function useSilgiFetch<T, P extends AllPaths | (string & {}), BasePath extends keyof SilgiRouterTypes = (TrimAfterFourSlashes<P> extends keyof SilgiRouterTypes ? TrimAfterFourSlashes<P> : never), M extends keyof SilgiRouterTypes[BasePath] = keyof SilgiRouterTypes[BasePath]>(path: P, options?: {
|
|
7
|
-
method?: M;
|
|
8
|
-
params?: ExtractPathParams<P>;
|
|
9
|
-
body?: SilgiRouterTypes[BasePath][M]["input"];
|
|
10
|
-
} & Omit<UseFetchOptions<T>, "method" | "body" | "params">): AsyncData<SilgiRouterTypes[BasePath][M]["output"], FetchError | null>;
|
|
11
|
-
//#endregion
|
|
12
|
-
export { useSilgiFetch };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { useFetch } from "nuxt/app";
|
|
2
|
-
|
|
3
|
-
//#region src/runtime/internal/nuxt.ts
|
|
4
|
-
function replacePathParams(template, params) {
|
|
5
|
-
return template.replace(/:([^/]+)/g, (_, param) => params[param] || `:${param}`);
|
|
6
|
-
}
|
|
7
|
-
function useSilgiFetch(path, options) {
|
|
8
|
-
const resolvedPath = options?.params ? replacePathParams(path, options.params) : path;
|
|
9
|
-
return useFetch(resolvedPath, {
|
|
10
|
-
method: options?.method,
|
|
11
|
-
body: options?.body
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
//#endregion
|
|
16
|
-
export { useSilgiFetch };
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { AllPaths, SilgiFetchClient, SilgiFetchOptions, SilgiRouterTypes, TrimAfterFourSlashes } from "silgi/types";
|
|
2
|
-
import { FetchOptions, FetchResponse } from "ofetch";
|
|
3
|
-
|
|
4
|
-
//#region src/runtime/internal/ofetch.d.ts
|
|
5
|
-
declare function createSilgiFetch(options: FetchOptions | ((options: FetchOptions) => FetchOptions), localFetch?: typeof globalThis.$fetch): SilgiFetchClient;
|
|
6
|
-
declare function silgi$fetch<P extends AllPaths | (string & {}), BasePath extends keyof SilgiRouterTypes = (TrimAfterFourSlashes<P> extends keyof SilgiRouterTypes ? TrimAfterFourSlashes<P> : never), M extends keyof SilgiRouterTypes[BasePath] = keyof SilgiRouterTypes[BasePath]>(url: P, opts?: SilgiFetchOptions<P, BasePath, M>): Promise<FetchResponse<SilgiRouterTypes[BasePath][M]["output"]>>;
|
|
7
|
-
//#endregion
|
|
8
|
-
export { createSilgiFetch, silgi$fetch };
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
//#region src/runtime/internal/ofetch.ts
|
|
2
|
-
function createSilgiFetch(options, localFetch) {
|
|
3
|
-
return (url, opts) => {
|
|
4
|
-
const finalOpts = {
|
|
5
|
-
...typeof options === "function" ? options(opts) : options,
|
|
6
|
-
...opts,
|
|
7
|
-
method: opts?.method || "get"
|
|
8
|
-
};
|
|
9
|
-
const $fetch = getFetch(url, finalOpts, localFetch);
|
|
10
|
-
return $fetch(fillPath(url, opts?.params), finalOpts);
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
function silgi$fetch(url, opts) {
|
|
14
|
-
const finalOpts = {
|
|
15
|
-
...opts,
|
|
16
|
-
method: opts?.method || "get"
|
|
17
|
-
};
|
|
18
|
-
const $fetch = getFetch(url, finalOpts);
|
|
19
|
-
return $fetch(fillPath(url, opts?.params), finalOpts);
|
|
20
|
-
}
|
|
21
|
-
function getFetch(url, opts, localFetch) {
|
|
22
|
-
if (import.meta.server && localFetch) {
|
|
23
|
-
const isLocalFetch = url[0] === "/" && (!opts.baseURL || opts.baseURL[0] === "/");
|
|
24
|
-
if (isLocalFetch) return localFetch;
|
|
25
|
-
}
|
|
26
|
-
return globalThis.$fetch;
|
|
27
|
-
}
|
|
28
|
-
function fillPath(path, params) {
|
|
29
|
-
if (!params || Object.keys(params).length === 0) return path;
|
|
30
|
-
let result = path;
|
|
31
|
-
for (const [key, value] of Object.entries(params)) {
|
|
32
|
-
const pattern = `:${key}`;
|
|
33
|
-
if (result.includes(pattern)) result = result.replace(pattern, value);
|
|
34
|
-
}
|
|
35
|
-
return result;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
//#endregion
|
|
39
|
-
export { createSilgiFetch, silgi$fetch };
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { SilgiAppPlugin } from "silgi/types";
|
|
2
|
-
|
|
3
|
-
//#region src/runtime/internal/plugin.d.ts
|
|
4
|
-
declare function defineSilgiPlugin(def: SilgiAppPlugin): SilgiAppPlugin;
|
|
5
|
-
declare const silgiPlugin: typeof defineSilgiPlugin;
|
|
6
|
-
//#endregion
|
|
7
|
-
export { defineSilgiPlugin, silgiPlugin };
|