powersync 0.3.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 +88 -74
- package/dist/commands/init.js +12 -12
- package/dist/commands/instance/create.js +3 -3
- package/dist/commands/instance/status.d.ts +1 -1
- package/dist/commands/instance/status.js +9 -9
- package/dist/commands/instance/sync-rules/deploy.js +1 -1
- package/dist/commands/instance/sync-rules/generate-schema.js +1 -1
- package/dist/commands/instance/sync-rules/validate.js +1 -1
- package/dist/commands/instances.js +4 -4
- package/dist/constants.d.ts +0 -1
- package/dist/constants.js +0 -1
- package/dist/service/accounts.client.js +72 -68
- package/dist/service/powersync.client.js +102 -90
- package/dist/service/utils.js +27 -27
- package/dist/utils.js +1 -1
- package/oclif.manifest.json +17 -21
- package/package.json +23 -23
|
@@ -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.
|
|
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
|
|
11359
|
+
let optionPaths = [dotenvPath]; // default, look for .env
|
|
11349
11360
|
if (options && options.path) {
|
|
11350
11361
|
if (!Array.isArray(options.path)) {
|
|
11351
|
-
|
|
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
|
-
|
|
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
|
|
11374
|
-
|
|
11375
|
-
|
|
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
|
|
11378
|
-
DotenvModule.populate(parsed, singleFileParsed, options);
|
|
11379
|
-
}
|
|
11378
|
+
const parsed = DotenvModule.parse(fs.readFileSync(path, { encoding }));
|
|
11380
11379
|
|
|
11381
|
-
|
|
11382
|
-
|
|
11383
|
-
|
|
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
|
-
|
|
11387
|
-
|
|
11388
|
-
|
|
11389
|
-
|
|
11390
|
-
|
|
11391
|
-
|
|
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.
|
|
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";
|
|
@@ -11555,53 +11562,53 @@ var scripts = {
|
|
|
11555
11562
|
postpack: "shx rm -f oclif.manifest.json",
|
|
11556
11563
|
posttest: "pnpm run lint",
|
|
11557
11564
|
prepack: "pnpm run build && oclif manifest && oclif readme",
|
|
11558
|
-
readme: "oclif readme",
|
|
11565
|
+
readme: "oclif readme && ./update-readme.sh",
|
|
11559
11566
|
prepare: "pnpm run build",
|
|
11560
11567
|
test: "vitest",
|
|
11561
11568
|
release: "pnpm build && pnpm changeset publish",
|
|
11562
11569
|
prettier: "prettier --write .",
|
|
11563
|
-
version: "
|
|
11570
|
+
version: "pnpm run readme && git add README.md",
|
|
11564
11571
|
"pack:tarballs": "oclif pack tarballs --parallel"
|
|
11565
11572
|
};
|
|
11566
11573
|
var dependencies$1 = {
|
|
11567
|
-
"@oclif/core": "^3.
|
|
11568
|
-
"@oclif/plugin-help": "^6.0.
|
|
11569
|
-
"@oclif/plugin-not-found": "^3.
|
|
11570
|
-
"@oclif/plugin-warn-if-update-available": "^3.0.
|
|
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.
|
|
11573
|
-
inquirer: "^9.2.
|
|
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.
|
|
11579
|
-
"@journeyapps-platform/powersync-types": "^0.
|
|
11580
|
-
"@journeyapps-platform/sdk-accounts-hub": "^
|
|
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.
|
|
11583
|
-
"@journeyapps-platform/types-accounts-hub": "^
|
|
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.
|
|
11589
|
-
esbuild: "^0.20.
|
|
11590
|
-
eslint: "^8.
|
|
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.
|
|
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.
|
|
11596
|
-
oclif: "^4.
|
|
11602
|
+
glob: "^10.3.12",
|
|
11603
|
+
oclif: "^4.8.5",
|
|
11597
11604
|
prettier: "^3.2.5",
|
|
11598
|
-
rollup: "^4.
|
|
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.
|
|
11604
|
-
vitest: "^1.
|
|
11610
|
+
typescript: "^5.4.5",
|
|
11611
|
+
vitest: "^1.5.0"
|
|
11605
11612
|
};
|
|
11606
11613
|
var packageJSON = {
|
|
11607
11614
|
author: author,
|
|
@@ -11633,9 +11640,9 @@ const generateHeader = (bearerToken) => {
|
|
|
11633
11640
|
"user-agent": `${APP_NAME}/${packageJSON.version}`
|
|
11634
11641
|
};
|
|
11635
11642
|
};
|
|
11636
|
-
const
|
|
11637
|
-
if (!
|
|
11638
|
-
throw new Error("No
|
|
11643
|
+
const checkProjectId = (projectId) => {
|
|
11644
|
+
if (!projectId)
|
|
11645
|
+
throw new Error("No project id found");
|
|
11639
11646
|
};
|
|
11640
11647
|
const checkOrgId = (orgId) => {
|
|
11641
11648
|
if (!orgId)
|
|
@@ -37498,13 +37505,13 @@ const schemaGenerators = {
|
|
|
37498
37505
|
};
|
|
37499
37506
|
|
|
37500
37507
|
config_1({ path: ENV_FILE_PATH });
|
|
37501
|
-
const {
|
|
37508
|
+
const { AUTH_TOKEN, INSTANCE_ID, ORG_ID, PROJECT_ID } = process.env;
|
|
37502
37509
|
var ENV_VARIABLES;
|
|
37503
37510
|
(function(ENV_VARIABLES2) {
|
|
37504
|
-
ENV_VARIABLES2["APP_ID"] = "APP_ID";
|
|
37505
37511
|
ENV_VARIABLES2["AUTH_TOKEN"] = "AUTH_TOKEN";
|
|
37506
37512
|
ENV_VARIABLES2["INSTANCE_ID"] = "INSTANCE_ID";
|
|
37507
37513
|
ENV_VARIABLES2["ORG_ID"] = "ORG_ID";
|
|
37514
|
+
ENV_VARIABLES2["PROJECT_ID"] = "PROJECT_ID";
|
|
37508
37515
|
})(ENV_VARIABLES || (ENV_VARIABLES = {}));
|
|
37509
37516
|
const powerSyncClient = ({ authToken } = {}) => {
|
|
37510
37517
|
const finalToken = authToken || AUTH_TOKEN;
|
|
@@ -37517,43 +37524,48 @@ 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);
|
|
37523
37535
|
return powerSyncClient().listInstances({
|
|
37524
|
-
app_id:
|
|
37536
|
+
app_id: PROJECT_ID,
|
|
37525
37537
|
org_id: ORG_ID
|
|
37526
37538
|
});
|
|
37527
37539
|
};
|
|
37528
37540
|
const getInstanceConfig = async () => {
|
|
37529
37541
|
checkOrgId(ORG_ID);
|
|
37530
|
-
|
|
37542
|
+
checkProjectId(PROJECT_ID);
|
|
37531
37543
|
checkInstanceId(INSTANCE_ID);
|
|
37532
37544
|
return powerSyncClient().getInstanceConfig({
|
|
37533
|
-
app_id:
|
|
37545
|
+
app_id: PROJECT_ID,
|
|
37534
37546
|
id: INSTANCE_ID,
|
|
37535
37547
|
org_id: ORG_ID
|
|
37536
37548
|
});
|
|
37537
37549
|
};
|
|
37538
|
-
const getInstanceDiagnostics = async ({
|
|
37539
|
-
const
|
|
37550
|
+
const getInstanceDiagnostics = async ({ authToken, instanceId, orgId, projectId }) => {
|
|
37551
|
+
const finalProjectId = projectId || PROJECT_ID;
|
|
37540
37552
|
const finalInstanceId = instanceId || INSTANCE_ID;
|
|
37541
37553
|
const finalOrgId = orgId || ORG_ID;
|
|
37542
37554
|
checkOrgId(finalOrgId);
|
|
37543
|
-
|
|
37555
|
+
checkProjectId(finalProjectId);
|
|
37544
37556
|
checkInstanceId(finalInstanceId);
|
|
37545
37557
|
return powerSyncClient({ authToken }).getInstanceDiagnostics({
|
|
37546
|
-
app_id:
|
|
37558
|
+
app_id: finalProjectId,
|
|
37547
37559
|
id: finalInstanceId,
|
|
37548
37560
|
org_id: finalOrgId
|
|
37549
37561
|
});
|
|
37550
37562
|
};
|
|
37551
37563
|
const getInstanceSchema = async () => {
|
|
37552
37564
|
checkOrgId(ORG_ID);
|
|
37553
|
-
|
|
37565
|
+
checkProjectId(PROJECT_ID);
|
|
37554
37566
|
checkInstanceId(INSTANCE_ID);
|
|
37555
37567
|
return powerSyncClient().getInstanceSchema({
|
|
37556
|
-
app_id:
|
|
37568
|
+
app_id: PROJECT_ID,
|
|
37557
37569
|
id: INSTANCE_ID,
|
|
37558
37570
|
org_id: ORG_ID
|
|
37559
37571
|
});
|
|
@@ -37561,57 +37573,57 @@ const getInstanceSchema = async () => {
|
|
|
37561
37573
|
const getInstanceStatus = async (instanceId) => {
|
|
37562
37574
|
const finalInstanceId = instanceId || INSTANCE_ID;
|
|
37563
37575
|
checkOrgId(ORG_ID);
|
|
37564
|
-
|
|
37576
|
+
checkProjectId(PROJECT_ID);
|
|
37565
37577
|
checkInstanceId(finalInstanceId);
|
|
37566
37578
|
return powerSyncClient().getInstanceStatus({
|
|
37567
|
-
app_id:
|
|
37579
|
+
app_id: PROJECT_ID,
|
|
37568
37580
|
id: instanceId ?? INSTANCE_ID,
|
|
37569
37581
|
org_id: ORG_ID
|
|
37570
37582
|
});
|
|
37571
37583
|
};
|
|
37572
37584
|
const destroyInstance = async () => {
|
|
37573
37585
|
checkOrgId(ORG_ID);
|
|
37574
|
-
|
|
37586
|
+
checkProjectId(PROJECT_ID);
|
|
37575
37587
|
checkInstanceId(INSTANCE_ID);
|
|
37576
37588
|
return powerSyncClient().destroyInstance({
|
|
37577
|
-
app_id:
|
|
37589
|
+
app_id: PROJECT_ID,
|
|
37578
37590
|
id: INSTANCE_ID,
|
|
37579
37591
|
org_id: ORG_ID
|
|
37580
37592
|
});
|
|
37581
37593
|
};
|
|
37582
37594
|
const deactivateInstance = async () => {
|
|
37583
37595
|
checkOrgId(ORG_ID);
|
|
37584
|
-
|
|
37596
|
+
checkProjectId(PROJECT_ID);
|
|
37585
37597
|
checkInstanceId(INSTANCE_ID);
|
|
37586
37598
|
return powerSyncClient().deactivateInstance({
|
|
37587
|
-
app_id:
|
|
37599
|
+
app_id: PROJECT_ID,
|
|
37588
37600
|
id: INSTANCE_ID,
|
|
37589
37601
|
org_id: ORG_ID
|
|
37590
37602
|
});
|
|
37591
37603
|
};
|
|
37592
37604
|
const createInstance = async (name) => {
|
|
37593
37605
|
checkOrgId(ORG_ID);
|
|
37594
|
-
|
|
37606
|
+
checkProjectId(PROJECT_ID);
|
|
37595
37607
|
return powerSyncClient().createInstance({
|
|
37596
|
-
app_id:
|
|
37608
|
+
app_id: PROJECT_ID,
|
|
37597
37609
|
name,
|
|
37598
37610
|
org_id: ORG_ID
|
|
37599
37611
|
});
|
|
37600
37612
|
};
|
|
37601
37613
|
const testConnection = async (connection) => {
|
|
37602
37614
|
checkOrgId(ORG_ID);
|
|
37603
|
-
|
|
37615
|
+
checkProjectId(PROJECT_ID);
|
|
37604
37616
|
return powerSyncClient().testConnection({
|
|
37605
|
-
app_id:
|
|
37617
|
+
app_id: PROJECT_ID,
|
|
37606
37618
|
connection,
|
|
37607
37619
|
org_id: ORG_ID
|
|
37608
37620
|
});
|
|
37609
37621
|
};
|
|
37610
37622
|
const deployInstance = async (config, instanceId) => {
|
|
37611
37623
|
checkOrgId(ORG_ID);
|
|
37612
|
-
|
|
37624
|
+
checkProjectId(PROJECT_ID);
|
|
37613
37625
|
return powerSyncClient().deployInstance({
|
|
37614
|
-
app_id:
|
|
37626
|
+
app_id: PROJECT_ID,
|
|
37615
37627
|
config,
|
|
37616
37628
|
id: instanceId,
|
|
37617
37629
|
org_id: ORG_ID
|
|
@@ -37619,10 +37631,10 @@ const deployInstance = async (config, instanceId) => {
|
|
|
37619
37631
|
};
|
|
37620
37632
|
const validateSyncRules = async (syncRules) => {
|
|
37621
37633
|
checkOrgId(ORG_ID);
|
|
37622
|
-
|
|
37634
|
+
checkProjectId(PROJECT_ID);
|
|
37623
37635
|
checkInstanceId(INSTANCE_ID);
|
|
37624
37636
|
return powerSyncClient().validateSyncRules({
|
|
37625
|
-
app_id:
|
|
37637
|
+
app_id: PROJECT_ID,
|
|
37626
37638
|
id: INSTANCE_ID,
|
|
37627
37639
|
org_id: ORG_ID,
|
|
37628
37640
|
sync_rules: syncRules
|
|
@@ -37630,7 +37642,7 @@ const validateSyncRules = async (syncRules) => {
|
|
|
37630
37642
|
};
|
|
37631
37643
|
const deploySyncRules = async (syncRules) => {
|
|
37632
37644
|
checkOrgId(ORG_ID);
|
|
37633
|
-
|
|
37645
|
+
checkProjectId(PROJECT_ID);
|
|
37634
37646
|
checkInstanceId(INSTANCE_ID);
|
|
37635
37647
|
const config = await getInstanceConfig();
|
|
37636
37648
|
if (!config.config) {
|
|
@@ -37640,7 +37652,7 @@ const deploySyncRules = async (syncRules) => {
|
|
|
37640
37652
|
throw new Error("No sync rules found");
|
|
37641
37653
|
}
|
|
37642
37654
|
return powerSyncClient().deployInstance({
|
|
37643
|
-
app_id:
|
|
37655
|
+
app_id: PROJECT_ID,
|
|
37644
37656
|
config: config.config,
|
|
37645
37657
|
id: INSTANCE_ID,
|
|
37646
37658
|
org_id: ORG_ID,
|
|
@@ -37649,10 +37661,10 @@ const deploySyncRules = async (syncRules) => {
|
|
|
37649
37661
|
};
|
|
37650
37662
|
const processSyncRules = async () => {
|
|
37651
37663
|
checkOrgId(ORG_ID);
|
|
37652
|
-
|
|
37664
|
+
checkProjectId(PROJECT_ID);
|
|
37653
37665
|
checkInstanceId(INSTANCE_ID);
|
|
37654
37666
|
powerSyncClient().reprocessSyncRules({
|
|
37655
|
-
app_id:
|
|
37667
|
+
app_id: PROJECT_ID,
|
|
37656
37668
|
id: INSTANCE_ID,
|
|
37657
37669
|
org_id: ORG_ID
|
|
37658
37670
|
});
|
|
@@ -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 };
|
package/dist/service/utils.js
CHANGED
|
@@ -18,7 +18,7 @@ var files = [
|
|
|
18
18
|
"/dist",
|
|
19
19
|
"/oclif.manifest.json"
|
|
20
20
|
];
|
|
21
|
-
var version = "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";
|
|
@@ -54,53 +54,53 @@ var scripts = {
|
|
|
54
54
|
postpack: "shx rm -f oclif.manifest.json",
|
|
55
55
|
posttest: "pnpm run lint",
|
|
56
56
|
prepack: "pnpm run build && oclif manifest && oclif readme",
|
|
57
|
-
readme: "oclif readme",
|
|
57
|
+
readme: "oclif readme && ./update-readme.sh",
|
|
58
58
|
prepare: "pnpm run build",
|
|
59
59
|
test: "vitest",
|
|
60
60
|
release: "pnpm build && pnpm changeset publish",
|
|
61
61
|
prettier: "prettier --write .",
|
|
62
|
-
version: "
|
|
62
|
+
version: "pnpm run readme && git add README.md",
|
|
63
63
|
"pack:tarballs": "oclif pack tarballs --parallel"
|
|
64
64
|
};
|
|
65
65
|
var dependencies = {
|
|
66
|
-
"@oclif/core": "^3.
|
|
67
|
-
"@oclif/plugin-help": "^6.0.
|
|
68
|
-
"@oclif/plugin-not-found": "^3.
|
|
69
|
-
"@oclif/plugin-warn-if-update-available": "^3.0.
|
|
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.
|
|
72
|
-
inquirer: "^9.2.
|
|
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.
|
|
78
|
-
"@journeyapps-platform/powersync-types": "^0.
|
|
79
|
-
"@journeyapps-platform/sdk-accounts-hub": "^
|
|
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.
|
|
82
|
-
"@journeyapps-platform/types-accounts-hub": "^
|
|
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.
|
|
88
|
-
esbuild: "^0.20.
|
|
89
|
-
eslint: "^8.
|
|
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.
|
|
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.
|
|
95
|
-
oclif: "^4.
|
|
94
|
+
glob: "^10.3.12",
|
|
95
|
+
oclif: "^4.8.5",
|
|
96
96
|
prettier: "^3.2.5",
|
|
97
|
-
rollup: "^4.
|
|
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.
|
|
103
|
-
vitest: "^1.
|
|
102
|
+
typescript: "^5.4.5",
|
|
103
|
+
vitest: "^1.5.0"
|
|
104
104
|
};
|
|
105
105
|
var packageJSON = {
|
|
106
106
|
author: author,
|
|
@@ -135,9 +135,9 @@ const generateHeader = (bearerToken) => {
|
|
|
135
135
|
"user-agent": `${APP_NAME}/${packageJSON.version}`
|
|
136
136
|
};
|
|
137
137
|
};
|
|
138
|
-
const
|
|
139
|
-
if (!
|
|
140
|
-
throw new Error("No
|
|
138
|
+
const checkProjectId = (projectId) => {
|
|
139
|
+
if (!projectId)
|
|
140
|
+
throw new Error("No project id found");
|
|
141
141
|
};
|
|
142
142
|
const checkOrgId = (orgId) => {
|
|
143
143
|
if (!orgId)
|
|
@@ -148,4 +148,4 @@ const checkInstanceId = (instanceId) => {
|
|
|
148
148
|
throw new Error("No instance id found");
|
|
149
149
|
};
|
|
150
150
|
|
|
151
|
-
export {
|
|
151
|
+
export { checkInstanceId, checkOrgId, checkProjectId, generateHeader };
|
package/dist/utils.js
CHANGED
|
@@ -4,7 +4,7 @@ import { ENV_FILE_PATH } from './constants.js';
|
|
|
4
4
|
import { ENV_VARIABLES } from './service/powersync.client.js';
|
|
5
5
|
// Add cliName as argument because we don't have access to this.config.bin in this file
|
|
6
6
|
export const checkForValidEnvFile = (cliName, requiresInstanceId = false) => {
|
|
7
|
-
const requiredProperties = [ENV_VARIABLES.
|
|
7
|
+
const requiredProperties = [ENV_VARIABLES.PROJECT_ID, ENV_VARIABLES.AUTH_TOKEN, ENV_VARIABLES.ORG_ID];
|
|
8
8
|
const missingProperties = requiredProperties.filter((prop) => !process.env[prop]);
|
|
9
9
|
if (!fs.existsSync(ENV_FILE_PATH) || missingProperties.length > 0) {
|
|
10
10
|
ux.error(`CLI has not been initialized. Please run ${green(`"${cliName} init"`)}.`, { exit: 1 });
|
package/oclif.manifest.json
CHANGED
|
@@ -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": {
|
|
@@ -324,23 +320,15 @@
|
|
|
324
320
|
"instance:status": {
|
|
325
321
|
"aliases": [],
|
|
326
322
|
"args": {},
|
|
327
|
-
"description": "View the status of the current instance.",
|
|
323
|
+
"description": "View the status of the current instance. View the status of a different instance by using flags.",
|
|
328
324
|
"examples": [
|
|
329
325
|
"<%= config.bin %> <%= command.id %>",
|
|
330
|
-
"<%= config.bin %> <%= command.id %> --orgId=1234 --
|
|
326
|
+
"<%= config.bin %> <%= command.id %> --orgId=1234 --projectId=1234 --instanceId=1234 --authToken=1234"
|
|
331
327
|
],
|
|
332
328
|
"flags": {
|
|
333
|
-
"appId": {
|
|
334
|
-
"char": "a",
|
|
335
|
-
"description": "app id to use",
|
|
336
|
-
"name": "appId",
|
|
337
|
-
"hasDynamicHelp": false,
|
|
338
|
-
"multiple": false,
|
|
339
|
-
"type": "option"
|
|
340
|
-
},
|
|
341
329
|
"authToken": {
|
|
342
330
|
"char": "t",
|
|
343
|
-
"description": "auth token
|
|
331
|
+
"description": "Override current auth token.",
|
|
344
332
|
"name": "authToken",
|
|
345
333
|
"hasDynamicHelp": false,
|
|
346
334
|
"multiple": false,
|
|
@@ -348,7 +336,7 @@
|
|
|
348
336
|
},
|
|
349
337
|
"instanceId": {
|
|
350
338
|
"char": "i",
|
|
351
|
-
"description": "instance
|
|
339
|
+
"description": "Override current instance by providing the ID of a different instance.",
|
|
352
340
|
"name": "instanceId",
|
|
353
341
|
"hasDynamicHelp": false,
|
|
354
342
|
"multiple": false,
|
|
@@ -356,11 +344,19 @@
|
|
|
356
344
|
},
|
|
357
345
|
"orgId": {
|
|
358
346
|
"char": "o",
|
|
359
|
-
"description": "
|
|
347
|
+
"description": "Override current organization by providing the ID of a different organization.",
|
|
360
348
|
"name": "orgId",
|
|
361
349
|
"hasDynamicHelp": false,
|
|
362
350
|
"multiple": false,
|
|
363
351
|
"type": "option"
|
|
352
|
+
},
|
|
353
|
+
"projectId": {
|
|
354
|
+
"char": "p",
|
|
355
|
+
"description": "Override current project by providing the ID of a different project.",
|
|
356
|
+
"name": "projectId",
|
|
357
|
+
"hasDynamicHelp": false,
|
|
358
|
+
"multiple": false,
|
|
359
|
+
"type": "option"
|
|
364
360
|
}
|
|
365
361
|
},
|
|
366
362
|
"hasDynamicHelp": false,
|
|
@@ -414,7 +410,7 @@
|
|
|
414
410
|
"instance:sync-rules:deploy": {
|
|
415
411
|
"aliases": [],
|
|
416
412
|
"args": {},
|
|
417
|
-
"description": "Deploy sync rules from a local sync rules file to the current instance.",
|
|
413
|
+
"description": "Deploy sync rules from a local sync rules config file to the current instance.",
|
|
418
414
|
"examples": [
|
|
419
415
|
"<%= config.bin %> <%= command.id %>",
|
|
420
416
|
"<%= config.bin %> <%= command.id %> --filePath path/to/file",
|
|
@@ -458,7 +454,7 @@
|
|
|
458
454
|
"instance:sync-rules:generate-schema": {
|
|
459
455
|
"aliases": [],
|
|
460
456
|
"args": {},
|
|
461
|
-
"description": "Generate schema in your language from your sync rules file.",
|
|
457
|
+
"description": "Generate schema in your language from your sync rules config file.",
|
|
462
458
|
"examples": [
|
|
463
459
|
"<%= config.bin %> <%= command.id %>",
|
|
464
460
|
"<%= config.bin %> <%= command.id %> --filePath path/to/file",
|
|
@@ -507,7 +503,7 @@
|
|
|
507
503
|
"instance:sync-rules:validate": {
|
|
508
504
|
"aliases": [],
|
|
509
505
|
"args": {},
|
|
510
|
-
"description": "Validate sync rules from a local sync rules file.",
|
|
506
|
+
"description": "Validate sync rules from a local sync rules config file.",
|
|
511
507
|
"examples": [
|
|
512
508
|
"<%= config.bin %> <%= command.id %>",
|
|
513
509
|
"<%= config.bin %> <%= command.id %> --filePath path/to/file",
|
|
@@ -542,5 +538,5 @@
|
|
|
542
538
|
]
|
|
543
539
|
}
|
|
544
540
|
},
|
|
545
|
-
"version": "0.
|
|
541
|
+
"version": "0.4.1"
|
|
546
542
|
}
|