Merge branch 'master' into feat-storage-buckets

This commit is contained in:
Damodar Lohani
2022-01-06 13:11:23 +05:45
405 changed files with 13573 additions and 2497 deletions
+32 -31
View File
@@ -38,7 +38,7 @@
class Appwrite {
constructor() {
this.config = {
endpoint: 'https://appwrite.io/v1',
endpoint: 'https://HOSTNAME/v1',
endpointRealtime: '',
project: '',
key: '',
@@ -48,7 +48,7 @@
};
this.headers = {
'x-sdk-version': 'appwrite:web:4.0.4',
'X-Appwrite-Response-Format': '0.11.0',
'X-Appwrite-Response-Format': '0.12.0',
};
this.realtime = {
socket: undefined,
@@ -2647,14 +2647,14 @@
}, payload);
}),
/**
* Get Anti virus
* Get Antivirus
*
* Check the Appwrite Anti Virus server is up and connection is successful.
* Check the Appwrite Antivirus server is up and connection is successful.
*
* @throws {AppwriteException}
* @returns {Promise}
*/
getAntiVirus: () => __awaiter(this, void 0, void 0, function* () {
getAntivirus: () => __awaiter(this, void 0, void 0, function* () {
let path = '/health/anti-virus';
let payload = {};
const uri = new URL(this.config.endpoint + path);
@@ -4452,10 +4452,11 @@
/**
* List Teams
*
* Get a list of all the current user teams. You can use the query params to
* filter your results. On admin mode, this endpoint will return a list of all
* of the project's teams. [Learn more about different API
* modes](/docs/admin).
* Get a list of all the teams in which the current user is a member. You can
* use the parameters to filter your results.
*
* In admin mode, this endpoint returns a list of all the teams in the current
* project. [Learn more about different API modes](/docs/admin).
*
* @param {string} search
* @param {number} limit
@@ -4496,9 +4497,8 @@
* Create Team
*
* Create a new team. The user who creates the team will automatically be
* assigned as the owner of the team. The team owner can invite new members,
* who will be able add new owners and update or delete the team from your
* project.
* assigned as the owner of the team. Only the users with the owner role can
* invite new members, add new owners and delete or update the team.
*
* @param {string} teamId
* @param {string} name
@@ -4532,8 +4532,7 @@
/**
* Get Team
*
* Get a team by its unique ID. All team members have read access for this
* resource.
* Get a team by its ID. All team members have read access for this resource.
*
* @param {string} teamId
* @throws {AppwriteException}
@@ -4553,8 +4552,8 @@
/**
* Update Team
*
* Update a team by its unique ID. Only team owners have write access for this
* resource.
* Update a team using its ID. Only members with the owner role can update the
* team.
*
* @param {string} teamId
* @param {string} name
@@ -4581,8 +4580,8 @@
/**
* Delete Team
*
* Delete a team by its unique ID. Only team owners have write access for this
* resource.
* Delete a team using its ID. Only team members with the owner role can
* delete the team.
*
* @param {string} teamId
* @throws {AppwriteException}
@@ -4602,8 +4601,8 @@
/**
* Get Team Memberships
*
* Get a team members by the team unique ID. All team members have read access
* for this list of resources.
* Use this endpoint to list a team's members using the team's ID. All team
* members have read access to this endpoint.
*
* @param {string} teamId
* @param {string} search
@@ -4647,22 +4646,21 @@
/**
* Create Team Membership
*
* Use this endpoint to invite a new member to join your team. If initiated
* from Client SDK, an email with a link to join the team will be sent to the
* new member's email address if the member doesn't exist in the project it
* will be created automatically. If initiated from server side SDKs, new
* member will automatically be added to the team.
* Invite a new member to join your team. If initiated from the client SDK, an
* email with a link to join the team will be sent to the member's email
* address and an account will be created for them should they not be signed
* up already. If initiated from server-side SDKs, the new member will
* automatically be added to the team.
*
* Use the 'URL' parameter to redirect the user from the invitation email back
* Use the 'url' parameter to redirect the user from the invitation email back
* to your app. When the user is redirected, use the [Update Team Membership
* Status](/docs/client/teams#teamsUpdateMembershipStatus) endpoint to allow
* the user to accept the invitation to the team. While calling from side
* SDKs the redirect url can be empty string.
* the user to accept the invitation to the team.
*
* Please note that in order to avoid a [Redirect
* Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
* Please note that to avoid a [Redirect
* Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
* the only valid redirect URL's are the once from domains you have set when
* added your platforms in the console interface.
* adding your platforms in the console interface.
*
* @param {string} teamId
* @param {string} email
@@ -4732,6 +4730,9 @@
/**
* Update Membership Roles
*
* Modify the roles of a team member. Only team members with the owner role
* have access to this endpoint. Learn more about [roles and
* permissions](/docs/permissions).
*
* @param {string} teamId
* @param {string} membershipId
-69
View File
@@ -140,75 +140,6 @@ window.addEventListener("load", async () => {
}
});
window.formValidation = (form, fields) => {
const elements = Array.from(form.querySelectorAll('[name]')).reduce((prev, curr) => {
if(!curr.name) {
return prev;
}
prev[curr.name] = curr;
return prev;
}, {});
const actionHandler = (action, attribute) => {
switch (action) {
case "disable":
elements[attribute].setAttribute("disabled", true);
elements[attribute].dispatchEvent(new Event('change'));
break;
case "enable":
elements[attribute].removeAttribute("disabled");
elements[attribute].dispatchEvent(new Event('change'));
break;
case "unvalue":
elements[attribute].value = "";
break;
case "check":
elements[attribute].value = "true";
break;
case "uncheck":
elements[attribute].value = "false";
break;
}
};
for (const field in fields) {
for (const attribute in fields[field]) {
const attr = fields[field][attribute];
if (Array.isArray(attr)) {
attr.forEach(action => {
if (elements[field].value === "true") {
actionHandler(action, attribute);
}
})
} else {
const condition = attr.if.some(c => {
return elements[c].value === "true";
});
if (condition) {
for (const thenAction in attr.then) {
attr.then[thenAction].forEach(action => {
actionHandler(action, thenAction);
});
}
} else {
for (const elseAction in attr.else) {
attr.else[elseAction].forEach(action => {
actionHandler(action, elseAction);
});
}
}
}
}
}
form.addEventListener("reset", () => {
for (const key in fields) {
if (Object.hasOwnProperty.call(fields, key)) {
const element = elements[key];
element.setAttribute("value", "");
element.removeAttribute("disabled");
element.dispatchEvent(new Event("change"));
}
}
});
};
/**
* Method to add attribute for the UI on array attributes.
*
+1 -1
View File
@@ -72,7 +72,7 @@
const setIdType = function (idType) {
if (idType == "custom") {
element.setAttribute("data-id-type", idType);
info.innerHTML = "Allowed Characters A-Z, a-z, 0-9, and non-leading underscore";
info.innerHTML = "Allowed Characters A-Z, a-z, 0-9, and non-leading underscore, hyphen and dot";
if (prevData === 'auto-generated') {
prevData = ""
}