adorn-api 1.0.13 → 1.0.14
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/dist/adapter/express/auth.d.ts +8 -0
- package/dist/adapter/express/auth.d.ts.map +1 -1
- package/dist/adapter/express/bootstrap.d.ts +12 -0
- package/dist/adapter/express/bootstrap.d.ts.map +1 -1
- package/dist/adapter/express/coercion.d.ts +81 -1
- package/dist/adapter/express/coercion.d.ts.map +1 -1
- package/dist/adapter/express/index.d.ts +1 -0
- package/dist/adapter/express/index.d.ts.map +1 -1
- package/dist/adapter/express/merge.d.ts +17 -0
- package/dist/adapter/express/merge.d.ts.map +1 -1
- package/dist/adapter/express/openapi.d.ts +55 -0
- package/dist/adapter/express/openapi.d.ts.map +1 -1
- package/dist/adapter/express/router.d.ts +6 -0
- package/dist/adapter/express/router.d.ts.map +1 -1
- package/dist/adapter/express/swagger.d.ts +6 -0
- package/dist/adapter/express/swagger.d.ts.map +1 -1
- package/dist/adapter/express/types.d.ts +26 -0
- package/dist/adapter/express/types.d.ts.map +1 -1
- package/dist/adapter/express/validation.d.ts +19 -2
- package/dist/adapter/express/validation.d.ts.map +1 -1
- package/dist/cli.cjs +192 -11
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +192 -11
- package/dist/cli.js.map +1 -1
- package/dist/compiler/analyze/index.d.ts +5 -0
- package/dist/compiler/analyze/index.d.ts.map +1 -0
- package/dist/compiler/analyze/scanControllers.d.ts +52 -0
- package/dist/compiler/analyze/scanControllers.d.ts.map +1 -1
- package/dist/compiler/cache/isStale.d.ts +26 -0
- package/dist/compiler/cache/isStale.d.ts.map +1 -1
- package/dist/compiler/cache/loadArtifacts.d.ts +36 -0
- package/dist/compiler/cache/loadArtifacts.d.ts.map +1 -1
- package/dist/compiler/cache/schema.d.ts +14 -0
- package/dist/compiler/cache/schema.d.ts.map +1 -1
- package/dist/compiler/cache/writeCache.d.ts +6 -0
- package/dist/compiler/cache/writeCache.d.ts.map +1 -1
- package/dist/compiler/gems.d.ts +75 -0
- package/dist/compiler/gems.d.ts.map +1 -0
- package/dist/compiler/generator/index.d.ts +7 -0
- package/dist/compiler/generator/index.d.ts.map +1 -0
- package/dist/compiler/generator/manifest.d.ts +23 -0
- package/dist/compiler/generator/manifest.d.ts.map +1 -0
- package/dist/compiler/generator/openapi.d.ts +118 -0
- package/dist/compiler/generator/openapi.d.ts.map +1 -0
- package/dist/compiler/graph/builder.d.ts +24 -0
- package/dist/compiler/graph/builder.d.ts.map +1 -0
- package/dist/compiler/graph/index.d.ts +7 -0
- package/dist/compiler/graph/index.d.ts.map +1 -0
- package/dist/compiler/graph/schemaGraph.d.ts +67 -0
- package/dist/compiler/graph/schemaGraph.d.ts.map +1 -0
- package/dist/compiler/graph/types.d.ts +203 -0
- package/dist/compiler/graph/types.d.ts.map +1 -0
- package/dist/compiler/index.d.ts +12 -0
- package/dist/compiler/index.d.ts.map +1 -0
- package/dist/compiler/ir/index.d.ts +7 -0
- package/dist/compiler/ir/index.d.ts.map +1 -0
- package/dist/compiler/ir/pipeline.d.ts +82 -0
- package/dist/compiler/ir/pipeline.d.ts.map +1 -0
- package/dist/compiler/ir/stages.d.ts +40 -0
- package/dist/compiler/ir/stages.d.ts.map +1 -0
- package/dist/compiler/ir/visitor.d.ts +98 -0
- package/dist/compiler/ir/visitor.d.ts.map +1 -0
- package/dist/compiler/manifest/emit.d.ts +14 -0
- package/dist/compiler/manifest/emit.d.ts.map +1 -1
- package/dist/compiler/manifest/format.d.ts +42 -0
- package/dist/compiler/manifest/format.d.ts.map +1 -1
- package/dist/compiler/manifest/index.d.ts +6 -0
- package/dist/compiler/manifest/index.d.ts.map +1 -0
- package/dist/compiler/runner/createProgram.d.ts +16 -0
- package/dist/compiler/runner/createProgram.d.ts.map +1 -1
- package/dist/compiler/runner/index.d.ts +5 -0
- package/dist/compiler/runner/index.d.ts.map +1 -0
- package/dist/compiler/schema/extractAnnotations.d.ts +47 -0
- package/dist/compiler/schema/extractAnnotations.d.ts.map +1 -1
- package/dist/compiler/schema/index.d.ts +6 -0
- package/dist/compiler/schema/index.d.ts.map +1 -0
- package/dist/compiler/schema/intersectionHandler.d.ts +37 -0
- package/dist/compiler/schema/intersectionHandler.d.ts.map +1 -1
- package/dist/compiler/schema/objectHandler.d.ts +86 -0
- package/dist/compiler/schema/objectHandler.d.ts.map +1 -1
- package/dist/compiler/schema/openapi.d.ts +15 -0
- package/dist/compiler/schema/openapi.d.ts.map +1 -1
- package/dist/compiler/schema/parameters.d.ts +72 -0
- package/dist/compiler/schema/parameters.d.ts.map +1 -1
- package/dist/compiler/schema/primitives.d.ts +58 -0
- package/dist/compiler/schema/primitives.d.ts.map +1 -1
- package/dist/compiler/schema/typeToJsonSchema.d.ts +20 -0
- package/dist/compiler/schema/typeToJsonSchema.d.ts.map +1 -1
- package/dist/compiler/schema/types.d.ts +15 -0
- package/dist/compiler/schema/types.d.ts.map +1 -1
- package/dist/compiler/schema/unionHandler.d.ts +60 -0
- package/dist/compiler/schema/unionHandler.d.ts.map +1 -1
- package/dist/compiler/transform/dedup.d.ts +35 -0
- package/dist/compiler/transform/dedup.d.ts.map +1 -0
- package/dist/compiler/transform/flatten.d.ts +50 -0
- package/dist/compiler/transform/flatten.d.ts.map +1 -0
- package/dist/compiler/transform/index.d.ts +7 -0
- package/dist/compiler/transform/index.d.ts.map +1 -0
- package/dist/compiler/transform/inline.d.ts +46 -0
- package/dist/compiler/transform/inline.d.ts.map +1 -0
- package/dist/compiler/validation/emitPrecompiledValidators.d.ts +16 -0
- package/dist/compiler/validation/emitPrecompiledValidators.d.ts.map +1 -1
- package/dist/compiler/validation/index.d.ts +5 -0
- package/dist/compiler/validation/index.d.ts.map +1 -0
- package/dist/decorators/Auth.d.ts +17 -0
- package/dist/decorators/Auth.d.ts.map +1 -1
- package/dist/decorators/Controller.d.ts +15 -0
- package/dist/decorators/Controller.d.ts.map +1 -1
- package/dist/decorators/Public.d.ts +13 -0
- package/dist/decorators/Public.d.ts.map +1 -1
- package/dist/decorators/Use.d.ts +18 -0
- package/dist/decorators/Use.d.ts.map +1 -1
- package/dist/decorators/methods.d.ts +20 -0
- package/dist/decorators/methods.d.ts.map +1 -1
- package/dist/express.cjs +32 -10
- package/dist/express.cjs.map +1 -1
- package/dist/express.js +32 -10
- package/dist/express.js.map +1 -1
- package/dist/index.cjs +160 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +155 -2
- package/dist/index.js.map +1 -1
- package/dist/metal/applyListQuery.d.ts +73 -0
- package/dist/metal/applyListQuery.d.ts.map +1 -1
- package/dist/metal/index.cjs.map +1 -1
- package/dist/metal/index.d.ts +4 -0
- package/dist/metal/index.d.ts.map +1 -1
- package/dist/metal/index.js.map +1 -1
- package/dist/metal/listQuery.d.ts +19 -0
- package/dist/metal/listQuery.d.ts.map +1 -1
- package/dist/metal/queryOptions.d.ts +8 -0
- package/dist/metal/queryOptions.d.ts.map +1 -1
- package/dist/metal/readMetalBag.d.ts +36 -0
- package/dist/metal/readMetalBag.d.ts.map +1 -1
- package/dist/metal/registerMetalEntities.d.ts +20 -0
- package/dist/metal/registerMetalEntities.d.ts.map +1 -1
- package/dist/metal/schemaFromEntity.d.ts +30 -0
- package/dist/metal/schemaFromEntity.d.ts.map +1 -1
- package/dist/metal/searchWhere.d.ts +39 -0
- package/dist/metal/searchWhere.d.ts.map +1 -1
- package/dist/metal/symbolMetadata.d.ts +6 -0
- package/dist/metal/symbolMetadata.d.ts.map +1 -1
- package/dist/runtime/auth/runtime.d.ts +155 -6
- package/dist/runtime/auth/runtime.d.ts.map +1 -1
- package/dist/runtime/metadata/bucket.d.ts +1 -2
- package/dist/runtime/metadata/bucket.d.ts.map +1 -1
- package/dist/runtime/metadata/key.d.ts +1 -1
- package/dist/runtime/metadata/key.d.ts.map +1 -1
- package/dist/runtime/metadata/read.d.ts +1 -2
- package/dist/runtime/metadata/read.d.ts.map +1 -1
- package/dist/runtime/metadata/types.d.ts +74 -0
- package/dist/runtime/metadata/types.d.ts.map +1 -1
- package/dist/runtime/polyfill.d.ts +1 -1
- package/dist/runtime/polyfill.d.ts.map +1 -1
- package/dist/runtime/upload.d.ts +37 -0
- package/dist/runtime/upload.d.ts.map +1 -1
- package/dist/runtime/validation/ajv.d.ts +100 -0
- package/dist/runtime/validation/ajv.d.ts.map +1 -1
- package/dist/runtime/validation/index.d.ts +9 -0
- package/dist/runtime/validation/index.d.ts.map +1 -1
- package/dist/scripts/adorn-example.cjs +238 -6
- package/dist/scripts/adorn-example.cjs.map +1 -1
- package/dist/utils/port.d.ts +9 -0
- package/dist/utils/port.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -1,33 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Symbol key for storing Metal ORM decorator metadata.
|
|
3
|
+
*/
|
|
1
4
|
export declare const METAL_METADATA_KEY = "metal-orm:decorators";
|
|
5
|
+
/**
|
|
6
|
+
* Represents a column definition in Metal ORM entity metadata.
|
|
7
|
+
*/
|
|
2
8
|
export type MetalColumnDef = {
|
|
9
|
+
/** Database column type (e.g., "varchar", "int", "timestamp") */
|
|
3
10
|
type: string;
|
|
11
|
+
/** Additional type arguments (e.g., length for varchar) */
|
|
4
12
|
args?: unknown[];
|
|
13
|
+
/** Database dialect-specific type definitions */
|
|
5
14
|
dialectTypes?: unknown;
|
|
15
|
+
/** Whether the column is NOT NULL */
|
|
6
16
|
notNull?: boolean;
|
|
17
|
+
/** Whether this is a primary key column */
|
|
7
18
|
primary?: boolean;
|
|
19
|
+
/** TypeScript type override for the column */
|
|
8
20
|
tsType?: unknown;
|
|
21
|
+
/** Whether the column has a unique constraint */
|
|
9
22
|
unique?: boolean;
|
|
23
|
+
/** Default value for the column */
|
|
10
24
|
default?: unknown;
|
|
25
|
+
/** Whether the column auto-increments */
|
|
11
26
|
autoIncrement?: boolean;
|
|
27
|
+
/** How the column value is generated (e.g., "byDefault", "always") */
|
|
12
28
|
generated?: unknown;
|
|
29
|
+
/** CHECK constraint for the column */
|
|
13
30
|
check?: unknown;
|
|
31
|
+
/** Foreign key references */
|
|
14
32
|
references?: unknown;
|
|
33
|
+
/** Column comment/description */
|
|
15
34
|
comment?: string;
|
|
16
35
|
};
|
|
36
|
+
/**
|
|
37
|
+
* Represents relation metadata in a Metal ORM entity.
|
|
38
|
+
*/
|
|
17
39
|
export type MetalRelationMetadata = {
|
|
40
|
+
/** Type of relation (e.g., "hasMany", "belongsTo") */
|
|
18
41
|
kind: string;
|
|
42
|
+
/** Property name of the relation */
|
|
19
43
|
propertyKey: string;
|
|
44
|
+
/** Target entity constructor (optional, may be a getter) */
|
|
20
45
|
target?: (...args: any[]) => any;
|
|
21
46
|
};
|
|
47
|
+
/**
|
|
48
|
+
* Container for all decorator metadata of a Metal ORM entity.
|
|
49
|
+
*/
|
|
22
50
|
export type MetalDecoratorBag = {
|
|
51
|
+
/** Array of column definitions */
|
|
23
52
|
columns: Array<{
|
|
24
53
|
propertyName: string;
|
|
25
54
|
column: MetalColumnDef;
|
|
26
55
|
}>;
|
|
56
|
+
/** Array of relation metadata */
|
|
27
57
|
relations: Array<{
|
|
28
58
|
propertyName: string;
|
|
29
59
|
relation: MetalRelationMetadata;
|
|
30
60
|
}>;
|
|
31
61
|
};
|
|
62
|
+
/**
|
|
63
|
+
* Reads Metal ORM decorator metadata from a class constructor.
|
|
64
|
+
*
|
|
65
|
+
* @param ctor - The class constructor to read metadata from
|
|
66
|
+
* @returns The decorator bag if metadata exists, undefined otherwise
|
|
67
|
+
*/
|
|
32
68
|
export declare function readMetalDecoratorBagFromConstructor(ctor: object): MetalDecoratorBag | undefined;
|
|
33
69
|
//# sourceMappingURL=readMetalBag.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readMetalBag.d.ts","sourceRoot":"","sources":["../../src/metal/readMetalBag.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"readMetalBag.d.ts","s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iCAAiC;IACjC,SAAS,EAAE,KAAK,CAAC;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,qBAAqB,CAAA;KAAE,CAAC,CAAC;CAC7E,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,oCAAoC,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS,CAIhG"}
|
|
@@ -1,6 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utilities for registering Metal ORM entities as OpenAPI components.
|
|
3
|
+
*/
|
|
1
4
|
import { type SchemaFromEntityOptions } from "./schemaFromEntity.js";
|
|
5
|
+
/**
|
|
6
|
+
* Options for registering Metal ORM entities.
|
|
7
|
+
*/
|
|
2
8
|
export interface RegisterMetalEntitiesOptions extends SchemaFromEntityOptions {
|
|
9
|
+
/** How to handle existing schemas with the same name: "override" or "merge" (default: "merge") */
|
|
3
10
|
merge?: "override" | "merge";
|
|
4
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Registers Metal ORM entity schemas in an OpenAPI document.
|
|
14
|
+
*
|
|
15
|
+
* @param openapi - The OpenAPI document to modify (will be mutated)
|
|
16
|
+
* @param entities - Array of entity class constructors to register
|
|
17
|
+
* @param opts - Optional configuration for schema generation and merging
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* const openapi = { components: { schemas: {} } };
|
|
22
|
+
* registerMetalEntities(openapi, [User, Post, Comment]);
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
5
25
|
export declare function registerMetalEntities(openapi: any, entities: Function[], opts?: RegisterMetalEntitiesOptions): void;
|
|
6
26
|
//# sourceMappingURL=registerMetalEntities.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerMetalEntities.d.ts","sourceRoot":"","sources":["../../src/metal/registerMetalEntities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAYvF,MAAM,WAAW,4BAA6B,SAAQ,uBAAuB;IAC3E,KAAK,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC;CAC9B;AAED,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,GAAG,EACZ,QAAQ,EAAE,QAAQ,EAAE,EACpB,IAAI,GAAE,4BAAiC,QAoBxC"}
|
|
1
|
+
{"version":3,"file":"registerMetalEntities.d.ts","sourceRoot":"","sources":["../../src/metal/registerMetalEntities.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAoB,KAAK,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAYvF;;GAEG;AACH,MAAM,WAAW,4BAA6B,SAAQ,uBAAuB;IAC3E,kGAAkG;IAClG,KAAK,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC;CAC9B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,GAAG,EACZ,QAAQ,EAAE,QAAQ,EAAE,EACpB,IAAI,GAAE,4BAAiC,QAoBxC"}
|
|
@@ -1,11 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSON Schema representation for OpenAPI.
|
|
3
|
+
*/
|
|
1
4
|
export type JsonSchema = Record<string, any>;
|
|
5
|
+
/**
|
|
6
|
+
* Schema generation mode determining which fields are included.
|
|
7
|
+
* - "read": All fields (read-only marked on primary keys)
|
|
8
|
+
* - "create": Exclude auto-generated fields (primary keys, autoIncrement)
|
|
9
|
+
* - "update": All fields (none required)
|
|
10
|
+
*/
|
|
2
11
|
export type EntitySchemaMode = "read" | "create" | "update";
|
|
12
|
+
/**
|
|
13
|
+
* Options for generating a JSON Schema from an entity.
|
|
14
|
+
*/
|
|
3
15
|
export interface SchemaFromEntityOptions {
|
|
16
|
+
/** Custom name for the schema (defaults to entity class name) */
|
|
4
17
|
name?: string;
|
|
18
|
+
/** Strip "Entity" suffix from class name (default: true) */
|
|
5
19
|
stripEntitySuffix?: boolean;
|
|
20
|
+
/** Schema generation mode (default: "read") */
|
|
6
21
|
mode?: EntitySchemaMode;
|
|
22
|
+
/** Allow additional properties not defined in schema (default: true) */
|
|
7
23
|
additionalProperties?: boolean;
|
|
24
|
+
/** How to handle relations in the schema (default: "none") */
|
|
8
25
|
includeRelations?: "none" | "inline";
|
|
9
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Generates a JSON Schema from a Metal ORM entity class.
|
|
29
|
+
*
|
|
30
|
+
* @param ctor - The entity class constructor
|
|
31
|
+
* @param opts - Schema generation options
|
|
32
|
+
* @returns JSON Schema object or undefined if entity has no columns
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* const schema = schemaFromEntity(User, { mode: "create" });
|
|
37
|
+
* // Returns: { title: "User", type: "object", properties: {...}, required: [...] }
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
10
40
|
export declare function schemaFromEntity(ctor: Function, opts?: SchemaFromEntityOptions): JsonSchema | undefined;
|
|
11
41
|
//# sourceMappingURL=schemaFromEntity.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemaFromEntity.d.ts","sourceRoot":"","sources":["../../src/metal/schemaFromEntity.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"schemaFromEntity.d.ts","sourceRoot":"","sources":["../../src/metal/schemaFromEntity.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAE7C;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE5D;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,iEAAiE;IACjE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,4DAA4D;IAC5D,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,+CAA+C;IAC/C,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB,wEAAwE;IACxE,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,8DAA8D;IAC9D,gBAAgB,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;CACtC;AAgHD;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,GAAE,uBAA4B,GAAG,UAAU,GAAG,SAAS,CAwD3G"}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for building "where" clauses with nested relations.
|
|
3
|
+
* Supports filtering on entity properties and related entity properties.
|
|
4
|
+
*/
|
|
1
5
|
import type { BelongsToReference, HasManyCollection, HasOneReference, ManyToManyCollection, SelectableKeys } from "metal-orm";
|
|
2
6
|
export type SearchWhereDepth = 0 | 1 | 2 | 3 | 4 | 5;
|
|
3
7
|
type PrevDepth = [0, 0, 1, 2, 3, 4];
|
|
@@ -38,21 +42,56 @@ type WhereShape<TEntity extends object, Depth extends SearchWhereDepth, IncludeP
|
|
|
38
42
|
} & (Depth extends 0 ? {} : {
|
|
39
43
|
[K in RelationKeysWithOverrides<TEntity, RelationOverrides> as IsRelationAllowed<K, IncludePaths, ExcludePaths> extends true ? K : never]?: WhereShape<RelationTargetForKey<TEntity, K>, PrevDepth[Depth], ChildIncludePaths<K, IncludePaths>, ChildExcludePaths<K, ExcludePaths>, never>;
|
|
40
44
|
});
|
|
45
|
+
/**
|
|
46
|
+
* Represents valid property paths for SearchWhere filtering.
|
|
47
|
+
* Includes all scalar properties and nested relation paths.
|
|
48
|
+
*
|
|
49
|
+
* @typeParam TEntity - The entity type
|
|
50
|
+
* @typeParam Depth - Maximum nesting depth (default: 2)
|
|
51
|
+
* @typeParam Relations - Additional relation overrides
|
|
52
|
+
*/
|
|
41
53
|
export type SearchWherePath<TEntity extends object, Depth extends SearchWhereDepth = 2, Relations = never> = "*" | ScalarKeys<TEntity> | RelationKeysWithOverrides<TEntity, Relations> | (Depth extends 0 ? never : {
|
|
42
54
|
[K in RelationKeysWithOverrides<TEntity, Relations>]: `${K}.*` | `${K}.${SearchWherePath<RelationTargetForKey<TEntity, K>, PrevDepth[Depth]>}`;
|
|
43
55
|
}[RelationKeysWithOverrides<TEntity, Relations>]);
|
|
44
56
|
type BaseSearchWhereOptions = {
|
|
57
|
+
/** Maximum depth for relation traversal */
|
|
45
58
|
maxDepth?: SearchWhereDepth;
|
|
59
|
+
/** Whitelist of allowed property paths */
|
|
46
60
|
include?: readonly string[];
|
|
61
|
+
/** Paths to exclude from filtering */
|
|
47
62
|
exclude?: readonly string[];
|
|
63
|
+
/** Relation property names to include */
|
|
48
64
|
relations?: readonly string[];
|
|
49
65
|
};
|
|
50
66
|
export type SearchWhereOptions<TEntity extends object, Depth extends SearchWhereDepth = 5, Relations = never> = {
|
|
67
|
+
/** Maximum depth for relation traversal */
|
|
51
68
|
maxDepth?: Depth;
|
|
69
|
+
/** Whitelist of allowed property paths */
|
|
52
70
|
include?: readonly SearchWherePath<TEntity, Depth, Relations>[];
|
|
71
|
+
/** Paths to exclude from filtering */
|
|
53
72
|
exclude?: readonly SearchWherePath<TEntity, Depth, Relations>[];
|
|
73
|
+
/** Relation property names to include */
|
|
54
74
|
relations?: readonly ObjectKeys<TEntity>[];
|
|
55
75
|
};
|
|
76
|
+
/**
|
|
77
|
+
* Type representing a where clause for querying entities.
|
|
78
|
+
* Supports filtering on scalar properties and nested relations.
|
|
79
|
+
*
|
|
80
|
+
* @typeParam TEntity - The entity type to filter
|
|
81
|
+
* @typeParam Opts - SearchWhere configuration options
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```ts
|
|
85
|
+
* // Simple equality filter
|
|
86
|
+
* { name: "John" }
|
|
87
|
+
*
|
|
88
|
+
* // With operators
|
|
89
|
+
* { age: { gt: 18 }, name: { contains: "John" } }
|
|
90
|
+
*
|
|
91
|
+
* // Nested relation filter
|
|
92
|
+
* { posts: { title: { contains: "Hello" } } }
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
56
95
|
export type SearchWhere<TEntity extends object, Opts extends BaseSearchWhereOptions = {}> = Opts extends SearchWhereOptions<TEntity, ResolveDepth<Opts>, ResolveRelations<Opts>> ? WhereShape<TEntity, ResolveDepth<Opts>, ResolveInclude<Opts>, ResolveExclude<Opts>, ResolveRelations<Opts>> : never;
|
|
57
96
|
export {};
|
|
58
97
|
//# sourceMappingURL=searchWhere.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"searchWhere.d.ts","sourceRoot":"","sources":["../../src/metal/searchWhere.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,oBAAoB,EACpB,cAAc,EACf,MAAM,WAAW,CAAC;AAEnB,MAAM,MAAM,gBAAgB,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAErD,KAAK,SAAS,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAEpC,KAAK,eAAe,GAChB,iBAAiB,CAAC,GAAG,CAAC,GACtB,oBAAoB,CAAC,GAAG,EAAE,GAAG,CAAC,GAC9B,eAAe,CAAC,GAAG,CAAC,GACpB,kBAAkB,CAAC,GAAG,CAAC,CAAC;AAE5B,KAAK,YAAY,CAAC,OAAO,SAAS,MAAM,IAAI;KACzC,CAAC,IAAI,MAAM,OAAO,GAAG,MAAM,CAAC,CAAC,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,eAAe,GAAG,CAAC,GAAG,KAAK;CAC7F,CAAC,MAAM,OAAO,GAAG,MAAM,CAAC,CAAC;AAE1B,KAAK,cAAc,CAAC,CAAC,IAAI,CAAC,SAAS,iBAAiB,CAAC,MAAM,CAAC,SAAS,MAAM,CAAC,GACxE,CAAC,GACD,CAAC,SAAS,o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,SAAS,GAAG,KAAK,IACf;IACF,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,0CAA0C;IAC1C,OAAO,CAAC,EAAE,SAAS,eAAe,CAAC,OAAO,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,CAAC;IAChE,sCAAsC;IACtC,OAAO,CAAC,EAAE,SAAS,eAAe,CAAC,OAAO,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,CAAC;IAChE,yCAAyC;IACzC,SAAS,CAAC,EAAE,SAAS,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;CAC5C,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,WAAW,CAAC,OAAO,SAAS,MAAM,EAAE,IAAI,SAAS,sBAAsB,GAAG,EAAE,IACtF,IAAI,SAAS,kBAAkB,CAAC,OAAO,EAAE,YAAY,CAAC,IAAI,CAAC,EAAE,gBAAgB,CAAC,IAAI,CAAC,CAAC,GAChF,UAAU,CAAC,OAAO,EAAE,YAAY,CAAC,IAAI,CAAC,EAAE,cAAc,CAAC,IAAI,CAAC,EAAE,cAAc,CAAC,IAAI,CAAC,EAAE,gBAAgB,CAAC,IAAI,CAAC,CAAC,GAC3G,KAAK,CAAC"}
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ensures the Symbol.metadata symbol exists and returns it.
|
|
3
|
+
* Used by Metal ORM decorators to store metadata on classes.
|
|
4
|
+
*
|
|
5
|
+
* @returns The Symbol.metadata symbol
|
|
6
|
+
*/
|
|
1
7
|
export declare function ensureSymbolMetadata(): symbol;
|
|
2
8
|
//# sourceMappingURL=symbolMetadata.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"symbolMetadata.d.ts","sourceRoot":"","sources":["../../src/metal/symbolMetadata.ts"],"names":[],"mappings":"AAAA,wBAAgB,oBAAoB,IAAI,MAAM,CAM7C"}
|
|
1
|
+
{"version":3,"file":"symbolMetadata.d.ts","sourceRoot":"","sources":["../../src/metal/symbolMetadata.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAM7C"}
|
|
@@ -1,34 +1,183 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime authentication module for adorn-api.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* This module provides interfaces and factory functions for implementing
|
|
6
|
+
* authentication schemes in adorn-api. It includes utilities for Bearer JWT
|
|
7
|
+
* authentication and API key authentication.
|
|
8
|
+
*
|
|
9
|
+
* @package
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Result of an authentication attempt.
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* Contains the authenticated principal (user/entity) and any granted scopes
|
|
16
|
+
* that can be used for authorization decisions.
|
|
17
|
+
*
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
1
20
|
export interface AuthResult {
|
|
21
|
+
/**
|
|
22
|
+
* The authenticated principal (user object, token payload, etc.).
|
|
23
|
+
*/
|
|
2
24
|
principal: any;
|
|
25
|
+
/**
|
|
26
|
+
* Array of scope strings granted to the principal.
|
|
27
|
+
* Used for authorization checks.
|
|
28
|
+
*/
|
|
3
29
|
scopes?: string[];
|
|
4
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Runtime interface for an authentication scheme.
|
|
33
|
+
*
|
|
34
|
+
* @remarks
|
|
35
|
+
* Implement this interface to create custom authentication schemes.
|
|
36
|
+
* Each scheme must provide methods for authentication, issuing challenges,
|
|
37
|
+
* and optional authorization.
|
|
38
|
+
*
|
|
39
|
+
* @public
|
|
40
|
+
*/
|
|
5
41
|
export interface AuthSchemeRuntime {
|
|
42
|
+
/**
|
|
43
|
+
* Unique name identifying this authentication scheme.
|
|
44
|
+
*/
|
|
6
45
|
name: string;
|
|
46
|
+
/**
|
|
47
|
+
* Authenticate a request and return the result.
|
|
48
|
+
*
|
|
49
|
+
* @param req - The incoming request object
|
|
50
|
+
* @returns Promise resolving to AuthResult if authenticated, null otherwise
|
|
51
|
+
*/
|
|
7
52
|
authenticate(req: any): Promise<AuthResult | null>;
|
|
53
|
+
/**
|
|
54
|
+
* Send an authentication challenge to the client.
|
|
55
|
+
*
|
|
56
|
+
* @param res - The response object to send the challenge
|
|
57
|
+
*/
|
|
8
58
|
challenge(res: any): void;
|
|
59
|
+
/**
|
|
60
|
+
* Authorize an authenticated principal against required scopes.
|
|
61
|
+
*
|
|
62
|
+
* @param auth - The authentication result
|
|
63
|
+
* @param requiredScopes - Scopes required for the operation
|
|
64
|
+
* @returns true if authorized, false otherwise
|
|
65
|
+
*/
|
|
9
66
|
authorize?(auth: AuthResult, requiredScopes: string[]): boolean;
|
|
10
67
|
}
|
|
11
|
-
|
|
68
|
+
/**
|
|
69
|
+
* Options for creating a Bearer JWT authentication runtime.
|
|
70
|
+
*
|
|
71
|
+
* @public
|
|
72
|
+
*/
|
|
73
|
+
export interface BearerJwtRuntimeOptions {
|
|
74
|
+
/**
|
|
75
|
+
* Extract the Bearer token from a request.
|
|
76
|
+
*
|
|
77
|
+
* @param req - The incoming request object
|
|
78
|
+
* @returns The token string, or undefined if not present
|
|
79
|
+
*/
|
|
12
80
|
getToken: (req: any) => string | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* Verify a JWT token and return its payload.
|
|
83
|
+
*
|
|
84
|
+
* @param token - The JWT token to verify
|
|
85
|
+
* @returns Promise resolving to the token payload
|
|
86
|
+
* @defaultvalue Async function that returns the token as payload
|
|
87
|
+
*/
|
|
13
88
|
verify?: (token: string) => Promise<any>;
|
|
89
|
+
/**
|
|
90
|
+
* Extract scopes from a token payload.
|
|
91
|
+
*
|
|
92
|
+
* @param payload - The JWT payload
|
|
93
|
+
* @returns Array of scope strings
|
|
94
|
+
* @defaultvalue Function returning empty array
|
|
95
|
+
*/
|
|
14
96
|
getScopes?: (payload: any) => string[];
|
|
15
|
-
}
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Options for creating an API key header authentication runtime.
|
|
100
|
+
*
|
|
101
|
+
* @public
|
|
102
|
+
*/
|
|
103
|
+
export interface ApiKeyHeaderRuntimeOptions {
|
|
104
|
+
/**
|
|
105
|
+
* The name of the header containing the API key.
|
|
106
|
+
*/
|
|
107
|
+
headerName: string;
|
|
108
|
+
/**
|
|
109
|
+
* Validate an API key and return the associated principal.
|
|
110
|
+
*
|
|
111
|
+
* @param key - The API key to validate
|
|
112
|
+
* @returns Promise resolving to the principal (user/service) associated with the key
|
|
113
|
+
*/
|
|
114
|
+
validate: (key: string) => Promise<any>;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Creates a Bearer JWT authentication runtime.
|
|
118
|
+
*
|
|
119
|
+
* @remarks
|
|
120
|
+
* This factory function creates an AuthSchemeRuntime for Bearer token authentication.
|
|
121
|
+
* The implementation extracts the token from the Authorization header, verifies it,
|
|
122
|
+
* and extracts scopes from the payload.
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* ```typescript
|
|
126
|
+
* const bearerRuntime = createBearerJwtRuntime({
|
|
127
|
+
* getToken: (req) => req.headers.authorization?.split(' ')[1],
|
|
128
|
+
* verify: async (token) => jwt.verify(token, secret),
|
|
129
|
+
* getScopes: (payload) => payload.scopes || []
|
|
130
|
+
* });
|
|
131
|
+
* ```
|
|
132
|
+
*
|
|
133
|
+
* @param options - Configuration options for the Bearer JWT runtime
|
|
134
|
+
* @returns An AuthSchemeRuntime for Bearer authentication
|
|
135
|
+
*
|
|
136
|
+
* @public
|
|
137
|
+
*/
|
|
138
|
+
export declare function createBearerJwtRuntime(options: BearerJwtRuntimeOptions): {
|
|
16
139
|
name: string;
|
|
140
|
+
/** @inheritdoc */
|
|
17
141
|
authenticate(req: any): Promise<{
|
|
18
142
|
principal: any;
|
|
19
143
|
scopes: string[];
|
|
20
144
|
} | null>;
|
|
145
|
+
/** @inheritdoc */
|
|
21
146
|
challenge(res: any): void;
|
|
147
|
+
/** @inheritdoc */
|
|
22
148
|
authorize(auth: AuthResult, requiredScopes: string[]): boolean;
|
|
23
149
|
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
150
|
+
/**
|
|
151
|
+
* Creates an API key header authentication runtime.
|
|
152
|
+
*
|
|
153
|
+
* @remarks
|
|
154
|
+
* This factory function creates an AuthSchemeRuntime for API key authentication.
|
|
155
|
+
* The implementation extracts the API key from a specified header and validates it.
|
|
156
|
+
*
|
|
157
|
+
* @example
|
|
158
|
+
* ```typescript
|
|
159
|
+
* const apiKeyRuntime = createApiKeyHeaderRuntime({
|
|
160
|
+
* headerName: "X-API-Key",
|
|
161
|
+
* validate: async (key) => {
|
|
162
|
+
* const user = await db.users.findByApiKey(key);
|
|
163
|
+
* if (!user) throw new Error("Invalid API key");
|
|
164
|
+
* return user;
|
|
165
|
+
* }
|
|
166
|
+
* });
|
|
167
|
+
* ```
|
|
168
|
+
*
|
|
169
|
+
* @param options - Configuration options for the API key runtime
|
|
170
|
+
* @returns An AuthSchemeRuntime for API key authentication
|
|
171
|
+
*
|
|
172
|
+
* @public
|
|
173
|
+
*/
|
|
174
|
+
export declare function createApiKeyHeaderRuntime(options: ApiKeyHeaderRuntimeOptions): {
|
|
28
175
|
name: string;
|
|
176
|
+
/** @inheritdoc */
|
|
29
177
|
authenticate(req: any): Promise<{
|
|
30
178
|
principal: any;
|
|
31
179
|
} | null>;
|
|
180
|
+
/** @inheritdoc */
|
|
32
181
|
challenge(res: any): void;
|
|
33
182
|
};
|
|
34
183
|
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../src/runtime/auth/runtime.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,GAAG,CAAC;
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../src/runtime/auth/runt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ACF,UAAU,kBAAkB,MAAM,EAAE;EAMvD;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,0BAA0B;;IAMzE,kBAAkB;sBACM,GAAG;;;IAY3B,kBAAkB;mBACH,GAAG;EAIrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bucket.d.ts","sourceRoot":"","sources":["../../../src/runtime/metadata/bucket.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bucket.d.ts","sourceRoot":"","sources":["../../../src/runtime/metadata/bucket.ts"],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export {};
|
|
2
2
|
//# sourceMappingURL=key.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"key.d.ts","sourceRoot":"","sources":["../../../src/runtime/metadata/key.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"key.d.ts","sourceRoot":"","sources":["../../../src/runtime/metadata/key.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../../src/runtime/metadata/read.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../../src/runtime/metadata/read.ts"],"names":[],"mappings":""}
|
|
@@ -1,21 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime metadata types for adorn-api.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* This module contains the type definitions used by the runtime metadata
|
|
6
|
+
* system, including HTTP methods, route operations, and authentication metadata.
|
|
7
|
+
*
|
|
8
|
+
* @package
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Supported HTTP methods for route operations.
|
|
12
|
+
*
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
1
15
|
export type HttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD";
|
|
16
|
+
/**
|
|
17
|
+
* Represents a single route operation registered on a controller.
|
|
18
|
+
*
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
2
21
|
export interface RouteOperation {
|
|
22
|
+
/**
|
|
23
|
+
* The HTTP method for this route.
|
|
24
|
+
*/
|
|
3
25
|
httpMethod: HttpMethod;
|
|
26
|
+
/**
|
|
27
|
+
* The URL path pattern for this route (relative to controller base path).
|
|
28
|
+
*/
|
|
4
29
|
path: string;
|
|
30
|
+
/**
|
|
31
|
+
* The name of the method on the controller class.
|
|
32
|
+
*/
|
|
5
33
|
methodName: string;
|
|
34
|
+
/**
|
|
35
|
+
* Optional OpenAPI operation ID.
|
|
36
|
+
*/
|
|
6
37
|
operationId?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Array of middleware names or functions to apply to this route.
|
|
40
|
+
*/
|
|
7
41
|
use?: Array<string | ExpressMw>;
|
|
42
|
+
/**
|
|
43
|
+
* Authentication configuration: "public" for open access, AuthMeta for protected.
|
|
44
|
+
*/
|
|
8
45
|
auth?: AuthMeta | "public";
|
|
9
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Authentication metadata for a route.
|
|
49
|
+
*
|
|
50
|
+
* @public
|
|
51
|
+
*/
|
|
10
52
|
export interface AuthMeta {
|
|
53
|
+
/**
|
|
54
|
+
* The authentication scheme name (e.g., "BearerAuth", "ApiKeyAuth").
|
|
55
|
+
*/
|
|
11
56
|
scheme: string;
|
|
57
|
+
/**
|
|
58
|
+
* Required scopes for authorization. Empty array means any authenticated user.
|
|
59
|
+
*/
|
|
12
60
|
scopes?: string[];
|
|
61
|
+
/**
|
|
62
|
+
* Whether authentication is optional for this route.
|
|
63
|
+
*/
|
|
13
64
|
optional?: boolean;
|
|
14
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Type alias for Express middleware functions.
|
|
68
|
+
*
|
|
69
|
+
* @public
|
|
70
|
+
*/
|
|
15
71
|
export type ExpressMw = (req: any, res: any, next: (err?: any) => void) => any;
|
|
72
|
+
/**
|
|
73
|
+
* Container for all decorator metadata on a controller class.
|
|
74
|
+
*
|
|
75
|
+
* @remarks
|
|
76
|
+
* The AdornBucket is stored in class metadata and contains all route operations,
|
|
77
|
+
* controller-level middleware, and base path configuration.
|
|
78
|
+
*
|
|
79
|
+
* @public
|
|
80
|
+
*/
|
|
16
81
|
export interface AdornBucket {
|
|
82
|
+
/**
|
|
83
|
+
* Base path prefix for all routes in this controller.
|
|
84
|
+
*/
|
|
17
85
|
basePath?: string;
|
|
86
|
+
/**
|
|
87
|
+
* Middleware to apply to all routes in this controller.
|
|
88
|
+
*/
|
|
18
89
|
controllerUse?: Array<string | ExpressMw>;
|
|
90
|
+
/**
|
|
91
|
+
* Array of route operations defined on this controller.
|
|
92
|
+
*/
|
|
19
93
|
ops: RouteOperation[];
|
|
20
94
|
}
|
|
21
95
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/runtime/metadata/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAClB,KAAK,GACL,MAAM,GACN,KAAK,GACL,OAAO,GACP,QAAQ,GACR,SAAS,GACT,MAAM,CAAC;AAEX,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/runtime/metadata/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAClB,KAAK,GACL,MAAM,GACN,KAAK,GACL,OAAO,GACP,QAAQ,GACR,SAAS,GACT,MAAM,CAAC;AAEX;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,UAAU,EAAE,UAAU,CAAC;IAEvB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,GAAG,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAEhC;;OAEG;IACH,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;CAC5B;AAED;;;;GAIG;AACH,MAAM,WAAW,QAAQ;IACvB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAElB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,KAAK,IAAI,KAAK,GAAG,CAAC;AAE/E;;;;;;;;GAQG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAE1C;;OAEG;IACH,GAAG,EAAE,cAAc,EAAE,CAAC;CACvB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export {};
|
|
2
2
|
//# sourceMappingURL=polyfill.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"polyfill.d.ts","sourceRoot":"","sources":["../../src/runtime/polyfill.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"polyfill.d.ts","sourceRoot":"","sources":["../../src/runtime/polyfill.ts"],"names":[],"mappings":""}
|
package/dist/runtime/upload.d.ts
CHANGED
|
@@ -1,7 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents an uploaded file in the request.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* This interface describes the structure of a file uploaded via multipart/form-data
|
|
6
|
+
* requests. It provides metadata about the file as well as access to its contents
|
|
7
|
+
* through a readable stream.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* async function handleUpload(file: UploadFile) {
|
|
12
|
+
* console.log(`Received file: ${file.filename}`);
|
|
13
|
+
* console.log(`Type: ${file.mimeType}`);
|
|
14
|
+
* console.log(`Size: ${file.size} bytes`);
|
|
15
|
+
*
|
|
16
|
+
* // Process the file stream
|
|
17
|
+
* for await (const chunk of file.stream) {
|
|
18
|
+
* // Handle chunk...
|
|
19
|
+
* }
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
1
25
|
export interface UploadFile {
|
|
26
|
+
/**
|
|
27
|
+
* The original filename as sent by the client.
|
|
28
|
+
*/
|
|
2
29
|
filename: string;
|
|
30
|
+
/**
|
|
31
|
+
* The MIME type of the file (e.g., "image/png", "application/pdf").
|
|
32
|
+
*/
|
|
3
33
|
mimeType: string;
|
|
34
|
+
/**
|
|
35
|
+
* The file size in bytes, if available.
|
|
36
|
+
*/
|
|
4
37
|
size?: number;
|
|
38
|
+
/**
|
|
39
|
+
* A Node.js readable stream to read the file contents.
|
|
40
|
+
* Use this to pipe, transform, or buffer the file data.
|
|
41
|
+
*/
|
|
5
42
|
stream: NodeJS.ReadableStream;
|
|
6
43
|
}
|
|
7
44
|
//# sourceMappingURL=upload.d.ts.map
|