@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.
Files changed (80) hide show
  1. package/DEPLOY.md +163 -0
  2. package/LICENSE +114 -10
  3. package/config.ts +221 -0
  4. package/dist/README.md +1 -1
  5. package/dist/bin/vsr.js +9 -6
  6. package/dist/index.js +4 -6
  7. package/dist/index.js.map +2 -2
  8. package/drizzle.config.js +40 -0
  9. package/info/COMPARISONS.md +37 -0
  10. package/info/CONFIGURATION.md +143 -0
  11. package/info/CONTRIBUTING.md +32 -0
  12. package/info/DATABASE_SETUP.md +108 -0
  13. package/info/GRANULAR_ACCESS_TOKENS.md +160 -0
  14. package/info/PROJECT_STRUCTURE.md +291 -0
  15. package/info/ROADMAP.md +27 -0
  16. package/info/SUPPORT.md +39 -0
  17. package/info/TESTING.md +301 -0
  18. package/info/USER_SUPPORT.md +31 -0
  19. package/package.json +50 -6
  20. package/scripts/build-assets.js +31 -0
  21. package/scripts/build-bin.js +63 -0
  22. package/src/assets/public/images/bg.png +0 -0
  23. package/src/assets/public/images/clients/logo-bun.png +0 -0
  24. package/src/assets/public/images/clients/logo-deno.png +0 -0
  25. package/src/assets/public/images/clients/logo-npm.png +0 -0
  26. package/src/assets/public/images/clients/logo-pnpm.png +0 -0
  27. package/src/assets/public/images/clients/logo-vlt.png +0 -0
  28. package/src/assets/public/images/clients/logo-yarn.png +0 -0
  29. package/src/assets/public/images/favicon/apple-touch-icon.png +0 -0
  30. package/src/assets/public/images/favicon/favicon-96x96.png +0 -0
  31. package/src/assets/public/images/favicon/favicon.ico +0 -0
  32. package/src/assets/public/images/favicon/favicon.svg +3 -0
  33. package/src/assets/public/images/favicon/site.webmanifest +21 -0
  34. package/src/assets/public/images/favicon/web-app-manifest-192x192.png +0 -0
  35. package/src/assets/public/images/favicon/web-app-manifest-512x512.png +0 -0
  36. package/src/assets/public/styles/styles.css +231 -0
  37. package/src/bin/demo/package.json +6 -0
  38. package/src/bin/demo/vlt.json +1 -0
  39. package/src/bin/vsr.ts +496 -0
  40. package/src/db/client.ts +590 -0
  41. package/src/db/migrations/0000_faulty_ricochet.sql +14 -0
  42. package/src/db/migrations/0000_initial.sql +29 -0
  43. package/src/db/migrations/0001_uuid_validation.sql +35 -0
  44. package/src/db/migrations/0001_wealthy_magdalene.sql +7 -0
  45. package/src/db/migrations/drop.sql +3 -0
  46. package/src/db/migrations/meta/0000_snapshot.json +104 -0
  47. package/src/db/migrations/meta/0001_snapshot.json +155 -0
  48. package/src/db/migrations/meta/_journal.json +20 -0
  49. package/src/db/schema.ts +43 -0
  50. package/src/index.ts +434 -0
  51. package/src/middleware/config.ts +79 -0
  52. package/src/middleware/telemetry.ts +43 -0
  53. package/src/queue/index.ts +97 -0
  54. package/src/routes/access.ts +852 -0
  55. package/src/routes/docs.ts +63 -0
  56. package/src/routes/misc.ts +469 -0
  57. package/src/routes/packages.ts +2823 -0
  58. package/src/routes/ping.ts +39 -0
  59. package/src/routes/search.ts +131 -0
  60. package/src/routes/static.ts +74 -0
  61. package/src/routes/tokens.ts +259 -0
  62. package/src/routes/users.ts +68 -0
  63. package/src/utils/auth.ts +202 -0
  64. package/src/utils/cache.ts +587 -0
  65. package/src/utils/config.ts +50 -0
  66. package/src/utils/database.ts +69 -0
  67. package/src/utils/docs.ts +146 -0
  68. package/src/utils/packages.ts +453 -0
  69. package/src/utils/response.ts +125 -0
  70. package/src/utils/routes.ts +64 -0
  71. package/src/utils/spa.ts +52 -0
  72. package/src/utils/tracing.ts +52 -0
  73. package/src/utils/upstream.ts +172 -0
  74. package/tsconfig.json +16 -0
  75. package/tsconfig.worker.json +3 -0
  76. package/typedoc.mjs +2 -0
  77. package/types.ts +598 -0
  78. package/vitest.config.ts +25 -0
  79. package/vlt.json.example +56 -0
  80. package/wrangler.json +65 -0
