@slopware/sloppy-darwin-arm64 0.1.0-alpha.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/LICENSE +201 -0
- package/README.md +5 -0
- package/bin/sloppy +0 -0
- package/bin/sloppyc +0 -0
- package/docs/KNOWN_LIMITATIONS.md +16 -0
- package/docs/LICENSES.md +6 -0
- package/docs/NOTICE.md +8 -0
- package/examples/README.md +140 -0
- package/examples/auth-api/README.md +20 -0
- package/examples/auth-api/app.js +61 -0
- package/examples/auth-api/appsettings.json +7 -0
- package/examples/auth-api/sloppy.json +5 -0
- package/examples/cache-basic/README.md +9 -0
- package/examples/cache-basic/app.js +32 -0
- package/examples/cache-hybrid-postgres/README.md +10 -0
- package/examples/cache-hybrid-postgres/app.js +27 -0
- package/examples/cache-output-api/README.md +10 -0
- package/examples/cache-output-api/app.js +35 -0
- package/examples/codec-base64-hex/README.md +14 -0
- package/examples/codec-base64-hex/app.js +15 -0
- package/examples/codec-checksums/README.md +15 -0
- package/examples/codec-checksums/app.js +8 -0
- package/examples/codec-compression/README.md +13 -0
- package/examples/codec-compression/app.js +9 -0
- package/examples/codec-streaming-compression/README.md +19 -0
- package/examples/codec-streaming-compression/app.js +16 -0
- package/examples/codec-text-binary/README.md +16 -0
- package/examples/codec-text-binary/app.js +17 -0
- package/examples/compiler-hello/README.md +71 -0
- package/examples/compiler-hello/app.js +7 -0
- package/examples/compiler-hello/expected/app.js +8 -0
- package/examples/compiler-hello/expected/app.js.map +53 -0
- package/examples/compiler-hello/expected/app.plan.json +229 -0
- package/examples/compiler-hello/expected/routes.slrt +0 -0
- package/examples/config-basic/README.md +13 -0
- package/examples/config-basic/app.js +13 -0
- package/examples/config-basic/appsettings.json +7 -0
- package/examples/config-secrets-redaction/README.md +9 -0
- package/examples/config-secrets-redaction/app.js +9 -0
- package/examples/config-secrets-redaction/appsettings.json +5 -0
- package/examples/config-strict-mode/README.md +7 -0
- package/examples/config-strict-mode/app.js +10 -0
- package/examples/config-strict-mode/appsettings.json +7 -0
- package/examples/configured-api/README.md +38 -0
- package/examples/configured-api/app.js +12 -0
- package/examples/configured-api/appsettings.Development.json +5 -0
- package/examples/configured-api/appsettings.json +6 -0
- package/examples/configured-api/sloppy.json +5 -0
- package/examples/core-config-secrets/README.md +10 -0
- package/examples/core-config-secrets/app.js +15 -0
- package/examples/core-fs-time-codec/README.md +9 -0
- package/examples/core-fs-time-codec/app.js +8 -0
- package/examples/core-network-time-codec/README.md +11 -0
- package/examples/core-network-time-codec/app.js +20 -0
- package/examples/core-policy-audit/README.md +7 -0
- package/examples/core-policy-audit/app.js +22 -0
- package/examples/core-process-time-codec/README.md +8 -0
- package/examples/core-process-time-codec/app.js +28 -0
- package/examples/core-worker-time/README.md +8 -0
- package/examples/core-worker-time/app.js +17 -0
- package/examples/crypto-hash-hmac/README.md +17 -0
- package/examples/crypto-hash-hmac/app.js +29 -0
- package/examples/crypto-password/README.md +21 -0
- package/examples/crypto-password/app.js +12 -0
- package/examples/crypto-random-token/README.md +16 -0
- package/examples/crypto-random-token/app.js +12 -0
- package/examples/crypto-secret-constant-time/README.md +21 -0
- package/examples/crypto-secret-constant-time/app.js +15 -0
- package/examples/data-foundation/README.md +39 -0
- package/examples/data-foundation/app.js +63 -0
- package/examples/dependency-graph/README.md +19 -0
- package/examples/dependency-graph/fixtures/graph-helper/index.js +3 -0
- package/examples/dependency-graph/fixtures/graph-helper/package.json +6 -0
- package/examples/dependency-graph/package.json +7 -0
- package/examples/dependency-graph/public/message.txt +1 -0
- package/examples/dependency-graph/sloppy.json +9 -0
- package/examples/dependency-graph/src/main.ts +8 -0
- package/examples/dogfood/README.md +23 -0
- package/examples/dogfood/dogfood.json +136 -0
- package/examples/dynamic-module-include/README.md +20 -0
- package/examples/dynamic-module-include/public/readme.txt +1 -0
- package/examples/dynamic-module-include/sloppy.json +12 -0
- package/examples/dynamic-module-include/src/main.ts +6 -0
- package/examples/dynamic-module-include/src/plugins/alpha.js +3 -0
- package/examples/dynamic-module-include/src/plugins/beta.js +3 -0
- package/examples/ergonomics/README.md +42 -0
- package/examples/ergonomics/app.js +38 -0
- package/examples/framework-controller/README.md +12 -0
- package/examples/framework-controller/app.js +31 -0
- package/examples/framework-di-services/README.md +17 -0
- package/examples/framework-di-services/app.ts +40 -0
- package/examples/framework-explicit-binding/README.md +12 -0
- package/examples/framework-explicit-binding/app.ts +34 -0
- package/examples/framework-hello/README.md +16 -0
- package/examples/framework-hello/app.ts +16 -0
- package/examples/framework-postgres-crud/README.md +73 -0
- package/examples/framework-postgres-crud/app.ts +64 -0
- package/examples/framework-sqlite-crud/README.md +52 -0
- package/examples/framework-sqlite-crud/app.ts +90 -0
- package/examples/framework-sqlite-crud/appsettings.json +11 -0
- package/examples/framework-sqlserver-crud/README.md +73 -0
- package/examples/framework-sqlserver-crud/app.ts +64 -0
- package/examples/framework-validation-errors/README.md +12 -0
- package/examples/framework-validation-errors/app.ts +16 -0
- package/examples/fs-basic/README.md +24 -0
- package/examples/fs-basic/app.js +12 -0
- package/examples/fs-roots-policy/README.md +14 -0
- package/examples/fs-roots-policy/app.js +4 -0
- package/examples/fs-streams/README.md +18 -0
- package/examples/fs-streams/app.js +11 -0
- package/examples/fs-watch/README.md +19 -0
- package/examples/fs-watch/app.js +11 -0
- package/examples/hello/README.md +63 -0
- package/examples/hello/app.js +19 -0
- package/examples/hello-minimal/README.md +51 -0
- package/examples/hello-minimal/sloppy.json +5 -0
- package/examples/hello-minimal/src/main.ts +9 -0
- package/examples/http-client-basic/README.md +11 -0
- package/examples/http-client-basic/app.js +46 -0
- package/examples/http-client-generated/README.md +22 -0
- package/examples/http-client-generated/openapi.json +45 -0
- package/examples/http-client-resilience/README.md +4 -0
- package/examples/http-client-resilience/app.js +38 -0
- package/examples/http-client-runtime-loopback/README.md +24 -0
- package/examples/http-client-testhost/README.md +4 -0
- package/examples/http-client-testhost/app.js +27 -0
- package/examples/http-client-testhost-package-mock/README.md +26 -0
- package/examples/http-client-typed/README.md +5 -0
- package/examples/http-client-typed/app.js +33 -0
- package/examples/modules-api/README.md +30 -0
- package/examples/modules-api/app.js +9 -0
- package/examples/modules-api/modules/routes.js +16 -0
- package/examples/modules-api/sloppy.json +5 -0
- package/examples/modules-basic/README.md +32 -0
- package/examples/modules-basic/app.js +41 -0
- package/examples/net-deadline-cancel/README.md +13 -0
- package/examples/net-deadline-cancel/app.js +34 -0
- package/examples/net-local-ipc/README.md +12 -0
- package/examples/net-local-ipc/app.js +46 -0
- package/examples/net-policy-strict/README.md +12 -0
- package/examples/net-policy-strict/app.js +34 -0
- package/examples/net-tcp-client/README.md +10 -0
- package/examples/net-tcp-client/app.js +23 -0
- package/examples/net-tcp-echo/README.md +11 -0
- package/examples/net-tcp-echo/app.js +45 -0
- package/examples/net-tcp-server/README.md +10 -0
- package/examples/net-tcp-server/app.js +28 -0
- package/examples/node-compat-path-events/README.md +15 -0
- package/examples/node-compat-path-events/sloppy.json +6 -0
- package/examples/node-compat-path-events/src/main.ts +15 -0
- package/examples/ops-compiler/README.md +9 -0
- package/examples/ops-compiler/app.js +26 -0
- package/examples/ops-health-metrics-management/README.md +14 -0
- package/examples/ops-health-metrics-management/app.js +24 -0
- package/examples/orm-basic/README.md +17 -0
- package/examples/orm-basic/app.js +82 -0
- package/examples/orm-cursor-export/README.md +16 -0
- package/examples/orm-cursor-export/app.js +28 -0
- package/examples/orm-migrations/README.md +14 -0
- package/examples/orm-migrations/migrations/.gitkeep +1 -0
- package/examples/orm-migrations/sloppy.json +9 -0
- package/examples/orm-migrations/src/app.ts +34 -0
- package/examples/orm-relations-includes/README.md +10 -0
- package/examples/orm-relations-includes/app.js +47 -0
- package/examples/orm-testservices/README.md +37 -0
- package/examples/orm-testservices/test.mjs +32 -0
- package/examples/os-runtime-api/README.md +11 -0
- package/examples/os-runtime-api/app.js +44 -0
- package/examples/package-zod-like/README.md +28 -0
- package/examples/package-zod-like/fixtures/zod-like/index.js +48 -0
- package/examples/package-zod-like/fixtures/zod-like/package.json +12 -0
- package/examples/package-zod-like/package.json +7 -0
- package/examples/package-zod-like/sloppy.json +6 -0
- package/examples/package-zod-like/src/main.ts +16 -0
- package/examples/postgres-basic/README.md +31 -0
- package/examples/postgres-basic/app.js +50 -0
- package/examples/prealpha-control-plane/README.md +50 -0
- package/examples/prealpha-control-plane/appsettings.Development.json +11 -0
- package/examples/prealpha-control-plane/appsettings.json +15 -0
- package/examples/prealpha-control-plane/sloppy.json +5 -0
- package/examples/prealpha-control-plane/src/db/schema.js +7 -0
- package/examples/prealpha-control-plane/src/db/seed.js +6 -0
- package/examples/prealpha-control-plane/src/main.js +21 -0
- package/examples/prealpha-control-plane/src/routes/apps.js +34 -0
- package/examples/prealpha-control-plane/src/routes/builds.js +25 -0
- package/examples/prealpha-control-plane/src/routes/deployments.js +19 -0
- package/examples/prealpha-control-plane/src/routes/diagnostics.js +11 -0
- package/examples/prealpha-control-plane/src/routes/health.js +27 -0
- package/examples/prealpha-control-plane/src/routes/projects.js +38 -0
- package/examples/prealpha-control-plane/src/services/diagnosticsSink.js +11 -0
- package/examples/prealpha-control-plane/src/services/repositories.js +9 -0
- package/examples/prealpha-control-plane/src/validation/schemas.js +6 -0
- package/examples/program-fs-process/README.md +31 -0
- package/examples/program-fs-process/sloppy.json +9 -0
- package/examples/program-fs-process/src/main.ts +27 -0
- package/examples/program-hello/README.md +32 -0
- package/examples/program-hello/main.ts +8 -0
- package/examples/program-hello/message.ts +1 -0
- package/examples/program-hello/sloppy.json +5 -0
- package/examples/rate-limit-auth/README.md +3 -0
- package/examples/rate-limit-auth/app.js +14 -0
- package/examples/rate-limit-basic/README.md +3 -0
- package/examples/rate-limit-basic/app.js +13 -0
- package/examples/rate-limit-redis/README.md +5 -0
- package/examples/rate-limit-redis/app.js +20 -0
- package/examples/rate-limit-testhost/README.md +4 -0
- package/examples/rate-limit-testhost/app.js +13 -0
- package/examples/rate-limit-websocket/README.md +3 -0
- package/examples/rate-limit-websocket/app.js +16 -0
- package/examples/realtime-auth/README.md +8 -0
- package/examples/realtime-auth/app.js +25 -0
- package/examples/realtime-auth/test.mjs +43 -0
- package/examples/realtime-chat/README.md +8 -0
- package/examples/realtime-chat/app.js +32 -0
- package/examples/realtime-chat/test.mjs +52 -0
- package/examples/realtime-dashboard/README.md +20 -0
- package/examples/realtime-dashboard/app.js +37 -0
- package/examples/realtime-presence/README.md +8 -0
- package/examples/realtime-presence/app.js +32 -0
- package/examples/realtime-presence/test.mjs +50 -0
- package/examples/realtime-testhost/README.md +8 -0
- package/examples/realtime-testhost/test.mjs +31 -0
- package/examples/redis-basic/README.md +17 -0
- package/examples/redis-basic/app.js +39 -0
- package/examples/redis-cache/README.md +14 -0
- package/examples/redis-cache/app.js +36 -0
- package/examples/redis-locks/README.md +13 -0
- package/examples/redis-locks/app.js +49 -0
- package/examples/request-context/README.md +32 -0
- package/examples/request-context/app.js +15 -0
- package/examples/sqlite-basic/README.md +52 -0
- package/examples/sqlite-basic/app.js +56 -0
- package/examples/sqlserver-basic/README.md +36 -0
- package/examples/sqlserver-basic/app.js +59 -0
- package/examples/static-files-basic/README.md +11 -0
- package/examples/static-files-basic/app.js +12 -0
- package/examples/static-files-basic/public/app.js +1 -0
- package/examples/static-files-basic/public/site.css +3 -0
- package/examples/static-files-package/README.md +12 -0
- package/examples/static-files-package/app.js +10 -0
- package/examples/static-files-package/public/index.html +2 -0
- package/examples/static-files-precompressed/README.md +12 -0
- package/examples/static-files-precompressed/app.js +11 -0
- package/examples/static-files-precompressed/public/app.js +1 -0
- package/examples/static-files-precompressed/public/app.js.br +0 -0
- package/examples/static-files-precompressed/public/app.js.gz +0 -0
- package/examples/static-files-spa/README.md +12 -0
- package/examples/static-files-spa/app.js +16 -0
- package/examples/static-files-spa/dist/assets/app.js +1 -0
- package/examples/static-files-spa/dist/index.html +4 -0
- package/examples/static-files-testhost/README.md +8 -0
- package/examples/static-files-testhost/app.js +13 -0
- package/examples/static-files-testhost/public/app.js +1 -0
- package/examples/static-files-testhost/public/app.js.gz +0 -0
- package/examples/static-files-testhost/test.mjs +38 -0
- package/examples/testhost-basic/README.md +26 -0
- package/examples/testhost-db/README.md +31 -0
- package/examples/testservices-postgres/README.md +68 -0
- package/examples/testservices-redis/README.md +71 -0
- package/examples/testservices-sqlserver/README.md +75 -0
- package/examples/time-basic/README.md +18 -0
- package/examples/time-basic/app.js +12 -0
- package/examples/time-deadline-cancellation/README.md +11 -0
- package/examples/time-deadline-cancellation/app.js +27 -0
- package/examples/time-fake-clock/README.md +14 -0
- package/examples/time-fake-clock/app.js +25 -0
- package/examples/time-interval-schedule/README.md +13 -0
- package/examples/time-interval-schedule/app.js +60 -0
- package/examples/users-api-sqlite/README.md +74 -0
- package/examples/users-api-sqlite/app.js +11 -0
- package/examples/users-api-sqlite/appsettings.Development.json +11 -0
- package/examples/users-api-sqlite/appsettings.json +11 -0
- package/examples/users-api-sqlite/modules/users.js +40 -0
- package/examples/users-api-sqlite/sloppy.json +5 -0
- package/examples/validation-errors/README.md +36 -0
- package/examples/validation-errors/app.js +14 -0
- package/examples/validation-errors/invalid-user.http +6 -0
- package/examples/validation-errors/sloppy.json +5 -0
- package/examples/web-dynamic-routes/README.md +17 -0
- package/examples/web-dynamic-routes/app.ts +27 -0
- package/examples/webhooks-basic/README.md +11 -0
- package/examples/webhooks-basic/app.js +48 -0
- package/examples/websocket-auth/README.md +8 -0
- package/examples/websocket-auth/app.js +16 -0
- package/examples/websocket-echo/README.md +9 -0
- package/examples/websocket-echo/app.js +36 -0
- package/examples/websocket-json-schema/README.md +5 -0
- package/examples/websocket-json-schema/app.js +25 -0
- package/examples/websocket-testhost/README.md +11 -0
- package/examples/websocket-testhost/test.mjs +49 -0
- package/examples/workers-background-service/README.md +7 -0
- package/examples/workers-background-service/app.js +16 -0
- package/examples/workers-js-isolate/README.md +8 -0
- package/examples/workers-js-isolate/app.js +19 -0
- package/examples/workers-js-isolate/workers/parser.ts +11 -0
- package/examples/workers-shutdown/README.md +6 -0
- package/examples/workers-shutdown/app.js +26 -0
- package/examples/workers-workerpool/README.md +6 -0
- package/examples/workers-workerpool/app.js +23 -0
- package/examples/workers-workqueue/README.md +8 -0
- package/examples/workers-workqueue/app.js +24 -0
- package/manifest.json +59 -0
- package/package.json +31 -0
- package/stdlib/sloppy/README.md +177 -0
- package/stdlib/sloppy/app.js +2142 -0
- package/stdlib/sloppy/auth.js +1813 -0
- package/stdlib/sloppy/bootstrap.manifest.json +83 -0
- package/stdlib/sloppy/cache.js +1542 -0
- package/stdlib/sloppy/codec.js +1153 -0
- package/stdlib/sloppy/config.js +61 -0
- package/stdlib/sloppy/crypto.js +312 -0
- package/stdlib/sloppy/data.js +2945 -0
- package/stdlib/sloppy/ffi.js +185 -0
- package/stdlib/sloppy/fs.js +795 -0
- package/stdlib/sloppy/health.js +603 -0
- package/stdlib/sloppy/http.js +1595 -0
- package/stdlib/sloppy/index.js +59 -0
- package/stdlib/sloppy/internal/bytes.js +31 -0
- package/stdlib/sloppy/internal/capabilities.js +155 -0
- package/stdlib/sloppy/internal/config.js +640 -0
- package/stdlib/sloppy/internal/disposable.js +31 -0
- package/stdlib/sloppy/internal/headers.js +63 -0
- package/stdlib/sloppy/internal/intrinsics.js +2 -0
- package/stdlib/sloppy/internal/json.js +20 -0
- package/stdlib/sloppy/internal/logging.js +278 -0
- package/stdlib/sloppy/internal/modules.js +405 -0
- package/stdlib/sloppy/internal/redaction.js +87 -0
- package/stdlib/sloppy/internal/routes.js +2279 -0
- package/stdlib/sloppy/internal/runtime-classic.js +19837 -0
- package/stdlib/sloppy/internal/services.js +690 -0
- package/stdlib/sloppy/internal/shared.js +32 -0
- package/stdlib/sloppy/internal/testhost-diagnostics.js +88 -0
- package/stdlib/sloppy/internal/testhost-http-server.js +238 -0
- package/stdlib/sloppy/internal/testhost-http.js +118 -0
- package/stdlib/sloppy/internal/testhost-loopback.js +50 -0
- package/stdlib/sloppy/internal/testservices-docker.js +154 -0
- package/stdlib/sloppy/internal/validation.js +117 -0
- package/stdlib/sloppy/metrics.js +427 -0
- package/stdlib/sloppy/net.js +5208 -0
- package/stdlib/sloppy/node/assert/strict.js +39 -0
- package/stdlib/sloppy/node/assert.js +228 -0
- package/stdlib/sloppy/node/buffer.js +247 -0
- package/stdlib/sloppy/node/console.js +33 -0
- package/stdlib/sloppy/node/constants.js +9 -0
- package/stdlib/sloppy/node/crypto.js +89 -0
- package/stdlib/sloppy/node/diagnostics_channel.js +41 -0
- package/stdlib/sloppy/node/events.js +113 -0
- package/stdlib/sloppy/node/fs/promises.js +27 -0
- package/stdlib/sloppy/node/fs.js +280 -0
- package/stdlib/sloppy/node/http.js +11 -0
- package/stdlib/sloppy/node/https.js +11 -0
- package/stdlib/sloppy/node/module.js +40 -0
- package/stdlib/sloppy/node/os.js +22 -0
- package/stdlib/sloppy/node/path.js +78 -0
- package/stdlib/sloppy/node/perf_hooks.js +12 -0
- package/stdlib/sloppy/node/process.js +129 -0
- package/stdlib/sloppy/node/querystring.js +21 -0
- package/stdlib/sloppy/node/stream/promises.js +3 -0
- package/stdlib/sloppy/node/stream.js +132 -0
- package/stdlib/sloppy/node/string_decoder.js +23 -0
- package/stdlib/sloppy/node/timers.js +26 -0
- package/stdlib/sloppy/node/tty.js +18 -0
- package/stdlib/sloppy/node/url.js +17 -0
- package/stdlib/sloppy/node/util.js +95 -0
- package/stdlib/sloppy/node/zlib.js +72 -0
- package/stdlib/sloppy/orm.js +2188 -0
- package/stdlib/sloppy/os.js +580 -0
- package/stdlib/sloppy/problem-details.js +29 -0
- package/stdlib/sloppy/providers/sqlite.js +26 -0
- package/stdlib/sloppy/rate-limit.js +856 -0
- package/stdlib/sloppy/realtime.js +1508 -0
- package/stdlib/sloppy/redis.js +1272 -0
- package/stdlib/sloppy/request-id.js +184 -0
- package/stdlib/sloppy/request-logging.js +101 -0
- package/stdlib/sloppy/results.js +933 -0
- package/stdlib/sloppy/schema.js +546 -0
- package/stdlib/sloppy/testing.js +4081 -0
- package/stdlib/sloppy/testservices.js +1041 -0
- package/stdlib/sloppy/time.js +894 -0
- package/stdlib/sloppy/webhooks.js +1330 -0
- package/stdlib/sloppy/workers.js +986 -0
- package/templates/api/README.md +82 -0
- package/templates/api/appsettings.Development.json +14 -0
- package/templates/api/appsettings.json +13 -0
- package/templates/api/data/.gitkeep +1 -0
- package/templates/api/gitignore +4 -0
- package/templates/api/migrations/0001_create_users.sql +1 -0
- package/templates/api/package.json +16 -0
- package/templates/api/public/hello.txt +1 -0
- package/templates/api/sloppy.json +14 -0
- package/templates/api/src/config.ts +1 -0
- package/templates/api/src/db/migrate.ts +14 -0
- package/templates/api/src/db/schema.ts +4 -0
- package/templates/api/src/db/usersRepository.ts +23 -0
- package/templates/api/src/main.ts +18 -0
- package/templates/api/src/models/user.ts +7 -0
- package/templates/api/src/routes/health.ts +20 -0
- package/templates/api/src/routes/users.ts +40 -0
- package/templates/api/src/services/usersService.ts +21 -0
- package/templates/api/tsconfig.json +15 -0
- package/templates/cli/README.md +16 -0
- package/templates/cli/gitignore +2 -0
- package/templates/cli/package.json +13 -0
- package/templates/cli/sloppy.json +6 -0
- package/templates/cli/src/commands/echo.ts +9 -0
- package/templates/cli/src/commands/inspect.ts +20 -0
- package/templates/cli/src/main.ts +50 -0
- package/templates/cli/tsconfig.json +15 -0
- package/templates/minimal-api/README.md +14 -0
- package/templates/minimal-api/gitignore +3 -0
- package/templates/minimal-api/package.json +14 -0
- package/templates/minimal-api/sloppy.json +5 -0
- package/templates/minimal-api/src/main.ts +9 -0
- package/templates/minimal-api/tsconfig.json +15 -0
- package/templates/node-compat/README.md +40 -0
- package/templates/node-compat/gitignore +2 -0
- package/templates/node-compat/package.json +11 -0
- package/templates/node-compat/sloppy.json +6 -0
- package/templates/node-compat/src/main.ts +40 -0
- package/templates/package-api/README.md +44 -0
- package/templates/package-api/fixtures/validator-lite/index.js +7 -0
- package/templates/package-api/fixtures/validator-lite/package.json +6 -0
- package/templates/package-api/gitignore +3 -0
- package/templates/package-api/package.json +17 -0
- package/templates/package-api/sloppy.json +5 -0
- package/templates/package-api/src/main.ts +10 -0
- package/templates/package-api/src/routes/health.ts +5 -0
- package/templates/package-api/src/routes/users.ts +12 -0
- package/templates/package-api/tsconfig.json +15 -0
- package/templates/program/README.md +12 -0
- package/templates/program/gitignore +1 -0
- package/templates/program/package.json +10 -0
- package/templates/program/sloppy.json +6 -0
- package/templates/program/src/main.ts +9 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"catalog": "Sloppy dogfood and example evidence catalog",
|
|
4
|
+
"statusVocabulary": [
|
|
5
|
+
"available",
|
|
6
|
+
"v8-gated",
|
|
7
|
+
"package-gated",
|
|
8
|
+
"live-provider-gated",
|
|
9
|
+
"blocked",
|
|
10
|
+
"unavailable"
|
|
11
|
+
],
|
|
12
|
+
"resultVocabulary": [
|
|
13
|
+
"PASS",
|
|
14
|
+
"FAIL",
|
|
15
|
+
"SKIPPED",
|
|
16
|
+
"UNAVAILABLE",
|
|
17
|
+
"NOT RUN"
|
|
18
|
+
],
|
|
19
|
+
"scenarios": [
|
|
20
|
+
{
|
|
21
|
+
"id": "hello-artifact",
|
|
22
|
+
"feature": "hello",
|
|
23
|
+
"status": "v8-gated",
|
|
24
|
+
"lane": "artifact",
|
|
25
|
+
"source": "examples/compiler-hello/app.js",
|
|
26
|
+
"artifactFixture": "compiler/tests/fixtures/hello-mapget/expected",
|
|
27
|
+
"once": {
|
|
28
|
+
"method": "GET",
|
|
29
|
+
"target": "/"
|
|
30
|
+
},
|
|
31
|
+
"stdoutContains": [
|
|
32
|
+
"Hello from Sloppy"
|
|
33
|
+
],
|
|
34
|
+
"requiresV8": true,
|
|
35
|
+
"defaultNonV8Result": "UNAVAILABLE",
|
|
36
|
+
"evidence": "V8-enabled sloppy run --artifacts evidence is required for positive execution; default non-V8 runs must report the V8 requirement."
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"id": "hello-source-input",
|
|
40
|
+
"feature": "hello",
|
|
41
|
+
"status": "v8-gated",
|
|
42
|
+
"lane": "source-input",
|
|
43
|
+
"sourceFixture": "tests/fixtures/source-input/hello-minimal",
|
|
44
|
+
"example": "examples/hello-minimal/src/main.ts",
|
|
45
|
+
"once": {
|
|
46
|
+
"method": "GET",
|
|
47
|
+
"target": "/hello/Ada"
|
|
48
|
+
},
|
|
49
|
+
"stdoutContains": [
|
|
50
|
+
"\"hello\":\"Ada\""
|
|
51
|
+
],
|
|
52
|
+
"requiresV8": true,
|
|
53
|
+
"defaultNonV8Result": "UNAVAILABLE",
|
|
54
|
+
"evidence": "Source-input compile/diagnostic behavior is validated by the fixture harness; positive handler execution requires a V8-enabled build."
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"id": "prealpha-control-plane",
|
|
58
|
+
"feature": "app host dogfood",
|
|
59
|
+
"status": "v8-gated",
|
|
60
|
+
"lane": "project source-input",
|
|
61
|
+
"project": "examples/prealpha-control-plane",
|
|
62
|
+
"source": "examples/prealpha-control-plane/src/main.js",
|
|
63
|
+
"once": {
|
|
64
|
+
"method": "GET",
|
|
65
|
+
"target": "/projects?owner=runtime"
|
|
66
|
+
},
|
|
67
|
+
"stdoutContains": [
|
|
68
|
+
"Compiler Platform"
|
|
69
|
+
],
|
|
70
|
+
"requiresCompiler": true,
|
|
71
|
+
"requiresV8": true,
|
|
72
|
+
"defaultNonV8Result": "UNAVAILABLE",
|
|
73
|
+
"evidence": "The app host coverage suite imports the same route modules through Testing.createHost; CMake source-input lanes verify project-mode artifacts, CLI inspection, non-V8 diagnostics, and V8-gated once execution."
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"id": "package-hello-artifact",
|
|
77
|
+
"feature": "package",
|
|
78
|
+
"status": "package-gated",
|
|
79
|
+
"lane": "package outside-checkout",
|
|
80
|
+
"metadataFixture": "tests/fixtures/package/windows-default/case.json",
|
|
81
|
+
"requiresPackage": true,
|
|
82
|
+
"requiresV8": false,
|
|
83
|
+
"defaultMissingPackageResult": "SKIPPED",
|
|
84
|
+
"evidence": "Package-mode dogfood runs only when an archive path is supplied; missing package input is reported as skipped."
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"id": "http-app",
|
|
88
|
+
"feature": "HTTP",
|
|
89
|
+
"status": "v8-gated",
|
|
90
|
+
"lane": "runtime transport",
|
|
91
|
+
"blockedBy": [],
|
|
92
|
+
"reason": "HTTP/1.1 server behavior is covered by transport and source-input run lanes. Positive app execution still requires a V8-enabled runtime."
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"id": "https-app",
|
|
96
|
+
"feature": "HTTPS/TLS",
|
|
97
|
+
"status": "v8-gated",
|
|
98
|
+
"lane": "experimental TLS transport",
|
|
99
|
+
"blockedBy": [],
|
|
100
|
+
"reason": "Inbound TLS listener support is experimental and covered by opt-in transport lanes. Positive app execution still requires a V8-enabled runtime."
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"id": "sqlite-app",
|
|
104
|
+
"feature": "SQLite",
|
|
105
|
+
"status": "v8-gated",
|
|
106
|
+
"lane": "source-input framework",
|
|
107
|
+
"blockedBy": [],
|
|
108
|
+
"reason": "Typed SQLite provider metadata and wrappers are emitted for framework apps. Positive CRUD execution still requires the native provider bridge and a V8-enabled runtime."
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"id": "postgresql-app",
|
|
112
|
+
"feature": "PostgreSQL",
|
|
113
|
+
"status": "live-provider-gated",
|
|
114
|
+
"lane": "live-provider app",
|
|
115
|
+
"blockedBy": [],
|
|
116
|
+
"reason": "PostgreSQL dogfood requires live-provider evidence and service configuration outside default CI."
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"id": "sqlserver-app",
|
|
120
|
+
"feature": "SQL Server",
|
|
121
|
+
"status": "live-provider-gated",
|
|
122
|
+
"lane": "live-provider app",
|
|
123
|
+
"blockedBy": [],
|
|
124
|
+
"reason": "SQL Server dogfood requires live-provider evidence, ODBC driver availability, and service configuration outside default CI."
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"id": "framework-app",
|
|
128
|
+
"feature": "Framework",
|
|
129
|
+
"status": "v8-gated",
|
|
130
|
+
"lane": "source-input framework",
|
|
131
|
+
"sourceFixture": "tests/fixtures/source-input/framework-foundation",
|
|
132
|
+
"blockedBy": [],
|
|
133
|
+
"reason": "Framework source-input extraction covers static middleware, CORS, request IDs, request logging, controllers, services, and app-host test evidence. Positive emitted-app execution still requires a V8-enabled runtime."
|
|
134
|
+
}
|
|
135
|
+
]
|
|
136
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Dynamic Module Include
|
|
2
|
+
|
|
3
|
+
This example demonstrates computed dynamic imports over a sealed module graph.
|
|
4
|
+
|
|
5
|
+
`src/main.ts` imports a plugin by name:
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
await import("./plugins/" + name + ".js");
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
The possible plugins are included by `moduleInclude` in `sloppy.json`.
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
sloppy build
|
|
15
|
+
sloppy deps .sloppy
|
|
16
|
+
sloppy run -- alpha
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Dynamic import controls when a known module is evaluated. It is not
|
|
20
|
+
unrestricted runtime file or package discovery.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
This asset is included to show assetInclude metadata next to moduleInclude.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Ergonomics Example
|
|
2
|
+
|
|
3
|
+
Bootstrap developer ergonomics API-shape example.
|
|
4
|
+
This example shows the current bootstrap surface: route groups, result helpers,
|
|
5
|
+
schema metadata, config, logging, and services. It uses the current bootstrap stdlib
|
|
6
|
+
source path and is validated as an API-shape example.
|
|
7
|
+
|
|
8
|
+
What works today:
|
|
9
|
+
|
|
10
|
+
- `Sloppy.createBuilder()` creates the JavaScript-only bootstrap builder.
|
|
11
|
+
- Config, memory logging, and string-token services can be registered before `build()`.
|
|
12
|
+
- `app.mapGroup("/users")` creates an in-memory route group.
|
|
13
|
+
- Group child routes compose prefixes, so `"/users"` plus `"{id:int}"` becomes
|
|
14
|
+
`"/users/{id:int}"`.
|
|
15
|
+
- `withTags("Users")` and `withName("Users")` store group metadata on child route
|
|
16
|
+
snapshots.
|
|
17
|
+
- `Results.ok`, `Results.accepted`, and `Results.noContent` create frozen descriptors.
|
|
18
|
+
- `schema.object(...)` and `schema.string().min(...)` create inspectable validation
|
|
19
|
+
metadata and standalone validators.
|
|
20
|
+
- CTest statically verifies this example imports the current stdlib path and uses the
|
|
21
|
+
expected API shape.
|
|
22
|
+
|
|
23
|
+
Current product state:
|
|
24
|
+
|
|
25
|
+
- This source-stdlib example is documentation-first and checked by CTest as an API-shape
|
|
26
|
+
fixture.
|
|
27
|
+
- `sloppy run --artifacts` currently runs emitted artifacts such as
|
|
28
|
+
`examples/compiler-hello`.
|
|
29
|
+
- `sloppyc` compilation, route-group/schema extraction, and `app.plan.json` emission
|
|
30
|
+
for this broader builder shape are planned separately.
|
|
31
|
+
- The bounded `sloppy run` path currently loads generated artifacts. Source-shape loading,
|
|
32
|
+
request-context materialization, and request body/query parsing for this example belong
|
|
33
|
+
to later app-host runtime work.
|
|
34
|
+
- Native HTTP route parameters reach JavaScript handler context in later runtime work; this
|
|
35
|
+
example uses `route.id ?? "demo"` to stay honest in bootstrap mode.
|
|
36
|
+
- Validation metadata currently remains route metadata. Automatic `400` responses belong
|
|
37
|
+
to a later validation pipeline.
|
|
38
|
+
- OpenAPI generation is planned separately.
|
|
39
|
+
- `app.run` and `app.listen` belong to later app-host runtime work.
|
|
40
|
+
|
|
41
|
+
This directory remains a checked-in documentation and fixture example for the current
|
|
42
|
+
application host shape.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Sloppy, Results, schema } from "sloppy";
|
|
2
|
+
|
|
3
|
+
const builder = Sloppy.createBuilder();
|
|
4
|
+
|
|
5
|
+
builder.config.addObject({
|
|
6
|
+
"app.name": "Sloppy Ergonomics Demo",
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
builder.logging.addMemorySink();
|
|
10
|
+
builder.services.addSingleton("users.message", () => "hello from the bootstrap app host");
|
|
11
|
+
|
|
12
|
+
const app = builder.build();
|
|
13
|
+
|
|
14
|
+
const SearchQuery = schema.object({
|
|
15
|
+
q: schema.string().min(1),
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const users = app.mapGroup("/users")
|
|
19
|
+
.withTags("Users")
|
|
20
|
+
.withName("Users");
|
|
21
|
+
|
|
22
|
+
users.mapGet("{id:int}", ({ route, services }) => {
|
|
23
|
+
return Results.ok({
|
|
24
|
+
id: route.id ?? "demo",
|
|
25
|
+
message: services.get("users.message"),
|
|
26
|
+
});
|
|
27
|
+
}).withName("Users.Get");
|
|
28
|
+
|
|
29
|
+
users.mapGet("/search", { query: SearchQuery }, () => {
|
|
30
|
+
return Results.accepted({
|
|
31
|
+
status: "shape-only",
|
|
32
|
+
});
|
|
33
|
+
}).withName("Users.Search");
|
|
34
|
+
|
|
35
|
+
app.mapGet("/health", () => Results.noContent())
|
|
36
|
+
.withName("Health");
|
|
37
|
+
|
|
38
|
+
export default app;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Framework Controller Example
|
|
2
|
+
|
|
3
|
+
Bootstrap controller API-shape example.
|
|
4
|
+
This example shows the implemented bootstrap `app.mapController(...)` surface, explicit
|
|
5
|
+
method mapping, and constructor injection through the same service provider used by route
|
|
6
|
+
handlers.
|
|
7
|
+
|
|
8
|
+
## Limitations
|
|
9
|
+
|
|
10
|
+
This is a bootstrap controller example, not a `sloppyc` source-input example.
|
|
11
|
+
Controller class compiler extraction, decorators, reflection-style scanning,
|
|
12
|
+
and package discovery are outside this example.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Sloppy, Results } from "sloppy";
|
|
2
|
+
|
|
3
|
+
class GreetingService {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.prefix = "user";
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
class UsersController {
|
|
10
|
+
static inject = ["GreetingService"];
|
|
11
|
+
|
|
12
|
+
constructor(greeting) {
|
|
13
|
+
this.greeting = greeting;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
get(ctx) {
|
|
17
|
+
return Results.ok({
|
|
18
|
+
message: `${this.greeting.prefix}-${ctx.route.id}`,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const app = Sloppy.create();
|
|
24
|
+
|
|
25
|
+
app.services.addScoped("GreetingService", () => new GreetingService());
|
|
26
|
+
|
|
27
|
+
app.mapController("/users", UsersController, (users) => {
|
|
28
|
+
users.get("/{id:int}", "get").withName("Users.Get");
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export default app;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Framework DI Services Example
|
|
2
|
+
|
|
3
|
+
A runnable example showing request-scoped dependency injection.
|
|
4
|
+
|
|
5
|
+
The app registers singleton, scoped, and transient services with literal service
|
|
6
|
+
tokens. The compiler emits service registration metadata, and the generated
|
|
7
|
+
runtime wrapper creates one request scope for handler injection.
|
|
8
|
+
|
|
9
|
+
```powershell
|
|
10
|
+
.\build\windows-relwithdebinfo\sloppy.exe run examples/framework-di-services/app.ts --once GET /di/42
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Scope
|
|
14
|
+
|
|
15
|
+
This example covers literal service registration and request-scoped injection.
|
|
16
|
+
Service scanning, external package modules, and decorator discovery are not
|
|
17
|
+
shown here.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Sloppy, Results, Route, Service } from "sloppy";
|
|
2
|
+
|
|
3
|
+
type GreetingService = {
|
|
4
|
+
prefix: string;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
type RequestCounter = {
|
|
8
|
+
value: number;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
type TransientStamp = {
|
|
12
|
+
value: string;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const app = Sloppy.create();
|
|
16
|
+
|
|
17
|
+
app.services.addSingleton("GreetingService", () => ({
|
|
18
|
+
prefix: "user",
|
|
19
|
+
}));
|
|
20
|
+
|
|
21
|
+
app.services.addScoped("RequestCounter", () => ({
|
|
22
|
+
value: 7,
|
|
23
|
+
}));
|
|
24
|
+
|
|
25
|
+
app.services.addTransient("TransientStamp", () => ({
|
|
26
|
+
value: "transient",
|
|
27
|
+
}));
|
|
28
|
+
|
|
29
|
+
app.get("/di/{id:int}", (
|
|
30
|
+
id: Route<number>,
|
|
31
|
+
greeting: Service<GreetingService>,
|
|
32
|
+
counter: Service<RequestCounter>,
|
|
33
|
+
stamp: Service<TransientStamp>,
|
|
34
|
+
) => Results.ok({
|
|
35
|
+
message: `${greeting.prefix}-${id}`,
|
|
36
|
+
counter: counter.value,
|
|
37
|
+
stamp: stamp.value,
|
|
38
|
+
})).withName("Di.Get");
|
|
39
|
+
|
|
40
|
+
export default app;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Framework Explicit Binding Example
|
|
2
|
+
|
|
3
|
+
A compile-time example for explicit handler-parameter binding.
|
|
4
|
+
|
|
5
|
+
The handler uses explicit `Route`, `Query`, `Header`, `Body`, and request-context
|
|
6
|
+
binding wrappers. This produces deterministic binding metadata for the current
|
|
7
|
+
supported wrapper subset.
|
|
8
|
+
|
|
9
|
+
## Scope
|
|
10
|
+
|
|
11
|
+
The example is limited to the explicit binding wrappers shown in `app.ts`.
|
|
12
|
+
Decorators, service scanning, and broad coercion behavior are not covered here.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Sloppy,
|
|
3
|
+
Results,
|
|
4
|
+
Body,
|
|
5
|
+
Header,
|
|
6
|
+
Query,
|
|
7
|
+
RequestContext,
|
|
8
|
+
Route,
|
|
9
|
+
} from "sloppy";
|
|
10
|
+
|
|
11
|
+
type UserPatch = {
|
|
12
|
+
displayName?: string;
|
|
13
|
+
tags?: string[];
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const app = Sloppy.create();
|
|
17
|
+
|
|
18
|
+
app.patch("/tenants/{tenantId}/users/{id:int}", (
|
|
19
|
+
tenantId: Route<string>,
|
|
20
|
+
id: Route<number>,
|
|
21
|
+
traceId: Header<"x-trace-id">,
|
|
22
|
+
includeAudit: Query<boolean>,
|
|
23
|
+
patch: Body<UserPatch>,
|
|
24
|
+
ctx: RequestContext,
|
|
25
|
+
) => Results.ok({
|
|
26
|
+
tenantId,
|
|
27
|
+
id,
|
|
28
|
+
traceId,
|
|
29
|
+
includeAudit,
|
|
30
|
+
patch,
|
|
31
|
+
method: ctx.request.method,
|
|
32
|
+
})).withName("Users.Patch");
|
|
33
|
+
|
|
34
|
+
export default app;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Framework Hello Example
|
|
2
|
+
|
|
3
|
+
A minimal runnable example for the current compiler/runtime subset.
|
|
4
|
+
|
|
5
|
+
It shows a TypeScript source file going through the source-input path, Plan
|
|
6
|
+
metadata emission, typed route parameter materialization, and a `Results.ok(...)`
|
|
7
|
+
response from V8.
|
|
8
|
+
|
|
9
|
+
```powershell
|
|
10
|
+
.\build\windows-relwithdebinfo\sloppy.exe run examples/framework-hello/app.ts --once GET /hello/Ada
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Scope
|
|
14
|
+
|
|
15
|
+
This example covers a single hello route. Package resolution, live providers,
|
|
16
|
+
and broader HTTP features are covered by separate examples.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Sloppy, Results, RequestContext, Route } from "sloppy";
|
|
2
|
+
|
|
3
|
+
const app = Sloppy.create();
|
|
4
|
+
|
|
5
|
+
app.get("/health", () => Results.text("ok")).withName("Health.Get");
|
|
6
|
+
|
|
7
|
+
app.get("/hello/{name}", (
|
|
8
|
+
name: Route<string>,
|
|
9
|
+
ctx: RequestContext,
|
|
10
|
+
) => Results.ok({
|
|
11
|
+
hello: name,
|
|
12
|
+
method: ctx.request.method,
|
|
13
|
+
path: ctx.request.path,
|
|
14
|
+
})).withName("Hello.Get");
|
|
15
|
+
|
|
16
|
+
export default app;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Framework PostgreSQL CRUD Example
|
|
2
|
+
|
|
3
|
+
## What this shows
|
|
4
|
+
|
|
5
|
+
A users API backed by PostgreSQL:
|
|
6
|
+
|
|
7
|
+
- typed `Body<T>` and `Route<T>` handler parameters;
|
|
8
|
+
- `Postgres<"main">` typed provider injection;
|
|
9
|
+
- PostgreSQL placeholders (`$1`, `$2`);
|
|
10
|
+
- request `signal` and `deadline` passed to database calls;
|
|
11
|
+
- `Results.ok`, `Results.notFound`, and `Results.created`.
|
|
12
|
+
|
|
13
|
+
## Requirements
|
|
14
|
+
|
|
15
|
+
- A V8-enabled `sloppy` runtime.
|
|
16
|
+
- A PostgreSQL service with a test database and `users` table.
|
|
17
|
+
- PostgreSQL client support. Current alpha packages use system or
|
|
18
|
+
build-provided libpq; package-local PostgreSQL provider packages are not
|
|
19
|
+
shipped yet.
|
|
20
|
+
- `Sloppy__Providers__postgres__main__connectionString` set in the environment.
|
|
21
|
+
|
|
22
|
+
You do not need PostgreSQL or libpq for normal Sloppy apps, the Quickstart,
|
|
23
|
+
Program Mode, SQLite, templates, or package support.
|
|
24
|
+
|
|
25
|
+
Example table shape:
|
|
26
|
+
|
|
27
|
+
```sql
|
|
28
|
+
create table users (
|
|
29
|
+
id serial primary key,
|
|
30
|
+
name text not null,
|
|
31
|
+
email text not null unique
|
|
32
|
+
);
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Run
|
|
36
|
+
|
|
37
|
+
Set the connection string and run the PostgreSQL integration checks:
|
|
38
|
+
|
|
39
|
+
```powershell
|
|
40
|
+
$env:Sloppy__Providers__postgres__main__connectionString = "postgres://<user>:<password>@<host>:<port>/<db>"
|
|
41
|
+
.\tools\windows\test-live-postgres.ps1
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Expected result
|
|
45
|
+
|
|
46
|
+
The script runs the PostgreSQL native and bridge tests selected by:
|
|
47
|
+
|
|
48
|
+
```powershell
|
|
49
|
+
ctest --test-dir build\windows-relwithdebinfo --output-on-failure -R "data\.postgres\.live_provider|conformance\.postgres\.(native_live|bridge_live)"
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
With the table and connection string configured, `GET /users` returns JSON rows
|
|
53
|
+
from the PostgreSQL database.
|
|
54
|
+
|
|
55
|
+
## Files to look at
|
|
56
|
+
|
|
57
|
+
- `app.ts` — `Postgres<"main">` injection and PostgreSQL SQL statements.
|
|
58
|
+
- Generated `.sloppy/app.plan.json` — inferred `postgres/main` provider metadata.
|
|
59
|
+
- `docs/api/data.md` — PostgreSQL setup and connection string convention.
|
|
60
|
+
|
|
61
|
+
## Scope
|
|
62
|
+
|
|
63
|
+
Schema setup is manual for this example. Migrations, ORM-style modeling,
|
|
64
|
+
deployment guidance, and future PostgreSQL provider-package distribution are
|
|
65
|
+
outside this example. Package dependency behavior is covered by the
|
|
66
|
+
package/dependency examples.
|
|
67
|
+
|
|
68
|
+
## Related docs
|
|
69
|
+
|
|
70
|
+
- `docs/api/data.md`
|
|
71
|
+
- `docs/reference/providers.md`
|
|
72
|
+
- `docs/reference/framework.md`
|
|
73
|
+
- `docs/internals/provider-runtime.md`
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Body,
|
|
3
|
+
Email,
|
|
4
|
+
NonEmptyString,
|
|
5
|
+
PositiveInt,
|
|
6
|
+
RequestContext,
|
|
7
|
+
Results,
|
|
8
|
+
Route,
|
|
9
|
+
Sloppy,
|
|
10
|
+
} from "sloppy";
|
|
11
|
+
import { Postgres } from "sloppy/providers/postgres";
|
|
12
|
+
|
|
13
|
+
type UserCreate = {
|
|
14
|
+
name: NonEmptyString;
|
|
15
|
+
email: Email;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
type UserDto = {
|
|
19
|
+
id: number;
|
|
20
|
+
name: string;
|
|
21
|
+
email: string;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const app = Sloppy.create();
|
|
25
|
+
|
|
26
|
+
app.get("/users", async (db: Postgres<"main">, ctx: RequestContext) => {
|
|
27
|
+
const users = await db.query<UserDto>(
|
|
28
|
+
"select id, name, email from users order by id",
|
|
29
|
+
[],
|
|
30
|
+
{ signal: ctx.signal, deadline: ctx.deadline },
|
|
31
|
+
);
|
|
32
|
+
return Results.ok(users);
|
|
33
|
+
}).withName("Users.List");
|
|
34
|
+
|
|
35
|
+
app.get("/users/{id:int}", async (
|
|
36
|
+
id: Route<PositiveInt>,
|
|
37
|
+
db: Postgres<"main">,
|
|
38
|
+
ctx: RequestContext,
|
|
39
|
+
) => {
|
|
40
|
+
const user = await db.queryOne<UserDto>(
|
|
41
|
+
"select id, name, email from users where id = $1",
|
|
42
|
+
[id],
|
|
43
|
+
{ signal: ctx.signal, deadline: ctx.deadline },
|
|
44
|
+
);
|
|
45
|
+
return user === null ? Results.notFound() : Results.ok(user);
|
|
46
|
+
}).withName("Users.Get");
|
|
47
|
+
|
|
48
|
+
app.post("/users", async (
|
|
49
|
+
input: Body<UserCreate>,
|
|
50
|
+
db: Postgres<"main">,
|
|
51
|
+
ctx: RequestContext,
|
|
52
|
+
) => {
|
|
53
|
+
const user = await db.queryOne<UserDto>(
|
|
54
|
+
"insert into users (name, email) values ($1, $2) returning id, name, email",
|
|
55
|
+
[input.name, input.email],
|
|
56
|
+
{ signal: ctx.signal, deadline: ctx.deadline },
|
|
57
|
+
);
|
|
58
|
+
if (user === null) {
|
|
59
|
+
throw new Error("PostgreSQL user insert did not return a row.");
|
|
60
|
+
}
|
|
61
|
+
return Results.created(`/users/${user.id}`, user);
|
|
62
|
+
}).withName("Users.Create");
|
|
63
|
+
|
|
64
|
+
export default app;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Framework SQLite CRUD Example
|
|
2
|
+
|
|
3
|
+
## What this shows
|
|
4
|
+
|
|
5
|
+
A small users API backed by SQLite:
|
|
6
|
+
|
|
7
|
+
- typed `Body<T>` and `Route<T>` handler parameters;
|
|
8
|
+
- `Sqlite<"main">` typed provider injection;
|
|
9
|
+
- provider config from `appsettings.json`;
|
|
10
|
+
- request `signal` and `deadline` passed through to database calls;
|
|
11
|
+
- `Results.ok`, `Results.notFound`, and `Results.created`.
|
|
12
|
+
|
|
13
|
+
## Requirements
|
|
14
|
+
|
|
15
|
+
- A V8-enabled `sloppy` runtime.
|
|
16
|
+
- The SQLite provider bridge available in that runtime.
|
|
17
|
+
|
|
18
|
+
## Run
|
|
19
|
+
|
|
20
|
+
From the repository root:
|
|
21
|
+
|
|
22
|
+
```powershell
|
|
23
|
+
.\build\windows-relwithdebinfo\sloppy.exe run examples/framework-sqlite-crud/app.ts --once GET /users
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Expected response
|
|
27
|
+
|
|
28
|
+
A JSON array of seeded users:
|
|
29
|
+
|
|
30
|
+
```json
|
|
31
|
+
[{"id":1,"name":"Ada Lovelace","email":"ada@example.test"},{"id":2,"name":"Grace Hopper","email":"grace@example.test"}]
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Files to look at
|
|
35
|
+
|
|
36
|
+
- `app.ts` — typed handlers, SQLite injection, seed data, and CRUD routes.
|
|
37
|
+
- `appsettings.json` — provider configuration for `sqlite/main`.
|
|
38
|
+
- Generated `.sloppy/app.plan.json` — inferred provider/capability metadata
|
|
39
|
+
and route bindings after `sloppy build`.
|
|
40
|
+
|
|
41
|
+
## Scope
|
|
42
|
+
|
|
43
|
+
This is not an ORM or migration layer. PostgreSQL and SQL Server versions of the
|
|
44
|
+
same shape live in separate examples and need their own database setup.
|
|
45
|
+
|
|
46
|
+
## Related docs
|
|
47
|
+
|
|
48
|
+
- `docs/api/data.md`
|
|
49
|
+
- `docs/guide/sqlite.md`
|
|
50
|
+
- `docs/reference/providers.md`
|
|
51
|
+
- `docs/reference/framework.md`
|
|
52
|
+
- `docs/internals/provider-runtime.md`
|