@bluestep-systems/b6p-core 0.8.1 → 1.0.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.
Files changed (149) hide show
  1. package/README.md +310 -32
  2. package/dist/B6PCore.d.ts +7 -0
  3. package/dist/B6PCore.js +96 -1
  4. package/dist/B6PCore.js.map +1 -1
  5. package/dist/B6PUri.d.ts +6 -8
  6. package/dist/B6PUri.js +6 -8
  7. package/dist/B6PUri.js.map +1 -1
  8. package/dist/Err.d.ts +421 -0
  9. package/dist/Err.js +558 -0
  10. package/dist/Err.js.map +1 -1
  11. package/dist/auth/BearerAuthProvider.d.ts +32 -0
  12. package/dist/auth/BearerAuthProvider.js +49 -0
  13. package/dist/auth/BearerAuthProvider.js.map +1 -1
  14. package/dist/cache/OrgCache.js.map +1 -1
  15. package/dist/cache/ScriptMetaDataStore.js.map +1 -1
  16. package/dist/constants/ApiEndpoints.d.ts +1 -0
  17. package/dist/constants/ApiEndpoints.js +1 -0
  18. package/dist/constants/ApiEndpoints.js.map +1 -1
  19. package/dist/constants/AuthTypes.js.map +1 -1
  20. package/dist/constants/BlueHQ.js.map +1 -1
  21. package/dist/constants/CryptoAlgorithms.js.map +1 -1
  22. package/dist/constants/ExtensionConfig.js.map +1 -1
  23. package/dist/constants/FileExtensions.js.map +1 -1
  24. package/dist/constants/FolderNames.js.map +1 -1
  25. package/dist/constants/Gateway.d.ts +71 -0
  26. package/dist/constants/Gateway.js +79 -0
  27. package/dist/constants/Gateway.js.map +1 -0
  28. package/dist/constants/GitHubUrls.js.map +1 -1
  29. package/dist/constants/Http.js.map +1 -1
  30. package/dist/constants/MimeTypes.js.map +1 -1
  31. package/dist/constants/Numerical.js.map +1 -1
  32. package/dist/constants/OutputChannels.js.map +1 -1
  33. package/dist/constants/SettingsKeys.d.ts +5 -0
  34. package/dist/constants/SettingsKeys.js +5 -0
  35. package/dist/constants/SettingsKeys.js.map +1 -1
  36. package/dist/constants/SpecialFiles.js.map +1 -1
  37. package/dist/constants/WebDAVElements.js.map +1 -1
  38. package/dist/constants/index.d.ts +1 -0
  39. package/dist/constants/index.js +3 -1
  40. package/dist/constants/index.js.map +1 -1
  41. package/dist/data/DownstairsPathParser.js.map +1 -1
  42. package/dist/data/GlobMatcher.js.map +1 -1
  43. package/dist/data/IdUtility.js.map +1 -1
  44. package/dist/data/OrgWorker.js.map +1 -1
  45. package/dist/data/ScriptKey.d.ts +3 -27
  46. package/dist/data/ScriptKey.js +12 -24
  47. package/dist/data/ScriptKey.js.map +1 -1
  48. package/dist/data/ScriptUrlParser.js +3 -1
  49. package/dist/data/ScriptUrlParser.js.map +1 -1
  50. package/dist/data/ServerVersion.d.ts +76 -0
  51. package/dist/data/ServerVersion.js +111 -0
  52. package/dist/data/ServerVersion.js.map +1 -0
  53. package/dist/data/index.d.ts +2 -0
  54. package/dist/data/index.js +7 -1
  55. package/dist/data/index.js.map +1 -1
  56. package/dist/gateway/GatewayClient.d.ts +147 -0
  57. package/dist/gateway/GatewayClient.js +395 -0
  58. package/dist/gateway/GatewayClient.js.map +1 -0
  59. package/dist/gateway/GatewayContext.d.ts +43 -0
  60. package/dist/gateway/GatewayContext.js +3 -0
  61. package/dist/gateway/GatewayContext.js.map +1 -0
  62. package/dist/gateway/GatewayGit.d.ts +291 -0
  63. package/dist/gateway/GatewayGit.js +731 -0
  64. package/dist/gateway/GatewayGit.js.map +1 -0
  65. package/dist/gateway/GatewayKb.d.ts +173 -0
  66. package/dist/gateway/GatewayKb.js +354 -0
  67. package/dist/gateway/GatewayKb.js.map +1 -0
  68. package/dist/gateway/GatewayMarketplace.d.ts +116 -0
  69. package/dist/gateway/GatewayMarketplace.js +278 -0
  70. package/dist/gateway/GatewayMarketplace.js.map +1 -0
  71. package/dist/gateway/GatewayService.d.ts +47 -0
  72. package/dist/gateway/GatewayService.js +54 -0
  73. package/dist/gateway/GatewayService.js.map +1 -0
  74. package/dist/gateway/GatewayToken.d.ts +18 -0
  75. package/dist/gateway/GatewayToken.js +43 -0
  76. package/dist/gateway/GatewayToken.js.map +1 -0
  77. package/dist/gateway/GatewayTokenService.d.ts +101 -0
  78. package/dist/gateway/GatewayTokenService.js +465 -0
  79. package/dist/gateway/GatewayTokenService.js.map +1 -0
  80. package/dist/index.d.ts +29 -8
  81. package/dist/index.js +81 -9
  82. package/dist/index.js.map +1 -1
  83. package/dist/network/HttpClient.js.map +1 -1
  84. package/dist/network/HttpClientProvider.js.map +1 -1
  85. package/dist/network/StatusCodes.js.map +1 -1
  86. package/dist/persistence/PersistablePseudoMap.js.map +1 -1
  87. package/dist/persistence/PersistenceKeys.js.map +1 -1
  88. package/dist/persistence/PrivatePersistanceMap.js.map +1 -1
  89. package/dist/persistence/PseudoMap.js.map +1 -1
  90. package/dist/persistence/PublicPersistanceMap.js.map +1 -1
  91. package/dist/persistence/Serializable.js.map +1 -1
  92. package/dist/persistence/SharedFilePersistence.d.ts +22 -0
  93. package/dist/persistence/SharedFilePersistence.js +65 -14
  94. package/dist/persistence/SharedFilePersistence.js.map +1 -1
  95. package/dist/persistence/TypedMap.js.map +1 -1
  96. package/dist/persistence/TypedPersistable.js.map +1 -1
  97. package/dist/persistence/TypedPrivatePersistable.js.map +1 -1
  98. package/dist/persistence/dirLockdown.js.map +1 -1
  99. package/dist/providers.d.ts +46 -16
  100. package/dist/script/GitIdentity.d.ts +48 -0
  101. package/dist/script/GitIdentity.js +52 -0
  102. package/dist/script/GitIdentity.js.map +1 -0
  103. package/dist/script/GitSync.d.ts +388 -0
  104. package/dist/script/GitSync.js +1068 -0
  105. package/dist/script/GitSync.js.map +1 -0
  106. package/dist/script/ScriptContext.d.ts +20 -5
  107. package/dist/script/ScriptFactory.d.ts +1 -2
  108. package/dist/script/ScriptFactory.js +1 -2
  109. package/dist/script/ScriptFactory.js.map +1 -1
  110. package/dist/script/ScriptFile.d.ts +0 -94
  111. package/dist/script/ScriptFile.js +0 -245
  112. package/dist/script/ScriptFile.js.map +1 -1
  113. package/dist/script/ScriptFolder.d.ts +0 -9
  114. package/dist/script/ScriptFolder.js +4 -7
  115. package/dist/script/ScriptFolder.js.map +1 -1
  116. package/dist/script/ScriptNode.d.ts +0 -9
  117. package/dist/script/ScriptNode.js.map +1 -1
  118. package/dist/script/ScriptRoot.d.ts +0 -65
  119. package/dist/script/ScriptRoot.js +0 -199
  120. package/dist/script/ScriptRoot.js.map +1 -1
  121. package/dist/script/ScriptService.d.ts +113 -9
  122. package/dist/script/ScriptService.js +164 -52
  123. package/dist/script/ScriptService.js.map +1 -1
  124. package/dist/script/ServerCompile.d.ts +35 -0
  125. package/dist/script/ServerCompile.js +40 -0
  126. package/dist/script/ServerCompile.js.map +1 -0
  127. package/dist/script/TsConfig.d.ts +2 -2
  128. package/dist/script/TsConfig.js +3 -3
  129. package/dist/script/TsConfig.js.map +1 -1
  130. package/dist/script/push.d.ts +162 -188
  131. package/dist/script/push.js +216 -474
  132. package/dist/script/push.js.map +1 -1
  133. package/dist/session/SessionManager.js.map +1 -1
  134. package/dist/testing/FakeGateway.d.ts +280 -0
  135. package/dist/testing/FakeGateway.js +627 -0
  136. package/dist/testing/FakeGateway.js.map +1 -0
  137. package/dist/testing/MockFileSystem.js.map +1 -1
  138. package/dist/types.d.ts +332 -0
  139. package/dist/update/UpdateService.js.map +1 -1
  140. package/package.json +17 -12
  141. package/dist/script/ScriptTranspiler.d.ts +0 -121
  142. package/dist/script/ScriptTranspiler.js +0 -333
  143. package/dist/script/ScriptTranspiler.js.map +0 -1
  144. package/dist/script/SnapshotHistoryRecorder.d.ts +0 -47
  145. package/dist/script/SnapshotHistoryRecorder.js +0 -231
  146. package/dist/script/SnapshotHistoryRecorder.js.map +0 -1
  147. package/dist/script/TsLibResolver.d.ts +0 -60
  148. package/dist/script/TsLibResolver.js +0 -134
  149. package/dist/script/TsLibResolver.js.map +0 -1
