@proveanything/smartlinks 2.1.10 → 2.1.11
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/dist/api/claimSet.d.ts +37 -1
- package/dist/api/claimSet.js +83 -1
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +1 -0
- package/dist/api/partner.d.ts +19 -0
- package/dist/api/partner.js +35 -0
- package/dist/docs/API_SUMMARY.md +275 -35
- package/dist/docs/tag-ranges.md +75 -0
- package/dist/http.js +3 -0
- package/dist/openapi.yaml +1494 -680
- package/dist/types/claimSet.d.ts +185 -0
- package/docs/API_SUMMARY.md +275 -35
- package/docs/tag-ranges.md +75 -0
- package/openapi.yaml +1494 -680
- package/package.json +1 -1
- package/scripts/publish.mjs +22 -7
package/package.json
CHANGED
package/scripts/publish.mjs
CHANGED
|
@@ -30,19 +30,29 @@ const CHANNEL = flag('--channel', process.env.SMARTLINKS_CHANNEL || 'dev')
|
|
|
30
30
|
const DIR = flag('--dir', 'dist')
|
|
31
31
|
const WATCH = args.includes('--watch')
|
|
32
32
|
|
|
33
|
-
//
|
|
34
|
-
//
|
|
35
|
-
//
|
|
36
|
-
//
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
// Every built file is published except two kinds. Source maps (.map): a release is promoted to beta and
|
|
34
|
+
// stable as-is, so a map would serve the app's original source publicly (and maps are most of a bundle's
|
|
35
|
+
// size); debug in Forge's preview, and a Release to dev is a readable, unminified build instead. And the
|
|
36
|
+
// server's block list (prove services/apps/appBucket.js — keep in step): programs and installers, server
|
|
37
|
+
// config, keys. SmartLinks serves web types as themselves and anything else as a download.
|
|
38
|
+
const BLOCKED_EXT = new Set(['.exe', '.msi', '.msix', '.dll', '.com', '.scr', '.bat', '.cmd', '.ps1', '.psm1', '.vbs', '.vbe',
|
|
39
|
+
'.wsf', '.hta', '.lnk', '.reg', '.cpl', '.jar', '.apk', '.aab', '.ipa', '.dmg', '.pkg', '.deb', '.rpm', '.appimage', '.sh',
|
|
40
|
+
'.bash', '.php', '.phtml', '.asp', '.aspx', '.jsp', '.cgi', '.pl', '.py', '.pem', '.key', '.p12', '.pfx', '.jks', '.keystore'])
|
|
41
|
+
const BLOCKED_NAMES = new Set(['_headers', '_redirects', '.htaccess', '.htpasswd', 'web.config', '.npmrc', '.yarnrc', '.ds_store'])
|
|
39
42
|
const extOf = (p) => { const i = p.lastIndexOf('.'); return i < 0 ? '' : p.slice(i).toLowerCase() }
|
|
43
|
+
const isBlocked = (rel) => {
|
|
44
|
+
const base = rel.slice(rel.lastIndexOf('/') + 1).toLowerCase()
|
|
45
|
+
if (BLOCKED_NAMES.has(base) || BLOCKED_EXT.has(extOf(base))) return true
|
|
46
|
+
return /^\.env(\.|$)/.test(base) || rel.toLowerCase().split('/').some((seg) => seg === '.git' || seg === '.ssh')
|
|
47
|
+
}
|
|
40
48
|
|
|
41
49
|
function fail(msg) { console.error(`❌ ${msg}`); process.exit(1) }
|
|
42
50
|
if (!APP_ID) fail('SMARTLINKS_APP_ID is required')
|
|
43
51
|
if (!KEY) fail('SMARTLINKS_DEPLOY_KEY is required')
|
|
44
52
|
|
|
45
53
|
let skippedMaps = 0
|
|
54
|
+
/** Built files SmartLinks never serves (the block list) — said out loud: an app that loads one would 404. */
|
|
55
|
+
let skippedOther = []
|
|
46
56
|
|
|
47
57
|
function collectFiles(dir) {
|
|
48
58
|
const out = {}
|
|
@@ -50,8 +60,9 @@ function collectFiles(dir) {
|
|
|
50
60
|
for (const e of readdirSync(d, { withFileTypes: true })) {
|
|
51
61
|
const full = join(d, e.name)
|
|
52
62
|
if (e.isDirectory()) { walk(full); continue }
|
|
53
|
-
if (!ALLOWED.has(extOf(e.name))) { if (extOf(e.name) === '.map') skippedMaps++; continue }
|
|
54
63
|
const rel = relative(dir, full).split(sep).join('/') // forward slashes for the bucket
|
|
64
|
+
if (extOf(e.name) === '.map') { skippedMaps++; continue }
|
|
65
|
+
if (isBlocked(rel)) { skippedOther.push(rel); continue }
|
|
55
66
|
out[rel] = readFileSync(full)
|
|
56
67
|
}
|
|
57
68
|
}
|
|
@@ -173,9 +184,13 @@ async function publishOnce() {
|
|
|
173
184
|
if (!stat.isDirectory()) fail(`${DIR} is not a directory`)
|
|
174
185
|
|
|
175
186
|
skippedMaps = 0
|
|
187
|
+
skippedOther = []
|
|
176
188
|
const files = collectFiles(DIR)
|
|
177
189
|
if (!files['app.manifest.json']) fail(`${DIR}/app.manifest.json not found — is this a built app bundle?`)
|
|
178
190
|
if (skippedMaps) console.log(` (${skippedMaps} source map${skippedMaps === 1 ? '' : 's'} left out — maps are never published)`)
|
|
191
|
+
if (skippedOther.length) {
|
|
192
|
+
console.warn(`⚠️ ${skippedOther.length} file${skippedOther.length === 1 ? '' : 's'} left out — SmartLinks never serves programs, server config or keys, so the app can't load ${skippedOther.length === 1 ? 'it' : 'them'}: ${skippedOther.slice(0, 8).join(', ')}${skippedOther.length > 8 ? ', …' : ''}`)
|
|
193
|
+
}
|
|
179
194
|
|
|
180
195
|
const t0 = Date.now()
|
|
181
196
|
const entries = Object.entries(files)
|