velocious 1.0.571 → 1.0.573
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/README.md +2 -0
- package/build/background-jobs/web/authorization.js +2 -33
- package/build/background-jobs/web/path-matcher.js +5 -30
- package/build/database/drivers/base.js +17 -0
- package/build/database/drivers/mssql/index.js +30 -0
- package/build/database/record/index.js +22 -10
- package/build/deployment-api/controller.js +437 -0
- package/build/deployment-api/index.js +210 -0
- package/build/deployment-api/path-matcher.js +45 -0
- package/build/deployment-api/registry.js +84 -0
- package/build/deployment-api/run-store.js +798 -0
- package/build/deployment-api/sanitize.js +114 -0
- package/build/http-client/request.js +3 -1
- package/build/src/background-jobs/web/authorization.d.ts.map +1 -1
- package/build/src/background-jobs/web/authorization.js +3 -29
- package/build/src/background-jobs/web/path-matcher.d.ts +2 -12
- package/build/src/background-jobs/web/path-matcher.d.ts.map +1 -1
- package/build/src/background-jobs/web/path-matcher.js +5 -30
- package/build/src/database/drivers/base.d.ts +16 -0
- package/build/src/database/drivers/base.d.ts.map +1 -1
- package/build/src/database/drivers/base.js +16 -1
- package/build/src/database/drivers/mssql/index.d.ts.map +1 -1
- package/build/src/database/drivers/mssql/index.js +29 -1
- package/build/src/database/record/index.d.ts +3 -2
- package/build/src/database/record/index.d.ts.map +1 -1
- package/build/src/database/record/index.js +21 -10
- package/build/src/deployment-api/controller.d.ts +117 -0
- package/build/src/deployment-api/controller.d.ts.map +1 -0
- package/build/src/deployment-api/controller.js +384 -0
- package/build/src/deployment-api/index.d.ts +46 -0
- package/build/src/deployment-api/index.d.ts.map +1 -0
- package/build/src/deployment-api/index.js +178 -0
- package/build/src/deployment-api/path-matcher.d.ts +31 -0
- package/build/src/deployment-api/path-matcher.d.ts.map +1 -0
- package/build/src/deployment-api/path-matcher.js +39 -0
- package/build/src/deployment-api/registry.d.ts +106 -0
- package/build/src/deployment-api/registry.d.ts.map +1 -0
- package/build/src/deployment-api/registry.js +74 -0
- package/build/src/deployment-api/run-store.d.ts +402 -0
- package/build/src/deployment-api/run-store.d.ts.map +1 -0
- package/build/src/deployment-api/run-store.js +711 -0
- package/build/src/deployment-api/sanitize.d.ts +27 -0
- package/build/src/deployment-api/sanitize.d.ts.map +1 -0
- package/build/src/deployment-api/sanitize.js +100 -0
- package/build/src/http-client/request.d.ts.map +1 -1
- package/build/src/http-client/request.js +4 -2
- package/build/src/sync/signed-sync-envelope-replay-service.d.ts +154 -0
- package/build/src/sync/signed-sync-envelope-replay-service.d.ts.map +1 -0
- package/build/src/sync/signed-sync-envelope-replay-service.js +294 -0
- package/build/src/sync/sync-envelope-replay-service.d.ts +84 -15
- package/build/src/sync/sync-envelope-replay-service.d.ts.map +1 -1
- package/build/src/sync/sync-envelope-replay-service.js +98 -16
- package/build/src/utils/bearer-token.d.ts +15 -0
- package/build/src/utils/bearer-token.d.ts.map +1 -0
- package/build/src/utils/bearer-token.js +29 -0
- package/build/src/utils/mount-prefix.d.ts +21 -0
- package/build/src/utils/mount-prefix.d.ts.map +1 -0
- package/build/src/utils/mount-prefix.js +35 -0
- package/build/sync/signed-sync-envelope-replay-service.js +342 -0
- package/build/sync/sync-envelope-replay-service.js +110 -15
- package/build/tsconfig.tsbuildinfo +1 -1
- package/build/utils/bearer-token.js +34 -0
- package/build/utils/mount-prefix.js +36 -0
- package/package.json +2 -1
- package/src/background-jobs/web/authorization.js +2 -33
- package/src/background-jobs/web/path-matcher.js +5 -30
- package/src/database/drivers/base.js +17 -0
- package/src/database/drivers/mssql/index.js +30 -0
- package/src/database/record/index.js +22 -10
- package/src/deployment-api/controller.js +437 -0
- package/src/deployment-api/index.js +210 -0
- package/src/deployment-api/path-matcher.js +45 -0
- package/src/deployment-api/registry.js +84 -0
- package/src/deployment-api/run-store.js +798 -0
- package/src/deployment-api/sanitize.js +114 -0
- package/src/http-client/request.js +3 -1
- package/src/sync/signed-sync-envelope-replay-service.js +342 -0
- package/src/sync/sync-envelope-replay-service.js +110 -15
- package/src/utils/bearer-token.js +34 -0
- package/src/utils/mount-prefix.js +36 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
import {createHash} from "node:crypto"
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* DeploymentAdapter type. The configured deployment integration (e.g. Rampway)
|
|
7
|
+
* owns the implementation; Velocious only calls this contract. All values are
|
|
8
|
+
* passed as data — the framework never builds commands, paths, or refs.
|
|
9
|
+
* @typedef {object} DeploymentAdapter
|
|
10
|
+
* @property {(args: {configuration: import("../configuration.js").default, project: string, releaseBranch: string, revision: string, stage: string}) => Promise<boolean>} validateRevision - Returns whether the full revision is reachable from the approved release branch.
|
|
11
|
+
* @property {(args: {configuration: import("../configuration.js").default, project: string, releaseBranch: string, revision: string, runId: string, stage: string}) => Promise<Record<string, ?>>} deploy - Runs the integration's normal lock/build/migrate/release/health/rollback/cleanup deploy. The report shape is integration-owned and gets JSON-sanitized and redacted before persistence.
|
|
12
|
+
* @property {(args: {configuration: import("../configuration.js").default, project: string, stage: string}) => Promise<Record<string, ?>>} [readStatus] - Optional bounded readback of the live release (active revision, current/previous release).
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* DeploymentStageOptions type.
|
|
17
|
+
* @typedef {object} DeploymentStageOptions
|
|
18
|
+
* @property {string} releaseBranch - Approved release branch the requested revision must be reachable from.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* DeploymentProjectOptions type.
|
|
23
|
+
* @typedef {object} DeploymentProjectOptions
|
|
24
|
+
* @property {Record<string, DeploymentStageOptions>} stages - Allowlisted stages keyed by identifier.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* DeploymentMountOptions type.
|
|
29
|
+
* @typedef {object} DeploymentMountOptions
|
|
30
|
+
* @property {string[]} accessTokens - Accepted bearer tokens (required, fail closed when empty).
|
|
31
|
+
* @property {DeploymentAdapter} adapter - Deployment integration adapter that owns execution.
|
|
32
|
+
* @property {string} mountIdentifier - Stable hash of the normalized mount path used to scope persisted state.
|
|
33
|
+
* @property {Record<string, DeploymentProjectOptions>} projects - Allowlisted projects keyed by identifier (null-prototype map).
|
|
34
|
+
* @property {string} [databaseIdentifier] - Database identifier the run store reads from.
|
|
35
|
+
* @property {number} staleRunTimeoutMs - Lease timeout after which an active run without a heartbeat is reconciled according to its execution state.
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Mount options are keyed by configuration so multiple configurations (e.g.
|
|
40
|
+
* across tests) never share state, and by mount path so a single configuration
|
|
41
|
+
* can mount the API at more than one prefix. Functions in the options (the
|
|
42
|
+
* adapter) can't travel through route params, so the controller looks them up
|
|
43
|
+
* here using the plain `at` string it receives.
|
|
44
|
+
* @type {WeakMap<import("../configuration.js").default, Map<string, DeploymentMountOptions>>}
|
|
45
|
+
*/
|
|
46
|
+
const registry = new WeakMap()
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Builds the stable, bounded identifier persisted for one normalized mount.
|
|
50
|
+
* Hashing keeps composite indexes portable even when the URL prefix is long.
|
|
51
|
+
* @param {string} at - Normalized mount path.
|
|
52
|
+
* @returns {string} - Stable mount identifier.
|
|
53
|
+
*/
|
|
54
|
+
export function deploymentMountIdentifier(at) {
|
|
55
|
+
return createHash("sha256").update(at).digest("hex")
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Registers mount options for a configuration and mount path.
|
|
60
|
+
* @param {import("../configuration.js").default} configuration - Configuration instance.
|
|
61
|
+
* @param {string} at - Normalized mount path.
|
|
62
|
+
* @param {DeploymentMountOptions} options - Mount options.
|
|
63
|
+
* @returns {void} - No return value.
|
|
64
|
+
*/
|
|
65
|
+
export function registerDeploymentMount(configuration, at, options) {
|
|
66
|
+
let byPath = registry.get(configuration)
|
|
67
|
+
|
|
68
|
+
if (!byPath) {
|
|
69
|
+
byPath = new Map()
|
|
70
|
+
registry.set(configuration, byPath)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
byPath.set(at, options)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Returns the mount options for a configuration and mount path.
|
|
78
|
+
* @param {import("../configuration.js").default} configuration - Configuration instance.
|
|
79
|
+
* @param {string} at - Normalized mount path.
|
|
80
|
+
* @returns {DeploymentMountOptions | undefined} - Mount options if registered.
|
|
81
|
+
*/
|
|
82
|
+
export function getDeploymentMount(configuration, at) {
|
|
83
|
+
return registry.get(configuration)?.get(at)
|
|
84
|
+
}
|