Skip to content

Commit 8b767bb

Browse files
Fix build and test errors in User Preferences Service
- Fix tsconfig.json to extend correct base config (tsconfig.json instead of tsconfig.base.json) - Add .js extensions to all relative imports for ESM compatibility - Fix unused variable warning in plugin.ts constructor - Fix type error in objectql-preferences-adapter.ts for valueType field - Fix test mock engine delete method to support $like operator - Update pnpm-lock.yaml to include new service dependencies All 25 tests now passing. Build successful. Agent-Logs-Url: https://github.com/objectstack-ai/framework/sessions/b54b7f1e-4c8c-42f9-9546-3efcd7c0dbf7 Co-authored-by: xuyushun441-sys <255036401+xuyushun441-sys@users.noreply.github.com>
1 parent 581ff96 commit 8b767bb

9 files changed

Lines changed: 50 additions & 25 deletions

File tree

packages/services/service-user-preferences/src/__tests__/user-preferences-service.test.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,8 @@ function createMemoryEngine(): IDataEngine {
100100
let deleted = 0;
101101
const multi = (options as any)?.multi ?? false;
102102
for (let i = table.length - 1; i >= 0; i--) {
103-
if (where) {
104-
let match = true;
105-
for (const [key, value] of Object.entries(where)) {
106-
if (table[i][key] !== value) { match = false; break; }
107-
}
108-
if (!match) continue;
103+
if (where && !matchesCondition(table[i], where)) {
104+
continue;
109105
}
110106
table.splice(i, 1);
111107
deleted++;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.
22

3-
export * from './objectql-preferences-adapter';
4-
export * from './favorites-adapter';
3+
export * from './objectql-preferences-adapter.js';
4+
export * from './favorites-adapter.js';

packages/services/service-user-preferences/src/adapters/objectql-preferences-adapter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ export class ObjectQLUserPreferencesService implements IUserPreferencesService {
223223
userId: row.user_id,
224224
key: row.key,
225225
value: row.value !== null ? this.deserializeValue(row.value) : null,
226-
valueType: row.value_type ?? undefined,
226+
valueType: (row.value_type as 'string' | 'number' | 'boolean' | 'object' | 'array' | 'null') ?? undefined,
227227
createdAt: row.created_at,
228228
updatedAt: row.updated_at,
229229
}));

packages/services/service-user-preferences/src/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
* ```
2626
*/
2727

28-
export * from './plugin';
29-
export * from './adapters';
30-
export * from './objects';
31-
export * from './routes';
28+
export * from './plugin.js';
29+
export * from './adapters/index.js';
30+
export * from './objects/index.js';
31+
export * from './routes/index.js';
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.
22

3-
export * from './user-preference.object';
3+
export * from './user-preference.object.js';

packages/services/service-user-preferences/src/plugin.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,9 @@ export class UserPreferencesServicePlugin implements Plugin {
4646

4747
private preferencesService?: IUserPreferencesService;
4848
private favoritesService?: IUserFavoritesService;
49-
private readonly options: UserPreferencesServicePluginOptions;
5049

51-
constructor(options: UserPreferencesServicePluginOptions = {}) {
52-
this.options = options;
50+
constructor(_options: UserPreferencesServicePluginOptions = {}) {
51+
// Reserved for future use
5352
}
5453

5554
async init(ctx: PluginContext): Promise<void> {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.
22

3-
export * from './preferences-routes';
3+
export * from './preferences-routes.js';
Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
{
2-
"extends": "../../../tsconfig.base.json",
2+
"extends": "../../../tsconfig.json",
33
"compilerOptions": {
44
"outDir": "dist",
5-
"rootDir": "src"
5+
"rootDir": "src",
6+
"types": [
7+
"node"
8+
]
69
},
7-
"include": ["src/**/*"],
8-
"exclude": ["node_modules", "dist", "**/*.test.ts"]
10+
"include": [
11+
"src"
12+
],
13+
"exclude": [
14+
"node_modules",
15+
"dist"
16+
]
917
}

pnpm-lock.yaml

Lines changed: 25 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)