tinacms 0.68.4 → 0.68.7
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 +34 -0
- package/dist/admin/api.d.ts +8 -10
- package/dist/admin/components/GetCollection.d.ts +3 -2
- package/dist/admin/types.d.ts +7 -0
- package/dist/client.es.js +39 -4
- package/dist/client.js +41 -5
- package/dist/index.es.js +583 -249
- package/dist/index.js +371 -38
- package/dist/style.css +90 -9
- package/dist/tina-cms.d.ts +1 -1
- package/dist/unifiedClient/index.d.ts +18 -5
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# tinacms
|
|
2
2
|
|
|
3
|
+
## 0.68.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- aaaa5bb09: Added pagination to the CMS
|
|
8
|
+
- e06dbb3ca: Adds `waitForDB` cmd to cli
|
|
9
|
+
- Updated dependencies [aaaa5bb09]
|
|
10
|
+
- @tinacms/toolkit@0.56.30
|
|
11
|
+
|
|
12
|
+
## 0.68.6
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- 2cc206b1a: Improve mobile nav behaviour
|
|
17
|
+
- 8998df207: fix: update tina client with the current branch from local storage
|
|
18
|
+
- Updated dependencies [58a7a00f7]
|
|
19
|
+
- Updated dependencies [2cc206b1a]
|
|
20
|
+
- Updated dependencies [aaadefd2d]
|
|
21
|
+
- @tinacms/toolkit@0.56.29
|
|
22
|
+
|
|
23
|
+
## 0.68.5
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- 646cad8da: Adds support for using the generated client on the frontend
|
|
28
|
+
- f857616f6: Rename sdk to queries
|
|
29
|
+
- 6e2ed31a2: Added `isTitle` property to the schema that allows the title to be displayed in the CMS
|
|
30
|
+
- Updated dependencies [a196198bd]
|
|
31
|
+
- Updated dependencies [57a4a3789]
|
|
32
|
+
- Updated dependencies [6e2ed31a2]
|
|
33
|
+
- Updated dependencies [ba1499029]
|
|
34
|
+
- @tinacms/toolkit@0.56.28
|
|
35
|
+
- @tinacms/schema-tools@0.0.4
|
|
36
|
+
|
|
3
37
|
## 0.68.4
|
|
4
38
|
|
|
5
39
|
### Patch Changes
|
package/dist/admin/api.d.ts
CHANGED
|
@@ -11,15 +11,13 @@ See the License for the specific language governing permissions and
|
|
|
11
11
|
limitations under the License.
|
|
12
12
|
*/
|
|
13
13
|
import type { TinaCMS } from '@tinacms/toolkit';
|
|
14
|
+
import type { TinaSchema } from '@tinacms/schema-tools';
|
|
15
|
+
import type { Client } from '../internalClient';
|
|
14
16
|
import type { Collection, DocumentForm } from './types';
|
|
15
17
|
export declare class TinaAdminApi {
|
|
16
|
-
api:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}) => any;
|
|
20
|
-
isAuthenticated: () => boolean;
|
|
21
|
-
};
|
|
22
|
-
schema: any;
|
|
18
|
+
api: Client;
|
|
19
|
+
useDataLayer: boolean;
|
|
20
|
+
schema: TinaSchema;
|
|
23
21
|
constructor(cms: TinaCMS);
|
|
24
22
|
isAuthenticated(): Promise<boolean>;
|
|
25
23
|
fetchCollections(): Promise<Collection[]>;
|
|
@@ -27,10 +25,10 @@ export declare class TinaAdminApi {
|
|
|
27
25
|
collection: string;
|
|
28
26
|
relativePath: string;
|
|
29
27
|
}): Promise<void>;
|
|
30
|
-
fetchCollection(collectionName: string, includeDocuments: boolean): Promise<Collection>;
|
|
28
|
+
fetchCollection(collectionName: string, includeDocuments: boolean, after?: string): Promise<Collection>;
|
|
31
29
|
fetchDocument(collectionName: string, relativePath: string): Promise<{
|
|
32
30
|
document: DocumentForm;
|
|
33
31
|
}>;
|
|
34
|
-
createDocument(collectionName: string, relativePath: string, params: Object): Promise<
|
|
35
|
-
updateDocument(collectionName: string, relativePath: string, params: Object): Promise<
|
|
32
|
+
createDocument(collectionName: string, relativePath: string, params: Object): Promise<unknown>;
|
|
33
|
+
updateDocument(collectionName: string, relativePath: string, params: Object): Promise<unknown>;
|
|
36
34
|
}
|
|
@@ -12,16 +12,17 @@ limitations under the License.
|
|
|
12
12
|
*/
|
|
13
13
|
import type { TinaCMS } from '@tinacms/toolkit';
|
|
14
14
|
import type { Collection } from '../types';
|
|
15
|
-
export declare const useGetCollection: (cms: TinaCMS, collectionName: string, includeDocuments?: boolean) => {
|
|
15
|
+
export declare const useGetCollection: (cms: TinaCMS, collectionName: string, includeDocuments?: boolean, after?: string) => {
|
|
16
16
|
collection: Collection;
|
|
17
17
|
loading: boolean;
|
|
18
18
|
error: Error;
|
|
19
19
|
reFetchCollection: () => void;
|
|
20
20
|
};
|
|
21
|
-
declare const GetCollection: ({ cms, collectionName, includeDocuments, children, }: {
|
|
21
|
+
declare const GetCollection: ({ cms, collectionName, includeDocuments, startCursor, children, }: {
|
|
22
22
|
cms: TinaCMS;
|
|
23
23
|
collectionName: string;
|
|
24
24
|
includeDocuments?: boolean;
|
|
25
|
+
startCursor?: string;
|
|
25
26
|
children: any;
|
|
26
27
|
}) => JSX.Element;
|
|
27
28
|
export default GetCollection;
|
package/dist/admin/types.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ export interface DocumentNode {
|
|
|
25
25
|
relativePath: string;
|
|
26
26
|
filename: string;
|
|
27
27
|
extension: string;
|
|
28
|
+
title?: string;
|
|
28
29
|
};
|
|
29
30
|
};
|
|
30
31
|
}
|
|
@@ -50,6 +51,12 @@ export interface Collection {
|
|
|
50
51
|
templates?: Template[];
|
|
51
52
|
documents?: {
|
|
52
53
|
totalCount?: number;
|
|
54
|
+
pageInfo: {
|
|
55
|
+
hasPreviousPage: boolean;
|
|
56
|
+
hasNextPage: boolean;
|
|
57
|
+
startCursor?: string;
|
|
58
|
+
endCursor?: string;
|
|
59
|
+
};
|
|
53
60
|
edges?: DocumentNode[];
|
|
54
61
|
};
|
|
55
62
|
}
|
package/dist/client.es.js
CHANGED
|
@@ -1,9 +1,44 @@
|
|
|
1
1
|
import fetchPonyfill from "fetch-ponyfill";
|
|
2
|
+
import UrlPattern from "url-pattern";
|
|
2
3
|
const { fetch, Headers } = fetchPonyfill();
|
|
4
|
+
const TINA_HOST = "content.tinajs.io";
|
|
3
5
|
class TinaClient {
|
|
4
|
-
constructor({ token, url }) {
|
|
6
|
+
constructor({ token, url, queries }) {
|
|
7
|
+
this.parseURL = (overrideUrl) => {
|
|
8
|
+
const url2 = overrideUrl || this.apiUrl;
|
|
9
|
+
if (url2.includes("localhost")) {
|
|
10
|
+
return {
|
|
11
|
+
host: "localhost",
|
|
12
|
+
branch: null,
|
|
13
|
+
isLocalClient: true,
|
|
14
|
+
clientId: null
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
const params = new URL(url2);
|
|
18
|
+
const pattern = new UrlPattern("/content/:clientId/github/*", {
|
|
19
|
+
escapeChar: " "
|
|
20
|
+
});
|
|
21
|
+
const result = pattern.match(params.pathname);
|
|
22
|
+
const branch = result == null ? void 0 : result._;
|
|
23
|
+
const clientId = result == null ? void 0 : result.clientId;
|
|
24
|
+
if (!branch || !clientId) {
|
|
25
|
+
throw new Error(`Invalid URL format provided. Expected: https://${TINA_HOST}/content/<ClientID>/github/<Branch> but but received ${url2}`);
|
|
26
|
+
}
|
|
27
|
+
if (params.host !== TINA_HOST) {
|
|
28
|
+
throw new Error(`The only supported hosts are ${TINA_HOST} or localhost, but received ${params.host}.`);
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
host: params.host,
|
|
32
|
+
clientId,
|
|
33
|
+
branch,
|
|
34
|
+
isLocalClient: false
|
|
35
|
+
};
|
|
36
|
+
};
|
|
5
37
|
this.apiUrl = url;
|
|
6
38
|
this.readonlyToken = token;
|
|
39
|
+
if (queries) {
|
|
40
|
+
this.queries = queries(this);
|
|
41
|
+
}
|
|
7
42
|
}
|
|
8
43
|
async request(args) {
|
|
9
44
|
const headers = new Headers();
|
|
@@ -33,8 +68,8 @@ class TinaClient {
|
|
|
33
68
|
};
|
|
34
69
|
}
|
|
35
70
|
}
|
|
36
|
-
|
|
71
|
+
function createClient(args) {
|
|
37
72
|
const client = new TinaClient(args);
|
|
38
73
|
return client;
|
|
39
|
-
}
|
|
40
|
-
export { TinaClient, createClient };
|
|
74
|
+
}
|
|
75
|
+
export { TINA_HOST, TinaClient, createClient };
|
package/dist/client.js
CHANGED
|
@@ -1,16 +1,51 @@
|
|
|
1
1
|
(function(global, factory) {
|
|
2
|
-
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("fetch-ponyfill")) : typeof define === "function" && define.amd ? define(["exports", "fetch-ponyfill"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.tinacms = {}, global.NOOP));
|
|
3
|
-
})(this, function(exports2, fetchPonyfill) {
|
|
2
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("fetch-ponyfill"), require("url-pattern")) : typeof define === "function" && define.amd ? define(["exports", "fetch-ponyfill", "url-pattern"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.tinacms = {}, global.NOOP, global.NOOP));
|
|
3
|
+
})(this, function(exports2, fetchPonyfill, UrlPattern) {
|
|
4
4
|
"use strict";
|
|
5
5
|
function _interopDefaultLegacy(e) {
|
|
6
6
|
return e && typeof e === "object" && "default" in e ? e : { "default": e };
|
|
7
7
|
}
|
|
8
8
|
var fetchPonyfill__default = /* @__PURE__ */ _interopDefaultLegacy(fetchPonyfill);
|
|
9
|
+
var UrlPattern__default = /* @__PURE__ */ _interopDefaultLegacy(UrlPattern);
|
|
9
10
|
const { fetch, Headers } = fetchPonyfill__default["default"]();
|
|
11
|
+
const TINA_HOST = "content.tinajs.io";
|
|
10
12
|
class TinaClient {
|
|
11
|
-
constructor({ token, url }) {
|
|
13
|
+
constructor({ token, url, queries }) {
|
|
14
|
+
this.parseURL = (overrideUrl) => {
|
|
15
|
+
const url2 = overrideUrl || this.apiUrl;
|
|
16
|
+
if (url2.includes("localhost")) {
|
|
17
|
+
return {
|
|
18
|
+
host: "localhost",
|
|
19
|
+
branch: null,
|
|
20
|
+
isLocalClient: true,
|
|
21
|
+
clientId: null
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
const params = new URL(url2);
|
|
25
|
+
const pattern = new UrlPattern__default["default"]("/content/:clientId/github/*", {
|
|
26
|
+
escapeChar: " "
|
|
27
|
+
});
|
|
28
|
+
const result = pattern.match(params.pathname);
|
|
29
|
+
const branch = result == null ? void 0 : result._;
|
|
30
|
+
const clientId = result == null ? void 0 : result.clientId;
|
|
31
|
+
if (!branch || !clientId) {
|
|
32
|
+
throw new Error(`Invalid URL format provided. Expected: https://${TINA_HOST}/content/<ClientID>/github/<Branch> but but received ${url2}`);
|
|
33
|
+
}
|
|
34
|
+
if (params.host !== TINA_HOST) {
|
|
35
|
+
throw new Error(`The only supported hosts are ${TINA_HOST} or localhost, but received ${params.host}.`);
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
host: params.host,
|
|
39
|
+
clientId,
|
|
40
|
+
branch,
|
|
41
|
+
isLocalClient: false
|
|
42
|
+
};
|
|
43
|
+
};
|
|
12
44
|
this.apiUrl = url;
|
|
13
45
|
this.readonlyToken = token;
|
|
46
|
+
if (queries) {
|
|
47
|
+
this.queries = queries(this);
|
|
48
|
+
}
|
|
14
49
|
}
|
|
15
50
|
async request(args) {
|
|
16
51
|
const headers = new Headers();
|
|
@@ -40,10 +75,11 @@
|
|
|
40
75
|
};
|
|
41
76
|
}
|
|
42
77
|
}
|
|
43
|
-
|
|
78
|
+
function createClient(args) {
|
|
44
79
|
const client = new TinaClient(args);
|
|
45
80
|
return client;
|
|
46
|
-
}
|
|
81
|
+
}
|
|
82
|
+
exports2.TINA_HOST = TINA_HOST;
|
|
47
83
|
exports2.TinaClient = TinaClient;
|
|
48
84
|
exports2.createClient = createClient;
|
|
49
85
|
Object.defineProperty(exports2, "__esModule", { value: true });
|