node-appwrite 13.0.0 → 14.0.0-rc.2

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 (62) hide show
  1. package/README.md +2 -2
  2. package/dist/client.js +7 -3
  3. package/dist/client.js.map +1 -1
  4. package/dist/client.mjs +7 -3
  5. package/dist/client.mjs.map +1 -1
  6. package/dist/enums/name.d.mts +1 -1
  7. package/dist/enums/name.d.ts +1 -1
  8. package/dist/enums/name.js +1 -1
  9. package/dist/enums/name.js.map +1 -1
  10. package/dist/enums/name.mjs +1 -1
  11. package/dist/enums/name.mjs.map +1 -1
  12. package/dist/enums/runtime.d.mts +2 -1
  13. package/dist/enums/runtime.d.ts +2 -1
  14. package/dist/enums/runtime.js +1 -0
  15. package/dist/enums/runtime.js.map +1 -1
  16. package/dist/enums/runtime.mjs +1 -0
  17. package/dist/enums/runtime.mjs.map +1 -1
  18. package/dist/id.d.mts +15 -0
  19. package/dist/id.d.ts +15 -0
  20. package/dist/id.js +18 -2
  21. package/dist/id.js.map +1 -1
  22. package/dist/id.mjs +18 -2
  23. package/dist/id.mjs.map +1 -1
  24. package/dist/models.d.mts +192 -0
  25. package/dist/models.d.ts +192 -0
  26. package/dist/permission.d.mts +36 -0
  27. package/dist/permission.d.ts +36 -0
  28. package/dist/permission.js +33 -0
  29. package/dist/permission.js.map +1 -1
  30. package/dist/permission.mjs +33 -0
  31. package/dist/permission.mjs.map +1 -1
  32. package/dist/query.d.mts +160 -0
  33. package/dist/query.d.ts +160 -0
  34. package/dist/query.js +157 -0
  35. package/dist/query.js.map +1 -1
  36. package/dist/query.mjs +157 -0
  37. package/dist/query.mjs.map +1 -1
  38. package/dist/services/account.d.mts +5 -6
  39. package/dist/services/account.d.ts +5 -6
  40. package/dist/services/account.js +6 -13
  41. package/dist/services/account.js.map +1 -1
  42. package/dist/services/account.mjs +6 -13
  43. package/dist/services/account.mjs.map +1 -1
  44. package/dist/services/avatars.d.mts +2 -0
  45. package/dist/services/avatars.d.ts +2 -0
  46. package/dist/services/avatars.js +2 -0
  47. package/dist/services/avatars.js.map +1 -1
  48. package/dist/services/avatars.mjs +2 -0
  49. package/dist/services/avatars.mjs.map +1 -1
  50. package/dist/services/functions.d.mts +57 -10
  51. package/dist/services/functions.d.ts +57 -10
  52. package/dist/services/functions.js +155 -18
  53. package/dist/services/functions.js.map +1 -1
  54. package/dist/services/functions.mjs +155 -18
  55. package/dist/services/functions.mjs.map +1 -1
  56. package/dist/services/users.d.mts +12 -0
  57. package/dist/services/users.d.ts +12 -0
  58. package/dist/services/users.js +34 -0
  59. package/dist/services/users.js.map +1 -1
  60. package/dist/services/users.mjs +34 -0
  61. package/dist/services/users.mjs.map +1 -1
  62. package/package.json +1 -1
package/dist/models.d.mts CHANGED
@@ -1,3 +1,6 @@
1
+ /**
2
+ * Appwrite Models
3
+ */
1
4
  declare namespace Models {
2
5
  /**
3
6
  * Documents List
@@ -168,6 +171,19 @@ declare namespace Models {
168
171
  */
169
172
  functions: Function[];
170
173
  };
174
+ /**
175
+ * Function Templates List
176
+ */
177
+ type TemplateFunctionList = {
178
+ /**
179
+ * Total number of templates documents that matched your query.
180
+ */
181
+ total: number;
182
+ /**
183
+ * List of templates.
184
+ */
185
+ templates: TemplateFunction[];
186
+ };
171
187
  /**
172
188
  * Runtimes List
173
189
  */
