@tinacms/cli 0.60.15 → 0.60.16

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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # tinacms-cli
2
2
 
3
+ ## 0.60.16
4
+
5
+ ### Patch Changes
6
+
7
+ - 7372f90ca: Adds a new client that can be used on the backend and frontend.
8
+ - Updated dependencies [3b11ff6ad]
9
+ - @tinacms/graphql@0.60.1
10
+
3
11
  ## 0.60.15
4
12
 
5
13
  ### Patch Changes
package/dist/index.js CHANGED
@@ -114,7 +114,7 @@ var commander = __toModule(require("commander"));
114
114
 
115
115
  // pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/package.json
116
116
  var name = "@tinacms/cli";
117
- var version = "0.60.15";
117
+ var version = "0.60.16";
118
118
 
119
119
  // pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/query-gen/attachSchema.ts
120
120
  var import_graphql = __toModule(require("@tinacms/graphql"));
@@ -165,7 +165,9 @@ var import_graphql5 = __toModule(require("graphql"));
165
165
  var AddGeneratedClientFunc = (_schema, _documents, _config, _info) => {
166
166
  return `
167
167
  // TinaSDK generated code
168
- import { staticRequest } from 'tinacms'
168
+ import { createClient } from 'tinacms/dist/client'
169
+ const client = createClient({url: 'http://localhost:4001/graphql'})
170
+
169
171
  const requester: (doc: any, vars?: any, options?: any) => Promise<any> = async (
170
172
  doc,
171
173
  vars,
@@ -173,7 +175,7 @@ const requester: (doc: any, vars?: any, options?: any) => Promise<any> = async (
173
175
  ) => {
174
176
  let data = {}
175
177
  try {
176
- data = await staticRequest({
178
+ data = await client.request({
177
179
  query: doc,
178
180
  variables: vars,
179
181
  })
@@ -183,7 +185,7 @@ const requester: (doc: any, vars?: any, options?: any) => Promise<any> = async (
183
185
  console.warn(e)
184
186
  }
185
187
 
186
- return { data, query: doc, variables: vars || {} }
188
+ return { data: data?.data, query: doc, variables: vars || {} }
187
189
  }
188
190
 
189
191
  /**
@@ -275,7 +277,6 @@ var plugin = (schema, documents, config) => {
275
277
  const visitor = new GenericSdkVisitor(schema, allFragments, config);
276
278
  const visitorResult = (0, import_graphql3.visit)(allAst, { leave: visitor });
277
279
  return {
278
- prepend: visitor.getImports(),
279
280
  content: [
280
281
  visitor.fragments,
281
282
  ...visitorResult.definitions.filter((t) => typeof t === "string"),
@@ -328,10 +329,7 @@ var generateTypes = async (schema, queryPathGlob = process.cwd(), fragDocPath =
328
329
  { typescript: {} },
329
330
  { typescriptOperations: {} },
330
331
  {
331
- typescriptSdk: {
332
- gqlImport: "tinacms#gql",
333
- documentNodeImport: "tinacms#DocumentNode"
334
- }
332
+ typescriptSdk: {}
335
333
  },
336
334
  { AddGeneratedClient: {} }
337
335
  ],
@@ -362,6 +360,13 @@ async function genTypes({ schema }, next, options) {
362
360
  const typescriptTypes = await generateTypes(schema, queryPathGlob, fragPath, options);
363
361
  await import_fs_extra.default.outputFile(typesPath, `//@ts-nocheck
364
362
  // DO NOT MODIFY THIS FILE. This file is automatically generated by Tina
363
+ export function gql(strings: TemplateStringsArray, ...args: string[]): string {
364
+ let str = ''
365
+ strings.forEach((string, i) => {
366
+ str += string + (args[i] || '')
367
+ })
368
+ return str
369
+ }
365
370
  ${typescriptTypes}
366
371
  `);
367
372
  logger.info(` Typescript types => ${logText(typesPath)}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinacms/cli",
3
- "version": "0.60.15",
3
+ "version": "0.60.16",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
6
6
  "files": [
@@ -58,7 +58,7 @@
58
58
  "@graphql-tools/graphql-file-loader": "^7.2.0",
59
59
  "@graphql-tools/load": "^7.3.2",
60
60
  "@tinacms/datalayer": "0.1.1",
61
- "@tinacms/graphql": "0.60.0",
61
+ "@tinacms/graphql": "0.60.1",
62
62
  "@tinacms/metrics": "0.0.3",
63
63
  "@tinacms/schema-tools": "0.0.3",
64
64
  "@yarnpkg/esbuild-plugin-pnp": "^2.0.1-rc.3",