@aeriajs/common 0.0.68 → 0.0.70

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.
@@ -1,5 +1,5 @@
1
1
  import type { EndpointError } from '@aeriajs/types';
2
- import { Result } from './result.js';
2
+ import { Result } from '@aeriajs/types';
3
3
  export declare const endpointError: <const TEndpointError extends EndpointError>(value: TEndpointError) => {
4
4
  readonly _tag: "Error";
5
5
  readonly error: TEndpointError;
@@ -2,9 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isEndpointError = exports.endpointError = void 0;
4
4
  const types_1 = require("@aeriajs/types");
5
- const result_js_1 = require("./result.js");
6
5
  const endpointError = (value) => {
7
- return result_js_1.Result.error(Object.assign({
6
+ return types_1.Result.error(Object.assign({
8
7
  [types_1.ERROR_SYMBOL]: true,
9
8
  }, value));
10
9
  };
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
- import { ERROR_SYMBOL, ERROR_SYMBOL_DESCRIPTION } from "@aeriajs/types";
3
- import { Result } from "./result.mjs";
2
+ import { Result, ERROR_SYMBOL, ERROR_SYMBOL_DESCRIPTION } from "@aeriajs/types";
4
3
  export const endpointError = (value) => {
5
4
  return Result.error(Object.assign({
6
5
  [ERROR_SYMBOL]: true
package/dist/result.d.ts CHANGED
@@ -1,18 +1,3 @@
1
- import type { Result as R } from '@aeriajs/types/result';
2
- export declare namespace Result {
3
- type Error<T> = R.Error<T>;
4
- type Result<T> = R.Result<T>;
5
- type Either<Error, Result> = R.Either<Error, Result>;
6
- const error: <const TValue>(value: TValue) => {
7
- readonly _tag: "Error";
8
- readonly error: TValue;
9
- readonly result: undefined;
10
- };
11
- const result: <const TValue>(value: TValue) => {
12
- readonly _tag: "Result";
13
- readonly error: undefined;
14
- readonly result: TValue;
15
- };
16
- }
1
+ import type { Result } from '@aeriajs/types';
17
2
  export declare const isResult: (value: any) => value is Result.Either<unknown, unknown>;
18
- export declare const throwIfError: <TValue>(either: R.Either<unknown, TValue>, message?: any) => NonNullable<TValue>;
3
+ export declare const throwIfError: <TValue>(either: Result.Either<unknown, TValue>, message?: any) => NonNullable<TValue>;
package/dist/result.js CHANGED
@@ -1,19 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.throwIfError = exports.isResult = 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 = {}));
3
+ exports.throwIfError = exports.isResult = void 0;
17
4
  const isResult = (value) => {
18
5
  return value
19
6
  && value.constructor === Object
package/dist/result.mjs CHANGED
@@ -1,17 +1,4 @@
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 = {}));
15
2
  export const isResult = (value) => {
16
3
  return value && value.constructor === Object && (value._tag === "Error" || value._tag === "Result");
17
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aeriajs/common",
3
- "version": "0.0.68",
3
+ "version": "0.0.70",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -31,7 +31,7 @@
31
31
  "bson": "^6.5.0"
32
32
  },
33
33
  "peerDependencies": {
34
- "@aeriajs/types": "^0.0.60",
34
+ "@aeriajs/types": "^0.0.62",
35
35
  "bson": "^6.5.0"
36
36
  },
37
37
  "scripts": {