Skip to content
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

VCS refactoring almost completed + DB changes unified #74

Closed
wants to merge 70 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
b7f68a5
Add our Duplicate Versions Script
confused-Techie Jan 13, 2023
bb7e210
Remove debug logging msg
confused-Techie Jan 13, 2023
2c4cfe7
Bump prettier from 2.8.2 to 2.8.3
dependabot[bot] Jan 14, 2023
54f771d
Bump eslint from 8.31.0 to 8.32.0
dependabot[bot] Jan 17, 2023
8113563
Merge pull request #55 from pulsar-edit/dependabot/npm_and_yarn/prett…
confused-Techie Jan 17, 2023
e1cda9d
Merge pull request #59 from pulsar-edit/dependabot/npm_and_yarn/eslin…
confused-Techie Jan 17, 2023
a70d248
Merge pull request #53 from pulsar-edit/new-script
confused-Techie Jan 17, 2023
596a039
GH Action Standards
confused-Techie Jan 17, 2023
2228c4e
Bump superagent from 8.0.6 to 8.0.8
dependabot[bot] Jan 19, 2023
29aa316
Merge pull request #60 from pulsar-edit/dependabot/npm_and_yarn/super…
confused-Techie Jan 19, 2023
a890265
GH Action Standards
confused-Techie Jan 19, 2023
b01adb7
names table: foreign pointer key ON DELETE SET NULL
Digitalone1 Jan 19, 2023
688877b
post new package: check if a name is available before publication
Digitalone1 Jan 19, 2023
b93e0e2
check name availability also on rename
Digitalone1 Jan 19, 2023
95b2462
delete package: do not remove names
Digitalone1 Jan 19, 2023
38421a7
test package name availability
Digitalone1 Jan 19, 2023
cf83b4a
remove unneeded script for duplicated versions
Digitalone1 Jan 21, 2023
61e698d
revert database changes made in #42
Digitalone1 Jan 21, 2023
b89c8ec
add updated/created columns for versions table + update trigger
Digitalone1 Jan 21, 2023
f22d770
start to retrive the results without relying on status = latest
Digitalone1 Jan 21, 2023
ed8b507
more tests on sorting variants + move deletion tests at the end
Digitalone1 Jan 21, 2023
b69792a
add deleted bool column to versions table
Digitalone1 Jan 22, 2023
0e745a1
deprecate status enum in versions table
Digitalone1 Jan 22, 2023
c9acfa4
prepare to deprecate package.data in favour of versions.meta
Digitalone1 Jan 22, 2023
d67bedc
deprecate package.data + use structuredClone and fix tests
Digitalone1 Jan 24, 2023
c89e0d9
remove unused const as suggested by CodeQL
Digitalone1 Jan 24, 2023
51cf557
Upgrade Node Version
confused-Techie Jan 25, 2023
ec0deff
Removed `14` as supported version due to `??=` usage
confused-Techie Jan 25, 2023
ba1dba0
Add explicit support for Node 15
confused-Techie Jan 25, 2023
a81a7f4
Drop support for Node 15
confused-Techie Jan 25, 2023
0290468
Bump @google-cloud/storage from 6.9.0 to 6.9.1
dependabot[bot] Jan 25, 2023
33e4f94
Bump jest from 29.3.1 to 29.4.0
dependabot[bot] Jan 25, 2023
fe95267
PackageJSON: fix getters, add protected methods and private properties
Digitalone1 Jan 25, 2023
b6f92d4
Merge remote-tracking branch 'upstream/refactor-git' into refactor-git
Digitalone1 Jan 25, 2023
957ea85
Merge remote-tracking branch 'upstream/upgrade-node' into new-version…
Digitalone1 Jan 25, 2023
3414640
struturedClone not supported for NodeJS v16
Digitalone1 Jan 25, 2023
8dc5eee
Merge pull request #70 from pulsar-edit/dependabot/npm_and_yarn/jest-…
confused-Techie Jan 26, 2023
2d40d54
GH Action Standards
confused-Techie Jan 26, 2023
97dd029
Bump superagent from 8.0.8 to 8.0.9
dependabot[bot] Jan 26, 2023
97ad2bc
Bump minimum supported version to 17
confused-Techie Jan 27, 2023
59f84fd
Bump jest from 29.4.0 to 29.4.1
dependabot[bot] Jan 27, 2023
5080b47
Merge remote branch 'upstream/upgrade-node' into new-versioning-system-2
Digitalone1 Jan 27, 2023
97b8dbc
fix CodeQL issue: unused variable
Digitalone1 Jan 28, 2023
a013a1c
internal function for pack metadata format + remove versions sorting
Digitalone1 Jan 28, 2023
be26865
remove pseudo objects
Digitalone1 Jan 28, 2023
33630a1
server response package object: use spread syntax
Digitalone1 Jan 28, 2023
60a2bd3
normalize package name directly from the start
Digitalone1 Jan 29, 2023
bd15cc7
package handler: switch to vcs module completely
Digitalone1 Jan 29, 2023
14da592
Merge branch 'new-versioning-system-3' into refactor-git
Digitalone1 Jan 29, 2023
fbfac9e
fix syntax error
Digitalone1 Jan 29, 2023
2b673cc
fix vcs test: we do not save semver in metadata version object
Digitalone1 Jan 29, 2023
50f4c0d
fix vcs test: we save repository as object also in version metadata
Digitalone1 Jan 29, 2023
dba1256
fix vcs test: tarball info are saved in metadata of version object
Digitalone1 Jan 29, 2023
6f5a3c2
fix vcs test: latest is not marked in new pack, database will select it
Digitalone1 Jan 29, 2023
34562ca
vcs test: fix ownership in developer mode
Digitalone1 Jan 29, 2023
93bf595
Bump eslint from 8.32.0 to 8.33.0
dependabot[bot] Jan 31, 2023
1264ece
Merge pull request #62 from Digitalone1/avoid-names-supply-chain-attack
confused-Techie Feb 1, 2023
5b0bdf1
Merge pull request #65 from Digitalone1/new-versioning-system
confused-Techie Feb 1, 2023
f5cfea8
Merge pull request #68 from pulsar-edit/upgrade-node
confused-Techie Feb 1, 2023
9128cfd
Merge pull request #66 from Digitalone1/new-versioning-system-2
confused-Techie Feb 1, 2023
445b810
Merge pull request #69 from pulsar-edit/dependabot/npm_and_yarn/googl…
confused-Techie Feb 1, 2023
1d0ca64
Merge pull request #72 from pulsar-edit/dependabot/npm_and_yarn/super…
confused-Techie Feb 1, 2023
1130fcc
GH Action Standards
confused-Techie Feb 1, 2023
06246ae
Merge pull request #73 from pulsar-edit/dependabot/npm_and_yarn/jest-…
confused-Techie Feb 1, 2023
f78b854
Merge pull request #75 from pulsar-edit/dependabot/npm_and_yarn/eslin…
confused-Techie Feb 1, 2023
f62fa1d
Reinstate reliance on `p.data`
confused-Techie Feb 1, 2023
378d990
Merge pull request #76 from pulsar-edit/fixes-in-prod
confused-Techie Feb 1, 2023
ef06fa4
Bump Version
confused-Techie Feb 1, 2023
cdd7747
GH Action Standards
confused-Techie Feb 1, 2023
0748279
Merge remote-tracking branch 'upstream/main' into refactor-git
Digitalone1 Feb 1, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

