Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Change Log

## 28.0.0

* Breaking: removed `account.createJWT`; use `users.createJWT` instead. A leaked JWT could mint further JWTs, letting a credential outlive its own expiry — a session cannot duplicate itself to live forever either
* Breaking: removed `project.createKey`. A leaked key could mint further hidden keys, making a compromise far harder to contain and revoke
* Breaking: `activities.listEvents` `queries` now takes an array instead of a string
* Added: `embeddings` service with `createTextEmbeddings`, plus the `EmbeddingModel` enum
* Added: TablesDB migration methods `listMigrations`, `createMigration`, `getMigration`, `deleteMigration`, `cutoverMigration`, and `listOperations`
* Added: `proxy.createInvalidation` for purging cached edge responses, plus the `InvalidationType` enum
* Added: `apps.deleteInstallation`
* Added: `users.getMFAChallenge` and the `MfaChallengeSecret` model
* Added: `project.updateMFAFactorsPolicy` and the `PolicyMfaFactors` model
* Added: `client.setOrganization` for organization-scoped requests
* Added: `folder` parameter to `storage.createFile`
* Added: `syncMode` parameter to `tablesDB.create` and `tablesDB.update`, and `specification` to `tablesDB.update`
* Added: `installationScopes` parameter to `project.updateOAuth2Server`
* Added: `custom` authentication factor, `node-26` runtime, `mfa-factors` project policy, and the `embeddings.write` and `proxy.invalidations.write` key scopes
* Updated: response format to `1.9.6`

## 27.1.0

* Added: `Apps` service for managing OAuth2 applications, keys, and installations
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Appwrite Node.js SDK

