-
Notifications
You must be signed in to change notification settings - Fork 1
feat: add /maps/ routes
#2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
This comment was marked as resolved.
This comment was marked as resolved.
|
Some windows failures around parallel uploads, which I suspect are probably a test artifact rather than a bug to be worried about. |
This comment was marked as resolved.
This comment was marked as resolved.
RangerMauve
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not seeing any obvious issues
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of small cleanup things to address but otherwise functionality seems thorough!
Out of curiosity, will I still need the patches I have on desktop related to CORS issues that I run into in development? (caused by usage of Vite's dev server)
Slightly tangential, but the publishing tsconfig needs to be updated since you're committing to a TS implementation:
diff --git a/tsconfig.npm.json b/tsconfig.npm.json
index f89cb7b..f35d2b4 100644
--- a/tsconfig.npm.json
+++ b/tsconfig.npm.json
@@ -4,9 +4,7 @@
"noEmit": false,
"outDir": "dist",
"declaration": true,
- "emitDeclarationOnly": true,
"declarationMap": true
},
- "files": [],
- "include": ["src/index.js"]
+ "include": ["src/index.ts", "types/*"]
}Updates the bounding box used for the map where there's no data to show. Something I learned via digidem/comapeo-map-server#2 (comment)
Updates the bounding box used for the map where there's no data to show. Something I learned via digidem/comapeo-map-server#2 (comment)
achou11
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few non-blocking comments but overall looks great ✨
| if (request.params.mapId !== CUSTOM_MAP_ID) { | ||
| throw new errors.MAP_NOT_FOUND(`Map not found: ${request.params.mapId}`) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
feels misleading to use a not found error here. maybe a status error explaining this temporary (?) limitation would be more suitable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix is lined up in #4, which adds a FORBIDDEN (403) for trying to update or delete the "special" IDs - fallback and default. I'm following a pattern here where PUT is for updates, not for creation (keeping POST for that), so I think 404 is the correct response. This is probably not perfectly semantically correct, given that this is also creating the custom map, but I think we can just resolve this later when we change this to support multiple custom maps.
| if (request.params.mapId !== CUSTOM_MAP_ID) { | ||
| throw new errors.MAP_NOT_FOUND(`Map not found: ${request.params.mapId}`) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
similar comment about potentially using a different error code
| // @ts-expect-error - the types for this are too hard and making them work would not add any type safety. | ||
| remoteDeviceId: z32.encode(req.socket.remotePublicKey), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More specific placement to avoid unintentional opt-out:
| // @ts-expect-error - the types for this are too hard and making them work would not add any type safety. | |
| remoteDeviceId: z32.encode(req.socket.remotePublicKey), | |
| remoteDeviceId: z32.encode( | |
| // @ts-expect-error - the types for this are too hard and making them work would not add any type safety. | |
| req.socket.remotePublicKey, | |
| ), |
Adds routes for reading maps, uploading new custom maps, and deleting custom maps