From ed2787e5085146224c168bbd9a1effa58730224d Mon Sep 17 00:00:00 2001 From: Mauve Signweaver Date: Mon, 9 Mar 2026 17:23:38 -0400 Subject: [PATCH] feat: Use latest version of core, deprecate importing schema directly --- gen-typebox.js | 2 +- package-lock.json | 18 ++++++++++++------ package.json | 3 +-- src/routes.js | 4 ++-- test/list-alerts-endpoint.js | 2 +- test/observations-endpoint.js | 2 +- test/test-helpers.js | 10 +++++----- test/tracks-endpoint.js | 4 ++-- 8 files changed, 25 insertions(+), 20 deletions(-) diff --git a/gen-typebox.js b/gen-typebox.js index 0a2dd35..f5ef5c1 100644 --- a/gen-typebox.js +++ b/gen-typebox.js @@ -1,4 +1,4 @@ -import { dereferencedDocSchemas as originals } from '@comapeo/schema' +import { dereferencedDocSchemas as originals } from '@comapeo/core/schema.js' import { schema2typebox } from 'schema2typebox' import * as ts from 'typescript' diff --git a/package-lock.json b/package-lock.json index a321184..6053743 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "0.3.1", "license": "MIT", "dependencies": { - "@comapeo/core": "^5.1.1", + "@comapeo/core": "^6.0.0", "@fastify/sensible": "^5.6.0", "@fastify/type-provider-typebox": "^4.1.0", "@fastify/websocket": "^10.0.1", @@ -23,7 +23,6 @@ "ws": "^8.18.0" }, "devDependencies": { - "@comapeo/schema": "^2.0.0", "@eslint/js": "^9.14.0", "@garbee/iso8601": "^1.0.3", "@mapeo/mock-data": "^5.0.0", @@ -348,9 +347,9 @@ } }, "node_modules/@comapeo/core": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/@comapeo/core/-/core-5.1.1.tgz", - "integrity": "sha512-3gq+qTdG9iz5nrAcshL+ygXfe0Aa4LMdEJXC2AzjDrqzl0g/S0qmYEGAHsD1pdIIpCBNHD4ENOEOHUFDQTlluA==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@comapeo/core/-/core-6.0.0.tgz", + "integrity": "sha512-EM02Kkedqv9JXWDWmkH5Yk406uUCWee3AgCvAhZH5Uu9dAPZId7/nTumYYWdl5lV++YINdYEaNv7EixuR5R16A==", "license": "MIT", "dependencies": { "@comapeo/fallback-smp": "^1.0.0", @@ -372,10 +371,11 @@ "comapeocat": "^1.0.0", "compact-encoding": "^2.12.0", "corestore": "6.8.4", + "custom-error-creator": "^1.1.1", "debug": "^4.3.4", "dot-prop": "^9.0.0", "dot-prop-extra": "^10.2.0", - "drizzle-orm": "^1.0.0-beta.1-ac4ce44", + "drizzle-orm": "1.0.0-beta.1-fd8bfcc", "ensure-error": "^4.0.0", "fastify": "^4.0.0", "fastify-plugin": "^4.5.1", @@ -3362,6 +3362,12 @@ "integrity": "sha512-aylIc7Z9y4yzHYAJNuESG3hfhC+0Ibp/MAMiaOZgNv4pmEdFyfZhhhny4MNiAfWdBQ1RQ2mfDWmM1x8SvGyp8g==", "license": "CC0-1.0" }, + "node_modules/custom-error-creator": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/custom-error-creator/-/custom-error-creator-1.1.1.tgz", + "integrity": "sha512-V1g1pUyk7qF2w4gHm2TwOUYA2vMmhrJJ1U+hwH/VJ4yXj4rHFY3s7yM3rh2xdyB/qcE76pIkdkB1X3KFeqVuvA==", + "license": "MIT" + }, "node_modules/data-view-buffer": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/data-view-buffer/-/data-view-buffer-1.0.1.tgz", diff --git a/package.json b/package.json index 945dcdb..cd0c776 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,6 @@ }, "homepage": "https://github.com/digidem/comapeo-cloud#readme", "devDependencies": { - "@comapeo/schema": "^2.0.0", "@eslint/js": "^9.14.0", "@garbee/iso8601": "^1.0.3", "@mapeo/mock-data": "^5.0.0", @@ -64,7 +63,7 @@ "typescript": "^5.6.3" }, "dependencies": { - "@comapeo/core": "^5.1.1", + "@comapeo/core": "^6.0.0", "@fastify/sensible": "^5.6.0", "@fastify/type-provider-typebox": "^4.1.0", "@fastify/websocket": "^10.0.1", diff --git a/src/routes.js b/src/routes.js index 2f1d534..b04a28e 100644 --- a/src/routes.js +++ b/src/routes.js @@ -18,8 +18,8 @@ import { wsCoreReplicator } from './ws-core-replicator.js' /** @import { FastifyInstance, FastifyPluginAsync, FastifyRequest, RawServerDefault } from 'fastify' */ /** @import { TypeBoxTypeProvider } from '@fastify/type-provider-typebox' */ -/** @import { MapeoDoc } from '@comapeo/schema' */ -/** @import { MapeoProject } from '@comapeo/core/dist/mapeo-project.js' */ +/** @import { MapeoDoc } from '@comapeo/core/schema.js' */ +/** @import { MapeoProject } from '@comapeo/core' */ /** @import {Static, TSchema} from '@sinclair/typebox' */ /** * @template {MapeoDoc['schemaName']} TSchemaName diff --git a/test/list-alerts-endpoint.js b/test/list-alerts-endpoint.js index 73a1e25..6e0b345 100644 --- a/test/list-alerts-endpoint.js +++ b/test/list-alerts-endpoint.js @@ -1,5 +1,5 @@ import { MapeoManager } from '@comapeo/core' -import { valueOf } from '@comapeo/schema' +import { valueOf } from '@comapeo/core/schema.js' import { isValidDateTime } from '@garbee/iso8601' import { keyToPublicId as projectKeyToPublicId } from '@mapeo/crypto' diff --git a/test/observations-endpoint.js b/test/observations-endpoint.js index a0b5ed1..09fb67f 100644 --- a/test/observations-endpoint.js +++ b/test/observations-endpoint.js @@ -16,7 +16,7 @@ import { runWithRetries, } from './test-helpers.js' -/** @import { ObservationValue } from '@comapeo/schema'*/ +/** @import { ObservationValue } from '@comapeo/core/schema.js'*/ /** @import { FastifyInstance } from 'fastify' */ const FIXTURES_ROOT = new URL('./fixtures/', import.meta.url) diff --git a/test/test-helpers.js b/test/test-helpers.js index c39b2b4..4da62d7 100644 --- a/test/test-helpers.js +++ b/test/test-helpers.js @@ -1,4 +1,4 @@ -import { valueOf } from '@comapeo/schema' +import { valueOf } from '@comapeo/core/schema.js' import { KeyManager, keyToPublicId as projectKeyToPublicId, @@ -18,7 +18,7 @@ import comapeoServer from '../src/app.js' /** @import { TestContext } from 'node:test' */ /** @import { FastifyInstance } from 'fastify' */ /** @import { ServerOptions } from '../src/app.js' */ -/** @import { MapeoProject } from '@comapeo/core/dist/mapeo-project.js' */ +/** @import { MapeoProject } from '@comapeo/core' */ export const BEARER_TOKEN = Buffer.from('swordfish').toString('base64') @@ -153,7 +153,7 @@ export function generateAlerts( // Hacky, but should get the job done ensuring we have all geometry types in the test const alerts = [] for (const geometryType of geometryTypes) { - /** @type {import('@comapeo/schema').RemoteDetectionAlert | undefined} */ + /** @type {import('@comapeo/core/schema.js').RemoteDetectionAlert | undefined} */ let alert while (!alert || alert.geometry.type !== geometryType) { ;[alert] = generate('remoteDetectionAlert', { count: 1 }) @@ -187,7 +187,7 @@ export async function generatePreset(project) { /** * Generate a new observation - * @returns {import('@comapeo/schema').ObservationValue} + * @returns {import('@comapeo/core/schema.js').ObservationValue} */ export function generateObservation() { const observationDoc = generate('observation', { count: 1 })[0] @@ -197,7 +197,7 @@ export function generateObservation() { /** * Generate a new track - * @returns {import('@comapeo/schema').TrackValue} + * @returns {import('@comapeo/core/schema.js').TrackValue} */ export function generateTrack() { const trackDoc = generate('track', { count: 1 })[0] diff --git a/test/tracks-endpoint.js b/test/tracks-endpoint.js index 493aed9..49f64c2 100644 --- a/test/tracks-endpoint.js +++ b/test/tracks-endpoint.js @@ -1,5 +1,5 @@ import { MapeoManager } from '@comapeo/core' -import { valueOf } from '@comapeo/schema' +import { valueOf } from '@comapeo/core/schema.js' import { keyToPublicId as projectKeyToPublicId } from '@mapeo/crypto' import { generate } from '@mapeo/mock-data' @@ -157,7 +157,7 @@ test('returning tracks with fetchable observations', async (t) => { /** * * @param {{docId: string, versionId: string}[]} observationRefs - * @returns {import('@comapeo/schema').TrackValue} + * @returns {import('@comapeo/core/schema.js').TrackValue} */ function makeTrack(observationRefs) { const rawTrack = generate('track', { count: 1 })[0]