tinacms 1.5.10 → 1.5.12

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.
@@ -3,6 +3,7 @@ import { BranchData, EventBus } from '@tinacms/toolkit';
3
3
  import { DocumentNode, GraphQLSchema } from 'graphql';
4
4
  import gql from 'graphql-tag';
5
5
  import { TinaSchema, Schema } from '@tinacms/schema-tools';
6
+ import { TinaCloudProject } from './types';
6
7
  import { SearchClient } from '@tinacms/search/dist/index-client';
7
8
  export declare type OnLoginFunc = (args: {
8
9
  token: TokenObject;
@@ -121,10 +122,12 @@ export declare class Client {
121
122
  tinaGraphQLVersion: string;
122
123
  setToken: (_token: TokenObject) => void;
123
124
  private getToken;
124
- private token;
125
- private branch;
125
+ token: string;
126
+ branch: string;
126
127
  private options;
127
128
  events: EventBus;
129
+ protectedBranches: string[];
130
+ usingEditorialWorkflow: boolean;
128
131
  constructor({ tokenStorage, ...options }: ServerOptions);
129
132
  get isLocalMode(): boolean;
130
133
  setBranch(branchName: string): void;
@@ -167,6 +170,12 @@ export declare class Client {
167
170
  }): Promise<{
168
171
  assetsSyncing: string[];
169
172
  }>;
173
+ getProject(): Promise<TinaCloudProject>;
174
+ createPullRequest({ baseBranch, branch, title, }: {
175
+ baseBranch: string;
176
+ branch: string;
177
+ title: string;
178
+ }): Promise<any>;
170
179
  fetchEvents(limit?: number, cursor?: string): Promise<{
171
180
  events: {
172
181
  message: string;
@@ -178,7 +187,6 @@ export declare class Client {
178
187
  cursor?: string;
179
188
  }>;
180
189
  parseJwt(token: any): any;
181
- getProject(): Promise<any>;
182
190
  getRefreshedToken(tokens: string): Promise<TokenObject>;
183
191
  isAuthorized(): Promise<boolean>;
184
192
  isAuthenticated(): Promise<boolean>;
@@ -202,22 +210,21 @@ export declare class Client {
202
210
  }>;
203
211
  waitForIndexStatus({ ref }: {
204
212
  ref: string;
205
- }): (Promise<any> | (() => void))[] | {
206
- status: string;
207
- };
213
+ }): (Promise<any> | (() => void))[];
208
214
  getIndexStatus({ ref }: {
209
215
  ref: string;
210
216
  }): Promise<{
211
217
  status?: "unknown" | "complete" | "failed" | "inprogress";
212
218
  timestamp?: number;
213
219
  }>;
214
- listBranches(): Promise<{
215
- indexStatus: {
216
- status?: "unknown" | "complete" | "failed" | "inprogress";
217
- timestamp?: number;
218
- };
220
+ listBranches(args?: {
221
+ includeIndexStatus?: boolean;
222
+ }): Promise<{
219
223
  name?: string;
224
+ protected?: boolean;
225
+ githubPullRequestUrl?: string;
220
226
  }[]>;
227
+ usingProtectedBranch(): boolean;
221
228
  createBranch({ baseBranch, branchName }: BranchData): Promise<string>;
222
229
  }
223
230
  export declare const DEFAULT_LOCAL_TINA_GQL_SERVER_URL = "http://localhost:4001/graphql";
@@ -0,0 +1,52 @@
1
+ export interface TinaCloudProject {
2
+ tokens: Token[];
3
+ orgId: string;
4
+ id: string;
5
+ name: string;
6
+ repoUrl: string;
7
+ installationId: number;
8
+ hookId: string;
9
+ siteUrl: string;
10
+ pathToTina: string;
11
+ dateCreated: number;
12
+ dateUpdated: number;
13
+ metadata: Metadata;
14
+ defaultBranch?: string;
15
+ accessDisabled?: boolean;
16
+ indexVersion?: string;
17
+ mediaBranch?: string;
18
+ role: string;
19
+ protectedBranches: string[];
20
+ features?: string[];
21
+ }
22
+ export interface Token {
23
+ token: string;
24
+ name: string;
25
+ branches: string[];
26
+ repoURL: string;
27
+ lastUsed: number;
28
+ }
29
+ export interface Metadata {
30
+ [key: string]: MetaDataBranch;
31
+ }
32
+ export interface MetaDataBranch {
33
+ tinaVersion: TinaVersion;
34
+ tinaMeta: TinaMeta;
35
+ tinaLockVersion: string;
36
+ }
37
+ export interface TinaVersion {
38
+ fullVersion: string;
39
+ major: string;
40
+ minor: string;
41
+ patch: string;
42
+ }
43
+ export interface TinaMeta {
44
+ flags: string[];
45
+ media: {
46
+ tina: TinaMedia;
47
+ };
48
+ }
49
+ export interface TinaMedia {
50
+ publicFolder: string;
51
+ mediaRoot: string;
52
+ }
package/dist/react.d.ts CHANGED
@@ -19,7 +19,7 @@ export declare const tinaField: <T extends object & {
19
19
  queryId: string;
20
20
  path: (number | string)[];
21
21
  };
22
- }>(object: T, property?: Exclude<keyof T, "__typename" | "_sys">, index?: number) => string;
22
+ }>(object: T, property?: Exclude<keyof NonNullable<T>, "__typename" | "_sys">, index?: number) => string;
23
23
  export declare const addMetadata: <T extends object>(id: string, object: T & {
24
24
  type?: string;
25
25
  _content_source?: unknown;
package/dist/react.es.js CHANGED
@@ -124,6 +124,9 @@ function useEditState() {
124
124
  }
125
125
  const tinaField = (object, property, index) => {
126
126
  var _a, _b, _c;
127
+ if (!object) {
128
+ return "";
129
+ }
127
130
  if (object._content_source) {
128
131
  if (!property) {
129
132
  return [
package/dist/react.js CHANGED
@@ -131,6 +131,9 @@
131
131
  }
132
132
  const tinaField = (object, property, index) => {
133
133
  var _a, _b, _c;
134
+ if (!object) {
135
+ return "";
136
+ }
134
137
  if (object._content_source) {
135
138
  if (!property) {
136
139
  return [