Skip to content

Commit 3c9860e

Browse files
authored
Merge pull request #224 from objectstack-ai/copilot/upgrade-objectstack-to-latest-another-one
2 parents ed182ac + 5be4542 commit 3c9860e

File tree

28 files changed

+367
-191
lines changed

28 files changed

+367
-191
lines changed

apps/web/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"test:watch": "vitest"
1313
},
1414
"dependencies": {
15-
"@objectstack/client": "1.1.0",
15+
"@objectstack/client": "2.0.0",
1616
"@radix-ui/react-dialog": "^1.1.15",
1717
"@radix-ui/react-dropdown-menu": "^2.1.16",
1818
"@radix-ui/react-select": "^2.2.6",

examples/crm/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
"test": "objectstack test"
1818
},
1919
"dependencies": {
20-
"@objectstack/spec": "workspace:*"
20+
"@objectstack/spec": "2.0.0"
2121
},
2222
"devDependencies": {
2323
"typescript": "^5.0.0",
24-
"@objectstack/cli": "workspace:*"
24+
"@objectstack/cli": "^2.0.0"
2525
}
2626
}

examples/crm/src/apps/crm.app.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ export const CrmApp = App.create({
66
icon: 'briefcase',
77
branding: {
88
primaryColor: '#4169E1',
9-
secondaryColor: '#00AA00',
109
logo: '/assets/crm-logo.png',
1110
favicon: '/assets/crm-favicon.ico',
1211
},

examples/crm/src/objects/account.hook.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const accountHook: Hook = {
55
name: 'account_protection',
66
object: 'account',
77
events: ['beforeInsert', 'beforeUpdate', 'beforeDelete'],
8-
handler: async (ctx: HookContext) => {
8+
handler: (async (ctx: HookContext) => {
99
const { input } = ctx;
1010

1111
if (ctx.event === 'beforeInsert' || ctx.event === 'beforeUpdate') {
@@ -17,14 +17,11 @@ const accountHook: Hook = {
1717

1818
if (ctx.event === 'beforeDelete') {
1919
// Prevent deletion of 'Strategic' accounts
20-
// Note: ctx.previous is available in beforeDelete?
21-
// Actually, usually in beforeDelete we might need to fetch it first if not provided.
22-
// But let's assume the engine provides 'previous' (which is the record being deleted).
2320
if (ctx.previous && ctx.previous.type === 'Strategic') {
2421
throw new Error('Cannot delete Strategic accounts');
2522
}
2623
}
27-
}
24+
}) as (...args: unknown[]) => unknown
2825
};
2926

3027
export default accountHook;

examples/crm/src/objects/lead.hook.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const leadHook: Hook = {
55
name: 'lead_automation',
66
object: 'lead',
77
events: ['beforeInsert', 'afterUpdate'],
8-
handler: async (ctx: HookContext) => {
8+
handler: (async (ctx: HookContext) => {
99
if (ctx.event === 'beforeInsert') {
1010
const { input } = ctx;
1111
// Auto-score logic (mock)
@@ -16,7 +16,7 @@ const leadHook: Hook = {
1616
if (input.phone) {
1717
score += 20;
1818
}
19-
input.score = score;
19+
(input as Record<string, unknown>).score = score;
2020
}
2121

2222
if (ctx.event === 'afterUpdate') {
@@ -26,7 +26,7 @@ const leadHook: Hook = {
2626
console.log('Lead qualified! Ready for conversion.');
2727
}
2828
}
29-
}
29+
}) as (...args: unknown[]) => unknown
3030
};
3131

3232
export default leadHook;

examples/todo/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717
"test": "objectstack test"
1818
},
1919
"dependencies": {
20-
"@objectstack/client": "workspace:*",
21-
"@objectstack/driver-memory": "workspace:^",
22-
"@objectstack/objectql": "workspace:^",
23-
"@objectstack/runtime": "workspace:^",
24-
"@objectstack/spec": "workspace:*"
20+
"@objectstack/client": "2.0.0",
21+
"@objectstack/driver-memory": "^2.0.0",
22+
"@objectstack/objectql": "^2.0.0",
23+
"@objectstack/runtime": "^2.0.0",
24+
"@objectstack/spec": "2.0.0"
2525
},
2626
"devDependencies": {
27-
"@objectstack/cli": "workspace:*",
27+
"@objectstack/cli": "^2.0.0",
2828
"typescript": "^5.0.0"
2929
}
3030
}

examples/todo/src/apps/todo.app.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ export const TodoApp = App.create({
66
icon: 'check-square',
77
branding: {
88
primaryColor: '#10B981',
9-
secondaryColor: '#3B82F6',
109
logo: '/assets/todo-logo.png',
1110
favicon: '/assets/todo-favicon.ico',
1211
},

examples/todo/src/objects/task.hook.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ const taskHook: Hook = {
44
name: 'task_logic',
55
object: 'task',
66
events: ['beforeInsert', 'afterUpdate'],
7-
handler: async (ctx: HookContext) => {
7+
handler: (async (ctx: HookContext) => {
88
if (ctx.event === 'beforeInsert') {
9-
const { input } = ctx;
9+
const input = ctx.input as Record<string, unknown>;
1010
// Default priority
1111
if (!input.priority) {
1212
input.priority = 'normal';
@@ -16,7 +16,7 @@ const taskHook: Hook = {
1616
input.status = 'not_started';
1717
}
1818
// Validation
19-
if (input.subject && input.subject.includes('spam')) {
19+
if (input.subject && typeof input.subject === 'string' && input.subject.includes('spam')) {
2020
throw new Error('Spam tasks are not allowed');
2121
}
2222
}
@@ -25,15 +25,14 @@ const taskHook: Hook = {
2525
// Check if completed
2626
if (ctx.input.status === 'completed' && ctx.previous && ctx.previous.status !== 'completed') {
2727
console.log(`Task ${ctx.id} completed by ${ctx.session?.userId || 'unknown'}`);
28-
// Could trigger notifications or integrations here
2928
}
3029

3130
// Check if task became overdue
3231
if (ctx.input.is_overdue && ctx.previous && !ctx.previous.is_overdue) {
3332
console.log(`Task ${ctx.id} is now overdue`);
3433
}
3534
}
36-
}
35+
}) as (...args: unknown[]) => unknown
3736
};
3837

3938
export default taskHook;

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
},
5454
"devDependencies": {
5555
"@changesets/cli": "^2.29.8",
56-
"@objectstack/cli": "^1.1.0",
56+
"@objectstack/cli": "^2.0.0",
5757
"@types/jest": "^30.0.0",
5858
"@types/js-yaml": "^4.0.9",
5959
"@types/node": "^25.2.0",
@@ -87,11 +87,11 @@
8787
"@objectql/driver-mongo": "^4.2.0",
8888
"@objectql/driver-sql": "^4.2.0",
8989
"@objectql/platform-node": "^4.2.0",
90-
"@objectstack/driver-memory": "1.1.0",
91-
"@objectstack/objectql": "1.1.0",
92-
"@objectstack/plugin-hono-server": "1.1.0",
93-
"@objectstack/runtime": "1.1.0",
94-
"@objectstack/spec": "1.1.0",
90+
"@objectstack/driver-memory": "2.0.0",
91+
"@objectstack/objectql": "2.0.0",
92+
"@objectstack/plugin-hono-server": "2.0.0",
93+
"@objectstack/runtime": "2.0.0",
94+
"@objectstack/spec": "2.0.0",
9595
"build": "^0.1.4",
9696
"hono": "^4.11.0",
9797
"pino": "^10.3.0",

packages/audit/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
"test": "jest --passWithNoTests"
1212
},
1313
"dependencies": {
14-
"@objectstack/runtime": "^1.1.0",
15-
"@objectstack/spec": "1.1.0"
14+
"@objectstack/runtime": "^2.0.0",
15+
"@objectstack/spec": "2.0.0"
1616
},
1717
"devDependencies": {
1818
"@objectos/permissions": "workspace:^",

0 commit comments

Comments
 (0)