@tinacms/graphql 0.59.8 → 0.59.11
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 +62 -0
- package/dist/builder/index.d.ts +14 -0
- package/dist/database/bridge/index.d.ts +1 -0
- package/dist/database/index.d.ts +30 -3
- package/dist/index.d.ts +2 -1
- package/dist/index.js +477 -189
- package/dist/mdx/parse.d.ts +1 -0
- package/dist/resolver/filter-utils.d.ts +22 -0
- package/dist/resolver/index.d.ts +19 -10
- package/dist/spec/setup.d.ts +1 -1
- package/dist/types.d.ts +8 -0
- package/package.json +4 -4
- package/dist/database/store/index.d.ts +0 -72
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,67 @@
|
|
|
1
1
|
# tina-graphql
|
|
2
2
|
|
|
3
|
+
## 0.59.11
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 4da32454b: Modify database to write config json files without whitespace to reduce file sizes
|
|
8
|
+
- 921709a7e: Adds validation to the schema instead of only using typescript types
|
|
9
|
+
- 558cc4368: Make schema init platform-aware and refactor database put requests
|
|
10
|
+
- 06666d39f: Link to MDX documentation when unregistered component error occurs
|
|
11
|
+
- 3e2d9e43a: Adds new GraphQL `deleteDocument` mutation and logic
|
|
12
|
+
- Updated dependencies [a2906d6fe]
|
|
13
|
+
- Updated dependencies [3e2d9e43a]
|
|
14
|
+
- @tinacms/datalayer@0.1.1
|
|
15
|
+
|
|
16
|
+
## 0.59.10
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- cf33bcec1: Fix issue where store.clear() was not being awaited causing an invalid state after reindex
|
|
21
|
+
|
|
22
|
+
## 0.59.9
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- 82174ff50: Modify Database.indexContentByPaths to not require collection parameter
|
|
27
|
+
- a87e1e6fa: Enable query filtering, pagination, sorting
|
|
28
|
+
- abf25c673: The schema can now to used on the frontend (optional for now but will be the main path moving forward).
|
|
29
|
+
|
|
30
|
+
### How to migrate.
|
|
31
|
+
|
|
32
|
+
If you gone though the `tinacms init` process there should be a file called `.tina/components/TinaProvider`. In that file you can import the schema from `schema.ts` and add it to the TinaCMS wrapper component.
|
|
33
|
+
|
|
34
|
+
```tsx
|
|
35
|
+
import TinaCMS from 'tinacms'
|
|
36
|
+
import schema, { tinaConfig } from '../schema.ts'
|
|
37
|
+
|
|
38
|
+
// Importing the TinaProvider directly into your page will cause Tina to be added to the production bundle.
|
|
39
|
+
// Instead, import the tina/provider/index default export to have it dynamially imported in edit-moode
|
|
40
|
+
/**
|
|
41
|
+
*
|
|
42
|
+
* @private Do not import this directly, please import the dynamic provider instead
|
|
43
|
+
*/
|
|
44
|
+
const TinaProvider = ({ children }) => {
|
|
45
|
+
return (
|
|
46
|
+
<TinaCMS {...tinaConfig} schema={schema}>
|
|
47
|
+
{children}
|
|
48
|
+
</TinaCMS>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export default TinaProvider
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
- 591640db0: Fixes a bug with `breadcrumbs` to account for subfolders (instead of just the `filename`) and allows Documents to be created and updated within subfolders.
|
|
56
|
+
|
|
57
|
+
Before this fix, `breadcrumbs` was only the `basename` of the file minus the `extension`. So `my-folder-a/my-folder-b/my-file.md` would have `breadcrumbs` of `['my-file']`. With this change, `breadcrumbs` will be `['my-folder-a','my-folder-b','my-file']` (leaving out the `content/<collection>`).
|
|
58
|
+
|
|
59
|
+
- e8b0de1f7: Add `parentTypename` to fields to allow us to disambiguate between fields which have the same field names but different types. Example, an event from field name of `blocks.0.title` could belong to a `Cta` block or a `Hero` block, both of which have a `title` field.
|
|
60
|
+
- Updated dependencies [8b3be903f]
|
|
61
|
+
- Updated dependencies [a87e1e6fa]
|
|
62
|
+
- Updated dependencies [b01f2e382]
|
|
63
|
+
- @tinacms/datalayer@0.1.0
|
|
64
|
+
|
|
3
65
|
## 0.59.8
|
|
4
66
|
|
|
5
67
|
### Patch Changes
|
package/dist/builder/index.d.ts
CHANGED
|
@@ -138,6 +138,20 @@ export declare class Builder {
|
|
|
138
138
|
* @param collections
|
|
139
139
|
*/
|
|
140
140
|
buildUpdateCollectionDocumentMutation: (collections: TinaCloudCollectionEnriched[]) => Promise<import("graphql").FieldDefinitionNode>;
|
|
141
|
+
/**
|
|
142
|
+
* ```graphql
|
|
143
|
+
* # ex.
|
|
144
|
+
* {
|
|
145
|
+
* deleteDocument(relativePath: $relativePath, params: $params) {
|
|
146
|
+
* id
|
|
147
|
+
* data {...}
|
|
148
|
+
* }
|
|
149
|
+
* }
|
|
150
|
+
* ```
|
|
151
|
+
*
|
|
152
|
+
* @param collections
|
|
153
|
+
*/
|
|
154
|
+
buildDeleteCollectionDocumentMutation: (collections: TinaCloudCollectionEnriched[]) => Promise<import("graphql").FieldDefinitionNode>;
|
|
141
155
|
/**
|
|
142
156
|
* ```graphql
|
|
143
157
|
* # ex.
|
|
@@ -15,6 +15,7 @@ export interface Bridge {
|
|
|
15
15
|
glob(pattern: string): Promise<string[]>;
|
|
16
16
|
get(filepath: string): Promise<string>;
|
|
17
17
|
put(filepath: string, data: string): Promise<void>;
|
|
18
|
+
delete(filepath: string): Promise<void>;
|
|
18
19
|
/**
|
|
19
20
|
* Whether this bridge supports the ability to build the schema.
|
|
20
21
|
*/
|
package/dist/database/index.d.ts
CHANGED
|
@@ -10,32 +10,45 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
10
10
|
See the License for the specific language governing permissions and
|
|
11
11
|
limitations under the License.
|
|
12
12
|
*/
|
|
13
|
+
import type { BinaryFilter, IndexDefinition, Store, TernaryFilter } from '@tinacms/datalayer';
|
|
13
14
|
import type { DocumentNode } from 'graphql';
|
|
14
15
|
import type { TinaSchema } from '../schema';
|
|
15
16
|
import type { TinaCloudSchemaBase } from '../types';
|
|
16
|
-
import type { Store } from './store';
|
|
17
17
|
import type { Bridge } from './bridge';
|
|
18
18
|
declare type CreateDatabase = {
|
|
19
19
|
bridge: Bridge;
|
|
20
20
|
store: Store;
|
|
21
21
|
};
|
|
22
22
|
export declare const createDatabase: (config: CreateDatabase) => Promise<Database>;
|
|
23
|
+
/** Options for {@link Database.query} **/
|
|
24
|
+
export declare type QueryOptions = {
|
|
25
|
+
collection: string;
|
|
26
|
+
filterChain?: (BinaryFilter | TernaryFilter)[];
|
|
27
|
+
sort?: string;
|
|
28
|
+
first?: number;
|
|
29
|
+
last?: number;
|
|
30
|
+
after?: string;
|
|
31
|
+
before?: string;
|
|
32
|
+
};
|
|
23
33
|
export declare class Database {
|
|
24
34
|
config: CreateDatabase;
|
|
25
35
|
bridge: Bridge;
|
|
26
36
|
store: Store;
|
|
27
37
|
private tinaSchema;
|
|
38
|
+
private collectionIndexDefinitions;
|
|
28
39
|
private _lookup;
|
|
29
40
|
private _graphql;
|
|
30
41
|
private _tinaSchema;
|
|
31
42
|
constructor(config: CreateDatabase);
|
|
43
|
+
private collectionForPath;
|
|
44
|
+
private partitionPathsByCollection;
|
|
32
45
|
get: <T extends object>(filepath: string) => Promise<T>;
|
|
33
46
|
addPendingDocument: (filepath: string, data: {
|
|
34
47
|
[key: string]: unknown;
|
|
35
48
|
}) => Promise<void>;
|
|
36
49
|
put: (filepath: string, data: {
|
|
37
50
|
[key: string]: unknown;
|
|
38
|
-
}) => Promise<boolean>;
|
|
51
|
+
}, collection?: string) => Promise<boolean>;
|
|
39
52
|
stringifyFile: (filepath: string, data: {
|
|
40
53
|
[key: string]: unknown;
|
|
41
54
|
}) => Promise<{
|
|
@@ -51,8 +64,20 @@ export declare class Database {
|
|
|
51
64
|
getGraphQLSchemaFromBridge: () => Promise<DocumentNode>;
|
|
52
65
|
getTinaSchema: () => Promise<TinaCloudSchemaBase>;
|
|
53
66
|
getSchema: () => Promise<TinaSchema>;
|
|
67
|
+
getIndexDefinitions: () => Promise<Record<string, Record<string, IndexDefinition>>>;
|
|
54
68
|
documentExists: (fullpath: unknown) => Promise<boolean>;
|
|
55
|
-
query: (
|
|
69
|
+
query: (queryOptions: QueryOptions, hydrator: any) => Promise<{
|
|
70
|
+
edges: {
|
|
71
|
+
node: any;
|
|
72
|
+
cursor: string;
|
|
73
|
+
}[];
|
|
74
|
+
pageInfo: {
|
|
75
|
+
hasPreviousPage: boolean;
|
|
76
|
+
hasNextPage: boolean;
|
|
77
|
+
startCursor: string;
|
|
78
|
+
endCursor: string;
|
|
79
|
+
};
|
|
80
|
+
}>;
|
|
56
81
|
putConfigFiles: ({ graphQLSchema, tinaSchema, }: {
|
|
57
82
|
graphQLSchema: DocumentNode;
|
|
58
83
|
tinaSchema: TinaSchema;
|
|
@@ -61,7 +86,9 @@ export declare class Database {
|
|
|
61
86
|
graphQLSchema: DocumentNode;
|
|
62
87
|
tinaSchema: TinaSchema;
|
|
63
88
|
}) => Promise<void>;
|
|
89
|
+
deleteContentByPaths: (documentPaths: string[]) => Promise<void>;
|
|
64
90
|
indexContentByPaths: (documentPaths: string[]) => Promise<void>;
|
|
91
|
+
delete: (filepath: string) => Promise<void>;
|
|
65
92
|
_indexAllContent: () => Promise<void>;
|
|
66
93
|
addToLookupMap: (lookup: LookupMapType) => Promise<void>;
|
|
67
94
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -13,9 +13,10 @@ limitations under the License.
|
|
|
13
13
|
export { indexDB } from './build';
|
|
14
14
|
export { resolve } from './resolve';
|
|
15
15
|
export { createDatabase } from './database';
|
|
16
|
+
export type { QueryOptions } from './database';
|
|
16
17
|
import type { Database } from './database';
|
|
17
18
|
export type { Database } from './database';
|
|
18
|
-
export type { Store } from '
|
|
19
|
+
export type { Store } from '@tinacms/datalayer';
|
|
19
20
|
export type { Bridge } from './database/bridge';
|
|
20
21
|
export { sequential, assertShape } from './util';
|
|
21
22
|
export { stringifyFile, parseFile } from './database/util';
|