Skip to content

Commit ecfc199

Browse files
committed
fix typescript errors
1 parent 1da249a commit ecfc199

File tree

95 files changed

+2122
-415
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+2122
-415
lines changed

.github/workflows/npm-publish.yml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
name: Publish Package to npmjs
2+
23
on:
34
release:
45
types: [published]
6+
7+
permissions:
8+
id-token: write
9+
contents: read
10+
511
jobs:
6-
build-for-linux-and-windows:
12+
build-and-publish:
713
runs-on: ubuntu-latest
814
steps:
9-
- uses: actions/checkout@v2
10-
- uses: actions/setup-node@v2
15+
- uses: actions/checkout@v4
16+
- uses: actions/setup-node@v4
1117
with:
12-
node-version: '16.x'
18+
node-version: '22'
1319
registry-url: 'https://registry.npmjs.org'
1420
- name: Setup binfmt with QEMU
1521
run: |
@@ -22,9 +28,9 @@ jobs:
2228
cd ./ldid
2329
sudo make
2430
sudo make install
25-
- name: Install dependenices and build for Linux and Windows
31+
- name: Install dependencies and build for Linux and Windows
2632
run: |
27-
npm install
33+
npm ci
2834
npm run linux-x64
2935
npm run linux-arm64
3036
npm run windows-x64
@@ -35,13 +41,11 @@ jobs:
3541
run: |
3642
if ${{ contains(github.event.release.tag_name, '-rc') }}; then
3743
echo "Publishing Release Candidate ${{ github.event.release.tag_name}} to NPM"
38-
npm publish --tag next
44+
npm publish --provenance --access public --tag next
3945
else
4046
echo "Publishing ${{ github.event.release.tag_name}} to NPM"
41-
npm publish
47+
npm publish --provenance --access public
4248
fi
43-
env:
44-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN_NO_ORG }}
4549
- uses: fnkr/github-action-ghr@v1
4650
env:
4751
GHR_PATH: build/

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Change Log
22

3+
## 13.0.0-rc.2
4+
5+
* Fixes a lot of typescript errors throughout the codebase
6+
37
## 13.0.0-rc.1
48

59
* Migrates codebase from JavaScript to TypeScript

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Once the installation is complete, you can verify the install using
2929

3030
```sh
3131
$ appwrite -v
32-
13.0.0-rc.1
32+
13.0.0-rc.2
3333
```
3434

3535
### Install using prebuilt binaries
@@ -60,7 +60,7 @@ $ scoop install https://raw.githubusercontent.com/appwrite/sdk-for-cli/master/sc
6060
Once the installation completes, you can verify your install using
6161
```
6262
$ appwrite -v
63-
13.0.0-rc.1
63+
13.0.0-rc.2
6464
```
6565

6666
## Getting Started

index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const oldWidth = process.stdout.columns;
55
process.stdout.columns = 100;
66
/** ---------------------------------------------- */
77

8-
import program = require('commander');
8+
import { program } from 'commander';
99
import chalk = require('chalk');
1010
const { version } = require('../package.json');
1111
import { commandDescriptions, cliConfig } from './lib/parser';

install.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
# You can use "View source" of this page to see the full script.
1414

1515
# REPO
16-
$GITHUB_x64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/13.0.0-rc.1/appwrite-cli-win-x64.exe"
17-
$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/13.0.0-rc.1/appwrite-cli-win-arm64.exe"
16+
$GITHUB_x64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/13.0.0-rc.2/appwrite-cli-win-x64.exe"
17+
$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/13.0.0-rc.2/appwrite-cli-win-arm64.exe"
1818

1919
$APPWRITE_BINARY_NAME = "appwrite.exe"
2020

