@tinacms/graphql 0.59.3 → 0.59.4

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
  # tina-graphql
2
2
 
3
+ ## 0.59.4
4
+
5
+ ### Patch Changes
6
+
7
+ - b66aefde1: Fixed issue where one could not add a title and then a bold text
8
+ - 35884152b: Adds and audit command that checks files for errors.
9
+ - 4948beec6: Fix issues with mdx code blocks and inline code nodes
10
+
3
11
  ## 0.59.3
4
12
 
5
13
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -14,10 +14,11 @@ export { indexDB } from './build';
14
14
  export { resolve } from './resolve';
15
15
  export { createDatabase } from './database';
16
16
  import type { Database } from './database';
17
+ export type { Database } from './database';
17
18
  export type { Store } from './database/store';
18
19
  export type { Bridge } from './database/bridge';
20
+ export { sequential, assertShape } from './util';
19
21
  export { stringifyFile, parseFile } from './database/util';
20
- export { sequential } from './util';
21
22
  export declare const buildSchema: (rootPath: string, database: Database) => Promise<import("graphql").GraphQLSchema>;
22
23
  import type { TinaCloudSchema as TinaCloudSchemaBase, TinaCloudCollection as TinaCloudCollectionBase, TinaCloudTemplateBase as TinaTemplate, TinaFieldBase } from './types';
23
24
  export declare type TinaCloudSchema = TinaCloudSchemaBase<false>;
