@bluestep-systems/b6p-core-bsjs-git 0.2.0 → 0.3.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/README.md +65 -12
- package/dist/ScriptRepo.d.ts +132 -10
- package/dist/ScriptRepo.js +355 -44
- package/dist/ScriptRepo.js.map +1 -1
- package/dist/buildManifest.d.ts +21 -36
- package/dist/buildManifest.js +44 -49
- package/dist/buildManifest.js.map +1 -1
- package/dist/csrf.js.map +1 -1
- package/dist/errors.d.ts +85 -1
- package/dist/errors.js +114 -1
- package/dist/errors.js.map +1 -1
- package/dist/http.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +14 -5
- package/dist/index.js.map +1 -1
- package/dist/legacy.js.map +1 -1
- package/dist/scriptKey.js.map +1 -1
- package/dist/serverBuild.d.ts +190 -0
- package/dist/serverBuild.js +221 -0
- package/dist/serverBuild.js.map +1 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
17
|
+
exports.parseJsonc = exports.isTypeScriptSource = exports.isBuildSource = exports.hasNoTsconfig = exports.changesOnlyBuildOutput = exports.buildOutputFolders = exports.buildConfigPaths = exports.buildOutputFolder = exports.buildManifestPath = exports.BUILD_MANIFEST_NAME = exports.refusalFor = exports.gitAuthHeader = exports.createProxyHttp = exports.basicTokenFetch = exports.CsrfFetch = exports.parseDraftCompileOutcome = exports.parseDraftBuildCommit = exports.compileAllowsPublish = exports.PUBLISHABLE_COMPILE_STATUSES = exports.KNOWN_DRAFT_COMPILE_STATUSES = exports.COMPILE_RETRY = exports.buildSourceOf = exports.BUILD_OF_TRAILER = exports.BUILD_COMMIT_SUBJECT = exports.SCRIPT_PUBLISH_TYPES = exports.publishMutationFor = exports.parseCompoundId = exports.compoundId = exports.treeFiles = exports.parseSaveState = exports.LegacyHistoryClient = exports.decodeText = exports.PUBLISHED_BRANCH = exports.DRAFT_BRANCH = exports.ScriptRepo = void 0;
|
|
18
18
|
/**
|
|
19
19
|
* Browser- and Node-safe git client for BlueStep BSJS scripts. Nothing here imports a Node built-in; the file system
|
|
20
20
|
* is injected (see {@link ScriptRepoOptions.fs}) and HTTP is the platform `fetch`.
|
|
@@ -35,6 +35,16 @@ Object.defineProperty(exports, "compoundId", { enumerable: true, get: function (
|
|
|
35
35
|
Object.defineProperty(exports, "parseCompoundId", { enumerable: true, get: function () { return scriptKey_1.parseCompoundId; } });
|
|
36
36
|
Object.defineProperty(exports, "publishMutationFor", { enumerable: true, get: function () { return scriptKey_1.publishMutationFor; } });
|
|
37
37
|
Object.defineProperty(exports, "SCRIPT_PUBLISH_TYPES", { enumerable: true, get: function () { return scriptKey_1.SCRIPT_PUBLISH_TYPES; } });
|
|
38
|
+
var serverBuild_1 = require("./serverBuild");
|
|
39
|
+
Object.defineProperty(exports, "BUILD_COMMIT_SUBJECT", { enumerable: true, get: function () { return serverBuild_1.BUILD_COMMIT_SUBJECT; } });
|
|
40
|
+
Object.defineProperty(exports, "BUILD_OF_TRAILER", { enumerable: true, get: function () { return serverBuild_1.BUILD_OF_TRAILER; } });
|
|
41
|
+
Object.defineProperty(exports, "buildSourceOf", { enumerable: true, get: function () { return serverBuild_1.buildSourceOf; } });
|
|
42
|
+
Object.defineProperty(exports, "COMPILE_RETRY", { enumerable: true, get: function () { return serverBuild_1.COMPILE_RETRY; } });
|
|
43
|
+
Object.defineProperty(exports, "KNOWN_DRAFT_COMPILE_STATUSES", { enumerable: true, get: function () { return serverBuild_1.KNOWN_DRAFT_COMPILE_STATUSES; } });
|
|
44
|
+
Object.defineProperty(exports, "PUBLISHABLE_COMPILE_STATUSES", { enumerable: true, get: function () { return serverBuild_1.PUBLISHABLE_COMPILE_STATUSES; } });
|
|
45
|
+
Object.defineProperty(exports, "compileAllowsPublish", { enumerable: true, get: function () { return serverBuild_1.compileAllowsPublish; } });
|
|
46
|
+
Object.defineProperty(exports, "parseDraftBuildCommit", { enumerable: true, get: function () { return serverBuild_1.parseDraftBuildCommit; } });
|
|
47
|
+
Object.defineProperty(exports, "parseDraftCompileOutcome", { enumerable: true, get: function () { return serverBuild_1.parseDraftCompileOutcome; } });
|
|
38
48
|
var csrf_1 = require("./csrf");
|
|
39
49
|
Object.defineProperty(exports, "CsrfFetch", { enumerable: true, get: function () { return csrf_1.CsrfFetch; } });
|
|
40
50
|
var http_1 = require("./http");
|
|
@@ -44,15 +54,14 @@ Object.defineProperty(exports, "gitAuthHeader", { enumerable: true, get: functio
|
|
|
44
54
|
Object.defineProperty(exports, "refusalFor", { enumerable: true, get: function () { return http_1.refusalFor; } });
|
|
45
55
|
__exportStar(require("./errors"), exports);
|
|
46
56
|
var buildManifest_1 = require("./buildManifest");
|
|
47
|
-
Object.defineProperty(exports, "BUILD_MANIFEST_BUILDER", { enumerable: true, get: function () { return buildManifest_1.BUILD_MANIFEST_BUILDER; } });
|
|
48
57
|
Object.defineProperty(exports, "BUILD_MANIFEST_NAME", { enumerable: true, get: function () { return buildManifest_1.BUILD_MANIFEST_NAME; } });
|
|
49
58
|
Object.defineProperty(exports, "buildManifestPath", { enumerable: true, get: function () { return buildManifest_1.buildManifestPath; } });
|
|
50
59
|
Object.defineProperty(exports, "buildOutputFolder", { enumerable: true, get: function () { return buildManifest_1.buildOutputFolder; } });
|
|
51
|
-
Object.defineProperty(exports, "
|
|
52
|
-
Object.defineProperty(exports, "
|
|
60
|
+
Object.defineProperty(exports, "buildConfigPaths", { enumerable: true, get: function () { return buildManifest_1.buildConfigPaths; } });
|
|
61
|
+
Object.defineProperty(exports, "buildOutputFolders", { enumerable: true, get: function () { return buildManifest_1.buildOutputFolders; } });
|
|
62
|
+
Object.defineProperty(exports, "changesOnlyBuildOutput", { enumerable: true, get: function () { return buildManifest_1.changesOnlyBuildOutput; } });
|
|
53
63
|
Object.defineProperty(exports, "hasNoTsconfig", { enumerable: true, get: function () { return buildManifest_1.hasNoTsconfig; } });
|
|
54
64
|
Object.defineProperty(exports, "isBuildSource", { enumerable: true, get: function () { return buildManifest_1.isBuildSource; } });
|
|
55
65
|
Object.defineProperty(exports, "isTypeScriptSource", { enumerable: true, get: function () { return buildManifest_1.isTypeScriptSource; } });
|
|
56
66
|
Object.defineProperty(exports, "parseJsonc", { enumerable: true, get: function () { return buildManifest_1.parseJsonc; } });
|
|
57
|
-
Object.defineProperty(exports, "planBuildManifest", { enumerable: true, get: function () { return buildManifest_1.planBuildManifest; } });
|
|
58
67
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;GAIG;AACH,wBAAsB;AACtB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;GAIG;AACH,wBAAsB;AACtB,2CAsBsB;AArBpB,wGAAA,UAAU,OAAA;AACV,0GAAA,YAAY,OAAA;AACZ,8GAAA,gBAAgB,OAAA;AAChB,wGAAA,UAAU,OAAA;AAmBZ,mCASkB;AARhB,6GAAA,mBAAmB,OAAA;AACnB,wGAAA,cAAc,OAAA;AACd,mGAAA,SAAS,OAAA;AAOX,yCAOqB;AANnB,uGAAA,UAAU,OAAA;AACV,4GAAA,eAAe,OAAA;AACf,+GAAA,kBAAkB,OAAA;AAClB,iHAAA,oBAAoB,OAAA;AAItB,6CAiBuB;AAhBrB,mHAAA,oBAAoB,OAAA;AACpB,+GAAA,gBAAgB,OAAA;AAChB,4GAAA,aAAa,OAAA;AACb,4GAAA,aAAa,OAAA;AACb,2HAAA,4BAA4B,OAAA;AAC5B,2HAAA,4BAA4B,OAAA;AAC5B,mHAAA,oBAAoB,OAAA;AACpB,oHAAA,qBAAqB,OAAA;AACrB,uHAAA,wBAAwB,OAAA;AAS1B,+BAAoD;AAA3C,iGAAA,SAAS,OAAA;AAClB,+BAAqG;AAA5F,uGAAA,eAAe,OAAA;AAAE,uGAAA,eAAe,OAAA;AAAE,qGAAA,aAAa,OAAA;AAAE,kGAAA,UAAU,OAAA;AACpE,2CAAyB;AACzB,iDAWyB;AAVvB,oHAAA,mBAAmB,OAAA;AACnB,kHAAA,iBAAiB,OAAA;AACjB,kHAAA,iBAAiB,OAAA;AACjB,iHAAA,gBAAgB,OAAA;AAChB,mHAAA,kBAAkB,OAAA;AAClB,uHAAA,sBAAsB,OAAA;AACtB,8GAAA,aAAa,OAAA;AACb,8GAAA,aAAa,OAAA;AACb,mHAAA,kBAAkB,OAAA;AAClB,2GAAA,UAAU,OAAA"}
|
package/dist/legacy.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legacy.js","sourceRoot":"","sources":["../src/legacy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"legacy.js","sourceRoot":"","sources":["../src/legacy.ts"],"names":[],"mappings":";;;;;AAAA,qCAMkB;AAClB,iCAAoD;AA6EpD,SAAS,QAAQ,CAAC,KAAW;IAC3B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED;;;;;;;;;;GAUG;AACH,wBAA+B,IAAmB;IAChD,IAAI,IAAU,CAAC;IACf,IAAI,CAAC;QACH,IAAI,GAAG,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC5D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAA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I,2BAAkB,CAAC,iCAAiC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;QAClH,CAAC;QACD,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;YAC5B,MAAM,IAAI,qBAAY,EAAE,CAAC;QAC3B,CAAC;QACD,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;YAC5B,MAAM,IAAI,2BAAkB,CAAC,EAAE,CAAC,CAAC;QACnC,CAAC;QACD,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;YAC5B,MAAM,IAAI,6BAAoB,EAAE,CAAC;QACnC,CAAC;QACD,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,IAAI,2BAAkB,CAAC,6CAA6C,QAAQ,CAAC,MAAM,EAAE,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;QAChH,CAAC;QACD,OAAO,QAAQ,CAAC,IAAI,EAAmB,CAAC;IAC1C,CAAC;CACF"}
|
package/dist/scriptKey.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scriptKey.js","sourceRoot":"","sources":["../src/scriptKey.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"scriptKey.js","sourceRoot":"","sources":["../src/scriptKey.ts"],"names":[],"mappings":";;;;;;AAAA,qCAAkD;AAElD,MAAM,WAAW,GAAG,iBAAiB,CAAC;AAYtC;;;;GAIG;AACU,QAAA,oBAAoB,GAAG;IAClC,QAAQ,EAAE;QACR,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE,eAAe;QACzB,YAAY,EAAE,qBAAqB;QACnC,SAAS,EAAE,0BAA0B;KACtC;IACD,QAAQ,EAAE;QACR,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,mBAAmB;QAC7B,YAAY,EAAE,yBAAyB;QACvC,SAAS,EAAE,8BAA8B;KAC1C;IACD,QAAQ,EAAE;QACR,IAAI,EAAE,UAAU;QAChB,QAAQ,EAAE,gBAAgB;QAC1B,YAAY,EAAE,sBAAsB;QACpC,SAAS,EAAE,2BAA2B;KACvC;CACO,CAAC;AAaX;;;;GAIG;AACH,yBAAgC,EAAU;IACxC,MAAM,KAAK,GAAG,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACnC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,iEAAiE,EAAE,EAAE,CAAC,CAAC;IACzF,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;AACjD,CAAC;AAED;;;GAGG;AACH,oBAA2B,GAAc;IACvC,OAAO,GAAG,GAAG,CAAC,OAAO,MAAM,GAAG,CAAC,MAAM,EAAE,CAAC;AAC1C,CAAC;AAED;;;;GAIG;AACH,4BAAmC,GAAc;IAC/C,MAAM,KAAK,GAAI,QAAA,oBAAoE,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACjG,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,+BAAsB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAChD,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The platform's build of a git-managed draft (GraphQL `compileDraft` with `expectedDraftSha`): what it answers and how
|
|
3
|
+
* to read it. The platform compiles the draft branch at the pushed commit and commits the output, and the build
|
|
4
|
+
* manifest when it vouches for the build, as one build commit on the draft branch. No client compiles.
|
|
5
|
+
*
|
|
6
|
+
* Everything here is pure (no file system, no Node built-ins).
|
|
7
|
+
* @lastreviewed null
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* The subject of the platform's build commit (web `UserCodeScriptHelper.BUILD_MESSAGE`). Informational only: what
|
|
11
|
+
* makes a commit a build is its {@link BUILD_OF_TRAILER} trailer, never its subject.
|
|
12
|
+
* @lastreviewed null
|
|
13
|
+
*/
|
|
14
|
+
export declare const BUILD_COMMIT_SUBJECT = "Build draft";
|
|
15
|
+
/**
|
|
16
|
+
* The trailer the platform puts on every build commit: `Bluestep-Build-Of: <source sha>`, the source being the nearest
|
|
17
|
+
* ancestor that is not a build (the commit that was pushed), the same across a chain of rebuilds.
|
|
18
|
+
* @lastreviewed null
|
|
19
|
+
*/
|
|
20
|
+
export declare const BUILD_OF_TRAILER = "Bluestep-Build-Of";
|
|
21
|
+
/**
|
|
22
|
+
* The source sha a commit message's {@link BUILD_OF_TRAILER} trailer names, or `null` when it names none. The web
|
|
23
|
+
* rule exactly (`UserCodeScriptHelper.buildTrailer`, ruling 67): CRLF read as LF and trailing whitespace dropped, the
|
|
24
|
+
* last paragraph is the text after the last blank line (a line of only whitespace counts, as git interpret-trailers
|
|
25
|
+
* reads it), or the whole message when there is none, and it must hold
|
|
26
|
+
* exactly one line that is, in full, `Bluestep-Build-Of: ` followed by a full lowercase commit id (40 or 64 hex). Exact
|
|
27
|
+
* case, exactly one space, nothing else on the line.
|
|
28
|
+
* @param message A commit's full message
|
|
29
|
+
* @lastreviewed null
|
|
30
|
+
*/
|
|
31
|
+
export declare function buildSourceOf(message: string): string | null;
|
|
32
|
+
/**
|
|
33
|
+
* The statuses the platform reports for a compile (`extensions.bluestepCompile[0].status`).
|
|
34
|
+
* @lastreviewed null
|
|
35
|
+
*/
|
|
36
|
+
export declare const KNOWN_DRAFT_COMPILE_STATUSES: readonly ["COMPILED", "GATE_TRIPPED", "EMIT_WITHHELD", "NOTHING_TO_COMPILE", "SKIPPED_GIT_MANAGED", "SKIPPED_EXTERNALLY_BUILT", "OUTPUT_UPLOAD", "NOT_PERMITTED", "COMPILER_UNAVAILABLE", "WRITE_FAILED", "INPUT_INCOMPLETE", "BUSY"];
|
|
37
|
+
/**
|
|
38
|
+
* A status the platform reported. `UNKNOWN` is the fallback for a status this version does not know (a newer server);
|
|
39
|
+
* the raw text is in {@link DraftCompileOutcome.rawStatus}.
|
|
40
|
+
* @lastreviewed null
|
|
41
|
+
*/
|
|
42
|
+
export type DraftCompileStatus = (typeof KNOWN_DRAFT_COMPILE_STATUSES)[number] | "UNKNOWN";
|
|
43
|
+
/**
|
|
44
|
+
* One compiler or compile-engine message from the platform.
|
|
45
|
+
* @lastreviewed null
|
|
46
|
+
*/
|
|
47
|
+
export interface CompileDiagnostic {
|
|
48
|
+
/** Who produced it: `TYPESCRIPT` (the compiler) or `ENGINE` (the platform's compile step). @lastreviewed null */
|
|
49
|
+
origin: string;
|
|
50
|
+
/** `ERROR`, `WARNING` or `INFO`. @lastreviewed null */
|
|
51
|
+
severity: string;
|
|
52
|
+
/** The compiler's diagnostic code, when it has one. @lastreviewed null */
|
|
53
|
+
code?: number;
|
|
54
|
+
/** The file the message is about, relative to the script, when it names one. @lastreviewed null */
|
|
55
|
+
file?: string;
|
|
56
|
+
/** 1-based line, when known. @lastreviewed null */
|
|
57
|
+
line?: number;
|
|
58
|
+
/** 1-based column, when known. @lastreviewed null */
|
|
59
|
+
column?: number;
|
|
60
|
+
/** The message text. @lastreviewed null */
|
|
61
|
+
message: string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* One thing the platform's save gate found.
|
|
65
|
+
* @lastreviewed null
|
|
66
|
+
*/
|
|
67
|
+
export interface GateProblem {
|
|
68
|
+
/**
|
|
69
|
+
* What kind of problem, e.g. `CONFIG_UNSUPPORTED_OPTION`, `CONFIG_BROKEN`, `OUTPUT_DIFFERS`, `OUTPUT_UNVERIFIABLE` or
|
|
70
|
+
* `OUTPUT_SHADOWS`. Kept as the platform's text so a newer kind passes through.
|
|
71
|
+
* @lastreviewed null
|
|
72
|
+
*/
|
|
73
|
+
kind: string;
|
|
74
|
+
/** The tsconfig the problem belongs to, relative to the script. @lastreviewed null */
|
|
75
|
+
tsconfig: string;
|
|
76
|
+
/** The file it is about, when it names one. @lastreviewed null */
|
|
77
|
+
file?: string;
|
|
78
|
+
/** What is wrong. @lastreviewed null */
|
|
79
|
+
message: string;
|
|
80
|
+
/** What differs, when the platform shows it. @lastreviewed null */
|
|
81
|
+
diff?: string;
|
|
82
|
+
/** Whether the author accepted it already, so it no longer holds anything back. @lastreviewed null */
|
|
83
|
+
accepted: boolean;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* What the platform's save gate found on a compile.
|
|
87
|
+
* @lastreviewed null
|
|
88
|
+
*/
|
|
89
|
+
export interface GateReport {
|
|
90
|
+
/** True when the gate holds back the output of at least one project. @lastreviewed null */
|
|
91
|
+
tripped: boolean;
|
|
92
|
+
/** The tsconfigs whose output was held back. @lastreviewed null */
|
|
93
|
+
withheld: string[];
|
|
94
|
+
/** How many output files were compared with the script's existing output. @lastreviewed null */
|
|
95
|
+
checked: number;
|
|
96
|
+
/** The problems, capped by the platform. @lastreviewed null */
|
|
97
|
+
problems: GateProblem[];
|
|
98
|
+
/** How many problems the platform left out of `problems`. @lastreviewed null */
|
|
99
|
+
problemsOmitted: number;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* What the platform's compile of the draft came to.
|
|
103
|
+
* @lastreviewed null
|
|
104
|
+
*/
|
|
105
|
+
export interface DraftCompileOutcome {
|
|
106
|
+
/** The status, or `UNKNOWN` for one this version does not know. @lastreviewed null */
|
|
107
|
+
status: DraftCompileStatus;
|
|
108
|
+
/** The status text exactly as the platform sent it. @lastreviewed null */
|
|
109
|
+
rawStatus: string;
|
|
110
|
+
/** Number of error diagnostics. @lastreviewed null */
|
|
111
|
+
errors: number;
|
|
112
|
+
/** Number of warning diagnostics. @lastreviewed null */
|
|
113
|
+
warnings: number;
|
|
114
|
+
/** Output files created or changed. @lastreviewed null */
|
|
115
|
+
written: number;
|
|
116
|
+
/** Output files removed. @lastreviewed null */
|
|
117
|
+
deleted: number;
|
|
118
|
+
/** The first diagnostics, errors first (the platform lists at most 20). @lastreviewed null */
|
|
119
|
+
diagnostics: CompileDiagnostic[];
|
|
120
|
+
/** How many diagnostics the platform left out of `diagnostics`. @lastreviewed null */
|
|
121
|
+
diagnosticsOmitted: number;
|
|
122
|
+
/** The save gate's findings, when it ran. @lastreviewed null */
|
|
123
|
+
gate?: GateReport;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* The build commit the platform made (`extensions.bluestepBuild[0]`).
|
|
127
|
+
* @lastreviewed null
|
|
128
|
+
*/
|
|
129
|
+
export interface DraftBuildCommit {
|
|
130
|
+
/**
|
|
131
|
+
* The draft branch's head after the build: the build commit, or the pushed commit itself when the build changed
|
|
132
|
+
* nothing (already built, or nothing to build). `null` when the platform gave none.
|
|
133
|
+
* @lastreviewed null
|
|
134
|
+
*/
|
|
135
|
+
commit: string | null;
|
|
136
|
+
/**
|
|
137
|
+
* Whether a publish's build check passes at `commit`: the platform vouched for the build (every project's output
|
|
138
|
+
* written, no blocking error, so the manifest is in the commit), or the draft needs none (externally built, nothing
|
|
139
|
+
* to build).
|
|
140
|
+
* @lastreviewed null
|
|
141
|
+
*/
|
|
142
|
+
vouched: boolean;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* How a retryable outcome is retried: how many extra attempts, and the wait before each.
|
|
146
|
+
* @lastreviewed null
|
|
147
|
+
*/
|
|
148
|
+
export interface RetryPolicy {
|
|
149
|
+
/** Extra attempts after the first. @lastreviewed null */
|
|
150
|
+
times: number;
|
|
151
|
+
/** Milliseconds to wait before each extra attempt. @lastreviewed null */
|
|
152
|
+
delayMs: number;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* The retry policy of the platform contract: `BUSY` 3 times 5 s apart, `INPUT_INCOMPLETE` 3 times 2 s apart,
|
|
156
|
+
* `COMPILER_UNAVAILABLE` once, and a failed request once. Each kind has its own budget.
|
|
157
|
+
* @lastreviewed null
|
|
158
|
+
*/
|
|
159
|
+
export declare const COMPILE_RETRY: {
|
|
160
|
+
readonly BUSY: RetryPolicy;
|
|
161
|
+
readonly INPUT_INCOMPLETE: RetryPolicy;
|
|
162
|
+
readonly COMPILER_UNAVAILABLE: RetryPolicy;
|
|
163
|
+
readonly NETWORK: RetryPolicy;
|
|
164
|
+
};
|
|
165
|
+
/**
|
|
166
|
+
* The compile statuses after which a draft can go on to publish: there is compiled output, or nothing for the platform
|
|
167
|
+
* to build.
|
|
168
|
+
* @lastreviewed null
|
|
169
|
+
*/
|
|
170
|
+
export declare const PUBLISHABLE_COMPILE_STATUSES: readonly DraftCompileStatus[];
|
|
171
|
+
/**
|
|
172
|
+
* Whether a compile status lets a draft go on to publish.
|
|
173
|
+
* @lastreviewed null
|
|
174
|
+
*/
|
|
175
|
+
export declare function compileAllowsPublish(status: DraftCompileStatus): boolean;
|
|
176
|
+
/**
|
|
177
|
+
* Reads one element of `extensions.bluestepCompile`. A status this version does not know becomes `UNKNOWN` with the raw
|
|
178
|
+
* text kept; a missing outcome (`undefined`) is `UNKNOWN` with empty raw text.
|
|
179
|
+
* @param raw The element as parsed JSON
|
|
180
|
+
* @lastreviewed null
|
|
181
|
+
*/
|
|
182
|
+
export declare function parseDraftCompileOutcome(raw: unknown): DraftCompileOutcome;
|
|
183
|
+
/**
|
|
184
|
+
* Reads one element of `extensions.bluestepBuild` (`{ script, draftSha, commit, built, vouched, status }`; only
|
|
185
|
+
* `commit` and `vouched` are read: a build commit was made exactly when `commit` differs from the pushed sha). A commit
|
|
186
|
+
* that is not a full sha (40 or 64 lowercase hex) reads as `null`; `vouched` is true only when the platform says so.
|
|
187
|
+
* @param raw The element as parsed JSON
|
|
188
|
+
* @lastreviewed null
|
|
189
|
+
*/
|
|
190
|
+
export declare function parseDraftBuildCommit(raw: unknown): DraftBuildCommit;
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* The platform's build of a git-managed draft (GraphQL `compileDraft` with `expectedDraftSha`): what it answers and how
|
|
4
|
+
* to read it. The platform compiles the draft branch at the pushed commit and commits the output, and the build
|
|
5
|
+
* manifest when it vouches for the build, as one build commit on the draft branch. No client compiles.
|
|
6
|
+
*
|
|
7
|
+
* Everything here is pure (no file system, no Node built-ins).
|
|
8
|
+
* @lastreviewed null
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.PUBLISHABLE_COMPILE_STATUSES = exports.COMPILE_RETRY = exports.KNOWN_DRAFT_COMPILE_STATUSES = exports.BUILD_OF_TRAILER = exports.BUILD_COMMIT_SUBJECT = void 0;
|
|
12
|
+
exports.buildSourceOf = buildSourceOf;
|
|
13
|
+
exports.compileAllowsPublish = compileAllowsPublish;
|
|
14
|
+
exports.parseDraftCompileOutcome = parseDraftCompileOutcome;
|
|
15
|
+
exports.parseDraftBuildCommit = parseDraftBuildCommit;
|
|
16
|
+
/**
|
|
17
|
+
* The subject of the platform's build commit (web `UserCodeScriptHelper.BUILD_MESSAGE`). Informational only: what
|
|
18
|
+
* makes a commit a build is its {@link BUILD_OF_TRAILER} trailer, never its subject.
|
|
19
|
+
* @lastreviewed null
|
|
20
|
+
*/
|
|
21
|
+
exports.BUILD_COMMIT_SUBJECT = "Build draft";
|
|
22
|
+
/**
|
|
23
|
+
* The trailer the platform puts on every build commit: `Bluestep-Build-Of: <source sha>`, the source being the nearest
|
|
24
|
+
* ancestor that is not a build (the commit that was pushed), the same across a chain of rebuilds.
|
|
25
|
+
* @lastreviewed null
|
|
26
|
+
*/
|
|
27
|
+
exports.BUILD_OF_TRAILER = "Bluestep-Build-Of";
|
|
28
|
+
/**
|
|
29
|
+
* The source sha a commit message's {@link BUILD_OF_TRAILER} trailer names, or `null` when it names none. The web
|
|
30
|
+
* rule exactly (`UserCodeScriptHelper.buildTrailer`, ruling 67): CRLF read as LF and trailing whitespace dropped, the
|
|
31
|
+
* last paragraph is the text after the last blank line (a line of only whitespace counts, as git interpret-trailers
|
|
32
|
+
* reads it), or the whole message when there is none, and it must hold
|
|
33
|
+
* exactly one line that is, in full, `Bluestep-Build-Of: ` followed by a full lowercase commit id (40 or 64 hex). Exact
|
|
34
|
+
* case, exactly one space, nothing else on the line.
|
|
35
|
+
* @param message A commit's full message
|
|
36
|
+
* @lastreviewed null
|
|
37
|
+
*/
|
|
38
|
+
function buildSourceOf(message) {
|
|
39
|
+
const lines = message.replace(/\r\n/g, "\n").trimEnd().split("\n");
|
|
40
|
+
// A line of only whitespace separates paragraphs, as git interpret-trailers reads it.
|
|
41
|
+
let start = 0;
|
|
42
|
+
for (let i = lines.length - 1; i >= 0; i--) {
|
|
43
|
+
if (/^\s*$/.test(lines[i])) {
|
|
44
|
+
start = i + 1;
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
let found = null;
|
|
49
|
+
for (const line of lines.slice(start)) {
|
|
50
|
+
const match = TRAILER_LINE.exec(line);
|
|
51
|
+
if (match) {
|
|
52
|
+
if (found !== null) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
found = match[1];
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return found;
|
|
59
|
+
}
|
|
60
|
+
const TRAILER_LINE = /^Bluestep-Build-Of: ([0-9a-f]{40}|[0-9a-f]{64})$/;
|
|
61
|
+
/**
|
|
62
|
+
* The statuses the platform reports for a compile (`extensions.bluestepCompile[0].status`).
|
|
63
|
+
* @lastreviewed null
|
|
64
|
+
*/
|
|
65
|
+
exports.KNOWN_DRAFT_COMPILE_STATUSES = [
|
|
66
|
+
"COMPILED",
|
|
67
|
+
"GATE_TRIPPED",
|
|
68
|
+
"EMIT_WITHHELD",
|
|
69
|
+
"NOTHING_TO_COMPILE",
|
|
70
|
+
"SKIPPED_GIT_MANAGED",
|
|
71
|
+
"SKIPPED_EXTERNALLY_BUILT",
|
|
72
|
+
"OUTPUT_UPLOAD",
|
|
73
|
+
"NOT_PERMITTED",
|
|
74
|
+
"COMPILER_UNAVAILABLE",
|
|
75
|
+
"WRITE_FAILED",
|
|
76
|
+
"INPUT_INCOMPLETE",
|
|
77
|
+
"BUSY",
|
|
78
|
+
];
|
|
79
|
+
/**
|
|
80
|
+
* The retry policy of the platform contract: `BUSY` 3 times 5 s apart, `INPUT_INCOMPLETE` 3 times 2 s apart,
|
|
81
|
+
* `COMPILER_UNAVAILABLE` once, and a failed request once. Each kind has its own budget.
|
|
82
|
+
* @lastreviewed null
|
|
83
|
+
*/
|
|
84
|
+
exports.COMPILE_RETRY = {
|
|
85
|
+
BUSY: { times: 3, delayMs: 5_000 },
|
|
86
|
+
INPUT_INCOMPLETE: { times: 3, delayMs: 2_000 },
|
|
87
|
+
COMPILER_UNAVAILABLE: { times: 1, delayMs: 2_000 },
|
|
88
|
+
NETWORK: { times: 1, delayMs: 2_000 },
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* The compile statuses after which a draft can go on to publish: there is compiled output, or nothing for the platform
|
|
92
|
+
* to build.
|
|
93
|
+
* @lastreviewed null
|
|
94
|
+
*/
|
|
95
|
+
exports.PUBLISHABLE_COMPILE_STATUSES = [
|
|
96
|
+
"COMPILED",
|
|
97
|
+
"NOTHING_TO_COMPILE",
|
|
98
|
+
"SKIPPED_EXTERNALLY_BUILT",
|
|
99
|
+
];
|
|
100
|
+
/**
|
|
101
|
+
* Whether a compile status lets a draft go on to publish.
|
|
102
|
+
* @lastreviewed null
|
|
103
|
+
*/
|
|
104
|
+
function compileAllowsPublish(status) {
|
|
105
|
+
return exports.PUBLISHABLE_COMPILE_STATUSES.includes(status);
|
|
106
|
+
}
|
|
107
|
+
function isRecord(value) {
|
|
108
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
109
|
+
}
|
|
110
|
+
function str(value) {
|
|
111
|
+
return typeof value === "string" ? value : undefined;
|
|
112
|
+
}
|
|
113
|
+
function num(value, fallback = 0) {
|
|
114
|
+
return typeof value === "number" && Number.isFinite(value) ? value : fallback;
|
|
115
|
+
}
|
|
116
|
+
function strings(value) {
|
|
117
|
+
return Array.isArray(value) ? value.filter((v) => typeof v === "string") : [];
|
|
118
|
+
}
|
|
119
|
+
function parseDiagnostics(value) {
|
|
120
|
+
if (!Array.isArray(value)) {
|
|
121
|
+
return [];
|
|
122
|
+
}
|
|
123
|
+
const out = [];
|
|
124
|
+
for (const item of value) {
|
|
125
|
+
if (!isRecord(item)) {
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
const d = {
|
|
129
|
+
origin: str(item.origin) ?? "",
|
|
130
|
+
severity: str(item.severity) ?? "",
|
|
131
|
+
message: str(item.message) ?? "",
|
|
132
|
+
};
|
|
133
|
+
if (typeof item.code === "number") {
|
|
134
|
+
d.code = item.code;
|
|
135
|
+
}
|
|
136
|
+
if (typeof item.file === "string") {
|
|
137
|
+
d.file = item.file;
|
|
138
|
+
}
|
|
139
|
+
if (typeof item.line === "number") {
|
|
140
|
+
d.line = item.line;
|
|
141
|
+
}
|
|
142
|
+
if (typeof item.column === "number") {
|
|
143
|
+
d.column = item.column;
|
|
144
|
+
}
|
|
145
|
+
out.push(d);
|
|
146
|
+
}
|
|
147
|
+
return out;
|
|
148
|
+
}
|
|
149
|
+
function parseGate(value) {
|
|
150
|
+
if (!isRecord(value)) {
|
|
151
|
+
return undefined;
|
|
152
|
+
}
|
|
153
|
+
const problems = [];
|
|
154
|
+
if (Array.isArray(value.problems)) {
|
|
155
|
+
for (const p of value.problems) {
|
|
156
|
+
if (!isRecord(p)) {
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
const problem = {
|
|
160
|
+
kind: str(p.kind) ?? "",
|
|
161
|
+
tsconfig: str(p.tsconfig) ?? "",
|
|
162
|
+
message: str(p.message) ?? "",
|
|
163
|
+
accepted: p.accepted === true,
|
|
164
|
+
};
|
|
165
|
+
if (typeof p.file === "string") {
|
|
166
|
+
problem.file = p.file;
|
|
167
|
+
}
|
|
168
|
+
if (typeof p.diff === "string") {
|
|
169
|
+
problem.diff = p.diff;
|
|
170
|
+
}
|
|
171
|
+
problems.push(problem);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return {
|
|
175
|
+
tripped: value.tripped === true,
|
|
176
|
+
withheld: strings(value.withheld),
|
|
177
|
+
checked: num(value.checked),
|
|
178
|
+
problems,
|
|
179
|
+
problemsOmitted: num(value.problemsOmitted),
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Reads one element of `extensions.bluestepCompile`. A status this version does not know becomes `UNKNOWN` with the raw
|
|
184
|
+
* text kept; a missing outcome (`undefined`) is `UNKNOWN` with empty raw text.
|
|
185
|
+
* @param raw The element as parsed JSON
|
|
186
|
+
* @lastreviewed null
|
|
187
|
+
*/
|
|
188
|
+
function parseDraftCompileOutcome(raw) {
|
|
189
|
+
const item = isRecord(raw) ? raw : {};
|
|
190
|
+
const rawStatus = str(item.status) ?? "";
|
|
191
|
+
const known = exports.KNOWN_DRAFT_COMPILE_STATUSES.includes(rawStatus);
|
|
192
|
+
const outcome = {
|
|
193
|
+
status: known ? rawStatus : "UNKNOWN",
|
|
194
|
+
rawStatus,
|
|
195
|
+
errors: num(item.errors),
|
|
196
|
+
warnings: num(item.warnings),
|
|
197
|
+
written: num(item.written),
|
|
198
|
+
deleted: num(item.deleted),
|
|
199
|
+
diagnostics: parseDiagnostics(item.diagnostics),
|
|
200
|
+
diagnosticsOmitted: num(item.diagnosticsOmitted),
|
|
201
|
+
};
|
|
202
|
+
const gate = parseGate(item.gate);
|
|
203
|
+
if (gate) {
|
|
204
|
+
outcome.gate = gate;
|
|
205
|
+
}
|
|
206
|
+
return outcome;
|
|
207
|
+
}
|
|
208
|
+
const SHA = /^(?:[0-9a-f]{40}|[0-9a-f]{64})$/;
|
|
209
|
+
/**
|
|
210
|
+
* Reads one element of `extensions.bluestepBuild` (`{ script, draftSha, commit, built, vouched, status }`; only
|
|
211
|
+
* `commit` and `vouched` are read: a build commit was made exactly when `commit` differs from the pushed sha). A commit
|
|
212
|
+
* that is not a full sha (40 or 64 lowercase hex) reads as `null`; `vouched` is true only when the platform says so.
|
|
213
|
+
* @param raw The element as parsed JSON
|
|
214
|
+
* @lastreviewed null
|
|
215
|
+
*/
|
|
216
|
+
function parseDraftBuildCommit(raw) {
|
|
217
|
+
const item = isRecord(raw) ? raw : {};
|
|
218
|
+
const commit = str(item.commit);
|
|
219
|
+
return { commit: commit && SHA.test(commit) ? commit : null, vouched: item.vouched === true };
|
|
220
|
+
}
|
|
221
|
+
//# sourceMappingURL=serverBuild.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serverBuild.js","sourceRoot":"","sources":["../src/serverBuild.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;;;;AAEH;;;;GAIG;AACU,QAAA,oBAAoB,GAAG,aAAa,CAAC;AAElD;;;;GAIG;AACU,QAAA,gBAAgB,GAAG,mBAAmB,CAAC;AAEpD;;;;;;;;;GASG;AACH,uBAA8B,OAAe;IAC3C,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACnE,sFAAsF;IACtF,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3C,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAC3B,KAAK,GAAG,CAAC,GAAG,CAAC,CAAC;YACd,MAAM;QACR,CAAC;IACH,CAAC;IACD,IAAI,KAAK,GAAkB,IAAI,CAAC;IAChC,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;QACtC,MAAM,KAAK,GAAG,YAAY,CAAC,IAAI,CAAC,IAAI,CA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,IAAI,CAAC,CAAC;IAClC,IAAI,IAAI,EAAE,CAAC;QACT,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;IACtB,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,GAAG,GAAG,iCAAiC,CAAC;AAE9C;;;;;;GAMG;AACH,+BAAsC,GAAY;IAChD,MAAM,IAAI,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IACtC,MAAM,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAChC,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC;AAChG,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bluestep-systems/b6p-core-bsjs-git",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Browser- and Node-safe git client for BlueStep BSJS scripts: draft-branch editing through the platform git proxy, publish, git history and the legacy history archive",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"clean": "rm -rf dist tsconfig.tsbuildinfo",
|
|
29
29
|
"format": "prettier --write \"src/**/*.ts\"",
|
|
30
30
|
"format-check": "prettier --check \"src/**/*.ts\"",
|
|
31
|
-
"test": "npm run compile && node test/NoNodeBuiltins.test.js && node test/BrowserBundle.test.js && node test/LegacyHistory.test.js && node test/BuildManifest.test.js && node test/GitRoundTrip.test.js",
|
|
31
|
+
"test": "npm run compile && node test/NoNodeBuiltins.test.js && node test/BrowserBundle.test.js && node test/LegacyHistory.test.js && node test/BuildManifest.test.js && node test/GitRoundTrip.test.js && node test/CompileDraft.test.js",
|
|
32
32
|
"prepublishOnly": "npm run clean && npm run format-check && npm run check-types && npm run compile"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
@@ -39,6 +39,6 @@
|
|
|
39
39
|
"@types/node": "^22.20.1",
|
|
40
40
|
"esbuild": "0.28.2",
|
|
41
41
|
"prettier": "^3.0.0",
|
|
42
|
-
"typescript": "
|
|
42
|
+
"typescript": "7.0.2"
|
|
43
43
|
}
|
|
44
44
|
}
|