semola 0.5.1 → 0.5.3
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 +144 -29
- package/dist/api/core/index.cjs +206 -0
- package/dist/api/core/index.d.cts +21 -0
- package/dist/api/core/index.d.cts.map +1 -0
- package/dist/api/core/index.d.mts +21 -0
- package/dist/api/core/index.d.mts.map +1 -0
- package/dist/api/core/index.mjs +208 -0
- package/dist/api/core/index.mjs.map +1 -0
- package/dist/api/core/types.d.cts +107 -0
- package/dist/api/core/types.d.cts.map +1 -0
- package/dist/api/core/types.d.mts +107 -0
- package/dist/api/core/types.d.mts.map +1 -0
- package/dist/api/middleware/index.cjs +8 -0
- package/dist/api/middleware/index.d.cts +11 -0
- package/dist/api/middleware/index.d.cts.map +1 -0
- package/dist/api/middleware/index.d.mts +11 -0
- package/dist/api/middleware/index.d.mts.map +1 -0
- package/dist/api/middleware/index.mjs +10 -0
- package/dist/api/middleware/index.mjs.map +1 -0
- package/dist/api/middleware/types.d.cts +16 -0
- package/dist/api/middleware/types.d.cts.map +1 -0
- package/dist/api/middleware/types.d.mts +16 -0
- package/dist/api/middleware/types.d.mts.map +1 -0
- package/dist/api/openapi/index.cjs +254 -0
- package/dist/api/openapi/index.mjs +256 -0
- package/dist/api/openapi/index.mjs.map +1 -0
- package/dist/api/openapi/types.d.cts +60 -0
- package/dist/api/openapi/types.d.cts.map +1 -0
- package/dist/api/openapi/types.d.mts +60 -0
- package/dist/api/openapi/types.d.mts.map +1 -0
- package/dist/api/validation/index.cjs +64 -0
- package/dist/api/validation/index.mjs +61 -0
- package/dist/api/validation/index.mjs.map +1 -0
- package/dist/cache/types.d.cts +17 -0
- package/dist/cache/types.d.cts.map +1 -0
- package/dist/cache/types.d.mts +17 -0
- package/dist/cache/types.d.mts.map +1 -0
- package/dist/cron/builder/index.cjs +166 -0
- package/dist/cron/builder/index.d.cts +28 -0
- package/dist/cron/builder/index.d.cts.map +1 -0
- package/dist/cron/builder/index.d.mts +28 -0
- package/dist/cron/builder/index.d.mts.map +1 -0
- package/dist/cron/builder/index.mjs +163 -0
- package/dist/cron/builder/index.mjs.map +1 -0
- package/dist/cron/builder/types.cjs +27 -0
- package/dist/cron/builder/types.d.cts +79 -0
- package/dist/cron/builder/types.d.cts.map +1 -0
- package/dist/cron/builder/types.d.mts +79 -0
- package/dist/cron/builder/types.d.mts.map +1 -0
- package/dist/cron/builder/types.mjs +28 -0
- package/dist/cron/builder/types.mjs.map +1 -0
- package/dist/cron/core/index.cjs +308 -0
- package/dist/cron/core/index.d.cts +39 -0
- package/dist/cron/core/index.d.cts.map +1 -0
- package/dist/cron/core/index.d.mts +39 -0
- package/dist/cron/core/index.d.mts.map +1 -0
- package/dist/cron/core/index.mjs +310 -0
- package/dist/cron/core/index.mjs.map +1 -0
- package/dist/cron/core/scanner.cjs +237 -0
- package/dist/cron/core/scanner.mjs +238 -0
- package/dist/cron/core/scanner.mjs.map +1 -0
- package/dist/cron/core/types.d.cts +11 -0
- package/dist/cron/core/types.d.cts.map +1 -0
- package/dist/cron/core/types.d.mts +11 -0
- package/dist/cron/core/types.d.mts.map +1 -0
- package/dist/errors/types.d.cts +5 -0
- package/dist/errors/types.d.cts.map +1 -0
- package/dist/errors/types.d.mts +5 -0
- package/dist/errors/types.d.mts.map +1 -0
- package/dist/i18n/types.d.cts +13 -0
- package/dist/i18n/types.d.cts.map +1 -0
- package/dist/i18n/types.d.mts +13 -0
- package/dist/i18n/types.d.mts.map +1 -0
- package/dist/lib/api/index.cjs +5 -0
- package/dist/lib/api/index.d.cts +5 -0
- package/dist/lib/api/index.d.mts +5 -0
- package/dist/lib/api/index.mjs +3 -0
- package/dist/lib/cache/index.cjs +74 -0
- package/dist/lib/cache/index.d.cts +36 -0
- package/dist/lib/cache/index.d.cts.map +1 -0
- package/dist/lib/cache/index.d.mts +36 -0
- package/dist/lib/cache/index.d.mts.map +1 -0
- package/dist/lib/cache/index.mjs +75 -0
- package/dist/lib/cache/index.mjs.map +1 -0
- package/dist/lib/cron/index.cjs +13 -0
- package/dist/lib/cron/index.d.cts +4 -0
- package/dist/lib/cron/index.d.mts +4 -0
- package/dist/lib/cron/index.mjs +4 -0
- package/dist/lib/errors/index.cjs +30 -0
- package/dist/lib/errors/index.d.cts +13 -0
- package/dist/lib/errors/index.d.cts.map +1 -0
- package/dist/lib/errors/index.d.mts +13 -0
- package/dist/lib/errors/index.d.mts.map +1 -0
- package/dist/lib/errors/index.mjs +28 -0
- package/dist/lib/errors/index.mjs.map +1 -0
- package/dist/lib/i18n/index.cjs +42 -0
- package/dist/lib/i18n/index.d.cts +20 -0
- package/dist/lib/i18n/index.d.cts.map +1 -0
- package/dist/lib/i18n/index.d.mts +20 -0
- package/dist/lib/i18n/index.d.mts.map +1 -0
- package/dist/lib/i18n/index.mjs +43 -0
- package/dist/lib/i18n/index.mjs.map +1 -0
- package/dist/lib/logging/index.cjs +18 -0
- package/dist/lib/logging/index.d.cts +7 -0
- package/dist/lib/logging/index.d.mts +7 -0
- package/dist/lib/logging/index.mjs +5 -0
- package/dist/lib/orm/index.cjs +20 -0
- package/dist/lib/orm/index.d.cts +7 -0
- package/dist/lib/orm/index.d.mts +7 -0
- package/dist/lib/orm/index.mjs +6 -0
- package/dist/lib/policy/index.cjs +99 -0
- package/dist/lib/policy/index.d.cts +21 -0
- package/dist/lib/policy/index.d.cts.map +1 -0
- package/dist/lib/policy/index.d.mts +21 -0
- package/dist/lib/policy/index.d.mts.map +1 -0
- package/dist/lib/policy/index.mjs +81 -0
- package/dist/lib/policy/index.mjs.map +1 -0
- package/dist/lib/prompts/index.cjs +409 -0
- package/dist/lib/prompts/index.d.cts +31 -0
- package/dist/lib/prompts/index.d.cts.map +1 -0
- package/dist/lib/prompts/index.d.mts +31 -0
- package/dist/lib/prompts/index.d.mts.map +1 -0
- package/dist/lib/prompts/index.mjs +405 -0
- package/dist/lib/prompts/index.mjs.map +1 -0
- package/dist/lib/pubsub/index.cjs +117 -0
- package/dist/lib/pubsub/index.d.cts +36 -0
- package/dist/lib/pubsub/index.d.cts.map +1 -0
- package/dist/lib/pubsub/index.d.mts +36 -0
- package/dist/lib/pubsub/index.d.mts.map +1 -0
- package/dist/lib/pubsub/index.mjs +118 -0
- package/dist/lib/pubsub/index.mjs.map +1 -0
- package/dist/lib/queue/index.cjs +182 -0
- package/dist/lib/queue/index.d.cts +32 -0
- package/dist/lib/queue/index.d.cts.map +1 -0
- package/dist/lib/queue/index.d.mts +32 -0
- package/dist/lib/queue/index.d.mts.map +1 -0
- package/dist/lib/queue/index.mjs +183 -0
- package/dist/lib/queue/index.mjs.map +1 -0
- package/dist/lib/workflow/index.cjs +534 -0
- package/dist/lib/workflow/index.d.cts +7 -0
- package/dist/lib/workflow/index.d.cts.map +1 -0
- package/dist/lib/workflow/index.d.mts +7 -0
- package/dist/lib/workflow/index.d.mts.map +1 -0
- package/dist/lib/workflow/index.mjs +535 -0
- package/dist/lib/workflow/index.mjs.map +1 -0
- package/dist/logging/core/index.cjs +99 -0
- package/dist/logging/core/index.d.cts +26 -0
- package/dist/logging/core/index.d.cts.map +1 -0
- package/dist/logging/core/index.d.mts +26 -0
- package/dist/logging/core/index.d.mts.map +1 -0
- package/dist/logging/core/index.mjs +99 -0
- package/dist/logging/core/index.mjs.map +1 -0
- package/dist/logging/core/types.cjs +10 -0
- package/dist/logging/core/types.d.cts +22 -0
- package/dist/logging/core/types.d.cts.map +1 -0
- package/dist/logging/core/types.d.mts +22 -0
- package/dist/logging/core/types.d.mts.map +1 -0
- package/dist/logging/core/types.mjs +12 -0
- package/dist/logging/core/types.mjs.map +1 -0
- package/dist/logging/formatter/index.cjs +119 -0
- package/dist/logging/formatter/index.d.cts +27 -0
- package/dist/logging/formatter/index.d.cts.map +1 -0
- package/dist/logging/formatter/index.d.mts +27 -0
- package/dist/logging/formatter/index.d.mts.map +1 -0
- package/dist/logging/formatter/index.mjs +115 -0
- package/dist/logging/formatter/index.mjs.map +1 -0
- package/dist/logging/formatter/types.d.cts +5 -0
- package/dist/logging/formatter/types.d.cts.map +1 -0
- package/dist/logging/formatter/types.d.mts +5 -0
- package/dist/logging/formatter/types.d.mts.map +1 -0
- package/dist/logging/provider/index.cjs +165 -0
- package/dist/logging/provider/index.d.cts +28 -0
- package/dist/logging/provider/index.d.cts.map +1 -0
- package/dist/logging/provider/index.d.mts +28 -0
- package/dist/logging/provider/index.d.mts.map +1 -0
- package/dist/logging/provider/index.mjs +165 -0
- package/dist/logging/provider/index.mjs.map +1 -0
- package/dist/logging/provider/types.d.cts +23 -0
- package/dist/logging/provider/types.d.cts.map +1 -0
- package/dist/logging/provider/types.d.mts +23 -0
- package/dist/logging/provider/types.d.mts.map +1 -0
- package/dist/node_modules/@standard-schema/spec/dist/index.d.cts +80 -0
- package/dist/node_modules/@standard-schema/spec/dist/index.d.cts.map +1 -0
- package/dist/node_modules/@standard-schema/spec/dist/index.d.mts +80 -0
- package/dist/node_modules/@standard-schema/spec/dist/index.d.mts.map +1 -0
- package/dist/orm/column.cjs +137 -0
- package/dist/orm/column.d.cts +121 -0
- package/dist/orm/column.d.cts.map +1 -0
- package/dist/orm/column.d.mts +121 -0
- package/dist/orm/column.d.mts.map +1 -0
- package/dist/orm/column.mjs +132 -0
- package/dist/orm/column.mjs.map +1 -0
- package/dist/orm/dialect/index.cjs +14 -0
- package/dist/orm/dialect/index.mjs +16 -0
- package/dist/orm/dialect/index.mjs.map +1 -0
- package/dist/orm/dialect/mysql.cjs +31 -0
- package/dist/orm/dialect/mysql.mjs +33 -0
- package/dist/orm/dialect/mysql.mjs.map +1 -0
- package/dist/orm/dialect/postgres.cjs +23 -0
- package/dist/orm/dialect/postgres.mjs +25 -0
- package/dist/orm/dialect/postgres.mjs.map +1 -0
- package/dist/orm/dialect/sqlite.cjs +31 -0
- package/dist/orm/dialect/sqlite.mjs +33 -0
- package/dist/orm/dialect/sqlite.mjs.map +1 -0
- package/dist/orm/dialect/utils.cjs +8 -0
- package/dist/orm/dialect/utils.mjs +10 -0
- package/dist/orm/dialect/utils.mjs.map +1 -0
- package/dist/orm/internal/table-columns.cjs +31 -0
- package/dist/orm/internal/table-columns.mjs +32 -0
- package/dist/orm/internal/table-columns.mjs.map +1 -0
- package/dist/orm/internal/table-lookup.cjs +35 -0
- package/dist/orm/internal/table-lookup.mjs +35 -0
- package/dist/orm/internal/table-lookup.mjs.map +1 -0
- package/dist/orm/internal/table-relations.cjs +28 -0
- package/dist/orm/internal/table-relations.mjs +29 -0
- package/dist/orm/internal/table-relations.mjs.map +1 -0
- package/dist/orm/migration/config.cjs +7 -0
- package/dist/orm/migration/config.d.cts +7 -0
- package/dist/orm/migration/config.d.cts.map +1 -0
- package/dist/orm/migration/config.d.mts +7 -0
- package/dist/orm/migration/config.d.mts.map +1 -0
- package/dist/orm/migration/config.mjs +8 -0
- package/dist/orm/migration/config.mjs.map +1 -0
- package/dist/orm/migration/types.d.cts +20 -0
- package/dist/orm/migration/types.d.cts.map +1 -0
- package/dist/orm/migration/types.d.mts +20 -0
- package/dist/orm/migration/types.d.mts.map +1 -0
- package/dist/orm/orm.cjs +41 -0
- package/dist/orm/orm.d.cts +18 -0
- package/dist/orm/orm.d.cts.map +1 -0
- package/dist/orm/orm.d.mts +18 -0
- package/dist/orm/orm.d.mts.map +1 -0
- package/dist/orm/orm.mjs +43 -0
- package/dist/orm/orm.mjs.map +1 -0
- package/dist/orm/relation.cjs +18 -0
- package/dist/orm/relation.d.cts +8 -0
- package/dist/orm/relation.d.cts.map +1 -0
- package/dist/orm/relation.d.mts +8 -0
- package/dist/orm/relation.d.mts.map +1 -0
- package/dist/orm/relation.mjs +19 -0
- package/dist/orm/relation.mjs.map +1 -0
- package/dist/orm/runtime/builders/mutations.cjs +29 -0
- package/dist/orm/runtime/builders/mutations.mjs +28 -0
- package/dist/orm/runtime/builders/mutations.mjs.map +1 -0
- package/dist/orm/runtime/builders/select.cjs +18 -0
- package/dist/orm/runtime/builders/select.mjs +19 -0
- package/dist/orm/runtime/builders/select.mjs.map +1 -0
- package/dist/orm/runtime/client.cjs +90 -0
- package/dist/orm/runtime/client.mjs +92 -0
- package/dist/orm/runtime/client.mjs.map +1 -0
- package/dist/orm/runtime/context.cjs +49 -0
- package/dist/orm/runtime/context.mjs +51 -0
- package/dist/orm/runtime/context.mjs.map +1 -0
- package/dist/orm/runtime/dialect/index.cjs +11 -0
- package/dist/orm/runtime/dialect/index.mjs +13 -0
- package/dist/orm/runtime/dialect/index.mjs.map +1 -0
- package/dist/orm/runtime/dialect/mysql.cjs +95 -0
- package/dist/orm/runtime/dialect/mysql.mjs +97 -0
- package/dist/orm/runtime/dialect/mysql.mjs.map +1 -0
- package/dist/orm/runtime/dialect/postgres.cjs +51 -0
- package/dist/orm/runtime/dialect/postgres.mjs +53 -0
- package/dist/orm/runtime/dialect/postgres.mjs.map +1 -0
- package/dist/orm/runtime/dialect/sqlite.cjs +4 -0
- package/dist/orm/runtime/dialect/sqlite.mjs +7 -0
- package/dist/orm/runtime/dialect/sqlite.mjs.map +1 -0
- package/dist/orm/runtime/errors.cjs +19 -0
- package/dist/orm/runtime/errors.mjs +21 -0
- package/dist/orm/runtime/errors.mjs.map +1 -0
- package/dist/orm/runtime/hydrate/many.cjs +46 -0
- package/dist/orm/runtime/hydrate/many.mjs +48 -0
- package/dist/orm/runtime/hydrate/many.mjs.map +1 -0
- package/dist/orm/runtime/hydrate/one.cjs +38 -0
- package/dist/orm/runtime/hydrate/one.mjs +40 -0
- package/dist/orm/runtime/hydrate/one.mjs.map +1 -0
- package/dist/orm/runtime/hydrate.cjs +49 -0
- package/dist/orm/runtime/hydrate.mjs +51 -0
- package/dist/orm/runtime/hydrate.mjs.map +1 -0
- package/dist/orm/runtime/rows.cjs +30 -0
- package/dist/orm/runtime/rows.mjs +31 -0
- package/dist/orm/runtime/rows.mjs.map +1 -0
- package/dist/orm/runtime/utils.cjs +27 -0
- package/dist/orm/runtime/utils.mjs +27 -0
- package/dist/orm/runtime/utils.mjs.map +1 -0
- package/dist/orm/sql/parse-array.cjs +64 -0
- package/dist/orm/sql/parse-array.mjs +66 -0
- package/dist/orm/sql/parse-array.mjs.map +1 -0
- package/dist/orm/sql/plan/select.cjs +36 -0
- package/dist/orm/sql/plan/select.mjs +38 -0
- package/dist/orm/sql/plan/select.mjs.map +1 -0
- package/dist/orm/sql/plan/where/operators.cjs +95 -0
- package/dist/orm/sql/plan/where/operators.mjs +97 -0
- package/dist/orm/sql/plan/where/operators.mjs.map +1 -0
- package/dist/orm/sql/plan/where.cjs +59 -0
- package/dist/orm/sql/plan/where.mjs +61 -0
- package/dist/orm/sql/plan/where.mjs.map +1 -0
- package/dist/orm/sql/serialize/clauses.cjs +36 -0
- package/dist/orm/sql/serialize/clauses.mjs +37 -0
- package/dist/orm/sql/serialize/clauses.mjs.map +1 -0
- package/dist/orm/sql/serialize/joins.cjs +31 -0
- package/dist/orm/sql/serialize/joins.mjs +33 -0
- package/dist/orm/sql/serialize/joins.mjs.map +1 -0
- package/dist/orm/sql/serialize/values.cjs +30 -0
- package/dist/orm/sql/serialize/values.mjs +32 -0
- package/dist/orm/sql/serialize/values.mjs.map +1 -0
- package/dist/orm/sql/serialize/where/predicate.cjs +73 -0
- package/dist/orm/sql/serialize/where/predicate.mjs +75 -0
- package/dist/orm/sql/serialize/where/predicate.mjs.map +1 -0
- package/dist/orm/sql/serialize/where/tree.cjs +26 -0
- package/dist/orm/sql/serialize/where/tree.mjs +28 -0
- package/dist/orm/sql/serialize/where/tree.mjs.map +1 -0
- package/dist/orm/sql/serialize/where.cjs +10 -0
- package/dist/orm/sql/serialize/where.mjs +12 -0
- package/dist/orm/sql/serialize/where.mjs.map +1 -0
- package/dist/orm/sql/serialize.cjs +24 -0
- package/dist/orm/sql/serialize.mjs +25 -0
- package/dist/orm/sql/serialize.mjs.map +1 -0
- package/dist/orm/table.cjs +12 -0
- package/dist/orm/table.d.cts +12 -0
- package/dist/orm/table.d.cts.map +1 -0
- package/dist/orm/table.d.mts +12 -0
- package/dist/orm/table.d.mts.map +1 -0
- package/dist/orm/table.mjs +14 -0
- package/dist/orm/table.mjs.map +1 -0
- package/dist/orm/types.d.cts +183 -0
- package/dist/orm/types.d.cts.map +1 -0
- package/dist/orm/types.d.mts +183 -0
- package/dist/orm/types.d.mts.map +1 -0
- package/dist/policy/helpers.cjs +206 -0
- package/dist/policy/helpers.d.cts +50 -0
- package/dist/policy/helpers.d.cts.map +1 -0
- package/dist/policy/helpers.d.mts +50 -0
- package/dist/policy/helpers.d.mts.map +1 -0
- package/dist/policy/helpers.mjs +190 -0
- package/dist/policy/helpers.mjs.map +1 -0
- package/dist/policy/types.d.cts +16 -0
- package/dist/policy/types.d.cts.map +1 -0
- package/dist/policy/types.d.mts +16 -0
- package/dist/policy/types.d.mts.map +1 -0
- package/dist/prompts/core/keys.cjs +165 -0
- package/dist/prompts/core/keys.mjs +167 -0
- package/dist/prompts/core/keys.mjs.map +1 -0
- package/dist/prompts/core/runtime.cjs +104 -0
- package/dist/prompts/core/runtime.mjs +106 -0
- package/dist/prompts/core/runtime.mjs.map +1 -0
- package/dist/prompts/core/session.cjs +98 -0
- package/dist/prompts/core/session.mjs +100 -0
- package/dist/prompts/core/session.mjs.map +1 -0
- package/dist/prompts/core/types.d.cts +21 -0
- package/dist/prompts/core/types.d.cts.map +1 -0
- package/dist/prompts/core/types.d.mts +21 -0
- package/dist/prompts/core/types.d.mts.map +1 -0
- package/dist/prompts/types.d.cts +52 -0
- package/dist/prompts/types.d.cts.map +1 -0
- package/dist/prompts/types.d.mts +52 -0
- package/dist/prompts/types.d.mts.map +1 -0
- package/dist/pubsub/types.d.cts +10 -0
- package/dist/pubsub/types.d.cts.map +1 -0
- package/dist/pubsub/types.d.mts +10 -0
- package/dist/pubsub/types.d.mts.map +1 -0
- package/dist/queue/types.d.cts +47 -0
- package/dist/queue/types.d.cts.map +1 -0
- package/dist/queue/types.d.mts +47 -0
- package/dist/queue/types.d.mts.map +1 -0
- package/dist/workflow/types.d.cts +83 -0
- package/dist/workflow/types.d.cts.map +1 -0
- package/dist/workflow/types.d.mts +83 -0
- package/dist/workflow/types.d.mts.map +1 -0
- package/package.json +112 -16
- package/dist/lib/api/core/index.d.ts +0 -15
- package/dist/lib/api/core/index.d.ts.map +0 -1
- package/dist/lib/api/core/index.js +0 -218
- package/dist/lib/api/core/index.js.map +0 -1
- package/dist/lib/api/core/index.test.d.ts +0 -2
- package/dist/lib/api/core/index.test.d.ts.map +0 -1
- package/dist/lib/api/core/index.test.js +0 -219
- package/dist/lib/api/core/index.test.js.map +0 -1
- package/dist/lib/api/core/types.d.ts +0 -109
- package/dist/lib/api/core/types.d.ts.map +0 -1
- package/dist/lib/api/core/types.js +0 -2
- package/dist/lib/api/core/types.js.map +0 -1
- package/dist/lib/api/index.d.ts +0 -5
- package/dist/lib/api/index.d.ts.map +0 -1
- package/dist/lib/api/index.js +0 -3
- package/dist/lib/api/index.js.map +0 -1
- package/dist/lib/api/middleware/index.d.ts +0 -7
- package/dist/lib/api/middleware/index.d.ts.map +0 -1
- package/dist/lib/api/middleware/index.js +0 -7
- package/dist/lib/api/middleware/index.js.map +0 -1
- package/dist/lib/api/middleware/index.test.d.ts +0 -2
- package/dist/lib/api/middleware/index.test.d.ts.map +0 -1
- package/dist/lib/api/middleware/index.test.js +0 -67
- package/dist/lib/api/middleware/index.test.js.map +0 -1
- package/dist/lib/api/middleware/types.d.ts +0 -12
- package/dist/lib/api/middleware/types.d.ts.map +0 -1
- package/dist/lib/api/middleware/types.js +0 -2
- package/dist/lib/api/middleware/types.js.map +0 -1
- package/dist/lib/api/openapi/index.d.ts +0 -31
- package/dist/lib/api/openapi/index.d.ts.map +0 -1
- package/dist/lib/api/openapi/index.js +0 -284
- package/dist/lib/api/openapi/index.js.map +0 -1
- package/dist/lib/api/openapi/index.test.d.ts +0 -2
- package/dist/lib/api/openapi/index.test.d.ts.map +0 -1
- package/dist/lib/api/openapi/index.test.js +0 -359
- package/dist/lib/api/openapi/index.test.js.map +0 -1
- package/dist/lib/api/openapi/types.d.ts +0 -57
- package/dist/lib/api/openapi/types.d.ts.map +0 -1
- package/dist/lib/api/openapi/types.js +0 -5
- package/dist/lib/api/openapi/types.js.map +0 -1
- package/dist/lib/api/validation/index.d.ts +0 -33
- package/dist/lib/api/validation/index.d.ts.map +0 -1
- package/dist/lib/api/validation/index.js +0 -92
- package/dist/lib/api/validation/index.js.map +0 -1
- package/dist/lib/api/validation/index.test.d.ts +0 -2
- package/dist/lib/api/validation/index.test.d.ts.map +0 -1
- package/dist/lib/api/validation/index.test.js +0 -135
- package/dist/lib/api/validation/index.test.js.map +0 -1
- package/dist/lib/cache/index.d.ts +0 -25
- package/dist/lib/cache/index.d.ts.map +0 -1
- package/dist/lib/cache/index.js +0 -62
- package/dist/lib/cache/index.js.map +0 -1
- package/dist/lib/cache/index.test.d.ts +0 -2
- package/dist/lib/cache/index.test.d.ts.map +0 -1
- package/dist/lib/cache/index.test.js +0 -314
- package/dist/lib/cache/index.test.js.map +0 -1
- package/dist/lib/cache/types.d.ts +0 -5
- package/dist/lib/cache/types.d.ts.map +0 -1
- package/dist/lib/cache/types.js +0 -2
- package/dist/lib/cache/types.js.map +0 -1
- package/dist/lib/errors/index.d.ts +0 -9
- package/dist/lib/errors/index.d.ts.map +0 -1
- package/dist/lib/errors/index.js +0 -25
- package/dist/lib/errors/index.js.map +0 -1
- package/dist/lib/errors/index.test.d.ts +0 -2
- package/dist/lib/errors/index.test.d.ts.map +0 -1
- package/dist/lib/errors/index.test.js +0 -197
- package/dist/lib/errors/index.test.js.map +0 -1
- package/dist/lib/errors/types.d.ts +0 -2
- package/dist/lib/errors/types.d.ts.map +0 -1
- package/dist/lib/errors/types.js +0 -2
- package/dist/lib/errors/types.js.map +0 -1
- package/dist/lib/i18n/index.d.ts +0 -18
- package/dist/lib/i18n/index.d.ts.map +0 -1
- package/dist/lib/i18n/index.js +0 -38
- package/dist/lib/i18n/index.js.map +0 -1
- package/dist/lib/i18n/index.test.d.ts +0 -2
- package/dist/lib/i18n/index.test.d.ts.map +0 -1
- package/dist/lib/i18n/index.test.js +0 -402
- package/dist/lib/i18n/index.test.js.map +0 -1
- package/dist/lib/i18n/types.d.ts +0 -15
- package/dist/lib/i18n/types.d.ts.map +0 -1
- package/dist/lib/i18n/types.js +0 -2
- package/dist/lib/i18n/types.js.map +0 -1
- package/dist/lib/policy/index.d.ts +0 -9
- package/dist/lib/policy/index.d.ts.map +0 -1
- package/dist/lib/policy/index.js +0 -51
- package/dist/lib/policy/index.js.map +0 -1
- package/dist/lib/policy/index.test.d.ts +0 -2
- package/dist/lib/policy/index.test.d.ts.map +0 -1
- package/dist/lib/policy/index.test.js +0 -328
- package/dist/lib/policy/index.test.js.map +0 -1
- package/dist/lib/policy/types.d.ts +0 -27
- package/dist/lib/policy/types.d.ts.map +0 -1
- package/dist/lib/policy/types.js +0 -2
- package/dist/lib/policy/types.js.map +0 -1
- package/dist/lib/pubsub/index.d.ts +0 -23
- package/dist/lib/pubsub/index.d.ts.map +0 -1
- package/dist/lib/pubsub/index.js +0 -55
- package/dist/lib/pubsub/index.js.map +0 -1
- package/dist/lib/pubsub/index.test.d.ts +0 -2
- package/dist/lib/pubsub/index.test.d.ts.map +0 -1
- package/dist/lib/pubsub/index.test.js +0 -550
- package/dist/lib/pubsub/index.test.js.map +0 -1
- package/dist/lib/pubsub/types.d.ts +0 -7
- package/dist/lib/pubsub/types.d.ts.map +0 -1
- package/dist/lib/pubsub/types.js +0 -2
- package/dist/lib/pubsub/types.js.map +0 -1
- package/dist/lib/queue/index.d.ts +0 -28
- package/dist/lib/queue/index.d.ts.map +0 -1
- package/dist/lib/queue/index.js +0 -211
- package/dist/lib/queue/index.js.map +0 -1
- package/dist/lib/queue/index.test.d.ts +0 -2
- package/dist/lib/queue/index.test.d.ts.map +0 -1
- package/dist/lib/queue/index.test.js +0 -740
- package/dist/lib/queue/index.test.js.map +0 -1
- package/dist/lib/queue/types.d.ts +0 -52
- package/dist/lib/queue/types.d.ts.map +0 -1
- package/dist/lib/queue/types.js +0 -2
- package/dist/lib/queue/types.js.map +0 -1
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
//#region src/lib/api/openapi/index.ts
|
|
2
|
+
const toOpenAPISchema = (schema, io = "input") => ({ schema: schema["~standard"].jsonSchema[io]({ target: "draft-2020-12" }) });
|
|
3
|
+
const getSchemaDescription = (schema) => {
|
|
4
|
+
const metadata = schema["~standard"];
|
|
5
|
+
if (!metadata) return "";
|
|
6
|
+
if ("description" in metadata && typeof metadata.description === "string") return metadata.description;
|
|
7
|
+
return "";
|
|
8
|
+
};
|
|
9
|
+
const requestFields = [
|
|
10
|
+
"body",
|
|
11
|
+
"query",
|
|
12
|
+
"headers",
|
|
13
|
+
"cookies",
|
|
14
|
+
"params"
|
|
15
|
+
];
|
|
16
|
+
const mergeRequestSchemas = (schemas) => {
|
|
17
|
+
const merged = {};
|
|
18
|
+
for (const schema of schemas) {
|
|
19
|
+
if (!schema) continue;
|
|
20
|
+
for (const field of requestFields) if (schema[field]) merged[field] = schema[field];
|
|
21
|
+
}
|
|
22
|
+
return merged;
|
|
23
|
+
};
|
|
24
|
+
const mergeResponseSchemas = (schemas) => {
|
|
25
|
+
const merged = {};
|
|
26
|
+
for (const schema of schemas) {
|
|
27
|
+
if (!schema) continue;
|
|
28
|
+
for (const status in schema) {
|
|
29
|
+
const statusCode = Number(status);
|
|
30
|
+
const responseSchema = schema[statusCode];
|
|
31
|
+
if (responseSchema) merged[statusCode] = responseSchema;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return Object.keys(merged).length > 0 ? merged : void 0;
|
|
35
|
+
};
|
|
36
|
+
const convertSchemaToOpenApi = async (schema, io = "input") => {
|
|
37
|
+
const result = toOpenAPISchema(schema, io);
|
|
38
|
+
const { schema: jsonSchema } = result;
|
|
39
|
+
const schemaId = jsonSchema.id;
|
|
40
|
+
if (schemaId && typeof schemaId === "string") {
|
|
41
|
+
const schemaWithoutId = { ...jsonSchema };
|
|
42
|
+
delete schemaWithoutId.id;
|
|
43
|
+
delete schemaWithoutId.$schema;
|
|
44
|
+
return {
|
|
45
|
+
schema: { $ref: `#/components/schemas/${schemaId}` },
|
|
46
|
+
components: { schemas: { [schemaId]: schemaWithoutId } }
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
if (jsonSchema.$schema) {
|
|
50
|
+
const schemaWithoutMeta = { ...jsonSchema };
|
|
51
|
+
delete schemaWithoutMeta.$schema;
|
|
52
|
+
return {
|
|
53
|
+
schema: schemaWithoutMeta,
|
|
54
|
+
components: void 0
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
return result;
|
|
58
|
+
};
|
|
59
|
+
const convertSchemaToInlineOpenApi = async (schema, io = "input") => {
|
|
60
|
+
const { schema: jsonSchema } = toOpenAPISchema(schema, io);
|
|
61
|
+
const cleanSchema = { ...jsonSchema };
|
|
62
|
+
delete cleanSchema.$schema;
|
|
63
|
+
delete cleanSchema.id;
|
|
64
|
+
return {
|
|
65
|
+
schema: cleanSchema,
|
|
66
|
+
components: void 0
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
const extractParametersFromSchema = async (schema, location) => {
|
|
70
|
+
const { schema: jsonSchema, components } = await convertSchemaToInlineOpenApi(schema);
|
|
71
|
+
if (jsonSchema.type !== "object") return {
|
|
72
|
+
parameters: [],
|
|
73
|
+
components
|
|
74
|
+
};
|
|
75
|
+
if (!jsonSchema.properties) return {
|
|
76
|
+
parameters: [],
|
|
77
|
+
components
|
|
78
|
+
};
|
|
79
|
+
const parameters = [];
|
|
80
|
+
const requiredFields = jsonSchema.required ?? [];
|
|
81
|
+
for (const name in jsonSchema.properties) {
|
|
82
|
+
const propertySchema = jsonSchema.properties[name];
|
|
83
|
+
const isRequired = requiredFields.includes(name);
|
|
84
|
+
parameters.push({
|
|
85
|
+
name,
|
|
86
|
+
in: location,
|
|
87
|
+
required: isRequired,
|
|
88
|
+
schema: propertySchema
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
return {
|
|
92
|
+
parameters,
|
|
93
|
+
components
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
const normalizePathForOpenAPI = (path) => {
|
|
97
|
+
return path.replace(/:([a-zA-Z_][a-zA-Z0-9_]*)/g, "{$1}");
|
|
98
|
+
};
|
|
99
|
+
const extractPathParameters = (path) => {
|
|
100
|
+
const matches = path.match(/:([a-zA-Z_][a-zA-Z0-9_]*)/g);
|
|
101
|
+
if (!matches) return [];
|
|
102
|
+
return matches.map((match) => match.slice(1));
|
|
103
|
+
};
|
|
104
|
+
const paramSources = [
|
|
105
|
+
["query", "query"],
|
|
106
|
+
["headers", "header"],
|
|
107
|
+
["cookies", "cookie"]
|
|
108
|
+
];
|
|
109
|
+
const createParameters = async (request, path) => {
|
|
110
|
+
const parameters = [];
|
|
111
|
+
const allComponents = [];
|
|
112
|
+
for (const [field, location] of paramSources) if (request[field]) {
|
|
113
|
+
const { parameters: params, components } = await extractParametersFromSchema(request[field], location);
|
|
114
|
+
parameters.push(...params);
|
|
115
|
+
if (components) allComponents.push(components);
|
|
116
|
+
}
|
|
117
|
+
const pathParamNames = extractPathParameters(path);
|
|
118
|
+
if (pathParamNames.length > 0 && request.params) {
|
|
119
|
+
const { schema: jsonSchema, components } = await convertSchemaToInlineOpenApi(request.params);
|
|
120
|
+
if (components) allComponents.push(components);
|
|
121
|
+
if (jsonSchema.type === "object" && jsonSchema.properties) for (const name of pathParamNames) {
|
|
122
|
+
const propertySchema = jsonSchema.properties[name];
|
|
123
|
+
if (propertySchema) parameters.push({
|
|
124
|
+
name,
|
|
125
|
+
in: "path",
|
|
126
|
+
required: true,
|
|
127
|
+
schema: propertySchema
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return {
|
|
132
|
+
parameters,
|
|
133
|
+
components: allComponents
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
const createRequestBody = async (bodySchema) => {
|
|
137
|
+
const { schema, components } = await convertSchemaToOpenApi(bodySchema);
|
|
138
|
+
return {
|
|
139
|
+
components,
|
|
140
|
+
requestBody: {
|
|
141
|
+
required: true,
|
|
142
|
+
content: { "application/json": { schema } }
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
const createResponses = async (response) => {
|
|
147
|
+
const responses = {};
|
|
148
|
+
const allComponents = [];
|
|
149
|
+
if (!response) return {
|
|
150
|
+
responses,
|
|
151
|
+
components: allComponents
|
|
152
|
+
};
|
|
153
|
+
for (const status in response) {
|
|
154
|
+
const statusCode = String(status);
|
|
155
|
+
const schema = response[Number(status)];
|
|
156
|
+
if (!schema) continue;
|
|
157
|
+
const description = getSchemaDescription(schema);
|
|
158
|
+
const { schema: jsonSchema, components } = await convertSchemaToOpenApi(schema, "output");
|
|
159
|
+
if (components) allComponents.push(components);
|
|
160
|
+
responses[statusCode] = {
|
|
161
|
+
description: description || `Response with status ${statusCode}`,
|
|
162
|
+
content: { "application/json": { schema: jsonSchema } }
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
return {
|
|
166
|
+
responses,
|
|
167
|
+
components: allComponents
|
|
168
|
+
};
|
|
169
|
+
};
|
|
170
|
+
const createOperation = async (route, globalMiddlewares, prefix) => {
|
|
171
|
+
const allMiddlewares = [...globalMiddlewares ?? [], ...route.middlewares ?? []];
|
|
172
|
+
const requestSchemas = [];
|
|
173
|
+
const responseSchemas = [];
|
|
174
|
+
for (const middleware of allMiddlewares) {
|
|
175
|
+
requestSchemas.push(middleware.options.request);
|
|
176
|
+
responseSchemas.push(middleware.options.response);
|
|
177
|
+
}
|
|
178
|
+
requestSchemas.push(route.request);
|
|
179
|
+
responseSchemas.push(route.response);
|
|
180
|
+
const mergedRequest = mergeRequestSchemas(requestSchemas);
|
|
181
|
+
const mergedResponse = mergeResponseSchemas(responseSchemas);
|
|
182
|
+
const { parameters, components: parameterComponents } = await createParameters(mergedRequest, prefix ? prefix + route.path : route.path);
|
|
183
|
+
const { responses, components: responseComponents } = await createResponses(mergedResponse);
|
|
184
|
+
const operation = { responses };
|
|
185
|
+
const allComponents = [];
|
|
186
|
+
allComponents.push(...responseComponents);
|
|
187
|
+
allComponents.push(...parameterComponents);
|
|
188
|
+
for (const field of [
|
|
189
|
+
"summary",
|
|
190
|
+
"description",
|
|
191
|
+
"operationId"
|
|
192
|
+
]) if (route[field]) operation[field] = route[field];
|
|
193
|
+
if (route.tags && route.tags.length > 0) operation.tags = route.tags;
|
|
194
|
+
if (parameters.length > 0) operation.parameters = parameters;
|
|
195
|
+
const bodySchema = mergedRequest.body;
|
|
196
|
+
if (bodySchema) {
|
|
197
|
+
const { requestBody, components: bodyComponents } = await createRequestBody(bodySchema);
|
|
198
|
+
operation.requestBody = requestBody;
|
|
199
|
+
if (bodyComponents) allComponents.push(bodyComponents);
|
|
200
|
+
}
|
|
201
|
+
return {
|
|
202
|
+
operation,
|
|
203
|
+
components: allComponents
|
|
204
|
+
};
|
|
205
|
+
};
|
|
206
|
+
const componentKeys = [
|
|
207
|
+
"schemas",
|
|
208
|
+
"responses",
|
|
209
|
+
"parameters",
|
|
210
|
+
"requestBodies"
|
|
211
|
+
];
|
|
212
|
+
const mergeComponents = (componentsArray) => {
|
|
213
|
+
const merged = {};
|
|
214
|
+
for (const components of componentsArray) {
|
|
215
|
+
if (!components) continue;
|
|
216
|
+
for (const key of componentKeys) if (components[key]) merged[key] = {
|
|
217
|
+
...merged[key],
|
|
218
|
+
...components[key]
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
return merged;
|
|
222
|
+
};
|
|
223
|
+
const generateOpenApiSpec = async (options) => {
|
|
224
|
+
const spec = {
|
|
225
|
+
openapi: "3.1.0",
|
|
226
|
+
info: {
|
|
227
|
+
title: options.title,
|
|
228
|
+
description: options.description,
|
|
229
|
+
version: options.version
|
|
230
|
+
},
|
|
231
|
+
paths: {}
|
|
232
|
+
};
|
|
233
|
+
if (options.servers && options.servers.length > 0) spec.servers = options.servers;
|
|
234
|
+
if (options.securitySchemes) spec.components = { securitySchemes: options.securitySchemes };
|
|
235
|
+
const allRouteComponents = [];
|
|
236
|
+
for (const route of options.routes) {
|
|
237
|
+
const openApiPath = normalizePathForOpenAPI(options.prefix ? options.prefix + route.path : route.path);
|
|
238
|
+
const method = route.method.toLowerCase();
|
|
239
|
+
if (!spec.paths[openApiPath]) spec.paths[openApiPath] = {};
|
|
240
|
+
const { operation, components } = await createOperation(route, options.globalMiddlewares ?? [], options.prefix);
|
|
241
|
+
spec.paths[openApiPath][method] = operation;
|
|
242
|
+
allRouteComponents.push(...components);
|
|
243
|
+
}
|
|
244
|
+
const mergedComponents = mergeComponents(allRouteComponents);
|
|
245
|
+
if (!spec.components) spec.components = {};
|
|
246
|
+
if (options.securitySchemes) spec.components.securitySchemes = options.securitySchemes;
|
|
247
|
+
for (const key of componentKeys) {
|
|
248
|
+
const value = mergedComponents[key];
|
|
249
|
+
if (value && Object.keys(value).length > 0) spec.components[key] = value;
|
|
250
|
+
}
|
|
251
|
+
return spec;
|
|
252
|
+
};
|
|
253
|
+
//#endregion
|
|
254
|
+
exports.generateOpenApiSpec = generateOpenApiSpec;
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
//#region src/lib/api/openapi/index.ts
|
|
2
|
+
const toOpenAPISchema = (schema, io = "input") => ({ schema: schema["~standard"].jsonSchema[io]({ target: "draft-2020-12" }) });
|
|
3
|
+
const getSchemaDescription = (schema) => {
|
|
4
|
+
const metadata = schema["~standard"];
|
|
5
|
+
if (!metadata) return "";
|
|
6
|
+
if ("description" in metadata && typeof metadata.description === "string") return metadata.description;
|
|
7
|
+
return "";
|
|
8
|
+
};
|
|
9
|
+
const requestFields = [
|
|
10
|
+
"body",
|
|
11
|
+
"query",
|
|
12
|
+
"headers",
|
|
13
|
+
"cookies",
|
|
14
|
+
"params"
|
|
15
|
+
];
|
|
16
|
+
const mergeRequestSchemas = (schemas) => {
|
|
17
|
+
const merged = {};
|
|
18
|
+
for (const schema of schemas) {
|
|
19
|
+
if (!schema) continue;
|
|
20
|
+
for (const field of requestFields) if (schema[field]) merged[field] = schema[field];
|
|
21
|
+
}
|
|
22
|
+
return merged;
|
|
23
|
+
};
|
|
24
|
+
const mergeResponseSchemas = (schemas) => {
|
|
25
|
+
const merged = {};
|
|
26
|
+
for (const schema of schemas) {
|
|
27
|
+
if (!schema) continue;
|
|
28
|
+
for (const status in schema) {
|
|
29
|
+
const statusCode = Number(status);
|
|
30
|
+
const responseSchema = schema[statusCode];
|
|
31
|
+
if (responseSchema) merged[statusCode] = responseSchema;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return Object.keys(merged).length > 0 ? merged : void 0;
|
|
35
|
+
};
|
|
36
|
+
const convertSchemaToOpenApi = async (schema, io = "input") => {
|
|
37
|
+
const result = toOpenAPISchema(schema, io);
|
|
38
|
+
const { schema: jsonSchema } = result;
|
|
39
|
+
const schemaId = jsonSchema.id;
|
|
40
|
+
if (schemaId && typeof schemaId === "string") {
|
|
41
|
+
const schemaWithoutId = { ...jsonSchema };
|
|
42
|
+
delete schemaWithoutId.id;
|
|
43
|
+
delete schemaWithoutId.$schema;
|
|
44
|
+
return {
|
|
45
|
+
schema: { $ref: `#/components/schemas/${schemaId}` },
|
|
46
|
+
components: { schemas: { [schemaId]: schemaWithoutId } }
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
if (jsonSchema.$schema) {
|
|
50
|
+
const schemaWithoutMeta = { ...jsonSchema };
|
|
51
|
+
delete schemaWithoutMeta.$schema;
|
|
52
|
+
return {
|
|
53
|
+
schema: schemaWithoutMeta,
|
|
54
|
+
components: void 0
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
return result;
|
|
58
|
+
};
|
|
59
|
+
const convertSchemaToInlineOpenApi = async (schema, io = "input") => {
|
|
60
|
+
const { schema: jsonSchema } = toOpenAPISchema(schema, io);
|
|
61
|
+
const cleanSchema = { ...jsonSchema };
|
|
62
|
+
delete cleanSchema.$schema;
|
|
63
|
+
delete cleanSchema.id;
|
|
64
|
+
return {
|
|
65
|
+
schema: cleanSchema,
|
|
66
|
+
components: void 0
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
const extractParametersFromSchema = async (schema, location) => {
|
|
70
|
+
const { schema: jsonSchema, components } = await convertSchemaToInlineOpenApi(schema);
|
|
71
|
+
if (jsonSchema.type !== "object") return {
|
|
72
|
+
parameters: [],
|
|
73
|
+
components
|
|
74
|
+
};
|
|
75
|
+
if (!jsonSchema.properties) return {
|
|
76
|
+
parameters: [],
|
|
77
|
+
components
|
|
78
|
+
};
|
|
79
|
+
const parameters = [];
|
|
80
|
+
const requiredFields = jsonSchema.required ?? [];
|
|
81
|
+
for (const name in jsonSchema.properties) {
|
|
82
|
+
const propertySchema = jsonSchema.properties[name];
|
|
83
|
+
const isRequired = requiredFields.includes(name);
|
|
84
|
+
parameters.push({
|
|
85
|
+
name,
|
|
86
|
+
in: location,
|
|
87
|
+
required: isRequired,
|
|
88
|
+
schema: propertySchema
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
return {
|
|
92
|
+
parameters,
|
|
93
|
+
components
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
const normalizePathForOpenAPI = (path) => {
|
|
97
|
+
return path.replace(/:([a-zA-Z_][a-zA-Z0-9_]*)/g, "{$1}");
|
|
98
|
+
};
|
|
99
|
+
const extractPathParameters = (path) => {
|
|
100
|
+
const matches = path.match(/:([a-zA-Z_][a-zA-Z0-9_]*)/g);
|
|
101
|
+
if (!matches) return [];
|
|
102
|
+
return matches.map((match) => match.slice(1));
|
|
103
|
+
};
|
|
104
|
+
const paramSources = [
|
|
105
|
+
["query", "query"],
|
|
106
|
+
["headers", "header"],
|
|
107
|
+
["cookies", "cookie"]
|
|
108
|
+
];
|
|
109
|
+
const createParameters = async (request, path) => {
|
|
110
|
+
const parameters = [];
|
|
111
|
+
const allComponents = [];
|
|
112
|
+
for (const [field, location] of paramSources) if (request[field]) {
|
|
113
|
+
const { parameters: params, components } = await extractParametersFromSchema(request[field], location);
|
|
114
|
+
parameters.push(...params);
|
|
115
|
+
if (components) allComponents.push(components);
|
|
116
|
+
}
|
|
117
|
+
const pathParamNames = extractPathParameters(path);
|
|
118
|
+
if (pathParamNames.length > 0 && request.params) {
|
|
119
|
+
const { schema: jsonSchema, components } = await convertSchemaToInlineOpenApi(request.params);
|
|
120
|
+
if (components) allComponents.push(components);
|
|
121
|
+
if (jsonSchema.type === "object" && jsonSchema.properties) for (const name of pathParamNames) {
|
|
122
|
+
const propertySchema = jsonSchema.properties[name];
|
|
123
|
+
if (propertySchema) parameters.push({
|
|
124
|
+
name,
|
|
125
|
+
in: "path",
|
|
126
|
+
required: true,
|
|
127
|
+
schema: propertySchema
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return {
|
|
132
|
+
parameters,
|
|
133
|
+
components: allComponents
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
const createRequestBody = async (bodySchema) => {
|
|
137
|
+
const { schema, components } = await convertSchemaToOpenApi(bodySchema);
|
|
138
|
+
return {
|
|
139
|
+
components,
|
|
140
|
+
requestBody: {
|
|
141
|
+
required: true,
|
|
142
|
+
content: { "application/json": { schema } }
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
const createResponses = async (response) => {
|
|
147
|
+
const responses = {};
|
|
148
|
+
const allComponents = [];
|
|
149
|
+
if (!response) return {
|
|
150
|
+
responses,
|
|
151
|
+
components: allComponents
|
|
152
|
+
};
|
|
153
|
+
for (const status in response) {
|
|
154
|
+
const statusCode = String(status);
|
|
155
|
+
const schema = response[Number(status)];
|
|
156
|
+
if (!schema) continue;
|
|
157
|
+
const description = getSchemaDescription(schema);
|
|
158
|
+
const { schema: jsonSchema, components } = await convertSchemaToOpenApi(schema, "output");
|
|
159
|
+
if (components) allComponents.push(components);
|
|
160
|
+
responses[statusCode] = {
|
|
161
|
+
description: description || `Response with status ${statusCode}`,
|
|
162
|
+
content: { "application/json": { schema: jsonSchema } }
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
return {
|
|
166
|
+
responses,
|
|
167
|
+
components: allComponents
|
|
168
|
+
};
|
|
169
|
+
};
|
|
170
|
+
const createOperation = async (route, globalMiddlewares, prefix) => {
|
|
171
|
+
const allMiddlewares = [...globalMiddlewares ?? [], ...route.middlewares ?? []];
|
|
172
|
+
const requestSchemas = [];
|
|
173
|
+
const responseSchemas = [];
|
|
174
|
+
for (const middleware of allMiddlewares) {
|
|
175
|
+
requestSchemas.push(middleware.options.request);
|
|
176
|
+
responseSchemas.push(middleware.options.response);
|
|
177
|
+
}
|
|
178
|
+
requestSchemas.push(route.request);
|
|
179
|
+
responseSchemas.push(route.response);
|
|
180
|
+
const mergedRequest = mergeRequestSchemas(requestSchemas);
|
|
181
|
+
const mergedResponse = mergeResponseSchemas(responseSchemas);
|
|
182
|
+
const { parameters, components: parameterComponents } = await createParameters(mergedRequest, prefix ? prefix + route.path : route.path);
|
|
183
|
+
const { responses, components: responseComponents } = await createResponses(mergedResponse);
|
|
184
|
+
const operation = { responses };
|
|
185
|
+
const allComponents = [];
|
|
186
|
+
allComponents.push(...responseComponents);
|
|
187
|
+
allComponents.push(...parameterComponents);
|
|
188
|
+
for (const field of [
|
|
189
|
+
"summary",
|
|
190
|
+
"description",
|
|
191
|
+
"operationId"
|
|
192
|
+
]) if (route[field]) operation[field] = route[field];
|
|
193
|
+
if (route.tags && route.tags.length > 0) operation.tags = route.tags;
|
|
194
|
+
if (parameters.length > 0) operation.parameters = parameters;
|
|
195
|
+
const bodySchema = mergedRequest.body;
|
|
196
|
+
if (bodySchema) {
|
|
197
|
+
const { requestBody, components: bodyComponents } = await createRequestBody(bodySchema);
|
|
198
|
+
operation.requestBody = requestBody;
|
|
199
|
+
if (bodyComponents) allComponents.push(bodyComponents);
|
|
200
|
+
}
|
|
201
|
+
return {
|
|
202
|
+
operation,
|
|
203
|
+
components: allComponents
|
|
204
|
+
};
|
|
205
|
+
};
|
|
206
|
+
const componentKeys = [
|
|
207
|
+
"schemas",
|
|
208
|
+
"responses",
|
|
209
|
+
"parameters",
|
|
210
|
+
"requestBodies"
|
|
211
|
+
];
|
|
212
|
+
const mergeComponents = (componentsArray) => {
|
|
213
|
+
const merged = {};
|
|
214
|
+
for (const components of componentsArray) {
|
|
215
|
+
if (!components) continue;
|
|
216
|
+
for (const key of componentKeys) if (components[key]) merged[key] = {
|
|
217
|
+
...merged[key],
|
|
218
|
+
...components[key]
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
return merged;
|
|
222
|
+
};
|
|
223
|
+
const generateOpenApiSpec = async (options) => {
|
|
224
|
+
const spec = {
|
|
225
|
+
openapi: "3.1.0",
|
|
226
|
+
info: {
|
|
227
|
+
title: options.title,
|
|
228
|
+
description: options.description,
|
|
229
|
+
version: options.version
|
|
230
|
+
},
|
|
231
|
+
paths: {}
|
|
232
|
+
};
|
|
233
|
+
if (options.servers && options.servers.length > 0) spec.servers = options.servers;
|
|
234
|
+
if (options.securitySchemes) spec.components = { securitySchemes: options.securitySchemes };
|
|
235
|
+
const allRouteComponents = [];
|
|
236
|
+
for (const route of options.routes) {
|
|
237
|
+
const openApiPath = normalizePathForOpenAPI(options.prefix ? options.prefix + route.path : route.path);
|
|
238
|
+
const method = route.method.toLowerCase();
|
|
239
|
+
if (!spec.paths[openApiPath]) spec.paths[openApiPath] = {};
|
|
240
|
+
const { operation, components } = await createOperation(route, options.globalMiddlewares ?? [], options.prefix);
|
|
241
|
+
spec.paths[openApiPath][method] = operation;
|
|
242
|
+
allRouteComponents.push(...components);
|
|
243
|
+
}
|
|
244
|
+
const mergedComponents = mergeComponents(allRouteComponents);
|
|
245
|
+
if (!spec.components) spec.components = {};
|
|
246
|
+
if (options.securitySchemes) spec.components.securitySchemes = options.securitySchemes;
|
|
247
|
+
for (const key of componentKeys) {
|
|
248
|
+
const value = mergedComponents[key];
|
|
249
|
+
if (value && Object.keys(value).length > 0) spec.components[key] = value;
|
|
250
|
+
}
|
|
251
|
+
return spec;
|
|
252
|
+
};
|
|
253
|
+
//#endregion
|
|
254
|
+
export { generateOpenApiSpec };
|
|
255
|
+
|
|
256
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/lib/api/openapi/index.ts"],"sourcesContent":["import type {\n StandardJSONSchemaV1,\n StandardSchemaV1,\n} from \"@standard-schema/spec\";\nimport type { OpenAPIV3_1 } from \"openapi-types\";\nimport type { RequestSchema, ResponseSchema } from \"../core/types.js\";\nimport type { Middleware } from \"../middleware/index.js\";\nimport type {\n OpenApiOperation,\n OpenApiParameter,\n OpenApiResponse,\n OpenApiSpec,\n} from \"./types.js\";\n\ntype RouteConfigInternal = {\n path: string;\n method: string;\n request?: RequestSchema;\n response?: ResponseSchema;\n middlewares?: readonly Middleware[];\n handler: unknown;\n summary?: string;\n description?: string;\n operationId?: string;\n tags?: string[];\n};\n\ntype OpenApiGeneratorOptions = {\n title: string;\n description?: string;\n version: string;\n prefix?: string;\n servers?: Array<{ url: string; description?: string }>;\n securitySchemes?: Record<string, unknown>;\n routes: RouteConfigInternal[];\n globalMiddlewares?: readonly Middleware[];\n};\n\nconst toOpenAPISchema = (\n schema: StandardSchemaV1,\n io: \"input\" | \"output\" = \"input\",\n) => ({\n schema: (schema as unknown as StandardJSONSchemaV1)[\"~standard\"].jsonSchema[\n io\n ]({ target: \"draft-2020-12\" }),\n});\n\nconst getSchemaDescription = (schema: StandardSchemaV1) => {\n const metadata = schema[\"~standard\"];\n\n if (!metadata) {\n return \"\";\n }\n\n if (\"description\" in metadata && typeof metadata.description === \"string\") {\n return metadata.description;\n }\n\n return \"\";\n};\n\nconst requestFields = [\n \"body\",\n \"query\",\n \"headers\",\n \"cookies\",\n \"params\",\n] as const;\n\nconst mergeRequestSchemas = (schemas: Array<RequestSchema | undefined>) => {\n const merged: RequestSchema = {};\n\n for (const schema of schemas) {\n if (!schema) {\n continue;\n }\n\n for (const field of requestFields) {\n if (schema[field]) {\n merged[field] = schema[field];\n }\n }\n }\n\n return merged;\n};\n\nconst mergeResponseSchemas = (schemas: Array<ResponseSchema | undefined>) => {\n const merged: ResponseSchema = {};\n\n for (const schema of schemas) {\n if (!schema) {\n continue;\n }\n\n for (const status in schema) {\n const statusCode = Number(status);\n const responseSchema = schema[statusCode];\n\n if (responseSchema) {\n merged[statusCode] = responseSchema;\n }\n }\n }\n\n return Object.keys(merged).length > 0 ? merged : undefined;\n};\n\ntype JsonSchema = {\n type?: string;\n properties?: Record<string, unknown>;\n required?: string[];\n [key: string]: unknown;\n};\n\nconst convertSchemaToOpenApi = async (\n schema: StandardSchemaV1,\n io: \"input\" | \"output\" = \"input\",\n) => {\n const result = toOpenAPISchema(schema, io);\n const { schema: jsonSchema } = result as {\n schema: JsonSchema;\n components?: OpenAPIV3_1.ComponentsObject;\n };\n\n // Check if schema has an id (from .meta({ id: \"...\" }))\n const schemaId = jsonSchema.id;\n\n if (schemaId && typeof schemaId === \"string\") {\n // Extract to components and return a reference\n const schemaWithoutId = { ...jsonSchema };\n delete schemaWithoutId.id;\n delete schemaWithoutId.$schema;\n\n return {\n schema: { $ref: `#/components/schemas/${schemaId}` },\n components: {\n schemas: {\n [schemaId]: schemaWithoutId,\n },\n } as OpenAPIV3_1.ComponentsObject,\n };\n }\n\n // Remove $schema from inline schemas\n if (jsonSchema.$schema) {\n const schemaWithoutMeta = { ...jsonSchema };\n delete schemaWithoutMeta.$schema;\n return {\n schema: schemaWithoutMeta,\n components: undefined,\n };\n }\n\n return result as {\n schema: JsonSchema;\n components?: OpenAPIV3_1.ComponentsObject;\n };\n};\n\n// Convert schema to inline JSON schema (for parameters that don't support $ref)\nconst convertSchemaToInlineOpenApi = async (\n schema: StandardSchemaV1,\n io: \"input\" | \"output\" = \"input\",\n) => {\n const result = toOpenAPISchema(schema, io);\n const { schema: jsonSchema } = result as {\n schema: JsonSchema;\n components?: OpenAPIV3_1.ComponentsObject;\n };\n\n // Remove $schema and id from inline schemas\n const cleanSchema = { ...jsonSchema };\n delete cleanSchema.$schema;\n delete cleanSchema.id;\n\n return {\n schema: cleanSchema,\n components: undefined,\n };\n};\n\nconst extractParametersFromSchema = async (\n schema: StandardSchemaV1,\n location: \"query\" | \"header\" | \"cookie\",\n) => {\n const { schema: jsonSchema, components } =\n await convertSchemaToInlineOpenApi(schema);\n\n if (jsonSchema.type !== \"object\") {\n return { parameters: [], components };\n }\n\n if (!jsonSchema.properties) {\n return { parameters: [], components };\n }\n\n const parameters: OpenApiParameter[] = [];\n const requiredFields = jsonSchema.required ?? [];\n\n for (const name in jsonSchema.properties) {\n const propertySchema = jsonSchema.properties[name];\n const isRequired = requiredFields.includes(name);\n\n parameters.push({\n name,\n in: location,\n required: isRequired,\n schema: propertySchema,\n });\n }\n\n return { parameters, components };\n};\n\nconst normalizePathForOpenAPI = (path: string) => {\n // Convert Bun-style path parameters (:param) to OpenAPI syntax ({param})\n return path.replace(/:([a-zA-Z_][a-zA-Z0-9_]*)/g, \"{$1}\");\n};\n\nconst extractPathParameters = (path: string) => {\n const matches = path.match(/:([a-zA-Z_][a-zA-Z0-9_]*)/g);\n\n if (!matches) {\n return [];\n }\n\n return matches.map((match) => match.slice(1));\n};\n\nconst paramSources = [\n [\"query\", \"query\"],\n [\"headers\", \"header\"],\n [\"cookies\", \"cookie\"],\n] as const;\n\nconst createParameters = async (request: RequestSchema, path: string) => {\n const parameters: OpenApiParameter[] = [];\n const allComponents: Array<OpenAPIV3_1.ComponentsObject | undefined> = [];\n\n for (const [field, location] of paramSources) {\n if (request[field]) {\n const { parameters: params, components } =\n await extractParametersFromSchema(request[field], location);\n parameters.push(...params);\n if (components) {\n allComponents.push(components);\n }\n }\n }\n\n const pathParamNames = extractPathParameters(path);\n\n if (pathParamNames.length > 0 && request.params) {\n const { schema: jsonSchema, components } =\n await convertSchemaToInlineOpenApi(request.params);\n\n if (components) {\n allComponents.push(components);\n }\n\n if (jsonSchema.type === \"object\" && jsonSchema.properties) {\n for (const name of pathParamNames) {\n const propertySchema = jsonSchema.properties[name];\n\n if (propertySchema) {\n parameters.push({\n name,\n in: \"path\",\n required: true,\n schema: propertySchema,\n });\n }\n }\n }\n }\n\n return { parameters, components: allComponents };\n};\n\nconst createRequestBody = async (bodySchema: StandardSchemaV1) => {\n const { schema, components } = await convertSchemaToOpenApi(bodySchema);\n\n return {\n components,\n requestBody: {\n required: true,\n content: {\n \"application/json\": {\n schema,\n },\n },\n },\n };\n};\n\nconst createResponses = async (response?: ResponseSchema) => {\n const responses: Record<string, OpenApiResponse> = {};\n const allComponents: Array<OpenAPIV3_1.ComponentsObject | undefined> = [];\n\n if (!response) {\n return { responses, components: allComponents };\n }\n\n for (const status in response) {\n const statusCode = String(status);\n const schema = response[Number(status)];\n\n if (!schema) {\n continue;\n }\n\n const description = getSchemaDescription(schema);\n const { schema: jsonSchema, components } = await convertSchemaToOpenApi(\n schema,\n \"output\",\n );\n\n if (components) {\n allComponents.push(components);\n }\n\n responses[statusCode] = {\n description: description || `Response with status ${statusCode}`,\n content: {\n \"application/json\": {\n schema: jsonSchema,\n },\n },\n };\n }\n\n return { responses, components: allComponents };\n};\n\nconst createOperation = async (\n route: RouteConfigInternal,\n globalMiddlewares: readonly Middleware[],\n prefix?: string,\n) => {\n const allMiddlewares = [\n ...(globalMiddlewares ?? []),\n ...(route.middlewares ?? []),\n ];\n\n const requestSchemas: Array<RequestSchema | undefined> = [];\n const responseSchemas: Array<ResponseSchema | undefined> = [];\n\n for (const middleware of allMiddlewares) {\n requestSchemas.push(middleware.options.request);\n responseSchemas.push(middleware.options.response);\n }\n\n requestSchemas.push(route.request);\n responseSchemas.push(route.response);\n\n const mergedRequest = mergeRequestSchemas(requestSchemas);\n const mergedResponse = mergeResponseSchemas(responseSchemas);\n\n const fullPath = prefix ? prefix + route.path : route.path;\n const { parameters, components: parameterComponents } =\n await createParameters(mergedRequest, fullPath);\n const { responses, components: responseComponents } =\n await createResponses(mergedResponse);\n\n const operation: OpenApiOperation = {\n responses,\n };\n\n const allComponents: Array<OpenAPIV3_1.ComponentsObject | undefined> = [];\n allComponents.push(...responseComponents);\n allComponents.push(...parameterComponents);\n\n for (const field of [\"summary\", \"description\", \"operationId\"] as const) {\n if (route[field]) {\n operation[field] = route[field];\n }\n }\n\n if (route.tags && route.tags.length > 0) {\n operation.tags = route.tags;\n }\n\n if (parameters.length > 0) {\n operation.parameters = parameters;\n }\n\n const bodySchema = mergedRequest.body;\n\n if (bodySchema) {\n const { requestBody, components: bodyComponents } =\n await createRequestBody(bodySchema);\n operation.requestBody = requestBody;\n if (bodyComponents) {\n allComponents.push(bodyComponents);\n }\n }\n\n return { operation, components: allComponents };\n};\n\nconst componentKeys = [\n \"schemas\",\n \"responses\",\n \"parameters\",\n \"requestBodies\",\n] as const;\n\n// Merges multiple ComponentsObject into a single object\n// Handles deduplication by merging schemas with the same name\nconst mergeComponents = (\n componentsArray: Array<OpenAPIV3_1.ComponentsObject | undefined>,\n): OpenAPIV3_1.ComponentsObject => {\n const merged: Record<string, Record<string, unknown>> = {};\n\n for (const components of componentsArray) {\n if (!components) {\n continue;\n }\n\n for (const key of componentKeys) {\n if (components[key]) {\n merged[key] = { ...merged[key], ...components[key] };\n }\n }\n }\n\n return merged;\n};\n\nexport const generateOpenApiSpec = async (options: OpenApiGeneratorOptions) => {\n const spec: OpenApiSpec = {\n openapi: \"3.1.0\",\n info: {\n title: options.title,\n description: options.description,\n version: options.version,\n },\n paths: {},\n };\n\n if (options.servers && options.servers.length > 0) {\n spec.servers = options.servers;\n }\n\n if (options.securitySchemes) {\n spec.components = {\n securitySchemes: options.securitySchemes,\n };\n }\n\n const allRouteComponents: Array<OpenAPIV3_1.ComponentsObject | undefined> =\n [];\n\n for (const route of options.routes) {\n const fullPath = options.prefix ? options.prefix + route.path : route.path;\n const openApiPath = normalizePathForOpenAPI(fullPath);\n const method = route.method.toLowerCase();\n\n if (!spec.paths[openApiPath]) {\n spec.paths[openApiPath] = {};\n }\n\n const { operation, components } = await createOperation(\n route,\n options.globalMiddlewares ?? [],\n options.prefix,\n );\n\n spec.paths[openApiPath][method] = operation;\n allRouteComponents.push(...components);\n }\n\n // Merge all components into spec\n const mergedComponents = mergeComponents(allRouteComponents);\n\n if (!spec.components) {\n spec.components = {};\n }\n\n // Merge with existing security schemes\n if (options.securitySchemes) {\n spec.components.securitySchemes = options.securitySchemes;\n }\n\n // Add collected component types if present\n for (const key of componentKeys) {\n const value = mergedComponents[key];\n\n if (value && Object.keys(value).length > 0) {\n spec.components[key] = value;\n }\n }\n\n return spec;\n};\n"],"mappings":";AAsCA,MAAM,mBACJ,QACA,KAAyB,aACrB,EACJ,QAAS,OAA2C,aAAa,WAC/D,IACA,EAAE,QAAQ,iBAAiB,CAAC,EAC/B;AAED,MAAM,wBAAwB,WAA6B;CACzD,MAAM,WAAW,OAAO;AAExB,KAAI,CAAC,SACH,QAAO;AAGT,KAAI,iBAAiB,YAAY,OAAO,SAAS,gBAAgB,SAC/D,QAAO,SAAS;AAGlB,QAAO;;AAGT,MAAM,gBAAgB;CACpB;CACA;CACA;CACA;CACA;CACD;AAED,MAAM,uBAAuB,YAA8C;CACzE,MAAM,SAAwB,EAAE;AAEhC,MAAK,MAAM,UAAU,SAAS;AAC5B,MAAI,CAAC,OACH;AAGF,OAAK,MAAM,SAAS,cAClB,KAAI,OAAO,OACT,QAAO,SAAS,OAAO;;AAK7B,QAAO;;AAGT,MAAM,wBAAwB,YAA+C;CAC3E,MAAM,SAAyB,EAAE;AAEjC,MAAK,MAAM,UAAU,SAAS;AAC5B,MAAI,CAAC,OACH;AAGF,OAAK,MAAM,UAAU,QAAQ;GAC3B,MAAM,aAAa,OAAO,OAAO;GACjC,MAAM,iBAAiB,OAAO;AAE9B,OAAI,eACF,QAAO,cAAc;;;AAK3B,QAAO,OAAO,KAAK,OAAO,CAAC,SAAS,IAAI,SAAS,KAAA;;AAUnD,MAAM,yBAAyB,OAC7B,QACA,KAAyB,YACtB;CACH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AAED,OAAK,MAAM,aAAa,UAAU;AAClC,qBAAmB,KAAK,GAAG,WAAW;;CAIxC,MAAM,mBAAmB,gBAAgB,mBAAmB;AAE5D,KAAI,CAAC,KAAK,WACR,MAAK,aAAa,EAAE;AAItB,KAAI,QAAQ,gBACV,MAAK,WAAW,kBAAkB,QAAQ;AAI5C,MAAK,MAAM,OAAO,eAAe;EAC/B,MAAM,QAAQ,iBAAiB;AAE/B,MAAI,SAAS,OAAO,KAAK,MAAM,CAAC,SAAS,EACvC,MAAK,WAAW,OAAO;;AAI3B,QAAO"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
//#region src/lib/api/openapi/types.d.ts
|
|
2
|
+
type OpenApiSpec = {
|
|
3
|
+
openapi: string;
|
|
4
|
+
info: {
|
|
5
|
+
title: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
version: string;
|
|
8
|
+
};
|
|
9
|
+
servers?: Array<{
|
|
10
|
+
url: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
}>;
|
|
13
|
+
paths: Record<string, OpenApiPath>;
|
|
14
|
+
components?: {
|
|
15
|
+
schemas?: Record<string, unknown>;
|
|
16
|
+
responses?: Record<string, unknown>;
|
|
17
|
+
parameters?: Record<string, unknown>;
|
|
18
|
+
requestBodies?: Record<string, unknown>;
|
|
19
|
+
securitySchemes?: Record<string, unknown>;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
type OpenApiPath = {
|
|
23
|
+
[method: string]: OpenApiOperation;
|
|
24
|
+
};
|
|
25
|
+
type OpenApiOperation = {
|
|
26
|
+
summary?: string;
|
|
27
|
+
description?: string;
|
|
28
|
+
operationId?: string;
|
|
29
|
+
tags?: string[];
|
|
30
|
+
parameters?: OpenApiParameter[];
|
|
31
|
+
requestBody?: OpenApiRequestBody;
|
|
32
|
+
responses: Record<string, OpenApiResponse>;
|
|
33
|
+
security?: Array<Record<string, string[]>>;
|
|
34
|
+
};
|
|
35
|
+
type OpenApiParameter = {
|
|
36
|
+
name: string;
|
|
37
|
+
in: "path" | "query" | "header" | "cookie";
|
|
38
|
+
required?: boolean;
|
|
39
|
+
schema: unknown;
|
|
40
|
+
description?: string;
|
|
41
|
+
};
|
|
42
|
+
type OpenApiRequestBody = {
|
|
43
|
+
required?: boolean;
|
|
44
|
+
content: {
|
|
45
|
+
[mediaType: string]: {
|
|
46
|
+
schema: unknown;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
type OpenApiResponse = {
|
|
51
|
+
description: string;
|
|
52
|
+
content?: {
|
|
53
|
+
[mediaType: string]: {
|
|
54
|
+
schema: unknown;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
//#endregion
|
|
59
|
+
export { OpenApiSpec };
|
|
60
|
+
//# sourceMappingURL=types.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.cts","names":[],"sources":["../../../src/lib/api/openapi/types.ts"],"mappings":";KAIY,WAAA;EACV,OAAA;EACA,IAAA;IACE,KAAA;IACA,WAAA;IACA,OAAA;EAAA;EAEF,OAAA,GAAU,KAAA;IAAQ,GAAA;IAAa,WAAA;EAAA;EAC/B,KAAA,EAAO,MAAA,SAAe,WAAA;EACtB,UAAA;IACE,OAAA,GAAU,MAAA;IACV,SAAA,GAAY,MAAA;IACZ,UAAA,GAAa,MAAA;IACb,aAAA,GAAgB,MAAA;IAChB,eAAA,GAAkB,MAAA;EAAA;AAAA;AAAA,KAIV,WAAA;EAAA,CACT,MAAA,WAAiB,gBAAA;AAAA;AAAA,KAGR,gBAAA;EACV,OAAA;EACA,WAAA;EACA,WAAA;EACA,IAAA;EACA,UAAA,GAAa,gBAAA;EACb,WAAA,GAAc,kBAAA;EACd,SAAA,EAAW,MAAA,SAAe,eAAA;EAC1B,QAAA,GAAW,KAAA,CAAM,MAAA;AAAA;AAAA,KAGP,gBAAA;EACV,IAAA;EACA,EAAA;EACA,QAAA;EACA,MAAA;EACA,WAAA;AAAA;AAAA,KAGU,kBAAA;EACV,QAAA;EACA,OAAA;IAAA,CACG,SAAA;MACC,MAAA;IAAA;EAAA;AAAA;AAAA,KAKM,eAAA;EACV,WAAA;EACA,OAAA;IAAA,CACG,SAAA;MACC,MAAA;IAAA;EAAA;AAAA"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
//#region src/lib/api/openapi/types.d.ts
|
|
2
|
+
type OpenApiSpec = {
|
|
3
|
+
openapi: string;
|
|
4
|
+
info: {
|
|
5
|
+
title: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
version: string;
|
|
8
|
+
};
|
|
9
|
+
servers?: Array<{
|
|
10
|
+
url: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
}>;
|
|
13
|
+
paths: Record<string, OpenApiPath>;
|
|
14
|
+
components?: {
|
|
15
|
+
schemas?: Record<string, unknown>;
|
|
16
|
+
responses?: Record<string, unknown>;
|
|
17
|
+
parameters?: Record<string, unknown>;
|
|
18
|
+
requestBodies?: Record<string, unknown>;
|
|
19
|
+
securitySchemes?: Record<string, unknown>;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
type OpenApiPath = {
|
|
23
|
+
[method: string]: OpenApiOperation;
|
|
24
|
+
};
|
|
25
|
+
type OpenApiOperation = {
|
|
26
|
+
summary?: string;
|
|
27
|
+
description?: string;
|
|
28
|
+
operationId?: string;
|
|
29
|
+
tags?: string[];
|
|
30
|
+
parameters?: OpenApiParameter[];
|
|
31
|
+
requestBody?: OpenApiRequestBody;
|
|
32
|
+
responses: Record<string, OpenApiResponse>;
|
|
33
|
+
security?: Array<Record<string, string[]>>;
|
|
34
|
+
};
|
|
35
|
+
type OpenApiParameter = {
|
|
36
|
+
name: string;
|
|
37
|
+
in: "path" | "query" | "header" | "cookie";
|
|
38
|
+
required?: boolean;
|
|
39
|
+
schema: unknown;
|
|
40
|
+
description?: string;
|
|
41
|
+
};
|
|
42
|
+
type OpenApiRequestBody = {
|
|
43
|
+
required?: boolean;
|
|
44
|
+
content: {
|
|
45
|
+
[mediaType: string]: {
|
|
46
|
+
schema: unknown;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
type OpenApiResponse = {
|
|
51
|
+
description: string;
|
|
52
|
+
content?: {
|
|
53
|
+
[mediaType: string]: {
|
|
54
|
+
schema: unknown;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
//#endregion
|
|
59
|
+
export { OpenApiSpec };
|
|
60
|
+
//# sourceMappingURL=types.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.mts","names":[],"sources":["../../../src/lib/api/openapi/types.ts"],"mappings":";KAIY,WAAA;EACV,OAAA;EACA,IAAA;IACE,KAAA;IACA,WAAA;IACA,OAAA;EAAA;EAEF,OAAA,GAAU,KAAA;IAAQ,GAAA;IAAa,WAAA;EAAA;EAC/B,KAAA,EAAO,MAAA,SAAe,WAAA;EACtB,UAAA;IACE,OAAA,GAAU,MAAA;IACV,SAAA,GAAY,MAAA;IACZ,UAAA,GAAa,MAAA;IACb,aAAA,GAAgB,MAAA;IAChB,eAAA,GAAkB,MAAA;EAAA;AAAA;AAAA,KAIV,WAAA;EAAA,CACT,MAAA,WAAiB,gBAAA;AAAA;AAAA,KAGR,gBAAA;EACV,OAAA;EACA,WAAA;EACA,WAAA;EACA,IAAA;EACA,UAAA,GAAa,gBAAA;EACb,WAAA,GAAc,kBAAA;EACd,SAAA,EAAW,MAAA,SAAe,eAAA;EAC1B,QAAA,GAAW,KAAA,CAAM,MAAA;AAAA;AAAA,KAGP,gBAAA;EACV,IAAA;EACA,EAAA;EACA,QAAA;EACA,MAAA;EACA,WAAA;AAAA;AAAA,KAGU,kBAAA;EACV,QAAA;EACA,OAAA;IAAA,CACG,SAAA;MACC,MAAA;IAAA;EAAA;AAAA;AAAA,KAKM,eAAA;EACV,WAAA;EACA,OAAA;IAAA,CACG,SAAA;MACC,MAAA;IAAA;EAAA;AAAA"}
|