appwrite-cli 13.5.0 → 13.6.1

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 (111) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +2 -2
  3. package/cli.ts +7 -5
  4. package/dist/bundle-win-arm64.mjs +988 -258
  5. package/dist/cli.cjs +988 -258
  6. package/dist/index.cjs +183 -112
  7. package/dist/index.js +183 -112
  8. package/dist/lib/commands/config-validations.d.ts +1 -1
  9. package/dist/lib/commands/config-validations.d.ts.map +1 -1
  10. package/dist/lib/commands/errors.d.ts +4 -4
  11. package/dist/lib/commands/errors.d.ts.map +1 -1
  12. package/dist/lib/commands/generate.d.ts.map +1 -1
  13. package/dist/lib/commands/generators/base.d.ts +5 -0
  14. package/dist/lib/commands/generators/base.d.ts.map +1 -1
  15. package/dist/lib/commands/generic.d.ts.map +1 -1
  16. package/dist/lib/commands/init.d.ts.map +1 -1
  17. package/dist/lib/commands/run.d.ts.map +1 -1
  18. package/dist/lib/commands/schema.d.ts.map +1 -1
  19. package/dist/lib/commands/services/activities.d.ts +3 -0
  20. package/dist/lib/commands/services/activities.d.ts.map +1 -0
  21. package/dist/lib/commands/services/backups.d.ts +3 -0
  22. package/dist/lib/commands/services/backups.d.ts.map +1 -0
  23. package/dist/lib/commands/types.d.ts.map +1 -1
  24. package/dist/lib/commands/update.d.ts.map +1 -1
  25. package/dist/lib/commands/utils/change-approval.d.ts +3 -3
  26. package/dist/lib/commands/utils/change-approval.d.ts.map +1 -1
  27. package/dist/lib/commands/utils/database-sync.d.ts.map +1 -1
  28. package/dist/lib/commands/utils/deployment.d.ts +16 -4
  29. package/dist/lib/commands/utils/deployment.d.ts.map +1 -1
  30. package/dist/lib/commands/utils/pools.d.ts.map +1 -1
  31. package/dist/lib/constants.d.ts +1 -1
  32. package/dist/lib/emulation/docker.d.ts.map +1 -1
  33. package/dist/lib/json.d.ts +1 -1
  34. package/dist/lib/json.d.ts.map +1 -1
  35. package/dist/lib/paginate.d.ts +5 -6
  36. package/dist/lib/paginate.d.ts.map +1 -1
  37. package/dist/lib/parser.d.ts +5 -4
  38. package/dist/lib/parser.d.ts.map +1 -1
  39. package/dist/lib/spinner.d.ts +1 -1
  40. package/dist/lib/spinner.d.ts.map +1 -1
  41. package/dist/lib/utils.d.ts +6 -1
  42. package/dist/lib/utils.d.ts.map +1 -1
  43. package/dist/lib/validations.d.ts +1 -1
  44. package/dist/lib/validations.d.ts.map +1 -1
  45. package/docs/examples/account/create-key.md +5 -0
  46. package/docs/examples/account/delete-key.md +4 -0
  47. package/docs/examples/account/get-key.md +4 -0
  48. package/docs/examples/account/list-keys.md +3 -0
  49. package/docs/examples/account/update-key.md +6 -0
  50. package/docs/examples/activities/get-event.md +4 -0
  51. package/docs/examples/activities/list-events.md +3 -0
  52. package/docs/examples/backups/create-archive.md +4 -0
  53. package/docs/examples/backups/create-policy.md +7 -0
  54. package/docs/examples/backups/create-restoration.md +5 -0
  55. package/docs/examples/backups/delete-archive.md +4 -0
  56. package/docs/examples/backups/delete-policy.md +4 -0
  57. package/docs/examples/backups/get-archive.md +4 -0
  58. package/docs/examples/backups/get-policy.md +4 -0
  59. package/docs/examples/backups/get-restoration.md +4 -0
  60. package/docs/examples/backups/list-archives.md +3 -0
  61. package/docs/examples/backups/list-policies.md +3 -0
  62. package/docs/examples/backups/list-restorations.md +3 -0
  63. package/docs/examples/backups/update-policy.md +4 -0
  64. package/eslint.config.js +45 -0
  65. package/install.ps1 +2 -2
  66. package/install.sh +1 -1
  67. package/lib/client.ts +3 -3
  68. package/lib/commands/config-validations.ts +1 -1
  69. package/lib/commands/config.ts +2 -2
  70. package/lib/commands/errors.ts +2 -2
  71. package/lib/commands/generate.ts +8 -6
  72. package/lib/commands/generators/base.ts +6 -0
  73. package/lib/commands/generators/typescript/databases.ts +9 -9
  74. package/lib/commands/generators/typescript/templates/databases.ts.hbs +16 -16
  75. package/lib/commands/generic.ts +21 -16
  76. package/lib/commands/init.ts +147 -61
  77. package/lib/commands/pull.ts +1 -1
  78. package/lib/commands/push.ts +19 -19
  79. package/lib/commands/run.ts +15 -9
  80. package/lib/commands/schema.ts +1 -3
  81. package/lib/commands/services/account.ts +234 -0
  82. package/lib/commands/services/activities.ts +51 -0
  83. package/lib/commands/services/backups.ts +184 -0
  84. package/lib/commands/services/health.ts +55 -0
  85. package/lib/commands/services/projects.ts +1 -1
  86. package/lib/commands/services/storage.ts +2 -2
  87. package/lib/commands/types.ts +18 -8
  88. package/lib/commands/update.ts +24 -16
  89. package/lib/commands/utils/attributes.ts +6 -6
  90. package/lib/commands/utils/change-approval.ts +26 -19
  91. package/lib/commands/utils/database-sync.ts +58 -18
  92. package/lib/commands/utils/deployment.ts +22 -5
  93. package/lib/commands/utils/pools.ts +11 -5
  94. package/lib/config.ts +1 -1
  95. package/lib/constants.ts +1 -1
  96. package/lib/emulation/docker.ts +5 -6
  97. package/lib/emulation/utils.ts +2 -2
  98. package/lib/json.ts +21 -8
  99. package/lib/paginate.ts +30 -20
  100. package/lib/parser.ts +46 -15
  101. package/lib/questions.ts +38 -38
  102. package/lib/spinner.ts +5 -1
  103. package/lib/utils.ts +15 -3
  104. package/lib/validations.ts +1 -1
  105. package/package.json +8 -2
  106. package/scoop/appwrite.config.json +3 -3
  107. package/dist/lib/commands/services/console.d.ts +0 -3
  108. package/dist/lib/commands/services/console.d.ts.map +0 -1
  109. package/docs/examples/console/get-resource.md +0 -5
  110. package/docs/examples/console/variables.md +0 -3
  111. package/lib/commands/services/console.ts +0 -49
