@vltpkg/vsr 0.0.0-27 → 0.0.0-29
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/DEPLOY.md +163 -0
- package/LICENSE +114 -10
- package/config.ts +221 -0
- package/dist/README.md +1 -1
- package/dist/bin/vsr.js +9 -6
- package/dist/index.js +4 -6
- package/dist/index.js.map +2 -2
- package/drizzle.config.js +40 -0
- package/info/COMPARISONS.md +37 -0
- package/info/CONFIGURATION.md +143 -0
- package/info/CONTRIBUTING.md +32 -0
- package/info/DATABASE_SETUP.md +108 -0
- package/info/GRANULAR_ACCESS_TOKENS.md +160 -0
- package/info/PROJECT_STRUCTURE.md +291 -0
- package/info/ROADMAP.md +27 -0
- package/info/SUPPORT.md +39 -0
- package/info/TESTING.md +301 -0
- package/info/USER_SUPPORT.md +31 -0
- package/package.json +50 -6
- package/scripts/build-assets.js +31 -0
- package/scripts/build-bin.js +63 -0
- package/src/assets/public/images/bg.png +0 -0
- package/src/assets/public/images/clients/logo-bun.png +0 -0
- package/src/assets/public/images/clients/logo-deno.png +0 -0
- package/src/assets/public/images/clients/logo-npm.png +0 -0
- package/src/assets/public/images/clients/logo-pnpm.png +0 -0
- package/src/assets/public/images/clients/logo-vlt.png +0 -0
- package/src/assets/public/images/clients/logo-yarn.png +0 -0
- package/src/assets/public/images/favicon/apple-touch-icon.png +0 -0
- package/src/assets/public/images/favicon/favicon-96x96.png +0 -0
- package/src/assets/public/images/favicon/favicon.ico +0 -0
- package/src/assets/public/images/favicon/favicon.svg +3 -0
- package/src/assets/public/images/favicon/site.webmanifest +21 -0
- package/src/assets/public/images/favicon/web-app-manifest-192x192.png +0 -0
- package/src/assets/public/images/favicon/web-app-manifest-512x512.png +0 -0
- package/src/assets/public/styles/styles.css +231 -0
- package/src/bin/demo/package.json +6 -0
- package/src/bin/demo/vlt.json +1 -0
- package/src/bin/vsr.ts +496 -0
- package/src/db/client.ts +590 -0
- package/src/db/migrations/0000_faulty_ricochet.sql +14 -0
- package/src/db/migrations/0000_initial.sql +29 -0
- package/src/db/migrations/0001_uuid_validation.sql +35 -0
- package/src/db/migrations/0001_wealthy_magdalene.sql +7 -0
- package/src/db/migrations/drop.sql +3 -0
- package/src/db/migrations/meta/0000_snapshot.json +104 -0
- package/src/db/migrations/meta/0001_snapshot.json +155 -0
- package/src/db/migrations/meta/_journal.json +20 -0
- package/src/db/schema.ts +43 -0
- package/src/index.ts +434 -0
- package/src/middleware/config.ts +79 -0
- package/src/middleware/telemetry.ts +43 -0
- package/src/queue/index.ts +97 -0
- package/src/routes/access.ts +852 -0
- package/src/routes/docs.ts +63 -0
- package/src/routes/misc.ts +469 -0
- package/src/routes/packages.ts +2823 -0
- package/src/routes/ping.ts +39 -0
- package/src/routes/search.ts +131 -0
- package/src/routes/static.ts +74 -0
- package/src/routes/tokens.ts +259 -0
- package/src/routes/users.ts +68 -0
- package/src/utils/auth.ts +202 -0
- package/src/utils/cache.ts +587 -0
- package/src/utils/config.ts +50 -0
- package/src/utils/database.ts +69 -0
- package/src/utils/docs.ts +146 -0
- package/src/utils/packages.ts +453 -0
- package/src/utils/response.ts +125 -0
- package/src/utils/routes.ts +64 -0
- package/src/utils/spa.ts +52 -0
- package/src/utils/tracing.ts +52 -0
- package/src/utils/upstream.ts +172 -0
- package/tsconfig.json +16 -0
- package/tsconfig.worker.json +3 -0
- package/typedoc.mjs +2 -0
- package/types.ts +598 -0
- package/vitest.config.ts +25 -0
- package/vlt.json.example +56 -0
- package/wrangler.json +65 -0
package/DEPLOY.md
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# VSR Deploy Command
|
|
2
|
+
|
|
3
|
+
The VSR CLI now includes a `deploy` subcommand that allows you to
|
|
4
|
+
deploy your VSR instance to Cloudflare Workers using configuration
|
|
5
|
+
from your `vlt.json` file.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# Deploy to default environment (dev)
|
|
11
|
+
vsr deploy
|
|
12
|
+
|
|
13
|
+
# Deploy to specific environment
|
|
14
|
+
vsr deploy --env=prod
|
|
15
|
+
|
|
16
|
+
# Preview deployment without actually deploying
|
|
17
|
+
vsr deploy --dry-run
|
|
18
|
+
|
|
19
|
+
# Override specific resource names
|
|
20
|
+
vsr deploy --env=staging --db-name=my-custom-db --bucket-name=my-custom-bucket
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Configuration
|
|
24
|
+
|
|
25
|
+
Add a `deploy` section to your `vlt.json` file under the `registry`
|
|
26
|
+
key:
|
|
27
|
+
|
|
28
|
+
```json
|
|
29
|
+
{
|
|
30
|
+
"registry": {
|
|
31
|
+
"deploy": {
|
|
32
|
+
"sentry": {
|
|
33
|
+
"dsn": "https://your-default-sentry-dsn@sentry.io/project-id",
|
|
34
|
+
"sampleRate": 1.0,
|
|
35
|
+
"tracesSampleRate": 0.1
|
|
36
|
+
},
|
|
37
|
+
"environments": {
|
|
38
|
+
"dev": {
|
|
39
|
+
"databaseName": "vsr-dev-database",
|
|
40
|
+
"bucketName": "vsr-dev-bucket",
|
|
41
|
+
"queueName": "vsr-dev-cache-refresh-queue",
|
|
42
|
+
"sentry": {
|
|
43
|
+
"environment": "development"
|
|
44
|
+
},
|
|
45
|
+
"vars": {
|
|
46
|
+
"CUSTOM_VAR": "dev-value"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"prod": {
|
|
50
|
+
"databaseName": "vsr-prod-database",
|
|
51
|
+
"bucketName": "vsr-prod-bucket",
|
|
52
|
+
"queueName": "vsr-prod-cache-refresh-queue",
|
|
53
|
+
"sentry": {
|
|
54
|
+
"environment": "production",
|
|
55
|
+
"dsn": "https://your-prod-sentry-dsn@sentry.io/project-id",
|
|
56
|
+
"sampleRate": 0.1,
|
|
57
|
+
"tracesSampleRate": 0.01
|
|
58
|
+
},
|
|
59
|
+
"vars": {
|
|
60
|
+
"API_BASE_URL": "https://api.example.com"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Configuration Options
|
|
70
|
+
|
|
71
|
+
### Global Deploy Settings
|
|
72
|
+
|
|
73
|
+
- `sentry.dsn`: Default Sentry DSN for error reporting
|
|
74
|
+
- `sentry.sampleRate`: Default error sample rate (0.0 to 1.0)
|
|
75
|
+
- `sentry.tracesSampleRate`: Default performance traces sample rate
|
|
76
|
+
(0.0 to 1.0)
|
|
77
|
+
|
|
78
|
+
### Environment-Specific Settings
|
|
79
|
+
|
|
80
|
+
Each environment can override any global setting and specify:
|
|
81
|
+
|
|
82
|
+
- `databaseName`: D1 database name for this environment
|
|
83
|
+
- `bucketName`: R2 bucket name for this environment
|
|
84
|
+
- `queueName`: Queue name for cache refresh operations
|
|
85
|
+
- `sentry`: Environment-specific Sentry configuration
|
|
86
|
+
- `vars`: Custom environment variables to pass to the Worker
|
|
87
|
+
|
|
88
|
+
### CLI Options
|
|
89
|
+
|
|
90
|
+
- `--env=<string>`: Environment to deploy to (defaults to "dev")
|
|
91
|
+
- `--db-name=<string>`: Override D1 database name
|
|
92
|
+
- `--bucket-name=<string>`: Override R2 bucket name
|
|
93
|
+
- `--queue-name=<string>`: Override queue name
|
|
94
|
+
- `--dry-run`: Show what would be deployed without actually deploying
|
|
95
|
+
|
|
96
|
+
## Precedence
|
|
97
|
+
|
|
98
|
+
Configuration values are resolved in the following order (highest
|
|
99
|
+
precedence first):
|
|
100
|
+
|
|
101
|
+
1. CLI arguments (`--db-name`, `--bucket-name`, etc.)
|
|
102
|
+
2. Environment-specific config (`environments.prod.databaseName`)
|
|
103
|
+
3. Default values
|
|
104
|
+
|
|
105
|
+
## Examples
|
|
106
|
+
|
|
107
|
+
### Basic Deployment
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
# Deploy to development environment
|
|
111
|
+
vsr deploy --env=dev
|
|
112
|
+
|
|
113
|
+
# Deploy to production
|
|
114
|
+
vsr deploy --env=prod
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Custom Resource Names
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
# Override database and bucket names
|
|
121
|
+
vsr deploy --env=staging --db-name=my-staging-db --bucket-name=my-staging-bucket
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Preview Deployment
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
# See what would be deployed without actually deploying
|
|
128
|
+
vsr deploy --env=prod --dry-run
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Using Custom Config File
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
# Use a specific vlt.json file
|
|
135
|
+
vsr deploy --config=/path/to/custom-vlt.json --env=prod
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Generated Wrangler Command
|
|
139
|
+
|
|
140
|
+
The deploy command generates a `wrangler deploy` command with the
|
|
141
|
+
appropriate bindings and variables. For example:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
wrangler deploy dist/index.js \
|
|
145
|
+
--name vsr-prod \
|
|
146
|
+
--compatibility-date 2024-09-23 \
|
|
147
|
+
--var SENTRY_DSN:https://your-sentry-dsn@sentry.io/project-id \
|
|
148
|
+
--var SENTRY_ENVIRONMENT:production \
|
|
149
|
+
--var ARG_DEBUG:false \
|
|
150
|
+
--var ARG_TELEMETRY:true \
|
|
151
|
+
--var ARG_DAEMON:true \
|
|
152
|
+
--d1 DB=vsr-prod-database \
|
|
153
|
+
--r2 BUCKET=vsr-prod-bucket \
|
|
154
|
+
--queue-producer CACHE_REFRESH_QUEUE=vsr-prod-cache-refresh-queue \
|
|
155
|
+
--queue-consumer vsr-prod-cache-refresh-queue
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## Prerequisites
|
|
159
|
+
|
|
160
|
+
- Wrangler CLI must be installed and authenticated
|
|
161
|
+
- Cloudflare Workers account with appropriate permissions
|
|
162
|
+
- D1 databases, R2 buckets, and queues must exist (or be created by
|
|
163
|
+
Wrangler)
|
package/LICENSE
CHANGED
|
@@ -1,15 +1,119 @@
|
|
|
1
|
-
|
|
1
|
+
# Functional Source License, Version 1.1, MIT Future License
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## Abbreviation
|
|
4
4
|
|
|
5
|
-
1.
|
|
6
|
-
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
7
|
-
Subject to the terms and conditions of this license, each copyright holder and contributor hereby grants to those receiving rights under this license a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except for failure to satisfy the conditions of this license) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer this software, where such license applies only to those patent claims, already acquired or hereafter acquired, licensable by such copyright holder or contributor that are necessarily infringed by:
|
|
5
|
+
FSL-1.1-MIT
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
(b) combination of their Contribution(s) with the work of authorship to which such Contribution(s) was added by such copyright holder or contributor, if, at the time the Contribution is added, such addition causes such combination to be necessarily infringed. The patent license shall not apply to any other combinations which include the Contribution.
|
|
11
|
-
Except as expressly stated above, no rights or licenses from any copyright holder or contributor is granted under this license, whether expressly, by implication, estoppel or otherwise.
|
|
7
|
+
## Notice
|
|
12
8
|
|
|
13
|
-
|
|
9
|
+
Copyright 2025 vlt technology Inc.
|
|
14
10
|
|
|
15
|
-
|
|
11
|
+
## Terms and Conditions
|
|
12
|
+
|
|
13
|
+
### Licensor ("We")
|
|
14
|
+
|
|
15
|
+
The party offering the Software under these Terms and Conditions.
|
|
16
|
+
|
|
17
|
+
### The Software
|
|
18
|
+
|
|
19
|
+
The "Software" is each version of the software that we make available
|
|
20
|
+
under these Terms and Conditions, as indicated by our inclusion of
|
|
21
|
+
these Terms and Conditions with the Software.
|
|
22
|
+
|
|
23
|
+
### License Grant
|
|
24
|
+
|
|
25
|
+
Subject to your compliance with this License Grant and the Patents,
|
|
26
|
+
Redistribution and Trademark clauses below, we hereby grant you the
|
|
27
|
+
right to use, copy, modify, create derivative works, publicly perform,
|
|
28
|
+
publicly display and redistribute the Software for any Permitted
|
|
29
|
+
Purpose identified below.
|
|
30
|
+
|
|
31
|
+
### Permitted Purpose
|
|
32
|
+
|
|
33
|
+
A Permitted Purpose is any purpose other than a Competing Use. A
|
|
34
|
+
Competing Use means making the Software available to others in a
|
|
35
|
+
commercial product or service that:
|
|
36
|
+
|
|
37
|
+
1. substitutes for the Software;
|
|
38
|
+
|
|
39
|
+
2. substitutes for any other product or service we offer using the
|
|
40
|
+
Software that exists as of the date we make the Software available;
|
|
41
|
+
or
|
|
42
|
+
|
|
43
|
+
3. offers the same or substantially similar functionality as the
|
|
44
|
+
Software.
|
|
45
|
+
|
|
46
|
+
Permitted Purposes specifically include using the Software:
|
|
47
|
+
|
|
48
|
+
1. for your internal use and access;
|
|
49
|
+
|
|
50
|
+
2. for non-commercial education;
|
|
51
|
+
|
|
52
|
+
3. for non-commercial research; and
|
|
53
|
+
|
|
54
|
+
4. in connection with professional services that you provide to a
|
|
55
|
+
licensee using the Software in accordance with these Terms and
|
|
56
|
+
Conditions.
|
|
57
|
+
|
|
58
|
+
### Patents
|
|
59
|
+
|
|
60
|
+
To the extent your use for a Permitted Purpose would necessarily
|
|
61
|
+
infringe our patents, the license grant above includes a license under
|
|
62
|
+
our patents. If you make a claim against any party that the Software
|
|
63
|
+
infringes or contributes to the infringement of any patent, then your
|
|
64
|
+
patent license to the Software ends immediately.
|
|
65
|
+
|
|
66
|
+
### Redistribution
|
|
67
|
+
|
|
68
|
+
The Terms and Conditions apply to all copies, modifications and
|
|
69
|
+
derivatives of the Software.
|
|
70
|
+
|
|
71
|
+
If you redistribute any copies, modifications or derivatives of the
|
|
72
|
+
Software, you must include a copy of or a link to these Terms and
|
|
73
|
+
Conditions and not remove any copyright notices provided in or with
|
|
74
|
+
the Software.
|
|
75
|
+
|
|
76
|
+
### Disclaimer
|
|
77
|
+
|
|
78
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND,
|
|
79
|
+
EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS
|
|
80
|
+
FOR A PARTICULAR PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
|
|
81
|
+
|
|
82
|
+
IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR
|
|
83
|
+
RELATED TO THE SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR
|
|
84
|
+
CONSEQUENTIAL DAMAGES, EVEN IF WE HAVE BEEN INFORMED OF THEIR
|
|
85
|
+
POSSIBILITY IN ADVANCE.
|
|
86
|
+
|
|
87
|
+
### Trademarks
|
|
88
|
+
|
|
89
|
+
Except for displaying the License Details and identifying us as the
|
|
90
|
+
origin of the Software, you have no right under these Terms and
|
|
91
|
+
Conditions to use our trademarks, trade names, service marks or
|
|
92
|
+
product names.
|
|
93
|
+
|
|
94
|
+
## Grant of Future License
|
|
95
|
+
|
|
96
|
+
We hereby irrevocably grant you an additional license to use the
|
|
97
|
+
Software under the MIT license that is effective on the second
|
|
98
|
+
anniversary of the date we make the Software available. On or after
|
|
99
|
+
that date, you may use the Software under the MIT license, in which
|
|
100
|
+
case the following will apply:
|
|
101
|
+
|
|
102
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
103
|
+
a copy of this software and associated documentation files (the
|
|
104
|
+
"Software"), to deal in the Software without restriction, including
|
|
105
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
106
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
107
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
108
|
+
the following conditions:
|
|
109
|
+
|
|
110
|
+
The above copyright notice and this permission notice shall be
|
|
111
|
+
included in all copies or substantial portions of the Software.
|
|
112
|
+
|
|
113
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
114
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
115
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
116
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
117
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
118
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
119
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/config.ts
ADDED
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
// get openapi schema
|
|
2
|
+
import wranglerJson from './wrangler.json' with { type: 'json' }
|
|
3
|
+
import packageJson from './package.json' with { type: 'json' }
|
|
4
|
+
import { apiBody } from './src/utils/docs.ts'
|
|
5
|
+
import type {
|
|
6
|
+
OriginConfig,
|
|
7
|
+
CookieOptions,
|
|
8
|
+
ApiDocsConfig,
|
|
9
|
+
} from './types.ts'
|
|
10
|
+
|
|
11
|
+
export const YEAR = new Date().getFullYear()
|
|
12
|
+
|
|
13
|
+
export const WRANGLER_CONFIG = wranglerJson.dev
|
|
14
|
+
|
|
15
|
+
export const PORT = WRANGLER_CONFIG.port || (1337 as number)
|
|
16
|
+
|
|
17
|
+
export const TELEMETRY_ENABLED = true as boolean
|
|
18
|
+
|
|
19
|
+
export const HELP_ENABLED = false as boolean
|
|
20
|
+
|
|
21
|
+
// Sentry configuration for error reporting (when telemetry is enabled)
|
|
22
|
+
export const SENTRY_CONFIG = {
|
|
23
|
+
dsn: 'https://909b085eb764c00250ad312660c2fdf1@o4506397716054016.ingest.us.sentry.io/4509492612300800',
|
|
24
|
+
sendDefaultPii: true,
|
|
25
|
+
environment: 'development', // Will be overridden by environment variable
|
|
26
|
+
sampleRate: 1.0,
|
|
27
|
+
tracesSampleRate: 0.1, // Lower sample rate for performance traces
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const DEBUG_ENABLED = false as boolean
|
|
31
|
+
|
|
32
|
+
export const API_DOCS_ENABLED = true as boolean
|
|
33
|
+
|
|
34
|
+
export const DAEMON_ENABLED = true as boolean
|
|
35
|
+
|
|
36
|
+
export const DAEMON_PORT = 3000 as number
|
|
37
|
+
|
|
38
|
+
// Runtime configuration is now handled by configMiddleware
|
|
39
|
+
// which enriches c.env with computed values like DAEMON_ENABLED, TELEMETRY_ENABLED, etc.
|
|
40
|
+
|
|
41
|
+
export const DAEMON_URL = `http://localhost:${DAEMON_PORT}`
|
|
42
|
+
|
|
43
|
+
export const VERSION: string = packageJson.version
|
|
44
|
+
|
|
45
|
+
export const URL = `http://localhost:${PORT}`
|
|
46
|
+
|
|
47
|
+
export const REDIRECT_URI = `${URL}/-/auth/callback`
|
|
48
|
+
|
|
49
|
+
// how to handle packages requests
|
|
50
|
+
export const ORIGIN_CONFIG: OriginConfig = {
|
|
51
|
+
default: 'local',
|
|
52
|
+
upstreams: {
|
|
53
|
+
local: {
|
|
54
|
+
type: 'local',
|
|
55
|
+
url: URL,
|
|
56
|
+
allowPublish: true,
|
|
57
|
+
},
|
|
58
|
+
npm: {
|
|
59
|
+
type: 'npm',
|
|
60
|
+
url: 'https://registry.npmjs.org',
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Reserved route prefixes that cannot be used as upstream names
|
|
66
|
+
export const RESERVED_ROUTES: string[] = [
|
|
67
|
+
'-',
|
|
68
|
+
'user',
|
|
69
|
+
'docs',
|
|
70
|
+
'search',
|
|
71
|
+
'tokens',
|
|
72
|
+
'auth',
|
|
73
|
+
'ping',
|
|
74
|
+
'package',
|
|
75
|
+
'v1',
|
|
76
|
+
'api',
|
|
77
|
+
'admin',
|
|
78
|
+
'*', // Reserved for hash-based routes
|
|
79
|
+
]
|
|
80
|
+
|
|
81
|
+
// Backward compatibility - maintain old PROXY behavior
|
|
82
|
+
export const PROXY: boolean =
|
|
83
|
+
Object.keys(ORIGIN_CONFIG.upstreams).length > 1
|
|
84
|
+
|
|
85
|
+
export const PROXY_URL: string | undefined =
|
|
86
|
+
ORIGIN_CONFIG.upstreams[ORIGIN_CONFIG.default]?.url
|
|
87
|
+
|
|
88
|
+
// the time in seconds to cache the registry
|
|
89
|
+
export const REQUEST_TIMEOUT: number = 60 * 1000
|
|
90
|
+
|
|
91
|
+
// cookie options
|
|
92
|
+
export const COOKIE_OPTIONS: CookieOptions = {
|
|
93
|
+
path: '/',
|
|
94
|
+
httpOnly: true,
|
|
95
|
+
secure: true,
|
|
96
|
+
sameSite: 'strict',
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// OpenAPI Docs
|
|
100
|
+
export const OPEN_API_CONFIG = {
|
|
101
|
+
openapi: '3.1.0',
|
|
102
|
+
info: {
|
|
103
|
+
title: 'vlt serverless registry',
|
|
104
|
+
version: VERSION,
|
|
105
|
+
description: 'The vlt serverless registry API',
|
|
106
|
+
},
|
|
107
|
+
tags: [
|
|
108
|
+
{
|
|
109
|
+
name: 'Health Check',
|
|
110
|
+
description: 'Registry health and status endpoints',
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
name: 'Authentication',
|
|
114
|
+
description: 'User authentication and token management',
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
name: 'Packages',
|
|
118
|
+
description: 'Package publishing, downloading, and management',
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
name: 'Dist-Tags',
|
|
122
|
+
description: 'Package version tagging and lifecycle management',
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
name: 'Access Control',
|
|
126
|
+
description:
|
|
127
|
+
'Package access permissions and collaborator management',
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
name: 'Search',
|
|
131
|
+
description: 'Package discovery and search functionality',
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
name: 'Security',
|
|
135
|
+
description: 'Security auditing and vulnerability scanning',
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
name: 'Dashboard',
|
|
139
|
+
description: 'Registry dashboard and administration',
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
name: 'Static Assets',
|
|
143
|
+
description: 'Static file serving and web assets',
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
name: 'NPM Compatibility',
|
|
147
|
+
description: 'Legacy npm client compatibility redirects',
|
|
148
|
+
},
|
|
149
|
+
],
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// the docs configuration for the API reference
|
|
153
|
+
export const SCALAR_API_CONFIG: ApiDocsConfig = {
|
|
154
|
+
metaData: {
|
|
155
|
+
title: 'vlt serverless registry',
|
|
156
|
+
},
|
|
157
|
+
hideModels: false,
|
|
158
|
+
hideDownloadButton: false,
|
|
159
|
+
darkMode: false,
|
|
160
|
+
favicon: '/public/images/favicon/favicon.svg',
|
|
161
|
+
defaultHttpClient: {
|
|
162
|
+
targetKey: 'curl',
|
|
163
|
+
clientKey: 'fetch',
|
|
164
|
+
},
|
|
165
|
+
authentication: {
|
|
166
|
+
http: {
|
|
167
|
+
bearer: {
|
|
168
|
+
token: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
|
|
169
|
+
},
|
|
170
|
+
basic: {
|
|
171
|
+
username: 'user',
|
|
172
|
+
password: 'pass',
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
hiddenClients: {
|
|
177
|
+
python: true,
|
|
178
|
+
c: true,
|
|
179
|
+
go: true,
|
|
180
|
+
java: true,
|
|
181
|
+
ruby: true,
|
|
182
|
+
shell: ['httpie', 'wget', 'fetch'],
|
|
183
|
+
clojure: true,
|
|
184
|
+
csharp: true,
|
|
185
|
+
kotlin: true,
|
|
186
|
+
objc: true,
|
|
187
|
+
swift: true,
|
|
188
|
+
r: true,
|
|
189
|
+
powershell: false,
|
|
190
|
+
ocaml: true,
|
|
191
|
+
curl: false,
|
|
192
|
+
http: true,
|
|
193
|
+
php: true,
|
|
194
|
+
node: ['request', 'unirest'],
|
|
195
|
+
javascript: ['xhr', 'jquery'],
|
|
196
|
+
},
|
|
197
|
+
spec: {
|
|
198
|
+
content: {
|
|
199
|
+
openapi: OPEN_API_CONFIG.openapi,
|
|
200
|
+
servers: [
|
|
201
|
+
{
|
|
202
|
+
url: URL,
|
|
203
|
+
description: 'localhost',
|
|
204
|
+
},
|
|
205
|
+
],
|
|
206
|
+
info: {
|
|
207
|
+
title: 'vlt serverless registry',
|
|
208
|
+
version: VERSION,
|
|
209
|
+
license: {
|
|
210
|
+
identifier: 'FSL-1.1-MIT',
|
|
211
|
+
name: 'Functional Source License, Version 1.1, MIT Future License',
|
|
212
|
+
url: 'https://fsl.software/FSL-1.1-MIT.template.md',
|
|
213
|
+
},
|
|
214
|
+
description: apiBody({ YEAR }),
|
|
215
|
+
},
|
|
216
|
+
// Include tag ordering and descriptions
|
|
217
|
+
tags: OPEN_API_CONFIG.tags,
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
customCss: `@import '${URL}/public/styles/styles.css';`,
|
|
221
|
+
}
|
package/dist/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
This folder contains the built output assets for the worker "vsr" generated at 2025-09-
|
|
1
|
+
This folder contains the built output assets for the worker "vsr" generated at 2025-09-04T04:15:41.930Z.
|
package/dist/bin/vsr.js
CHANGED
|
@@ -80,7 +80,7 @@ var wrangler_default = {
|
|
|
80
80
|
// package.json
|
|
81
81
|
var package_default = {
|
|
82
82
|
name: "@vltpkg/vsr",
|
|
83
|
-
version: "0.0.0-
|
|
83
|
+
version: "0.0.0-29",
|
|
84
84
|
repository: {
|
|
85
85
|
type: "git",
|
|
86
86
|
url: "git+https://github.com/vltpkg/vltpkg.git",
|
|
@@ -140,9 +140,10 @@ var package_default = {
|
|
|
140
140
|
deploy: "pnpm build && npx wrangler deploy",
|
|
141
141
|
format: "prettier --write . --log-level warn --ignore-path ../../.prettierignore --cache",
|
|
142
142
|
"format:check": "prettier --check . --ignore-path ../../.prettierignore --cache",
|
|
143
|
+
postinstall: `node -e "const fs=require('fs'); process.exit(fs.existsSync('local-store') ? 0 : 1);" || (npx wrangler d1 execute vsr-local-database --file=src/db/migrations/0000_initial.sql --local --persist-to=local-store --no-remote && npx wrangler d1 execute vsr-local-database --file=src/db/migrations/0001_wealthy_magdalene.sql --local --persist-to=local-store --no-remote)`,
|
|
143
144
|
lint: "eslint . --fix",
|
|
144
145
|
"lint:check": "eslint .",
|
|
145
|
-
prepack: "pnpm build
|
|
146
|
+
prepack: "pnpm build",
|
|
146
147
|
"serve:build": "pnpm --silent build && node ./dist/bin/vsr.js --debug --daemon=false",
|
|
147
148
|
"serve:build:daemon": "pnpm --silent build && node ./dist/bin/vsr.js --debug --daemon=true",
|
|
148
149
|
"serve:death": `echo "Killing wrangler dev processes..." && (pkill -f 'wrangler.*dev' || true) && sleep 1 && (pids=$(lsof -ti :1337 2>/dev/null; lsof -ti :3000 2>/dev/null) && [ -n "$pids" ] && echo "Force killing remaining processes: $pids" && kill -9 $pids || echo "No remaining processes found") && echo "Done."`,
|
|
@@ -154,10 +155,7 @@ var package_default = {
|
|
|
154
155
|
typecheck: "tsc --noEmit",
|
|
155
156
|
"typecheck:worker": "tsc -p tsconfig.worker.json --noEmit"
|
|
156
157
|
},
|
|
157
|
-
type: "module"
|
|
158
|
-
publishConfig: {
|
|
159
|
-
directory: "./.build-publish"
|
|
160
|
-
}
|
|
158
|
+
type: "module"
|
|
161
159
|
};
|
|
162
160
|
|
|
163
161
|
// src/utils/docs.ts
|
|
@@ -617,6 +615,8 @@ async function deployToCloudflare() {
|
|
|
617
615
|
const wranglerArgs = [
|
|
618
616
|
"deploy",
|
|
619
617
|
indexPath,
|
|
618
|
+
"--config",
|
|
619
|
+
wranglerConfigPath,
|
|
620
620
|
"--name",
|
|
621
621
|
`vsr-${ENV}`,
|
|
622
622
|
"--compatibility-date",
|
|
@@ -696,6 +696,7 @@ var demo = path.resolve(__dirname, "./demo");
|
|
|
696
696
|
var require2 = createRequire(import.meta.url);
|
|
697
697
|
var registryRoot = path.resolve(__dirname, "../../");
|
|
698
698
|
var indexPath = path.resolve(registryRoot, "dist/index.js");
|
|
699
|
+
var wranglerConfigPath = path.resolve(registryRoot, "wrangler.json");
|
|
699
700
|
var wranglerPkgPath = require2.resolve("wrangler/package.json");
|
|
700
701
|
var wranglerRelBinPath = JSON.parse(readFileSync(wranglerPkgPath, "utf8")).bin.wrangler;
|
|
701
702
|
var wranglerBinPath = require2.resolve(
|
|
@@ -743,6 +744,8 @@ void (async () => {
|
|
|
743
744
|
[
|
|
744
745
|
"dev",
|
|
745
746
|
indexPath,
|
|
747
|
+
"--config",
|
|
748
|
+
wranglerConfigPath,
|
|
746
749
|
"--local",
|
|
747
750
|
"--persist-to=local-store",
|
|
748
751
|
"--no-remote",
|
package/dist/index.js
CHANGED
|
@@ -1156,7 +1156,7 @@ var init_package = __esm({
|
|
|
1156
1156
|
"package.json"() {
|
|
1157
1157
|
package_default = {
|
|
1158
1158
|
name: "@vltpkg/vsr",
|
|
1159
|
-
version: "0.0.0-
|
|
1159
|
+
version: "0.0.0-29",
|
|
1160
1160
|
repository: {
|
|
1161
1161
|
type: "git",
|
|
1162
1162
|
url: "git+https://github.com/vltpkg/vltpkg.git",
|
|
@@ -1216,9 +1216,10 @@ var init_package = __esm({
|
|
|
1216
1216
|
deploy: "pnpm build && npx wrangler deploy",
|
|
1217
1217
|
format: "prettier --write . --log-level warn --ignore-path ../../.prettierignore --cache",
|
|
1218
1218
|
"format:check": "prettier --check . --ignore-path ../../.prettierignore --cache",
|
|
1219
|
+
postinstall: `node -e "const fs=require('fs'); process.exit(fs.existsSync('local-store') ? 0 : 1);" || (npx wrangler d1 execute vsr-local-database --file=src/db/migrations/0000_initial.sql --local --persist-to=local-store --no-remote && npx wrangler d1 execute vsr-local-database --file=src/db/migrations/0001_wealthy_magdalene.sql --local --persist-to=local-store --no-remote)`,
|
|
1219
1220
|
lint: "eslint . --fix",
|
|
1220
1221
|
"lint:check": "eslint .",
|
|
1221
|
-
prepack: "pnpm build
|
|
1222
|
+
prepack: "pnpm build",
|
|
1222
1223
|
"serve:build": "pnpm --silent build && node ./dist/bin/vsr.js --debug --daemon=false",
|
|
1223
1224
|
"serve:build:daemon": "pnpm --silent build && node ./dist/bin/vsr.js --debug --daemon=true",
|
|
1224
1225
|
"serve:death": `echo "Killing wrangler dev processes..." && (pkill -f 'wrangler.*dev' || true) && sleep 1 && (pids=$(lsof -ti :1337 2>/dev/null; lsof -ti :3000 2>/dev/null) && [ -n "$pids" ] && echo "Force killing remaining processes: $pids" && kill -9 $pids || echo "No remaining processes found") && echo "Done."`,
|
|
@@ -1230,10 +1231,7 @@ var init_package = __esm({
|
|
|
1230
1231
|
typecheck: "tsc --noEmit",
|
|
1231
1232
|
"typecheck:worker": "tsc -p tsconfig.worker.json --noEmit"
|
|
1232
1233
|
},
|
|
1233
|
-
type: "module"
|
|
1234
|
-
publishConfig: {
|
|
1235
|
-
directory: "./.build-publish"
|
|
1236
|
-
}
|
|
1234
|
+
type: "module"
|
|
1237
1235
|
};
|
|
1238
1236
|
}
|
|
1239
1237
|
});
|