Skip to content

Commit 1b7358e

Browse files
committed
fix: decentralizing the validation domain, and removing /index from import paths
1 parent 2392da4 commit 1b7358e

71 files changed

Lines changed: 611 additions & 632 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/client/handlers/GestaltsActionsGetByIdentity.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ import type {
66
} from '../types';
77
import type GestaltGraph from '../../gestalts/GestaltGraph';
88
import type { GestaltAction } from '../../gestalts/types';
9-
import type { IdentityId, ProviderId } from '../../ids/index';
9+
import type { IdentityId, ProviderId } from '../../ids';
1010
import { UnaryHandler } from '@matrixai/rpc';
11-
import { validateSync } from '../../validation/index';
12-
import * as validationUtils from '../../validation/utils';
13-
import { matchSync } from '../../utils/index';
11+
import * as ids from '../../ids';
12+
import { validateSync } from '../../validation';
13+
import { matchSync } from '../../utils';
1414

1515
class GestaltsActionsGetByIdentity extends UnaryHandler<
1616
{
@@ -36,8 +36,8 @@ class GestaltsActionsGetByIdentity extends UnaryHandler<
3636
}: { providerId: ProviderId; identityId: IdentityId } = validateSync(
3737
(keyPath, value) => {
3838
return matchSync(keyPath)(
39-
[['providerId'], () => validationUtils.parseProviderId(value)],
40-
[['identityId'], () => validationUtils.parseIdentityId(value)],
39+
[['providerId'], () => ids.parseProviderId(value)],
40+
[['identityId'], () => ids.parseIdentityId(value)],
4141
() => value,
4242
);
4343
},

src/client/handlers/GestaltsActionsGetByNode.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ import type {
77
} from '../types';
88
import type GestaltGraph from '../../gestalts/GestaltGraph';
99
import type { GestaltAction } from '../../gestalts/types';
10-
import type { NodeId } from '../../ids/index';
10+
import type { NodeId } from '../../ids';
1111
import { UnaryHandler } from '@matrixai/rpc';
12-
import { validateSync } from '../../validation/index';
13-
import * as validationUtils from '../../validation/utils';
14-
import { matchSync } from '../../utils/index';
12+
import * as ids from '../../ids';
13+
import { validateSync } from '../../validation';
14+
import { matchSync } from '../../utils';
1515

1616
class GestaltsActionsGetByNode extends UnaryHandler<
1717
{
@@ -28,7 +28,7 @@ class GestaltsActionsGetByNode extends UnaryHandler<
2828
const { nodeId }: { nodeId: NodeId } = validateSync(
2929
(keyPath, value) => {
3030
return matchSync(keyPath)(
31-
[['nodeId'], () => validationUtils.parseNodeId(value)],
31+
[['nodeId'], () => ids.parseNodeId(value)],
3232
() => value,
3333
);
3434
},

src/client/handlers/GestaltsActionsSetByIdentity.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@ import type {
44
ClientRPCResponseResult,
55
SetIdentityActionMessage,
66
} from '../types';
7-
import type { IdentityId, ProviderId } from '../../ids/index';
7+
import type { IdentityId, ProviderId } from '../../ids';
88
import type { GestaltAction } from '../../gestalts/types';
99
import type GestaltGraph from '../../gestalts/GestaltGraph';
1010
import { UnaryHandler } from '@matrixai/rpc';
11-
import { validateSync } from '../../validation/index';
12-
import * as validationUtils from '../../validation/utils';
13-
import { matchSync } from '../../utils/index';
11+
import * as ids from '../../ids';
12+
import * as gestaltsUtils from '../../gestalts/utils';
13+
import { validateSync } from '../../validation';
14+
import { matchSync } from '../../utils';
1415

1516
class GestaltsActionsSetByIdentityHandler extends UnaryHandler<
1617
{
@@ -35,9 +36,9 @@ class GestaltsActionsSetByIdentityHandler extends UnaryHandler<
3536
} = validateSync(
3637
(keyPath, value) => {
3738
return matchSync(keyPath)(
38-
[['action'], () => validationUtils.parseGestaltAction(value)],
39-
[['providerId'], () => validationUtils.parseProviderId(value)],
40-
[['identityId'], () => validationUtils.parseIdentityId(value)],
39+
[['action'], () => gestaltsUtils.parseGestaltAction(value)],
40+
[['providerId'], () => ids.parseProviderId(value)],
41+
[['identityId'], () => ids.parseIdentityId(value)],
4142
() => value,
4243
);
4344
},

src/client/handlers/GestaltsActionsSetByNode.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ import type {
66
} from '../types';
77
import type { GestaltAction } from '../../gestalts/types';
88
import type GestaltGraph from '../../gestalts/GestaltGraph';
9-
import type { NodeId } from '../../ids/index';
9+
import type { NodeId } from '../../ids';
1010
import { UnaryHandler } from '@matrixai/rpc';
11-
import { validateSync } from '../../validation/index';
12-
import * as validationUtils from '../../validation/utils';
13-
import { matchSync } from '../../utils/index';
11+
import * as ids from '../../ids';
12+
import * as gestaltsUtils from '../../gestalts/utils';
13+
import { validateSync } from '../../validation';
14+
import { matchSync } from '../../utils';
1415

1516
class GestaltsActionsSetByNode extends UnaryHandler<
1617
{
@@ -28,8 +29,8 @@ class GestaltsActionsSetByNode extends UnaryHandler<
2829
validateSync(
2930
(keyPath, value) => {
3031
return matchSync(keyPath)(
31-
[['nodeId'], () => validationUtils.parseNodeId(value)],
32-
[['action'], () => validationUtils.parseGestaltAction(value)],
32+
[['nodeId'], () => ids.parseNodeId(value)],
33+
[['action'], () => gestaltsUtils.parseGestaltAction(value)],
3334
() => value,
3435
);
3536
},

src/client/handlers/GestaltsActionsUnsetByIdentity.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@ import type {
44
ClientRPCResponseResult,
55
SetIdentityActionMessage,
66
} from '../types';
7-
import type { IdentityId, ProviderId } from '../../ids/index';
7+
import type { IdentityId, ProviderId } from '../../ids';
88
import type { GestaltAction } from '../../gestalts/types';
99
import type GestaltGraph from '../../gestalts/GestaltGraph';
1010
import { UnaryHandler } from '@matrixai/rpc';
11-
import { validateSync } from '../../validation/index';
12-
import * as validationUtils from '../../validation/utils';
13-
import { matchSync } from '../../utils/index';
11+
import * as ids from '../../ids';
12+
import * as gestaltsUtils from '../../gestalts/utils';
13+
import { validateSync } from '../../validation';
14+
import { matchSync } from '../../utils';
1415

1516
class GestaltsActionsUnsetByIdentity extends UnaryHandler<
1617
{
@@ -35,9 +36,9 @@ class GestaltsActionsUnsetByIdentity extends UnaryHandler<
3536
} = validateSync(
3637
(keyPath, value) => {
3738
return matchSync(keyPath)(
38-
[['action'], () => validationUtils.parseGestaltAction(value)],
39-
[['providerId'], () => validationUtils.parseProviderId(value)],
40-
[['identityId'], () => validationUtils.parseIdentityId(value)],
39+
[['action'], () => gestaltsUtils.parseGestaltAction(value)],
40+
[['providerId'], () => ids.parseProviderId(value)],
41+
[['identityId'], () => ids.parseIdentityId(value)],
4142
() => value,
4243
);
4344
},

src/client/handlers/GestaltsActionsUnsetByNode.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ import type {
66
} from '../types';
77
import type { GestaltAction } from '../../gestalts/types';
88
import type GestaltGraph from '../../gestalts/GestaltGraph';
9-
import type { NodeId } from '../../ids/index';
9+
import type { NodeId } from '../../ids';
1010
import { UnaryHandler } from '@matrixai/rpc';
11-
import { validateSync } from '../../validation/index';
12-
import * as validationUtils from '../../validation/utils';
13-
import { matchSync } from '../../utils/index';
11+
import * as ids from '../../ids';
12+
import * as gestaltsUtils from '../../gestalts/utils';
13+
import { validateSync } from '../../validation';
14+
import { matchSync } from '../../utils';
1415

1516
class GestaltsActionsUnsetByNode extends UnaryHandler<
1617
{
@@ -28,8 +29,8 @@ class GestaltsActionsUnsetByNode extends UnaryHandler<
2829
validateSync(
2930
(keyPath, value) => {
3031
return matchSync(keyPath)(
31-
[['nodeId'], () => validationUtils.parseNodeId(value)],
32-
[['action'], () => validationUtils.parseGestaltAction(value)],
32+
[['nodeId'], () => ids.parseNodeId(value)],
33+
[['action'], () => gestaltsUtils.parseGestaltAction(value)],
3334
() => value,
3435
);
3536
},

src/client/handlers/GestaltsDiscoveryByIdentity.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ import type {
33
ClientRPCResponseResult,
44
IdentityMessage,
55
} from '../types';
6-
import type { IdentityId, ProviderId } from '../../ids/index';
6+
import type { IdentityId, ProviderId } from '../../ids';
77
import type Discovery from '../../discovery/Discovery';
88
import { UnaryHandler } from '@matrixai/rpc';
9-
import { validateSync } from '../../validation/index';
10-
import * as validationUtils from '../../validation/utils';
11-
import { matchSync } from '../../utils/index';
9+
import * as ids from '../../ids';
10+
import { validateSync } from '../../validation';
11+
import { matchSync } from '../../utils';
1212

1313
class GestaltsDiscoveryByIdentity extends UnaryHandler<
1414
{
@@ -27,8 +27,8 @@ class GestaltsDiscoveryByIdentity extends UnaryHandler<
2727
}: { providerId: ProviderId; identityId: IdentityId } = validateSync(
2828
(keyPath, value) => {
2929
return matchSync(keyPath)(
30-
[['providerId'], () => validationUtils.parseProviderId(value)],
31-
[['identityId'], () => validationUtils.parseIdentityId(value)],
30+
[['providerId'], () => ids.parseProviderId(value)],
31+
[['identityId'], () => ids.parseIdentityId(value)],
3232
() => value,
3333
);
3434
},

src/client/handlers/GestaltsDiscoveryByNode.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ import type {
33
ClientRPCResponseResult,
44
NodeIdMessage,
55
} from '../types';
6-
import type { NodeId } from '../../ids/index';
6+
import type { NodeId } from '../../ids';
77
import type Discovery from '../../discovery/Discovery';
88
import { UnaryHandler } from '@matrixai/rpc';
9-
import { validateSync } from '../../validation/index';
10-
import * as validationUtils from '../../validation/utils';
11-
import { matchSync } from '../../utils/index';
9+
import * as ids from '../../ids';
10+
import { validateSync } from '../../validation';
11+
import { matchSync } from '../../utils';
1212

1313
class GestaltsDiscoveryByNode extends UnaryHandler<
1414
{
@@ -24,7 +24,7 @@ class GestaltsDiscoveryByNode extends UnaryHandler<
2424
const { nodeId }: { nodeId: NodeId } = validateSync(
2525
(keyPath, value) => {
2626
return matchSync(keyPath)(
27-
[['nodeId'], () => validationUtils.parseNodeId(value)],
27+
[['nodeId'], () => ids.parseNodeId(value)],
2828
() => value,
2929
);
3030
},

src/client/handlers/GestaltsGestaltGetByIdentity.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ import type {
55
GestaltMessage,
66
IdentityMessage,
77
} from '../types';
8-
import type { IdentityId, ProviderId } from '../../ids/index';
8+
import type { IdentityId, ProviderId } from '../../ids';
99
import type GestaltGraph from '../../gestalts/GestaltGraph';
1010
import { UnaryHandler } from '@matrixai/rpc';
1111
import * as nodesUtils from '../../nodes/utils';
12-
import { validateSync } from '../../validation/index';
13-
import * as validationUtils from '../../validation/utils';
14-
import { matchSync } from '../../utils/index';
12+
import * as ids from '../../ids';
13+
import { validateSync } from '../../validation';
14+
import { matchSync } from '../../utils';
1515

1616
class GestaltsGestaltGetByIdentity extends UnaryHandler<
1717
{
@@ -31,8 +31,8 @@ class GestaltsGestaltGetByIdentity extends UnaryHandler<
3131
}: { providerId: ProviderId; identityId: IdentityId } = validateSync(
3232
(keyPath, value) => {
3333
return matchSync(keyPath)(
34-
[['providerId'], () => validationUtils.parseProviderId(value)],
35-
[['identityId'], () => validationUtils.parseIdentityId(value)],
34+
[['providerId'], () => ids.parseProviderId(value)],
35+
[['identityId'], () => ids.parseIdentityId(value)],
3636
() => value,
3737
);
3838
},

src/client/handlers/GestaltsGestaltGetByNode.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ import type {
66
NodeIdMessage,
77
} from '../types';
88
import type GestaltGraph from '../../gestalts/GestaltGraph';
9-
import type { NodeId } from '../../ids/index';
9+
import type { NodeId } from '../../ids';
1010
import { UnaryHandler } from '@matrixai/rpc';
1111
import * as nodesUtils from '../../nodes/utils';
12-
import { validateSync } from '../../validation/index';
13-
import * as validationUtils from '../../validation/utils';
14-
import { matchSync } from '../../utils/index';
12+
import * as ids from '../../ids';
13+
import { validateSync } from '../../validation';
14+
import { matchSync } from '../../utils';
1515

1616
class GestaltsGestaltGetByNode extends UnaryHandler<
1717
{
@@ -28,7 +28,7 @@ class GestaltsGestaltGetByNode extends UnaryHandler<
2828
const { nodeId }: { nodeId: NodeId } = validateSync(
2929
(keyPath, value) => {
3030
return matchSync(keyPath)(
31-
[['nodeId'], () => validationUtils.parseNodeId(value)],
31+
[['nodeId'], () => ids.parseNodeId(value)],
3232
() => value,
3333
);
3434
},

0 commit comments

Comments
 (0)