@@ -25,7 +25,7 @@ const int64Schema = z.preprocess(
25
25
  const valueOfResult = val.valueOf();
26
26
  const bigIntVal = BigInt(valueOfResult as string | number | bigint);
27
27
  return bigIntVal;
28
- } catch (e) {
28
+ } catch (_e) {
29
29
  return undefined;
30
30
  }
31
31
  }
@@ -37,7 +37,7 @@ const int64Schema = z.preprocess(
37
37
  if (typeof val === "string") {
38
38
  try {
39
39
  return BigInt(val);
40
- } catch (e) {
40
+ } catch (_e) {
41
41
  return undefined;
42
42
  }
43
43
  }
@@ -10,8 +10,8 @@ export class DestructiveChangeError extends Error {
10
10
  type: string;
11
11
  resource: string;
12
12
  field: string;
13
- oldValue?: any;
14
- newValue?: any;
13
+ oldValue?: unknown;
14
+ newValue?: unknown;
15
15
  }>;
16
16
  affectedResources: number;
17
17
  },
@@ -77,17 +77,18 @@ const generateAction = async (
77
77
  } else {
78
78
  log(`Detected language: ${detectedLanguage} (${detection.reason})`);
79
79
  }
80
- } catch (err: any) {
80
+ } catch (err) {
81
81
  const supported = getSupportedLanguages().join(", ");
82
+ const message = err instanceof Error ? err.message : String(err);
82
83
  error(
83
- `${err.message}\nUse --language to specify the target language. Supported: ${supported}`,
84
+ `${message}\nUse --language to specify the target language. Supported: ${supported}`,
84
85
  );
85
86
  process.exit(1);
86
87
  }
87
88
  }
88
89
 