@@ -1660,6 +1676,10 @@ declare namespace Models {
1660
1676
  * Function's active deployment ID.
1661
1677
  */
1662
1678
  deployment: string;
1679
+ /**
1680
+ * Allowed permission scopes.
1681
+ */
1682
+ scopes: string[];
1663
1683
  /**
1664
1684
  * Function variables.
1665
1685
  */
@@ -1709,6 +1729,129 @@ declare namespace Models {
1709
1729
  */
1710
1730
  providerSilentMode: boolean;
1711
1731
  };
1732
+ /**
1733
+ * Template Function
1734
+ */
1735
+ type TemplateFunction = {
1736
+ /**
1737
+ * Function Template Icon.
1738
+ */
1739
+ icon: string;
1740
+ /**
1741
+ * Function Template ID.
1742
+ */
1743
+ id: string;
1744
+ /**
1745
+ * Function Template Name.
1746
+ */
1747
+ name: string;
1748
+ /**
1749
+ * Function Template Tagline.
1750
+ */
1751
+ tagline: string;
1752
+ /**
1753
+ * Execution permissions.
1754
+ */
1755
+ permissions: string[];
1756
+ /**
1757
+ * Function trigger events.
1758
+ */
1759
+ events: string[];
1760
+ /**
1761
+ * Function execution schedult in CRON format.
1762
+ */
1763
+ cron: string;
1764
+ /**
1765
+ * Function execution timeout in seconds.
1766
+ */
1767
+ timeout: number;
1768
+ /**
1769
+ * Function use cases.
1770
+ */
1771
+ useCases: string[];
1772
+ /**
1773
+ * List of runtimes that can be used with this template.
1774
+ */
1775
+ runtimes: TemplateRuntime[];
1776
+ /**
1777
+ * Function Template Instructions.
1778
+ */
1779
+ instructions: string;
1780
+ /**
1781
+ * VCS (Version Control System) Provider.
1782
+ */
1783
+ vcsProvider: string;
1784
+ /**
1785
+ * VCS (Version Control System) Repository ID
1786
+ */
1787
+ providerRepositoryId: string;
1788
+ /**
1789
+ * VCS (Version Control System) Owner.
1790
+ */
1791
+ providerOwner: string;
1792
+ /**
1793
+ * VCS (Version Control System) branch version (tag).
1794
+ */
1795
+ providerVersion: string;
1796
+ /**
1797
+ * Function variables.
1798
+ */
1799
+ variables: TemplateVariable[];
1800
+ /**
1801
+ * Function scopes.
1802
+ */
1803
+ scopes: string[];
1804
+ };
1805
+ /**
1806
+ * Template Runtime
1807
+ */
1808
+ type TemplateRuntime = {
1809
+ /**
1810
+ * Runtime Name.
1811
+ */
1812
+ name: string;
1813
+ /**
1814
+ * The build command used to build the deployment.
1815
+ */
1816
+ commands: string;
1817
+ /**
1818
+ * The entrypoint file used to execute the deployment.
1819
+ */
1820
+ entrypoint: string;
1821
+ /**
1822
+ * Path to function in VCS (Version Control System) repository
1823
+ */
1824
+ providerRootDirectory: string;
1825
+ };
1826
+ /**
1827
+ * Template Variable
1828
+ */
1829
+ type TemplateVariable = {
1830
+ /**
1831
+ * Variable Name.
1832
+ */
1833
+ name: string;
1834
+ /**
1835
+ * Variable Description.
1836
+ */
1837
+ description: string;
1838
+ /**
1839
+ * Variable Value.
1840
+ */
1841
+ value: string;
1842
+ /**
1843
+ * Variable Placeholder.
1844
+ */
1845
+ placeholder: string;
1846
+ /**
1847
+ * Is the variable required?
1848
+ */
1849
+ required: boolean;
1850
+ /**
1851
+ * Variable Type.
1852
+ */
1853
+ type: string;
1854
+ };
1712
1855
  /**
1713
1856
  * Runtime
1714
1857
  */
@@ -1717,6 +1860,10 @@ declare namespace Models {
1717
1860
  * Runtime ID.
1718
1861
  */
1719
1862
  $id: string;
1863
+ /**
1864
+ * Parent runtime key.
1865
+ */
1866
+ key: string;
1720
1867
  /**
1721
1868
  * Runtime Name.
1722
1869
  */
@@ -1907,6 +2054,51 @@ declare namespace Models {
1907
2054
  * Function execution duration in seconds.
1908
2055
  */
1909
2056
  duration: number;
2057
+ /**
2058
+ * The scheduled time for execution. If left empty, execution will be queued immediately.
2059
+ */
2060
+ scheduledAt?: string;
2061
+ };
2062
+ /**
2063
+ * Build
2064
+ */
2065
+ type Build = {
2066
+ /**
2067
+ * Build ID.
2068
+ */
2069
+ $id: string;
2070
+ /**
2071
+ * The deployment that created this build.
2072
+ */
2073
+ deploymentId: string;
2074
+ /**
2075
+ * The build status. There are a few different types and each one means something different. \nFailed - The deployment build has failed. More details can usually be found in buildStderr\nReady - The deployment build was successful and the deployment is ready to be deployed\nProcessing - The deployment is currently waiting to have a build triggered\nBuilding - The deployment is currently being built
2076
+ */
2077
+ status: string;
2078
+ /**
2079
+ * The stdout of the build.
2080
+ */
2081
+ stdout: string;
2082
+ /**
2083
+ * The stderr of the build.
2084
+ */
2085
+ stderr: string;
2086
+ /**
2087
+ * The deployment creation date in ISO 8601 format.
2088
+ */
2089
+ startTime: string;
2090
+ /**
2091
+ * The time the build was finished in ISO 8601 format.
2092
+ */
2093
+ endTime: string;
2094
+ /**
2095
+ * The build duration in seconds.
2096
+ */
2097
+ duration: number;
2098
+ /**
2099
+ * The code size in bytes.
2100
+ */
2101
+ size: number;
1910
2102
  };
1911
2103
  /**
1912
2104
  * Variable
package/dist/models.d.ts CHANGED
@@ -1,3 +1,6 @@
1
+ /**
2
+ * Appwrite Models
3
+ */
1
4
  declare namespace Models {
2
5
  /**
3
6
  * Documents List
@@ -168,6 +171,19 @@ declare namespace Models {
168
171
  */
169
172
  functions: Function[];
170
173
  };
174
+ /**
175
+ * Function Templates List
176
+ */
177
+ type TemplateFunctionList = {
178
+ /**
179
+ * Total number of templates documents that matched your query.
180
+ */
181
+ total: number;
182
+ /**
183
+ * List of templates.
184
+ */
185
+ templates: TemplateFunction[];
186
+ };
171
187
  /**
172
188
  * Runtimes List
173
189
  */
@@ -1660,6 +1676,10 @@ declare namespace Models {
1660
1676
  * Function's active deployment ID.
1661
1677
  */
1662
1678
  deployment: string;
1679
+ /**
1680
+ * Allowed permission scopes.
1681
+ */
1682
+ scopes: string[];
1663
1683
  /**
1664
1684
  * Function variables.
1665
1685
  */
@@ -1709,6 +1729,129 @@ declare namespace Models {
1709
1729
  */
1710
1730
  providerSilentMode: boolean;
1711
1731
  };
1732
+ /**
1733
+ * Template Function
1734
+ */
1735
+ type TemplateFunction = {
1736
+ /**
1737
+ * Function Template Icon.
1738
+ */
1739
+ icon: string;
1740
+ /**
1741
+ * Function Template ID.
1742
+ */
1743
+ id: string;
1744
+ /**
1745
+ * Function Template Name.
1746
+ */
1747
+ name: string;
1748
+ /**
1749
+ * Function Template Tagline.
1750
+ */
1751
+ tagline: string;
1752
+ /**
1753
+ * Execution permissions.
1754
+ */
1755
+ permissions: string[];
1756
+ /**
1757
+ * Function trigger events.
1758
+ */
1759
+ events: string[];
1760
+ /**
1761
+ * Function execution schedult in CRON format.
1762
+ */
1763
+ cron: string;
1764
+ /**
1765
+ * Function execution timeout in seconds.
1766
+ */
1767
+ timeout: number;
1768
+ /**
1769
+ * Function use cases.
1770
+ */
1771
+ useCases: string[];
1772
+ /**
1773
+ * List of runtimes that can be used with this template.
1774
+ */
1775
+ runtimes: TemplateRuntime[];
1776
+ /**
1777
+ * Function Template Instructions.
1778
+ */
1779
+ instructions: string;
1780
+ /**
1781
+ * VCS (Version Control System) Provider.
1782
+ */
1783
+ vcsProvider: string;
1784
+ /**
1785
+ * VCS (Version Control System) Repository ID
1786
+ */
1787
+ providerRepositoryId: string;
1788
+ /**
1789
+ * VCS (Version Control System) Owner.
1790
+ */
1791
+ providerOwner: string;
1792
+ /**
1793
+ * VCS (Version Control System) branch version (tag).
1794
+ */
1795
+ providerVersion: string;
1796
+ /**
1797
+ * Function variables.
1798
+ */
1799
+ variables: TemplateVariable[];
1800
+ /**
1801
+ * Function scopes.
1802
+ */
1803
+ scopes: string[];
1804
+ };
1805
+ /**
1806
+ * Template Runtime
1807
+ */
1808
+ type TemplateRuntime = {
1809
+ /**
1810
+ * Runtime Name.
1811
+ */
1812
+ name: string;
1813
+ /**
1814
+ * The build command used to build the deployment.
1815
+ */
1816
+ commands: string;
1817
+ /**
1818
+ * The entrypoint file used to execute the deployment.
1819
+ */
1820
+ entrypoint: string;
1821
+ /**
1822
+ * Path to function in VCS (Version Control System) repository
1823
+ */
1824
+ providerRootDirectory: string;
1825
+ };
1826
+ /**
1827
+ * Template Variable
1828
+ */
1829
+ type TemplateVariable = {
1830
+ /**
1831
+ * Variable Name.
1832
+ */
1833
+ name: string;
1834
+ /**
1835
+ * Variable Description.
1836
+ */
1837
+ description: string;
1838
+ /**
1839
+ * Variable Value.
1840
+ */
1841
+ value: string;
1842
+ /**
1843
+ * Variable Placeholder.
1844
+ */
1845
+ placeholder: string;
1846
+ /**
1847
+ * Is the variable required?
1848
+ */
1849
+ required: boolean;
1850
+ /**
1851
+ * Variable Type.
1852
+ */
1853
+ type: string;
1854
+ };
1712
1855
  /**
1713
1856
  * Runtime
1714
1857
  */
@@ -1717,6 +1860,10 @@ declare namespace Models {
1717
1860
  * Runtime ID.
1718
1861
  */
1719
1862
  $id: string;
1863
+ /**
1864
+ * Parent runtime key.
1865
+ */
1866
+ key: string;
1720
1867
  /**
1721
1868
  * Runtime Name.
1722
1869
  */
@@ -1907,6 +2054,51 @@ declare namespace Models {
1907
2054
  * Function execution duration in seconds.
1908
2055
  */
1909
2056
  duration: number;
2057
+ /**
2058
+ * The scheduled time for execution. If left empty, execution will be queued immediately.
2059
+ */
2060
+ scheduledAt?: string;
2061
+ };
2062
+ /**
2063
+ * Build
2064
+ */
2065
+ type Build = {
2066
+ /**
2067
+ * Build ID.
2068
+ */
2069
+ $id: string;
2070
+ /**
2071
+ * The deployment that created this build.
2072
+ */
2073
+ deploymentId: string;
2074
+ /**
2075
+ * The build status. There are a few different types and each one means something different. \nFailed - The deployment build has failed. More details can usually be found in buildStderr\nReady - The deployment build was successful and the deployment is ready to be deployed\nProcessing - The deployment is currently waiting to have a build triggered\nBuilding - The deployment is currently being built
2076
+ */
2077
+ status: string;
2078
+ /**
2079
+ * The stdout of the build.
2080
+ */
2081
+ stdout: string;
2082
+ /**
2083
+ * The stderr of the build.
2084
+ */
2085
+ stderr: string;
2086
+ /**
2087
+ * The deployment creation date in ISO 8601 format.
2088
+ */
2089
+ startTime: string;
2090
+ /**
2091
+ * The time the build was finished in ISO 8601 format.
2092
+ */
2093
+ endTime: string;
2094
+ /**
2095
+ * The build duration in seconds.
2096
+ */
2097
+ duration: number;
2098
+ /**
2099
+ * The code size in bytes.
2100
+ */
2101
+ size: number;
1910
2102
  };
1911
2103
  /**
1912
2104
  * Variable
@@ -1,8 +1,44 @@
1
+ /**
2
+ * Helper class to generate permission strings for resources.
3
+ */
1
4
  declare class Permission {
5
+ /**
6
+ * Generate read permission string for the provided role.
7
+ *
8
+ * @param {string} role
9
+ * @returns {string}
10
+ */
2
11
  static read: (role: string) => string;
12
+ /**
13
+ * Generate write permission string for the provided role.
14
+ *
15
+ * This is an alias of update, delete, and possibly create.
16
+ * Don't use write in combination with update, delete, or create.
17
+ *
18
+ * @param {string} role
19
+ * @returns {string}
20
+ */
3
21
  static write: (role: string) => string;
22
+ /**
23
+ * Generate create permission string for the provided role.
24
+ *
25
+ * @param {string} role
26
+ * @returns {string}
27
+ */
4
28
  static create: (role: string) => string;
29
+ /**
30
+ * Generate update permission string for the provided role.
31
+ *
32
+ * @param {string} role
33
+ * @returns {string}
34
+ */
5
35
  static update: (role: string) => string;
36
+ /**
37
+ * Generate delete permission string for the provided role.
38
+ *
39
+ * @param {string} role
40
+ * @returns {string}
41
+ */
6
42
  static delete: (role: string) => string;
7
43
  }
8
44
 
@@ -1,8 +1,44 @@
1
+ /**
2
+ * Helper class to generate permission strings for resources.
3
+ */
1
4
  declare class Permission {
5
+ /**
6
+ * Generate read permission string for the provided role.
7
+ *
8
+ * @param {string} role
9
+ * @returns {string}
10
+ */
2
11
  static read: (role: string) => string;
12
+ /**
13
+ * Generate write permission string for the provided role.
14
+ *
15
+ * This is an alias of update, delete, and possibly create.
16
+ * Don't use write in combination with update, delete, or create.
17
+ *
18
+ * @param {string} role
19
+ * @returns {string}
20
+ */
3
21
  static write: (role: string) => string;
22
+ /**
23
+ * Generate create permission string for the provided role.
24
+ *
25
+ * @param {string} role
26
+ * @returns {string}
27
+ */
4
28
  static create: (role: string) => string;
29
+ /**
30
+ * Generate update permission string for the provided role.
31
+ *
32
+ * @param {string} role
33
+ * @returns {string}
34
+ */
5
35
  static update: (role: string) => string;
36
+ /**
37
+ * Generate delete permission string for the provided role.
38
+ *
39
+ * @param {string} role
40
+ * @returns {string}
41
+ */
6
42
  static delete: (role: string) => string;
7
43
  }
8
44
 
@@ -2,18 +2,51 @@
2
2
 
3
3
  class Permission {
4
4
  }
5
+ /**
6
+ * Generate read permission string for the provided role.
7
+ *
8
+ * @param {string} role
9
+ * @returns {string}
10
+ */
5
11
  Permission.read = (role) => {
6
12
  return `read("${role}")`;
7
13
  };
14
+ /**
15
+ * Generate write permission string for the provided role.
16
+ *
17
+ * This is an alias of update, delete, and possibly create.
18
+ * Don't use write in combination with update, delete, or create.
19
+ *
20
+ * @param {string} role
21
+ * @returns {string}
22
+ */
8
23
  Permission.write = (role) => {
9
24
  return `write("${role}")`;
10
25
  };
26
+ /**
27
+ * Generate create permission string for the provided role.
28
+ *
29
+ * @param {string} role
30
+ * @returns {string}
31
+ */
11
32
  Permission.create = (role) => {
12
33
  return `create("${role}")`;
13
34
  };
35
+ /**
36
+ * Generate update permission string for the provided role.
37
+ *
38
+ * @param {string} role
39
+ * @returns {string}
40
+ */
14
41
  Permission.update = (role) => {
15
42
  return `update("${role}")`;
16
43
  };
44
+ /**
45
+ * Generate delete permission string for the provided role.
46
+ *
47
+ * @param {string} role
48
+ * @returns {string}
49
+ */
17
50
  Permission.delete = (role) => {
18
51
  return `delete("${role}")`;
19
52
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/permission.ts"],"names":[],"mappings":"AAAO,MAAM,WAAW;AAqBxB;AArBa,WAEF,OAAO,CAAC,SAAyB;AACpC,SAAO,SAAS,IAAI;AACxB;AAJS,WAMF,QAAQ,CAAC,SAAyB;AACrC,SAAO,UAAU,IAAI;AACzB;AARS,WAUF,SAAS,CAAC,SAAyB;AACtC,SAAO,WAAW,IAAI;AAC1B;AAZS,WAcF,SAAS,CAAC,SAAyB;AACtC,SAAO,WAAW,IAAI;AAC1B;AAhBS,WAkBF,SAAS,CAAC,SAAyB;AACtC,SAAO,WAAW,IAAI;AAC1B","sourcesContent":["export class Permission {\n\n static read = (role: string): string => {\n return `read(\"${role}\")`\n }\n\n static write = (role: string): string => {\n return `write(\"${role}\")`\n }\n\n static create = (role: string): string => {\n return `create(\"${role}\")`\n }\n\n static update = (role: string): string => {\n return `update(\"${role}\")`\n }\n\n static delete = (role: string): string => {\n return `delete(\"${role}\")`\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/permission.ts"],"names":[],"mappings":"AAGO,MAAM,WAAW;AAqDxB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AArDa,WAOF,OAAO,CAAC,SAAyB;AACpC,SAAO,SAAS,IAAI;AACxB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AATS,WAoBF,QAAQ,CAAC,SAAyB;AACrC,SAAO,UAAU,IAAI;AACzB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAtBS,WA8BF,SAAS,CAAC,SAAyB;AACtC,SAAO,WAAW,IAAI;AAC1B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAhCS,WAwCF,SAAS,CAAC,SAAyB;AACtC,SAAO,WAAW,IAAI;AAC1B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA1CS,WAkDF,SAAS,CAAC,SAAyB;AACtC,SAAO,WAAW,IAAI;AAC1B","sourcesContent":["/**\n * Helper class to generate permission strings for resources.\n */\nexport class Permission {\n /**\n * Generate read permission string for the provided role.\n *\n * @param {string} role\n * @returns {string}\n */\n static read = (role: string): string => {\n return `read(\"${role}\")`;\n }\n\n /**\n * Generate write permission string for the provided role.\n *\n * This is an alias of update, delete, and possibly create.\n * Don't use write in combination with update, delete, or create.\n *\n * @param {string} role\n * @returns {string}\n */\n static write = (role: string): string => {\n return `write(\"${role}\")`;\n }\n\n /**\n * Generate create permission string for the provided role.\n *\n * @param {string} role\n * @returns {string}\n */\n static create = (role: string): string => {\n return `create(\"${role}\")`;\n }\n\n /**\n * Generate update permission string for the provided role.\n *\n * @param {string} role\n * @returns {string}\n */\n static update = (role: string): string => {\n return `update(\"${role}\")`;\n }\n\n /**\n * Generate delete permission string for the provided role.\n *\n * @param {string} role\n * @returns {string}\n */\n static delete = (role: string): string => {\n return `delete(\"${role}\")`;\n }\n}\n"]}
@@ -1,18 +1,51 @@
1
1
  // src/permission.ts
2
2
  var Permission = class {
3
3
  };
4
+ /**
5
+ * Generate read permission string for the provided role.
6
+ *
7
+ * @param {string} role
8
+ * @returns {string}
9
+ */
4
10
  Permission.read = (role) => {
5
11
  return `read("${role}")`;
6
12
  };
13
+ /**
14
+ * Generate write permission string for the provided role.
15
+ *
16
+ * This is an alias of update, delete, and possibly create.
17
+ * Don't use write in combination with update, delete, or create.
18
+ *
19
+ * @param {string} role
20
+ * @returns {string}
21
+ */
7
22
  Permission.write = (role) => {
8
23
  return `write("${role}")`;
9
24
  };
25
+ /**
26
+ * Generate create permission string for the provided role.
27
+ *
28
+ * @param {string} role
29
+ * @returns {string}
30
+ */
10
31
  Permission.create = (role) => {
11
32
  return `create("${role}")`;
12
33
  };
34
+ /**
35
+ * Generate update permission string for the provided role.
36
+ *
37
+ * @param {string} role
38
+ * @returns {string}
39
+ */
13
40
  Permission.update = (role) => {
14
41
  return `update("${role}")`;
15
42
  };
43
+ /**
44
+ * Generate delete permission string for the provided role.
45
+ *
46
+ * @param {string} role
47
+ * @returns {string}
48
+ */
16
49
  Permission.delete = (role) => {
17
50
  return `delete("${role}")`;
18
51
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/permission.ts"],"names":[],"mappings":";AAAO,IAAM,aAAN,MAAiB;AAqBxB;AArBa,WAEF,OAAO,CAAC,SAAyB;AACpC,SAAO,SAAS,IAAI;AACxB;AAJS,WAMF,QAAQ,CAAC,SAAyB;AACrC,SAAO,UAAU,IAAI;AACzB;AARS,WAUF,SAAS,CAAC,SAAyB;AACtC,SAAO,WAAW,IAAI;AAC1B;AAZS,WAcF,SAAS,CAAC,SAAyB;AACtC,SAAO,WAAW,IAAI;AAC1B;AAhBS,WAkBF,SAAS,CAAC,SAAyB;AACtC,SAAO,WAAW,IAAI;AAC1B","sourcesContent":["export class Permission {\n\n static read = (role: string): string => {\n return `read(\"${role}\")`\n }\n\n static write = (role: string): string => {\n return `write(\"${role}\")`\n }\n\n static create = (role: string): string => {\n return `create(\"${role}\")`\n }\n\n static update = (role: string): string => {\n return `update(\"${role}\")`\n }\n\n static delete = (role: string): string => {\n return `delete(\"${role}\")`\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/permission.ts"],"names":[],"mappings":";AAGO,IAAM,aAAN,MAAiB;AAqDxB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AArDa,WAOF,OAAO,CAAC,SAAyB;AACpC,SAAO,SAAS,IAAI;AACxB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AATS,WAoBF,QAAQ,CAAC,SAAyB;AACrC,SAAO,UAAU,IAAI;AACzB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAtBS,WA8BF,SAAS,CAAC,SAAyB;AACtC,SAAO,WAAW,IAAI;AAC1B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAhCS,WAwCF,SAAS,CAAC,SAAyB;AACtC,SAAO,WAAW,IAAI;AAC1B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA1CS,WAkDF,SAAS,CAAC,SAAyB;AACtC,SAAO,WAAW,IAAI;AAC1B","sourcesContent":["/**\n * Helper class to generate permission strings for resources.\n */\nexport class Permission {\n /**\n * Generate read permission string for the provided role.\n *\n * @param {string} role\n * @returns {string}\n */\n static read = (role: string): string => {\n return `read(\"${role}\")`;\n }\n\n /**\n * Generate write permission string for the provided role.\n *\n * This is an alias of update, delete, and possibly create.\n * Don't use write in combination with update, delete, or create.\n *\n * @param {string} role\n * @returns {string}\n */\n static write = (role: string): string => {\n return `write(\"${role}\")`;\n }\n\n /**\n * Generate create permission string for the provided role.\n *\n * @param {string} role\n * @returns {string}\n */\n static create = (role: string): string => {\n return `create(\"${role}\")`;\n }\n\n /**\n * Generate update permission string for the provided role.\n *\n * @param {string} role\n * @returns {string}\n */\n static update = (role: string): string => {\n return `update(\"${role}\")`;\n }\n\n /**\n * Generate delete permission string for the provided role.\n *\n * @param {string} role\n * @returns {string}\n */\n static delete = (role: string): string => {\n return `delete(\"${role}\")`;\n }\n}\n"]}