groovectl 0.0.0-stage → 0.2.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/CHANGELOG.md +79 -0
- package/LICENSE +201 -0
- package/NOTICE +4 -0
- package/README.md +424 -2
- package/SECURITY.md +10 -0
- package/dist/app/collection-service.d.ts +24 -0
- package/dist/app/collection-service.d.ts.map +1 -0
- package/dist/app/collection-service.js +129 -0
- package/dist/app/collection-service.js.map +1 -0
- package/dist/app/database-service.d.ts +26 -0
- package/dist/app/database-service.d.ts.map +1 -0
- package/dist/app/database-service.js +242 -0
- package/dist/app/database-service.js.map +1 -0
- package/dist/app/marketplace-offers.d.ts +25 -0
- package/dist/app/marketplace-offers.d.ts.map +1 -0
- package/dist/app/marketplace-offers.js +237 -0
- package/dist/app/marketplace-offers.js.map +1 -0
- package/dist/app/marketplace-service.d.ts +37 -0
- package/dist/app/marketplace-service.d.ts.map +1 -0
- package/dist/app/marketplace-service.js +270 -0
- package/dist/app/marketplace-service.js.map +1 -0
- package/dist/app/user-mappers.d.ts +4 -0
- package/dist/app/user-mappers.d.ts.map +1 -0
- package/dist/app/user-mappers.js +21 -0
- package/dist/app/user-mappers.js.map +1 -0
- package/dist/app/user-service.d.ts +11 -0
- package/dist/app/user-service.d.ts.map +1 -0
- package/dist/app/user-service.js +73 -0
- package/dist/app/user-service.js.map +1 -0
- package/dist/app/wantlist-service.d.ts +12 -0
- package/dist/app/wantlist-service.d.ts.map +1 -0
- package/dist/app/wantlist-service.js +32 -0
- package/dist/app/wantlist-service.js.map +1 -0
- package/dist/auth/keyring.d.ts +8 -0
- package/dist/auth/keyring.d.ts.map +1 -0
- package/dist/auth/keyring.js +39 -0
- package/dist/auth/keyring.js.map +1 -0
- package/dist/auth/prompt.d.ts +3 -0
- package/dist/auth/prompt.d.ts.map +1 -0
- package/dist/auth/prompt.js +8 -0
- package/dist/auth/prompt.js.map +1 -0
- package/dist/auth/token-provider.d.ts +31 -0
- package/dist/auth/token-provider.d.ts.map +1 -0
- package/dist/auth/token-provider.js +94 -0
- package/dist/auth/token-provider.js.map +1 -0
- package/dist/bin/groovectl.d.ts +3 -0
- package/dist/bin/groovectl.d.ts.map +1 -0
- package/dist/bin/groovectl.js +9 -0
- package/dist/bin/groovectl.js.map +1 -0
- package/dist/cli/commands/artist.d.ts +5 -0
- package/dist/cli/commands/artist.d.ts.map +1 -0
- package/dist/cli/commands/artist.js +72 -0
- package/dist/cli/commands/artist.js.map +1 -0
- package/dist/cli/commands/auth.d.ts +5 -0
- package/dist/cli/commands/auth.d.ts.map +1 -0
- package/dist/cli/commands/auth.js +49 -0
- package/dist/cli/commands/auth.js.map +1 -0
- package/dist/cli/commands/collection.d.ts +5 -0
- package/dist/cli/commands/collection.d.ts.map +1 -0
- package/dist/cli/commands/collection.js +391 -0
- package/dist/cli/commands/collection.js.map +1 -0
- package/dist/cli/commands/config.d.ts +5 -0
- package/dist/cli/commands/config.d.ts.map +1 -0
- package/dist/cli/commands/config.js +79 -0
- package/dist/cli/commands/config.js.map +1 -0
- package/dist/cli/commands/database-common.d.ts +19 -0
- package/dist/cli/commands/database-common.d.ts.map +1 -0
- package/dist/cli/commands/database-common.js +53 -0
- package/dist/cli/commands/database-common.js.map +1 -0
- package/dist/cli/commands/label.d.ts +5 -0
- package/dist/cli/commands/label.d.ts.map +1 -0
- package/dist/cli/commands/label.js +59 -0
- package/dist/cli/commands/label.js.map +1 -0
- package/dist/cli/commands/list.d.ts +5 -0
- package/dist/cli/commands/list.d.ts.map +1 -0
- package/dist/cli/commands/list.js +58 -0
- package/dist/cli/commands/list.js.map +1 -0
- package/dist/cli/commands/marketplace.d.ts +5 -0
- package/dist/cli/commands/marketplace.d.ts.map +1 -0
- package/dist/cli/commands/marketplace.js +661 -0
- package/dist/cli/commands/marketplace.js.map +1 -0
- package/dist/cli/commands/master.d.ts +5 -0
- package/dist/cli/commands/master.d.ts.map +1 -0
- package/dist/cli/commands/master.js +96 -0
- package/dist/cli/commands/master.js.map +1 -0
- package/dist/cli/commands/release.d.ts +5 -0
- package/dist/cli/commands/release.d.ts.map +1 -0
- package/dist/cli/commands/release.js +158 -0
- package/dist/cli/commands/release.js.map +1 -0
- package/dist/cli/commands/schema.d.ts +38 -0
- package/dist/cli/commands/schema.d.ts.map +1 -0
- package/dist/cli/commands/schema.js +125 -0
- package/dist/cli/commands/schema.js.map +1 -0
- package/dist/cli/commands/search.d.ts +5 -0
- package/dist/cli/commands/search.d.ts.map +1 -0
- package/dist/cli/commands/search.js +144 -0
- package/dist/cli/commands/search.js.map +1 -0
- package/dist/cli/commands/user.d.ts +5 -0
- package/dist/cli/commands/user.d.ts.map +1 -0
- package/dist/cli/commands/user.js +43 -0
- package/dist/cli/commands/user.js.map +1 -0
- package/dist/cli/commands/wantlist.d.ts +5 -0
- package/dist/cli/commands/wantlist.d.ts.map +1 -0
- package/dist/cli/commands/wantlist.js +158 -0
- package/dist/cli/commands/wantlist.js.map +1 -0
- package/dist/cli/confirmation.d.ts +3 -0
- package/dist/cli/confirmation.d.ts.map +1 -0
- package/dist/cli/confirmation.js +21 -0
- package/dist/cli/confirmation.js.map +1 -0
- package/dist/cli/create-program.d.ts +10 -0
- package/dist/cli/create-program.d.ts.map +1 -0
- package/dist/cli/create-program.js +121 -0
- package/dist/cli/create-program.js.map +1 -0
- package/dist/cli/global-options.d.ts +18 -0
- package/dist/cli/global-options.d.ts.map +1 -0
- package/dist/cli/global-options.js +25 -0
- package/dist/cli/global-options.js.map +1 -0
- package/dist/cli/run-cli.d.ts +7 -0
- package/dist/cli/run-cli.d.ts.map +1 -0
- package/dist/cli/run-cli.js +84 -0
- package/dist/cli/run-cli.js.map +1 -0
- package/dist/cli/runtime.d.ts +34 -0
- package/dist/cli/runtime.d.ts.map +1 -0
- package/dist/cli/runtime.js +93 -0
- package/dist/cli/runtime.js.map +1 -0
- package/dist/config/paths.d.ts +2 -0
- package/dist/config/paths.d.ts.map +1 -0
- package/dist/config/paths.js +18 -0
- package/dist/config/paths.js.map +1 -0
- package/dist/config/schema.d.ts +20 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +15 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/config/store.d.ts +10 -0
- package/dist/config/store.d.ts.map +1 -0
- package/dist/config/store.js +88 -0
- package/dist/config/store.js.map +1 -0
- package/dist/discogs/client.d.ts +247 -0
- package/dist/discogs/client.d.ts.map +1 -0
- package/dist/discogs/client.js +331 -0
- package/dist/discogs/client.js.map +1 -0
- package/dist/discogs/database-schemas.d.ts +162 -0
- package/dist/discogs/database-schemas.d.ts.map +1 -0
- package/dist/discogs/database-schemas.js +92 -0
- package/dist/discogs/database-schemas.js.map +1 -0
- package/dist/discogs/marketplace-page.d.ts +10 -0
- package/dist/discogs/marketplace-page.d.ts.map +1 -0
- package/dist/discogs/marketplace-page.js +140 -0
- package/dist/discogs/marketplace-page.js.map +1 -0
- package/dist/discogs/marketplace-schemas.d.ts +378 -0
- package/dist/discogs/marketplace-schemas.d.ts.map +1 -0
- package/dist/discogs/marketplace-schemas.js +184 -0
- package/dist/discogs/marketplace-schemas.js.map +1 -0
- package/dist/discogs/schemas.d.ts +142 -0
- package/dist/discogs/schemas.d.ts.map +1 -0
- package/dist/discogs/schemas.js +120 -0
- package/dist/discogs/schemas.js.map +1 -0
- package/dist/discogs/user-schemas.d.ts +325 -0
- package/dist/discogs/user-schemas.d.ts.map +1 -0
- package/dist/discogs/user-schemas.js +140 -0
- package/dist/discogs/user-schemas.js.map +1 -0
- package/dist/domain/database-resource.d.ts +72 -0
- package/dist/domain/database-resource.d.ts.map +1 -0
- package/dist/domain/database-resource.js +2 -0
- package/dist/domain/database-resource.js.map +1 -0
- package/dist/domain/marketplace.d.ts +165 -0
- package/dist/domain/marketplace.d.ts.map +1 -0
- package/dist/domain/marketplace.js +91 -0
- package/dist/domain/marketplace.js.map +1 -0
- package/dist/domain/release.d.ts +61 -0
- package/dist/domain/release.d.ts.map +1 -0
- package/dist/domain/release.js +2 -0
- package/dist/domain/release.js.map +1 -0
- package/dist/domain/search-result.d.ts +17 -0
- package/dist/domain/search-result.d.ts.map +1 -0
- package/dist/domain/search-result.js +2 -0
- package/dist/domain/search-result.js.map +1 -0
- package/dist/domain/user-resource.d.ts +117 -0
- package/dist/domain/user-resource.d.ts.map +1 -0
- package/dist/domain/user-resource.js +2 -0
- package/dist/domain/user-resource.js.map +1 -0
- package/dist/errors/app-error.d.ts +19 -0
- package/dist/errors/app-error.d.ts.map +1 -0
- package/dist/errors/app-error.js +55 -0
- package/dist/errors/app-error.js.map +1 -0
- package/dist/http/marketplace-request.d.ts +3 -0
- package/dist/http/marketplace-request.d.ts.map +1 -0
- package/dist/http/marketplace-request.js +67 -0
- package/dist/http/marketplace-request.js.map +1 -0
- package/dist/http/rate-limit.d.ts +12 -0
- package/dist/http/rate-limit.d.ts.map +1 -0
- package/dist/http/rate-limit.js +27 -0
- package/dist/http/rate-limit.js.map +1 -0
- package/dist/http/request.d.ts +19 -0
- package/dist/http/request.d.ts.map +1 -0
- package/dist/http/request.js +165 -0
- package/dist/http/request.js.map +1 -0
- package/dist/output/records.d.ts +14 -0
- package/dist/output/records.d.ts.map +1 -0
- package/dist/output/records.js +110 -0
- package/dist/output/records.js.map +1 -0
- package/dist/version.d.ts +11 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +16 -0
- package/dist/version.js.map +1 -0
- package/package.json +72 -4
package/README.md
CHANGED
|
@@ -1,3 +1,425 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Groovectl for Discogs
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A script-friendly Discogs CLI for exploring releases, managing your collection
|
|
4
|
+
and wantlist, and reading Marketplace data.
|
|
5
|
+
|
|
6
|
+
> This application uses Discogs' API but is not affiliated with, sponsored or
|
|
7
|
+
> endorsed by Discogs. "Discogs" is a trademark of Zink Media, LLC.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
Requires Node.js 24 or newer and npm. End users do not need pnpm, TypeScript, or
|
|
12
|
+
a source checkout.
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
npm install --global groovectl
|
|
16
|
+
groovectl --help
|
|
17
|
+
groovectl version --json
|
|
18
|
+
groovectl release get 249504 --json
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
For a one-off invocation without a global installation:
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
npm exec --package=groovectl -- groovectl --help
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Upgrade or uninstall:
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
npm install --global groovectl@latest
|
|
31
|
+
npm uninstall --global groovectl
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Global commands must be on PATH. If npm reports a permissions error, use a
|
|
35
|
+
user-owned Node.js installation rather than changing system directory
|
|
36
|
+
permissions. Discogs authentication is separate from npm installation; use
|
|
37
|
+
`groovectl --token auth login` when you want to save a Discogs User Token.
|
|
38
|
+
|
|
39
|
+
## Local development
|
|
40
|
+
|
|
41
|
+
Requirements: Node.js 24 LTS and pnpm 10.
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
pnpm install
|
|
45
|
+
pnpm build
|
|
46
|
+
npm install --global .
|
|
47
|
+
|
|
48
|
+
groovectl --help
|
|
49
|
+
groovectl release get 249504 --json
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Run the installation commands in the project directory. After installation,
|
|
53
|
+
`groovectl` works from any directory as long as npm's global executable
|
|
54
|
+
directory is on PATH. This local installation links to the checkout, so rebuild
|
|
55
|
+
with `pnpm build` after changing source code and keep the checkout in place.
|
|
56
|
+
|
|
57
|
+
A built tarball can also be installed with
|
|
58
|
+
`npm install -g /path/to/groovectl-0.2.0.tgz`; recipients need Node.js 24+, but
|
|
59
|
+
do not need pnpm or a TypeScript compiler.
|
|
60
|
+
|
|
61
|
+
For local development without installing, use `pnpm start -- --help` or
|
|
62
|
+
`node dist/bin/groovectl.js --help` after building.
|
|
63
|
+
|
|
64
|
+
## Rename from Crateflow
|
|
65
|
+
|
|
66
|
+
The package and executable are now `groovectl` (Groovectl for Discogs). The
|
|
67
|
+
local checkout folder does not need to be renamed. Reinstall from the checkout
|
|
68
|
+
to register the new command. If an older global `crateflow` package is
|
|
69
|
+
installed, you can remove it with `npm uninstall -g crateflow` after verifying
|
|
70
|
+
`groovectl`.
|
|
71
|
+
|
|
72
|
+
Existing settings and saved tokens remain in the original `crateflow` config
|
|
73
|
+
directory and OS credential-store namespace; the rename does not migrate or
|
|
74
|
+
delete them. The `DISCOGS_TOKEN` environment variable and token options are
|
|
75
|
+
unchanged. Error prefixes now use `GROOVECTL_`; scripts matching the old
|
|
76
|
+
`CRATEFLOW_` errors need updating. Build/test environment variables use
|
|
77
|
+
`GROOVECTL_`, with legacy `CRATEFLOW_` aliases accepted for compatibility.
|
|
78
|
+
|
|
79
|
+
## Implemented commands
|
|
80
|
+
|
|
81
|
+
- `groovectl --help`
|
|
82
|
+
- `groovectl version [--json]`
|
|
83
|
+
- `groovectl schema [command...] [--compact]`
|
|
84
|
+
- `groovectl auth login|status|logout`
|
|
85
|
+
- `groovectl config get|set`
|
|
86
|
+
- `groovectl search [query] [filters] [--all] [--limit <n>]`
|
|
87
|
+
- `groovectl release get <id> [--currency <code>]`
|
|
88
|
+
- `groovectl release rating get|set|remove <id>`
|
|
89
|
+
- `groovectl master get <id>` /
|
|
90
|
+
`groovectl master versions <id> [--country ...] [--media-format ...] [--label ...] [--released ...] [--sort ...]`
|
|
91
|
+
- `groovectl artist get <id>` / `groovectl artist releases <id> [--sort ...]`
|
|
92
|
+
- `groovectl label get <id>` / `groovectl label releases <id>`
|
|
93
|
+
- `groovectl collection folders|folder|fields|note|list|contains|add|update|remove|value`
|
|
94
|
+
- `groovectl wantlist list|add|update|remove`
|
|
95
|
+
- `groovectl user profile [username]`
|
|
96
|
+
- `groovectl list ls [username]` / `groovectl list get <list-id>`
|
|
97
|
+
- `groovectl marketplace stats <release-id> [--currency <code>]`
|
|
98
|
+
- `groovectl marketplace price-suggestions <release-id>`
|
|
99
|
+
- `groovectl marketplace listings <release-id> [filters] [--sort <order>] [--limit <n>] [--html <file>]`
|
|
100
|
+
- `groovectl marketplace inventory [username] [--status ...] [--sort ...]`
|
|
101
|
+
- `groovectl marketplace listing get|create|update|delete`
|
|
102
|
+
- `groovectl marketplace orders list|get|update|messages|message`
|
|
103
|
+
- `groovectl marketplace fee <price> [--currency <code>]`
|
|
104
|
+
|
|
105
|
+
Resource commands support `--format table|json|jsonl|tsv` and `--json` as a
|
|
106
|
+
shortcut. Search uses `--output` for output format because its `--format` flag
|
|
107
|
+
filters the release medium (for example Vinyl); `master versions` uses
|
|
108
|
+
`--media-format` to filter release medium alongside `--format` for output. List
|
|
109
|
+
commands support `--page`, `--per-page`, `--all`, and `--limit` (stopping
|
|
110
|
+
pagination as soon as the requested record count is reached). Use global
|
|
111
|
+
`--fields id,title,...` to select and order output fields, `--quiet` (`-q`) to
|
|
112
|
+
suppress informational stderr notices, and `--error-format json` (or
|
|
113
|
+
`GROOVECTL_ERROR_FORMAT=json`) for structured JSON errors on stderr. JSONL
|
|
114
|
+
streams one record per line; JSON arrays are capped at 10,000 records to avoid
|
|
115
|
+
unbounded memory use.
|
|
116
|
+
|
|
117
|
+
## Identifying specific pressings
|
|
118
|
+
|
|
119
|
+
`release get <id>` returns full pressing-identification details without opening
|
|
120
|
+
the Discogs website: `masterId`, `released`, `formats` (including quantity and
|
|
121
|
+
format text such as `180g` or `Gatefold`), `labels` with `catalogNumber`,
|
|
122
|
+
`companies` (pressed/mastered by), `identifiers` (barcode, matrix/runout
|
|
123
|
+
etchings), `tracklist`, `notes`, `community` (`have`, `want`, rating),
|
|
124
|
+
`lowestPrice`, and `numForSale`.
|
|
125
|
+
|
|
126
|
+
```sh
|
|
127
|
+
# 1. Search by catalog number, barcode, or title/artist
|
|
128
|
+
groovectl search --catno "25AP 755" --type release --json
|
|
129
|
+
|
|
130
|
+
# 2. Narrow down a master release to a specific pressing
|
|
131
|
+
groovectl master versions 5460 --country Japan --media-format Vinyl \
|
|
132
|
+
--released 1978 --sort released --sort-order asc --limit 10 --json
|
|
133
|
+
|
|
134
|
+
# 3. Inspect matrix/runout, barcode, tracklist, notes, and demand
|
|
135
|
+
groovectl release get 249504 --currency USD --json
|
|
136
|
+
groovectl release rating get 249504 --json
|
|
137
|
+
groovectl release rating set 249504 5 --dry-run --json
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Collection, Wantlist, Profile, and Lists
|
|
141
|
+
|
|
142
|
+
Collection and Wantlist commands always operate on the identity associated with
|
|
143
|
+
the active token; they do not accept an arbitrary username. `user profile` and
|
|
144
|
+
`list ls` default to the authenticated user when `[username]` is omitted and can
|
|
145
|
+
read public profiles/lists when a username is given.
|
|
146
|
+
|
|
147
|
+
```sh
|
|
148
|
+
groovectl collection folders --json
|
|
149
|
+
groovectl collection folder create "Japanese Pressings" --dry-run --json
|
|
150
|
+
groovectl collection folder rename 2 "Japan OBI Vinyl" --json
|
|
151
|
+
groovectl collection folder delete 3 --yes --json
|
|
152
|
+
|
|
153
|
+
# Inspect custom field IDs (e.g. Media Condition, Sleeve Condition, Notes)
|
|
154
|
+
groovectl collection fields --json
|
|
155
|
+
groovectl collection note set 1 249504 123456 1 "Very Good Plus (VG+)" --dry-run --json
|
|
156
|
+
|
|
157
|
+
# Filter locally across read pages by title, artist, label, catno, or notes
|
|
158
|
+
groovectl collection list --folder 0 --all --query "OBI" --limit 20 --json
|
|
159
|
+
groovectl collection contains 249504 --json
|
|
160
|
+
groovectl collection add 249504 --folder 1 --dry-run --json
|
|
161
|
+
groovectl collection update 1 249504 123456 --rating 5 --dry-run
|
|
162
|
+
groovectl collection remove 1 249504 123456 --yes
|
|
163
|
+
groovectl collection value --json
|
|
164
|
+
|
|
165
|
+
groovectl wantlist list --all --query "Blue Note" --limit 20 --json
|
|
166
|
+
groovectl wantlist add 249504 --rating 5 --notes "Find a clean copy" --dry-run
|
|
167
|
+
groovectl wantlist update 249504 --notes "Prefer first pressing"
|
|
168
|
+
groovectl wantlist remove 249504 --yes
|
|
169
|
+
|
|
170
|
+
groovectl user profile --json
|
|
171
|
+
groovectl list ls --json
|
|
172
|
+
groovectl list get 123456 --json
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
`--dry-run` still authenticates and resolves the current username, but sends no
|
|
176
|
+
write request. Destructive `remove` and `delete` commands prompt interactively;
|
|
177
|
+
automation must pass `--yes`. Non-interactive removal without `--yes` exits with
|
|
178
|
+
code 10. Read and mutation commands validate output format and selected fields
|
|
179
|
+
before sending requests.
|
|
180
|
+
|
|
181
|
+
## Marketplace
|
|
182
|
+
|
|
183
|
+
The official API commands cover release statistics (`stats`), condition-based
|
|
184
|
+
market price suggestions (`price-suggestions`), seller inventories
|
|
185
|
+
(`inventory`), individual listings (`listing get|create|update|delete`), orders
|
|
186
|
+
(`orders list|get|update|messages|message`), and selling fees (`fee`).
|
|
187
|
+
|
|
188
|
+
```sh
|
|
189
|
+
# Release market valuation
|
|
190
|
+
groovectl marketplace stats 249504 --currency USD --json
|
|
191
|
+
groovectl marketplace price-suggestions 249504 --json
|
|
192
|
+
|
|
193
|
+
# Browse any seller's shop (public) or your own inventory (omit username)
|
|
194
|
+
groovectl marketplace inventory some-record-shop --status "For Sale" --sort price --sort-order asc --limit 25 --json
|
|
195
|
+
groovectl marketplace inventory --all --format jsonl
|
|
196
|
+
|
|
197
|
+
# Inspect or manage individual listings (create defaults to Draft; update merges existing fields)
|
|
198
|
+
groovectl marketplace listing get 123456789 --currency EUR --json
|
|
199
|
+
groovectl marketplace listing create 249504 --condition VG+ --sleeve-condition VG+ --price 45.00 --dry-run --json
|
|
200
|
+
groovectl marketplace listing update 123456789 --price 39.99 --dry-run --json
|
|
201
|
+
groovectl marketplace listing delete 123456789 --yes --json
|
|
202
|
+
|
|
203
|
+
# Inspect and manage seller orders and fees
|
|
204
|
+
groovectl marketplace orders list --status "Payment Received" --json
|
|
205
|
+
groovectl marketplace orders get 12345-1 --json
|
|
206
|
+
groovectl marketplace orders messages 12345-1 --json
|
|
207
|
+
groovectl marketplace orders update 12345-1 --status Shipped --dry-run --json
|
|
208
|
+
groovectl marketplace orders message 12345-1 --message "Shipped today" --dry-run --json
|
|
209
|
+
groovectl marketplace fee 45.00 --currency USD --json
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
For `stats`, `listing get`, and `fee`, token input remains optional, and the
|
|
213
|
+
usual token resolution applies without a separate identity lookup. When the API
|
|
214
|
+
requires authentication, an anonymous request exits with
|
|
215
|
+
`GROOVECTL_AUTH_REQUIRED` and instructions for supplying a token. An HTTP 401
|
|
216
|
+
with a supplied token remains `GROOVECTL_AUTH_INVALID`; the CLI does not
|
|
217
|
+
silently discard invalid credentials. An empty `shipping_price: {}` is treated
|
|
218
|
+
as an unknown shipping quote (`shippingPrice: null`), not a zero charge.
|
|
219
|
+
`price-suggestions` requires an authenticated token for an account with Discogs
|
|
220
|
+
seller settings configured.
|
|
221
|
+
|
|
222
|
+
All commands support table, JSON, JSONL, TSV, and `--fields` with top-level
|
|
223
|
+
output field names (for example `price` or `seller`, not `price.value`).
|
|
224
|
+
Monetary values are `{ value, currency }` objects. Missing prices/counts remain
|
|
225
|
+
`null` in JSON/JSONL; table and TSV display null as an empty value. No-stock and
|
|
226
|
+
blocked releases are successful results. A missing listing is a not-found error.
|
|
227
|
+
|
|
228
|
+
Supported currencies: USD, GBP, EUR, CAD, AUD, JPY, CHF, MXN, BRL, NZD, SEK,
|
|
229
|
+
ZAR. Omitting `--currency` leaves the choice to Discogs: stats use USD
|
|
230
|
+
anonymously or the authenticated buyer's currency; fees default to USD.
|
|
231
|
+
Groovectl never converts currencies or calculates fees locally. Fee prices
|
|
232
|
+
accept non-negative decimal notation, not scientific notation or currency
|
|
233
|
+
symbols.
|
|
234
|
+
|
|
235
|
+
Stats contain the lowest **item price**, not a delivered total including
|
|
236
|
+
shipping and taxes. The official API does not document an endpoint to list every
|
|
237
|
+
offer for a release; `listing get` needs an existing listing ID. Public
|
|
238
|
+
`listing get` output uses `release.description` and strips private owner-only
|
|
239
|
+
fields and cart state. `listing update` reads the existing listing internally so
|
|
240
|
+
partial updates (such as changing only `--price`) preserve other listing fields.
|
|
241
|
+
|
|
242
|
+
There is no watch mode, scheduler, notification service, price history, or
|
|
243
|
+
Marketplace cache/state file. Data is read for the current invocation and is not
|
|
244
|
+
persisted or sent to telemetry. Tests use synthetic responses. Data provided by
|
|
245
|
+
Discogs. See the
|
|
246
|
+
[official API documentation](https://www.discogs.com/developers#page:marketplace)
|
|
247
|
+
and
|
|
248
|
+
[API Terms of Use](https://support.discogs.com/hc/en-us/articles/360009334593-API-Terms-of-Use).
|
|
249
|
+
|
|
250
|
+
### Find offers by release (website reader)
|
|
251
|
+
|
|
252
|
+
`marketplace listings` discovers actual item links from a release's English
|
|
253
|
+
Marketplace HTML page using its PJAX request (`_pjax=#pjax_container`,
|
|
254
|
+
`X-PJAX: true`, `X-PJAX-Container: #pjax_container`). Both full saved pages and
|
|
255
|
+
PJAX fragments are supported. It uses the website, **not a release-listings
|
|
256
|
+
API**. Website access is best-effort: Discogs may return HTTP 403 or a challenge
|
|
257
|
+
even when API access works. The command reports that failure instead of
|
|
258
|
+
returning an empty inventory; it does not retry, bypass challenges, use API
|
|
259
|
+
tokens or cookies, or launch a browser. Website requests use Node's HTTPS
|
|
260
|
+
client; API requests continue using their existing transport. A PJAX read of
|
|
261
|
+
release 2980551 returned 22 offers on 2026-10-25, matching the API's sale count.
|
|
262
|
+
This undocumented website route may change independently of the public API.
|
|
263
|
+
|
|
264
|
+
```sh
|
|
265
|
+
groovectl --quiet marketplace listings 2980551 --ships-from "United Kingdom" \
|
|
266
|
+
--currency GBP --min-media "VG+" --min-sleeve "VG+" \
|
|
267
|
+
--max-price 150 --min-seller-rating 99 --sort price-asc --all --limit 10 --json
|
|
268
|
+
|
|
269
|
+
# Alternatively save the English release Marketplace page as HTML in a browser.
|
|
270
|
+
groovectl marketplace listings 2117312 --html "/path/to/saved-page.html" \
|
|
271
|
+
--ships-from "United Kingdom" --min-media "VG+" --json
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
The default reads one page (50 offers); `--page`, `--per-page` (max 100),
|
|
275
|
+
`--all`, `--limit`, and `--sort` (`price-asc`, `price-desc`, `listed-desc`,
|
|
276
|
+
`listed-asc`, `condition-desc`, `condition-asc`) are supported for live reads.
|
|
277
|
+
`--all` reads pages serially, with a 100-page ceiling; `--limit` stops fetching
|
|
278
|
+
further pages once enough matching offers are emitted; a failed later page exits
|
|
279
|
+
nonzero. JSON buffers the result until completion; JSONL can contain partial
|
|
280
|
+
rows before an error. `--html` reads only one supplied page and cannot be
|
|
281
|
+
combined with `--page`, `--all`, or `--sort`. Local HTML is read without network
|
|
282
|
+
access, is limited to 10 MiB, and has unknown freshness. Unrecognized markup,
|
|
283
|
+
wrong releases, inconsistent pagination, and challenge/login pages are errors
|
|
284
|
+
rather than zero offers.
|
|
285
|
+
|
|
286
|
+
Filters apply to the pages read. `--ships-from` filters the **seller's**
|
|
287
|
+
country, not the release's country or the shipping destination. `--currency`
|
|
288
|
+
filters the original item currency; it does not request conversion.
|
|
289
|
+
`--max-price` requires `--currency` and excludes shipping/tax. Grade choices,
|
|
290
|
+
from lowest to highest, are `P`, `F`, `G`, `G+`, `VG`, `VG+`, `NM`, `M`.
|
|
291
|
+
Unknown/generic sleeve grades and unknown ratings do not pass a requested
|
|
292
|
+
minimum. Offers marked unavailable on the page are excluded unless
|
|
293
|
+
`--include-unavailable` is supplied.
|
|
294
|
+
|
|
295
|
+
Each result includes `marketplaceUrl`, item `price`, `condition`,
|
|
296
|
+
`sleeveCondition`, `comments`, `shipsFrom`, `seller` (username, positive
|
|
297
|
+
feedback percentage, feedback count), `shippingText`, `availability`, `source`,
|
|
298
|
+
`sourceUrl`, and `readAt`. `readAt` is the time the CLI parsed the page, not the
|
|
299
|
+
time a saved HTML snapshot was captured. `shippingText` is an unverified page
|
|
300
|
+
quote for the page's destination, which may be unknown; it is not added to the
|
|
301
|
+
price. Grades and playback notes are seller claims, and these offers have not
|
|
302
|
+
been checked against `listing get`. Use that existing command with a candidate
|
|
303
|
+
ID for an independent API check when access permits. No cart state, private
|
|
304
|
+
account fields, or credentials are output.
|
|
305
|
+
|
|
306
|
+
## AI agent & automation usage
|
|
307
|
+
|
|
308
|
+
Groovectl is designed as a pure Discogs CLI that AI agents and scripts can call
|
|
309
|
+
reliably without scraping web pages:
|
|
310
|
+
|
|
311
|
+
- **Discover commands offline**: run `groovectl schema --compact` (or
|
|
312
|
+
`groovectl schema marketplace`) for live machine-readable JSON metadata of
|
|
313
|
+
commands, arguments, options, choices, safety flags, and exit codes.
|
|
314
|
+
- **Structured errors**: pass `--error-format json` or set
|
|
315
|
+
`GROOVECTL_ERROR_FORMAT=json` so every usage, auth, rate-limit, or upstream
|
|
316
|
+
error is emitted as a single JSON object on stderr
|
|
317
|
+
(`{ error: { code, kind, message, remediation, httpStatus, exitCode } }`).
|
|
318
|
+
- **Clean output & token budget**: combine `--quiet`, `--json` (or
|
|
319
|
+
`--format jsonl`), `--fields`, and `--limit` to keep stdout clean and bounded.
|
|
320
|
+
- **Safe non-interactive mutations**: non-TTY invocations never hang on prompts;
|
|
321
|
+
preview every write with `--dry-run`, and pass `--yes` only after explicit
|
|
322
|
+
confirmation for deletions.
|
|
323
|
+
|
|
324
|
+
```sh
|
|
325
|
+
# Recommended environment for AI tool callers
|
|
326
|
+
export GROOVECTL_ERROR_FORMAT=json
|
|
327
|
+
|
|
328
|
+
groovectl schema --compact
|
|
329
|
+
groovectl --quiet search "Kind of Blue" --type master --limit 5 --json
|
|
330
|
+
groovectl --quiet master versions 5460 --country Japan --media-format Vinyl --limit 10 --json
|
|
331
|
+
groovectl --quiet release get 249504 --fields id,title,labels,identifiers,notes,community,lowestPrice,numForSale --json
|
|
332
|
+
groovectl --quiet marketplace price-suggestions 249504 --json
|
|
333
|
+
groovectl --quiet marketplace listings 249504 --min-media VG+ --limit 10 --json
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
## Authentication
|
|
337
|
+
|
|
338
|
+
Public Database reads work anonymously. Database search requires a Discogs User
|
|
339
|
+
Token. Token resolution uses this order:
|
|
340
|
+
|
|
341
|
+
1. `--token-stdin`
|
|
342
|
+
2. `DISCOGS_TOKEN`
|
|
343
|
+
3. an explicit hidden prompt from `--token`
|
|
344
|
+
4. the OS credential store populated by `auth login`
|
|
345
|
+
|
|
346
|
+
```sh
|
|
347
|
+
# Hidden interactive prompt; validates before saving to Keychain/keyring.
|
|
348
|
+
groovectl --token auth login
|
|
349
|
+
|
|
350
|
+
# Temporary token for automation. The token is not persisted.
|
|
351
|
+
printf '%s\n' "$DISCOGS_TOKEN" \
|
|
352
|
+
| groovectl --token-stdin search "Kind of Blue" --type release --json
|
|
353
|
+
|
|
354
|
+
groovectl auth status --json
|
|
355
|
+
groovectl auth logout
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
`auth logout` only deletes the locally stored credential; revoke the token in
|
|
359
|
+
Discogs account settings when it should no longer remain valid.
|
|
360
|
+
|
|
361
|
+
## Configuration
|
|
362
|
+
|
|
363
|
+
Groovectl stores non-secret settings in the platform-standard user config
|
|
364
|
+
directory. Tokens are never written to this file.
|
|
365
|
+
|
|
366
|
+
```sh
|
|
367
|
+
groovectl config get --json
|
|
368
|
+
groovectl config set format jsonl
|
|
369
|
+
groovectl config set timeoutMs 45000
|
|
370
|
+
groovectl config set maxRateLimitWaitMs 60000
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
Supported keys are `format`, `color`, `locale`, `timeoutMs`, and
|
|
374
|
+
`maxRateLimitWaitMs`. `format`, request timeout, and maximum accepted
|
|
375
|
+
`Retry-After` delay are active in P0. `--timeout` overrides the stored timeout
|
|
376
|
+
for each HTTP attempt in one invocation; retries and rate-limit waits can make
|
|
377
|
+
the command's total duration longer. `--verbose` writes sanitized
|
|
378
|
+
method/path/status/timing diagnostics to stderr and never includes tokens, query
|
|
379
|
+
values, or request bodies.
|
|
380
|
+
|
|
381
|
+
## Reliability
|
|
382
|
+
|
|
383
|
+
GET requests use bounded exponential-backoff retries for transient network and
|
|
384
|
+
Discogs 502/503/504 failures. A 429 response is retried only when Discogs sends
|
|
385
|
+
a `Retry-After` value within the configured safety limit. Cross-origin
|
|
386
|
+
pagination URLs are rejected. Write requests are never automatically retried.
|
|
387
|
+
Rate-limit response headers are used to pace subsequent requests, and broken
|
|
388
|
+
pipes exit cleanly for shell pipelines. The native credential store is
|
|
389
|
+
initialized only when accessed; missing keyring services do not prevent help,
|
|
390
|
+
version, config, or explicitly supplied tokens from working. Cancelling an
|
|
391
|
+
interactive prompt exits with code 10.
|
|
392
|
+
|
|
393
|
+
Stable exit-code classes include usage/validation `2`, authentication `3`,
|
|
394
|
+
forbidden `4`, not found `5`, rate limit `6`, upstream `7`, network `8`, and
|
|
395
|
+
cancelled/confirmation-required `10`.
|
|
396
|
+
|
|
397
|
+
## Security
|
|
398
|
+
|
|
399
|
+
Do not report vulnerabilities in public issues. See [SECURITY.md](SECURITY.md).
|
|
400
|
+
|
|
401
|
+
## Publishing
|
|
402
|
+
|
|
403
|
+
Maintainers need Node.js 24+, pnpm 10, and npm publishing access to `groovectl`.
|
|
404
|
+
The package name and version in `package.json` must match the release tag.
|
|
405
|
+
|
|
406
|
+
1. Update the version and changelog, commit the release, and wait for all three
|
|
407
|
+
platform CI jobs to pass for that exact commit.
|
|
408
|
+
2. Run `pnpm release:check` and `pnpm verify:package` from a clean checkout.
|
|
409
|
+
3. Authenticate with `npm login --registry=https://registry.npmjs.org` if
|
|
410
|
+
needed.
|
|
411
|
+
4. Run `npm publish --dry-run`, inspect the payload, then `npm publish`.
|
|
412
|
+
Publishing runs the release checks and builds the distributable
|
|
413
|
+
automatically.
|
|
414
|
+
5. Verify the published version using `npm view groovectl version`, install it
|
|
415
|
+
into an isolated directory, and exercise `groovectl version --json` and help.
|
|
416
|
+
6. Create the matching `vX.Y.Z` tag only after the registry publish succeeds.
|
|
417
|
+
|
|
418
|
+
The existing GitHub workflow validates changes; it does not publish packages.
|
|
419
|
+
The first npm publication uses interactive npm authentication. Future automated
|
|
420
|
+
publishing can use npm Trusted Publishing with a specifically authorized GitHub
|
|
421
|
+
workflow, without storing a long-lived npm publishing token.
|
|
422
|
+
|
|
423
|
+
## License
|
|
424
|
+
|
|
425
|
+
Apache-2.0.
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Security policy
|
|
2
|
+
|
|
3
|
+
Groovectl handles Discogs user tokens and private collection data. Do not submit
|
|
4
|
+
real tokens, account data, or private API responses in public issues.
|
|
5
|
+
|
|
6
|
+
Before the repository is published, the maintainer will add a private security
|
|
7
|
+
contact and GitHub private vulnerability reporting instructions.
|
|
8
|
+
|
|
9
|
+
Until then, keep security reports local and do not publish proof-of-concept
|
|
10
|
+
details.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { CollectionListParameters, DiscogsClient } from "../discogs/client.js";
|
|
2
|
+
import type { CollectionAddResult, CollectionField, CollectionFolder, CollectionItem, CollectionValue } from "../domain/user-resource.js";
|
|
3
|
+
export declare class CollectionService {
|
|
4
|
+
#private;
|
|
5
|
+
constructor(client: DiscogsClient);
|
|
6
|
+
folders(username: string): Promise<CollectionFolder[]>;
|
|
7
|
+
getFolder(username: string, folderId: number): Promise<CollectionFolder>;
|
|
8
|
+
createFolder(username: string, name: string): Promise<CollectionFolder>;
|
|
9
|
+
renameFolder(username: string, folderId: number, name: string): Promise<CollectionFolder>;
|
|
10
|
+
deleteFolder(username: string, folderId: number): Promise<void>;
|
|
11
|
+
fields(username: string): Promise<CollectionField[]>;
|
|
12
|
+
setField(username: string, folderId: number, releaseId: number, instanceId: number, fieldId: number, value: string): Promise<void>;
|
|
13
|
+
list(username: string, folderId: number, parameters: CollectionListParameters): Promise<CollectionItem[]>;
|
|
14
|
+
listAll(username: string, folderId: number, parameters: Omit<CollectionListParameters, "page">): AsyncGenerator<CollectionItem>;
|
|
15
|
+
contains(username: string, releaseId: number): Promise<CollectionItem[]>;
|
|
16
|
+
add(username: string, folderId: number, releaseId: number): Promise<CollectionAddResult>;
|
|
17
|
+
update(username: string, folderId: number, releaseId: number, instanceId: number, update: {
|
|
18
|
+
folder_id?: number;
|
|
19
|
+
rating?: number;
|
|
20
|
+
}): Promise<void>;
|
|
21
|
+
remove(username: string, folderId: number, releaseId: number, instanceId: number): Promise<void>;
|
|
22
|
+
value(username: string): Promise<CollectionValue>;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=collection-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collection-service.d.ts","sourceRoot":"","sources":["../../src/app/collection-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,aAAa,EACd,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EACV,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,eAAe,EAEhB,MAAM,4BAA4B,CAAC;AAGpC,qBAAa,iBAAiB;;gBAGhB,MAAM,EAAE,aAAa;IAI3B,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAMtD,SAAS,CACb,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,gBAAgB,CAAC;IAMtB,YAAY,CAChB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,gBAAgB,CAAC;IAMtB,YAAY,CAChB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,gBAAgB,CAAC;IAMtB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI/D,MAAM,CAAC,QAAQ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icInformation } from "./user-mappers.js";
|
|
2
|
+
export class CollectionService {
|
|
3
|
+
#client;
|
|
4
|
+
constructor(client) {
|
|
5
|
+
this.#client = client;
|
|
6
|
+
}
|
|
7
|
+
async folders(username) {
|
|
8
|
+
return (await this.#client.getCollectionFolders(username)).map((folder) => this.#mapFolder(folder));
|
|
9
|
+
}
|
|
10
|
+
async getFolder(username, folderId) {
|
|
11
|
+
return this.#mapFolder(await this.#client.getCollectionFolder(username, folderId));
|
|
12
|
+
}
|
|
13
|
+
async createFolder(username, name) {
|
|
14
|
+
return this.#mapFolder(await this.#client.createCollectionFolder(username, name));
|
|
15
|
+
}
|
|
16
|
+
async renameFolder(username, folderId, name) {
|
|
17
|
+
return this.#mapFolder(await this.#client.updateCollectionFolder(username, folderId, name));
|
|
18
|
+
}
|
|
19
|
+
async deleteFolder(username, folderId) {
|
|
20
|
+
await this.#client.deleteCollectionFolder(username, folderId);
|
|
21
|
+
}
|
|
22
|
+
async fields(username) {
|
|
23
|
+
return (await this.#client.getCollectionFields(username)).map((field) => ({
|
|
24
|
+
id: field.id,
|
|
25
|
+
name: field.name,
|
|
26
|
+
type: field.type,
|
|
27
|
+
position: field.position,
|
|
28
|
+
public: field.public ?? null,
|
|
29
|
+
lines: field.lines ?? null,
|
|
30
|
+
options: field.options,
|
|
31
|
+
}));
|
|
32
|
+
}
|
|
33
|
+
async setField(username, folderId, releaseId, instanceId, fieldId, value) {
|
|
34
|
+
await this.#client.setCollectionInstanceField(username, folderId, releaseId, instanceId, fieldId, value);
|
|
35
|
+
}
|
|
36
|
+
async list(username, folderId, parameters) {
|
|
37
|
+
return (await this.#client.getCollectionItems(username, folderId, parameters)).map((item) => this.#mapItem(item));
|
|
38
|
+
}
|
|
39
|
+
async *listAll(username, folderId, parameters) {
|
|
40
|
+
for await (const item of this.#client.getCollectionItemsAll(username, folderId, parameters)) {
|
|
41
|
+
yield this.#mapItem(item);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
async contains(username, releaseId) {
|
|
45
|
+
return (await this.#client.getCollectionItemsByRelease(username, releaseId)).map((item) => this.#mapItem(item));
|
|
46
|
+
}
|
|
47
|
+
async add(username, folderId, releaseId) {
|
|
48
|
+
const result = await this.#client.addToCollection(username, folderId, releaseId);
|
|
49
|
+
return {
|
|
50
|
+
releaseId,
|
|
51
|
+
folderId,
|
|
52
|
+
instanceId: result.instance_id,
|
|
53
|
+
resourceUrl: result.resource_url,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
async update(username, folderId, releaseId, instanceId, update) {
|
|
57
|
+
await this.#client.updateCollectionInstance(username, folderId, releaseId, instanceId, update);
|
|
58
|
+
}
|
|
59
|
+
async remove(username, folderId, releaseId, instanceId) {
|
|
60
|
+
await this.#client.removeCollectionInstance(username, folderId, releaseId, instanceId);
|
|
61
|
+
}
|
|
62
|
+
async value(username) {
|
|
63
|
+
const value = await this.#client.getCollectionValue(username);
|
|
64
|
+
return {
|
|
65
|
+
minimum: parseMoney(value.minimum),
|
|
66
|
+
median: parseMoney(value.median),
|
|
67
|
+
maximum: parseMoney(value.maximum),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
#mapFolder(folder) {
|
|
71
|
+
return {
|
|
72
|
+
id: folder.id,
|
|
73
|
+
name: folder.name,
|
|
74
|
+
count: folder.count,
|
|
75
|
+
resourceUrl: folder.resource_url,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
#mapItem(item) {
|
|
79
|
+
return {
|
|
80
|
+
...mapBasicInformation(item.basic_information),
|
|
81
|
+
instanceId: item.instance_id,
|
|
82
|
+
folderId: item.folder_id,
|
|
83
|
+
rating: item.rating,
|
|
84
|
+
dateAdded: item.date_added ?? null,
|
|
85
|
+
notes: item.notes.map((note) => ({
|
|
86
|
+
fieldId: note.field_id,
|
|
87
|
+
value: note.value,
|
|
88
|
+
})),
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
const currencyTokens = [
|
|
93
|
+
["CA$", "CAD"],
|
|
94
|
+
["AU$", "AUD"],
|
|
95
|
+
["A$", "AUD"],
|
|
96
|
+
["NZ$", "NZD"],
|
|
97
|
+
["MX$", "MXN"],
|
|
98
|
+
["R$", "BRL"],
|
|
99
|
+
["US$", "USD"],
|
|
100
|
+
["CHF", "CHF"],
|
|
101
|
+
["SEK", "SEK"],
|
|
102
|
+
["ZAR", "ZAR"],
|
|
103
|
+
["CAD", "CAD"],
|
|
104
|
+
["AUD", "AUD"],
|
|
105
|
+
["NZD", "NZD"],
|
|
106
|
+
["MXN", "MXN"],
|
|
107
|
+
["BRL", "BRL"],
|
|
108
|
+
["USD", "USD"],
|
|
109
|
+
["EUR", "EUR"],
|
|
110
|
+
["GBP", "GBP"],
|
|
111
|
+
["JPY", "JPY"],
|
|
112
|
+
["€", "EUR"],
|
|
113
|
+
["£", "GBP"],
|
|
114
|
+
["¥", "JPY"],
|
|
115
|
+
];
|
|
116
|
+
function parseMoney(display) {
|
|
117
|
+
const matched = currencyTokens.find(([token]) => display.includes(token))?.[1];
|
|
118
|
+
const currency = matched ?? (/(?<![A-Za-z])\$/u.test(display) ? "USD" : null);
|
|
119
|
+
const normalized = display.replace(/[^0-9.,-]/gu, "").replaceAll(",", "");
|
|
120
|
+
const parsed = /^-?\d+(?:\.\d+)?$/u.test(normalized)
|
|
121
|
+
? Number(normalized)
|
|
122
|
+
: Number.NaN;
|
|
123
|
+
return {
|
|
124
|
+
value: Number.isFinite(parsed) ? parsed : null,
|
|
125
|
+
currency,
|
|
126
|
+
display,
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=collection-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collection-service.js","sourceRoot":"","sources":["../../src/app/collection-service.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,MAAM,OAAO,iBAAiB;IACnB,OAAO,CAAgB;IAEhC,YAAY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AAG,EAAE,KAAK,CAAC;IACZ,CAAC,GAAG,EAAE,KAAK,CAAC;IACZ,CAAC,GAAG,EAAE,KAAK,CAAC;CACb,CAAC;AAEF,SAAS,UAAU,CAAC,OAAe;IACjC,MAAM,OAAO,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,CAC9C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CACxB,EAAE,CAAC,CAAC,CAAC,CAAC;IACP,MAAM,QAAQ,GAAG,OAAO,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAC9E,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IAC1E,MAAM,MAAM,GAAG,oBAAoB,CAAC,IAAI,CAAC,UAAU,CAAC;QAClD,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC;QACpB,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;IACf,OAAO;QACL,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI;QAC9C,QAAQ;QACR,OAAO;KACR,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ArtistReleasesParameters, DiscogsClient, MasterVersionsParameters, PaginationParameters, SearchParameters } from "../discogs/client.js";
|
|
2
|
+
import type { Artist, ArtistRelease, Label, LabelRelease, Master, MasterVersion } from "../domain/database-resource.js";
|
|
3
|
+
import type { MarketplaceCurrency } from "../domain/marketplace.js";
|
|
4
|
+
import type { Release, ReleaseCommunityRating, ReleaseUserRating } from "../domain/release.js";
|
|
5
|
+
import type { SearchResult } from "../domain/search-result.js";
|
|
6
|
+
export declare class DatabaseService {
|
|
7
|
+
#private;
|
|
8
|
+
constructor(client: DiscogsClient);
|
|
9
|
+
getRelease(id: number, currency?: MarketplaceCurrency): Promise<Release>;
|
|
10
|
+
getReleaseCommunityRating(id: number): Promise<ReleaseCommunityRating>;
|
|
11
|
+
getReleaseUserRating(id: number, username: string): Promise<ReleaseUserRating>;
|
|
12
|
+
setReleaseRating(id: number, username: string, rating: number): Promise<ReleaseUserRating>;
|
|
13
|
+
deleteReleaseRating(id: number, username: string): Promise<void>;
|
|
14
|
+
search(parameters: SearchParameters): Promise<SearchResult[]>;
|
|
15
|
+
getMaster(id: number): Promise<Master>;
|
|
16
|
+
getMasterVersions(id: number, parameters: MasterVersionsParameters): Promise<MasterVersion[]>;
|
|
17
|
+
getMasterVersionsAll(id: number, parameters: Omit<MasterVersionsParameters, "page">): AsyncGenerator<MasterVersion>;
|
|
18
|
+
getArtist(id: number): Promise<Artist>;
|
|
19
|
+
getArtistReleases(id: number, parameters: ArtistReleasesParameters): Promise<ArtistRelease[]>;
|
|
20
|
+
getArtistReleasesAll(id: number, parameters: Omit<ArtistReleasesParameters, "page">): AsyncGenerator<ArtistRelease>;
|
|
21
|
+
getLabel(id: number): Promise<Label>;
|
|
22
|
+
getLabelReleases(id: number, parameters: PaginationParameters): Promise<LabelRelease[]>;
|
|
23
|
+
getLabelReleasesAll(id: number, parameters: Omit<PaginationParameters, "page">): AsyncGenerator<LabelRelease>;
|
|
24
|
+
searchAll(parameters: SearchParameters): AsyncGenerator<SearchResult>;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=database-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"database-service.d.ts","sourceRoot":"","sources":["../../src/app/database-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,aAAa,EACb,wBAAwB,EACxB,oBAAoB,EACpB,gBAAgB,EACjB,MAAM,sBAAsB,CAAC;AAO9B,OAAO,KAAK,EACV,MAAM,EACN,aAAa,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