@envelop/persisted-operations 10.1.1 → 10.2.1
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/LICENSE +3 -1
- package/cjs/stores/json-file-store.js +3 -3
- package/cjs/utils.js +1 -3
- package/esm/stores/json-file-store.js +1 -1
- package/esm/utils.js +1 -3
- package/package.json +6 -5
- package/typings/plugin.d.cts +2 -2
- package/typings/plugin.d.ts +2 -2
- package/typings/stores/aggregated-store.d.cts +2 -2
- package/typings/stores/aggregated-store.d.ts +2 -2
- package/typings/stores/inmemory-store.d.cts +2 -2
- package/typings/stores/inmemory-store.d.ts +2 -2
- package/typings/stores/json-file-store.d.cts +2 -2
- package/typings/stores/json-file-store.d.ts +2 -2
- package/typings/types.d.cts +2 -2
- package/typings/types.d.ts +2 -2
- package/typings/utils.d.cts +1 -1
- package/typings/utils.d.ts +1 -1
package/LICENSE
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2020
|
|
3
|
+
Copyright (c) 2018-2020 Graphcool
|
|
4
|
+
Copyright (c) 2020-2021 Prisma
|
|
5
|
+
Copyright (c) 2021- The Guild
|
|
4
6
|
|
|
5
7
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
8
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.JsonFileStore = void 0;
|
|
4
|
-
const
|
|
4
|
+
const node_fs_1 = require("node:fs");
|
|
5
5
|
class JsonFileStore {
|
|
6
6
|
storeData = null;
|
|
7
7
|
get(operationId) {
|
|
@@ -11,11 +11,11 @@ class JsonFileStore {
|
|
|
11
11
|
return this.storeData.get(operationId) || undefined;
|
|
12
12
|
}
|
|
13
13
|
loadFromFileSync(path) {
|
|
14
|
-
const data = JSON.parse((0,
|
|
14
|
+
const data = JSON.parse((0, node_fs_1.readFileSync)(path, 'utf-8'));
|
|
15
15
|
this.storeData = new Map(Object.entries(data));
|
|
16
16
|
}
|
|
17
17
|
loadFromFile(path) {
|
|
18
|
-
return
|
|
18
|
+
return node_fs_1.promises.readFile(path, 'utf-8').then(data => {
|
|
19
19
|
this.storeData = new Map(Object.entries(JSON.parse(data)));
|
|
20
20
|
});
|
|
21
21
|
}
|
package/cjs/utils.js
CHANGED
|
@@ -2,7 +2,5 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.operationIdFromSource = operationIdFromSource;
|
|
4
4
|
function operationIdFromSource(source) {
|
|
5
|
-
return typeof source === 'string' && source.length && source.
|
|
6
|
-
? source
|
|
7
|
-
: undefined;
|
|
5
|
+
return typeof source === 'string' && source.length && !source.includes('{') ? source : undefined;
|
|
8
6
|
}
|
package/esm/utils.js
CHANGED
package/package.json
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@envelop/persisted-operations",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.2.1",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"peerDependencies": {
|
|
6
|
-
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0",
|
|
7
|
-
"@envelop/core": "^5.
|
|
6
|
+
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0",
|
|
7
|
+
"@envelop/core": "^5.6.1"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"tslib": "^2.5.0"
|
|
11
11
|
},
|
|
12
12
|
"repository": {
|
|
13
13
|
"type": "git",
|
|
14
|
-
"url": "https://github.com/graphql-hive/
|
|
15
|
-
"directory": "packages/plugins/persisted-operations"
|
|
14
|
+
"url": "https://github.com/graphql-hive/graphql-yoga.git",
|
|
15
|
+
"directory": "packages/envelop/plugins/persisted-operations"
|
|
16
16
|
},
|
|
17
|
+
"homepage": "https://github.com/graphql-hive/graphql-yoga/tree/main/packages/envelop/plugins/persisted-operations#readme",
|
|
17
18
|
"author": "Dotan Simha <dotansimha@gmail.com>",
|
|
18
19
|
"license": "MIT",
|
|
19
20
|
"engines": {
|
package/typings/plugin.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DefaultContext, Plugin } from '@envelop/core';
|
|
2
|
-
import { PersistedOperationsFunctionStore, PersistedOperationsStore } from './types.cjs';
|
|
1
|
+
import type { DefaultContext, Plugin } from '@envelop/core';
|
|
2
|
+
import type { PersistedOperationsFunctionStore, PersistedOperationsStore } from './types.cjs';
|
|
3
3
|
export type UsePersistedOperationsOptions<ContextType = DefaultContext> = {
|
|
4
4
|
/**
|
|
5
5
|
* Set to `false` to allow running operations that are not available in the store.
|
package/typings/plugin.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DefaultContext, Plugin } from '@envelop/core';
|
|
2
|
-
import { PersistedOperationsFunctionStore, PersistedOperationsStore } from './types.js';
|
|
1
|
+
import type { DefaultContext, Plugin } from '@envelop/core';
|
|
2
|
+
import type { PersistedOperationsFunctionStore, PersistedOperationsStore } from './types.js';
|
|
3
3
|
export type UsePersistedOperationsOptions<ContextType = DefaultContext> = {
|
|
4
4
|
/**
|
|
5
5
|
* Set to `false` to allow running operations that are not available in the store.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DocumentNode } from 'graphql';
|
|
2
|
-
import { PersistedOperationsStore } from '../types.cjs';
|
|
1
|
+
import type { DocumentNode } from 'graphql';
|
|
2
|
+
import type { PersistedOperationsStore } from '../types.cjs';
|
|
3
3
|
export declare class AggregatedStore implements PersistedOperationsStore {
|
|
4
4
|
private stores;
|
|
5
5
|
constructor(stores: PersistedOperationsStore[]);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DocumentNode } from 'graphql';
|
|
2
|
-
import { PersistedOperationsStore } from '../types.js';
|
|
1
|
+
import type { DocumentNode } from 'graphql';
|
|
2
|
+
import type { PersistedOperationsStore } from '../types.js';
|
|
3
3
|
export declare class AggregatedStore implements PersistedOperationsStore {
|
|
4
4
|
private stores;
|
|
5
5
|
constructor(stores: PersistedOperationsStore[]);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DocumentNode } from 'graphql';
|
|
2
|
-
import { PersistedOperationsStore } from '../types.cjs';
|
|
1
|
+
import type { DocumentNode } from 'graphql';
|
|
2
|
+
import type { PersistedOperationsStore } from '../types.cjs';
|
|
3
3
|
export type InMemoryStoreDataMap = Map<string, DocumentNode | string>;
|
|
4
4
|
export declare class InMemoryStore implements PersistedOperationsStore {
|
|
5
5
|
private storeData;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DocumentNode } from 'graphql';
|
|
2
|
-
import { PersistedOperationsStore } from '../types.js';
|
|
1
|
+
import type { DocumentNode } from 'graphql';
|
|
2
|
+
import type { PersistedOperationsStore } from '../types.js';
|
|
3
3
|
export type InMemoryStoreDataMap = Map<string, DocumentNode | string>;
|
|
4
4
|
export declare class InMemoryStore implements PersistedOperationsStore {
|
|
5
5
|
private storeData;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DocumentNode } from 'graphql';
|
|
2
|
-
import { PersistedOperationsStore } from '../types.cjs';
|
|
1
|
+
import type { DocumentNode } from 'graphql';
|
|
2
|
+
import type { PersistedOperationsStore } from '../types.cjs';
|
|
3
3
|
export type JsonFileStoreDataMap = Map<string, DocumentNode | string>;
|
|
4
4
|
export declare class JsonFileStore implements PersistedOperationsStore {
|
|
5
5
|
private storeData;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DocumentNode } from 'graphql';
|
|
2
|
-
import { PersistedOperationsStore } from '../types.js';
|
|
1
|
+
import type { DocumentNode } from 'graphql';
|
|
2
|
+
import type { PersistedOperationsStore } from '../types.js';
|
|
3
3
|
export type JsonFileStoreDataMap = Map<string, DocumentNode | string>;
|
|
4
4
|
export declare class JsonFileStore implements PersistedOperationsStore {
|
|
5
5
|
private storeData;
|
package/typings/types.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DocumentNode } from 'graphql';
|
|
2
|
-
import { DefaultContext } from '@envelop/core';
|
|
1
|
+
import type { DocumentNode } from 'graphql';
|
|
2
|
+
import type { DefaultContext } from '@envelop/core';
|
|
3
3
|
export interface PersistedOperationsStore {
|
|
4
4
|
/**
|
|
5
5
|
* Transfroms a hash/id into a DocumentNode or SDL string.
|
package/typings/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DocumentNode } from 'graphql';
|
|
2
|
-
import { DefaultContext } from '@envelop/core';
|
|
1
|
+
import type { DocumentNode } from 'graphql';
|
|
2
|
+
import type { DefaultContext } from '@envelop/core';
|
|
3
3
|
export interface PersistedOperationsStore {
|
|
4
4
|
/**
|
|
5
5
|
* Transfroms a hash/id into a DocumentNode or SDL string.
|
package/typings/utils.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Source } from 'graphql';
|
|
1
|
+
import type { Source } from 'graphql';
|
|
2
2
|
export declare function operationIdFromSource(source: string | Source): string | undefined;
|
package/typings/utils.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Source } from 'graphql';
|
|
1
|
+
import type { Source } from 'graphql';
|
|
2
2
|
export declare function operationIdFromSource(source: string | Source): string | undefined;
|