@pelican.ts/sdk 0.4.16-next.3 → 0.5.1

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/dist/index.js CHANGED
@@ -727,6 +727,7 @@ var timezonesSchema = import_zod7.default.enum([
727
727
  var CreateSchema = import_zod8.default.object({
728
728
  email: import_zod8.default.email(),
729
729
  external_id: import_zod8.default.string().max(255).optional(),
730
+ is_managed_externally: import_zod8.default.boolean().optional().default(false),
730
731
  username: import_zod8.default.string().min(1).max(255),
731
732
  password: import_zod8.default.string().optional(),
732
733
  language: languagesSchema,
@@ -794,9 +795,10 @@ var Account = class {
794
795
  newEmail = import_zod10.default.email().parse(newEmail);
795
796
  await this.r.put("/account/email", { email: newEmail, password });
796
797
  };
797
- updatePassword = async (newPassword) => {
798
+ updatePassword = async (currentPassword, newPassword) => {
798
799
  newPassword = import_zod10.default.string().min(8).parse(newPassword);
799
800
  await this.r.put("/account/password", {
801
+ current_password: currentPassword,
800
802
  password: newPassword,
801
803
  password_confirmation: newPassword
802
804
  });
@@ -1735,6 +1737,9 @@ var Account2 = class {
1735
1737
  language;
1736
1738
  image;
1737
1739
  admin;
1740
+ /**
1741
+ * Has currently no significance
1742
+ */
1738
1743
  root_admin;
1739
1744
  $has2faEnabled;
1740
1745
  get has2faEnabled() {
@@ -1759,7 +1764,7 @@ var Account2 = class {
1759
1764
  await this.client.account.updateEmail(newEmail, password);
1760
1765
  this.$email = newEmail;
1761
1766
  };
1762
- updatePassword = async (newPassword) => this.client.account.updatePassword(newPassword);
1767
+ updatePassword = async (currentPassword, newPassword) => this.client.account.updatePassword(currentPassword, newPassword);
1763
1768
  listApiKeys = async () => this.client.account.apiKeys.list();
1764
1769
  createApiKey = async (description, allowed_ips) => this.client.account.apiKeys.create(description, allowed_ips);
1765
1770
  deleteApiKey = async (identifier) => this.client.account.apiKeys.delete(identifier);
@@ -1792,14 +1797,24 @@ var ServerAllocation = class {
1792
1797
  this.$notes = alloc.notes;
1793
1798
  this.port = alloc.port;
1794
1799
  }
1800
+ /**
1801
+ * Set description for this allocation
1802
+ * @param notes
1803
+ */
1795
1804
  setNotes = async (notes) => {
1796
1805
  const data = await this.client.allocations.setNotes(this.id, notes);
1797
1806
  this.$notes = data.notes;
1798
1807
  };
1808
+ /**
1809
+ * Make port primary
1810
+ */
1799
1811
  makeDefault = async () => {
1800
1812
  const data = await this.client.allocations.setPrimary(this.id);
1801
1813
  this.$isDefault = data.is_default;
1802
1814
  };
1815
+ /**
1816
+ * Remove allocation (if user is allowed to manage allocations by themselves)
1817
+ */
1803
1818
  unassign = async () => this.client.allocations.unassign(this.id);
1804
1819
  };
1805
1820
 
@@ -1860,6 +1875,9 @@ var ServerDatabase = class {
1860
1875
  this.$password = database.relationships?.password.attributes.password;
1861
1876
  this.username = database.username;
1862
1877
  }
1878
+ /**
1879
+ * Reset password to a random one, password will be updated in this ServerDatabase instance
1880
+ */
1863
1881
  rotatePassword = async () => {
1864
1882
  const data = await this.client.databases.rotatePassword(this.id);
1865
1883
  this.$password = data.relationships?.password.attributes.password;
@@ -1896,6 +1914,12 @@ var ServerFile = class _ServerFile {
1896
1914
  this.size = file.size;
1897
1915
  this.path = import_node_path.default.join(dir, this.name);
1898
1916
  }
1917
+ /**
1918
+ * Is this file an archive
1919
+ *
1920
+ * @remarks
1921
+ * It uses extension check instead of mimetype as Pelican currently has some issue with mimetypes
1922
+ */
1899
1923
  get isArchive() {
1900
1924
  return [
1901
1925
  "zip",
@@ -1935,15 +1959,24 @@ var ServerSchedule = class {
1935
1959
  client;
1936
1960
  createdAt;
1937
1961
  $cron;
1962
+ /**
1963
+ * CRON representation of schedule
1964
+ */
1938
1965
  get cron() {
1939
1966
  return { ...this.$cron };
1940
1967
  }
1941
1968
  id;
1942
1969
  $isActive;
1970
+ /**
1971
+ * Is this schedule enabled
1972
+ */
1943
1973
  get isActive() {
1944
1974
  return this.$isActive;
1945
1975
  }
1946
1976
  $isProcessing;
1977
+ /**
1978
+ * Is this schedule currently running
1979
+ */
1947
1980
  get isProcessing() {
1948
1981
  return this.$isProcessing;
1949
1982
  }
@@ -1954,6 +1987,9 @@ var ServerSchedule = class {
1954
1987
  }
1955
1988
  nextRunAt;
1956
1989
  $onlyWhenOnline;
1990
+ /**
1991
+ * Should schedule run only if server is online
1992
+ */
1957
1993
  get onlyWhenOnline() {
1958
1994
  return this.$onlyWhenOnline;
1959
1995
  }
@@ -1994,28 +2030,46 @@ var ServerScheduleTask = class {
1994
2030
  client;
1995
2031
  scheduleId;
1996
2032
  $action;
2033
+ /**
2034
+ * Task action (command would likely need server to be online)
2035
+ */
1997
2036
  get action() {
1998
2037
  return this.$action;
1999
2038
  }
2000
2039
  $continueOnFailure;
2040
+ /**
2041
+ * Should we fail on error or continue with other tasks?
2042
+ */
2001
2043
  get continueOnFailure() {
2002
2044
  return this.$continueOnFailure;
2003
2045
  }
2004
2046
  createdAt;
2005
2047
  id;
2006
2048
  $isQueued;
2049
+ /**
2050
+ * Is this task queued right now?
2051
+ */
2007
2052
  get isQueued() {
2008
2053
  return this.$isQueued;
2009
2054
  }
2010
2055
  $payload;
2056
+ /**
2057
+ * Whatever task should do: command to execute, power action or list of files to backup
2058
+ */
2011
2059
  get payload() {
2012
2060
  return this.$payload;
2013
2061
  }
2014
2062
  $sequenceId;
2063
+ /**
2064
+ * Order of this task in defined schedule
2065
+ */
2015
2066
  get sequenceId() {
2016
2067
  return this.$sequenceId;
2017
2068
  }
2018
2069
  $timeOffset;
2070
+ /**
2071
+ * Time offset in seconds relative to schedule start time
2072
+ */
2019
2073
  get timeOffset() {
2020
2074
  return this.$timeOffset;
2021
2075
  }
@@ -2058,6 +2112,10 @@ var ServerUser = class {
2058
2112
  language;
2059
2113
  image;
2060
2114
  admin;
2115
+ /**
2116
+ * Currently unused
2117
+ * @deprecated
2118
+ */
2061
2119
  root_admin;
2062
2120
  has2faEnabled;
2063
2121
  createdAt;
@@ -2107,7 +2165,8 @@ var Server = class {
2107
2165
  }
2108
2166
  /**
2109
2167
  * Node name used by this server
2110
- * @
2168
+ * @remarks
2169
+ * This is the name of the node used by this server, not the ID
2111
2170
  */
2112
2171
  node;
2113
2172
  isNodeUnderMaintenance;
@@ -2117,6 +2176,9 @@ var Server = class {
2117
2176
  return this.$description;
2118
2177
  }
2119
2178
  limits;
2179
+ /**
2180
+ * It's a Startup command used to start the server
2181
+ */
2120
2182
  invocation;
2121
2183
  $dockerImage;
2122
2184
  get dockerImage() {
@@ -2129,8 +2191,17 @@ var Server = class {
2129
2191
  isInstalling;
2130
2192
  isTransferring;
2131
2193
  allocations;
2194
+ /**
2195
+ * Egg variables
2196
+ */
2132
2197
  variables;
2198
+ /**
2199
+ * Egg used by this server, available only if request had include=egg
2200
+ */
2133
2201
  egg;
2202
+ /**
2203
+ * Server subusers, available only if request had include=subusers
2204
+ */
2134
2205
  subusers;
2135
2206
  constructor(client, server) {
2136
2207
  this.client = client;
@@ -2185,6 +2256,14 @@ var Server = class {
2185
2256
  const data = await this.client.databases.list(opts.include, opts.page);
2186
2257
  return data.map((d) => new ServerDatabase(this.client, d));
2187
2258
  };
2259
+ /**
2260
+ * Create a database
2261
+ * @param database - optional database name (leave blank for autogenerated)
2262
+ * @param remote - allow connections from (ip, % or anything db-wise)
2263
+ *
2264
+ * @remarks
2265
+ * I have no idea why API endpoint doesn't allow to select database host
2266
+ */
2188
2267
  createDatabase = async (database, remote) => {
2189
2268
  const data = await this.client.databases.create(database, remote);
2190
2269
  return new ServerDatabase(this.client, data);
@@ -2209,6 +2288,9 @@ var Server = class {
2209
2288
  const data = await this.client.allocations.list();
2210
2289
  return data.map((d) => new ServerAllocation(this.client, d));
2211
2290
  };
2291
+ /**
2292
+ * Create new allocation (if user is allowed to manage allocations by themselves)
2293
+ */
2212
2294
  createAllocation = async () => {
2213
2295
  const data = await this.client.allocations.autoAssign();
2214
2296
  return new ServerAllocation(this.client, data);
@@ -2220,6 +2302,9 @@ var Server = class {
2220
2302
  createFolder = async (...opts) => this.client.files.createFolder(...opts);
2221
2303
  uploadFile = async (...opts) => this.client.files.upload(...opts);
2222
2304
  uploadFileGetUrl = async (...opts) => this.client.files.uploadGetUrl(...opts);
2305
+ /**
2306
+ * Make wings agent download file or archive folder from specified URL instead of uploading directly
2307
+ */
2223
2308
  pullFileFromRemote = async (...opts) => this.client.files.pullFromRemote(...opts);
2224
2309
  compressMultipleFiles = async (...opts) => this.client.files.compress(...opts);
2225
2310
  renameMultipleFiles = async (...opts) => this.client.files.rename(...opts);
@@ -2228,10 +2313,18 @@ var Server = class {
2228
2313
  const data = await this.client.users.list();
2229
2314
  return data.map((d) => new ServerUser(this.client, d));
2230
2315
  };
2316
+ /**
2317
+ * Create a subuser
2318
+ * @param email
2319
+ * @param permissions
2320
+ */
2231
2321
  createUser = async (email, permissions) => {
2232
2322
  const data = await this.client.users.create(email, permissions);
2233
2323
  return new ServerUser(this.client, data);
2234
2324
  };
2325
+ /**
2326
+ * Get server egg variables and startup commands
2327
+ */
2235
2328
  getStartupInfo = async () => this.client.startup.list();
2236
2329
  setStartupVariable = async (key, value) => this.client.startup.set(key, value);
2237
2330
  };
@@ -2265,6 +2358,15 @@ var Client3 = class {
2265
2358
  * List servers
2266
2359
  *
2267
2360
  * @param opts Filtering options (all optional)
2361
+ *
2362
+ * @remarks
2363
+ * `type` — Server access type (Default: accessible)
2364
+ *
2365
+ * Variants:
2366
+ * - `accessible` — your servers and servers you have access to as a subuser
2367
+ * - `mine` — only your servers
2368
+ * - `admin` — only servers you have admin access to (excluding yours)
2369
+ * - `admin-all` — all servers you have admin access to
2268
2370
  */
2269
2371
  listServers = async (opts = { type: "accessible", page: 1, per_page: 50 }) => {
2270
2372
  const data = await this.client.listServers(
package/dist/index.mjs CHANGED
@@ -682,6 +682,7 @@ var timezonesSchema = z7.enum([
682
682
  var CreateSchema = z8.object({
683
683
  email: z8.email(),
684
684
  external_id: z8.string().max(255).optional(),
685
+ is_managed_externally: z8.boolean().optional().default(false),
685
686
  username: z8.string().min(1).max(255),
686
687
  password: z8.string().optional(),
687
688
  language: languagesSchema,
@@ -749,9 +750,10 @@ var Account = class {
749
750
  newEmail = z10.email().parse(newEmail);
750
751
  await this.r.put("/account/email", { email: newEmail, password });
751
752
  };
752
- updatePassword = async (newPassword) => {
753
+ updatePassword = async (currentPassword, newPassword) => {
753
754
  newPassword = z10.string().min(8).parse(newPassword);
754
755
  await this.r.put("/account/password", {
756
+ current_password: currentPassword,
755
757
  password: newPassword,
756
758
  password_confirmation: newPassword
757
759
  });
@@ -1690,6 +1692,9 @@ var Account2 = class {
1690
1692
  language;
1691
1693
  image;
1692
1694
  admin;
1695
+ /**
1696
+ * Has currently no significance
1697
+ */
1693
1698
  root_admin;
1694
1699
  $has2faEnabled;
1695
1700
  get has2faEnabled() {
@@ -1714,7 +1719,7 @@ var Account2 = class {
1714
1719
  await this.client.account.updateEmail(newEmail, password);
1715
1720
  this.$email = newEmail;
1716
1721
  };
1717
- updatePassword = async (newPassword) => this.client.account.updatePassword(newPassword);
1722
+ updatePassword = async (currentPassword, newPassword) => this.client.account.updatePassword(currentPassword, newPassword);
1718
1723
  listApiKeys = async () => this.client.account.apiKeys.list();
1719
1724
  createApiKey = async (description, allowed_ips) => this.client.account.apiKeys.create(description, allowed_ips);
1720
1725
  deleteApiKey = async (identifier) => this.client.account.apiKeys.delete(identifier);
@@ -1747,14 +1752,24 @@ var ServerAllocation = class {
1747
1752
  this.$notes = alloc.notes;
1748
1753
  this.port = alloc.port;
1749
1754
  }
1755
+ /**
1756
+ * Set description for this allocation
1757
+ * @param notes
1758
+ */
1750
1759
  setNotes = async (notes) => {
1751
1760
  const data = await this.client.allocations.setNotes(this.id, notes);
1752
1761
  this.$notes = data.notes;
1753
1762
  };
1763
+ /**
1764
+ * Make port primary
1765
+ */
1754
1766
  makeDefault = async () => {
1755
1767
  const data = await this.client.allocations.setPrimary(this.id);
1756
1768
  this.$isDefault = data.is_default;
1757
1769
  };
1770
+ /**
1771
+ * Remove allocation (if user is allowed to manage allocations by themselves)
1772
+ */
1758
1773
  unassign = async () => this.client.allocations.unassign(this.id);
1759
1774
  };
1760
1775
 
@@ -1815,6 +1830,9 @@ var ServerDatabase = class {
1815
1830
  this.$password = database.relationships?.password.attributes.password;
1816
1831
  this.username = database.username;
1817
1832
  }
1833
+ /**
1834
+ * Reset password to a random one, password will be updated in this ServerDatabase instance
1835
+ */
1818
1836
  rotatePassword = async () => {
1819
1837
  const data = await this.client.databases.rotatePassword(this.id);
1820
1838
  this.$password = data.relationships?.password.attributes.password;
@@ -1851,6 +1869,12 @@ var ServerFile = class _ServerFile {
1851
1869
  this.size = file.size;
1852
1870
  this.path = path.join(dir, this.name);
1853
1871
  }
1872
+ /**
1873
+ * Is this file an archive
1874
+ *
1875
+ * @remarks
1876
+ * It uses extension check instead of mimetype as Pelican currently has some issue with mimetypes
1877
+ */
1854
1878
  get isArchive() {
1855
1879
  return [
1856
1880
  "zip",
@@ -1890,15 +1914,24 @@ var ServerSchedule = class {
1890
1914
  client;
1891
1915
  createdAt;
1892
1916
  $cron;
1917
+ /**
1918
+ * CRON representation of schedule
1919
+ */
1893
1920
  get cron() {
1894
1921
  return { ...this.$cron };
1895
1922
  }
1896
1923
  id;
1897
1924
  $isActive;
1925
+ /**
1926
+ * Is this schedule enabled
1927
+ */
1898
1928
  get isActive() {
1899
1929
  return this.$isActive;
1900
1930
  }
1901
1931
  $isProcessing;
1932
+ /**
1933
+ * Is this schedule currently running
1934
+ */
1902
1935
  get isProcessing() {
1903
1936
  return this.$isProcessing;
1904
1937
  }
@@ -1909,6 +1942,9 @@ var ServerSchedule = class {
1909
1942
  }
1910
1943
  nextRunAt;
1911
1944
  $onlyWhenOnline;
1945
+ /**
1946
+ * Should schedule run only if server is online
1947
+ */
1912
1948
  get onlyWhenOnline() {
1913
1949
  return this.$onlyWhenOnline;
1914
1950
  }
@@ -1949,28 +1985,46 @@ var ServerScheduleTask = class {
1949
1985
  client;
1950
1986
  scheduleId;
1951
1987
  $action;
1988
+ /**
1989
+ * Task action (command would likely need server to be online)
1990
+ */
1952
1991
  get action() {
1953
1992
  return this.$action;
1954
1993
  }
1955
1994
  $continueOnFailure;
1995
+ /**
1996
+ * Should we fail on error or continue with other tasks?
1997
+ */
1956
1998
  get continueOnFailure() {
1957
1999
  return this.$continueOnFailure;
1958
2000
  }
1959
2001
  createdAt;
1960
2002
  id;
1961
2003
  $isQueued;
2004
+ /**
2005
+ * Is this task queued right now?
2006
+ */
1962
2007
  get isQueued() {
1963
2008
  return this.$isQueued;
1964
2009
  }
1965
2010
  $payload;
2011
+ /**
2012
+ * Whatever task should do: command to execute, power action or list of files to backup
2013
+ */
1966
2014
  get payload() {
1967
2015
  return this.$payload;
1968
2016
  }
1969
2017
  $sequenceId;
2018
+ /**
2019
+ * Order of this task in defined schedule
2020
+ */
1970
2021
  get sequenceId() {
1971
2022
  return this.$sequenceId;
1972
2023
  }
1973
2024
  $timeOffset;
2025
+ /**
2026
+ * Time offset in seconds relative to schedule start time
2027
+ */
1974
2028
  get timeOffset() {
1975
2029
  return this.$timeOffset;
1976
2030
  }
@@ -2013,6 +2067,10 @@ var ServerUser = class {
2013
2067
  language;
2014
2068
  image;
2015
2069
  admin;
2070
+ /**
2071
+ * Currently unused
2072
+ * @deprecated
2073
+ */
2016
2074
  root_admin;
2017
2075
  has2faEnabled;
2018
2076
  createdAt;
@@ -2062,7 +2120,8 @@ var Server = class {
2062
2120
  }
2063
2121
  /**
2064
2122
  * Node name used by this server
2065
- * @
2123
+ * @remarks
2124
+ * This is the name of the node used by this server, not the ID
2066
2125
  */
2067
2126
  node;
2068
2127
  isNodeUnderMaintenance;
@@ -2072,6 +2131,9 @@ var Server = class {
2072
2131
  return this.$description;
2073
2132
  }
2074
2133
  limits;
2134
+ /**
2135
+ * It's a Startup command used to start the server
2136
+ */
2075
2137
  invocation;
2076
2138
  $dockerImage;
2077
2139
  get dockerImage() {
@@ -2084,8 +2146,17 @@ var Server = class {
2084
2146
  isInstalling;
2085
2147
  isTransferring;
2086
2148
  allocations;
2149
+ /**
2150
+ * Egg variables
2151
+ */
2087
2152
  variables;
2153
+ /**
2154
+ * Egg used by this server, available only if request had include=egg
2155
+ */
2088
2156
  egg;
2157
+ /**
2158
+ * Server subusers, available only if request had include=subusers
2159
+ */
2089
2160
  subusers;
2090
2161
  constructor(client, server) {
2091
2162
  this.client = client;
@@ -2140,6 +2211,14 @@ var Server = class {
2140
2211
  const data = await this.client.databases.list(opts.include, opts.page);
2141
2212
  return data.map((d) => new ServerDatabase(this.client, d));
2142
2213
  };
2214
+ /**
2215
+ * Create a database
2216
+ * @param database - optional database name (leave blank for autogenerated)
2217
+ * @param remote - allow connections from (ip, % or anything db-wise)
2218
+ *
2219
+ * @remarks
2220
+ * I have no idea why API endpoint doesn't allow to select database host
2221
+ */
2143
2222
  createDatabase = async (database, remote) => {
2144
2223
  const data = await this.client.databases.create(database, remote);
2145
2224
  return new ServerDatabase(this.client, data);
@@ -2164,6 +2243,9 @@ var Server = class {
2164
2243
  const data = await this.client.allocations.list();
2165
2244
  return data.map((d) => new ServerAllocation(this.client, d));
2166
2245
  };
2246
+ /**
2247
+ * Create new allocation (if user is allowed to manage allocations by themselves)
2248
+ */
2167
2249
  createAllocation = async () => {
2168
2250
  const data = await this.client.allocations.autoAssign();
2169
2251
  return new ServerAllocation(this.client, data);
@@ -2175,6 +2257,9 @@ var Server = class {
2175
2257
  createFolder = async (...opts) => this.client.files.createFolder(...opts);
2176
2258
  uploadFile = async (...opts) => this.client.files.upload(...opts);
2177
2259
  uploadFileGetUrl = async (...opts) => this.client.files.uploadGetUrl(...opts);
2260
+ /**
2261
+ * Make wings agent download file or archive folder from specified URL instead of uploading directly
2262
+ */
2178
2263
  pullFileFromRemote = async (...opts) => this.client.files.pullFromRemote(...opts);
2179
2264
  compressMultipleFiles = async (...opts) => this.client.files.compress(...opts);
2180
2265
  renameMultipleFiles = async (...opts) => this.client.files.rename(...opts);
@@ -2183,10 +2268,18 @@ var Server = class {
2183
2268
  const data = await this.client.users.list();
2184
2269
  return data.map((d) => new ServerUser(this.client, d));
2185
2270
  };
2271
+ /**
2272
+ * Create a subuser
2273
+ * @param email
2274
+ * @param permissions
2275
+ */
2186
2276
  createUser = async (email, permissions) => {
2187
2277
  const data = await this.client.users.create(email, permissions);
2188
2278
  return new ServerUser(this.client, data);
2189
2279
  };
2280
+ /**
2281
+ * Get server egg variables and startup commands
2282
+ */
2190
2283
  getStartupInfo = async () => this.client.startup.list();
2191
2284
  setStartupVariable = async (key, value) => this.client.startup.set(key, value);
2192
2285
  };
@@ -2220,6 +2313,15 @@ var Client3 = class {
2220
2313
  * List servers
2221
2314
  *
2222
2315
  * @param opts Filtering options (all optional)
2316
+ *
2317
+ * @remarks
2318
+ * `type` — Server access type (Default: accessible)
2319
+ *
2320
+ * Variants:
2321
+ * - `accessible` — your servers and servers you have access to as a subuser
2322
+ * - `mine` — only your servers
2323
+ * - `admin` — only servers you have admin access to (excluding yours)
2324
+ * - `admin-all` — all servers you have admin access to
2223
2325
  */
2224
2326
  listServers = async (opts = { type: "accessible", page: 1, per_page: 50 }) => {
2225
2327
  const data = await this.client.listServers(