89
- if (typeof (generator as any).setServerSideOverride === "function") {
90
- (generator as any).setServerSideOverride(serverSideOverride);
90
+ if (typeof generator.setServerSideOverride === "function") {
91
+ generator.setServerSideOverride(serverSideOverride);
91
92
  }
92
93
 
93
94
  const config: ConfigType = {
@@ -149,8 +150,9 @@ const generateAction = async (
149
150
  ` await mydb.use(${JSON.stringify(tableName)}).create({ ... });`,
150
151
  );
151
152
  }
152
- } catch (err: any) {
153
- error(`Failed to generate SDK: ${err.message}`);
153
+ } catch (err) {
154
+ const message = err instanceof Error ? err.message : String(err);
155
+ error(`Failed to generate SDK: ${message}`);
154
156
  process.exit(1);
155
157
  }
156
158
  };
@@ -64,6 +64,12 @@ export interface IDatabasesGenerator {
64
64
  * @param result - The generation result
65
65
  */
66
66
  getGeneratedFilePaths(result: GenerateResult): string[];
67
+
68
+ /**
69
+ * Optional method to override server-side generation behavior.
70
+ * @param override - The override value
71
+ */
72
+ setServerSideOverride?(override: "auto" | "true" | "false"): void;
67
73
  }
68
74
 
