Skip to content

Commit 8e6ec09

Browse files
committed
fix mock generation
1 parent c26187d commit 8e6ec09

File tree

20 files changed

+127
-2392
lines changed

20 files changed

+127
-2392
lines changed

.github/workflows/publish.yml

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,9 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- uses: actions/checkout@v4
16-
- uses: actions/setup-node@v4
16+
- uses: oven-sh/setup-bun@v2
1717
with:
18-
node-version: '22'
19-
registry-url: 'https://registry.npmjs.org'
20-
21-
- name: Update npm to latest version for OIDC support
22-
run: npm install -g npm@latest
18+
bun-version: latest
2319

2420
- name: Setup binfmt with QEMU
2521
run: |
@@ -35,27 +31,38 @@ jobs:
3531
sudo make install
3632
3733
- name: Install dependencies and build for Linux and Windows
38-
run: |
39-
npm install
40-
npm run linux-x64
41-
npm run linux-arm64
42-
npm run windows-x64
43-
npm run windows-arm64
44-
npm run mac-x64
45-
npm run mac-arm64
46-
47-
- name: Publish NPM library
4834
run: |
49-
if ${{ contains(github.event.release.tag_name, '-rc') }}; then
50-
echo "Publishing Release Candidate ${{ github.event.release.tag_name}} to NPM"
51-
npm publish --provenance --access public --tag next
35+
bun install
36+
bun run linux-x64
37+
bun run linux-arm64
38+
bun run mac-x64
39+
bun run mac-arm64
40+
bun run windows-x64
41+
bun run windows-arm64
42+
43+
- name: Setup Node.js
44+
uses: actions/setup-node@v4
45+
with:
46+
node-version: '22'
47+
registry-url: 'https://registry.npmjs.org'
48+
49+
- name: Update npm to latest version for OIDC support
50+
run: npm install -g npm@latest
51+
52+
- name: Determine release tag
53+
id: release_tag
54+
run: |
55+
if [[ "${{ github.ref }}" == *"-rc"* ]] || [[ "${{ github.ref }}" == *"-RC"* ]]; then
56+
echo "tag=next" >> "$GITHUB_OUTPUT"
5257
else
53-
echo "Publishing ${{ github.event.release.tag_name}} to NPM"
54-
npm publish --provenance --access public
58+
echo "tag=latest" >> "$GITHUB_OUTPUT"
5559
fi
5660
61+
- name: Publish
62+
run: npm publish --provenance --access public --tag ${{ steps.release_tag.outputs.tag }}
63+
5764
- uses: fnkr/github-action-ghr@v1
5865
env:
5966
GHR_PATH: build/
6067
GHR_REPLACE: false
61-
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
68+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}

lib/commands/services/account.ts

