@tinacms/graphql 0.0.0-20224121515 → 0.0.0-2022412201743
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/CHANGELOG.md +3 -4
- package/dist/index.js +17 -24
- package/dist/resolve.d.ts +3 -1
- package/dist/resolver/index.d.ts +3 -0
- package/dist/types.d.ts +6 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
# tina-graphql
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
3
|
+
## 0.0.0-2022412201743
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- 08cdb672a: Adds `useRelativeMedia` support to local graphql client
|
|
8
8
|
- 6e2ed31a2: Added `isTitle` property to the schema that allows the title to be displayed in the CMS
|
|
9
|
-
- Updated dependencies [c9088a6cd]
|
|
10
9
|
- Updated dependencies [6e2ed31a2]
|
|
11
|
-
- @tinacms/schema-tools@0.0.0-
|
|
10
|
+
- @tinacms/schema-tools@0.0.0-2022412201743
|
|
12
11
|
|
|
13
12
|
## 0.60.1
|
|
14
13
|
|
package/dist/index.js
CHANGED
|
@@ -22663,12 +22663,7 @@ var Resolver = class {
|
|
|
22663
22663
|
if (!collectionLookup && isCollectionSpecific === false) {
|
|
22664
22664
|
collectionLookup = Object.keys(args.params)[0];
|
|
22665
22665
|
}
|
|
22666
|
-
|
|
22667
|
-
const collectionNames = this.tinaSchema.getCollections().map((item) => {
|
|
22668
|
-
console.log({ item });
|
|
22669
|
-
return (item == null ? void 0 : item.name) || false;
|
|
22670
|
-
}).filter(Boolean);
|
|
22671
|
-
console.log("All collection names", collectionNames);
|
|
22666
|
+
const collectionNames = this.tinaSchema.getCollections().map((item) => item.name);
|
|
22672
22667
|
assertShape(collectionLookup, (yup3) => {
|
|
22673
22668
|
return yup3.mixed().oneOf(collectionNames);
|
|
22674
22669
|
}, `"collection" must be one of: [${collectionNames.join(", ")}] but got ${collectionLookup}`);
|
|
@@ -22692,11 +22687,8 @@ var Resolver = class {
|
|
|
22692
22687
|
if (!alreadyExists) {
|
|
22693
22688
|
throw new Error(`Unable to delete document, ${realPath} does not exist`);
|
|
22694
22689
|
}
|
|
22695
|
-
console.log("it is a deletion");
|
|
22696
22690
|
const doc = await this.getDocument(realPath);
|
|
22697
|
-
console.log("it is a deleting doc");
|
|
22698
22691
|
await this.deleteDocument(realPath);
|
|
22699
|
-
console.log("Finished deleting doc");
|
|
22700
22692
|
return doc;
|
|
22701
22693
|
}
|
|
22702
22694
|
if (alreadyExists === false) {
|
|
@@ -22857,9 +22849,19 @@ var Resolver = class {
|
|
|
22857
22849
|
case "boolean":
|
|
22858
22850
|
case "number":
|
|
22859
22851
|
case "reference":
|
|
22860
|
-
case "image":
|
|
22861
22852
|
accumulator[field.name] = value;
|
|
22862
22853
|
break;
|
|
22854
|
+
case "image":
|
|
22855
|
+
if (this.config) {
|
|
22856
|
+
if (this.config.useRelativeMedia === true) {
|
|
22857
|
+
accumulator[field.name] = value;
|
|
22858
|
+
} else {
|
|
22859
|
+
accumulator[field.name] = `https://assets.tina.io/${this.config.clientId}/${value}`;
|
|
22860
|
+
}
|
|
22861
|
+
} else {
|
|
22862
|
+
accumulator[field.name] = value;
|
|
22863
|
+
}
|
|
22864
|
+
break;
|
|
22863
22865
|
case "rich-text":
|
|
22864
22866
|
const tree = parseMDX(value, field);
|
|
22865
22867
|
accumulator[field.name] = tree;
|
|
@@ -22925,6 +22927,7 @@ var Resolver = class {
|
|
|
22925
22927
|
}));
|
|
22926
22928
|
return args.params;
|
|
22927
22929
|
};
|
|
22930
|
+
this.config = init.config;
|
|
22928
22931
|
this.database = init.database;
|
|
22929
22932
|
this.tinaSchema = init.tinaSchema;
|
|
22930
22933
|
}
|
|
@@ -22961,6 +22964,7 @@ var resolveDateInput = (value) => {
|
|
|
22961
22964
|
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/graphql/src/resolve.ts
|
|
22962
22965
|
var import_relay_operation_optimizer = __toModule(require("@graphql-tools/relay-operation-optimizer"));
|
|
22963
22966
|
var resolve = async ({
|
|
22967
|
+
config,
|
|
22964
22968
|
query,
|
|
22965
22969
|
variables,
|
|
22966
22970
|
database,
|
|
@@ -22969,11 +22973,11 @@ var resolve = async ({
|
|
|
22969
22973
|
try {
|
|
22970
22974
|
const graphQLSchemaAst = await database.getGraphQLSchema();
|
|
22971
22975
|
const graphQLSchema = (0, import_graphql3.buildASTSchema)(graphQLSchemaAst);
|
|
22972
|
-
const
|
|
22976
|
+
const tinaConfig = await database.getTinaSchema();
|
|
22973
22977
|
const tinaSchema = await createSchema({
|
|
22974
|
-
schema:
|
|
22978
|
+
schema: tinaConfig
|
|
22975
22979
|
});
|
|
22976
|
-
const resolver2 = await createResolver2({ database, tinaSchema });
|
|
22980
|
+
const resolver2 = await createResolver2({ config, database, tinaSchema });
|
|
22977
22981
|
const res = await (0, import_graphql3.graphql)({
|
|
22978
22982
|
schema: graphQLSchema,
|
|
22979
22983
|
source: query,
|
|
@@ -23058,7 +23062,6 @@ var resolve = async ({
|
|
|
23058
23062
|
"updateDocument",
|
|
23059
23063
|
"deleteDocument"
|
|
23060
23064
|
].includes(info.fieldName)) {
|
|
23061
|
-
console.log("resolver.resolveDocument being called");
|
|
23062
23065
|
const result2 = await resolver2.resolveDocument({
|
|
23063
23066
|
args,
|
|
23064
23067
|
collection: args.collection,
|
|
@@ -23068,7 +23071,6 @@ var resolve = async ({
|
|
|
23068
23071
|
isAddPendingDocument: false,
|
|
23069
23072
|
isCollectionSpecific: false
|
|
23070
23073
|
});
|
|
23071
|
-
console.log("result from resolver.resolveDocument", result2);
|
|
23072
23074
|
return result2;
|
|
23073
23075
|
}
|
|
23074
23076
|
return value;
|
|
@@ -23227,7 +23229,6 @@ var Database = class {
|
|
|
23227
23229
|
return collection;
|
|
23228
23230
|
};
|
|
23229
23231
|
this.get = async (filepath) => {
|
|
23230
|
-
console.log("Get form DB being called");
|
|
23231
23232
|
if (SYSTEM_FILES.includes(filepath)) {
|
|
23232
23233
|
throw new Error(`Unexpected get for config file ${filepath}`);
|
|
23233
23234
|
} else {
|
|
@@ -23255,7 +23256,6 @@ var Database = class {
|
|
|
23255
23256
|
data[field.name] = $_body;
|
|
23256
23257
|
}
|
|
23257
23258
|
}
|
|
23258
|
-
console.log("Get form DB being finished");
|
|
23259
23259
|
return __spreadProps(__spreadValues({}, data), {
|
|
23260
23260
|
_collection: collection.name,
|
|
23261
23261
|
_keepTemplateKey: !!collection.templates,
|
|
@@ -23538,25 +23538,18 @@ var Database = class {
|
|
|
23538
23538
|
});
|
|
23539
23539
|
};
|
|
23540
23540
|
this.delete = async (filepath) => {
|
|
23541
|
-
console.log("calling db delete");
|
|
23542
|
-
console.log({ filepath });
|
|
23543
23541
|
const tinaSchema = await this.getSchema();
|
|
23544
23542
|
const collection = tinaSchema.schema.collections.find((collection2) => filepath.startsWith(collection2.path));
|
|
23545
|
-
console.log({ collection });
|
|
23546
23543
|
let collectionIndexDefinitions;
|
|
23547
23544
|
if (collection) {
|
|
23548
23545
|
const indexDefinitions = await this.getIndexDefinitions();
|
|
23549
|
-
console.log({ indexDefinitions });
|
|
23550
23546
|
collectionIndexDefinitions = indexDefinitions == null ? void 0 : indexDefinitions[collection.name];
|
|
23551
23547
|
}
|
|
23552
|
-
console.log("Calling store delete");
|
|
23553
23548
|
await this.store.delete(filepath, {
|
|
23554
23549
|
collection: collection.name,
|
|
23555
23550
|
indexDefinitions: collectionIndexDefinitions
|
|
23556
23551
|
});
|
|
23557
|
-
console.log("Calling bridge delete");
|
|
23558
23552
|
await this.bridge.delete(filepath);
|
|
23559
|
-
console.log("finished calling db delete");
|
|
23560
23553
|
};
|
|
23561
23554
|
this._indexAllContent = async () => {
|
|
23562
23555
|
const tinaSchema = await this.getSchema();
|
package/dist/resolve.d.ts
CHANGED
|
@@ -11,7 +11,9 @@ See the License for the specific language governing permissions and
|
|
|
11
11
|
limitations under the License.
|
|
12
12
|
*/
|
|
13
13
|
import type { Database } from './database';
|
|
14
|
-
|
|
14
|
+
import type { GraphQLConfig } from './types';
|
|
15
|
+
export declare const resolve: ({ config, query, variables, database, silenceErrors, }: {
|
|
16
|
+
config?: GraphQLConfig;
|
|
15
17
|
query: string;
|
|
16
18
|
variables: object;
|
|
17
19
|
database: Database;
|
package/dist/resolver/index.d.ts
CHANGED
|
@@ -12,7 +12,9 @@ limitations under the License.
|
|
|
12
12
|
*/
|
|
13
13
|
import { Database } from '../database';
|
|
14
14
|
import type { Collectable, ReferenceTypeWithNamespace, TinaCloudCollection, TinaFieldInner, TinaSchema } from '@tinacms/schema-tools';
|
|
15
|
+
import type { GraphQLConfig } from '../types';
|
|
15
16
|
interface ResolverConfig {
|
|
17
|
+
config?: GraphQLConfig;
|
|
16
18
|
database: Database;
|
|
17
19
|
tinaSchema: TinaSchema;
|
|
18
20
|
}
|
|
@@ -23,6 +25,7 @@ export declare const createResolver: (args: ResolverConfig) => Resolver;
|
|
|
23
25
|
*/
|
|
24
26
|
export declare class Resolver {
|
|
25
27
|
init: ResolverConfig;
|
|
28
|
+
config: GraphQLConfig;
|
|
26
29
|
database: Database;
|
|
27
30
|
tinaSchema: TinaSchema;
|
|
28
31
|
constructor(init: ResolverConfig);
|
package/dist/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinacms/graphql",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-2022412201743",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
},
|
|
98
98
|
"devDependencies": {
|
|
99
99
|
"@tinacms/datalayer": "0.1.1",
|
|
100
|
-
"@tinacms/schema-tools": "0.0.0-
|
|
100
|
+
"@tinacms/schema-tools": "0.0.0-2022412201743",
|
|
101
101
|
"@tinacms/scripts": "0.50.7",
|
|
102
102
|
"@types/cors": "^2.8.7",
|
|
103
103
|
"@types/estree": "^0.0.50",
|