strategy:
matrix:
node-version: [16.x]
node-version: [18.x]

steps:
- name: Checkout the latest code
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-tests-pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:

strategy:
matrix:
node-version: [16.x]
node-version: [17.x, 18.x, 19.x]

steps:
- name: Checkout the latest code
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:

strategy:
matrix:
node-version: [16.x]
node-version: [17.x, 18.x, 19.x]

steps:
- name: Checkout the latest code
Expand Down
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18
6 changes: 3 additions & 3 deletions app.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Name this file app.yaml, and it will be picked up by the server.
# app.yaml is in the git ignore to prevent any secrets from leaking.

runtime: nodejs14
runtime: nodejs18
service: default

env_variables:
Expand All @@ -22,8 +22,6 @@ env_variables:
GH_CLIENTID: ""
# The Client Secret to accompany the CLIENT ID
GH_CLIENTSECRET: ""
# The github username associated with the token.
GH_USERNAME: ""
# The User Agent thats used to communicate with GitHub
GH_USERAGENT: "Pulsar-Edit Bot"
# The URI that the OAuth instance should redirect to. Should end in `/api/oauth`
Expand All @@ -48,3 +46,5 @@ env_variables:
# Determines how Logs are written. Currently supports the following options:
# stdout - Writes the console
LOG_FORMAT: "stdout"
RATE_LIMIT_GENERIC: 300
RATE_LIMIT_AUTH: 300
56 changes: 47 additions & 9 deletions docs/reference/Source_Documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ with and retrieve data from the cloud hosted database instance.
* [database](#module_database)
* [~setupSQL()](#module_database..setupSQL) ⇒ <code>object</code>
* [~shutdownSQL()](#module_database..shutdownSQL)
* [~packageNameAvailability(name)](#module_database..packageNameAvailability) ⇒ <code>object</code>
* [~insertNewPackage(pack)](#module_database..insertNewPackage) ⇒ <code>object</code>
* [~insertNewPackageVersion(packJSON, oldName)](#module_database..insertNewPackageVersion) ⇒ <code>object</code>
* [~insertNewPackageName(newName, oldName)](#module_database..insertNewPackageName) ⇒ <code>object</code>
Expand All @@ -185,9 +186,10 @@ with and retrieve data from the cloud hosted database instance.
* [~updateDecrementStar(user, pack)](#module_database..updateDecrementStar) ⇒ <code>object</code>
* [~getStarredPointersByUserID(userid)](#module_database..getStarredPointersByUserID) ⇒ <code>object</code>
* [~getStarringUsersByPointer(pointer)](#module_database..getStarringUsersByPointer) ⇒ <code>object</code>
* [~simpleSearch()](#module_database..simpleSearch) ⇒ <code>object</code>
* [~simpleSearch(term, dir, sort, [themes])](#module_database..simpleSearch) ⇒ <code>object</code>
* [~getUserCollectionById(ids)](#module_database..getUserCollectionById) ⇒ <code>object</code>
* [~getSortedPackages(page, dir, dir, method, [themes])](#module_database..getSortedPackages) ⇒ <code>object</code>
* [~getSortedPackages(page, dir, method, [themes])](#module_database..getSortedPackages) ⇒ <code>object</code>
* [~getOrderField(method, sqlStorage)](#module_database..getOrderField) ⇒ <code>object</code> \| <code>null</code>
* [~authStoreStateKey(stateKey)](#module_database..authStoreStateKey) ⇒ <code>object</code>
* [~authCheckAndDeleteStateKey(stateKey, timestamp)](#module_database..authCheckAndDeleteStateKey) ⇒ <code>object</code>

Expand All @@ -207,6 +209,22 @@ Exceptions thrown here should be caught and handled in the caller.
Ensures any Database connection is properly, and safely closed before exiting.

**Kind**: inner method of [<code>database</code>](#module_database)
<a name="module_database..packageNameAvailability"></a>

### database~packageNameAvailability(name) ⇒ <code>object</code>
Determines if a name is ready to be used for a new package. Useful in the stage of the publication
of a new package where checking if the package exists is not enough because a name could be not
available if a deleted package was using it in the past.
Useful also to check if a name is available for the renaming of a published package.
This function simply checks if the provided name is present in "names" table.

**Kind**: inner method of [<code>database</code>](#module_database)
**Returns**: <code>object</code> - A Server Status Object.

| Param | Type | Description |
| --- | --- | --- |
| name | <code>string</code> | The candidate name for a new package. |

<a name="module_database..insertNewPackage"></a>

### database~insertNewPackage(pack) ⇒ <code>object</code>
Expand Down Expand Up @@ -336,7 +354,7 @@ Takes a package pointer array, and returns an array of the package objects.
<a name="module_database..updatePackageStargazers"></a>

### database~updatePackageStargazers(name, pointer) ⇒ <code>object</code>
Uses the package name (or pointer if provided) to update its stargazers count.
Internal util that uses the package name (or pointer if provided) to update its stargazers count.

**Kind**: inner method of [<code>database</code>](#module_database)
**Returns**: <code>object</code> - The effected server status object.
Expand Down Expand Up @@ -385,8 +403,8 @@ Given a package name, removes its record alongside its names, versions, stars.
<a name="module_database..removePackageVersion"></a>

### database~removePackageVersion(packName, semVer) ⇒ <code>object</code>
Mark a version of a specific package as removed. This does not delete the record,
just mark the status as removed, but only if one published version remain available.
Mark a version of a specific package as deleted. This does not delete the record,
just mark the boolean deleted flag as true, but only if one published version remains available.
This also makes sure that a new latest version is selected in case the previous one is removed.

**Kind**: inner method of [<code>database</code>](#module_database)
Expand Down Expand Up @@ -503,12 +521,20 @@ Use the pointer of a package to collect all users that have starred it.

<a name="module_database..simpleSearch"></a>

### database~simpleSearch() ⇒ <code>object</code>
### database~simpleSearch(term, dir, sort, [themes]) ⇒ <code>object</code>
The current Fuzzy-Finder implementation of search. Ideally eventually
will use a more advanced search method.

**Kind**: inner method of [<code>database</code>](#module_database)
**Returns**: <code>object</code> - A server status object containing the results and the pagination object.

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| term | <code>string</code> | | The search term. |
| dir | <code>string</code> | | String flag for asc/desc order. |
| sort | <code>string</code> | | The sort method. |
| [themes] | <code>boolean</code> | <code>false</code> | Optional Parameter to specify if this should only return themes. |

<a name="module_database..getUserCollectionById"></a>

### database~getUserCollectionById(ids) ⇒ <code>object</code>
Expand All @@ -523,7 +549,7 @@ Returns an array of Users and their associated data via the ids.

<a name="module_database..getSortedPackages"></a>

### database~getSortedPackages(page, dir, dir, method, [themes]) ⇒ <code>object</code>
### database~getSortedPackages(page, dir, method, [themes]) ⇒ <code>object</code>
Takes the page, direction, and sort method returning the raw sql package
data for each. This monolithic function handles trunication of the packages,
and sorting, aiming to provide back the raw data, and allow later functions to
Expand All @@ -536,10 +562,22 @@ then reconstruct the JSON as needed.
| --- | --- | --- | --- |
| page | <code>int</code> | | Page number. |
| dir | <code>string</code> | | String flag for asc/desc order. |
| dir | <code>string</code> | | String flag for asc/desc order. |
| method | <code>string</code> | | The column name the results have to be sorted by. |
| method | <code>string</code> | | The sort method. |
| [themes] | <code>boolean</code> | <code>false</code> | Optional Parameter to specify if this should only return themes. |

<a name="module_database..getOrderField"></a>

### database~getOrderField(method, sqlStorage) ⇒ <code>object</code> \| <code>null</code>
Internal method to parse the sort method and return the related database field/column.

**Kind**: inner method of [<code>database</code>](#module_database)
**Returns**: <code>object</code> \| <code>null</code> - The string field associated to the sort method or null if the method is not recognized.

| Param | Type | Description |
| --- | --- | --- |
| method | <code>string</code> | The sort method. |
| sqlStorage | <code>object</code> | The database class instance used parse the proper field. |

<a name="module_database..authStoreStateKey"></a>

### database~authStoreStateKey(stateKey) ⇒ <code>object</code>
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/complexity-report.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Complexity report, 1/14/2023
# Complexity report, 2/1/2023

* Mean per-function logical LOC: 16.142857142857142
* Mean per-function parameter count: 0.3392857142857143
Expand Down
Loading