Lines changed: 6 additions & 252 deletions
Original file line numberDiff line numberDiff line change
@@ -8,258 +8,12 @@ import {
88
parseBool,
99
parseInteger,
1010
} from "../../parser.js";
11-
// Mock enums
12-
export enum AuthenticatorType {
13-
// Mock enum values
14-
}
15-
export enum AuthenticationFactor {
16-
// Mock enum values
17-
}
18-
export enum OAuthProvider {
19-
// Mock enum values
20-
}
21-
22-
// Mock Account class
23-
class Account {
24-
constructor(sdkClient: any) {}
25-
26-
async get(): Promise<any> {
27-
return { result: 'GET:/v1/account:passed' };
28-
}
29-
30-
async create(userId: string, email: string, password: string, name?: string): Promise<any> {
31-
return { result: 'POST:/v1/account:passed' };
32-
}
33-
34-
async delete(): Promise<any> {
35-
return { result: 'DELETE:/v1/account:passed' };
36-
}
37-
38-
async updateEmail(email: string, password: string): Promise<any> {
39-
return { result: 'PATCH:/v1/account/email:passed' };
40-
}
41-
42-
async listIdentities(queries?: any[], total?: boolean): Promise<any> {
43-
return { result: 'GET:/v1/account/identities:passed' };
44-
}
45-
46-
async deleteIdentity(identityId: string): Promise<any> {
47-
return { result: 'DELETE:/v1/account/identities/{identityId}:passed' };
48-
}
49-
50-
async createJWT(duration?: number): Promise<any> {
51-
return { result: 'POST:/v1/account/jwts:passed' };
52-
}
53-
54-
async listLogs(queries?: any[], total?: boolean): Promise<any> {
55-
return { result: 'GET:/v1/account/logs:passed' };
56-
}
57-
58-
async updateMFA(mfa: boolean): Promise<any> {
59-
return { result: 'PATCH:/v1/account/mfa:passed' };
60-
}
61-
62-
async createMfaAuthenticator(type: string): Promise<any> {
63-
return { result: 'POST:/v1/account/mfa/authenticators/{type}:passed' };
64-
}
65-
66-
async createMFAAuthenticator(type: string): Promise<any> {
67-
return { result: 'POST:/v1/account/mfa/authenticators/{type}:passed' };
68-
}
69-
70-
async updateMfaAuthenticator(type: string, otp: string): Promise<any> {
71-
return { result: 'PUT:/v1/account/mfa/authenticators/{type}:passed' };
72-
}
73-
74-
async updateMFAAuthenticator(type: string, otp: string): Promise<any> {
75-
return { result: 'PUT:/v1/account/mfa/authenticators/{type}:passed' };
76-
}
77-
78-
async deleteMfaAuthenticator(type: string): Promise<any> {
79-
return { result: 'DELETE:/v1/account/mfa/authenticators/{type}:passed' };
80-
}
81-
82-
async deleteMFAAuthenticator(type: string): Promise<any> {
83-
return { result: 'DELETE:/v1/account/mfa/authenticators/{type}:passed' };
84-
}
85-
86-
async createMfaChallenge(factor: string): Promise<any> {
87-
return { result: 'POST:/v1/account/mfa/challenges:passed' };
88-
}
89-
90-
async createMFAChallenge(factor: string): Promise<any> {
91-
return { result: 'POST:/v1/account/mfa/challenges:passed' };
92-
}
93-
94-
async updateMfaChallenge(challengeId: string, otp: string): Promise<any> {
95-
return { result: 'PUT:/v1/account/mfa/challenges:passed' };
96-
}
97-
98-
async updateMFAChallenge(challengeId: string, otp: string): Promise<any> {
99-
return { result: 'PUT:/v1/account/mfa/challenges:passed' };
100-
}
101-
102-
async listMfaFactors(): Promise<any> {
103-
return { result: 'GET:/v1/account/mfa/factors:passed' };
104-
}
105-
106-
async listMFAFactors(): Promise<any> {
107-
return { result: 'GET:/v1/account/mfa/factors:passed' };
108-
}
109-
110-
async getMfaRecoveryCodes(): Promise<any> {
111-
return { result: 'GET:/v1/account/mfa/recovery-codes:passed' };
112-
}
113-
114-
async getMFARecoveryCodes(): Promise<any> {
115-
return { result: 'GET:/v1/account/mfa/recovery-codes:passed' };
116-
}
117-
118-
async createMfaRecoveryCodes(): Promise<any> {
119-
return { result: 'POST:/v1/account/mfa/recovery-codes:passed' };
120-
}
121-
122-
async createMFARecoveryCodes(): Promise<any> {
123-
return { result: 'POST:/v1/account/mfa/recovery-codes:passed' };
124-
}
125-
126-
async updateMfaRecoveryCodes(): Promise<any> {
127-
return { result: 'PATCH:/v1/account/mfa/recovery-codes:passed' };
128-
}
129-
130-
async updateMFARecoveryCodes(): Promise<any> {
131-
return { result: 'PATCH:/v1/account/mfa/recovery-codes:passed' };
132-
}
133-
134-
async updateName(name: string): Promise<any> {
135-
return { result: 'PATCH:/v1/account/name:passed' };
136-
}
137-
138-
async updatePassword(password: string, oldPassword?: string): Promise<any> {
139-
return { result: 'PATCH:/v1/account/password:passed' };
140-
}
141-
142-
async updatePhone(phone: string, password: string): Promise<any> {
143-
return { result: 'PATCH:/v1/account/phone:passed' };
144-
}
145-
146-
async getPrefs(): Promise<any> {
147-
return { result: 'GET:/v1/account/prefs:passed' };
148-
}
149-
150-
async updatePrefs(prefs: any): Promise<any> {
151-
return { result: 'PATCH:/v1/account/prefs:passed' };
152-
}
153-
154-
async createRecovery(email: string, url: string): Promise<any> {
155-
return { result: 'POST:/v1/account/recovery:passed' };
156-
}
157-
158-
async updateRecovery(userId: string, secret: string, password: string): Promise<any> {
159-
return { result: 'PUT:/v1/account/recovery:passed' };
160-
}
161-
162-
async listSessions(): Promise<any> {
163-
return { result: 'GET:/v1/account/sessions:passed' };
164-
}
165-
166-
async deleteSessions(): Promise<any> {
167-
return { result: 'DELETE:/v1/account/sessions:passed' };
168-
}
169-
170-
async createAnonymousSession(): Promise<any> {
171-
return { result: 'POST:/v1/account/sessions/anonymous:passed' };
172-
}
173-
174-
async createEmailPasswordSession(email: string, password: string): Promise<any> {
175-
return { result: 'POST:/v1/account/sessions/email:passed' };
176-
}
177-
178-
async updateMagicURLSession(userId: string, secret: string): Promise<any> {
179-
return { result: 'PUT:/v1/account/sessions/magic-url:passed' };
180-
}
181-
182-
async createOAuth2Session(provider: string, success?: string, failure?: string, scopes?: any[]): Promise<any> {
183-
return { result: 'GET:/v1/account/sessions/oauth2/{provider}:passed' };
184-
}
185-
186-
async updatePhoneSession(userId: string, secret: string): Promise<any> {
187-
return { result: 'PUT:/v1/account/sessions/phone:passed' };
188-
}
189-
190-
async createSession(userId: string, secret: string): Promise<any> {
191-
return { result: 'POST:/v1/account/sessions/token:passed' };
192-
}
193-
194-
async getSession(sessionId: string): Promise<any> {
195-
return { result: 'GET:/v1/account/sessions/{sessionId}:passed' };
196-
}
197-
198-
async updateSession(sessionId: string): Promise<any> {
199-
return { result: 'PATCH:/v1/account/sessions/{sessionId}:passed' };
200-
}
201-
202-
async deleteSession(sessionId: string): Promise<any> {
203-
return { result: 'DELETE:/v1/account/sessions/{sessionId}:passed' };
204-
}
205-
206-
async updateStatus(): Promise<any> {
207-
return { result: 'PATCH:/v1/account/status:passed' };
208-
}
209-
210-
async createPushTarget(targetId: string, identifier: string, providerId?: string): Promise<any> {
211-
return { result: 'POST:/v1/account/targets/push:passed' };
212-
}
213-
214-
async updatePushTarget(targetId: string, identifier: string): Promise<any> {
215-
return { result: 'PUT:/v1/account/targets/{targetId}/push:passed' };
216-
}
217-
218-
async deletePushTarget(targetId: string): Promise<any> {
219-
return { result: 'DELETE:/v1/account/targets/{targetId}/push:passed' };
220-
}
221-
222-
async createEmailToken(userId: string, email: string, phrase?: boolean): Promise<any> {
223-
return { result: 'POST:/v1/account/tokens/email:passed' };
224-
}
225-
226-
async createMagicURLToken(userId: string, email: string, url?: string, phrase?: boolean): Promise<any> {
227-
return { result: 'POST:/v1/account/tokens/magic-url:passed' };
228-
}
229-
230-
async createOAuth2Token(provider: string, success?: string, failure?: string, scopes?: any[]): Promise<any> {
231-
return { result: 'GET:/v1/account/tokens/oauth2/{provider}:passed' };
232-
}
233-
234-
async createPhoneToken(userId: string, phone: string): Promise<any> {
235-
return { result: 'POST:/v1/account/tokens/phone:passed' };
236-
}
237-
238-
async createEmailVerification(url: string): Promise<any> {
239-
return { result: 'POST:/v1/account/verifications/email:passed' };
240-
}
241-
242-
async createVerification(url: string): Promise<any> {
243-
return { result: 'POST:/v1/account/verifications/email:passed' };
244-
}
245-
246-
async updateEmailVerification(userId: string, secret: string): Promise<any> {
247-
return { result: 'PUT:/v1/account/verifications/email:passed' };
248-
}
249-
250-
async updateVerification(userId: string, secret: string): Promise<any> {
251-
return { result: 'PUT:/v1/account/verifications/email:passed' };
252-
}
253-
254-
async createPhoneVerification(): Promise<any> {
255-
return { result: 'POST:/v1/account/verifications/phone:passed' };
256-
}
257-
258-
async updatePhoneVerification(userId: string, secret: string): Promise<any> {
259-
return { result: 'PUT:/v1/account/verifications/phone:passed' };
260-
}
261-
}
262-
11+
import {
12+
Account,
13+
AuthenticatorType,
14+
AuthenticationFactor,
15+
OAuthProvider,
16+
} from "@appwrite.io/console";
26317

26418
let accountClient: Account | null = null;
26519

lib/commands/services/console.ts

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,10 @@ import {
88
parseBool,
99
parseInteger,
1010
} from "../../parser.js";
11-
// Mock enums
12-
export enum ConsoleResourceType {
13-
// Mock enum values
14-
}
15-
16-
// Mock Console class
17-
class Console {
18-
constructor(sdkClient: any) {}
19-
20-
async getResource(value: string, type: string): Promise<any> {
21-
return { result: 'GET:/v1/console/resources:passed' };
22-
}
23-
24-
async variables(): Promise<any> {
25-
return { result: 'GET:/v1/console/variables:passed' };
26-
}
27-
}
28-
11+
import {
12+
Console,
13+
ConsoleResourceType,
14+
} from "@appwrite.io/console";
2915

3016
let consoleClient: Console | null = null;
3117

0 commit comments

Comments
 (0)