@@ -1,333 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.ScriptTranspiler = void 0;
40
- const typescript_1 = __importDefault(require("typescript"));
41
- const path = __importStar(require("path"));
42
- const Err_1 = require("../Err");
43
- const constants_1 = require("../constants");
44
- const B6PUri_1 = require("../B6PUri");
45
- const ScriptFactory_1 = require("./ScriptFactory");
46
- const TsLibResolver_1 = require("./TsLibResolver");
47
- /**
48
- * Compiler for TypeScript files in script projects.
49
- * Manages compilation of multiple TypeScript files organized by their tsconfig.json files.
50
- * @lastreviewed 2025-10-01
51
- */
52
- class ScriptTranspiler {
53
- ctx;
54
- projects = new Map();
55
- static DEFAULT_TS_CONFIG = {
56
- module: typescript_1.default.ModuleKind.ESNext,
57
- target: typescript_1.default.ScriptTarget.ES2022,
58
- outDir: constants_1.FolderNames.DOT_BUILD,
59
- strict: true,
60
- esModuleInterop: true,
61
- skipLibCheck: true,
62
- forceConsistentCasingInFileNames: true,
63
- sourceMap: false,
64
- inlineSourceMap: false,
65
- allowJs: false,
66
- noEmitOnError: false,
67
- suppressOutputPathCheck: true,
68
- declarationDir: undefined,
69
- declaration: false,
70
- listEmittedFiles: true,
71
- };
72
- constructor(ctx) {
73
- this.ctx = ctx;
74
- }
75
- getDefaultOptions(sf) {
76
- throw new Err_1.Err.InvalidStateError("did not find a tsconfig for " + sf.path() + ".");
77
- const LOCAL_CONFIG = ScriptTranspiler.DEFAULT_TS_CONFIG;
78
- LOCAL_CONFIG.rootDir = sf.getScriptRoot().getDraftFolder().path();
79
- return LOCAL_CONFIG;
80
- }
81
- async getProjectConfig(sn) {
82
- const tsConfigFile = await sn.getClosestTsConfigFile();
83
- if (!tsConfigFile) {
84
- this.ctx.logger.info("No tsconfig.json found, using default compiler options.");
85
- return { options: this.getDefaultOptions(sn), declarationRootFiles: [] };
86
- }
87
- const tsconfigTextArray = await this.ctx.fs.readFile(B6PUri_1.B6PUri.fromFsPath(tsConfigFile.uri().fsPath));
88
- const pseudoParsedConfig = typescript_1.default.parseConfigFileTextToJson(tsConfigFile.path(), Buffer.from(tsconfigTextArray).toString("utf-8"));
89
- if (pseudoParsedConfig.error) {
90
- const message = typescript_1.default.flattenDiagnosticMessageText(pseudoParsedConfig.error.messageText, "\n");
91
- throw new Err_1.Err.CompilationError(`Error parsing tsconfig.json at ${tsConfigFile.path()}: ${message}`);
92
- }
93
- pseudoParsedConfig.config.compilerOptions = pseudoParsedConfig.config.compilerOptions ?? {};
94
- pseudoParsedConfig.config.compilerOptions.rootDir = tsConfigFile.folder().path();
95
- // Resolve the ambient declaration files the tsconfig's include/files pull in
96
- // BEFORE the options-only parse below stubs out readDirectory. Without this
97
- // the transpile can't see the platform globals and the type-check is a
98
- // syntax check only (see resolveDeclarationRootFiles).
99
- const declarationRootFiles = ScriptTranspiler.resolveDeclarationRootFiles(tsConfigFile.path(), pseudoParsedConfig.config);
100
- if (declarationRootFiles.length > 0) {
101
- this.ctx.logger.info(`Including ${declarationRootFiles.length} declaration file(s) in the type-check:\n` +
102
- declarationRootFiles.join("\n"));
103
- }
104
- // The "no declarations resolved" case is NOT warned here: a client-bundle
105
- // tsconfig (e.g. a MergeReport `static/`) legitimately pulls in none, so a
106
- // per-project warning would fire on every such push. transpile() warns only
107
- // for the gated draft-root project, where empty declarations really do mean
108
- // an ineffective type-check.
109
- const parsedConfig = typescript_1.default.parseJsonConfigFileContent(pseudoParsedConfig.config, {
110
- ...typescript_1.default.sys,
111
- readDirectory: () => [],
112
- }, tsConfigFile.folder().path(), undefined, tsConfigFile.path());
113
- this.ctx.logger.info("Using tsconfig.json compiler options from:", tsConfigFile.path());
114
- return { options: ScriptTranspiler.applyTranspileInvariants(parsedConfig.options), declarationRootFiles };
115
- }
116
- /**
117
- * Resolve the ambient declaration files (`*.d.ts`) a tsconfig pulls in via its
118
- * `include`/`files`. These carry the platform globals — `B`, `console`, the
119
- * generated `MEFR_*`/`Record_*` types, the `Bluestep` namespace, imported
120
- * query globals — declared in the component's sibling `declarations/` tree
121
- * (a real draft tsconfig's `include` starts with `../declarations/index.d.ts`).
122
- *
123
- * The transpile builds its own root-file list by walking the `draft/` folder
124
- * and parses the tsconfig with `readDirectory: () => []`, so the tsconfig's
125
- * `include` — which points OUTSIDE `draft/` — is otherwise dropped. That left
126
- * every platform global an unresolved "Cannot find name" and reduced the only
127
- * pre-publish type-check to a syntax check, so a push shipped un-type-checked
128
- * JavaScript while reporting success (ClickUp 86bbeb659). Ambient `.d.ts`
129
- * emit no JavaScript, so adding them to the program's root files fixes the
130
- * type-check without changing the emitted-file set — the same effect as a
131
- * hand-written `/// <reference path="../../declarations/index.d.ts" />`.
132
- *
133
- * Resolution uses the real `ts.sys` (not the stubbed `readDirectory`) so
134
- * globbed includes resolve, then keeps only existing `.d.ts` so a stale
135
- * include entry cannot itself introduce a "file not found" diagnostic.
136
- * @lastreviewed null
137
- */
138
- static resolveDeclarationRootFiles(tsConfigPath, configJson) {
139
- const parsed = typescript_1.default.parseJsonConfigFileContent(configJson, typescript_1.default.sys, path.dirname(tsConfigPath), undefined, tsConfigPath);
140
- return parsed.fileNames.filter((f) => ScriptTranspiler.isDeclarationFile(f) && typescript_1.default.sys.fileExists(f));
141
- }
142
- /**
143
- * Whether a path is an ambient declaration file — matched broadly enough
144
- * (`.d.ts`, `.d.mts`, `.d.cts`) that a future switch to a module-flavored
145
- * declaration name cannot silently drop the platform globals and regress the
146
- * type-check back to syntax-only.
147
- * @lastreviewed null
148
- */
149
- static isDeclarationFile(fsPath) {
150
- return /\.d\.(ts|mts|cts)$/i.test(fsPath);
151
- }
152
- /**
153
- * Force the invariants this transpile step depends on onto a set of parsed
154
- * compiler options, regardless of what the project's tsconfig.json specified.
155
- *
156
- * - `listEmittedFiles`: we return the emitted paths to the caller.
157
- * - `skipLibCheck`: this step is a transpile/emit gate, not a full lib audit.
158
- * Without it, a legitimate project `lib: ["dom", "WebWorker"]` (e.g. a
159
- * MergeReport `static/` client bundle) produces 30+ lib-vs-lib conflicts
160
- * (`ImportExportKind`, duplicate index signatures, `location` mismatch, ...)
161
- * that have nothing to do with the project's own code.
162
- * - `noEmitOnError`: emit must succeed even when type diagnostics exist —
163
- * the platform never type-checks (it runs the emitted JS on GraalVM) and a
164
- * component's local declarations may be incomplete, so a diagnostic must not
165
- * block the emit a push depends on. This is NOT the same as swallowing the
166
- * diagnostics: `transpile` returns their count so the push surfaces them
167
- * loudly instead of reporting a clean success (ClickUp 86bbeb659).
168
- * @lastreviewed null
169
- */
170
- static applyTranspileInvariants(options) {
171
- options.listEmittedFiles = true;
172
- options.skipLibCheck = true;
173
- options.noEmitOnError = false;
174
- return options;
175
- }
176
- async addFile(sn) {
177
- if (await sn.isFolder()) {
178
- this.ctx.logger.warn("Ignoring folder node in ScriptCompiler.addFile:", sn.path());
179
- return void 0;
180
- }
181
- if (!(await sn.isCopacetic())) {
182
- throw new Err_1.Err.ScriptNotCopaceticError();
183
- }
184
- const newTsConfigFile = await sn.getClosestTsConfigFile();
185
- const vals = this.projects.get(newTsConfigFile.path()) || [];
186
- if (!vals.some((existingSn) => existingSn.path() === sn.path())) {
187
- vals.push(sn);
188
- }
189
- else {
190
- this.ctx.logger.warn("Ignoring duplicate file in ScriptCompiler.addFile:", sn.path());
191
- }
192
- this.projects.set(newTsConfigFile.path(), vals);
193
- }
194
- async transpile(sharedRoot) {
195
- const f = sharedRoot ? sharedRoot.factory : new ScriptFactory_1.ScriptFactory(this.ctx);
196
- // The draft-root tsconfig governs the platform-compiled scripts (`scripts/*.ts`)
197
- // — the ONLY code whose type-check gates the push. Nested tsconfigs are
198
- // client bundles (e.g. a MergeReport `static/`) whose diagnostics stay
199
- // advisory: they legitimately reference browser-only third-party globals the
200
- // component declares nowhere, so gating on them would fail a push over benign
201
- // noise (see the b6p-push skill's third-party-lib-type-noise gotcha). When no
202
- // root is supplied we can't tell them apart, so we gate on everything.
203
- const draftRootTsConfigPath = sharedRoot ? sharedRoot.getDraftTsConfigPath() : null;
204
- const emittedFiles = [];
205
- const gatedDiagnostics = [];
206
- // Whether the gated (draft-root) project was actually among the compiled
207
- // projects. If a component's TS all lives under nested client bundles and
208
- // nothing is governed by the draft-root tsconfig, no platform-code
209
- // type-check ran — and `diagnosticCount: 0` would falsely read as "checked
210
- // clean". We return `null` in that case instead (ClickUp 86bbeb659 review).
211
- let gatedProjectCompiled = false;
212
- for (const [tsConfigPath, sfList] of this.projects.entries()) {
213
- if (sfList.length === 0) {
214
- throw new Err_1.Err.NoFilesToCompileError(tsConfigPath);
215
- }
216
- const sf = f.createFile(B6PUri_1.B6PUri.fromFsPath(tsConfigPath), sharedRoot);
217
- const { options: compilerOptions, declarationRootFiles } = await this.getProjectConfig(sf);
218
- const sfPaths = sfList.map((sf) => sf.uri().fsPath);
219
- const isGated = draftRootTsConfigPath === null || path.normalize(tsConfigPath) === draftRootTsConfigPath;
220
- if (isGated) {
221
- gatedProjectCompiled = true;
222
- // Only the gated draft-root project needs declarations to type-check
223
- // meaningfully; an empty set here means the check is effectively a
224
- // syntax pass, which is exactly the regression this guards against.
225
- if (declarationRootFiles.length === 0) {
226
- this.ctx.logger.warn(`No declaration files resolved from ${tsConfigPath} (include/files) — ` +
227
- `platform globals may be unresolved and the type-check ineffective.`);
228
- }
229
- }
230
- const { emittedFiles: projectEmitted, diagnostics: allDiagnostics, emitSkipped, } = this.compileProject(tsConfigPath, sfPaths, declarationRootFiles, compilerOptions);
231
- emittedFiles.push(...projectEmitted);
232
- // Contract: this step is an emit gate, not a hard type-audit gate. A
233
- // genuine emit failure is FATAL — we throw so callers
234
- // (ScriptRoot.compileDraftFolder → executePush) abort instead of pushing
235
- // missing JavaScript. Type diagnostics do NOT block emit (the platform
236
- // never type-checks — it runs the emitted JS on GraalVM, and local
237
- // declarations may be incomplete). For the platform-compiled draft-root
238
- // project they are NO LONGER silently advisory: the count is returned so
239
- // the push reports loudly instead of claiming a clean success (ClickUp
240
- // 86bbeb659). Client-bundle diagnostics stay advisory (logged, not gated).
241
- if (emitSkipped) {
242
- throw new Err_1.Err.CompilationError(`TypeScript emit was skipped for ${tsConfigPath}; no JavaScript was produced.` +
243
- (allDiagnostics.length > 0 ? "\n" + this.formatDiagnostics(allDiagnostics) : ""));
244
- }
245
- else if (allDiagnostics.length > 0) {
246
- if (isGated) {
247
- gatedDiagnostics.push(...allDiagnostics);
248
- this.ctx.logger.warn(`TypeScript reported ${allDiagnostics.length} diagnostic(s) for ${tsConfigPath}:\n` +
249
- this.formatDiagnostics(allDiagnostics));
250
- }
251
- else {
252
- this.ctx.logger.warn(`TypeScript reported ${allDiagnostics.length} advisory diagnostic(s) for client bundle ` +
253
- `${tsConfigPath} (not gated — client-side globals may be intentionally undeclared):\n` +
254
- this.formatDiagnostics(allDiagnostics));
255
- }
256
- }
257
- else {
258
- this.ctx.logger.info(`TypeScript type-checked ${tsConfigPath} cleanly.`);
259
- }
260
- }
261
- return {
262
- emittedFiles,
263
- diagnosticCount: gatedProjectCompiled ? gatedDiagnostics.length : null,
264
- diagnosticText: this.formatDiagnostics(gatedDiagnostics),
265
- };
266
- }
267
- /**
268
- * Build the `ts.Program` for one tsconfig project and emit it, returning the
269
- * emitted files and the combined pre-emit + emit diagnostics.
270
- *
271
- * The declaration files come FIRST so the type-check resolves platform
272
- * globals; ambient `.d.ts` emit nothing, so adding them changes only what is
273
- * type-checked, not the emitted-file set (the invariant the regression test
274
- * pins). The `Set` dedupes only exact string matches — declaration paths come
275
- * from `ts.sys` (forward slashes) and `sfPaths` from `B6PUri` (native
276
- * separators), so on Windows a `.d.ts` also under the draft tree may appear
277
- * twice; harmless (TypeScript canonicalizes internally, and a `.d.ts` still
278
- * emits nothing), just not deduped here.
279
- * @lastreviewed null
280
- */
281
- compileProject(tsConfigPath, sfPaths, declarationRootFiles, options) {
282
- const rootFiles = Array.from(new Set([...declarationRootFiles, ...sfPaths]));
283
- const program = this.createProgram(rootFiles, options, tsConfigPath);
284
- const emitResult = program.emit();
285
- const diagnostics = typescript_1.default.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
286
- return { emittedFiles: emitResult.emittedFiles ?? [], diagnostics, emitSkipped: emitResult.emitSkipped };
287
- }
288
- /**
289
- * Create a `ts.Program` with a `CompilerHost` whose default-library resolution
290
- * does NOT depend on `__filename`.
291
- *
292
- * b6p-core is bundled into the consumer's single-file CLI / SEA binary, so
293
- * TypeScript's default `getDefaultLibLocation()` (= `dirname(__filename)`)
294
- * points at the bundle directory, where no `lib.*.d.ts` exist. We resolve the
295
- * lib directory via {@link TsLibResolver} and override the two host methods
296
- * that steer lib lookup. If no lib directory can be found we fall back to the
297
- * default host behavior rather than pointing it at a bogus path.
298
- * @lastreviewed null
299
- */
300
- createProgram(fileNames, options, tsConfigPath) {
301
- const host = typescript_1.default.createCompilerHost(options);
302
- const libDir = TsLibResolver_1.TsLibResolver.resolveLibDir({
303
- explicitDirs: this.ctx.typescriptLibDirs,
304
- projectDirs: [path.dirname(tsConfigPath), process.cwd()],
305
- });
306
- if (libDir) {
307
- this.ctx.logger.info(`Resolved TypeScript lib directory: ${libDir}`);
308
- host.getDefaultLibLocation = () => libDir;
309
- host.getDefaultLibFileName = (o) => path.join(libDir, typescript_1.default.getDefaultLibFileName(o));
310
- }
311
- else {
312
- this.ctx.logger.warn("Could not resolve a TypeScript lib directory; falling back to default host resolution. " +
313
- "If this run is bundled (CLI/SEA), lib diagnostics are expected — supply providers.typescriptLibDirs.");
314
- }
315
- return typescript_1.default.createProgram(fileNames, options, host);
316
- }
317
- formatDiagnostics(diagnostics) {
318
- return diagnostics
319
- .map((diagnostic) => {
320
- if (diagnostic.file) {
321
- const { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
322
- const message = typescript_1.default.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
323
- return `${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`;
324
- }
325
- else {
326
- return typescript_1.default.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
327
- }
328
- })
329
- .join("\n");
330
- }
331
- }
332
- exports.ScriptTranspiler = ScriptTranspiler;
333
- //# sourceMappingURL=ScriptTranspiler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ScriptTranspiler.js","sourceRoot":"","sources":["../../src/script/ScriptTranspiler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4DAA4B;AAC5B,2CAA6B;AAC7B,gCAA6B;AAG7B,4CAA2C;AAC3C,sCAAmC;AAEnC,mDAAgD;AAChD,mDAAgD;AA2BhD;;;;GAIG;AACH,MAAa,gBAAgB;IAoBE;IAnBrB,QAAQ,GAA8B,IAAI,GAAG,EAAE,CAAC;IAChD,MAAM,CAAC,iBAAiB,GAAuB;QACrD,MAAM,EAAE,oBAAE,CAAC,UAAU,CAA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AAC;;AAxUH,4CAyUC"}
@@ -1,47 +0,0 @@
1
- import type { ScriptRoot } from "./ScriptRoot";
2
- /**
3
- * Records snapshot history by writing a history entry to the script's object map
4
- * via a GraphQL mutation. This makes snapshots taken from VS Code appear in the
5
- * browser IDE's "Project History" view.
6
- */
7
- export declare class SnapshotHistoryRecorder {
8
- /**
9
- * Record one history entry for the snapshot that was just pushed, via the
10
- * script type's GraphQL update mutation. Retries on the platform's
11
- * optimistic-locking "version mismatch" rejection only (see the loop below);
12
- * every other failure throws on the first attempt.
13
- * @param scriptRoot The script whose draft tree was just snapshot-pushed
14
- * @param message The user's snapshot message ("" for none)
15
- * @param opts.retryDelaysMs Backoff schedule overriding
16
- * {@link VERSION_MISMATCH_RETRY_DELAYS_MS} (one retry per entry); used by tests
17
- * @throws an {@link Err.HttpResponseError} When the mutation ultimately fails
18
- * @lastreviewed null
19
- */
20
- static record(scriptRoot: ScriptRoot, message: string, opts?: {
21
- retryDelaysMs?: number[];
22
- }): Promise<void>;
23
- /**
24
- * Default backoff schedule for retrying the history mutation after a
25
- * server-side optimistic-locking "version mismatch" rejection (one retry per
26
- * entry). Tests inject their own schedule via `record()`'s `retryDelaysMs`
27
- * option rather than mutating shared state.
28
- * @lastreviewed null
29
- */
30
- private static readonly VERSION_MISMATCH_RETRY_DELAYS_MS;
31
- /**
32
- * The author recorded alongside a snapshot.
33
- *
34
- * Under basic auth this was the stored username. Bearer tokens are opaque and
35
- * carry no client-readable identity, and `author` is embedded in the
36
- * client-composed `historyKey` blob rather than a schema field the server can
37
- * backfill — so there is currently no identity to record.
38
- *
39
- * //HUMAN-REVIEW-NEEDED restoring a real author requires an identity source:
40
- * either a `/whoami`-style lookup against the token, or the login response
41
- * carrying the principal into `SessionData`.
42
- * @lastreviewed null
43
- */
44
- private static readonly UNKNOWN_AUTHOR;
45
- private static buildSaveState;
46
- private static stripContent;
47
- }
@@ -1,231 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.SnapshotHistoryRecorder = void 0;
37
- const path = __importStar(require("path"));
38
- const constants_1 = require("../constants");
39
- const MimeTypes_1 = require("../constants/MimeTypes");
40
- const Err_1 = require("../Err");
41
- const B6PUri_1 = require("../B6PUri");
42
- /**
43
- * Text file extensions that should have their content included in history snapshots.
44
- */
45
- const TEXT_EXTENSIONS = new Set([
46
- ".ts",
47
- ".tsx",
48
- ".js",
49
- ".jsx",
50
- ".json",
51
- ".md",
52
- ".css",
53
- ".scss",
54
- ".html",
55
- ".htm",
56
- ".xml",
57
- ".svg",
58
- ".txt",
59
- ".yaml",
60
- ".yml",
61
- ]);
62
- /**
63
- * Records snapshot history by writing a history entry to the script's object map
64
- * via a GraphQL mutation. This makes snapshots taken from VS Code appear in the
65
- * browser IDE's "Project History" view.
66
- */
67
- class SnapshotHistoryRecorder {
68
- /**
69
- * Record one history entry for the snapshot that was just pushed, via the
70
- * script type's GraphQL update mutation. Retries on the platform's
71
- * optimistic-locking "version mismatch" rejection only (see the loop below);
72
- * every other failure throws on the first attempt.
73
- * @param scriptRoot The script whose draft tree was just snapshot-pushed
74
- * @param message The user's snapshot message ("" for none)
75
- * @param opts.retryDelaysMs Backoff schedule overriding
76
- * {@link VERSION_MISMATCH_RETRY_DELAYS_MS} (one retry per entry); used by tests
77
- * @throws an {@link Err.HttpResponseError} When the mutation ultimately fails
78
- * @lastreviewed null
79
- */
80
- static async record(scriptRoot, message, opts) {
81
- const ctx = scriptRoot.ctx;
82
- const scriptKey = await scriptRoot.getScriptKey();
83
- const mutationName = scriptKey.mutationName;
84
- const inputType = scriptKey.inputType;
85
- if (!mutationName || !inputType) {
86
- ctx.logger.warn(`No GraphQL mutation known for classid ${scriptKey.classid}; skipping history recording.`);
87
- return;
88
- }
89
- const author = this.UNKNOWN_AUTHOR;
90
- const saveState = await this.buildSaveState(scriptRoot);
91
- const historyKey = JSON.stringify({
92
- author,
93
- timestamp: new Date().toISOString(),
94
- message: message || undefined,
95
- });
96
- const historyValue = JSON.stringify(saveState);
97
- const draftValue = JSON.stringify({ ...saveState, settings: this.stripContent(saveState.settings) });
98
- const origin = await scriptRoot.anyOrigin();
99
- const gqlUrl = new URL("gql", origin);
100
- const query = `mutation Snapshot($inputs: [${inputType}!]!) { ${mutationName}(inputs: $inputs) { id } }`;
101
- const variables = {
102
- inputs: [
103
- {
104
- topId: scriptKey.toCompoundId(),
105
- draft: draftValue,
106
- addMapObjectEntries: [{ key: historyKey, value: historyValue }],
107
- },
108
- ],
109
- };
110
- ctx.logger.info(`Recording snapshot history for ${scriptKey.toCompoundId()}`);
111
- // The upload that just finished bumps the script object's version on the
112
- // platform, and the bump can still be settling when this mutation lands —
113
- // the server then rejects it with an optimistic-locking "version mismatch"
114
- // error even though nothing else touched the script. That state resolves
115
- // itself in moments, so a mismatch is retried with backoff; every other
116
- // failure is thrown on the first attempt.
117
- const retryDelaysMs = opts?.retryDelaysMs ?? SnapshotHistoryRecorder.VERSION_MISMATCH_RETRY_DELAYS_MS;
118
- const maxAttempts = retryDelaysMs.length + 1;
119
- // Serialized once: `variables` embeds the full draft-tree content, so
120
- // re-stringifying megabytes per retry would be pure waste. The request-init
121
- // OBJECT stays per-attempt — csrfFetch mutates `options.headers` in place,
122
- // and a shared literal would leak the previous attempt's CSRF token forward.
123
- const body = JSON.stringify({ query, variables });
124
- for (let attempt = 1; attempt <= maxAttempts; attempt++) {
125
- const response = await ctx.sessionManager.csrfFetch(gqlUrl, {
126
- method: constants_1.Http.Methods.POST,
127
- headers: {
128
- [constants_1.Http.Headers.CONTENT_TYPE]: MimeTypes_1.MimeTypes.APPLICATION_JSON,
129
- },
130
- body,
131
- });
132
- if (!response.ok) {
133
- const text = await response.text();
134
- throw new Err_1.Err.HttpResponseError(`Failed to record snapshot history: ${response.status} ${text}`);
135
- }
136
- const json = (await response.json());
137
- if (!json.errors?.length) {
138
- ctx.logger.info("Snapshot history recorded successfully.");
139
- return;
140
- }
141
- const messages = json.errors.map((e) => e.message).join(", ");
142
- // Anchored on the optimistic-lock wording ("Unable to update BaseTable
143
- // because of version mismatch: expected ver. 5, actual ver. 6") plus the
144
- // numbered version clause on its own, in case the server ever drops the
145
- // lead-in. Deliberately NOT a bare /version mismatch/: that would also
146
- // retry unrelated fatal errors that happen to contain the phrase (e.g. a
147
- // schema/client version complaint), burning the whole backoff budget.
148
- const isVersionMismatch = /because of version mismatch|expected ver\.\s*\d+/i.test(messages);
149
- if (isVersionMismatch && attempt < maxAttempts) {
150
- const delayMs = retryDelaysMs[attempt - 1];
151
- ctx.logger.info(`Snapshot history hit a version mismatch (the platform is still settling the pushed files); ` +
152
- `attempt ${attempt} of ${maxAttempts} failed, retrying in ${delayMs}ms...`);
153
- await new Promise((resolve) => setTimeout(resolve, delayMs));
154
- continue;
155
- }
156
- throw new Err_1.Err.HttpResponseError(`GraphQL errors recording snapshot history: ${messages}`);
157
- }
158
- }
159
- /**
160
- * Default backoff schedule for retrying the history mutation after a
161
- * server-side optimistic-locking "version mismatch" rejection (one retry per
162
- * entry). Tests inject their own schedule via `record()`'s `retryDelaysMs`
163
- * option rather than mutating shared state.
164
- * @lastreviewed null
165
- */
166
- static VERSION_MISMATCH_RETRY_DELAYS_MS = [1_000, 2_000, 4_000];
167
- /**
168
- * The author recorded alongside a snapshot.
169
- *
170
- * Under basic auth this was the stored username. Bearer tokens are opaque and
171
- * carry no client-readable identity, and `author` is embedded in the
172
- * client-composed `historyKey` blob rather than a schema field the server can
173
- * backfill — so there is currently no identity to record.
174
- *
175
- * //HUMAN-REVIEW-NEEDED restoring a real author requires an identity source:
176
- * either a `/whoami`-style lookup against the token, or the login response
177
- * carrying the principal into `SessionData`.
178
- * @lastreviewed null
179
- */
180
- static UNKNOWN_AUTHOR = "unknown";
181
- static async buildSaveState(scriptRoot) {
182
- const ctx = scriptRoot.ctx;
183
- const draftFolder = scriptRoot.getDraftFolder();
184
- const allNodes = await draftFolder.flatten();
185
- const draftRootPath = draftFolder.uri().fsPath;
186
- const settings = {};
187
- for (const node of allNodes) {
188
- const relativePath = "/" + path.relative(draftRootPath, node.path()).replace(/\\/g, "/");
189
- if (await node.isInItsRespectiveBuildFolder()) {
190
- continue;
191
- }
192
- if (await node.isFolder()) {
193
- const folderPath = relativePath.endsWith("/") ? relativePath : relativePath + "/";
194
- settings[folderPath] = {};
195
- }
196
- else {
197
- const ext = path.extname(node.path()).toLowerCase();
198
- if (TEXT_EXTENSIONS.has(ext)) {
199
- try {
200
- const bytes = await ctx.fs.readFile(B6PUri_1.B6PUri.fromFsPath(node.uri().fsPath));
201
- const content = Buffer.from(bytes).toString("utf-8");
202
- settings[relativePath] = { content };
203
- }
204
- catch (e) {
205
- ctx.logger.warn(`Failed to read file for history: ${node.path()}: ${e}`);
206
- }
207
- }
208
- }
209
- }
210
- return {
211
- version: 1,
212
- isSnapshot: true,
213
- settings,
214
- };
215
- }
216
- static stripContent(settings) {
217
- const stripped = {};
218
- for (const [key, value] of Object.entries(settings)) {
219
- if ("content" in value) {
220
- const { content, ...rest } = value;
221
- stripped[key] = rest;
222
- }
223
- else {
224
- stripped[key] = value;
225
- }
226
- }
227
- return stripped;
228
- }
229
- }
230
- exports.SnapshotHistoryRecorder = SnapshotHistoryRecorder;
231
- //# sourceMappingURL=SnapshotHistoryRecorder.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SnapshotHistoryRecorder.js","sourceRoot":"","sources":["../../src/script/SnapshotHistoryRecorder.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA6B;AAC7B,4CAAoC;AACpC,sDAAmD;AACnD,gCAA6B;AAC7B,sCAAmC;AAGnC;;GAEG;AACH,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC;IAC9B,KAAK;IACL,MAAM;IACN,KAAK;IACL,MAAM;IACN,OAAO;IACP,KAAK;IACL,MAAM;IACN,OAAO;IACP,OAAO;IACP,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,OAAO;IACP,MAAM;CACP,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAa,uBAAuB;IAClC;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,UAAsB,EAAE,OAAe,EAAE,IAAmC;QAC9F,MAAM,GAAG,GAAG,UAAU,CAAC,GAAG,CAAC;QAC3B,MAAM,SAAS,GAAG,MAAM,UAAU,CAAC,YAAY,EAAE,CAAC;QAClD,MAAM,YAAY,GAAG,SAAS,CAAC,YAAY,CAAC;QAC5C,MAAM,SAAS,GAAG,SAAS,CAAC,SAAS,CAAC;QAEtC,IAAI,CAAC,YAAY,IAAI,CAAC,SAAS,EAAE,CAAC;YAChC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,yC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