@@ -0,0 +1,104 @@
1
+ {
2
+ "version": "6",
3
+ "dialect": "sqlite",
4
+ "id": "d78cc389-7e78-46bc-969b-7a2828cc2e07",
5
+ "prevId": "00000000-0000-0000-0000-000000000000",
6
+ "tables": {
7
+ "packages": {
8
+ "name": "packages",
9
+ "columns": {
10
+ "name": {
11
+ "name": "name",
12
+ "type": "text",
13
+ "primaryKey": true,
14
+ "notNull": true,
15
+ "autoincrement": false
16
+ },
17
+ "tags": {
18
+ "name": "tags",
19
+ "type": "text",
20
+ "primaryKey": false,
21
+ "notNull": false,
22
+ "autoincrement": false
23
+ }
24
+ },
25
+ "indexes": {},
26
+ "foreignKeys": {},
27
+ "compositePrimaryKeys": {},
28
+ "uniqueConstraints": {},
29
+ "checkConstraints": {}
30
+ },
31
+ "tokens": {
32
+ "name": "tokens",
33
+ "columns": {
34
+ "token": {
35
+ "name": "token",
36
+ "type": "text",
37
+ "primaryKey": true,
38
+ "notNull": true,
39
+ "autoincrement": false
40
+ },
41
+ "uuid": {
42
+ "name": "uuid",
43
+ "type": "text",
44
+ "primaryKey": false,
45
+ "notNull": true,
46
+ "autoincrement": false
47
+ },
48
+ "scope": {
49
+ "name": "scope",
50
+ "type": "text",
51
+ "primaryKey": false,
52
+ "notNull": false,
53
+ "autoincrement": false
54
+ }
55
+ },
56
+ "indexes": {},
57
+ "foreignKeys": {},
58
+ "compositePrimaryKeys": {},
59
+ "uniqueConstraints": {},
60
+ "checkConstraints": {}
61
+ },
62
+ "versions": {
63
+ "name": "versions",
64
+ "columns": {
65
+ "spec": {
66
+ "name": "spec",
67
+ "type": "text",
68
+ "primaryKey": true,
69
+ "notNull": true,
70
+ "autoincrement": false
71
+ },
72
+ "manifest": {
73
+ "name": "manifest",
74
+ "type": "text",
75
+ "primaryKey": false,
76
+ "notNull": false,
77
+ "autoincrement": false
78
+ },
79
+ "published_at": {
80
+ "name": "published_at",
81
+ "type": "text",
82
+ "primaryKey": false,
83
+ "notNull": false,
84
+ "autoincrement": false
85
+ }
86
+ },
87
+ "indexes": {},
88
+ "foreignKeys": {},
89
+ "compositePrimaryKeys": {},
90
+ "uniqueConstraints": {},
91
+ "checkConstraints": {}
92
+ }
93
+ },
94
+ "views": {},
95
+ "enums": {},
96
+ "_meta": {
97
+ "schemas": {},
98
+ "tables": {},
99
+ "columns": {}
100
+ },
101
+ "internal": {
102
+ "indexes": {}
103
+ }
104
+ }
@@ -0,0 +1,155 @@
1
+ {
2
+ "version": "6",
3
+ "dialect": "sqlite",
4
+ "id": "a961f197-33f4-4c03-901c-0aa1c1f835b6",
5
+ "prevId": "d78cc389-7e78-46bc-969b-7a2828cc2e07",
6
+ "tables": {
7
+ "packages": {
8
+ "name": "packages",
9
+ "columns": {
10
+ "name": {
11
+ "name": "name",
12
+ "type": "text",
13
+ "primaryKey": true,
14
+ "notNull": true,
15
+ "autoincrement": false
16
+ },
17
+ "tags": {
18
+ "name": "tags",
19
+ "type": "text",
20
+ "primaryKey": false,
21
+ "notNull": false,
22
+ "autoincrement": false
23
+ },
24
+ "last_updated": {
25
+ "name": "last_updated",
26
+ "type": "text",
27
+ "primaryKey": false,
28
+ "notNull": false,
29
+ "autoincrement": false
30
+ },
31
+ "origin": {
32
+ "name": "origin",
33
+ "type": "text",
34
+ "primaryKey": false,
35
+ "notNull": true,
36
+ "autoincrement": false,
37
+ "default": "'local'"
38
+ },
39
+ "upstream": {
40
+ "name": "upstream",
41
+ "type": "text",
42
+ "primaryKey": false,
43
+ "notNull": false,
44
+ "autoincrement": false
45
+ },
46
+ "cached_at": {
47
+ "name": "cached_at",
48
+ "type": "text",
49
+ "primaryKey": false,
50
+ "notNull": false,
51
+ "autoincrement": false
52
+ }
53
+ },
54
+ "indexes": {},
55
+ "foreignKeys": {},
56
+ "compositePrimaryKeys": {},
57
+ "uniqueConstraints": {},
58
+ "checkConstraints": {}
59
+ },
60
+ "tokens": {
61
+ "name": "tokens",
62
+ "columns": {
63
+ "token": {
64
+ "name": "token",
65
+ "type": "text",
66
+ "primaryKey": true,
67
+ "notNull": true,
68
+ "autoincrement": false
69
+ },
70
+ "uuid": {
71
+ "name": "uuid",
72
+ "type": "text",
73
+ "primaryKey": false,
74
+ "notNull": true,
75
+ "autoincrement": false
76
+ },
77
+ "scope": {
78
+ "name": "scope",
79
+ "type": "text",
80
+ "primaryKey": false,
81
+ "notNull": false,
82
+ "autoincrement": false
83
+ }
84
+ },
85
+ "indexes": {},
86
+ "foreignKeys": {},
87
+ "compositePrimaryKeys": {},
88
+ "uniqueConstraints": {},
89
+ "checkConstraints": {}
90
+ },
91
+ "versions": {
92
+ "name": "versions",
93
+ "columns": {
94
+ "spec": {
95
+ "name": "spec",
96
+ "type": "text",
97
+ "primaryKey": true,
98
+ "notNull": true,
99
+ "autoincrement": false
100
+ },
101
+ "manifest": {
102
+ "name": "manifest",
103
+ "type": "text",
104
+ "primaryKey": false,
105
+ "notNull": false,
106
+ "autoincrement": false
107
+ },
108
+ "published_at": {
109
+ "name": "published_at",
110
+ "type": "text",
111
+ "primaryKey": false,
112
+ "notNull": false,
113
+ "autoincrement": false
114
+ },
115
+ "origin": {
116
+ "name": "origin",
117
+ "type": "text",
118
+ "primaryKey": false,
119
+ "notNull": true,
120
+ "autoincrement": false,
121
+ "default": "'local'"
122
+ },
123
+ "upstream": {
124
+ "name": "upstream",
125
+ "type": "text",
126
+ "primaryKey": false,
127
+ "notNull": false,
128
+ "autoincrement": false
129
+ },
130
+ "cached_at": {
131
+ "name": "cached_at",
132
+ "type": "text",
133
+ "primaryKey": false,
134
+ "notNull": false,
135
+ "autoincrement": false
136
+ }
137
+ },
138
+ "indexes": {},
139
+ "foreignKeys": {},
140
+ "compositePrimaryKeys": {},
141
+ "uniqueConstraints": {},
142
+ "checkConstraints": {}
143
+ }
144
+ },
145
+ "views": {},
146
+ "enums": {},
147
+ "_meta": {
148
+ "schemas": {},
149
+ "tables": {},
150
+ "columns": {}
151
+ },
152
+ "internal": {
153
+ "indexes": {}
154
+ }
155
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "version": "7",
3
+ "dialect": "sqlite",
4
+ "entries": [
5
+ {
6
+ "idx": 0,
7
+ "version": "6",
8
+ "when": 1742933058715,
9
+ "tag": "0000_faulty_ricochet",
10
+ "breakpoints": true
11
+ },
12
+ {
13
+ "idx": 1,
14
+ "version": "6",
15
+ "when": 1750313789237,
16
+ "tag": "0001_wealthy_magdalene",
17
+ "breakpoints": true
18
+ }
19
+ ]
20
+ }
@@ -0,0 +1,43 @@
1
+ import { sqliteTable, text } from 'drizzle-orm/sqlite-core'
2
+
3
+ // Define the packages table
4
+ export const packages = sqliteTable('packages', {
5
+ name: text('name').primaryKey(),
6
+ tags: text('tags').$type<string>(), // JSON stored as string
7
+ lastUpdated: text('last_updated'), // Timestamp for when this package was last updated
8
+ origin: text('origin').notNull().default('local'), // 'local' or 'upstream'
9
+ upstream: text('upstream'), // Name of upstream registry (null for local packages)
10
+ cachedAt: text('cached_at'), // When this package was cached from upstream
11
+ })
12
+
13
+ // Define the tokens table
14
+ export const tokens = sqliteTable('tokens', {
15
+ token: text('token').primaryKey(),
16
+ uuid: text('uuid').notNull(),
17
+ scope: text('scope').$type<string>(), // JSON stored as string
18
+ })
19
+
20
+ // Define the versions table
21
+ export const versions = sqliteTable('versions', {
22
+ spec: text('spec').primaryKey(),
23
+ manifest: text('manifest').$type<string>(), // JSON stored as string
24
+ publishedAt: text('published_at'),
25
+ origin: text('origin').notNull().default('local'), // 'local' or 'upstream'
26
+ upstream: text('upstream'), // Name of upstream registry (null for local packages)
27
+ cachedAt: text('cached_at'), // When this version was cached from upstream
28
+ })
29
+
30
+ // Default admin token
31
+ export const defaultAdminToken = {
32
+ token: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
33
+ uuid: 'admin',
34
+ scope: JSON.stringify([
35
+ {
36
+ values: ['*'],
37
+ types: {
38
+ pkg: { read: true, write: true },
39
+ user: { read: true, write: true },
40
+ },
41
+ },
42
+ ]),
43
+ } as const