@aeriajs/types 0.0.60 → 0.0.62

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/context.d.ts CHANGED
@@ -10,7 +10,7 @@ import type { PackReferences, SchemaWithId } from './schema.js';
10
10
  import type { RateLimitingParams, RateLimitingError } from './security.js';
11
11
  import type { Token } from './token.js';
12
12
  export type CollectionModel<TDescription extends Description> = MongoCollection<Omit<PackReferences<SchemaWithId<TDescription>>, '_id'>>;
13
- type OmitContextParameter<TFunction> = TFunction extends () => any ? TFunction : TFunction extends (payload: undefined, ...args: any[]) => infer Return ? () => Return : TFunction extends (payload: infer Payload, context: Context, ...args: infer Rest) => infer Return ? (payload: Payload, ...args: Rest) => Return : never;
13
+ type OmitContextParameter<TFunction> = TFunction extends () => any ? TFunction : TFunction extends (payload: undefined, ...args: any[]) => infer Return ? () => Return : TFunction extends (payload: infer Payload, context: Context<any>, ...args: infer Rest) => infer Return ? (payload: Payload, ...args: Rest) => Return : never;
14
14
  type RestParameters<TFunction> = TFunction extends (payload: any, context: Context<any>, ...args: infer Rest) => any ? Rest : never;
15
15
  type UnionFunctions<TFunctions, TSchema extends CollectionDocument<any>> = {
16
16
  [P in keyof TFunctions]: (P extends keyof CollectionFunctions<any> ? CollectionFunctions<TSchema>[P] extends infer CollFunction ? CollFunction extends (...args: any[]) => any ? Extract<undefined, Parameters<CollFunction>[0]> extends never ? (payload: Parameters<CollFunction>[0], ...args: RestParameters<TFunctions[P]>) => ReturnType<CollFunction> : (payload?: Parameters<CollFunction>[0], ...args: RestParameters<TFunctions[P]>) => ReturnType<CollFunction> : never : never : OmitContextParameter<TFunctions[P]>) extends (...args: infer Args) => infer Return ? Return extends Promise<any> ? (...args: Args) => Return : (...args: Args) => Promise<Return> : never;
package/dist/index.d.ts CHANGED
@@ -9,6 +9,7 @@ export * from './endpointError.js';
9
9
  export * from './functions.js';
10
10
  export * from './http.js';
11
11
  export * from './property.js';
12
+ export * from './result.js';
12
13
  export * from './schema.js';
13
14
  export * from './security.js';
14
15
  export * from './token.js';
package/dist/index.js CHANGED
@@ -25,6 +25,7 @@ __exportStar(require("./endpointError.js"), exports);
25
25
  __exportStar(require("./functions.js"), exports);
26
26
  __exportStar(require("./http.js"), exports);
27
27
  __exportStar(require("./property.js"), exports);
28
+ __exportStar(require("./result.js"), exports);
28
29
  __exportStar(require("./schema.js"), exports);
29
30
  __exportStar(require("./security.js"), exports);
30
31
  __exportStar(require("./token.js"), exports);
package/dist/index.mjs CHANGED
@@ -10,6 +10,7 @@ export * from "./endpointError.mjs";
10
10
  export * from "./functions.mjs";
11
11
  export * from "./http.mjs";
12
12
  export * from "./property.mjs";
13
+ export * from "./result.mjs";
13
14
  export * from "./schema.mjs";
14
15
  export * from "./security.mjs";
15
16
  export * from "./token.mjs";
@@ -94,7 +94,7 @@ export type GetterProperty = {
94
94
  getter: (document: any) => any;
95
95
  };
96
96
  export type ConstProperty = {
97
- const: string | number | boolean | undefined;
97
+ const: string | number | boolean | undefined | null;
98
98
  };
99
99
  export type MixedProperty = RefProperty | FileProperty | EnumProperty | ArrayProperty | ObjectProperty | StringProperty | NumberProperty | BooleanProperty | GetterProperty | ConstProperty;
100
100
  export type NonCircularMixedProperty = NonCircularRefProperty | FileProperty | EnumProperty | ArrayProperty | ObjectProperty | StringProperty | NumberProperty | BooleanProperty | GetterProperty | ConstProperty;
package/dist/result.d.ts CHANGED
@@ -10,6 +10,16 @@ export declare namespace Result {
10
10
  readonly result: T;
11
11
  };
12
12
  type Either<E, R> = Result.Error<E> | Result.Result<R>;
13
+ const error: <const TValue>(value: TValue) => {
14
+ readonly _tag: "Error";
15
+ readonly error: TValue;
16
+ readonly result: undefined;
17
+ };
18
+ const result: <const TValue>(value: TValue) => {
19
+ readonly _tag: "Result";
20
+ readonly error: undefined;
21
+ readonly result: TValue;
22
+ };
13
23
  }
14
24
  export type ExtractError<T> = T extends Result.Error<infer L> ? L : never;
15
25
  export type ExtractResult<T> = T extends Result.Result<infer R> ? R : never;
package/dist/result.js CHANGED
@@ -1,2 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Result = void 0;
4
+ var Result;
5
+ (function (Result) {
6
+ Result.error = (value) => ({
7
+ _tag: 'Error',
8
+ error: value,
9
+ result: undefined,
10
+ });
11
+ Result.result = (value) => ({
12
+ _tag: 'Result',
13
+ error: undefined,
14
+ result: value,
15
+ });
16
+ })(Result || (exports.Result = Result = {}));
package/dist/result.mjs CHANGED
@@ -1 +1,14 @@
1
1
  "use strict";
2
+ export var Result;
3
+ ((Result2) => {
4
+ Result2.error = (value) => ({
5
+ _tag: "Error",
6
+ error: value,
7
+ result: void 0
8
+ });
9
+ Result2.result = (value) => ({
10
+ _tag: "Result",
11
+ error: void 0,
12
+ result: value
13
+ });
14
+ })(Result || (Result = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aeriajs/types",
3
- "version": "0.0.60",
3
+ "version": "0.0.62",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -13,11 +13,6 @@
13
13
  "import": "./dist/index.mjs",
14
14
  "require": "./dist/index.js",
15
15
  "types": "./dist/index.d.ts"
16
- },
17
- "./result": {
18
- "import": "./dist/result.mjs",
19
- "require": "./dist/result.js",
20
- "types": "./dist/result.d.ts"
21
16
  }
22
17
  },
23
18
  "keywords": [],