@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/docs/API.md CHANGED
@@ -90,7 +90,7 @@ Parameters:
90
90
 
91
91
  | Function | Type |
92
92
  | ---------- | ---------- |
93
- | `getIsArchiveDeviceQueryKey` | `() => readonly ["@comapeo/core-react", "client", "is_remote_archive"]` |
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, opts, }: { projectId: string; docType: D; opts?: Parameters<ClientApi<MapeoProject>[D]["getMany"]>[0] or undefined; }) => readonly [...]` |
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, opts, }: { projectId: string; docType: D; docId: Parameters<ClientApi<MapeoProject>[D]["getByDocId"]>[0]; opts?: Parameters<ClientApi<MapeoProject>[D]["getByDocId"]>[1] or undefined; }) => readonly [...]` |
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, opts, }: { projectId: string; docType: D; versionId: Parameters<ClientApi<MapeoProject>[D]["getByVersionId"]>[0]; opts?: Parameters<ClientApi<...>[D]["getByVersionId"]>[1] or undefined; }) => readonly [...]` |
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, opts, }: { projectApi: ClientApi<MapeoProject>; projectId: string; docType: D; opts?: Parameters<ClientApi<MapeoProject>[D]["getMany"]>[0] or undefined; }) => OmitKeyof<...> and ... 1 more ... and { ...; }` |
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, opts, }: { projectApi: ClientApi<MapeoProject>; projectId: string; docType: D; docId: Parameters<ClientApi<MapeoProject>[D]["getByDocId"]>[0]; opts?: Omit<...> or undefined; }) => OmitKeyof<...> and ... 1 more ... and { ...; }` |
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, opts, }: { projectApi: ClientApi<MapeoProject>; projectId: string; docType: D; versionId: Parameters<ClientApi<MapeoProject>[D]["getByVersionId"]>[0]; opts?: Parameters<...>[1] or undefined; }) => OmitKeyof<...> and ... 1 more ... and { ...; }` |
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, opts, }: { projectId: string; iconId: string; opts: BitmapOpts or SvgOpts; }) => readonly ["@comapeo/core-react", "projects", string, "icons", string, BitmapOpts or SvgOpts]` |
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, opts, }: { projectApi: ClientApi<MapeoProject>; projectId: string; iconId: string; opts: BitmapOpts or SvgOpts; }) => OmitKeyof<UseQueryOptions<string, Error, string, QueryKey>, "queryFn"> and { ...; } and { ...; }` |
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, opts, }: { projectId: string; iconId: string; opts: BitmapOpts or SvgOpts; }) => { data: string; error: Error or null; isRefetching: boolean; }` |
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.opts`: Parameters related to the mime type of the icon of interest
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
- opts: {
461
- mimeType: 'image/png',
462
- pixelDensity: 1,
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
- opts: {
475
- mimeType: 'image/svg',
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, opts, }: { projectId: string; docType: D; docId: string; opts?: Omit<{ mustBeFound?: boolean or undefined; lang?: string or undefined; } or undefined, "mustBeFound"> or undefined; }) => { ...; }` |
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.opts.lang`: Language to translate the document into
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, opts, }: { projectId: string; docType: D; versionId: string; opts?: { lang?: string or undefined; } or undefined; }) => { data: { schemaName: "track"; locations: Position[]; ... 8 more ...; deleted: boolean; } or { ...; } or { ...; } or { ...; } or { ...; }; error:...` |
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.opts.lang`: Language to translate the document into
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, opts, }: { projectId: string; docType: D; opts?: { includeDeleted?: boolean or undefined; lang?: string or undefined; } or undefined; }) => { data: ({ schemaName: "track"; locations: Position[]; ... 8 more ...; deleted: boolean; } and { ...; })[] or ({ ...; } and { ...; })[] or ...` |
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.opts.includeDeleted`: Include documents that have been marked as deleted
651
- * `opts.opts.lang`: Language to translate the documents into
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.1.1",
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.15.0",
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.16.0",
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.1",
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.0",
77
+ "typescript-eslint": "^8.18.1",
78
78
  "vitest": "^2.1.8"
79
79
  }
80
80
  }