Skip to content

Commit bb42d37

Browse files
enhance(types): cleanup (#8945)
* enhance(types): cleanup * chore(dependencies): updated changesets for modified dependencies * Ranged * chore(dependencies): updated changesets for modified dependencies --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent c6252a2 commit bb42d37

File tree

6 files changed

+49
-400
lines changed

6 files changed

+49
-400
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@graphql-mesh/types": patch
3+
---
4+
dependencies updates:
5+
- Updated dependency [`@graphql-hive/pubsub@^2.1.1` ↗︎](https://www.npmjs.com/package/@graphql-hive/pubsub/v/2.1.1) (from `next`, in `dependencies`)
6+
- Removed dependency [`@graphql-mesh/store@^0.104.15` ↗︎](https://www.npmjs.com/package/@graphql-mesh/store/v/0.104.15) (from `dependencies`)

.changeset/proud-foxes-study.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@graphql-mesh/types': patch
3+
---
4+
5+
Remove unnecessary store dependency

packages/legacy/types/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@
3535
"graphql": "*"
3636
},
3737
"dependencies": {
38-
"@graphql-hive/pubsub": "next",
39-
"@graphql-mesh/store": "^0.104.15",
38+
"@graphql-hive/pubsub": "^2.1.1",
4039
"@graphql-tools/batch-delegate": "^10.0.0",
4140
"@graphql-tools/delegate": "^11.0.0",
4241
"@graphql-tools/utils": "^10.8.0",

packages/legacy/types/src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import type { DocumentNode, GraphQLResolveInfo, GraphQLSchema, SelectionSetNode } from 'graphql';
33
import type { PromiseOrValue } from 'graphql/jsutils/PromiseOrValue.js';
44
import type { Plugin } from '@envelop/core';
5-
import type { MeshStore } from '@graphql-mesh/store';
65
import type { BatchDelegateOptions } from '@graphql-tools/batch-delegate';
76
import type {
87
CreateProxyingResolverFn,
@@ -15,6 +14,7 @@ import type { ExecutionRequest, Executor, IResolvers, MaybePromise } from '@grap
1514
import type { TypedDocumentNode } from '@graphql-typed-document-node/core';
1615
import * as YamlConfig from './config.js';
1716
import type { MeshPubSub } from './pubsub.js';
17+
import type { IMeshStore } from './store.js';
1818

1919
export * from './pubsub.js';
2020

@@ -50,7 +50,7 @@ export type MeshHandlerOptions<THandlerConfig> = {
5050
baseDir: string;
5151
cache: KeyValueCache;
5252
pubsub: MeshPubSub;
53-
store: MeshStore;
53+
store: IMeshStore;
5454
logger: Logger;
5555
importFn: ImportFn;
5656
};
@@ -92,7 +92,7 @@ export interface MeshMergerOptions {
9292
cache: KeyValueCache;
9393
pubsub: MeshPubSub;
9494
logger: Logger;
95-
store: MeshStore;
95+
store: IMeshStore;
9696
}
9797

9898
export interface MeshMergerLibrary {

packages/legacy/types/src/store.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
type StoreFlags = {
2+
readonly: boolean;
3+
validate: boolean;
4+
};
5+
6+
type ProxyOptions<TData, TJSONData = any> = {
7+
codify: (value: TData, identifier: string) => string | Promise<string>;
8+
fromJSON: (jsonData: TJSONData, identifier: string) => TData | Promise<TData>;
9+
toJSON: (value: TData, identifier: string) => TJSONData | Promise<TJSONData>;
10+
validate: (oldValue: TData, newValue: TData, identifier: string) => void | Promise<void>;
11+
};
12+
13+
type StoreProxy<TData> = {
14+
set(value: TData): Promise<void>;
15+
get(): Promise<TData>;
16+
getWithSet(setterFn: () => TData | Promise<TData>): Promise<TData>;
17+
delete(): Promise<void>;
18+
};
19+
20+
export interface IMeshStore {
21+
child(childIdentifier: string, flags?: Partial<StoreFlags>): IMeshStore;
22+
proxy<TData>(id: string, options: ProxyOptions<TData>): StoreProxy<TData>;
23+
}

0 commit comments

Comments
 (0)