fix(apps): resolve strict-mode TypeScript errors in packages/apps/src#40187
fix(apps): resolve strict-mode TypeScript errors in packages/apps/src#40187d-gubert wants to merge 19 commits intofeat/apps-engine-split--pr2c-flip-the-switchfrom
Conversation
|
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Looks like this PR is not ready to merge, because of the following issues:
Please fix the issues and try again If you have any trouble, please check the PR guidelines |
Adds `src/definition/version.ts` which reads the package version via
`resolveJsonModule` and exports it as `ENGINE_VERSION`.
Replaces `AppPackageParser.getEngineVersion()` — which resolved the
version by traversing the filesystem relative to `__dirname` — with a
direct import of `ENGINE_VERSION`. This removes the assumption that
`package.json` lives at a predictable relative path, which will break
when `AppPackageParser` moves to a different package during the
apps-engine split.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
fix(apps-engine): fix ENGINE_VERSION runtime path in compiled output
Static `import { version } from '../../package.json'` resolves correctly
during TypeScript compilation (source lives at src/definition/) but the
emitted require('../../package.json') exits the package root at runtime
once compiled to definition/version.js (outDir='.', rootDir='./src').
Switching to require('../package.json') — which is the correct path
relative to the compiled output — and bypassing TypeScript's compile-time
module resolution avoids the path mismatch entirely.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copies src/server/ from @rocket.chat/apps-engine verbatim, then rewrites all relative definition/ imports to package imports (`@rocket.chat/apps-engine/definition/...`). apps-engine still contains its server code at this point — this is an additive copy only. The deletion happens in a later PR once @packages/apps is confirmed working independently. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copies src/client/ (AppClientManager, AppsEngineUIHost, AppsEngineUIClient) from @rocket.chat/apps-engine, rewriting relative definition/ imports to package imports. This code is a known rough edge: browser-side UI host logic does not semantically belong in a server orchestration package. It is consolidated here for pragmatic simplicity during the apps-engine split. A future @rocket.chat/apps-client package is tracked in the TODO comment added to src/client/index.ts. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copies deno-runtime/ verbatim from @rocket.chat/apps-engine. The import map in deno.jsonc still points to ./../src/ which is only valid in the current location (apps-engine). Making the import map location-independent (using a runtime-generated map) is handled in a dedicated follow-up PR to keep the diff focused. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… directly The old src/bridges/IListenerBridge.ts used module augmentation (`declare module '@rocket.chat/apps-engine/server/bridges'`) to extend IListenerBridge with core-typings-specific overloads. Now that IListenerBridge lives in this package, the augmentation workaround is no longer needed. The extra overload signatures are merged directly into src/server/bridges/IListenerBridge.ts and the augmentation file is deleted. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- package.json: add all runtime deps from apps-engine (msgpack, adm-zip, esbuild, jose, semver, etc.), deno-related devDeps (npm-run-all, rimraf, ts-node), build/test scripts, and include deno-runtime/ and scripts/ in published files - tsconfig.json: enable experimentalDecorators and emitDecoratorMetadata required by the incoming server code - turbo.json: declare build outputs (dist/, deno-runtime/, .deno-cache/) - scripts/deno-cache.js: copied from apps-engine; validates Deno version and pre-caches deno-runtime dependencies Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Installs runtime and dev dependencies added to @rocket.chat/apps in the previous commit (adm-zip, debug, esbuild, jose, jsonrpc-lite, lodash.clonedeep, msgpack, semver, stack-trace, uuid, npm-run-all, rimraf, ts-node). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…lass room.ts previously imported `AppManager` from the server layer (`@rocket.chat/apps-engine/server/AppManager.ts`) solely to type the private [PrivateManager] symbol field that backs the deprecated `usernames` getter. This created a cross-boundary import from the Deno subprocess into the Node.js host. Replace with a minimal inline `IRoomManager` interface that exposes only the one method actually called: getBridges().getInternalBridge().doGetUsernamesOfRoomById() Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…th at spawn time
The static deno.jsonc used `"@rocket.chat/apps-engine/": "./../src/"` — a
relative path that only works when deno-runtime/ and apps-engine/src/ are
siblings in the same package. Now that deno-runtime lives in @rocket.chat/apps
and the definition source lives in @rocket.chat/apps-engine, the relative path
would resolve to the wrong location.
Solution: generate a `deno_runtime.jsonc` into the temp directory before each
Deno subprocess spawn. The generated config copies all settings from the static
deno.jsonc and injects `@rocket.chat/apps-engine/` as an absolute `file:` URL
resolved via `require.resolve('@rocket.chat/apps-engine/package.json')`. This
works correctly in any environment (monorepo dev, Meteor bundle, CI) without
assumptions about directory layout.
Changes:
- `getAppsEngineSourceDir()`: resolves apps-engine src/ via require.resolve
- `generateRuntimeDenoConfig()`: reads static config, injects resolved path,
writes to tempDir/deno_runtime.jsonc, returns the path
- `spawnProcess()`: calls generateRuntimeDenoConfig, uses the generated config,
adds appsEngineSrcDir to --allow-read
- deno.jsonc: remove the now-redundant static @rocket.chat/apps-engine/ entry
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… local server/ paths These files previously re-exported AppManager, AppBridges, and AppMetadataStorage from @rocket.chat/apps-engine/server/. Now that server/ lives in this package, the imports are updated to local paths. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…/apps/server/ Hard-cut all import paths from `@rocket.chat/apps-engine/server/*` to `@rocket.chat/apps/server/*` across apps/meteor. Covers bridges, storage, managers, marketplace, and service files (50 files, purely mechanical rename). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…/apps/client/ Hard-cut all import paths from `@rocket.chat/apps-engine/client/*` to `@rocket.chat/apps/client/*` across apps/meteor (5 files). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…et.chat/apps IAppsEngineService imported IGetAppsFilter and IAppStorageItem from @rocket.chat/apps-engine/server/ — server internals that now live in @rocket.chat/apps. Update imports and swap the devDependency accordingly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
OAuth2Client, IExternalComponentRoomInfo/UserInfo, and the room query option types (GetMessagesOptions, GetRoomsFilters, GetRoomsOptions) were defined in server/ or client/ but were imported by definition/ files. Move them into the definition layer so the public API is self-contained. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Strip @rocket.chat/apps-engine down to the definition layer only. All runtime code (AppManager, bridges, compiler, deno-runtime, etc.) has already been moved to @rocket.chat/apps in previous commits. Updates package.json, tsconfig.json, and turbo.json to reflect the narrower scope (definition/** and lib/** outputs only). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… definition GetMessagesOptions, GetRoomsFilters, GetRoomsOptions, and GetMessagesSortableFields are now canonical in @rocket.chat/apps-engine/definition/rooms/IGetMessagesOptions — import them from there and re-export for downstream consumers. OAuth2Client is now canonical in @rocket.chat/apps-engine/definition/oauth2/OAuth2Client — replace the duplicate copy with a re-export. Also add typesVersions to @rocket.chat/apps/package.json so that consumers using moduleResolution: "node" can resolve ./server/* and ./client/* subpath imports without needing node16/bundler resolution. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1cc12df to
c9af208
Compare
Fix all TypeScript strict-mode errors introduced when the packages/apps package was configured with strict: true, noImplicitReturns, and noUnusedParameters. Errors included: - Map.get() used without non-null assertion after has()/set() guards - Catch clause variables typed as unknown (now cast explicitly) - Missing return statements in all code paths (TS7030) - Unused parameters renamed with _ prefix - Optional chaining / nullish coalescing for possibly-undefined values - Bridge do* methods returning undefined as unknown as T for denied perms Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2a94144 to
83f9262
Compare
c9af208 to
ac06baf
Compare
|
Closing due to conflicts. We'll relax the tsconfig on packages/apps for now to speed up this transition. |
Proposed changes (including videos or screenshots)
Fix all TypeScript strict-mode errors introduced when the packages/apps package was configured with strict: true, noImplicitReturns, and noUnusedParameters. Errors included:
Issue(s)
Steps to test or reproduce
Further comments
Related to the "Apps-Engine split" stack: