@comapeo/core-react 0.1.1 → 1.0.0
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 +7 -0
- package/README.md +2 -2
- package/dist/contexts/ClientApi.d.ts +1 -1
- package/dist/contexts/ClientApi.js +1 -1
- package/dist/hooks/client.d.ts +1 -1
- package/dist/hooks/client.js +1 -1
- package/dist/hooks/documents.d.ts +36 -399
- package/dist/hooks/documents.js +39 -30
- package/dist/hooks/maps.d.ts +1 -2
- package/dist/hooks/maps.js +1 -2
- package/dist/hooks/projects.d.ts +22 -32
- package/dist/hooks/projects.js +21 -30
- package/dist/lib/react-query/client.d.ts +1 -1
- package/dist/lib/react-query/client.js +1 -1
- package/dist/lib/react-query/documents.d.ts +28 -19
- package/dist/lib/react-query/documents.js +36 -15
- package/dist/lib/react-query/projects.d.ts +16 -8
- package/dist/lib/react-query/projects.js +12 -5
- package/docs/API.md +25 -27
- package/package.json +5 -5
package/docs/API.md
CHANGED
|
@@ -90,7 +90,7 @@ Parameters:
|
|
|
90
90
|
|
|
91
91
|
| Function | Type |
|
|
92
92
|
| ---------- | ---------- |
|
|
93
|
-
| `getIsArchiveDeviceQueryKey` | `() => readonly ["@comapeo/core-react", "client", "
|
|
93
|
+
| `getIsArchiveDeviceQueryKey` | `() => readonly ["@comapeo/core-react", "client", "is_archive_device"]` |
|
|
94
94
|
|
|
95
95
|
### deviceInfoQueryOptions
|
|
96
96
|
|
|
@@ -177,37 +177,37 @@ function IsArchiveDeviceExample() {
|
|
|
177
177
|
|
|
178
178
|
| Function | Type |
|
|
179
179
|
| ---------- | ---------- |
|
|
180
|
-
| `getManyDocumentsQueryKey` | `<D extends DocumentType>({ projectId, docType,
|
|
180
|
+
| `getManyDocumentsQueryKey` | `<D extends DocumentType>({ projectId, docType, includeDeleted, lang, }: { projectId: string; docType: D; includeDeleted?: boolean or undefined; lang?: string or undefined; }) => readonly ["@comapeo/core-react", "projects", string, D, { ...; }]` |
|
|
181
181
|
|
|
182
182
|
### getDocumentByDocIdQueryKey
|
|
183
183
|
|
|
184
184
|
| Function | Type |
|
|
185
185
|
| ---------- | ---------- |
|
|
186
|
-
| `getDocumentByDocIdQueryKey` | `<D extends DocumentType>({ projectId, docType, docId,
|
|
186
|
+
| `getDocumentByDocIdQueryKey` | `<D extends DocumentType>({ projectId, docType, docId, lang, }: { projectId: string; docType: D; docId: string; lang?: string or undefined; }) => readonly ["@comapeo/core-react", "projects", string, D, string, { readonly lang: string or undefined; }]` |
|
|
187
187
|
|
|
188
188
|
### getDocumentByVersionIdQueryKey
|
|
189
189
|
|
|
190
190
|
| Function | Type |
|
|
191
191
|
| ---------- | ---------- |
|
|
192
|
-
| `getDocumentByVersionIdQueryKey` | `<D extends DocumentType>({ projectId, docType, versionId,
|
|
192
|
+
| `getDocumentByVersionIdQueryKey` | `<D extends DocumentType>({ projectId, docType, versionId, lang, }: { projectId: string; docType: D; versionId: string; lang?: string or undefined; }) => readonly ["@comapeo/core-react", "projects", string, D, string, { readonly lang: string or undefined; }]` |
|
|
193
193
|
|
|
194
194
|
### documentsQueryOptions
|
|
195
195
|
|
|
196
196
|
| Function | Type |
|
|
197
197
|
| ---------- | ---------- |
|
|
198
|
-
| `documentsQueryOptions` | `<D extends DocumentType>({ projectApi, projectId, docType,
|
|
198
|
+
| `documentsQueryOptions` | `<D extends DocumentType>({ projectApi, projectId, docType, includeDeleted, lang, }: { projectApi: ClientApi<MapeoProject>; projectId: string; docType: D; includeDeleted?: boolean or undefined; lang?: string or undefined; }) => OmitKeyof<...> and ... 1 more ... and { ...; }` |
|
|
199
199
|
|
|
200
200
|
### documentByDocumentIdQueryOptions
|
|
201
201
|
|
|
202
202
|
| Function | Type |
|
|
203
203
|
| ---------- | ---------- |
|
|
204
|
-
| `documentByDocumentIdQueryOptions` | `<D extends DocumentType>({ projectApi, projectId, docType, docId,
|
|
204
|
+
| `documentByDocumentIdQueryOptions` | `<D extends DocumentType>({ projectApi, projectId, docType, docId, lang, }: { projectApi: ClientApi<MapeoProject>; projectId: string; docType: D; docId: string; lang?: string or undefined; }) => OmitKeyof<UseQueryOptions<({ schemaName: "track"; ... 9 more ...; deleted: boolean; } and { ...; }) or ({ ...; } and { ...; }) or ...` |
|
|
205
205
|
|
|
206
206
|
### documentByVersionIdQueryOptions
|
|
207
207
|
|
|
208
208
|
| Function | Type |
|
|
209
209
|
| ---------- | ---------- |
|
|
210
|
-
| `documentByVersionIdQueryOptions` | `<D extends DocumentType>({ projectApi, projectId, docType, versionId,
|
|
210
|
+
| `documentByVersionIdQueryOptions` | `<D extends DocumentType>({ projectApi, projectId, docType, versionId, lang, }: { projectApi: ClientApi<MapeoProject>; projectId: string; docType: D; versionId: string; lang?: string or undefined; }) => OmitKeyof<UseQueryOptions<{ schemaName: "track"; ... 9 more ...; deleted: boolean; } or { ...; } or { ...; } or { ...; ...` |
|
|
211
211
|
|
|
212
212
|
### getProjectsQueryKey
|
|
213
213
|
|
|
@@ -249,7 +249,7 @@ function IsArchiveDeviceExample() {
|
|
|
249
249
|
|
|
250
250
|
| Function | Type |
|
|
251
251
|
| ---------- | ---------- |
|
|
252
|
-
| `getIconUrlQueryKey` | `({ projectId, iconId,
|
|
252
|
+
| `getIconUrlQueryKey` | `({ projectId, iconId, ...mimeBasedOpts }: { projectId: string; iconId: string; } and (BitmapOpts or SvgOpts)) => readonly ["@comapeo/core-react", "projects", string, "icons", string, { mimeType: "image/png"; pixelDensity: 2 or ... 1 more ... or 1; size: ValidSizes; } or { ...; }]` |
|
|
253
253
|
|
|
254
254
|
### getDocumentCreatedByQueryKey
|
|
255
255
|
|
|
@@ -303,7 +303,7 @@ function IsArchiveDeviceExample() {
|
|
|
303
303
|
|
|
304
304
|
| Function | Type |
|
|
305
305
|
| ---------- | ---------- |
|
|
306
|
-
| `iconUrlQueryOptions` | `({ projectApi, projectId, iconId,
|
|
306
|
+
| `iconUrlQueryOptions` | `({ projectApi, projectId, iconId, ...mimeBasedOpts }: { projectApi: ClientApi<MapeoProject>; projectId: string; iconId: string; } and (BitmapOpts or SvgOpts)) => OmitKeyof<UseQueryOptions<string, Error, string, QueryKey>, "queryFn"> and { ...; } and { ...; }` |
|
|
307
307
|
|
|
308
308
|
### documentCreatedByQueryOptions
|
|
309
309
|
|
|
@@ -441,13 +441,15 @@ _TODO: Explain bitmap opts vs svg opts_
|
|
|
441
441
|
|
|
442
442
|
| Function | Type |
|
|
443
443
|
| ---------- | ---------- |
|
|
444
|
-
| `useIconUrl` | `({ projectId, iconId,
|
|
444
|
+
| `useIconUrl` | `({ projectId, iconId, ...mimeBasedOpts }: { projectId: string; iconId: string; } and (BitmapOpts or SvgOpts)) => { data: string; error: Error or null; isRefetching: boolean; }` |
|
|
445
445
|
|
|
446
446
|
Parameters:
|
|
447
447
|
|
|
448
448
|
* `opts.projectId`: Project public ID
|
|
449
449
|
* `opts.iconId`: Icon ID of interest
|
|
450
|
-
* `opts.
|
|
450
|
+
* `opts.mimeType`: MIME type of desired resource
|
|
451
|
+
* `opts.pixelDensity`: Pixel density resource (only applicable when `mimeType` is `'image/png'`)
|
|
452
|
+
* `opts.size`: Size of desired resource
|
|
451
453
|
|
|
452
454
|
|
|
453
455
|
Examples:
|
|
@@ -457,11 +459,9 @@ function PngExample() {
|
|
|
457
459
|
const { data } = useIconUrl({
|
|
458
460
|
projectId: '...',
|
|
459
461
|
iconId: '...',
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
size: 'medium'
|
|
464
|
-
}
|
|
462
|
+
mimeType: 'image/png',
|
|
463
|
+
pixelDensity: 1,
|
|
464
|
+
size: 'medium'
|
|
465
465
|
})
|
|
466
466
|
}
|
|
467
467
|
```
|
|
@@ -471,10 +471,8 @@ function SvgExample() {
|
|
|
471
471
|
const { data } = useIconUrl({
|
|
472
472
|
projectId: '...',
|
|
473
473
|
iconId: '...',
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
size: 'medium'
|
|
477
|
-
}
|
|
474
|
+
mimeType: 'image/svg',
|
|
475
|
+
size: 'medium'
|
|
478
476
|
})
|
|
479
477
|
}
|
|
480
478
|
```
|
|
@@ -575,14 +573,14 @@ Triggers the closest error boundary if the document cannot be found
|
|
|
575
573
|
|
|
576
574
|
| Function | Type |
|
|
577
575
|
| ---------- | ---------- |
|
|
578
|
-
| `useSingleDocByDocId` | `<D extends DocumentType>({ projectId, docType, docId,
|
|
576
|
+
| `useSingleDocByDocId` | `<D extends DocumentType>({ projectId, docType, docId, lang, }: { projectId: string; docType: D; docId: string; lang?: string or undefined; }) => ReadHookResult<Extract<{ schemaName: "translation"; docRef: { docId: string; versionId: string; }; docRefType: "track" or ... 7 more ... or "type_unspecified"; ... 10 more ......` |
|
|
579
577
|
|
|
580
578
|
Parameters:
|
|
581
579
|
|
|
582
580
|
* `opts.projectId`: Project public ID
|
|
583
581
|
* `opts.docType`: Document type of interest
|
|
584
582
|
* `opts.docId`: Document ID
|
|
585
|
-
* `opts.
|
|
583
|
+
* `opts.lang`: Language to translate the document into
|
|
586
584
|
|
|
587
585
|
|
|
588
586
|
Examples:
|
|
@@ -608,14 +606,14 @@ Triggers the closest error boundary if the document cannot be found.
|
|
|
608
606
|
|
|
609
607
|
| Function | Type |
|
|
610
608
|
| ---------- | ---------- |
|
|
611
|
-
| `useSingleDocByVersionId` | `<D extends DocumentType>({ projectId, docType, versionId,
|
|
609
|
+
| `useSingleDocByVersionId` | `<D extends DocumentType>({ projectId, docType, versionId, lang, }: { projectId: string; docType: D; versionId: string; lang?: string or undefined; }) => ReadHookResult<Extract<{ schemaName: "translation"; docRef: { docId: string; versionId: string; }; docRefType: "track" or ... 7 more ... or "type_unspecified"; ... 10 ...` |
|
|
612
610
|
|
|
613
611
|
Parameters:
|
|
614
612
|
|
|
615
613
|
* `opts.projectId`: Project public ID
|
|
616
614
|
* `opts.docType`: Document type of interest
|
|
617
615
|
* `opts.versionId`: Document's version ID
|
|
618
|
-
* `opts.
|
|
616
|
+
* `opts.lang`: Language to translate the document into
|
|
619
617
|
|
|
620
618
|
*
|
|
621
619
|
|
|
@@ -641,14 +639,14 @@ Retrieve all documents of a specific `docType`.
|
|
|
641
639
|
|
|
642
640
|
| Function | Type |
|
|
643
641
|
| ---------- | ---------- |
|
|
644
|
-
| `useManyDocs` | `<D extends DocumentType>({ projectId, docType,
|
|
642
|
+
| `useManyDocs` | `<D extends DocumentType>({ projectId, docType, includeDeleted, lang, }: { projectId: string; docType: D; includeDeleted?: boolean or undefined; lang?: string or undefined; }) => ReadHookResult<Extract<{ schemaName: "translation"; docRef: { docId: string; versionId: string; }; ... 11 more ...; deleted: boolean; }, { .....` |
|
|
645
643
|
|
|
646
644
|
Parameters:
|
|
647
645
|
|
|
648
646
|
* `opts.projectId`: Project public ID
|
|
649
647
|
* `opts.docType`: Document type of interest
|
|
650
|
-
* `opts.
|
|
651
|
-
* `opts.
|
|
648
|
+
* `opts.includeDeleted`: Include documents that have been marked as deleted
|
|
649
|
+
* `opts.lang`: Language to translate the documents into
|
|
652
650
|
|
|
653
651
|
|
|
654
652
|
Examples:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@comapeo/core-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "React wrapper for working with @comapeo/core",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@eslint/compat": "^1.2.4",
|
|
55
|
-
"@eslint/js": "^9.
|
|
55
|
+
"@eslint/js": "^9.17.0",
|
|
56
56
|
"@ianvs/prettier-plugin-sort-imports": "^4.4.0",
|
|
57
57
|
"@mapeo/crypto": "^1.0.0-alpha.10",
|
|
58
58
|
"@tanstack/eslint-plugin-query": "^5.62.1",
|
|
@@ -63,18 +63,18 @@
|
|
|
63
63
|
"@types/react": "^19.0.1",
|
|
64
64
|
"@types/react-dom": "^19.0.2",
|
|
65
65
|
"commit-and-tag-version": "^12.5.0",
|
|
66
|
-
"eslint": "^9.
|
|
66
|
+
"eslint": "^9.17.0",
|
|
67
67
|
"fastify": "^4.29.0",
|
|
68
68
|
"globals": "^15.13.0",
|
|
69
69
|
"husky": "^9.1.7",
|
|
70
70
|
"lint-staged": "^15.2.11",
|
|
71
|
-
"npm-run-all2": "^7.0.
|
|
71
|
+
"npm-run-all2": "^7.0.2",
|
|
72
72
|
"prettier": "^3.4.2",
|
|
73
73
|
"random-access-memory": "^6.2.1",
|
|
74
74
|
"rimraf": "^6.0.1",
|
|
75
75
|
"tsdoc-markdown": "^1.0.0",
|
|
76
76
|
"typescript": "^5.7.2",
|
|
77
|
-
"typescript-eslint": "^8.18.
|
|
77
|
+
"typescript-eslint": "^8.18.1",
|
|
78
78
|
"vitest": "^2.1.8"
|
|
79
79
|
}
|
|
80
80
|
}
|