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

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