powersync 0.4.0 → 0.4.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/README.md CHANGED
@@ -16,7 +16,6 @@ For an overview, see the docs [here](https://docs.powersync.com/usage/tools/cli-
16
16
  $ npx powersync
17
17
  $ npx powersync COMMAND
18
18
  running command...
19
- powersync/0.4.0 linux-x64 node-v20.11.1
20
19
  $ npx powersync --help [COMMAND]
21
20
  USAGE
22
21
  $ npx powersync COMMAND
@@ -39,7 +38,7 @@ Example:
39
38
  # Commands
40
39
 
41
40
  <!-- commands -->
42
- * [`powersync help [COMMANDS]`](#powersync-help-commands)
41
+ * [`powersync help [COMMAND]`](#powersync-help-command)
43
42
  * [`powersync init`](#powersync-init)
44
43
  * [`powersync instance config`](#powersync-instance-config)
45
44
  * [`powersync instance create`](#powersync-instance-create)
@@ -54,16 +53,16 @@ Example:
54
53
  * [`powersync instance sync-rules validate`](#powersync-instance-sync-rules-validate)
55
54
  * [`powersync instances`](#powersync-instances)
56
55
 
57
- ## `powersync help [COMMANDS]`
56
+ ## `powersync help [COMMAND]`
58
57
 
59
58
  Display help for powersync.
60
59
 
61
60
  ```
62
61
  USAGE
63
- $ npx powersync help [COMMANDS] [-n]
62
+ $ npx powersync help [COMMAND...] [-n]
64
63
 
65
64
  ARGUMENTS
66
- COMMANDS Command to show help for.
65
+ COMMAND... Command to show help for.
67
66
 
68
67
  FLAGS
69
68
  -n, --nested-commands Include all nested commands in the output.
@@ -72,7 +71,7 @@ DESCRIPTION
72
71
  Display help for powersync.
73
72
  ```
74
73
 
75
- _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.0.13/src/commands/help.ts)_
74
+ _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.0.21/src/commands/help.ts)_
76
75
 
77
76
  ## `powersync init`
78
77
 
@@ -90,7 +89,7 @@ EXAMPLES
90
89
  $ npx powersync init
91
90
  ```
92
91
 
93
- _See code: [src/commands/init.ts](https://github.com/powersync-ja/cli/blob/v0.4.0/src/commands/init.ts)_
92
+ _See code: [src/commands/init.ts](https://github.com/powersync-ja/cli/blob/v0.4.1/src/commands/init.ts)_
94
93
 
95
94
  ## `powersync instance config`
96
95
 
@@ -107,7 +106,7 @@ EXAMPLES
107
106
  $ npx powersync instance config
108
107
  ```
109
108
 
110
- _See code: [src/commands/instance/config.ts](https://github.com/powersync-ja/cli/blob/v0.4.0/src/commands/instance/config.ts)_
109
+ _See code: [src/commands/instance/config.ts](https://github.com/powersync-ja/cli/blob/v0.4.1/src/commands/instance/config.ts)_
111
110
 
112
111
  ## `powersync instance create`
113
112
 
@@ -116,15 +115,14 @@ Create a new instance.
116
115
  ```
117
116
  USAGE
118
117
  $ npx powersync instance create [--databaseName <value>] [--hostname <value>] [--name <value>] [--port <value>]
119
- [--region US|EU] [--useSupabaseAuth]
118
+ [--region <value>] [--useSupabaseAuth]
120
119
 
121
120
  FLAGS
122
121
  --databaseName=<value> Name of the database.
123
122
  --hostname=<value> Hostname to connect to database.
124
123
  --name=<value> Name of the instance.
125
124
  --port=<value> Port number to connect to database.
126
- --region=<option> Region to deploy instance to.
127
- <options: US|EU>
125
+ --region=<value> Region to deploy instance to.
128
126
  --useSupabaseAuth Use Supabase for auth.
129
127
 
130
128
  DESCRIPTION
@@ -134,7 +132,7 @@ EXAMPLES
134
132
  $ npx powersync instance create
135
133
  ```
136
134
 
137
- _See code: [src/commands/instance/create.ts](https://github.com/powersync-ja/cli/blob/v0.4.0/src/commands/instance/create.ts)_
135
+ _See code: [src/commands/instance/create.ts](https://github.com/powersync-ja/cli/blob/v0.4.1/src/commands/instance/create.ts)_
138
136
 
139
137
  ## `powersync instance deploy`
140
138
 
@@ -159,7 +157,7 @@ EXAMPLES
159
157
  $ npx powersync instance deploy
160
158
  ```
161
159
 
162
- _See code: [src/commands/instance/deploy.ts](https://github.com/powersync-ja/cli/blob/v0.4.0/src/commands/instance/deploy.ts)_
160
+ _See code: [src/commands/instance/deploy.ts](https://github.com/powersync-ja/cli/blob/v0.4.1/src/commands/instance/deploy.ts)_
163
161
 
164
162
  ## `powersync instance destroy`
165
163
 
@@ -179,7 +177,7 @@ EXAMPLES
179
177
  $ npx powersync instance destroy
180
178
  ```
181
179
 
182
- _See code: [src/commands/instance/destroy.ts](https://github.com/powersync-ja/cli/blob/v0.4.0/src/commands/instance/destroy.ts)_
180
+ _See code: [src/commands/instance/destroy.ts](https://github.com/powersync-ja/cli/blob/v0.4.1/src/commands/instance/destroy.ts)_
183
181
 
184
182
  ## `powersync instance schema`
185
183
 
@@ -196,7 +194,7 @@ EXAMPLES
196
194
  $ npx powersync instance schema
197
195
  ```
198
196
 
199
- _See code: [src/commands/instance/schema.ts](https://github.com/powersync-ja/cli/blob/v0.4.0/src/commands/instance/schema.ts)_
197
+ _See code: [src/commands/instance/schema.ts](https://github.com/powersync-ja/cli/blob/v0.4.1/src/commands/instance/schema.ts)_
200
198
 
201
199
  ## `powersync instance set`
202
200
 
@@ -218,7 +216,7 @@ EXAMPLES
218
216
  $ npx powersync instance set --instanceId=1234
219
217
  ```
220
218
 
221
- _See code: [src/commands/instance/set.ts](https://github.com/powersync-ja/cli/blob/v0.4.0/src/commands/instance/set.ts)_
219
+ _See code: [src/commands/instance/set.ts](https://github.com/powersync-ja/cli/blob/v0.4.1/src/commands/instance/set.ts)_
222
220
 
223
221
  ## `powersync instance status`
224
222
 
@@ -243,7 +241,7 @@ EXAMPLES
243
241
  $ npx powersync instance status --orgId=1234 --projectId=1234 --instanceId=1234 --authToken=1234
244
242
  ```
245
243
 
246
- _See code: [src/commands/instance/status.ts](https://github.com/powersync-ja/cli/blob/v0.4.0/src/commands/instance/status.ts)_
244
+ _See code: [src/commands/instance/status.ts](https://github.com/powersync-ja/cli/blob/v0.4.1/src/commands/instance/status.ts)_
247
245
 
248
246
  ## `powersync instance stop`
249
247
 
@@ -263,7 +261,7 @@ EXAMPLES
263
261
  $ npx powersync instance stop
264
262
  ```
265
263
 
266
- _See code: [src/commands/instance/stop.ts](https://github.com/powersync-ja/cli/blob/v0.4.0/src/commands/instance/stop.ts)_
264
+ _See code: [src/commands/instance/stop.ts](https://github.com/powersync-ja/cli/blob/v0.4.1/src/commands/instance/stop.ts)_
267
265
 
268
266
  ## `powersync instance sync-rules deploy`
269
267
 
@@ -288,7 +286,7 @@ EXAMPLES
288
286
  $ npx powersync instance sync-rules deploy -f path/to/file
289
287
  ```
290
288
 
291
- _See code: [src/commands/instance/sync-rules/deploy.ts](https://github.com/powersync-ja/cli/blob/v0.4.0/src/commands/instance/sync-rules/deploy.ts)_
289
+ _See code: [src/commands/instance/sync-rules/deploy.ts](https://github.com/powersync-ja/cli/blob/v0.4.1/src/commands/instance/sync-rules/deploy.ts)_
292
290
 
293
291
  ## `powersync instance sync-rules generate-schema`
294
292
 
@@ -314,7 +312,7 @@ EXAMPLES
314
312
  $ npx powersync instance sync-rules generate-schema -f path/to/file
315
313
  ```
316
314
 
317
- _See code: [src/commands/instance/sync-rules/generate-schema.ts](https://github.com/powersync-ja/cli/blob/v0.4.0/src/commands/instance/sync-rules/generate-schema.ts)_
315
+ _See code: [src/commands/instance/sync-rules/generate-schema.ts](https://github.com/powersync-ja/cli/blob/v0.4.1/src/commands/instance/sync-rules/generate-schema.ts)_
318
316
 
319
317
  ## `powersync instance sync-rules validate`
320
318
 
@@ -338,7 +336,7 @@ EXAMPLES
338
336
  $ npx powersync instance sync-rules validate -f path/to/file
339
337
  ```
340
338
 
341
- _See code: [src/commands/instance/sync-rules/validate.ts](https://github.com/powersync-ja/cli/blob/v0.4.0/src/commands/instance/sync-rules/validate.ts)_
339
+ _See code: [src/commands/instance/sync-rules/validate.ts](https://github.com/powersync-ja/cli/blob/v0.4.1/src/commands/instance/sync-rules/validate.ts)_
342
340
 
343
341
  ## `powersync instances`
344
342
 
@@ -355,5 +353,5 @@ EXAMPLES
355
353
  $ npx powersync instances
356
354
  ```
357
355
 
358
- _See code: [src/commands/instances.ts](https://github.com/powersync-ja/cli/blob/v0.4.0/src/commands/instances.ts)_
356
+ _See code: [src/commands/instances.ts](https://github.com/powersync-ja/cli/blob/v0.4.1/src/commands/instances.ts)_
359
357
  <!-- commandsstop -->
@@ -2,7 +2,6 @@
2
2
  import { Command, Flags, ux } from '@oclif/core';
3
3
  import inquirer from 'inquirer';
4
4
  import ora from 'ora';
5
- import { REGIONS } from '../../constants.js';
6
5
  import * as PowerSyncClient from '../../service/powersync.client.js';
7
6
  import { bold, checkForValidEnvFile, green, red, updateEnvFileVariableValue } from '../../utils.js';
8
7
  export default class InstanceCreate extends Command {
@@ -15,12 +14,13 @@ export default class InstanceCreate extends Command {
15
14
  hostname: Flags.string({ description: 'Hostname to connect to database.' }),
16
15
  name: Flags.string({ description: 'Name of the instance.' }),
17
16
  port: Flags.integer({ description: 'Port number to connect to database.' }),
18
- region: Flags.string({ description: 'Region to deploy instance to.', options: REGIONS }),
17
+ region: Flags.string({ description: 'Region to deploy instance to.' }),
19
18
  useSupabaseAuth: Flags.boolean({ description: 'Use Supabase for auth.' })
20
19
  };
21
20
  async run() {
22
21
  checkForValidEnvFile(this.config.bin);
23
22
  const { flags } = await this.parse(InstanceCreate);
23
+ const regions = await PowerSyncClient.getRegions();
24
24
  const questions = [
25
25
  {
26
26
  message: 'What do you want to name your instance?',
@@ -32,7 +32,7 @@ export default class InstanceCreate extends Command {
32
32
  when: !flags.name
33
33
  },
34
34
  {
35
- choices: REGIONS,
35
+ choices: regions.map((region) => region.toUpperCase()),
36
36
  message: 'What region do you want to use?',
37
37
  name: 'region',
38
38
  type: 'list',
@@ -5,5 +5,4 @@ export declare const ENDPOINTS: {
5
5
  ACCOUNTS_URL: string;
6
6
  POWERSYNC_URL: string;
7
7
  };
8
- export declare const REGIONS: string[];
9
8
  export declare const LANGUAGES: string[];
package/dist/constants.js CHANGED
@@ -7,5 +7,4 @@ export const ENDPOINTS = {
7
7
  ACCOUNTS_URL: 'https://accounts.journeyapps.com',
8
8
  POWERSYNC_URL: 'https://powersync-api.journeyapps.com'
9
9
  };
10
- export const REGIONS = ['US', 'EU'];
11
10
  export const LANGUAGES = ['js', 'dart'];
@@ -10160,7 +10160,7 @@ var models = {};
10160
10160
  return result;
10161
10161
  };
10162
10162
  Object.defineProperty(exports, "__esModule", { value: true });
10163
- exports.SendMFASMSResponse = exports.SendMFASMSParams = exports.SetUserMFAPreferenceResponse = exports.SetUserMFAPreferenceParams = exports.GetMFABackupCodesResponse = exports.DeleteMFAFactorResponse = exports.DeleteMFAFactorParams = exports.VerifyMFAFactorResponse = exports.VerifyMFAFactorParams = exports.RegisterSMSMFAFactorResponse = exports.RegisterSMSMFAFactorParams = exports.RegisterTOTPMFAFactorResponse = exports.UpdateUserParams = exports.ListUserMFAFactorsResponse = exports.CreateUserParams = exports.GetPreferredMFAFactorResponse = exports.GetSensitiveAccessTokenResponse = exports.GetSensitiveAccessTokenParams = exports.GiveUserAccessParams = exports.TokenResponse = exports.CompleteSignupParams = exports.UpdateInviteParams = exports.GetTrialUserResponse = exports.CreateDeveloperInviteParams = exports.StartTrialParams = exports.ListUserResponse = exports.ListUserParams = exports.ListUserInvitesResponse = exports.GetUserInvitesParams = exports.ListAppsResponse = exports.ListAppParams = exports.UpdateAppParams = exports.CreateAppParams = exports.ListOrgResponse = exports.ListOrgParams = exports.UpdateOrgBilling = exports.UpdateOrgParams = exports.CreateOrgParams = exports.UpgradeOrgParams = exports.DowngradeOrgParams = exports.ListResponseMetaData = exports.SearchParams = exports.PaginationParams = exports.OperationResponse = exports.IDParam = void 0;
10163
+ exports.UpdateOrgLocksParams = exports.SendMFASMSResponse = exports.SendMFASMSParams = exports.SetUserMFAPreferenceResponse = exports.SetUserMFAPreferenceParams = exports.GetMFABackupCodesResponse = exports.DeleteMFAFactorResponse = exports.DeleteMFAFactorParams = exports.VerifyMFAFactorResponse = exports.VerifyMFAFactorParams = exports.RegisterSMSMFAFactorResponse = exports.RegisterSMSMFAFactorParams = exports.RegisterTOTPMFAFactorResponse = exports.UpdateUserParams = exports.ListUserMFAFactorsResponse = exports.CreateUserParams = exports.GetPreferredMFAFactorResponse = exports.GetSensitiveAccessTokenResponse = exports.GetSensitiveAccessTokenParams = exports.GiveUserAccessParams = exports.TokenResponse = exports.CompleteSignupParams = exports.UpdateInviteParams = exports.GetTrialUserResponse = exports.CreateDeveloperInviteParams = exports.StartTrialParams = exports.ListUserResponse = exports.ListUserParams = exports.ListUserInvitesResponse = exports.GetUserInvitesParams = exports.ListAppsResponse = exports.ListAppParams = exports.UpdateAppParams = exports.CreateAppParams = exports.ListOrgResponse = exports.ListOrgParams = exports.UpdateOrgBilling = exports.UpdateOrgParams = exports.CreateOrgParams = exports.UpgradeOrgParams = exports.DowngradeOrgParams = exports.ListResponseMetaData = exports.SearchParams = exports.PaginationParams = exports.OperationResponse = exports.IDParam = void 0;
10164
10164
  const source = __importStar(dist$3);
10165
10165
  const codecs = __importStar(dist);
10166
10166
  const models$1 = __importStar(models);
@@ -10196,8 +10196,7 @@ var models = {};
10196
10196
  });
10197
10197
  exports.UpdateOrgParams = t.object({
10198
10198
  id: t.string,
10199
- label: t.string.optional(),
10200
- locked: t.boolean.optional()
10199
+ label: t.string.optional()
10201
10200
  });
10202
10201
  exports.UpdateOrgBilling = t.object({
10203
10202
  id: t.string,
@@ -10266,7 +10265,8 @@ var models = {};
10266
10265
  id: t.string,
10267
10266
  name: t.string,
10268
10267
  phone_number: t.string.optional(),
10269
- password: t.string
10268
+ password: t.string,
10269
+ send_welcome_email: t.boolean.optional()
10270
10270
  });
10271
10271
  exports.TokenResponse = t.object({
10272
10272
  token: t.string
@@ -10340,6 +10340,10 @@ var models = {};
10340
10340
  });
10341
10341
  exports.SendMFASMSResponse = t.object({
10342
10342
  sent: t.boolean
10343
+ });
10344
+ exports.UpdateOrgLocksParams = t.object({
10345
+ id: t.string,
10346
+ locked: t.boolean
10343
10347
  });
10344
10348
  } (api$2));
10345
10349
 
@@ -10357,6 +10361,7 @@ var ROUTES;
10357
10361
  ROUTES["GET_ORG"] = "/api/accounts/v5/organizations/get";
10358
10362
  ROUTES["LIST_ORGS"] = "/api/accounts/v5/organizations/list";
10359
10363
  ROUTES["SEARCH_ORGS"] = "/api/accounts/v5/organizations/search";
10364
+ ROUTES["UPDATE_ORG_LOCKS"] = "/api/accounts/v5/organizations/update-locks";
10360
10365
  ROUTES["CREATE_USER"] = "/api/accounts/v5/users/create";
10361
10366
  ROUTES["UPDATE_USER"] = "/api/accounts/v5/users/update";
10362
10367
  ROUTES["DELETE_USER"] = "/api/accounts/v5/users/delete";
@@ -10530,6 +10535,9 @@ class AccountsV5Client extends sdk.SDKClient {
10530
10535
  this.updateUser = this.createEndpoint({
10531
10536
  path: types_accounts_hub_1.ROUTES.UPDATE_USER
10532
10537
  });
10538
+ this.updateOrgLocks = this.createEndpoint({
10539
+ path: types_accounts_hub_1.ROUTES.UPDATE_ORG_LOCKS
10540
+ });
10533
10541
  // === TRIAL ===
10534
10542
  this.startTrial = this.createEndpoint({
10535
10543
  path: types_accounts_hub_1.ROUTES.START_TRIAL
@@ -10659,7 +10667,7 @@ var distExports = requireDist();
10659
10667
  var main$1 = {exports: {}};
10660
10668
 
10661
10669
  var name$1 = "dotenv";
10662
- var version$2 = "16.4.4";
10670
+ var version$2 = "16.4.5";
10663
10671
  var description$1 = "Loads environment variables from .env file";
10664
10672
  var main = "lib/main.js";
10665
10673
  var types$1 = "lib/main.d.ts";
@@ -10956,52 +10964,48 @@ function configDotenv (options) {
10956
10964
  }
10957
10965
  }
10958
10966
 
10959
- let optionPathsThatExist = [];
10967
+ let optionPaths = [dotenvPath]; // default, look for .env
10960
10968
  if (options && options.path) {
10961
10969
  if (!Array.isArray(options.path)) {
10962
- if (fs.existsSync(options.path)) {
10963
- optionPathsThatExist = [_resolveHome(options.path)];
10964
- }
10970
+ optionPaths = [_resolveHome(options.path)];
10965
10971
  } else {
10972
+ optionPaths = []; // reset default
10966
10973
  for (const filepath of options.path) {
10967
- if (fs.existsSync(filepath)) {
10968
- optionPathsThatExist.push(_resolveHome(filepath));
10969
- }
10974
+ optionPaths.push(_resolveHome(filepath));
10970
10975
  }
10971
10976
  }
10972
-
10973
- if (!optionPathsThatExist.length) {
10974
- optionPathsThatExist = [dotenvPath];
10975
- }
10976
10977
  }
10977
10978
 
10978
- // If we have options.path, and it had valid paths, use them. Else fall back to .env
10979
- const pathsToProcess = optionPathsThatExist.length ? optionPathsThatExist : [dotenvPath];
10980
-
10981
10979
  // Build the parsed data in a temporary object (because we need to return it). Once we have the final
10982
10980
  // parsed data, we will combine it with process.env (or options.processEnv if provided).
10983
-
10984
- const parsed = {};
10985
- try {
10986
- for (const path of pathsToProcess) {
10981
+ let lastError;
10982
+ const parsedAll = {};
10983
+ for (const path of optionPaths) {
10984
+ try {
10987
10985
  // Specifying an encoding returns a string instead of a buffer
10988
- const singleFileParsed = DotenvModule.parse(fs.readFileSync(path, { encoding }));
10989
- DotenvModule.populate(parsed, singleFileParsed, options);
10990
- }
10986
+ const parsed = DotenvModule.parse(fs.readFileSync(path, { encoding }));
10991
10987
 
10992
- let processEnv = process.env;
10993
- if (options && options.processEnv != null) {
10994
- processEnv = options.processEnv;
10988
+ DotenvModule.populate(parsedAll, parsed, options);
10989
+ } catch (e) {
10990
+ if (debug) {
10991
+ _debug(`Failed to load ${path} ${e.message}`);
10992
+ }
10993
+ lastError = e;
10995
10994
  }
10995
+ }
10996
10996
 
10997
- DotenvModule.populate(processEnv, parsed, options);
10998
- } catch (e) {
10999
- if (debug) {
11000
- _debug(`Failed to load ${pathsToProcess} ${e.message}`);
11001
- }
11002
- return { error: e }
10997
+ let processEnv = process.env;
10998
+ if (options && options.processEnv != null) {
10999
+ processEnv = options.processEnv;
11000
+ }
11001
+
11002
+ DotenvModule.populate(processEnv, parsedAll, options);
11003
+
11004
+ if (lastError) {
11005
+ return { parsed: parsedAll, error: lastError }
11006
+ } else {
11007
+ return { parsed: parsedAll }
11003
11008
  }
11004
- return { parsed }
11005
11009
  }
11006
11010
 
11007
11011
  // Populates process.env from .env file
@@ -11130,7 +11134,7 @@ var files = [
11130
11134
  "/dist",
11131
11135
  "/oclif.manifest.json"
11132
11136
  ];
11133
- var version = "0.4.0";
11137
+ var version = "0.4.1";
11134
11138
  var bugs = "https://github.com/powersync-ja/cli/issues";
11135
11139
  var types = "dist/index.d.ts";
11136
11140
  var exports = "./lib/index.js";
@@ -11175,44 +11179,44 @@ var scripts = {
11175
11179
  "pack:tarballs": "oclif pack tarballs --parallel"
11176
11180
  };
11177
11181
  var dependencies = {
11178
- "@oclif/core": "^3.19.2",
11179
- "@oclif/plugin-help": "^6.0.13",
11180
- "@oclif/plugin-not-found": "^3.0.10",
11181
- "@oclif/plugin-warn-if-update-available": "^3.0.11",
11182
+ "@oclif/core": "^3.26.4",
11183
+ "@oclif/plugin-help": "^6.0.21",
11184
+ "@oclif/plugin-not-found": "^3.1.4",
11185
+ "@oclif/plugin-warn-if-update-available": "^3.0.15",
11182
11186
  "@rollup/plugin-typescript": "^11.1.6",
11183
- dotenv: "^16.4.4",
11184
- inquirer: "^9.2.14",
11187
+ dotenv: "^16.4.5",
11188
+ inquirer: "^9.2.19",
11185
11189
  ora: "^8.0.1"
11186
11190
  };
11187
11191
  var devDependencies = {
11188
11192
  "@changesets/cli": "^2.27.1",
11189
- "@journeyapps-platform/powersync-sync-rules": "^0.16.7",
11190
- "@journeyapps-platform/powersync-types": "^0.16.7",
11191
- "@journeyapps-platform/sdk-accounts-hub": "^5.1.0",
11193
+ "@journeyapps-platform/powersync-sync-rules": "^0.17.4",
11194
+ "@journeyapps-platform/powersync-types": "^0.17.4",
11195
+ "@journeyapps-platform/sdk-accounts-hub": "^6.0.0",
11192
11196
  "@journeyapps-platform/sdk-common": "^5.5.0",
11193
- "@journeyapps-platform/sdk-powersync": "^0.16.7",
11194
- "@journeyapps-platform/types-accounts-hub": "^5.1.0",
11197
+ "@journeyapps-platform/sdk-powersync": "^0.17.4",
11198
+ "@journeyapps-platform/types-accounts-hub": "^6.0.0",
11195
11199
  "@rollup/plugin-commonjs": "^25.0.7",
11196
11200
  "@rollup/plugin-json": "^6.1.0",
11197
11201
  "@rollup/plugin-node-resolve": "^15.2.3",
11198
11202
  "@types/inquirer": "^9.0.7",
11199
- "@types/node": "^20.11.19",
11200
- esbuild: "^0.20.1",
11201
- eslint: "^8.56.0",
11203
+ "@types/node": "^20.12.7",
11204
+ esbuild: "^0.20.2",
11205
+ eslint: "^8.57.0",
11202
11206
  "eslint-config-oclif": "^5",
11203
- "eslint-config-oclif-typescript": "^3.0.48",
11207
+ "eslint-config-oclif-typescript": "^3.1.5",
11204
11208
  "eslint-config-prettier": "^9.1.0",
11205
11209
  "eslint-plugin-prettier": "^5.1.3",
11206
- glob: "^10.3.10",
11207
- oclif: "^4.4.16",
11210
+ glob: "^10.3.12",
11211
+ oclif: "^4.8.5",
11208
11212
  prettier: "^3.2.5",
11209
- rollup: "^4.12.0",
11213
+ rollup: "^4.14.3",
11210
11214
  "rollup-plugin-esbuild": "^6.1.1",
11211
11215
  shx: "^0.3.4",
11212
11216
  "strip-ansi": "^7.1.0",
11213
11217
  "ts-node": "^10.9.2",
11214
- typescript: "^5.3.3",
11215
- vitest: "^1.3.0"
11218
+ typescript: "^5.4.5",
11219
+ vitest: "^1.5.0"
11216
11220
  };
11217
11221
  var packageJSON = {
11218
11222
  author: author,
@@ -9208,7 +9208,7 @@ var __importStar$2 = (commonjsGlobal && commonjsGlobal.__importStar) || function
9208
9208
  return result;
9209
9209
  };
9210
9210
  Object.defineProperty(routes, "__esModule", { value: true });
9211
- routes.ListRegionsResponse = routes.ListRegionsRequest = routes.InstanceDiagnosticsResponse = routes.InstanceDiagnosticsRequest = routes.ReprocessSyncRulesResponse = routes.ReprocessSyncRulesRequest = routes.ValidateSyncRulesResponse = routes.ValidateSyncRulesRequest = routes.ExecuteSqlResponse = routes.ExecuteSqlRequest = routes.GetSchemaResponse = routes.GetSchemaRequest = routes.TestPostgresConnectionResponse = routes.TestPostgresConnectionRequest = routes.DemoCredentialsResponse = routes.DemoCredentialsRequest = routes.DEV_ROUTES = routes.DeactivateInstanceResponse = routes.DeactivateInstanceRequest = routes.DestroyInstanceResponse = routes.DestroyInstanceRequest = routes.InstanceStatusResponse = routes.InstanceStatusRequest = routes.InstanceConfigResponse = routes.InstanceConfigRequest = routes.DeployInstanceResponse = routes.DeployInstanceRequest = routes.CreateInstanceResponse = routes.CreateInstanceRequest = routes.ListInstancesResponse = routes.ListInstancesRequest = routes.MANAGE_ROUTES = routes.GENERAL_ROUTES = void 0;
9211
+ routes.GenerateDevTokenResponse = routes.GenerateDevTokenRequest = routes.ListRegionsResponse = routes.ListRegionsRequest = routes.InstanceDiagnosticsResponse = routes.InstanceDiagnosticsRequest = routes.ReprocessSyncRulesResponse = routes.ReprocessSyncRulesRequest = routes.ValidateSyncRulesResponse = routes.ValidateSyncRulesRequest = routes.ExecuteSqlResponse = routes.ExecuteSqlRequest = routes.GetSchemaResponse = routes.GetSchemaRequest = routes.TestPostgresConnectionResponse = routes.TestPostgresConnectionRequest = routes.DemoCredentialsResponse = routes.DemoCredentialsRequest = routes.DEV_ROUTES = routes.DeactivateInstanceResponse = routes.DeactivateInstanceRequest = routes.DestroyInstanceResponse = routes.DestroyInstanceRequest = routes.InstanceStatusResponse = routes.InstanceStatusRequest = routes.InstanceConfigResponse = routes.InstanceConfigRequest = routes.DeployInstanceResponse = routes.DeployInstanceRequest = routes.CreateInstanceResponse = routes.CreateInstanceRequest = routes.ListInstancesResponse = routes.ListInstancesRequest = routes.MANAGE_ROUTES = routes.GENERAL_ROUTES = void 0;
9212
9212
  const t = __importStar$2(dist);
9213
9213
  const HostedConfig_1 = HostedConfig;
9214
9214
  const definitions_1 = definitions$1;
@@ -9305,6 +9305,7 @@ var DEV_ROUTES;
9305
9305
  DEV_ROUTES["GET_SCHEMA"] = "/api/v1/instances/dev/schema";
9306
9306
  DEV_ROUTES["VALIDATE_SYNC_RULES"] = "/api/v1/instances/dev/validate-sync-rules";
9307
9307
  DEV_ROUTES["REPROCESS_SYNC_RULES"] = "/api/v1/instances/dev/reprocess-sync-rules";
9308
+ DEV_ROUTES["GENERATE_DEV_TOKEN"] = "/api/v1/instances/dev/generate-dev-token";
9308
9309
  DEV_ROUTES["TEST_CONNECTION"] = "/api/v1/connections/test";
9309
9310
  DEV_ROUTES["DEMO_CREDENTIALS"] = "/api/v1/instances/demo-credentials";
9310
9311
  })(DEV_ROUTES || (routes.DEV_ROUTES = DEV_ROUTES = {}));
@@ -9398,6 +9399,13 @@ routes.ListRegionsResponse = t.object({
9398
9399
  ips: t.array(t.string)
9399
9400
  }))
9400
9401
  });
9402
+ routes.GenerateDevTokenRequest = definitions_1.InstanceId.and(t.object({
9403
+ subject: t.string,
9404
+ expiresInSeconds: t.number
9405
+ }));
9406
+ routes.GenerateDevTokenResponse = t.object({
9407
+ token: t.string
9408
+ });
9401
9409
 
9402
9410
  var normalize = {};
9403
9411
 
@@ -11037,6 +11045,9 @@ class Client extends sdk.SDKClient {
11037
11045
  this.reprocessSyncRules = this.createEndpoint({
11038
11046
  path: dev.VALIDATE_SYNC_RULES
11039
11047
  });
11048
+ this.generateDevToken = this.createEndpoint({
11049
+ path: dev.GENERATE_DEV_TOKEN
11050
+ });
11040
11051
  this.listRegions = this.createEndpoint({
11041
11052
  path: general.LIST_REGIONS,
11042
11053
  method: 'get'
@@ -11048,7 +11059,7 @@ Client_1 = dist$2.Client = Client;
11048
11059
  var main$1 = {exports: {}};
11049
11060
 
11050
11061
  var name$1 = "dotenv";
11051
- var version$2 = "16.4.4";
11062
+ var version$2 = "16.4.5";
11052
11063
  var description$2 = "Loads environment variables from .env file";
11053
11064
  var main = "lib/main.js";
11054
11065
  var types$3 = "lib/main.d.ts";
@@ -11345,52 +11356,48 @@ function configDotenv (options) {
11345
11356
  }
11346
11357
  }
11347
11358
 
11348
- let optionPathsThatExist = [];
11359
+ let optionPaths = [dotenvPath]; // default, look for .env
11349
11360
  if (options && options.path) {
11350
11361
  if (!Array.isArray(options.path)) {
11351
- if (fs.existsSync(options.path)) {
11352
- optionPathsThatExist = [_resolveHome(options.path)];
11353
- }
11362
+ optionPaths = [_resolveHome(options.path)];
11354
11363
  } else {
11364
+ optionPaths = []; // reset default
11355
11365
  for (const filepath of options.path) {
11356
- if (fs.existsSync(filepath)) {
11357
- optionPathsThatExist.push(_resolveHome(filepath));
11358
- }
11366
+ optionPaths.push(_resolveHome(filepath));
11359
11367
  }
11360
11368
  }
11361
-
11362
- if (!optionPathsThatExist.length) {
11363
- optionPathsThatExist = [dotenvPath];
11364
- }
11365
11369
  }
11366
11370
 
11367
- // If we have options.path, and it had valid paths, use them. Else fall back to .env
11368
- const pathsToProcess = optionPathsThatExist.length ? optionPathsThatExist : [dotenvPath];
11369
-
11370
11371
  // Build the parsed data in a temporary object (because we need to return it). Once we have the final
11371
11372
  // parsed data, we will combine it with process.env (or options.processEnv if provided).
11372
-
11373
- const parsed = {};
11374
- try {
11375
- for (const path of pathsToProcess) {
11373
+ let lastError;
11374
+ const parsedAll = {};
11375
+ for (const path of optionPaths) {
11376
+ try {
11376
11377
  // Specifying an encoding returns a string instead of a buffer
11377
- const singleFileParsed = DotenvModule.parse(fs.readFileSync(path, { encoding }));
11378
- DotenvModule.populate(parsed, singleFileParsed, options);
11379
- }
11378
+ const parsed = DotenvModule.parse(fs.readFileSync(path, { encoding }));
11380
11379
 
11381
- let processEnv = process.env;
11382
- if (options && options.processEnv != null) {
11383
- processEnv = options.processEnv;
11380
+ DotenvModule.populate(parsedAll, parsed, options);
11381
+ } catch (e) {
11382
+ if (debug) {
11383
+ _debug(`Failed to load ${path} ${e.message}`);
11384
+ }
11385
+ lastError = e;
11384
11386
  }
11387
+ }
11385
11388
 
11386
- DotenvModule.populate(processEnv, parsed, options);
11387
- } catch (e) {
11388
- if (debug) {
11389
- _debug(`Failed to load ${pathsToProcess} ${e.message}`);
11390
- }
11391
- return { error: e }
11389
+ let processEnv = process.env;
11390
+ if (options && options.processEnv != null) {
11391
+ processEnv = options.processEnv;
11392
+ }
11393
+
11394
+ DotenvModule.populate(processEnv, parsedAll, options);
11395
+
11396
+ if (lastError) {
11397
+ return { parsed: parsedAll, error: lastError }
11398
+ } else {
11399
+ return { parsed: parsedAll }
11392
11400
  }
11393
- return { parsed }
11394
11401
  }
11395
11402
 
11396
11403
  // Populates process.env from .env file
@@ -11519,7 +11526,7 @@ var files = [
11519
11526
  "/dist",
11520
11527
  "/oclif.manifest.json"
11521
11528
  ];
11522
- var version = "0.4.0";
11529
+ var version = "0.4.1";
11523
11530
  var bugs = "https://github.com/powersync-ja/cli/issues";
11524
11531
  var types$2 = "dist/index.d.ts";
11525
11532
  var exports = "./lib/index.js";
@@ -11564,44 +11571,44 @@ var scripts = {
11564
11571
  "pack:tarballs": "oclif pack tarballs --parallel"
11565
11572
  };
11566
11573
  var dependencies$1 = {
11567
- "@oclif/core": "^3.19.2",
11568
- "@oclif/plugin-help": "^6.0.13",
11569
- "@oclif/plugin-not-found": "^3.0.10",
11570
- "@oclif/plugin-warn-if-update-available": "^3.0.11",
11574
+ "@oclif/core": "^3.26.4",
11575
+ "@oclif/plugin-help": "^6.0.21",
11576
+ "@oclif/plugin-not-found": "^3.1.4",
11577
+ "@oclif/plugin-warn-if-update-available": "^3.0.15",
11571
11578
  "@rollup/plugin-typescript": "^11.1.6",
11572
- dotenv: "^16.4.4",
11573
- inquirer: "^9.2.14",
11579
+ dotenv: "^16.4.5",
11580
+ inquirer: "^9.2.19",
11574
11581
  ora: "^8.0.1"
11575
11582
  };
11576
11583
  var devDependencies = {
11577
11584
  "@changesets/cli": "^2.27.1",
11578
- "@journeyapps-platform/powersync-sync-rules": "^0.16.7",
11579
- "@journeyapps-platform/powersync-types": "^0.16.7",
11580
- "@journeyapps-platform/sdk-accounts-hub": "^5.1.0",
11585
+ "@journeyapps-platform/powersync-sync-rules": "^0.17.4",
11586
+ "@journeyapps-platform/powersync-types": "^0.17.4",
11587
+ "@journeyapps-platform/sdk-accounts-hub": "^6.0.0",
11581
11588
  "@journeyapps-platform/sdk-common": "^5.5.0",
11582
- "@journeyapps-platform/sdk-powersync": "^0.16.7",
11583
- "@journeyapps-platform/types-accounts-hub": "^5.1.0",
11589
+ "@journeyapps-platform/sdk-powersync": "^0.17.4",
11590
+ "@journeyapps-platform/types-accounts-hub": "^6.0.0",
11584
11591
  "@rollup/plugin-commonjs": "^25.0.7",
11585
11592
  "@rollup/plugin-json": "^6.1.0",
11586
11593
  "@rollup/plugin-node-resolve": "^15.2.3",
11587
11594
  "@types/inquirer": "^9.0.7",
11588
- "@types/node": "^20.11.19",
11589
- esbuild: "^0.20.1",
11590
- eslint: "^8.56.0",
11595
+ "@types/node": "^20.12.7",
11596
+ esbuild: "^0.20.2",
11597
+ eslint: "^8.57.0",
11591
11598
  "eslint-config-oclif": "^5",
11592
- "eslint-config-oclif-typescript": "^3.0.48",
11599
+ "eslint-config-oclif-typescript": "^3.1.5",
11593
11600
  "eslint-config-prettier": "^9.1.0",
11594
11601
  "eslint-plugin-prettier": "^5.1.3",
11595
- glob: "^10.3.10",
11596
- oclif: "^4.4.16",
11602
+ glob: "^10.3.12",
11603
+ oclif: "^4.8.5",
11597
11604
  prettier: "^3.2.5",
11598
- rollup: "^4.12.0",
11605
+ rollup: "^4.14.3",
11599
11606
  "rollup-plugin-esbuild": "^6.1.1",
11600
11607
  shx: "^0.3.4",
11601
11608
  "strip-ansi": "^7.1.0",
11602
11609
  "ts-node": "^10.9.2",
11603
- typescript: "^5.3.3",
11604
- vitest: "^1.3.0"
11610
+ typescript: "^5.4.5",
11611
+ vitest: "^1.5.0"
11605
11612
  };
11606
11613
  var packageJSON = {
11607
11614
  author: author,
@@ -37517,6 +37524,11 @@ const powerSyncClient = ({ authToken } = {}) => {
37517
37524
  endpoint: ENDPOINTS.POWERSYNC_URL
37518
37525
  });
37519
37526
  };
37527
+ const getRegions = async () => {
37528
+ const result = await powerSyncClient().listRegions(void 0);
37529
+ const regions = result.regions.filter((region) => region.deployable).map((region) => region.name);
37530
+ return regions;
37531
+ };
37520
37532
  const getInstancesList = async () => {
37521
37533
  checkOrgId(ORG_ID);
37522
37534
  checkProjectId(PROJECT_ID);
@@ -37675,4 +37687,4 @@ const waitForStatusChange = async (instanceId) => {
37675
37687
  }
37676
37688
  };
37677
37689
 
37678
- export { ENV_VARIABLES, SqlSyncRules, StaticSchema, createInstance, deactivateInstance, deployInstance, deploySyncRules, destroyInstance, getInstanceConfig, getInstanceDiagnostics, getInstanceSchema, getInstanceStatus, getInstancesList, powerSyncClient, processSyncRules, schemaGenerators, testConnection, validateSyncRules, waitForStatusChange };
37690
+ export { ENV_VARIABLES, SqlSyncRules, StaticSchema, createInstance, deactivateInstance, deployInstance, deploySyncRules, destroyInstance, getInstanceConfig, getInstanceDiagnostics, getInstanceSchema, getInstanceStatus, getInstancesList, getRegions, powerSyncClient, processSyncRules, schemaGenerators, testConnection, validateSyncRules, waitForStatusChange };
@@ -18,7 +18,7 @@ var files = [
18
18
  "/dist",
19
19
  "/oclif.manifest.json"
20
20
  ];
21
- var version = "0.4.0";
21
+ var version = "0.4.1";
22
22
  var bugs = "https://github.com/powersync-ja/cli/issues";
23
23
  var types = "dist/index.d.ts";
24
24
  var exports = "./lib/index.js";
@@ -63,44 +63,44 @@ var scripts = {
63
63
  "pack:tarballs": "oclif pack tarballs --parallel"
64
64
  };
65
65
  var dependencies = {
66
- "@oclif/core": "^3.19.2",
67
- "@oclif/plugin-help": "^6.0.13",
68
- "@oclif/plugin-not-found": "^3.0.10",
69
- "@oclif/plugin-warn-if-update-available": "^3.0.11",
66
+ "@oclif/core": "^3.26.4",
67
+ "@oclif/plugin-help": "^6.0.21",
68
+ "@oclif/plugin-not-found": "^3.1.4",
69
+ "@oclif/plugin-warn-if-update-available": "^3.0.15",
70
70
  "@rollup/plugin-typescript": "^11.1.6",
71
- dotenv: "^16.4.4",
72
- inquirer: "^9.2.14",
71
+ dotenv: "^16.4.5",
72
+ inquirer: "^9.2.19",
73
73
  ora: "^8.0.1"
74
74
  };
75
75
  var devDependencies = {
76
76
  "@changesets/cli": "^2.27.1",
77
- "@journeyapps-platform/powersync-sync-rules": "^0.16.7",
78
- "@journeyapps-platform/powersync-types": "^0.16.7",
79
- "@journeyapps-platform/sdk-accounts-hub": "^5.1.0",
77
+ "@journeyapps-platform/powersync-sync-rules": "^0.17.4",
78
+ "@journeyapps-platform/powersync-types": "^0.17.4",
79
+ "@journeyapps-platform/sdk-accounts-hub": "^6.0.0",
80
80
  "@journeyapps-platform/sdk-common": "^5.5.0",
81
- "@journeyapps-platform/sdk-powersync": "^0.16.7",
82
- "@journeyapps-platform/types-accounts-hub": "^5.1.0",
81
+ "@journeyapps-platform/sdk-powersync": "^0.17.4",
82
+ "@journeyapps-platform/types-accounts-hub": "^6.0.0",
83
83
  "@rollup/plugin-commonjs": "^25.0.7",
84
84
  "@rollup/plugin-json": "^6.1.0",
85
85
  "@rollup/plugin-node-resolve": "^15.2.3",
86
86
  "@types/inquirer": "^9.0.7",
87
- "@types/node": "^20.11.19",
88
- esbuild: "^0.20.1",
89
- eslint: "^8.56.0",
87
+ "@types/node": "^20.12.7",
88
+ esbuild: "^0.20.2",
89
+ eslint: "^8.57.0",
90
90
  "eslint-config-oclif": "^5",
91
- "eslint-config-oclif-typescript": "^3.0.48",
91
+ "eslint-config-oclif-typescript": "^3.1.5",
92
92
  "eslint-config-prettier": "^9.1.0",
93
93
  "eslint-plugin-prettier": "^5.1.3",
94
- glob: "^10.3.10",
95
- oclif: "^4.4.16",
94
+ glob: "^10.3.12",
95
+ oclif: "^4.8.5",
96
96
  prettier: "^3.2.5",
97
- rollup: "^4.12.0",
97
+ rollup: "^4.14.3",
98
98
  "rollup-plugin-esbuild": "^6.1.1",
99
99
  shx: "^0.3.4",
100
100
  "strip-ansi": "^7.1.0",
101
101
  "ts-node": "^10.9.2",
102
- typescript: "^5.3.3",
103
- vitest: "^1.3.0"
102
+ typescript: "^5.4.5",
103
+ vitest: "^1.5.0"
104
104
  };
105
105
  var packageJSON = {
106
106
  author: author,
@@ -127,10 +127,6 @@
127
127
  "name": "region",
128
128
  "hasDynamicHelp": false,
129
129
  "multiple": false,
130
- "options": [
131
- "US",
132
- "EU"
133
- ],
134
130
  "type": "option"
135
131
  },
136
132
  "useSupabaseAuth": {
@@ -542,5 +538,5 @@
542
538
  ]
543
539
  }
544
540
  },
545
- "version": "0.4.0"
541
+ "version": "0.4.1"
546
542
  }
package/package.json CHANGED
@@ -16,7 +16,7 @@
16
16
  "/dist",
17
17
  "/oclif.manifest.json"
18
18
  ],
19
- "version": "0.4.0",
19
+ "version": "0.4.1",
20
20
  "bugs": "https://github.com/powersync-ja/cli/issues",
21
21
  "types": "dist/index.d.ts",
22
22
  "exports": "./lib/index.js",
@@ -45,44 +45,44 @@
45
45
  },
46
46
  "repository": "powersync-ja/cli",
47
47
  "dependencies": {
48
- "@oclif/core": "^3.19.2",
49
- "@oclif/plugin-help": "^6.0.13",
50
- "@oclif/plugin-not-found": "^3.0.10",
51
- "@oclif/plugin-warn-if-update-available": "^3.0.11",
48
+ "@oclif/core": "^3.26.4",
49
+ "@oclif/plugin-help": "^6.0.21",
50
+ "@oclif/plugin-not-found": "^3.1.4",
51
+ "@oclif/plugin-warn-if-update-available": "^3.0.15",
52
52
  "@rollup/plugin-typescript": "^11.1.6",
53
- "dotenv": "^16.4.4",
54
- "inquirer": "^9.2.14",
53
+ "dotenv": "^16.4.5",
54
+ "inquirer": "^9.2.19",
55
55
  "ora": "^8.0.1"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@changesets/cli": "^2.27.1",
59
- "@journeyapps-platform/powersync-sync-rules": "^0.16.7",
60
- "@journeyapps-platform/powersync-types": "^0.16.7",
61
- "@journeyapps-platform/sdk-accounts-hub": "^5.1.0",
59
+ "@journeyapps-platform/powersync-sync-rules": "^0.17.4",
60
+ "@journeyapps-platform/powersync-types": "^0.17.4",
61
+ "@journeyapps-platform/sdk-accounts-hub": "^6.0.0",
62
62
  "@journeyapps-platform/sdk-common": "^5.5.0",
63
- "@journeyapps-platform/sdk-powersync": "^0.16.7",
64
- "@journeyapps-platform/types-accounts-hub": "^5.1.0",
63
+ "@journeyapps-platform/sdk-powersync": "^0.17.4",
64
+ "@journeyapps-platform/types-accounts-hub": "^6.0.0",
65
65
  "@rollup/plugin-commonjs": "^25.0.7",
66
66
  "@rollup/plugin-json": "^6.1.0",
67
67
  "@rollup/plugin-node-resolve": "^15.2.3",
68
68
  "@types/inquirer": "^9.0.7",
69
- "@types/node": "^20.11.19",
70
- "esbuild": "^0.20.1",
71
- "eslint": "^8.56.0",
69
+ "@types/node": "^20.12.7",
70
+ "esbuild": "^0.20.2",
71
+ "eslint": "^8.57.0",
72
72
  "eslint-config-oclif": "^5",
73
- "eslint-config-oclif-typescript": "^3.0.48",
73
+ "eslint-config-oclif-typescript": "^3.1.5",
74
74
  "eslint-config-prettier": "^9.1.0",
75
75
  "eslint-plugin-prettier": "^5.1.3",
76
- "glob": "^10.3.10",
77
- "oclif": "^4.4.16",
76
+ "glob": "^10.3.12",
77
+ "oclif": "^4.8.5",
78
78
  "prettier": "^3.2.5",
79
- "rollup": "^4.12.0",
79
+ "rollup": "^4.14.3",
80
80
  "rollup-plugin-esbuild": "^6.1.1",
81
81
  "shx": "^0.3.4",
82
82
  "strip-ansi": "^7.1.0",
83
83
  "ts-node": "^10.9.2",
84
- "typescript": "^5.3.3",
85
- "vitest": "^1.3.0"
84
+ "typescript": "^5.4.5",
85
+ "vitest": "^1.5.0"
86
86
  },
87
87
  "scripts": {
88
88
  "build": "pnpm build:oclif-commands && pnpm bundle:powersync-deps && ./combine-bundle-and-build.sh && pnpm readme",