69
75
  /**
@@ -240,7 +240,7 @@ export type DatabaseHandle<D extends DatabaseId> = {
240
240
  use: <T extends keyof DatabaseTableMap[D] & string>(tableId: T) => DatabaseTableMap[D][T];
241
241
  ${
242
242
  supportsServerSide
243
- ? ` create: (tableId: string, name: string, options?: { permissions?: ${PERMISSION_CALLBACK_INLINE}; rowSecurity?: boolean; enabled?: boolean; columns?: any[]; indexes?: any[] }) => Promise<Models.Table>;
243
+ ? ` create: (tableId: string, name: string, options?: { permissions?: ${PERMISSION_CALLBACK_INLINE}; rowSecurity?: boolean; enabled?: boolean; columns?: object[]; indexes?: object[] }) => Promise<Models.Table>;
244
244
  update: <T extends keyof DatabaseTableMap[D] & string>(tableId: T, options?: { name?: string; permissions?: ${PERMISSION_CALLBACK_INLINE}; rowSecurity?: boolean; enabled?: boolean }) => Promise<Models.Table>;
245
245
  delete: <T extends keyof DatabaseTableMap[D] & string>(tableId: T) => Promise<void>;`
246
246
  : ""
@@ -330,26 +330,26 @@ ${
330
330
  if (!supportsBulk) return "";
331
331
 
332
332
  return `
333
- createMany: (rows: any[], options?: { transactionId?: string }) =>
333
+ createMany: (rows: object[], options?: { transactionId?: string }) =>
334
334
  tablesDB.createRows({
335
335
  databaseId,
336
336
  tableId,
337
337
  rows,
338
338
  transactionId: options?.transactionId,
339
339
  }),
340
- updateMany: (data: any, options?: { queries?: (q: any) => string[]; transactionId?: string }) =>
340
+ updateMany: (data: object, options?: { queries?: (q: QueryBuilder<T>) => string[]; transactionId?: string }) =>
341
341
  tablesDB.updateRows({
342
342
  databaseId,
343
343
  tableId,
344
344
  data,
345
- queries: options?.queries?.(createQueryBuilder()),
345
+ queries: options?.queries?.(createQueryBuilder<T>()),
346
346
  transactionId: options?.transactionId,
347
347
  }),
348
- deleteMany: (options?: { queries?: (q: any) => string[]; transactionId?: string }) =>
348
+ deleteMany: (options?: { queries?: (q: QueryBuilder<T>) => string[]; transactionId?: string }) =>
349
349
  tablesDB.deleteRows({
350
350
  databaseId,
351
351
  tableId,
352
- queries: options?.queries?.(createQueryBuilder()),
352
+ queries: options?.queries?.(createQueryBuilder<T>()),
353
353
  transactionId: options?.transactionId,
354
354
  }),`;
355
355
  }
@@ -364,9 +364,9 @@ ${
364
364
  return `
365
365
  // Remove bulk methods for tables with relationships
366
366
  if (!hasBulkMethods(databaseId, tableId)) {
367
- delete (api as any).createMany;
368
- delete (api as any).updateMany;
369
- delete (api as any).deleteMany;
367
+ delete (api as Record<string, unknown>).createMany;
368
+ delete (api as Record<string, unknown>).updateMany;
369
+ delete (api as Record<string, unknown>).deleteMany;
370
370
  }`;
371
371
  }
372
372
 
@@ -1,5 +1,5 @@
1
1
  import { Client, TablesDB, ID, Query, type Models, Permission, Role } from '{{appwriteDep}}';
2
- import type { DatabaseHandle, DatabaseId, DatabaseTableMap, DatabaseTables, QueryBuilder, PermissionBuilder, RoleBuilder, RoleString } from './types{{importExt}}';
2
+ import type { DatabaseHandle, DatabaseId, DatabaseTableMap, DatabaseTables, QueryBuilder, QueryValue, PermissionBuilder, RoleBuilder, RoleString } from './types{{importExt}}';
3
3
  {{#if supportsServerSide}}
4
4
  import { PROJECT_ID, ENDPOINT, API_KEY } from './constants{{importExt}}';
5
5
  {{else}}
@@ -7,19 +7,19 @@ import { PROJECT_ID, ENDPOINT } from './constants{{importExt}}';
7
7
  {{/if}}
8
8
 
9
9
  const createQueryBuilder = <T>(): QueryBuilder<T> => ({
10
- equal: (field, value) => Query.equal(String(field), value as any),
11
- notEqual: (field, value) => Query.notEqual(String(field), value as any),
12
- lessThan: (field, value) => Query.lessThan(String(field), value as any),
13
- lessThanEqual: (field, value) => Query.lessThanEqual(String(field), value as any),
14
- greaterThan: (field, value) => Query.greaterThan(String(field), value as any),
15
- greaterThanEqual: (field, value) => Query.greaterThanEqual(String(field), value as any),
16
- contains: (field, value) => Query.contains(String(field), value as any),
10
+ equal: (field, value) => Query.equal(String(field), value as QueryValue),
11
+ notEqual: (field, value) => Query.notEqual(String(field), value as QueryValue),
12
+ lessThan: (field, value) => Query.lessThan(String(field), value as QueryValue),
13
+ lessThanEqual: (field, value) => Query.lessThanEqual(String(field), value as QueryValue),
14
+ greaterThan: (field, value) => Query.greaterThan(String(field), value as QueryValue),
15
+ greaterThanEqual: (field, value) => Query.greaterThanEqual(String(field), value as QueryValue),
16
+ contains: (field, value) => Query.contains(String(field), value as string | QueryValue[]),
17
17
  search: (field, value) => Query.search(String(field), value),
18
18
  isNull: (field) => Query.isNull(String(field)),
19
19
  isNotNull: (field) => Query.isNotNull(String(field)),
20
20
  startsWith: (field, value) => Query.startsWith(String(field), value),
21
21
  endsWith: (field, value) => Query.endsWith(String(field), value),
22
- between: (field, start, end) => Query.between(String(field), start as any, end as any),
22
+ between: (field, start, end) => Query.between(String(field), start as string | number, end as string | number),
23
23
  select: (fields) => Query.select(fields.map(String)),
24
24
  orderAsc: (field) => Query.orderAsc(String(field)),
25
25
  orderDesc: (field) => Query.orderDesc(String(field)),
@@ -62,12 +62,12 @@ function createTableApi<T extends Models.Row>(
62
62
  tableId: string,
63
63
  ) {
64
64
  return {
65
- create: (data: any, options?: { rowId?: string; permissions?: (permission: { read: (role: RoleString) => string; write: (role: RoleString) => string; create: (role: RoleString) => string; update: (role: RoleString) => string; delete: (role: RoleString) => string }, role: { any: () => RoleString; user: (userId: string, status?: string) => RoleString; users: (status?: string) => RoleString; guests: () => RoleString; team: (teamId: string, role?: string) => RoleString; member: (memberId: string) => RoleString; label: (label: string) => RoleString }) => string[]; transactionId?: string }) =>
65
+ create: (data: Omit<T, keyof Models.Row>, options?: { rowId?: string; permissions?: (permission: { read: (role: RoleString) => string; write: (role: RoleString) => string; create: (role: RoleString) => string; update: (role: RoleString) => string; delete: (role: RoleString) => string }, role: { any: () => RoleString; user: (userId: string, status?: string) => RoleString; users: (status?: string) => RoleString; guests: () => RoleString; team: (teamId: string, role?: string) => RoleString; member: (memberId: string) => RoleString; label: (label: string) => RoleString }) => string[]; transactionId?: string }) =>
66
66
  tablesDB.createRow<T>({
67
67
  databaseId,
68
68
  tableId,
69
69
  rowId: options?.rowId ?? ID.unique(),
70
- data,
70
+ data: data as T extends Models.DefaultRow ? Partial<Models.Row> & Record<string, unknown> : Partial<Models.Row> & Omit<T, keyof Models.Row>,
71
71
  permissions: resolvePermissions(options?.permissions),
72
72
  transactionId: options?.transactionId,
73
73
  }),
@@ -77,12 +77,12 @@ function createTableApi<T extends Models.Row>(
77
77
  tableId,
78
78
  rowId: id,
79
79
  }),
80
- update: (id: string, data: any, options?: { permissions?: (permission: { read: (role: RoleString) => string; write: (role: RoleString) => string; create: (role: RoleString) => string; update: (role: RoleString) => string; delete: (role: RoleString) => string }, role: { any: () => RoleString; user: (userId: string, status?: string) => RoleString; users: (status?: string) => RoleString; guests: () => RoleString; team: (teamId: string, role?: string) => RoleString; member: (memberId: string) => RoleString; label: (label: string) => RoleString }) => string[]; transactionId?: string }) =>
80
+ update: (id: string, data: Partial<Omit<T, keyof Models.Row>>, options?: { permissions?: (permission: { read: (role: RoleString) => string; write: (role: RoleString) => string; create: (role: RoleString) => string; update: (role: RoleString) => string; delete: (role: RoleString) => string }, role: { any: () => RoleString; user: (userId: string, status?: string) => RoleString; users: (status?: string) => RoleString; guests: () => RoleString; team: (teamId: string, role?: string) => RoleString; member: (memberId: string) => RoleString; label: (label: string) => RoleString }) => string[]; transactionId?: string }) =>
81
81
  tablesDB.updateRow<T>({
82
82
  databaseId,
83
83
  tableId,
84
84
  rowId: id,
85
- data,
85
+ data: data as T extends Models.DefaultRow ? Partial<Models.Row> & Record<string, unknown> : Partial<Models.Row> & Partial<Omit<T, keyof Models.Row>>,
86
86
  ...(options?.permissions ? { permissions: resolvePermissions(options.permissions) } : {}),
87
87
  transactionId: options?.transactionId,
88
88
  }),
@@ -94,7 +94,7 @@ function createTableApi<T extends Models.Row>(
94
94
  transactionId: options?.transactionId,
95
95
  });
96
96
  },
97
- list: (options?: { queries?: (q: any) => string[] }) =>
97
+ list: (options?: { queries?: (q: QueryBuilder<T>) => string[] }) =>
98
98
  tablesDB.listRows<T>({
99
99
  databaseId,
100
100
  tableId,
@@ -129,7 +129,7 @@ function createDatabaseHandle<D extends DatabaseId>(
129
129
  return tableApiCache.get(tableId) as DatabaseTableMap[D][T];
130
130
  },
131
131
  {{#if supportsServerSide}}
132
- create: (tableId: string, name: string, options?: { permissions?: (permission: { read: (role: RoleString) => string; write: (role: RoleString) => string; create: (role: RoleString) => string; update: (role: RoleString) => string; delete: (role: RoleString) => string }, role: { any: () => RoleString; user: (userId: string, status?: string) => RoleString; users: (status?: string) => RoleString; guests: () => RoleString; team: (teamId: string, role?: string) => RoleString; member: (memberId: string) => RoleString; label: (label: string) => RoleString }) => string[]; rowSecurity?: boolean; enabled?: boolean; columns?: any[]; indexes?: any[] }) =>
132
+ create: (tableId: string, name: string, options?: { permissions?: (permission: { read: (role: RoleString) => string; write: (role: RoleString) => string; create: (role: RoleString) => string; update: (role: RoleString) => string; delete: (role: RoleString) => string }, role: { any: () => RoleString; user: (userId: string, status?: string) => RoleString; users: (status?: string) => RoleString; guests: () => RoleString; team: (teamId: string, role?: string) => RoleString; member: (memberId: string) => RoleString; label: (label: string) => RoleString }) => string[]; rowSecurity?: boolean; enabled?: boolean; columns?: object[]; indexes?: object[] }) =>
133
133
  tablesDB.createTable({
134
134
  databaseId,
135
135
  tableId,
@@ -148,7 +148,7 @@ function createDatabaseHandle<D extends DatabaseId>(
148
148
  return tablesDB.updateTable({
149
149
  databaseId,
150
150
  tableId: resolvedTableId,
151
- name: options?.name ?? tableId, // TODO: remove this fallback once fixed in other SDKs
151
+ name: options?.name,
152
152
  permissions: resolvePermissions(options?.permissions),
153
153
  rowSecurity: options?.rowSecurity,
154
154
  enabled: options?.enabled,
@@ -28,9 +28,14 @@ import ClientLegacy from "../client.js";
28
28
 
29
29
  const DEFAULT_ENDPOINT = "https://cloud.appwrite.io/v1";
30
30
 
31
- const isMfaRequiredError = (err: any): boolean =>
32
- err?.type === "user_more_factors_required" ||
33
- err?.response === "user_more_factors_required";
31
+ interface AppwriteError {
32
+ type?: string;
33
+ response?: string;
34
+ }
35
+
36
+ const isMfaRequiredError = (err: unknown): err is AppwriteError =>
37
+ (err as AppwriteError)?.type === "user_more_factors_required" ||
38
+ (err as AppwriteError)?.response === "user_more_factors_required";
34
39
 
35
40
  const createLegacyConsoleClient = (endpoint: string): ClientLegacy => {
36
41
  const legacyClient = new ClientLegacy();
@@ -52,7 +57,7 @@ const completeMfaLogin = async ({
52
57
  legacyClient: ClientLegacy;
53
58
  mfa?: string;
54
59
  code?: string;
55
- }): Promise<any> => {
60
+ }): Promise<unknown> => {
56
61
  let accountClient = new Account(client);
57
62
 
58
63
  const savedCookie = globalConfig.getCookie();
@@ -92,11 +97,11 @@ const completeMfaLogin = async ({
92
97
 
93
98
  const deleteServerSession = async (sessionId: string): Promise<boolean> => {
94
99
  try {
95
- let client = await sdkForConsole();
96
- let accountClient = new Account(client);
100
+ const client = await sdkForConsole();
101
+ const accountClient = new Account(client);
97
102
  await accountClient.deleteSession(sessionId);
98
103
  return true;
99
- } catch (e) {
104
+ } catch (_e) {
100
105
  return false;
101
106
  }
102
107
  };
@@ -206,7 +211,7 @@ export const loginCommand = async ({
206
211
 
207
212
  try {
208
213
  await accountClient.get();
209
- } catch (err: any) {
214
+ } catch (err) {
210
215
  if (!isMfaRequiredError(err)) {
211
216
  throw err;
212
217
  }
@@ -234,7 +239,7 @@ export const loginCommand = async ({
234
239
  // Use legacy client for login to extract cookies from response
235
240
  const legacyClient = createLegacyConsoleClient(configEndpoint);
236
241
 
237
- let client = await sdkForConsole(false);
242
+ const client = await sdkForConsole(false);
238
243
  let accountClient = new Account(client);
239
244
 
240
245
  let account;
@@ -261,7 +266,7 @@ export const loginCommand = async ({
261
266
 
262
267
  accountClient = new Account(client);
263
268
  account = await accountClient.get();
264
- } catch (err: any) {
269
+ } catch (err) {
265
270
  if (isMfaRequiredError(err)) {
266
271
  account = await completeMfaLogin({
267
272
  client,
@@ -301,8 +306,8 @@ export const whoami = new Command("whoami")
301
306
  return;
302
307
  }
303
308
 
304
- let client = await sdkForConsole(false);
305
- let accountClient = new Account(client);
309
+ const client = await sdkForConsole(false);
310
+ const accountClient = new Account(client);
306
311
 
307
312
  let account;
308
313
 
@@ -501,7 +506,7 @@ export const client = new Command("client")
501
506
  : cookieValue || "********";
502
507
  maskedCookie = `${cookieName}=...${tail}`;
503
508
  }
504
- let config = {
509
+ const config = {
505
510
  endpoint: globalConfig.getEndpoint(),
506
511
  key: maskedKey,
507
512
  cookie: maskedCookie,
@@ -515,17 +520,17 @@ export const client = new Command("client")
515
520
  if (endpoint !== undefined) {
516
521
  try {
517
522
  const id = ID.unique();
518
- let url = new URL(endpoint);
523
+ const url = new URL(endpoint);
519
524
  if (url.protocol !== "http:" && url.protocol !== "https:") {
520
525
  throw new Error();
521
526
  }
522
527
 
523
- let clientInstance = new Client().setEndpoint(endpoint);
528
+ const clientInstance = new Client().setEndpoint(endpoint);
524
529
  clientInstance.setProject("console");
525
530
  if (selfSigned || globalConfig.getSelfSigned()) {
526
531
  clientInstance.setSelfSigned(true);
527
532
  }
528
- let response = (await clientInstance.call(
533
+ const response = (await clientInstance.call(
529
534
  "GET",
530
535
  new URL(endpoint + "/health/version"),
531
536
  )) as { version?: string };