install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ printSuccess() {
9696
downloadBinary() {
9797
echo "[2/4] Downloading executable for $OS ($ARCH) ..."
9898

99-
GITHUB_LATEST_VERSION="13.0.0-rc.1"
99+
GITHUB_LATEST_VERSION="13.0.0-rc.2"
100100
GITHUB_FILE="appwrite-cli-${OS}-${ARCH}"
101101
GITHUB_URL="https://github.com/$GITHUB_REPOSITORY_NAME/releases/download/$GITHUB_LATEST_VERSION/$GITHUB_FILE"
102102

lib/client.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import os = require('os');
2-
import { fetch, FormData, Agent } from 'undici';
2+
import { fetch, FormData, Agent, File } from 'undici';
33
import JSONbig = require('json-bigint');
44
import AppwriteException = require('./exception');
55
import { globalConfig } from './config';
@@ -9,7 +9,7 @@ import type { Headers, RequestParams, ResponseType, FileUpload } from './types';
99
const JSONBigInt = JSONbig({ storeAsString: false });
1010

1111
class Client {
12-
private readonly CHUNK_SIZE = 5 * 1024 * 1024; // 5MB
12+
readonly CHUNK_SIZE = 5 * 1024 * 1024; // 5MB
1313
private endpoint: string;
1414
private headers: Headers;
1515
private selfSigned: boolean;
@@ -22,8 +22,8 @@ class Client {
2222
'x-sdk-name': 'Command Line',
2323
'x-sdk-platform': 'console',
2424
'x-sdk-language': 'cli',
25-
'x-sdk-version': '13.0.0-rc.1',
26-
'user-agent': `AppwriteCLI/13.0.0-rc.1 (${os.type()} ${os.version()}; ${os.arch()})`,
25+
'x-sdk-version': '13.0.0-rc.2',
26+
'user-agent': `AppwriteCLI/13.0.0-rc.2 (${os.type()} ${os.version()}; ${os.arch()})`,
2727
'X-Appwrite-Response-Format': '1.8.0',
2828
};
2929
}
@@ -168,7 +168,7 @@ class Client {
168168
for (const [key, value] of Object.entries(flatParams)) {
169169
if (value && typeof value === 'object' && 'type' in value && value.type === 'file') {
170170
const fileUpload = value as FileUpload;
171-
formData.append(key, fileUpload.file as any, fileUpload.filename);
171+
formData.append(key, fileUpload.file, fileUpload.filename);
172172
} else {
173173
formData.append(key, value as string);
174174
}

lib/commands/account.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import fs = require('fs');
22
import pathLib = require('path');
33
import tar = require('tar');
4-
import ignore = require('ignore');
4+
import ignore from 'ignore';
55
import { promisify } from 'util';
66
import Client from '../client';
77
import { getAllFiles, showConsoleLink } from '../utils';
@@ -11,6 +11,10 @@ import { parse, actionRunner, parseInteger, parseBool, commandDescriptions, succ
1111
import { localConfig, globalConfig } from '../config';
1212
import { File } from 'undici';
1313
import { ReadableStream } from 'stream/web';
14+
import type { UploadProgress, FileInput } from '../types';
15+
import { AuthenticatorType } from '../enums/authenticator-type';
16+
import { AuthenticationFactor } from '../enums/authentication-factor';
17+
import { OAuthProvider } from '../enums/o-auth-provider';
1418

1519
function convertReadStreamToReadableStream(readStream: fs.ReadStream): ReadableStream {
1620
return new ReadableStream({
@@ -669,7 +673,7 @@ export const accountGetPrefs = async ({parseOutput = true, overrideForCli = fals
669673

670674
}
671675
interface AccountUpdatePrefsRequestParams {
672-
prefs: object;
676+
prefs: string;
673677
overrideForCli?: boolean;
674678
parseOutput?: boolean;
675679
sdk?: Client;

lib/commands/console.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import fs = require('fs');
22
import pathLib = require('path');
33
import tar = require('tar');
4-
import ignore = require('ignore');
4+
import ignore from 'ignore';
55
import { promisify } from 'util';
66
import Client from '../client';
77
import { getAllFiles, showConsoleLink } from '../utils';
@@ -11,6 +11,8 @@ import { parse, actionRunner, parseInteger, parseBool, commandDescriptions, succ
1111
import { localConfig, globalConfig } from '../config';
1212
import { File } from 'undici';
1313
import { ReadableStream } from 'stream/web';
14+
import type { UploadProgress, FileInput } from '../types';
15+
import { ConsoleResourceType } from '../enums/console-resource-type';
1416

1517
function convertReadStreamToReadableStream(readStream: fs.ReadStream): ReadableStream {
1618
return new ReadableStream({

0 commit comments

Comments
 (0)