package/dist/index.js CHANGED
@@ -10384,6 +10384,7 @@ var require_remark_mdx = __commonJS({
10384
10384
 
10385
10385
  // pnp:/Users/jeffsee/code/tinacms/packages/@tinacms/graphql/src/index.ts
10386
10386
  __export(exports, {
10387
+ assertShape: () => assertShape,
10387
10388
  buildSchema: () => buildSchema,
10388
10389
  createDatabase: () => createDatabase,
10389
10390
  indexDB: () => indexDB,
@@ -11366,7 +11367,7 @@ var Builder = class {
11366
11367
  }),
11367
11368
  astBuilder.FieldDefinition({
11368
11369
  name: "label",
11369
- required: true,
11370
+ required: false,
11370
11371
  type: astBuilder.TYPES.String
11371
11372
  }),
11372
11373
  astBuilder.FieldDefinition({
@@ -12325,7 +12326,6 @@ var validateCollection = async (collection) => {
12325
12326
  name: yup2.string().matches(/^[a-zA-Z0-9_]*$/, {
12326
12327
  message: (obj) => `Collection's "name" must match ${obj.regex} at ${messageName}`
12327
12328
  }).required(),
12328
- label: yup2.string().required(),
12329
12329
  path: yup2.string().required().transform((value) => {
12330
12330
  return value.replace(/^\/|\/$/g, "");
12331
12331
  })
@@ -12362,7 +12362,6 @@ var validateField = async (field) => {
12362
12362
  name: yup2.string().matches(/^[a-zA-Z0-9_]*$/, {
12363
12363
  message: (obj) => `Field's 'name' must match ${obj.regex} at ${messageName}`
12364
12364
  }).required(),
12365
- label: yup2.string().required(),
12366
12365
  type: yup2.string().oneOf(FIELD_TYPES, (obj) => `'type' must be one of: ${obj.values}, but got '${obj.value}' at ${messageName}`)
12367
12366
  });
12368
12367
  await schema.validate(field);
@@ -12462,7 +12461,7 @@ var publishConfig = {
12462
12461
  };
12463
12462
  var repository = {
12464
12463
  url: "https://github.com/tinacms/tinacms.git",
12465
- directory: "packages/@tinacms/graphql"
12464
+ directory: "packages/tina-graphql"
12466
12465
  };
12467
12466
  var devDependencies = {
12468
12467
  "@tinacms/datalayer": "workspace:*",
@@ -20402,7 +20401,7 @@ function remarkToSlate(node) {
20402
20401
  case "code":
20403
20402
  return {
20404
20403
  type: types.code_block,
20405
- language: node.lang,
20404
+ lang: node.lang,
20406
20405
  children: node.value.split("\n").map((item) => ({
20407
20406
  type: "code_line",
20408
20407
  children: [{ type: "text", text: item }]
@@ -20447,11 +20446,11 @@ var forceLeafNode = (children) => {
20447
20446
  const text4 = [];
20448
20447
  children.forEach((k) => {
20449
20448
  switch (k.type) {
20449
+ case "inlineCode":
20450
20450
  case "text":
20451
20451
  return text4.push(k.value || "");
20452
20452
  case "strong":
20453
20453
  case "emphasis":
20454
- case "code":
20455
20454
  const format = { strong: "bold", em: "italic", code: "code" };
20456
20455
  extraProps[format[k.type]] = true;
20457
20456
  return k.children.forEach((item) => {
@@ -21883,10 +21882,23 @@ var stringifyChildren = (children, field) => {
21883
21882
  var stringify = (node, field) => {
21884
21883
  var _a;
21885
21884
  if (!node.type) {
21886
- return {
21887
- type: "text",
21888
- value: node.text || ""
21889
- };
21885
+ if (node == null ? void 0 : node.code) {
21886
+ return {
21887
+ type: "inlineCode",
21888
+ value: node.text
21889
+ };
21890
+ }
21891
+ let returnNode = { type: "text", value: node.text || "" };
21892
+ if (node == null ? void 0 : node.bold) {
21893
+ returnNode = { type: "strong", children: [returnNode] };
21894
+ }
21895
+ if (node == null ? void 0 : node.italic) {
21896
+ returnNode = {
21897
+ type: "emphasis",
21898
+ children: [returnNode]
21899
+ };
21900
+ }
21901
+ return returnNode;
21890
21902
  }
21891
21903
  switch (node.type) {
21892
21904
  case plateElements.ELEMENT_H1:
@@ -21938,10 +21950,8 @@ var stringify = (node, field) => {
21938
21950
  return {
21939
21951
  type: "code",
21940
21952
  lang: node.lang,
21941
- value: stringifyChildren(node.children, field).join("\n")
21953
+ value: node.children.map((child) => child.children[0].text).join("\n")
21942
21954
  };
21943
- case "code_line":
21944
- return stringifyChildren(node.children, field).join("\n");
21945
21955
  case plateElements.ELEMENT_UL:
21946
21956
  return {
21947
21957
  type: "list",
@@ -22221,6 +22231,12 @@ ${out}
22221
22231
  console.log(e);
22222
22232
  }
22223
22233
  case "text":
22234
+ if (node == null ? void 0 : node.code) {
22235
+ return {
22236
+ type: "inlineCode",
22237
+ value: node.text
22238
+ };
22239
+ }
22224
22240
  let returnNode = { type: "text", value: node.text || "" };
22225
22241
  if (node == null ? void 0 : node.bold) {
22226
22242
  returnNode = { type: "strong", children: [returnNode] };
@@ -22842,7 +22858,8 @@ var resolveDateInput = (value) => {
22842
22858
  var resolve = async ({
22843
22859
  query,
22844
22860
  variables,
22845
- database
22861
+ database,
22862
+ silenceErrors
22846
22863
  }) => {
22847
22864
  try {
22848
22865
  const graphQLSchemaAst = await database.getGraphQLSchema();
@@ -23025,11 +23042,15 @@ var resolve = async ({
23025
23042
  }
23026
23043
  });
23027
23044
  if (res.errors) {
23028
- console.error(res.errors);
23045
+ if (!silenceErrors) {
23046
+ console.error(res.errors);
23047
+ }
23029
23048
  }
23030
23049
  return res;
23031
23050
  } catch (e) {
23032
- console.error(e);
23051
+ if (!silenceErrors) {
23052
+ console.error(e);
23053
+ }
23033
23054
  if (e instanceof import_graphql3.GraphQLError) {
23034
23055
  return {
23035
23056
  errors: [e]
@@ -23663,6 +23684,7 @@ var buildSchema = async (rootPath, database) => {
23663
23684
  };
23664
23685
  // Annotate the CommonJS export names for ESM import in node:
23665
23686
  0 && (module.exports = {
23687
+ assertShape,
23666
23688
  buildSchema,
23667
23689
  createDatabase,
23668
23690
  indexDB,
package/dist/resolve.d.ts CHANGED
@@ -11,10 +11,11 @@ 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
- export declare const resolve: ({ query, variables, database, }: {
14
+ export declare const resolve: ({ query, variables, database, silenceErrors, }: {
15
15
  query: string;
16
16
  variables: object;
17
17
  database: Database;
18
+ silenceErrors?: boolean;
18
19
  }) => Promise<import("graphql").ExecutionResult<{
19
20
  [key: string]: any;
20
21
  }, {
@@ -32,7 +32,7 @@ export declare class Resolver {
32
32
  templates?: undefined;
33
33
  references?: import("../types").ReferenceTypeWithNamespace[];
34
34
  namespace: string[];
35
- label: string;
35
+ label?: string;
36
36
  name: string;
37
37
  path: string;
38
38
  format?: "json" | "md" | "markdown" | "mdx";
@@ -49,7 +49,7 @@ export declare class Resolver {
49
49
  fields?: undefined;
50
50
  references?: import("../types").ReferenceTypeWithNamespace[];
51
51
  namespace: string[];
52
- label: string;
52
+ label?: string;
53
53
  name: string;
54
54
  path: string;
55
55
  format?: "json" | "md" | "markdown" | "mdx";
package/dist/types.d.ts CHANGED
@@ -31,7 +31,7 @@ export declare type TinaCloudCollectionBase = TinaCloudCollection<false>;
31
31
  export declare type TinaCloudCollectionEnriched = TinaCloudCollection<true>;
32
32
  declare type FormatType = 'json' | 'md' | 'markdown' | 'mdx';
33
33
  interface BaseCollection {
34
- label: string;
34
+ label?: string;
35
35
  name: string;
36
36
  path: string;
37
37
  format?: FormatType;
@@ -64,7 +64,7 @@ export declare type TinaFieldBase = TinaFieldInner<false>;
64
64
  export declare type TinaFieldEnriched = TinaFieldInner<true>;
65
65
  interface TinaField {
66
66
  name: string;
67
- label: string;
67
+ label?: string;
68
68
  description?: string;
69
69
  required?: boolean;
70
70
  list?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinacms/graphql",
3
- "version": "0.59.3",
3
+ "version": "0.59.4",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
6
6
  "files": [