forked from confused-Techie/atom-backend
-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from pulsar-edit/refactor-git
Laying the groundwork for the `git` refactor
- Loading branch information
Showing
14 changed files
with
2,164 additions
and
356 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
This document aims to take some of the mystery out of objects used within the backend. | ||
|
||
Since a lot of what's done on the backend is mutating object structures or working with them, it can be helpful to now document what structures some important functions expect, or will return. | ||
|
||
## `database.insertNewPackageVersion()` | ||
|
||
This function expects it's first argument to be one of `packJSON` and expects the following format: | ||
|
||
* Essentially this object should be the full `package.json` of the version we want. | ||
* There are some values that are required, and used by the database function: | ||
- `.name`: Expected to be the `package.json` `name` key | ||
- `.license`: Expected to contain the license of the package. If none is provided it defaults to `defaultLicense` | ||
- `.engines`: Expected to contain the packages engines field. If none is provided it defaults to `defaultEngine` | ||
- `.version`: Required, no default provided. If this key doesn't exist the database call *will* fail | ||
* There are other values that are required that the database function *doesn't* use, but will be used later on. | ||
- `.sha`: This should be the SHA value of the tarball download for this version. | ||
- `.tarball_url`: This should be the GitHub (Or other VCS service) URL to download this versions code. | ||
- `.dist.tarball`: This value is not required. It is injected when the packages version data is returned. Migrated packages will already have this key, but will be pointing to an `atom.io` URL, and will need to be overridden when returning the package data. | ||
|
||
A full example is below: | ||
|
||
```json | ||
{ | ||
"sha": "4fd4a4942dc0136c982277cdd59351bb71eb776d", | ||
"dist": { | ||
"tarball": "https://www.atom.io/api/packages/codelink-tools/versions/0.14.0/tarball" | ||
}, | ||
"main": "./lib/codelink-tools", | ||
"name": "codelink-tools", | ||
"version": "0.14.0", | ||
"keywords": [], | ||
"repository": "https://github.com/j-woudenberg/codelink-tools", | ||
"description": "An Atom package for CodeLink that includes a compiler, debugger, and a solution explorer", | ||
"tarball_url": "https://api.github.com/repos/j-woudenberg/codelink-tools/tarball/refs/tags/v0.14.0", | ||
"dependencies": {}, | ||
"deserializers": { | ||
"codelink-tools/Parser": "deserializeParser" | ||
}, | ||
"activationHooks": [ | ||
"source.codelink:root-scope-used" | ||
], | ||
"activationCommands": { | ||
"atom-workspace": "codelink-tools:toggle" | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/** | ||
* This Document is intended to house all `typedef` comments used within | ||
* the codebase. | ||
* It's existance and location serves two purposes: | ||
* - Having this located within docs lets it be properly discoverable as | ||
* documentation about the object structures we use. | ||
* - But having it as a JavaScript file means it can be included into our | ||
* JSDoc Source Code Documentation - ../reference/Source_Documentation.md | ||
*/ | ||
|
||
/** | ||
* The Generic Object that should be returned by nearly every function | ||
* within every module. Allows ease of bubbling errors to the HTTP Handler. | ||
* @see {@link docs/reference/bubbled_errors.md} | ||
* @typedef {object} ServerStatusObject | ||
* @property {boolean} ok - Indicates if the overall function was successful. | ||
* @property {*} content - The returned data of the request. Can be anything. | ||
* @property {string} [short] - Only included if `ok` is false. Includes a | ||
* generic reason the request failed. | ||
*/ | ||
|
||
// ============================================================================= | ||
// ========================= VCS =============================================== | ||
// ============================================================================= | ||
|
||
/** | ||
* The Server Status Object returned by `vcs.newVersionData()` containing all | ||
* the data needed to update a packages version. | ||
* @typedef {object} SSO_VCS_newVersionData | ||
* @property {boolean} ok - Indicates if the overall function was successful. | ||
* @property {string} [short] - Only included if `ok: false`. Includes the generic | ||
* reason the request failed. | ||
* @property {string|object} content - When `ok: false` returns a string error | ||
* but when `ok: true` returns an object further documented below. | ||
* @property {string} content.name - The Lowercase string of the packages name. | ||
* As taken from the `package.json` content at it's remote repository. | ||
* @property {object} content.repository - The returned repository object as | ||
* returned by `vcs.determineProvider()` when passed the remote `package.json`s | ||
* `repository` key. | ||
* @property {string} content.repository.type - A string representing the service | ||
* vcs name of where the repo is located. One of the valid types returned by | ||
* `vcs.determineProvider()` | ||
* @property {string} content.repository.url - A String URL of where the remote | ||
* repository is located. | ||
* @property {string} content.readme - The Text based readme of the package, as | ||
* received from it's remote repository. | ||
* @property {object} content.metadata - Largely made up of the remote `package.json` | ||
* Where it will include all fields as found in the remote file. While additionally | ||
* adding a few others which will be documented here. | ||
* @property {string} content.metadata.tarball_url - The URL of the tarball download | ||
* for the newest tag published for the package. | ||
* @property {string} content.metadata.sha - The SHA hash of the `tarball_url` | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.