@appwrite.io/console 2.1.1 → 2.1.3
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.
- package/CHANGELOG.md +8 -0
- package/README.md +1 -1
- package/dist/cjs/sdk.js +311 -17
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +310 -18
- package/dist/esm/sdk.js.map +1 -1
- package/dist/iife/sdk.js +344 -70
- package/docs/examples/domains/list-suggestions.md +18 -0
- package/docs/examples/health/get-queue-audits.md +13 -0
- package/docs/examples/organizations/create.md +2 -2
- package/docs/examples/organizations/estimation-create-organization.md +2 -2
- package/docs/examples/organizations/estimation-update-plan.md +2 -2
- package/docs/examples/organizations/update-plan.md +2 -2
- package/package.json +3 -2
- package/src/channel.ts +134 -0
- package/src/client.ts +79 -9
- package/src/enums/billing-plan.ts +17 -0
- package/src/enums/filter-type.ts +4 -0
- package/src/enums/name.ts +1 -0
- package/src/enums/o-auth-provider.ts +0 -2
- package/src/index.ts +3 -0
- package/src/models.ts +437 -375
- package/src/query.ts +42 -0
- package/src/services/account.ts +20 -20
- package/src/services/avatars.ts +117 -117
- package/src/services/backups.ts +18 -18
- package/src/services/console.ts +24 -24
- package/src/services/databases.ts +89 -89
- package/src/services/domains.ts +295 -204
- package/src/services/functions.ts +30 -30
- package/src/services/health.ts +201 -152
- package/src/services/messaging.ts +54 -54
- package/src/services/migrations.ts +36 -36
- package/src/services/organizations.ts +67 -66
- package/src/services/projects.ts +81 -81
- package/src/services/realtime.ts +35 -12
- package/src/services/sites.ts +30 -30
- package/src/services/storage.ts +45 -45
- package/src/services/tables-db.ts +89 -89
- package/src/services/users.ts +39 -39
- package/types/channel.d.ts +71 -0
- package/types/client.d.ts +11 -3
- package/types/enums/billing-plan.d.ts +17 -0
- package/types/enums/filter-type.d.ts +4 -0
- package/types/enums/name.d.ts +1 -0
- package/types/enums/o-auth-provider.d.ts +0 -2
- package/types/index.d.ts +3 -0
- package/types/models.d.ts +434 -375
- package/types/query.d.ts +30 -0
- package/types/services/account.d.ts +11 -11
- package/types/services/avatars.d.ts +82 -82
- package/types/services/backups.d.ts +8 -8
- package/types/services/console.d.ts +14 -14
- package/types/services/databases.d.ts +50 -50
- package/types/services/domains.d.ts +139 -104
- package/types/services/functions.d.ts +15 -15
- package/types/services/health.d.ts +95 -78
- package/types/services/messaging.d.ts +24 -24
- package/types/services/migrations.d.ts +16 -16
- package/types/services/organizations.d.ts +37 -36
- package/types/services/projects.d.ts +36 -36
- package/types/services/realtime.d.ts +17 -8
- package/types/services/sites.d.ts +15 -15
- package/types/services/storage.d.ts +30 -30
- package/types/services/tables-db.d.ts +50 -50
- package/types/services/users.d.ts +24 -24
package/src/services/projects.ts
CHANGED
|
@@ -741,33 +741,33 @@ export class Projects {
|
|
|
741
741
|
* Update how long sessions created within a project should stay active for.
|
|
742
742
|
*
|
|
743
743
|
* @param {string} params.projectId - Project unique ID.
|
|
744
|
-
* @param {number
|
|
744
|
+
* @param {number} params.duration - Project session length in seconds. Max length: 31536000 seconds.
|
|
745
745
|
* @throws {AppwriteException}
|
|
746
746
|
* @returns {Promise<Models.Project>}
|
|
747
747
|
*/
|
|
748
|
-
updateAuthDuration(params: { projectId: string, duration: number
|
|
748
|
+
updateAuthDuration(params: { projectId: string, duration: number }): Promise<Models.Project>;
|
|
749
749
|
/**
|
|
750
750
|
* Update how long sessions created within a project should stay active for.
|
|
751
751
|
*
|
|
752
752
|
* @param {string} projectId - Project unique ID.
|
|
753
|
-
* @param {number
|
|
753
|
+
* @param {number} duration - Project session length in seconds. Max length: 31536000 seconds.
|
|
754
754
|
* @throws {AppwriteException}
|
|
755
755
|
* @returns {Promise<Models.Project>}
|
|
756
756
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
757
757
|
*/
|
|
758
|
-
updateAuthDuration(projectId: string, duration: number
|
|
758
|
+
updateAuthDuration(projectId: string, duration: number): Promise<Models.Project>;
|
|
759
759
|
updateAuthDuration(
|
|
760
|
-
paramsOrFirst: { projectId: string, duration: number
|
|
761
|
-
...rest: [(number
|
|
760
|
+
paramsOrFirst: { projectId: string, duration: number } | string,
|
|
761
|
+
...rest: [(number)?]
|
|
762
762
|
): Promise<Models.Project> {
|
|
763
|
-
let params: { projectId: string, duration: number
|
|
763
|
+
let params: { projectId: string, duration: number };
|
|
764
764
|
|
|
765
765
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
766
|
-
params = (paramsOrFirst || {}) as { projectId: string, duration: number
|
|
766
|
+
params = (paramsOrFirst || {}) as { projectId: string, duration: number };
|
|
767
767
|
} else {
|
|
768
768
|
params = {
|
|
769
769
|
projectId: paramsOrFirst as string,
|
|
770
|
-
duration: rest[0] as number
|
|
770
|
+
duration: rest[0] as number
|
|
771
771
|
};
|
|
772
772
|
}
|
|
773
773
|
|
|
@@ -804,33 +804,33 @@ export class Projects {
|
|
|
804
804
|
* Update the maximum number of users allowed in this project. Set to 0 for unlimited users.
|
|
805
805
|
*
|
|
806
806
|
* @param {string} params.projectId - Project unique ID.
|
|
807
|
-
* @param {number
|
|
807
|
+
* @param {number} params.limit - Set the max number of users allowed in this project. Use 0 for unlimited.
|
|
808
808
|
* @throws {AppwriteException}
|
|
809
809
|
* @returns {Promise<Models.Project>}
|
|
810
810
|
*/
|
|
811
|
-
updateAuthLimit(params: { projectId: string, limit: number
|
|
811
|
+
updateAuthLimit(params: { projectId: string, limit: number }): Promise<Models.Project>;
|
|
812
812
|
/**
|
|
813
813
|
* Update the maximum number of users allowed in this project. Set to 0 for unlimited users.
|
|
814
814
|
*
|
|
815
815
|
* @param {string} projectId - Project unique ID.
|
|
816
|
-
* @param {number
|
|
816
|
+
* @param {number} limit - Set the max number of users allowed in this project. Use 0 for unlimited.
|
|
817
817
|
* @throws {AppwriteException}
|
|
818
818
|
* @returns {Promise<Models.Project>}
|
|
819
819
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
820
820
|
*/
|
|
821
|
-
updateAuthLimit(projectId: string, limit: number
|
|
821
|
+
updateAuthLimit(projectId: string, limit: number): Promise<Models.Project>;
|
|
822
822
|
updateAuthLimit(
|
|
823
|
-
paramsOrFirst: { projectId: string, limit: number
|
|
824
|
-
...rest: [(number
|
|
823
|
+
paramsOrFirst: { projectId: string, limit: number } | string,
|
|
824
|
+
...rest: [(number)?]
|
|
825
825
|
): Promise<Models.Project> {
|
|
826
|
-
let params: { projectId: string, limit: number
|
|
826
|
+
let params: { projectId: string, limit: number };
|
|
827
827
|
|
|
828
828
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
829
|
-
params = (paramsOrFirst || {}) as { projectId: string, limit: number
|
|
829
|
+
params = (paramsOrFirst || {}) as { projectId: string, limit: number };
|
|
830
830
|
} else {
|
|
831
831
|
params = {
|
|
832
832
|
projectId: paramsOrFirst as string,
|
|
833
|
-
limit: rest[0] as number
|
|
833
|
+
limit: rest[0] as number
|
|
834
834
|
};
|
|
835
835
|
}
|
|
836
836
|
|
|
@@ -867,33 +867,33 @@ export class Projects {
|
|
|
867
867
|
* Update the maximum number of sessions allowed per user within the project, if the limit is hit the oldest session will be deleted to make room for new sessions.
|
|
868
868
|
*
|
|
869
869
|
* @param {string} params.projectId - Project unique ID.
|
|
870
|
-
* @param {number
|
|
870
|
+
* @param {number} params.limit - Set the max number of users allowed in this project. Value allowed is between 1-100. Default is 10
|
|
871
871
|
* @throws {AppwriteException}
|
|
872
872
|
* @returns {Promise<Models.Project>}
|
|
873
873
|
*/
|
|
874
|
-
updateAuthSessionsLimit(params: { projectId: string, limit: number
|
|
874
|
+
updateAuthSessionsLimit(params: { projectId: string, limit: number }): Promise<Models.Project>;
|
|
875
875
|
/**
|
|
876
876
|
* Update the maximum number of sessions allowed per user within the project, if the limit is hit the oldest session will be deleted to make room for new sessions.
|
|
877
877
|
*
|
|
878
878
|
* @param {string} projectId - Project unique ID.
|
|
879
|
-
* @param {number
|
|
879
|
+
* @param {number} limit - Set the max number of users allowed in this project. Value allowed is between 1-100. Default is 10
|
|
880
880
|
* @throws {AppwriteException}
|
|
881
881
|
* @returns {Promise<Models.Project>}
|
|
882
882
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
883
883
|
*/
|
|
884
|
-
updateAuthSessionsLimit(projectId: string, limit: number
|
|
884
|
+
updateAuthSessionsLimit(projectId: string, limit: number): Promise<Models.Project>;
|
|
885
885
|
updateAuthSessionsLimit(
|
|
886
|
-
paramsOrFirst: { projectId: string, limit: number
|
|
887
|
-
...rest: [(number
|
|
886
|
+
paramsOrFirst: { projectId: string, limit: number } | string,
|
|
887
|
+
...rest: [(number)?]
|
|
888
888
|
): Promise<Models.Project> {
|
|
889
|
-
let params: { projectId: string, limit: number
|
|
889
|
+
let params: { projectId: string, limit: number };
|
|
890
890
|
|
|
891
891
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
892
|
-
params = (paramsOrFirst || {}) as { projectId: string, limit: number
|
|
892
|
+
params = (paramsOrFirst || {}) as { projectId: string, limit: number };
|
|
893
893
|
} else {
|
|
894
894
|
params = {
|
|
895
895
|
projectId: paramsOrFirst as string,
|
|
896
|
-
limit: rest[0] as number
|
|
896
|
+
limit: rest[0] as number
|
|
897
897
|
};
|
|
898
898
|
}
|
|
899
899
|
|
|
@@ -1139,33 +1139,33 @@ export class Projects {
|
|
|
1139
1139
|
* Update the authentication password history requirement. Use this endpoint to require new passwords to be different than the last X amount of previously used ones.
|
|
1140
1140
|
*
|
|
1141
1141
|
* @param {string} params.projectId - Project unique ID.
|
|
1142
|
-
* @param {number
|
|
1142
|
+
* @param {number} params.limit - Set the max number of passwords to store in user history. User can't choose a new password that is already stored in the password history list. Max number of passwords allowed in history is20. Default value is 0
|
|
1143
1143
|
* @throws {AppwriteException}
|
|
1144
1144
|
* @returns {Promise<Models.Project>}
|
|
1145
1145
|
*/
|
|
1146
|
-
updateAuthPasswordHistory(params: { projectId: string, limit: number
|
|
1146
|
+
updateAuthPasswordHistory(params: { projectId: string, limit: number }): Promise<Models.Project>;
|
|
1147
1147
|
/**
|
|
1148
1148
|
* Update the authentication password history requirement. Use this endpoint to require new passwords to be different than the last X amount of previously used ones.
|
|
1149
1149
|
*
|
|
1150
1150
|
* @param {string} projectId - Project unique ID.
|
|
1151
|
-
* @param {number
|
|
1151
|
+
* @param {number} limit - Set the max number of passwords to store in user history. User can't choose a new password that is already stored in the password history list. Max number of passwords allowed in history is20. Default value is 0
|
|
1152
1152
|
* @throws {AppwriteException}
|
|
1153
1153
|
* @returns {Promise<Models.Project>}
|
|
1154
1154
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1155
1155
|
*/
|
|
1156
|
-
updateAuthPasswordHistory(projectId: string, limit: number
|
|
1156
|
+
updateAuthPasswordHistory(projectId: string, limit: number): Promise<Models.Project>;
|
|
1157
1157
|
updateAuthPasswordHistory(
|
|
1158
|
-
paramsOrFirst: { projectId: string, limit: number
|
|
1159
|
-
...rest: [(number
|
|
1158
|
+
paramsOrFirst: { projectId: string, limit: number } | string,
|
|
1159
|
+
...rest: [(number)?]
|
|
1160
1160
|
): Promise<Models.Project> {
|
|
1161
|
-
let params: { projectId: string, limit: number
|
|
1161
|
+
let params: { projectId: string, limit: number };
|
|
1162
1162
|
|
|
1163
1163
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1164
|
-
params = (paramsOrFirst || {}) as { projectId: string, limit: number
|
|
1164
|
+
params = (paramsOrFirst || {}) as { projectId: string, limit: number };
|
|
1165
1165
|
} else {
|
|
1166
1166
|
params = {
|
|
1167
1167
|
projectId: paramsOrFirst as string,
|
|
1168
|
-
limit: rest[0] as number
|
|
1168
|
+
limit: rest[0] as number
|
|
1169
1169
|
};
|
|
1170
1170
|
}
|
|
1171
1171
|
|
|
@@ -1793,35 +1793,35 @@ export class Projects {
|
|
|
1793
1793
|
*
|
|
1794
1794
|
* @param {string} params.projectId - Project unique ID.
|
|
1795
1795
|
* @param {string[]} params.scopes - List of scopes allowed for JWT key. Maximum of 100 scopes are allowed.
|
|
1796
|
-
* @param {number
|
|
1796
|
+
* @param {number} params.duration - Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds.
|
|
1797
1797
|
* @throws {AppwriteException}
|
|
1798
1798
|
* @returns {Promise<Models.Jwt>}
|
|
1799
1799
|
*/
|
|
1800
|
-
createJWT(params: { projectId: string, scopes: string[], duration?: number
|
|
1800
|
+
createJWT(params: { projectId: string, scopes: string[], duration?: number }): Promise<Models.Jwt>;
|
|
1801
1801
|
/**
|
|
1802
1802
|
* Create a new JWT token. This token can be used to authenticate users with custom scopes and expiration time.
|
|
1803
1803
|
*
|
|
1804
1804
|
* @param {string} projectId - Project unique ID.
|
|
1805
1805
|
* @param {string[]} scopes - List of scopes allowed for JWT key. Maximum of 100 scopes are allowed.
|
|
1806
|
-
* @param {number
|
|
1806
|
+
* @param {number} duration - Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds.
|
|
1807
1807
|
* @throws {AppwriteException}
|
|
1808
1808
|
* @returns {Promise<Models.Jwt>}
|
|
1809
1809
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1810
1810
|
*/
|
|
1811
|
-
createJWT(projectId: string, scopes: string[], duration?: number
|
|
1811
|
+
createJWT(projectId: string, scopes: string[], duration?: number): Promise<Models.Jwt>;
|
|
1812
1812
|
createJWT(
|
|
1813
|
-
paramsOrFirst: { projectId: string, scopes: string[], duration?: number
|
|
1814
|
-
...rest: [(string[])?, (number
|
|
1813
|
+
paramsOrFirst: { projectId: string, scopes: string[], duration?: number } | string,
|
|
1814
|
+
...rest: [(string[])?, (number)?]
|
|
1815
1815
|
): Promise<Models.Jwt> {
|
|
1816
|
-
let params: { projectId: string, scopes: string[], duration?: number
|
|
1816
|
+
let params: { projectId: string, scopes: string[], duration?: number };
|
|
1817
1817
|
|
|
1818
1818
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1819
|
-
params = (paramsOrFirst || {}) as { projectId: string, scopes: string[], duration?: number
|
|
1819
|
+
params = (paramsOrFirst || {}) as { projectId: string, scopes: string[], duration?: number };
|
|
1820
1820
|
} else {
|
|
1821
1821
|
params = {
|
|
1822
1822
|
projectId: paramsOrFirst as string,
|
|
1823
1823
|
scopes: rest[0] as string[],
|
|
1824
|
-
duration: rest[1] as number
|
|
1824
|
+
duration: rest[1] as number
|
|
1825
1825
|
};
|
|
1826
1826
|
}
|
|
1827
1827
|
|
|
@@ -2858,7 +2858,7 @@ export class Projects {
|
|
|
2858
2858
|
* @param {string} params.senderEmail - Email of the sender
|
|
2859
2859
|
* @param {string} params.replyTo - Reply to email
|
|
2860
2860
|
* @param {string} params.host - SMTP server host name
|
|
2861
|
-
* @param {number
|
|
2861
|
+
* @param {number} params.port - SMTP server port
|
|
2862
2862
|
* @param {string} params.username - SMTP server username
|
|
2863
2863
|
* @param {string} params.password - SMTP server password
|
|
2864
2864
|
* @param {SMTPSecure} params.secure - Does SMTP server use secure connection
|
|
@@ -2866,7 +2866,7 @@ export class Projects {
|
|
|
2866
2866
|
* @returns {Promise<Models.Project>}
|
|
2867
2867
|
* @deprecated This API has been deprecated since 1.8.0. Please use `Projects.updateSMTP` instead.
|
|
2868
2868
|
*/
|
|
2869
|
-
updateSmtp(params: { projectId: string, enabled: boolean, senderName?: string, senderEmail?: string, replyTo?: string, host?: string, port?: number
|
|
2869
|
+
updateSmtp(params: { projectId: string, enabled: boolean, senderName?: string, senderEmail?: string, replyTo?: string, host?: string, port?: number, username?: string, password?: string, secure?: SMTPSecure }): Promise<Models.Project>;
|
|
2870
2870
|
/**
|
|
2871
2871
|
* Update the SMTP configuration for your project. Use this endpoint to configure your project's SMTP provider with your custom settings for sending transactional emails.
|
|
2872
2872
|
*
|
|
@@ -2876,7 +2876,7 @@ export class Projects {
|
|
|
2876
2876
|
* @param {string} senderEmail - Email of the sender
|
|
2877
2877
|
* @param {string} replyTo - Reply to email
|
|
2878
2878
|
* @param {string} host - SMTP server host name
|
|
2879
|
-
* @param {number
|
|
2879
|
+
* @param {number} port - SMTP server port
|
|
2880
2880
|
* @param {string} username - SMTP server username
|
|
2881
2881
|
* @param {string} password - SMTP server password
|
|
2882
2882
|
* @param {SMTPSecure} secure - Does SMTP server use secure connection
|
|
@@ -2884,15 +2884,15 @@ export class Projects {
|
|
|
2884
2884
|
* @returns {Promise<Models.Project>}
|
|
2885
2885
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
2886
2886
|
*/
|
|
2887
|
-
updateSmtp(projectId: string, enabled: boolean, senderName?: string, senderEmail?: string, replyTo?: string, host?: string, port?: number
|
|
2887
|
+
updateSmtp(projectId: string, enabled: boolean, senderName?: string, senderEmail?: string, replyTo?: string, host?: string, port?: number, username?: string, password?: string, secure?: SMTPSecure): Promise<Models.Project>;
|
|
2888
2888
|
updateSmtp(
|
|
2889
|
-
paramsOrFirst: { projectId: string, enabled: boolean, senderName?: string, senderEmail?: string, replyTo?: string, host?: string, port?: number
|
|
2890
|
-
...rest: [(boolean)?, (string)?, (string)?, (string)?, (string)?, (number
|
|
2889
|
+
paramsOrFirst: { projectId: string, enabled: boolean, senderName?: string, senderEmail?: string, replyTo?: string, host?: string, port?: number, username?: string, password?: string, secure?: SMTPSecure } | string,
|
|
2890
|
+
...rest: [(boolean)?, (string)?, (string)?, (string)?, (string)?, (number)?, (string)?, (string)?, (SMTPSecure)?]
|
|
2891
2891
|
): Promise<Models.Project> {
|
|
2892
|
-
let params: { projectId: string, enabled: boolean, senderName?: string, senderEmail?: string, replyTo?: string, host?: string, port?: number
|
|
2892
|
+
let params: { projectId: string, enabled: boolean, senderName?: string, senderEmail?: string, replyTo?: string, host?: string, port?: number, username?: string, password?: string, secure?: SMTPSecure };
|
|
2893
2893
|
|
|
2894
2894
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2895
|
-
params = (paramsOrFirst || {}) as { projectId: string, enabled: boolean, senderName?: string, senderEmail?: string, replyTo?: string, host?: string, port?: number
|
|
2895
|
+
params = (paramsOrFirst || {}) as { projectId: string, enabled: boolean, senderName?: string, senderEmail?: string, replyTo?: string, host?: string, port?: number, username?: string, password?: string, secure?: SMTPSecure };
|
|
2896
2896
|
} else {
|
|
2897
2897
|
params = {
|
|
2898
2898
|
projectId: paramsOrFirst as string,
|
|
@@ -2901,7 +2901,7 @@ export class Projects {
|
|
|
2901
2901
|
senderEmail: rest[2] as string,
|
|
2902
2902
|
replyTo: rest[3] as string,
|
|
2903
2903
|
host: rest[4] as string,
|
|
2904
|
-
port: rest[5] as number
|
|
2904
|
+
port: rest[5] as number,
|
|
2905
2905
|
username: rest[6] as string,
|
|
2906
2906
|
password: rest[7] as string,
|
|
2907
2907
|
secure: rest[8] as SMTPSecure
|
|
@@ -2978,14 +2978,14 @@ export class Projects {
|
|
|
2978
2978
|
* @param {string} params.senderEmail - Email of the sender
|
|
2979
2979
|
* @param {string} params.replyTo - Reply to email
|
|
2980
2980
|
* @param {string} params.host - SMTP server host name
|
|
2981
|
-
* @param {number
|
|
2981
|
+
* @param {number} params.port - SMTP server port
|
|
2982
2982
|
* @param {string} params.username - SMTP server username
|
|
2983
2983
|
* @param {string} params.password - SMTP server password
|
|
2984
2984
|
* @param {SMTPSecure} params.secure - Does SMTP server use secure connection
|
|
2985
2985
|
* @throws {AppwriteException}
|
|
2986
2986
|
* @returns {Promise<Models.Project>}
|
|
2987
2987
|
*/
|
|
2988
|
-
updateSMTP(params: { projectId: string, enabled: boolean, senderName?: string, senderEmail?: string, replyTo?: string, host?: string, port?: number
|
|
2988
|
+
updateSMTP(params: { projectId: string, enabled: boolean, senderName?: string, senderEmail?: string, replyTo?: string, host?: string, port?: number, username?: string, password?: string, secure?: SMTPSecure }): Promise<Models.Project>;
|
|
2989
2989
|
/**
|
|
2990
2990
|
* Update the SMTP configuration for your project. Use this endpoint to configure your project's SMTP provider with your custom settings for sending transactional emails.
|
|
2991
2991
|
*
|
|
@@ -2995,7 +2995,7 @@ export class Projects {
|
|
|
2995
2995
|
* @param {string} senderEmail - Email of the sender
|
|
2996
2996
|
* @param {string} replyTo - Reply to email
|
|
2997
2997
|
* @param {string} host - SMTP server host name
|
|
2998
|
-
* @param {number
|
|
2998
|
+
* @param {number} port - SMTP server port
|
|
2999
2999
|
* @param {string} username - SMTP server username
|
|
3000
3000
|
* @param {string} password - SMTP server password
|
|
3001
3001
|
* @param {SMTPSecure} secure - Does SMTP server use secure connection
|
|
@@ -3003,15 +3003,15 @@ export class Projects {
|
|
|
3003
3003
|
* @returns {Promise<Models.Project>}
|
|
3004
3004
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
3005
3005
|
*/
|
|
3006
|
-
updateSMTP(projectId: string, enabled: boolean, senderName?: string, senderEmail?: string, replyTo?: string, host?: string, port?: number
|
|
3006
|
+
updateSMTP(projectId: string, enabled: boolean, senderName?: string, senderEmail?: string, replyTo?: string, host?: string, port?: number, username?: string, password?: string, secure?: SMTPSecure): Promise<Models.Project>;
|
|
3007
3007
|
updateSMTP(
|
|
3008
|
-
paramsOrFirst: { projectId: string, enabled: boolean, senderName?: string, senderEmail?: string, replyTo?: string, host?: string, port?: number
|
|
3009
|
-
...rest: [(boolean)?, (string)?, (string)?, (string)?, (string)?, (number
|
|
3008
|
+
paramsOrFirst: { projectId: string, enabled: boolean, senderName?: string, senderEmail?: string, replyTo?: string, host?: string, port?: number, username?: string, password?: string, secure?: SMTPSecure } | string,
|
|
3009
|
+
...rest: [(boolean)?, (string)?, (string)?, (string)?, (string)?, (number)?, (string)?, (string)?, (SMTPSecure)?]
|
|
3010
3010
|
): Promise<Models.Project> {
|
|
3011
|
-
let params: { projectId: string, enabled: boolean, senderName?: string, senderEmail?: string, replyTo?: string, host?: string, port?: number
|
|
3011
|
+
let params: { projectId: string, enabled: boolean, senderName?: string, senderEmail?: string, replyTo?: string, host?: string, port?: number, username?: string, password?: string, secure?: SMTPSecure };
|
|
3012
3012
|
|
|
3013
3013
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3014
|
-
params = (paramsOrFirst || {}) as { projectId: string, enabled: boolean, senderName?: string, senderEmail?: string, replyTo?: string, host?: string, port?: number
|
|
3014
|
+
params = (paramsOrFirst || {}) as { projectId: string, enabled: boolean, senderName?: string, senderEmail?: string, replyTo?: string, host?: string, port?: number, username?: string, password?: string, secure?: SMTPSecure };
|
|
3015
3015
|
} else {
|
|
3016
3016
|
params = {
|
|
3017
3017
|
projectId: paramsOrFirst as string,
|
|
@@ -3020,7 +3020,7 @@ export class Projects {
|
|
|
3020
3020
|
senderEmail: rest[2] as string,
|
|
3021
3021
|
replyTo: rest[3] as string,
|
|
3022
3022
|
host: rest[4] as string,
|
|
3023
|
-
port: rest[5] as number
|
|
3023
|
+
port: rest[5] as number,
|
|
3024
3024
|
username: rest[6] as string,
|
|
3025
3025
|
password: rest[7] as string,
|
|
3026
3026
|
secure: rest[8] as SMTPSecure
|
|
@@ -3097,7 +3097,7 @@ export class Projects {
|
|
|
3097
3097
|
* @param {string} params.senderEmail - Email of the sender
|
|
3098
3098
|
* @param {string} params.host - SMTP server host name
|
|
3099
3099
|
* @param {string} params.replyTo - Reply to email
|
|
3100
|
-
* @param {number
|
|
3100
|
+
* @param {number} params.port - SMTP server port
|
|
3101
3101
|
* @param {string} params.username - SMTP server username
|
|
3102
3102
|
* @param {string} params.password - SMTP server password
|
|
3103
3103
|
* @param {SMTPSecure} params.secure - Does SMTP server use secure connection
|
|
@@ -3105,7 +3105,7 @@ export class Projects {
|
|
|
3105
3105
|
* @returns {Promise<{}>}
|
|
3106
3106
|
* @deprecated This API has been deprecated since 1.8.0. Please use `Projects.createSMTPTest` instead.
|
|
3107
3107
|
*/
|
|
3108
|
-
createSmtpTest(params: { projectId: string, emails: string[], senderName: string, senderEmail: string, host: string, replyTo?: string, port?: number
|
|
3108
|
+
createSmtpTest(params: { projectId: string, emails: string[], senderName: string, senderEmail: string, host: string, replyTo?: string, port?: number, username?: string, password?: string, secure?: SMTPSecure }): Promise<{}>;
|
|
3109
3109
|
/**
|
|
3110
3110
|
* Send a test email to verify SMTP configuration.
|
|
3111
3111
|
*
|
|
@@ -3115,7 +3115,7 @@ export class Projects {
|
|
|
3115
3115
|
* @param {string} senderEmail - Email of the sender
|
|
3116
3116
|
* @param {string} host - SMTP server host name
|
|
3117
3117
|
* @param {string} replyTo - Reply to email
|
|
3118
|
-
* @param {number
|
|
3118
|
+
* @param {number} port - SMTP server port
|
|
3119
3119
|
* @param {string} username - SMTP server username
|
|
3120
3120
|
* @param {string} password - SMTP server password
|
|
3121
3121
|
* @param {SMTPSecure} secure - Does SMTP server use secure connection
|
|
@@ -3123,15 +3123,15 @@ export class Projects {
|
|
|
3123
3123
|
* @returns {Promise<{}>}
|
|
3124
3124
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
3125
3125
|
*/
|
|
3126
|
-
createSmtpTest(projectId: string, emails: string[], senderName: string, senderEmail: string, host: string, replyTo?: string, port?: number
|
|
3126
|
+
createSmtpTest(projectId: string, emails: string[], senderName: string, senderEmail: string, host: string, replyTo?: string, port?: number, username?: string, password?: string, secure?: SMTPSecure): Promise<{}>;
|
|
3127
3127
|
createSmtpTest(
|
|
3128
|
-
paramsOrFirst: { projectId: string, emails: string[], senderName: string, senderEmail: string, host: string, replyTo?: string, port?: number
|
|
3129
|
-
...rest: [(string[])?, (string)?, (string)?, (string)?, (string)?, (number
|
|
3128
|
+
paramsOrFirst: { projectId: string, emails: string[], senderName: string, senderEmail: string, host: string, replyTo?: string, port?: number, username?: string, password?: string, secure?: SMTPSecure } | string,
|
|
3129
|
+
...rest: [(string[])?, (string)?, (string)?, (string)?, (string)?, (number)?, (string)?, (string)?, (SMTPSecure)?]
|
|
3130
3130
|
): Promise<{}> {
|
|
3131
|
-
let params: { projectId: string, emails: string[], senderName: string, senderEmail: string, host: string, replyTo?: string, port?: number
|
|
3131
|
+
let params: { projectId: string, emails: string[], senderName: string, senderEmail: string, host: string, replyTo?: string, port?: number, username?: string, password?: string, secure?: SMTPSecure };
|
|
3132
3132
|
|
|
3133
3133
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3134
|
-
params = (paramsOrFirst || {}) as { projectId: string, emails: string[], senderName: string, senderEmail: string, host: string, replyTo?: string, port?: number
|
|
3134
|
+
params = (paramsOrFirst || {}) as { projectId: string, emails: string[], senderName: string, senderEmail: string, host: string, replyTo?: string, port?: number, username?: string, password?: string, secure?: SMTPSecure };
|
|
3135
3135
|
} else {
|
|
3136
3136
|
params = {
|
|
3137
3137
|
projectId: paramsOrFirst as string,
|
|
@@ -3140,7 +3140,7 @@ export class Projects {
|
|
|
3140
3140
|
senderEmail: rest[2] as string,
|
|
3141
3141
|
host: rest[3] as string,
|
|
3142
3142
|
replyTo: rest[4] as string,
|
|
3143
|
-
port: rest[5] as number
|
|
3143
|
+
port: rest[5] as number,
|
|
3144
3144
|
username: rest[6] as string,
|
|
3145
3145
|
password: rest[7] as string,
|
|
3146
3146
|
secure: rest[8] as SMTPSecure
|
|
@@ -3226,14 +3226,14 @@ export class Projects {
|
|
|
3226
3226
|
* @param {string} params.senderEmail - Email of the sender
|
|
3227
3227
|
* @param {string} params.host - SMTP server host name
|
|
3228
3228
|
* @param {string} params.replyTo - Reply to email
|
|
3229
|
-
* @param {number
|
|
3229
|
+
* @param {number} params.port - SMTP server port
|
|
3230
3230
|
* @param {string} params.username - SMTP server username
|
|
3231
3231
|
* @param {string} params.password - SMTP server password
|
|
3232
3232
|
* @param {SMTPSecure} params.secure - Does SMTP server use secure connection
|
|
3233
3233
|
* @throws {AppwriteException}
|
|
3234
3234
|
* @returns {Promise<{}>}
|
|
3235
3235
|
*/
|
|
3236
|
-
createSMTPTest(params: { projectId: string, emails: string[], senderName: string, senderEmail: string, host: string, replyTo?: string, port?: number
|
|
3236
|
+
createSMTPTest(params: { projectId: string, emails: string[], senderName: string, senderEmail: string, host: string, replyTo?: string, port?: number, username?: string, password?: string, secure?: SMTPSecure }): Promise<{}>;
|
|
3237
3237
|
/**
|
|
3238
3238
|
* Send a test email to verify SMTP configuration.
|
|
3239
3239
|
*
|
|
@@ -3243,7 +3243,7 @@ export class Projects {
|
|
|
3243
3243
|
* @param {string} senderEmail - Email of the sender
|
|
3244
3244
|
* @param {string} host - SMTP server host name
|
|
3245
3245
|
* @param {string} replyTo - Reply to email
|
|
3246
|
-
* @param {number
|
|
3246
|
+
* @param {number} port - SMTP server port
|
|
3247
3247
|
* @param {string} username - SMTP server username
|
|
3248
3248
|
* @param {string} password - SMTP server password
|
|
3249
3249
|
* @param {SMTPSecure} secure - Does SMTP server use secure connection
|
|
@@ -3251,15 +3251,15 @@ export class Projects {
|
|
|
3251
3251
|
* @returns {Promise<{}>}
|
|
3252
3252
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
3253
3253
|
*/
|
|
3254
|
-
createSMTPTest(projectId: string, emails: string[], senderName: string, senderEmail: string, host: string, replyTo?: string, port?: number
|
|
3254
|
+
createSMTPTest(projectId: string, emails: string[], senderName: string, senderEmail: string, host: string, replyTo?: string, port?: number, username?: string, password?: string, secure?: SMTPSecure): Promise<{}>;
|
|
3255
3255
|
createSMTPTest(
|
|
3256
|
-
paramsOrFirst: { projectId: string, emails: string[], senderName: string, senderEmail: string, host: string, replyTo?: string, port?: number
|
|
3257
|
-
...rest: [(string[])?, (string)?, (string)?, (string)?, (string)?, (number
|
|
3256
|
+
paramsOrFirst: { projectId: string, emails: string[], senderName: string, senderEmail: string, host: string, replyTo?: string, port?: number, username?: string, password?: string, secure?: SMTPSecure } | string,
|
|
3257
|
+
...rest: [(string[])?, (string)?, (string)?, (string)?, (string)?, (number)?, (string)?, (string)?, (SMTPSecure)?]
|
|
3258
3258
|
): Promise<{}> {
|
|
3259
|
-
let params: { projectId: string, emails: string[], senderName: string, senderEmail: string, host: string, replyTo?: string, port?: number
|
|
3259
|
+
let params: { projectId: string, emails: string[], senderName: string, senderEmail: string, host: string, replyTo?: string, port?: number, username?: string, password?: string, secure?: SMTPSecure };
|
|
3260
3260
|
|
|
3261
3261
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3262
|
-
params = (paramsOrFirst || {}) as { projectId: string, emails: string[], senderName: string, senderEmail: string, host: string, replyTo?: string, port?: number
|
|
3262
|
+
params = (paramsOrFirst || {}) as { projectId: string, emails: string[], senderName: string, senderEmail: string, host: string, replyTo?: string, port?: number, username?: string, password?: string, secure?: SMTPSecure };
|
|
3263
3263
|
} else {
|
|
3264
3264
|
params = {
|
|
3265
3265
|
projectId: paramsOrFirst as string,
|
|
@@ -3268,7 +3268,7 @@ export class Projects {
|
|
|
3268
3268
|
senderEmail: rest[2] as string,
|
|
3269
3269
|
host: rest[3] as string,
|
|
3270
3270
|
replyTo: rest[4] as string,
|
|
3271
|
-
port: rest[5] as number
|
|
3271
|
+
port: rest[5] as number,
|
|
3272
3272
|
username: rest[6] as string,
|
|
3273
3273
|
password: rest[7] as string,
|
|
3274
3274
|
secure: rest[8] as SMTPSecure
|
package/src/services/realtime.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AppwriteException, Client } from '../client';
|
|
2
|
+
import { Channel, ActionableChannel, ResolvedChannel } from '../channel';
|
|
2
3
|
|
|
3
4
|
export type RealtimeSubscription = {
|
|
4
5
|
close: () => Promise<void>;
|
|
@@ -237,61 +238,83 @@ export class Realtime {
|
|
|
237
238
|
return new Promise(resolve => setTimeout(resolve, ms));
|
|
238
239
|
}
|
|
239
240
|
|
|
241
|
+
/**
|
|
242
|
+
* Convert a channel value to a string
|
|
243
|
+
*
|
|
244
|
+
* @private
|
|
245
|
+
* @param {string | Channel<any> | ActionableChannel | ResolvedChannel} channel - Channel value (string or Channel builder instance)
|
|
246
|
+
* @returns {string} Channel string representation
|
|
247
|
+
*/
|
|
248
|
+
private channelToString(channel: string | Channel<any> | ActionableChannel | ResolvedChannel): string {
|
|
249
|
+
if (typeof channel === 'string') {
|
|
250
|
+
return channel;
|
|
251
|
+
}
|
|
252
|
+
// All Channel instances have toString() method
|
|
253
|
+
if (channel && typeof (channel as Channel<any>).toString === 'function') {
|
|
254
|
+
return (channel as Channel<any>).toString();
|
|
255
|
+
}
|
|
256
|
+
return String(channel);
|
|
257
|
+
}
|
|
258
|
+
|
|
240
259
|
/**
|
|
241
260
|
* Subscribe to a single channel
|
|
242
261
|
*
|
|
243
|
-
* @param {string} channel - Channel name to subscribe to
|
|
262
|
+
* @param {string | Channel<any> | ActionableChannel | ResolvedChannel} channel - Channel name to subscribe to (string or Channel builder instance)
|
|
244
263
|
* @param {Function} callback - Callback function to handle events
|
|
245
264
|
* @returns {Promise<RealtimeSubscription>} Subscription object with close method
|
|
246
265
|
*/
|
|
247
266
|
public async subscribe(
|
|
248
|
-
channel: string,
|
|
267
|
+
channel: string | Channel<any> | ActionableChannel | ResolvedChannel,
|
|
249
268
|
callback: (event: RealtimeResponseEvent<any>) => void
|
|
250
269
|
): Promise<RealtimeSubscription>;
|
|
251
270
|
|
|
252
271
|
/**
|
|
253
272
|
* Subscribe to multiple channels
|
|
254
273
|
*
|
|
255
|
-
* @param {string[]} channels - Array of channel names to subscribe to
|
|
274
|
+
* @param {(string | Channel<any> | ActionableChannel | ResolvedChannel)[]} channels - Array of channel names to subscribe to (strings or Channel builder instances)
|
|
256
275
|
* @param {Function} callback - Callback function to handle events
|
|
257
276
|
* @returns {Promise<RealtimeSubscription>} Subscription object with close method
|
|
258
277
|
*/
|
|
259
278
|
public async subscribe(
|
|
260
|
-
channels: string[],
|
|
279
|
+
channels: (string | Channel<any> | ActionableChannel | ResolvedChannel)[],
|
|
261
280
|
callback: (event: RealtimeResponseEvent<any>) => void
|
|
262
281
|
): Promise<RealtimeSubscription>;
|
|
263
282
|
|
|
264
283
|
/**
|
|
265
284
|
* Subscribe to a single channel with typed payload
|
|
266
285
|
*
|
|
267
|
-
* @param {string} channel - Channel name to subscribe to
|
|
286
|
+
* @param {string | Channel<any> | ActionableChannel | ResolvedChannel} channel - Channel name to subscribe to (string or Channel builder instance)
|
|
268
287
|
* @param {Function} callback - Callback function to handle events with typed payload
|
|
269
288
|
* @returns {Promise<RealtimeSubscription>} Subscription object with close method
|
|
270
289
|
*/
|
|
271
290
|
public async subscribe<T>(
|
|
272
|
-
channel: string,
|
|
291
|
+
channel: string | Channel<any> | ActionableChannel | ResolvedChannel,
|
|
273
292
|
callback: (event: RealtimeResponseEvent<T>) => void
|
|
274
293
|
): Promise<RealtimeSubscription>;
|
|
275
294
|
|
|
276
295
|
/**
|
|
277
296
|
* Subscribe to multiple channels with typed payload
|
|
278
297
|
*
|
|
279
|
-
* @param {string[]} channels - Array of channel names to subscribe to
|
|
298
|
+
* @param {(string | Channel<any> | ActionableChannel | ResolvedChannel)[]} channels - Array of channel names to subscribe to (strings or Channel builder instances)
|
|
280
299
|
* @param {Function} callback - Callback function to handle events with typed payload
|
|
281
300
|
* @returns {Promise<RealtimeSubscription>} Subscription object with close method
|
|
282
301
|
*/
|
|
283
302
|
public async subscribe<T>(
|
|
284
|
-
channels: string[],
|
|
303
|
+
channels: (string | Channel<any> | ActionableChannel | ResolvedChannel)[],
|
|
285
304
|
callback: (event: RealtimeResponseEvent<T>) => void
|
|
286
305
|
): Promise<RealtimeSubscription>;
|
|
287
306
|
|
|
288
307
|
public async subscribe<T = any>(
|
|
289
|
-
channelsOrChannel: string | string[],
|
|
308
|
+
channelsOrChannel: string | Channel<any> | ActionableChannel | ResolvedChannel | (string | Channel<any> | ActionableChannel | ResolvedChannel)[],
|
|
290
309
|
callback: (event: RealtimeResponseEvent<T>) => void
|
|
291
310
|
): Promise<RealtimeSubscription> {
|
|
292
|
-
const
|
|
293
|
-
?
|
|
294
|
-
:
|
|
311
|
+
const channelArray = Array.isArray(channelsOrChannel)
|
|
312
|
+
? channelsOrChannel
|
|
313
|
+
: [channelsOrChannel];
|
|
314
|
+
|
|
315
|
+
// Convert all channels to strings
|
|
316
|
+
const channelStrings = channelArray.map(ch => this.channelToString(ch));
|
|
317
|
+
const channels = new Set(channelStrings);
|
|
295
318
|
|
|
296
319
|
this.subscriptionsCounter++;
|
|
297
320
|
const count = this.subscriptionsCounter;
|