fixing tina
This commit is contained in:
Generated
+1
File diff suppressed because one or more lines are too long
Generated
+1
@@ -0,0 +1 @@
|
||||
{"DocumentConnection":{"type":"DocumentConnection","resolveType":"multiCollectionDocumentList","collections":["post"]},"Node":{"type":"Node","resolveType":"nodeDocument"},"DocumentNode":{"type":"DocumentNode","resolveType":"multiCollectionDocument","createDocument":"create","updateDocument":"update"},"Post":{"type":"Post","resolveType":"collectionDocument","collection":"post","createPost":"create","updatePost":"update"},"PostConnection":{"type":"PostConnection","resolveType":"collectionDocumentList","collection":"post"}}
|
||||
Generated
+1
@@ -0,0 +1 @@
|
||||
{"version":{"fullVersion":"1.4.27","major":"1","minor":"4","patch":"27"},"meta":{"flags":["experimentalData"]},"collections":[{"name":"post","label":"Posts","path":"content/posts","fields":[{"type":"string","name":"title","label":"Title","isTitle":true,"required":true,"namespace":["post","title"],"searchable":true},{"type":"rich-text","name":"body","label":"Body","isBody":true,"namespace":["post","body"],"searchable":true,"parser":{"type":"markdown"}}],"namespace":["post"]}],"config":{"media":{"tina":{"publicFolder":"static","mediaRoot":""}}}}
|
||||
Generated
+5
@@ -0,0 +1,5 @@
|
||||
import { createClient } from "tinacms/dist/client";
|
||||
import { queries } from "./types";
|
||||
export const client = createClient({ url: 'https://content.tinajs.io/1.4/content/e4537a30-23f9-4ad7-8a1f-f844a298dff3/github/main', token: 'e79c3264742978eaeaa3cc6e164bd4959c7edda8', queries, });
|
||||
export default client;
|
||||
|
||||
Generated
+47
@@ -0,0 +1,47 @@
|
||||
// tina/config.ts
|
||||
import { defineConfig } from "tinacms";
|
||||
var branch = process.env.HEAD || process.env.VERCEL_GIT_COMMIT_REF || "main";
|
||||
var config_default = defineConfig({
|
||||
branch,
|
||||
clientId: "e4537a30-23f9-4ad7-8a1f-f844a298dff3",
|
||||
// Get this from tina.io
|
||||
token: "e79c3264742978eaeaa3cc6e164bd4959c7edda8",
|
||||
// Get this from tina.io
|
||||
build: {
|
||||
outputFolder: "admin",
|
||||
publicFolder: "static"
|
||||
},
|
||||
media: {
|
||||
tina: {
|
||||
mediaRoot: "",
|
||||
publicFolder: "static"
|
||||
}
|
||||
},
|
||||
schema: {
|
||||
collections: [
|
||||
{
|
||||
name: "post",
|
||||
label: "Posts",
|
||||
path: "content/posts",
|
||||
fields: [
|
||||
{
|
||||
type: "string",
|
||||
name: "title",
|
||||
label: "Title",
|
||||
isTitle: true,
|
||||
required: true
|
||||
},
|
||||
{
|
||||
type: "rich-text",
|
||||
name: "body",
|
||||
label: "Body",
|
||||
isBody: true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
export {
|
||||
config_default as default
|
||||
};
|
||||
Generated
+5
@@ -0,0 +1,5 @@
|
||||
fragment PostParts on Post {
|
||||
__typename
|
||||
title
|
||||
body
|
||||
}
|
||||
Generated
+52
@@ -0,0 +1,52 @@
|
||||
query post($relativePath: String!) {
|
||||
post(relativePath: $relativePath) {
|
||||
... on Document {
|
||||
_sys {
|
||||
filename
|
||||
basename
|
||||
breadcrumbs
|
||||
path
|
||||
relativePath
|
||||
extension
|
||||
}
|
||||
id
|
||||
}
|
||||
...PostParts
|
||||
}
|
||||
}
|
||||
|
||||
query postConnection($before: String, $after: String, $first: Float, $last: Float, $sort: String, $filter: PostFilter) {
|
||||
postConnection(
|
||||
before: $before
|
||||
after: $after
|
||||
first: $first
|
||||
last: $last
|
||||
sort: $sort
|
||||
filter: $filter
|
||||
) {
|
||||
pageInfo {
|
||||
hasPreviousPage
|
||||
hasNextPage
|
||||
startCursor
|
||||
endCursor
|
||||
}
|
||||
totalCount
|
||||
edges {
|
||||
cursor
|
||||
node {
|
||||
... on Document {
|
||||
_sys {
|
||||
filename
|
||||
basename
|
||||
breadcrumbs
|
||||
path
|
||||
relativePath
|
||||
extension
|
||||
}
|
||||
id
|
||||
}
|
||||
...PostParts
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
+152
@@ -0,0 +1,152 @@
|
||||
# DO NOT MODIFY THIS FILE. This file is automatically generated by Tina
|
||||
"""References another document, used as a foreign key"""
|
||||
scalar Reference
|
||||
|
||||
""""""
|
||||
scalar JSON
|
||||
|
||||
type SystemInfo {
|
||||
filename: String!
|
||||
title: String
|
||||
basename: String!
|
||||
breadcrumbs(excludeExtension: Boolean): [String!]!
|
||||
path: String!
|
||||
relativePath: String!
|
||||
extension: String!
|
||||
template: String!
|
||||
collection: Collection!
|
||||
}
|
||||
|
||||
type Folder {
|
||||
name: String!
|
||||
path: String!
|
||||
}
|
||||
|
||||
type PageInfo {
|
||||
hasPreviousPage: Boolean!
|
||||
hasNextPage: Boolean!
|
||||
startCursor: String!
|
||||
endCursor: String!
|
||||
}
|
||||
|
||||
""""""
|
||||
interface Node {
|
||||
id: ID!
|
||||
}
|
||||
|
||||
""""""
|
||||
interface Document {
|
||||
id: ID!
|
||||
_sys: SystemInfo
|
||||
_values: JSON!
|
||||
}
|
||||
|
||||
"""A relay-compliant pagination connection"""
|
||||
interface Connection {
|
||||
totalCount: Float!
|
||||
pageInfo: PageInfo!
|
||||
}
|
||||
|
||||
type Query {
|
||||
getOptimizedQuery(queryString: String!): String
|
||||
collection(collection: String): Collection!
|
||||
collections: [Collection!]!
|
||||
node(id: String): Node!
|
||||
document(collection: String, relativePath: String): DocumentNode!
|
||||
post(relativePath: String): Post!
|
||||
postConnection(before: String, after: String, first: Float, last: Float, sort: String, filter: PostFilter): PostConnection!
|
||||
}
|
||||
|
||||
input DocumentFilter {
|
||||
post: PostFilter
|
||||
}
|
||||
|
||||
type DocumentConnectionEdges {
|
||||
cursor: String!
|
||||
node: DocumentNode
|
||||
}
|
||||
|
||||
type DocumentConnection implements Connection {
|
||||
pageInfo: PageInfo!
|
||||
totalCount: Float!
|
||||
edges: [DocumentConnectionEdges]
|
||||
}
|
||||
|
||||
type Collection {
|
||||
name: String!
|
||||
slug: String!
|
||||
label: String
|
||||
path: String!
|
||||
format: String
|
||||
matches: String
|
||||
templates: [JSON]
|
||||
fields: [JSON]
|
||||
documents(before: String, after: String, first: Float, last: Float, sort: String, filter: DocumentFilter, folder: String): DocumentConnection!
|
||||
}
|
||||
|
||||
union DocumentNode = Post | Folder
|
||||
|
||||
type Post implements Node & Document {
|
||||
title: String!
|
||||
body: JSON
|
||||
id: ID!
|
||||
_sys: SystemInfo!
|
||||
_values: JSON!
|
||||
}
|
||||
|
||||
input StringFilter {
|
||||
startsWith: String
|
||||
eq: String
|
||||
exists: Boolean
|
||||
in: [String]
|
||||
}
|
||||
|
||||
input RichTextFilter {
|
||||
startsWith: String
|
||||
eq: String
|
||||
exists: Boolean
|
||||
}
|
||||
|
||||
input PostFilter {
|
||||
title: StringFilter
|
||||
body: RichTextFilter
|
||||
}
|
||||
|
||||
type PostConnectionEdges {
|
||||
cursor: String!
|
||||
node: Post
|
||||
}
|
||||
|
||||
type PostConnection implements Connection {
|
||||
pageInfo: PageInfo!
|
||||
totalCount: Float!
|
||||
edges: [PostConnectionEdges]
|
||||
}
|
||||
|
||||
type Mutation {
|
||||
addPendingDocument(collection: String!, relativePath: String!, template: String): DocumentNode!
|
||||
updateDocument(collection: String, relativePath: String!, params: DocumentUpdateMutation!): DocumentNode!
|
||||
deleteDocument(collection: String, relativePath: String!): DocumentNode!
|
||||
createDocument(collection: String, relativePath: String!, params: DocumentMutation!): DocumentNode!
|
||||
updatePost(relativePath: String!, params: PostMutation!): Post!
|
||||
createPost(relativePath: String!, params: PostMutation!): Post!
|
||||
}
|
||||
|
||||
input DocumentUpdateMutation {
|
||||
post: PostMutation
|
||||
relativePath: String
|
||||
}
|
||||
|
||||
input DocumentMutation {
|
||||
post: PostMutation
|
||||
}
|
||||
|
||||
input PostMutation {
|
||||
title: String
|
||||
body: JSON
|
||||
}
|
||||
|
||||
schema {
|
||||
query: Query
|
||||
mutation: Mutation
|
||||
}
|
||||
Generated
+1
@@ -0,0 +1 @@
|
||||
[]
|
||||
Generated
+419
@@ -0,0 +1,419 @@
|
||||
//@ts-nocheck
|
||||
// DO NOT MODIFY THIS FILE. This file is automatically generated by Tina
|
||||
export function gql(strings: TemplateStringsArray, ...args: string[]): string {
|
||||
let str = ''
|
||||
strings.forEach((string, i) => {
|
||||
str += string + (args[i] || '')
|
||||
})
|
||||
return str
|
||||
}
|
||||
export type Maybe<T> = T | null;
|
||||
export type InputMaybe<T> = Maybe<T>;
|
||||
export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
|
||||
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
|
||||
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
|
||||
export type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = { [_ in K]?: never };
|
||||
export type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };
|
||||
/** All built-in and custom scalars, mapped to their actual values */
|
||||
export type Scalars = {
|
||||
ID: { input: string; output: string; }
|
||||
String: { input: string; output: string; }
|
||||
Boolean: { input: boolean; output: boolean; }
|
||||
Int: { input: number; output: number; }
|
||||
Float: { input: number; output: number; }
|
||||
/** References another document, used as a foreign key */
|
||||
Reference: { input: any; output: any; }
|
||||
JSON: { input: any; output: any; }
|
||||
};
|
||||
|
||||
export type SystemInfo = {
|
||||
__typename?: 'SystemInfo';
|
||||
filename: Scalars['String']['output'];
|
||||
title?: Maybe<Scalars['String']['output']>;
|
||||
basename: Scalars['String']['output'];
|
||||
breadcrumbs: Array<Scalars['String']['output']>;
|
||||
path: Scalars['String']['output'];
|
||||
relativePath: Scalars['String']['output'];
|
||||
extension: Scalars['String']['output'];
|
||||
template: Scalars['String']['output'];
|
||||
collection: Collection;
|
||||
};
|
||||
|
||||
|
||||
export type SystemInfoBreadcrumbsArgs = {
|
||||
excludeExtension?: InputMaybe<Scalars['Boolean']['input']>;
|
||||
};
|
||||
|
||||
export type Folder = {
|
||||
__typename?: 'Folder';
|
||||
name: Scalars['String']['output'];
|
||||
path: Scalars['String']['output'];
|
||||
};
|
||||
|
||||
export type PageInfo = {
|
||||
__typename?: 'PageInfo';
|
||||
hasPreviousPage: Scalars['Boolean']['output'];
|
||||
hasNextPage: Scalars['Boolean']['output'];
|
||||
startCursor: Scalars['String']['output'];
|
||||
endCursor: Scalars['String']['output'];
|
||||
};
|
||||
|
||||
export type Node = {
|
||||
id: Scalars['ID']['output'];
|
||||
};
|
||||
|
||||
export type Document = {
|
||||
id: Scalars['ID']['output'];
|
||||
_sys?: Maybe<SystemInfo>;
|
||||
_values: Scalars['JSON']['output'];
|
||||
};
|
||||
|
||||
/** A relay-compliant pagination connection */
|
||||
export type Connection = {
|
||||
totalCount: Scalars['Float']['output'];
|
||||
pageInfo: PageInfo;
|
||||
};
|
||||
|
||||
export type Query = {
|
||||
__typename?: 'Query';
|
||||
getOptimizedQuery?: Maybe<Scalars['String']['output']>;
|
||||
collection: Collection;
|
||||
collections: Array<Collection>;
|
||||
node: Node;
|
||||
document: DocumentNode;
|
||||
post: Post;
|
||||
postConnection: PostConnection;
|
||||
};
|
||||
|
||||
|
||||
export type QueryGetOptimizedQueryArgs = {
|
||||
queryString: Scalars['String']['input'];
|
||||
};
|
||||
|
||||
|
||||
export type QueryCollectionArgs = {
|
||||
collection?: InputMaybe<Scalars['String']['input']>;
|
||||
};
|
||||
|
||||
|
||||
export type QueryNodeArgs = {
|
||||
id?: InputMaybe<Scalars['String']['input']>;
|
||||
};
|
||||
|
||||
|
||||
export type QueryDocumentArgs = {
|
||||
collection?: InputMaybe<Scalars['String']['input']>;
|
||||
relativePath?: InputMaybe<Scalars['String']['input']>;
|
||||
};
|
||||
|
||||
|
||||
export type QueryPostArgs = {
|
||||
relativePath?: InputMaybe<Scalars['String']['input']>;
|
||||
};
|
||||
|
||||
|
||||
export type QueryPostConnectionArgs = {
|
||||
before?: InputMaybe<Scalars['String']['input']>;
|
||||
after?: InputMaybe<Scalars['String']['input']>;
|
||||
first?: InputMaybe<Scalars['Float']['input']>;
|
||||
last?: InputMaybe<Scalars['Float']['input']>;
|
||||
sort?: InputMaybe<Scalars['String']['input']>;
|
||||
filter?: InputMaybe<PostFilter>;
|
||||
};
|
||||
|
||||
export type DocumentFilter = {
|
||||
post?: InputMaybe<PostFilter>;
|
||||
};
|
||||
|
||||
export type DocumentConnectionEdges = {
|
||||
__typename?: 'DocumentConnectionEdges';
|
||||
cursor: Scalars['String']['output'];
|
||||
node?: Maybe<DocumentNode>;
|
||||
};
|
||||
|
||||
export type DocumentConnection = Connection & {
|
||||
__typename?: 'DocumentConnection';
|
||||
pageInfo: PageInfo;
|
||||
totalCount: Scalars['Float']['output'];
|
||||
edges?: Maybe<Array<Maybe<DocumentConnectionEdges>>>;
|
||||
};
|
||||
|
||||
export type Collection = {
|
||||
__typename?: 'Collection';
|
||||
name: Scalars['String']['output'];
|
||||
slug: Scalars['String']['output'];
|
||||
label?: Maybe<Scalars['String']['output']>;
|
||||
path: Scalars['String']['output'];
|
||||
format?: Maybe<Scalars['String']['output']>;
|
||||
matches?: Maybe<Scalars['String']['output']>;
|
||||
templates?: Maybe<Array<Maybe<Scalars['JSON']['output']>>>;
|
||||
fields?: Maybe<Array<Maybe<Scalars['JSON']['output']>>>;
|
||||
documents: DocumentConnection;
|
||||
};
|
||||
|
||||
|
||||
export type CollectionDocumentsArgs = {
|
||||
before?: InputMaybe<Scalars['String']['input']>;
|
||||
after?: InputMaybe<Scalars['String']['input']>;
|
||||
first?: InputMaybe<Scalars['Float']['input']>;
|
||||
last?: InputMaybe<Scalars['Float']['input']>;
|
||||
sort?: InputMaybe<Scalars['String']['input']>;
|
||||
filter?: InputMaybe<DocumentFilter>;
|
||||
folder?: InputMaybe<Scalars['String']['input']>;
|
||||
};
|
||||
|
||||
export type DocumentNode = Post | Folder;
|
||||
|
||||
export type Post = Node & Document & {
|
||||
__typename?: 'Post';
|
||||
title: Scalars['String']['output'];
|
||||
body?: Maybe<Scalars['JSON']['output']>;
|
||||
id: Scalars['ID']['output'];
|
||||
_sys: SystemInfo;
|
||||
_values: Scalars['JSON']['output'];
|
||||
};
|
||||
|
||||
export type StringFilter = {
|
||||
startsWith?: InputMaybe<Scalars['String']['input']>;
|
||||
eq?: InputMaybe<Scalars['String']['input']>;
|
||||
exists?: InputMaybe<Scalars['Boolean']['input']>;
|
||||
in?: InputMaybe<Array<InputMaybe<Scalars['String']['input']>>>;
|
||||
};
|
||||
|
||||
export type RichTextFilter = {
|
||||
startsWith?: InputMaybe<Scalars['String']['input']>;
|
||||
eq?: InputMaybe<Scalars['String']['input']>;
|
||||
exists?: InputMaybe<Scalars['Boolean']['input']>;
|
||||
};
|
||||
|
||||
export type PostFilter = {
|
||||
title?: InputMaybe<StringFilter>;
|
||||
body?: InputMaybe<RichTextFilter>;
|
||||
};
|
||||
|
||||
export type PostConnectionEdges = {
|
||||
__typename?: 'PostConnectionEdges';
|
||||
cursor: Scalars['String']['output'];
|
||||
node?: Maybe<Post>;
|
||||
};
|
||||
|
||||
export type PostConnection = Connection & {
|
||||
__typename?: 'PostConnection';
|
||||
pageInfo: PageInfo;
|
||||
totalCount: Scalars['Float']['output'];
|
||||
edges?: Maybe<Array<Maybe<PostConnectionEdges>>>;
|
||||
};
|
||||
|
||||
export type Mutation = {
|
||||
__typename?: 'Mutation';
|
||||
addPendingDocument: DocumentNode;
|
||||
updateDocument: DocumentNode;
|
||||
deleteDocument: DocumentNode;
|
||||
createDocument: DocumentNode;
|
||||
updatePost: Post;
|
||||
createPost: Post;
|
||||
};
|
||||
|
||||
|
||||
export type MutationAddPendingDocumentArgs = {
|
||||
collection: Scalars['String']['input'];
|
||||
relativePath: Scalars['String']['input'];
|
||||
template?: InputMaybe<Scalars['String']['input']>;
|
||||
};
|
||||
|
||||
|
||||
export type MutationUpdateDocumentArgs = {
|
||||
collection?: InputMaybe<Scalars['String']['input']>;
|
||||
relativePath: Scalars['String']['input'];
|
||||
params: DocumentUpdateMutation;
|
||||
};
|
||||
|
||||
|
||||
export type MutationDeleteDocumentArgs = {
|
||||
collection?: InputMaybe<Scalars['String']['input']>;
|
||||
relativePath: Scalars['String']['input'];
|
||||
};
|
||||
|
||||
|
||||
export type MutationCreateDocumentArgs = {
|
||||
collection?: InputMaybe<Scalars['String']['input']>;
|
||||
relativePath: Scalars['String']['input'];
|
||||
params: DocumentMutation;
|
||||
};
|
||||
|
||||
|
||||
export type MutationUpdatePostArgs = {
|
||||
relativePath: Scalars['String']['input'];
|
||||
params: PostMutation;
|
||||
};
|
||||
|
||||
|
||||
export type MutationCreatePostArgs = {
|
||||
relativePath: Scalars['String']['input'];
|
||||
params: PostMutation;
|
||||
};
|
||||
|
||||
export type DocumentUpdateMutation = {
|
||||
post?: InputMaybe<PostMutation>;
|
||||
relativePath?: InputMaybe<Scalars['String']['input']>;
|
||||
};
|
||||
|
||||
export type DocumentMutation = {
|
||||
post?: InputMaybe<PostMutation>;
|
||||
};
|
||||
|
||||
export type PostMutation = {
|
||||
title?: InputMaybe<Scalars['String']['input']>;
|
||||
body?: InputMaybe<Scalars['JSON']['input']>;
|
||||
};
|
||||
|
||||
export type PostPartsFragment = { __typename: 'Post', title: string, body?: any | null };
|
||||
|
||||
export type PostQueryVariables = Exact<{
|
||||
relativePath: Scalars['String']['input'];
|
||||
}>;
|
||||
|
||||
|
||||
export type PostQuery = { __typename?: 'Query', post: { __typename: 'Post', id: string, title: string, body?: any | null, _sys: { __typename?: 'SystemInfo', filename: string, basename: string, breadcrumbs: Array<string>, path: string, relativePath: string, extension: string } } };
|
||||
|
||||
export type PostConnectionQueryVariables = Exact<{
|
||||
before?: InputMaybe<Scalars['String']['input']>;
|
||||
after?: InputMaybe<Scalars['String']['input']>;
|
||||
first?: InputMaybe<Scalars['Float']['input']>;
|
||||
last?: InputMaybe<Scalars['Float']['input']>;
|
||||
sort?: InputMaybe<Scalars['String']['input']>;
|
||||
filter?: InputMaybe<PostFilter>;
|
||||
}>;
|
||||
|
||||
|
||||
export type PostConnectionQuery = { __typename?: 'Query', postConnection: { __typename?: 'PostConnection', totalCount: number, pageInfo: { __typename?: 'PageInfo', hasPreviousPage: boolean, hasNextPage: boolean, startCursor: string, endCursor: string }, edges?: Array<{ __typename?: 'PostConnectionEdges', cursor: string, node?: { __typename: 'Post', id: string, title: string, body?: any | null, _sys: { __typename?: 'SystemInfo', filename: string, basename: string, breadcrumbs: Array<string>, path: string, relativePath: string, extension: string } } | null } | null> | null } };
|
||||
|
||||
export const PostPartsFragmentDoc = gql`
|
||||
fragment PostParts on Post {
|
||||
__typename
|
||||
title
|
||||
body
|
||||
}
|
||||
`;
|
||||
export const PostDocument = gql`
|
||||
query post($relativePath: String!) {
|
||||
post(relativePath: $relativePath) {
|
||||
... on Document {
|
||||
_sys {
|
||||
filename
|
||||
basename
|
||||
breadcrumbs
|
||||
path
|
||||
relativePath
|
||||
extension
|
||||
}
|
||||
id
|
||||
}
|
||||
...PostParts
|
||||
}
|
||||
}
|
||||
${PostPartsFragmentDoc}`;
|
||||
export const PostConnectionDocument = gql`
|
||||
query postConnection($before: String, $after: String, $first: Float, $last: Float, $sort: String, $filter: PostFilter) {
|
||||
postConnection(
|
||||
before: $before
|
||||
after: $after
|
||||
first: $first
|
||||
last: $last
|
||||
sort: $sort
|
||||
filter: $filter
|
||||
) {
|
||||
pageInfo {
|
||||
hasPreviousPage
|
||||
hasNextPage
|
||||
startCursor
|
||||
endCursor
|
||||
}
|
||||
totalCount
|
||||
edges {
|
||||
cursor
|
||||
node {
|
||||
... on Document {
|
||||
_sys {
|
||||
filename
|
||||
basename
|
||||
breadcrumbs
|
||||
path
|
||||
relativePath
|
||||
extension
|
||||
}
|
||||
id
|
||||
}
|
||||
...PostParts
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
${PostPartsFragmentDoc}`;
|
||||
export type Requester<C= {}> = <R, V>(doc: DocumentNode, vars?: V, options?: C) => Promise<R>
|
||||
export function getSdk<C>(requester: Requester<C>) {
|
||||
return {
|
||||
post(variables: PostQueryVariables, options?: C): Promise<{data: PostQuery, errors?: { message: string, locations: { line: number, column: number }[], path: string[] }[], variables: PostQueryVariables, query: string}> {
|
||||
return requester<{data: PostQuery, errors?: { message: string, locations: { line: number, column: number }[], path: string[] }[], variables: PostQueryVariables, query: string}, PostQueryVariables>(PostDocument, variables, options);
|
||||
},
|
||||
postConnection(variables?: PostConnectionQueryVariables, options?: C): Promise<{data: PostConnectionQuery, errors?: { message: string, locations: { line: number, column: number }[], path: string[] }[], variables: PostConnectionQueryVariables, query: string}> {
|
||||
return requester<{data: PostConnectionQuery, errors?: { message: string, locations: { line: number, column: number }[], path: string[] }[], variables: PostConnectionQueryVariables, query: string}, PostConnectionQueryVariables>(PostConnectionDocument, variables, options);
|
||||
}
|
||||
};
|
||||
}
|
||||
export type Sdk = ReturnType<typeof getSdk>;
|
||||
|
||||
// TinaSDK generated code
|
||||
import { createClient, TinaClient } from "tinacms/dist/client";
|
||||
|
||||
const generateRequester = (
|
||||
client: TinaClient,
|
||||
options?: { branch?: string }
|
||||
) => {
|
||||
const requester: (
|
||||
doc: any,
|
||||
vars?: any,
|
||||
options?: { branch?: string },
|
||||
client
|
||||
) => Promise<any> = async (doc, vars, options) => {
|
||||
let url = client.apiUrl
|
||||
if (options?.branch) {
|
||||
const index = client.apiUrl.lastIndexOf('/')
|
||||
url = client.apiUrl.substring(0, index + 1) + options.branch
|
||||
}
|
||||
const data = await client.request({
|
||||
query: doc,
|
||||
variables: vars,
|
||||
url,
|
||||
})
|
||||
|
||||
return { data: data?.data, errors: data?.errors, query: doc, variables: vars || {} }
|
||||
}
|
||||
|
||||
return requester
|
||||
}
|
||||
|
||||
/**
|
||||
* @experimental this class can be used but may change in the future
|
||||
**/
|
||||
export const ExperimentalGetTinaClient = () =>
|
||||
getSdk(
|
||||
generateRequester(
|
||||
createClient({
|
||||
url: "https://content.tinajs.io/1.4/content/e4537a30-23f9-4ad7-8a1f-f844a298dff3/github/main",
|
||||
queries,
|
||||
})
|
||||
)
|
||||
)
|
||||
|
||||
export const queries = (
|
||||
client: TinaClient,
|
||||
options?: {
|
||||
branch?: string
|
||||
}
|
||||
) => {
|
||||
const requester = generateRequester(client, options)
|
||||
return getSdk(requester)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user