@chatu-ai/builder-sdk-mock 0.7.0 → 0.7.2

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 (2) hide show
  1. package/dist/index.js +7 -0
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -50,6 +50,8 @@ export function createMockBuilderClient(script) {
50
50
  heartbeat: async () => { },
51
51
  previewToken: async () => ({ token: 'mock-token', previewUrl: `${status.previewUrl ?? ''}/?t=mock-token` }),
52
52
  wake: async () => { status = { ...status, state: 'ready' }; return status; },
53
+ share: async () => ({ url: 'https://sbx-mock.test/?s=mock', token: 'mock', expiresAt: new Date(Date.now() + 86400000).toISOString() }),
54
+ revokeShare: async () => ({ ok: true }),
53
55
  },
54
56
  versions: {
55
57
  list: async () => versions,
@@ -77,6 +79,11 @@ export function createMockBuilderClient(script) {
77
79
  deploy: {
78
80
  settings: async () => [{ target: 'git', credentialId: 'cred-1', config: { remoteUrl: 'https://github.com/demo/app.git', branch: 'main' }, updatedTime: new Date().toISOString() }],
79
81
  saveSetting: async (_id, input) => ({ target: input.target, credentialId: input.credentialId ?? null, config: input.config ?? {}, updatedTime: new Date().toISOString() }),
82
+ deployStream: async function* (_id, input) {
83
+ yield { type: 'log', line: '▶ 关联 EdgeOne 项目 …' };
84
+ yield { type: 'log', line: '▶ 构建并部署 …' };
85
+ yield { type: 'result', result: { ok: true, projectName: input.projectName, env: input.env ?? 'production', url: `https://${input.projectName}.edgeone.app`, output: 'mock' } };
86
+ },
80
87
  deploy: async (_id, input) => ({ ok: true, projectName: input.projectName, env: input.env ?? 'production', url: `https://${input.projectName}.edgeone.app`, output: 'mock deploy ok', envVarsApplied: 3 }),
81
88
  pushGit: async (_id, input) => ({ ok: true, remoteUrl: input.remoteUrl, branch: input.branch ?? 'main', sha: 'deadbeefcafe', output: 'mock push ok', webUrl: input.remoteUrl.replace(/\.git$/, '') }),
82
89
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chatu-ai/builder-sdk-mock",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
4
4
  "description": "Mock BuilderClient for @chatu-ai/builder-sdk: scripted event replay with latency & disconnect injection",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -41,7 +41,7 @@
41
41
  "node": ">=18"
42
42
  },
43
43
  "dependencies": {
44
- "@chatu-ai/builder-sdk": "0.7.0"
44
+ "@chatu-ai/builder-sdk": "0.7.2"
45
45
  },
46
46
  "devDependencies": {
47
47
  "typescript": "^5.7.0",