![License](https://img.shields.io/github/license/appwrite/sdk-for-node.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.9.5-blue.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.9.6-blue.svg?style=flat-square)
[![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator)
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite)
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/activities/list-events.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ const client = new sdk.Client()
const activities = new sdk.Activities(client);

const result = await activities.listEvents({
queries: '' // optional
queries: [] // optional
});
```
2 changes: 1 addition & 1 deletion docs/examples/apps/create-installation-token.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const sdk = require('node-appwrite');
const client = new sdk.Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
.setSession(''); // The user session to authenticate with

const apps = new sdk.Apps(client);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ const client = new sdk.Client()
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setSession(''); // The user session to authenticate with

const account = new sdk.Account(client);
const apps = new sdk.Apps(client);

const result = await account.createJWT({
duration: 0 // optional
const result = await apps.deleteInstallation({
appId: '<APP_ID>',
installationId: '<INSTALLATION_ID>'
});
```
2 changes: 1 addition & 1 deletion docs/examples/apps/get-installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const sdk = require('node-appwrite');
const client = new sdk.Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
.setSession(''); // The user session to authenticate with

const apps = new sdk.Apps(client);

Expand Down
2 changes: 1 addition & 1 deletion docs/examples/apps/list-installations.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const sdk = require('node-appwrite');
const client = new sdk.Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
.setSession(''); // The user session to authenticate with

const apps = new sdk.Apps(client);

Expand Down
15 changes: 15 additions & 0 deletions docs/examples/embeddings/create-text-embeddings.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
```javascript
const sdk = require('node-appwrite');

const client = new sdk.Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key

const embeddings = new sdk.Embeddings(client);

const result = await embeddings.createTextEmbeddings({
texts: [],
model: sdk.EmbeddingModel.NomicEmbedText // optional
});
```
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ const client = new sdk.Client()

const project = new sdk.Project(client);

const result = await project.createKey({
keyId: '<KEY_ID>',
name: '<NAME>',
scopes: [sdk.ProjectKeyScopes.ProjectRead],
expire: '2020-10-15T06:38:00.000+00:00' // optional
const result = await project.updateMFAFactorsPolicy({
totp: false, // optional
email: false, // optional
phone: false, // optional
custom: false // optional
});
```
3 changes: 2 additions & 1 deletion docs/examples/project/update-o-auth-2-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const result = await project.updateOAuth2Server({
userCodeLength: 6, // optional
userCodeFormat: 'numeric', // optional
deviceCodeDuration: 60, // optional
defaultScopes: [] // optional
defaultScopes: [], // optional
installationScopes: [] // optional
});
```
2 changes: 1 addition & 1 deletion docs/examples/project/update-session-duration-policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ const client = new sdk.Client()
const project = new sdk.Project(client);

const result = await project.updateSessionDurationPolicy({
duration: 5
duration: 60
});
```
2 changes: 1 addition & 1 deletion docs/examples/project/update-user-limit-policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ const client = new sdk.Client()
const project = new sdk.Project(client);

const result = await project.updateUserLimitPolicy({
total: 1
total: 0
});
```
16 changes: 16 additions & 0 deletions docs/examples/proxy/create-invalidation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
```javascript
const sdk = require('node-appwrite');

const client = new sdk.Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key

const proxy = new sdk.Proxy(client);

const result = await proxy.createInvalidation({
domain: '',
type: sdk.InvalidationType.Tag,
reference: '<REFERENCE>' // optional
});
```
3 changes: 2 additions & 1 deletion docs/examples/storage/create-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const result = await storage.createFile({
bucketId: '<BUCKET_ID>',
fileId: '<FILE_ID>',
file: InputFile.fromPath('/path/to/file', 'filename'),
permissions: [sdk.Permission.read(sdk.Role.any())] // optional
permissions: [sdk.Permission.read(sdk.Role.any())], // optional
folder: '' // optional
});
```
16 changes: 16 additions & 0 deletions docs/examples/tablesdb/create-migration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
```javascript
const sdk = require('node-appwrite');

const client = new sdk.Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key

const tablesDB = new sdk.TablesDB(client);

const result = await tablesDB.createMigration({
databaseId: '<DATABASE_ID>',
specification: 's-1vcpu-1gb',
autoCutover: false // optional
});
```
3 changes: 2 additions & 1 deletion docs/examples/tablesdb/create.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const result = await tablesDB.create({
name: '<NAME>',
enabled: false, // optional
specification: 'serverless', // optional
replicas: 0 // optional
replicas: 0, // optional
syncMode: 'async' // optional
});
```
15 changes: 15 additions & 0 deletions docs/examples/tablesdb/cutover-migration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
```javascript
const sdk = require('node-appwrite');

const client = new sdk.Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key

const tablesDB = new sdk.TablesDB(client);

const result = await tablesDB.cutoverMigration({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets check with Jake if this is 100% terminology we want. its not what we commonly do. We usually createMnigrationCutover, for exmaple

databaseId: '<DATABASE_ID>',
migrationId: '<MIGRATION_ID>'
});
```
15 changes: 15 additions & 0 deletions docs/examples/tablesdb/delete-migration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
```javascript
const sdk = require('node-appwrite');

const client = new sdk.Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key

const tablesDB = new sdk.TablesDB(client);

const result = await tablesDB.deleteMigration({
databaseId: '<DATABASE_ID>',
migrationId: '<MIGRATION_ID>'
});
```
15 changes: 15 additions & 0 deletions docs/examples/tablesdb/get-migration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
```javascript
const sdk = require('node-appwrite');

const client = new sdk.Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key

const tablesDB = new sdk.TablesDB(client);

const result = await tablesDB.getMigration({
databaseId: '<DATABASE_ID>',
migrationId: '<MIGRATION_ID>'
});
```
14 changes: 14 additions & 0 deletions docs/examples/tablesdb/list-migrations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
```javascript
const sdk = require('node-appwrite');

const client = new sdk.Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key

const tablesDB = new sdk.TablesDB(client);

const result = await tablesDB.listMigrations({
databaseId: '<DATABASE_ID>'
});
```
17 changes: 17 additions & 0 deletions docs/examples/tablesdb/list-operations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
```javascript
const sdk = require('node-appwrite');

const client = new sdk.Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key

const tablesDB = new sdk.TablesDB(client);

const result = await tablesDB.listOperations({
databaseId: '<DATABASE_ID>',
status: 'running', // optional
limit: 1, // optional
offset: 0 // optional
});
```
4 changes: 3 additions & 1 deletion docs/examples/tablesdb/update.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ const result = await tablesDB.update({
databaseId: '<DATABASE_ID>',
name: '<NAME>', // optional
enabled: false, // optional
replicas: 0 // optional
specification: 'serverless', // optional
replicas: 0, // optional
syncMode: 'async' // optional
Comment on lines +15 to +17

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note for fututre, we might want enums here

});
```
15 changes: 15 additions & 0 deletions docs/examples/users/get-mfa-challenge.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
```javascript
const sdk = require('node-appwrite');

const client = new sdk.Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key

const users = new sdk.Users(client);

const result = await users.getMFAChallenge({
userId: '<USER_ID>',
challengeId: '<CHALLENGE_ID>'
});
```
Loading