@powersync/cli-core 0.9.6 → 0.10.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/api/validate-sync-config.d.ts +40 -23
- package/dist/api/validate-sync-config.js +124 -69
- package/dist/api/validate-sync-config.js.map +1 -1
- package/dist/command-types/CloudInstanceCommand.d.ts +3 -3
- package/dist/command-types/CloudInstanceCommand.js +29 -30
- package/dist/command-types/CloudInstanceCommand.js.map +1 -1
- package/dist/command-types/PowerSyncCommand.js +2 -2
- package/dist/command-types/PowerSyncCommand.js.map +1 -1
- package/dist/command-types/SharedInstanceCommand.d.ts +2 -2
- package/dist/command-types/SharedInstanceCommand.js +31 -26
- package/dist/command-types/SharedInstanceCommand.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/utils/ensure-service-type.js +1 -1
- package/dist/utils/ensure-service-type.js.map +1 -1
- package/dist/utils/errors.d.ts +4 -0
- package/dist/utils/errors.js +8 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/object-id.d.ts +1 -0
- package/dist/utils/object-id.js +5 -0
- package/dist/utils/object-id.js.map +1 -1
- package/dist/utils/resolve-cloud-instance-link.d.ts +14 -0
- package/dist/utils/resolve-cloud-instance-link.js +50 -0
- package/dist/utils/resolve-cloud-instance-link.js.map +1 -0
- package/package.json +4 -4
|
@@ -11,10 +11,6 @@ import type { SelfHostedProject } from '../command-types/SelfHostedInstanceComma
|
|
|
11
11
|
export type ValidationTestRunResult = {
|
|
12
12
|
errors?: string[];
|
|
13
13
|
passed: boolean;
|
|
14
|
-
/**
|
|
15
|
-
* Output containing errors and warnings in a pretty human-readable format.
|
|
16
|
-
*/
|
|
17
|
-
prettyOutput?: string;
|
|
18
14
|
warnings?: string[];
|
|
19
15
|
};
|
|
20
16
|
/**
|
|
@@ -33,11 +29,10 @@ export type ValidationTestResult = ValidationTestRunResult & {
|
|
|
33
29
|
name: string;
|
|
34
30
|
};
|
|
35
31
|
/**
|
|
36
|
-
* Sync-config
|
|
32
|
+
* Sync-config validation as reported by CLI commands. Detailed editor metadata stays on
|
|
33
|
+
* {@link SyncValidationError}; command output only needs display strings.
|
|
37
34
|
*/
|
|
38
|
-
export type SyncValidationTestRunResult = ValidationTestRunResult
|
|
39
|
-
diagnostics: SyncDiagnostic[];
|
|
40
|
-
};
|
|
35
|
+
export type SyncValidationTestRunResult = ValidationTestRunResult;
|
|
41
36
|
/**
|
|
42
37
|
* Aggregate result for the full validation test suite.
|
|
43
38
|
*/
|
|
@@ -46,31 +41,53 @@ export type ValidationResult = {
|
|
|
46
41
|
tests: ValidationTestResult[];
|
|
47
42
|
};
|
|
48
43
|
/**
|
|
49
|
-
*
|
|
44
|
+
* Position in a sync config file.
|
|
45
|
+
*/
|
|
46
|
+
export type SyncConfigPosition = {
|
|
47
|
+
column: number;
|
|
48
|
+
line: number;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Start and end location span for a sync config validation issue.
|
|
50
52
|
*/
|
|
51
|
-
export type
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
export type SyncConfigLocation = {
|
|
54
|
+
end: SyncConfigPosition;
|
|
55
|
+
start: SyncConfigPosition;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Raw response returned from the validation call made to a PowerSync instance.
|
|
59
|
+
*/
|
|
60
|
+
export type SyncErrorResponse = routes.ValidateSyncRulesResponse['errors'][number];
|
|
61
|
+
/**
|
|
62
|
+
* Sync validation error or warning enriched with editor and display metadata.
|
|
63
|
+
*/
|
|
64
|
+
export type SyncValidationError = SyncErrorResponse & {
|
|
65
|
+
/**
|
|
66
|
+
* Original message plus source line and caret when a sync config location is available.
|
|
67
|
+
* CLI output adds the line/column prefix separately so editor panels can render location once.
|
|
68
|
+
*/
|
|
69
|
+
enrichedMessage: string;
|
|
70
|
+
/**
|
|
71
|
+
* Line and column range in the sync config file. This is distinct from the raw API `location`,
|
|
72
|
+
* which uses character offsets.
|
|
73
|
+
*/
|
|
74
|
+
syncConfigLocation?: SyncConfigLocation;
|
|
58
75
|
};
|
|
59
76
|
/**
|
|
60
77
|
* Enhanced result of sync config validation.
|
|
61
78
|
*/
|
|
62
|
-
export type SyncValidation = routes.ValidateSyncRulesResponse & {
|
|
63
|
-
|
|
79
|
+
export type SyncValidation = Omit<routes.ValidateSyncRulesResponse, 'errors'> & {
|
|
80
|
+
errors: SyncValidationError[];
|
|
64
81
|
};
|
|
65
|
-
export declare function
|
|
82
|
+
export declare function validateCloudSyncConfig(input: {
|
|
66
83
|
linked: ResolvedCloudCLIConfig;
|
|
67
|
-
|
|
84
|
+
syncConfigContent: string;
|
|
68
85
|
}): Promise<SyncValidation>;
|
|
69
|
-
export declare function
|
|
86
|
+
export declare function validateSelfHostedSyncConfig(input: {
|
|
70
87
|
linked: ResolvedSelfHostedCLIConfig;
|
|
71
|
-
|
|
88
|
+
syncConfigContent: string;
|
|
72
89
|
}): Promise<SyncValidation>;
|
|
73
90
|
export declare function validateProjectSyncConfig(input: {
|
|
74
91
|
linkedProject: CloudProject | SelfHostedProject;
|
|
75
|
-
|
|
92
|
+
syncConfigContent: string;
|
|
76
93
|
}): Promise<SyncValidation>;
|
|
@@ -1,104 +1,159 @@
|
|
|
1
1
|
import { createCloudClient } from '../clients/create-cloud-client.js';
|
|
2
2
|
import { createSelfHostedClient } from '../clients/create-self-hosted-client.js';
|
|
3
|
-
const
|
|
3
|
+
const EMPTY_SYNC_CONFIG_ERROR = {
|
|
4
4
|
connections: [],
|
|
5
5
|
errors: [
|
|
6
6
|
{
|
|
7
|
+
enrichedMessage: 'No sync config content was provided.',
|
|
7
8
|
level: 'fatal',
|
|
8
9
|
message: 'No sync config content was provided.'
|
|
9
10
|
}
|
|
10
11
|
]
|
|
11
12
|
};
|
|
12
|
-
function
|
|
13
|
-
return error instanceof Error ? error.message : String(error);
|
|
14
|
-
}
|
|
15
|
-
function toValidationRequestError(type, cause) {
|
|
16
|
-
const causeMessage = getErrorMessage(cause);
|
|
17
|
-
if (type === 'cloud') {
|
|
18
|
-
return new Error(`Could not validate sync rules against the cloud instance. Deploy the instance first with "powersync deploy service-config" and try again.\n${causeMessage}`);
|
|
19
|
-
}
|
|
20
|
-
return new Error(`Could not validate sync rules against the self-hosted instance. Ensure the instance is linked and running, then try again.\n${causeMessage}`);
|
|
21
|
-
}
|
|
22
|
-
function offsetToLineColumn(text, offset) {
|
|
23
|
-
const safeOffset = typeof offset === 'number' ? Math.max(0, Math.min(offset, text.length)) : 0;
|
|
24
|
-
let line = 1;
|
|
25
|
-
let column = 1;
|
|
26
|
-
for (let i = 0; i < safeOffset; i++) {
|
|
27
|
-
if (text.codePointAt(i) === 10) {
|
|
28
|
-
line += 1;
|
|
29
|
-
column = 1;
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
column += 1;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return { column, line };
|
|
36
|
-
}
|
|
37
|
-
function mapSyncDiagnostics(response, syncRulesContent) {
|
|
38
|
-
const topLevel = response.errors.map((error) => {
|
|
39
|
-
const start = offsetToLineColumn(syncRulesContent, error.location?.start_offset);
|
|
40
|
-
const end = offsetToLineColumn(syncRulesContent, error.location?.end_offset ?? error.location?.start_offset);
|
|
41
|
-
return {
|
|
42
|
-
endColumn: end.column,
|
|
43
|
-
endLine: end.line,
|
|
44
|
-
level: error.level,
|
|
45
|
-
message: error.message,
|
|
46
|
-
startColumn: start.column,
|
|
47
|
-
startLine: start.line
|
|
48
|
-
};
|
|
49
|
-
});
|
|
50
|
-
return topLevel;
|
|
51
|
-
}
|
|
52
|
-
function toSyncValidation(response, syncRulesContent) {
|
|
53
|
-
return {
|
|
54
|
-
...response,
|
|
55
|
-
diagnostics: mapSyncDiagnostics(response, syncRulesContent)
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
export async function validateCloudSyncRules(input) {
|
|
59
|
-
if (!input.syncRulesContent.trim()) {
|
|
60
|
-
return toSyncValidation(EMPTY_SYNC_RULES_ERROR, input.syncRulesContent);
|
|
61
|
-
}
|
|
13
|
+
export async function validateCloudSyncConfig(input) {
|
|
62
14
|
try {
|
|
63
15
|
const client = createCloudClient();
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
16
|
+
return enrichSyncValidationResult({
|
|
17
|
+
result: await client.validateSyncRules({
|
|
18
|
+
app_id: input.linked.project_id,
|
|
19
|
+
id: input.linked.instance_id,
|
|
20
|
+
org_id: input.linked.org_id,
|
|
21
|
+
sync_rules: input.syncConfigContent
|
|
22
|
+
}),
|
|
23
|
+
syncConfigContent: input.syncConfigContent
|
|
69
24
|
});
|
|
70
|
-
return toSyncValidation(response, input.syncRulesContent);
|
|
71
25
|
}
|
|
72
26
|
catch (error) {
|
|
73
|
-
|
|
27
|
+
return wrapSyncValidationError({
|
|
28
|
+
errorCause: error,
|
|
29
|
+
message: `Could not validate sync config against the cloud instance. Deploy the instance first with "powersync deploy service-config" and try again.`
|
|
30
|
+
});
|
|
74
31
|
}
|
|
75
32
|
}
|
|
76
|
-
export async function
|
|
77
|
-
if (!input.syncRulesContent.trim()) {
|
|
78
|
-
return toSyncValidation(EMPTY_SYNC_RULES_ERROR, input.syncRulesContent);
|
|
79
|
-
}
|
|
33
|
+
export async function validateSelfHostedSyncConfig(input) {
|
|
80
34
|
try {
|
|
81
35
|
const client = createSelfHostedClient({
|
|
82
36
|
apiKey: input.linked.api_key,
|
|
83
37
|
apiUrl: input.linked.api_url
|
|
84
38
|
});
|
|
85
|
-
|
|
86
|
-
|
|
39
|
+
return enrichSyncValidationResult({
|
|
40
|
+
result: await client.validate({ sync_rules: input.syncConfigContent }),
|
|
41
|
+
syncConfigContent: input.syncConfigContent
|
|
42
|
+
});
|
|
87
43
|
}
|
|
88
44
|
catch (error) {
|
|
89
|
-
|
|
45
|
+
return wrapSyncValidationError({
|
|
46
|
+
errorCause: error,
|
|
47
|
+
message: `Could not validate sync config against the self-hosted instance. Ensure the instance is linked and running, then try again.`
|
|
48
|
+
});
|
|
90
49
|
}
|
|
91
50
|
}
|
|
92
51
|
export async function validateProjectSyncConfig(input) {
|
|
52
|
+
if (!input.syncConfigContent.trim()) {
|
|
53
|
+
return EMPTY_SYNC_CONFIG_ERROR;
|
|
54
|
+
}
|
|
93
55
|
if (input.linkedProject.linked.type === 'cloud') {
|
|
94
|
-
return
|
|
56
|
+
return validateCloudSyncConfig({
|
|
95
57
|
linked: input.linkedProject.linked,
|
|
96
|
-
|
|
58
|
+
syncConfigContent: input.syncConfigContent
|
|
97
59
|
});
|
|
98
60
|
}
|
|
99
|
-
return
|
|
61
|
+
return validateSelfHostedSyncConfig({
|
|
100
62
|
linked: input.linkedProject.linked,
|
|
101
|
-
|
|
63
|
+
syncConfigContent: input.syncConfigContent
|
|
102
64
|
});
|
|
103
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Enriches a Sync config validation result by:
|
|
68
|
+
* - adding `syncConfigLocation` with line and column information when available
|
|
69
|
+
* - adding `enrichedMessage`, which includes source context for terminal and editor details display
|
|
70
|
+
*
|
|
71
|
+
* This keeps `message` raw for marker hover text while giving callers enough structured data
|
|
72
|
+
* to decide how to render line/column details.
|
|
73
|
+
*/
|
|
74
|
+
function enrichSyncValidationResult({ result, syncConfigContent }) {
|
|
75
|
+
return {
|
|
76
|
+
...result,
|
|
77
|
+
errors: result.errors.map((error) => {
|
|
78
|
+
const syncConfigLocation = getSyncConfigLocation({ error, syncConfigContent });
|
|
79
|
+
return {
|
|
80
|
+
...error,
|
|
81
|
+
enrichedMessage: formatSyncValidationMessage({
|
|
82
|
+
message: error.message,
|
|
83
|
+
syncConfigContent,
|
|
84
|
+
syncConfigLocation
|
|
85
|
+
}),
|
|
86
|
+
...(syncConfigLocation ? { syncConfigLocation } : {})
|
|
87
|
+
};
|
|
88
|
+
})
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
function getSyncConfigLocation({ error, syncConfigContent }) {
|
|
92
|
+
if (!error.location) {
|
|
93
|
+
return undefined;
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
end: getLineAndColumnFromCharOffset({
|
|
97
|
+
charOffset: error.location.end_offset,
|
|
98
|
+
text: syncConfigContent
|
|
99
|
+
}),
|
|
100
|
+
start: getLineAndColumnFromCharOffset({
|
|
101
|
+
charOffset: error.location.start_offset,
|
|
102
|
+
text: syncConfigContent
|
|
103
|
+
})
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Wraps validation transport/setup failures into the same shape as API validation errors.
|
|
108
|
+
*/
|
|
109
|
+
function wrapSyncValidationError({ errorCause, message }) {
|
|
110
|
+
const cause = errorCause instanceof Error ? errorCause.message : String(errorCause);
|
|
111
|
+
return {
|
|
112
|
+
connections: [],
|
|
113
|
+
errors: [
|
|
114
|
+
{
|
|
115
|
+
enrichedMessage: `${message}. Cause: ${cause}`,
|
|
116
|
+
level: 'fatal',
|
|
117
|
+
message: `${message}. Cause: ${cause}`
|
|
118
|
+
}
|
|
119
|
+
]
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Maps the API's raw character offsets to one-based line/column positions for editor markers.
|
|
124
|
+
*/
|
|
125
|
+
function getLineAndColumnFromCharOffset({ charOffset, text }) {
|
|
126
|
+
const lines = text.split('\n');
|
|
127
|
+
let charCount = 0;
|
|
128
|
+
for (const [i, line_] of lines.entries()) {
|
|
129
|
+
const line = line_ || '';
|
|
130
|
+
const lineLengthWithNewline = line.length + 1;
|
|
131
|
+
if (charCount + lineLengthWithNewline > charOffset) {
|
|
132
|
+
return {
|
|
133
|
+
column: charOffset - charCount + 1,
|
|
134
|
+
line: i + 1
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
charCount += lineLengthWithNewline;
|
|
138
|
+
}
|
|
139
|
+
const lastLine = lines.at(-1) || '';
|
|
140
|
+
return {
|
|
141
|
+
column: lastLine.length + 1,
|
|
142
|
+
line: lines.length
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Builds a multi-line validation message containing the original message, source fragment and caret.
|
|
147
|
+
*/
|
|
148
|
+
function formatSyncValidationMessage({ message, syncConfigContent, syncConfigLocation }) {
|
|
149
|
+
if (!syncConfigLocation) {
|
|
150
|
+
return message;
|
|
151
|
+
}
|
|
152
|
+
const sourceLine = syncConfigContent.split('\n')[syncConfigLocation.start.line - 1];
|
|
153
|
+
if (sourceLine == null) {
|
|
154
|
+
return message;
|
|
155
|
+
}
|
|
156
|
+
const caretPrefix = `${' '.repeat(Math.max((syncConfigLocation.start.column ?? 1) - 1, 0))}^`;
|
|
157
|
+
return `${message}\n${sourceLine}\n${caretPrefix}`;
|
|
158
|
+
}
|
|
104
159
|
//# sourceMappingURL=validate-sync-config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-sync-config.js","sourceRoot":"","sources":["../../src/api/validate-sync-config.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"validate-sync-config.js","sourceRoot":"","sources":["../../src/api/validate-sync-config.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AAwFjF,MAAM,uBAAuB,GAAmB;IAC9C,WAAW,EAAE,EAAE;IACf,MAAM,EAAE;QACN;YACE,eAAe,EAAE,sCAAsC;YACvD,KAAK,EAAE,OAAO;YACd,OAAO,EAAE,sCAAsC;SAChD;KACF;CACF,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAAC,KAG7C;IACC,IAAI,CAAC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pC,OAAO;QACL,MAAM,EAAE,QAAQ,CAAC,MAAM,GAAG,CAAC;QAC3B,IAAI,EAAE,KAAK,CAAC,MAAM;KACnB,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAS,2BAA2B,CAAC,EACnC,OAAO,EACP,iBAAiB,EACjB,kBAAkB,EAKnB;IACC,IAAI,CAAC,kBAAkB,EAAE,CAAC;QACxB,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,MAAM,UAAU,GAAG,iBAAiB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,kBAAkB,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;IACpF,IAAI,UAAU,IAAI,IAAI,EAAE,CAAC;QACvB,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,MAAM,WAAW,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,kBAAkB,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;IAE9F,OAAO,GAAG,OAAO,KAAK,UAAU,KAAK,WAAW,EAAE,CAAC;AACrD,CAAC"}
|
|
@@ -20,15 +20,15 @@ export type CloudInstanceCommandFlags = Interfaces.InferredFlags<typeof CloudIns
|
|
|
20
20
|
* 1. Command-line flags (--instance-id, --org-id, --project-id)
|
|
21
21
|
* 2. Linked config from cli.yaml
|
|
22
22
|
* 3. Environment variables (INSTANCE_ID, ORG_ID, PROJECT_ID)
|
|
23
|
-
* 4. If org_id is still missing:
|
|
23
|
+
* 4. If org_id or project_id is still missing: resolve it from the Cloud instance.
|
|
24
24
|
*
|
|
25
25
|
* @example
|
|
26
26
|
* # Use linked project (cli.yaml)
|
|
27
27
|
* pnpm exec powersync some-cloud-cmd
|
|
28
28
|
* # Override with env
|
|
29
|
-
* INSTANCE_ID=...
|
|
29
|
+
* INSTANCE_ID=... pnpm exec powersync some-cloud-cmd
|
|
30
30
|
* # Override with flags
|
|
31
|
-
* pnpm exec powersync some-cloud-cmd --instance-id=...
|
|
31
|
+
* pnpm exec powersync some-cloud-cmd --instance-id=...
|
|
32
32
|
*/
|
|
33
33
|
export declare abstract class CloudInstanceCommand extends InstanceCommand {
|
|
34
34
|
static baseFlags: {
|
|
@@ -2,12 +2,13 @@ import { Flags, ux } from '@oclif/core';
|
|
|
2
2
|
import { ResolvedCloudCLIConfig, ServiceCloudConfig, validateCloudConfig } from '@powersync/cli-schemas';
|
|
3
3
|
import { existsSync } from 'node:fs';
|
|
4
4
|
import { join } from 'node:path';
|
|
5
|
-
import { getDefaultOrgId } from '../clients/AccountsHubClientSDKClient.js';
|
|
6
5
|
import { createCloudClient } from '../clients/create-cloud-client.js';
|
|
7
6
|
import { ensureServiceTypeMatches, ServiceType } from '../utils/ensure-service-type.js';
|
|
8
7
|
import { env } from '../utils/env.js';
|
|
8
|
+
import { LINK_MISSING_ERROR_MESSAGE } from '../utils/errors.js';
|
|
9
9
|
import { OBJECT_ID_REGEX } from '../utils/object-id.js';
|
|
10
10
|
import { CLI_FILENAME, SERVICE_FILENAME } from '../utils/project-config.js';
|
|
11
|
+
import { resolveCloudInstanceLink } from '../utils/resolve-cloud-instance-link.js';
|
|
11
12
|
import { resolveSyncRulesContent } from '../utils/resolve-sync-rules-content.js';
|
|
12
13
|
import { parseYamlFile } from '../utils/yaml.js';
|
|
13
14
|
import { CommandHelpGroup, HelpGroup } from './HelpGroup.js';
|
|
@@ -19,36 +20,44 @@ import { DEFAULT_ENSURE_CONFIG_OPTIONS, InstanceCommand } from './InstanceComman
|
|
|
19
20
|
* 1. Command-line flags (--instance-id, --org-id, --project-id)
|
|
20
21
|
* 2. Linked config from cli.yaml
|
|
21
22
|
* 3. Environment variables (INSTANCE_ID, ORG_ID, PROJECT_ID)
|
|
22
|
-
* 4. If org_id is still missing:
|
|
23
|
+
* 4. If org_id or project_id is still missing: resolve it from the Cloud instance.
|
|
23
24
|
*
|
|
24
25
|
* @example
|
|
25
26
|
* # Use linked project (cli.yaml)
|
|
26
27
|
* pnpm exec powersync some-cloud-cmd
|
|
27
28
|
* # Override with env
|
|
28
|
-
* INSTANCE_ID=...
|
|
29
|
+
* INSTANCE_ID=... pnpm exec powersync some-cloud-cmd
|
|
29
30
|
* # Override with flags
|
|
30
|
-
* pnpm exec powersync some-cloud-cmd --instance-id=...
|
|
31
|
+
* pnpm exec powersync some-cloud-cmd --instance-id=...
|
|
31
32
|
*/
|
|
32
33
|
export class CloudInstanceCommand extends InstanceCommand {
|
|
33
34
|
static baseFlags = {
|
|
34
35
|
/**
|
|
35
36
|
* Instance ID, org ID, and project ID are resolved in order: flags → cli.yaml → env (INSTANCE_ID, ORG_ID, PROJECT_ID).
|
|
37
|
+
* Missing org/project IDs are resolved from the Cloud instance.
|
|
36
38
|
*/
|
|
37
39
|
...InstanceCommand.baseFlags,
|
|
38
40
|
'instance-id': Flags.string({
|
|
39
|
-
dependsOn: ['project-id'],
|
|
40
41
|
description: 'PowerSync Cloud instance ID. Manually passed if the current context has not been linked.',
|
|
41
42
|
helpGroup: HelpGroup.CLOUD_PROJECT,
|
|
42
43
|
required: false
|
|
43
44
|
}),
|
|
44
45
|
'org-id': Flags.string({
|
|
45
|
-
|
|
46
|
+
deprecated: {
|
|
47
|
+
message: '--org-id is a no-op. Organization ID is resolved automatically.'
|
|
48
|
+
},
|
|
49
|
+
description: '[Deprecated] Organization ID. Automatically resolved from --instance-id.',
|
|
46
50
|
helpGroup: HelpGroup.CLOUD_PROJECT,
|
|
51
|
+
hidden: true,
|
|
47
52
|
required: false
|
|
48
53
|
}),
|
|
49
54
|
'project-id': Flags.string({
|
|
50
|
-
|
|
55
|
+
deprecated: {
|
|
56
|
+
message: '--project-id is a no-op. Project ID is resolved automatically.'
|
|
57
|
+
},
|
|
58
|
+
description: '[Deprecated] Project ID. Automatically resolved from --instance-id.',
|
|
51
59
|
helpGroup: HelpGroup.CLOUD_PROJECT,
|
|
60
|
+
hidden: true,
|
|
52
61
|
required: false
|
|
53
62
|
})
|
|
54
63
|
};
|
|
@@ -120,37 +129,27 @@ export class CloudInstanceCommand extends InstanceCommand {
|
|
|
120
129
|
});
|
|
121
130
|
}
|
|
122
131
|
}
|
|
132
|
+
// Only instance_id is accepted as a CLI flag - project_id and org_id overrides must come from cli.yaml
|
|
123
133
|
const instance_id = flags['instance-id'] ?? rawLink?.instance_id ?? env.INSTANCE_ID;
|
|
124
|
-
const project_id =
|
|
125
|
-
|
|
126
|
-
try {
|
|
127
|
-
if (org_id == null && instance_id != null) {
|
|
128
|
-
org_id = await getDefaultOrgId();
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
catch (error) {
|
|
132
|
-
this.styledError({
|
|
133
|
-
error,
|
|
134
|
-
message: 'Linking is required before using this command. Provide flags, link the project (cli.yaml), or set environment variables.'
|
|
135
|
-
});
|
|
136
|
-
}
|
|
134
|
+
const project_id = rawLink?.project_id;
|
|
135
|
+
const org_id = rawLink?.org_id;
|
|
137
136
|
if (instance_id != null || project_id != null || org_id != null) {
|
|
138
137
|
this.ensureObjectIdIfPresent(instance_id, '--instance-id');
|
|
139
138
|
this.ensureObjectIdIfPresent(org_id, '--org-id');
|
|
140
139
|
this.ensureObjectIdIfPresent(project_id, '--project-id');
|
|
140
|
+
if (!instance_id) {
|
|
141
|
+
this.styledError({ message: LINK_MISSING_ERROR_MESSAGE });
|
|
142
|
+
}
|
|
141
143
|
try {
|
|
142
|
-
linked = ResolvedCloudCLIConfig.decode({
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
});
|
|
144
|
+
linked = ResolvedCloudCLIConfig.decode(await resolveCloudInstanceLink({
|
|
145
|
+
client: this.client,
|
|
146
|
+
instanceId: instance_id,
|
|
147
|
+
orgId: org_id,
|
|
148
|
+
projectId: project_id
|
|
149
|
+
}));
|
|
148
150
|
}
|
|
149
151
|
catch (error) {
|
|
150
|
-
this.styledError({
|
|
151
|
-
error,
|
|
152
|
-
message: 'Linking is required before using this command. Provide flags, link the project (cli.yaml), or set environment variables.'
|
|
153
|
-
});
|
|
152
|
+
this.styledError({ error, message: LINK_MISSING_ERROR_MESSAGE });
|
|
154
153
|
}
|
|
155
154
|
}
|
|
156
155
|
if (!linked) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CloudInstanceCommand.js","sourceRoot":"","sources":["../../src/command-types/CloudInstanceCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAc,EAAE,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAElB,mBAAmB,EACpB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"CloudInstanceCommand.js","sourceRoot":"","sources":["../../src/command-types/CloudInstanceCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAc,EAAE,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAElB,mBAAmB,EACpB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,wBAAwB,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AACxF,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AACtC,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EAAE,wB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AAuB,CAC7B,KAAyB,EACzB,QAAuD;QAEvD,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;YAClB,OAAO;QACT,CAAC;QAED,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YACjC,IAAI,CAAC,WAAW,CAAC;gBACf,OAAO,EAAE,WAAW,QAAQ,KAAK,KAAK,kDAAkD;aACzF,CAAC,CAAC;QACL,CAAC;IACH,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Command, ux } from '@oclif/core';
|
|
2
|
-
import {
|
|
2
|
+
import { resolve } from 'node:path';
|
|
3
3
|
import { formatPowersyncServiceErrorDisplay, isPowersyncAuthServiceError } from '../utils/format-powersync-service-error-display.js';
|
|
4
4
|
/** Base command for operations that target a PowerSync project directory (e.g. link, init). */
|
|
5
5
|
export class PowerSyncCommand extends Command {
|
|
@@ -11,7 +11,7 @@ export class PowerSyncCommand extends Command {
|
|
|
11
11
|
static commandHelpGroup;
|
|
12
12
|
/** Resolves the project directory path from the --directory flag (relative to cwd). */
|
|
13
13
|
resolveProjectDir(flags) {
|
|
14
|
-
return
|
|
14
|
+
return resolve(process.cwd(), flags.directory);
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* Reports a styled error via this.error. Normalizes a catch-block error (any) to an Error
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PowerSyncCommand.js","sourceRoot":"","sources":["../../src/command-types/PowerSyncCommand.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"PowerSyncCommand.js","sourceRoot":"","sources":["../../src/command-types/PowerSyncCommand.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC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AAK,CAAC,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC,EAAE;YAC7C,GAAG,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;YACxC,GAAG,CAAC,YAAY,EAAE,SAAS,EAAE,IAAI,IAAI,EAAE,IAAI,EAAE,YAAY,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;YAC3E,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,mBAAmB,IAAI,OAAO;YACvC,GAAG,CAAC,eAAe,EAAE,MAAM,IAAI,EAAE,WAAW,EAAE,eAAe,EAAE,CAAC;SACjE,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -24,11 +24,11 @@ export type SharedInstanceCommandFlags = Interfaces.InferredFlags<typeof SharedI
|
|
|
24
24
|
* # Use linked project (cli.yaml determines cloud vs self-hosted)
|
|
25
25
|
* pnpm exec powersync some-shared-cmd
|
|
26
26
|
* # Force cloud with env
|
|
27
|
-
* INSTANCE_ID=...
|
|
27
|
+
* INSTANCE_ID=... pnpm exec powersync some-shared-cmd
|
|
28
28
|
* # Force self-hosted with flag
|
|
29
29
|
* pnpm exec powersync some-shared-cmd --api-url=https://...
|
|
30
30
|
* # Force cloud with flags
|
|
31
|
-
* pnpm exec powersync some-shared-cmd --instance-id=...
|
|
31
|
+
* pnpm exec powersync some-shared-cmd --instance-id=...
|
|
32
32
|
*/
|
|
33
33
|
export declare abstract class SharedInstanceCommand extends InstanceCommand {
|
|
34
34
|
static baseFlags: {
|
|
@@ -2,11 +2,12 @@ import { Flags, ux } from '@oclif/core';
|
|
|
2
2
|
import { CLIConfig, ResolvedCloudCLIConfig, ResolvedSelfHostedCLIConfig, ServiceCloudConfig, ServiceSelfHostedConfig, validateCloudConfig, validateSelfHostedConfig } from '@powersync/cli-schemas';
|
|
3
3
|
import { existsSync } from 'node:fs';
|
|
4
4
|
import { join } from 'node:path';
|
|
5
|
-
import { getDefaultOrgId } from '../clients/AccountsHubClientSDKClient.js';
|
|
6
5
|
import { createCloudClient } from '../clients/create-cloud-client.js';
|
|
7
6
|
import { ensureServiceTypeMatches, ServiceType } from '../utils/ensure-service-type.js';
|
|
8
7
|
import { env } from '../utils/env.js';
|
|
8
|
+
import { LINK_MISSING_ERROR_MESSAGE } from '../utils/errors.js';
|
|
9
9
|
import { CLI_FILENAME, SERVICE_FILENAME } from '../utils/project-config.js';
|
|
10
|
+
import { resolveCloudInstanceLink } from '../utils/resolve-cloud-instance-link.js';
|
|
10
11
|
import { resolveSyncRulesContent } from '../utils/resolve-sync-rules-content.js';
|
|
11
12
|
import { parseYamlFile } from '../utils/yaml.js';
|
|
12
13
|
import { CommandHelpGroup, HelpGroup } from './HelpGroup.js';
|
|
@@ -29,11 +30,11 @@ import { DEFAULT_ENSURE_CONFIG_OPTIONS, InstanceCommand } from './InstanceComman
|
|
|
29
30
|
* # Use linked project (cli.yaml determines cloud vs self-hosted)
|
|
30
31
|
* pnpm exec powersync some-shared-cmd
|
|
31
32
|
* # Force cloud with env
|
|
32
|
-
* INSTANCE_ID=...
|
|
33
|
+
* INSTANCE_ID=... pnpm exec powersync some-shared-cmd
|
|
33
34
|
* # Force self-hosted with flag
|
|
34
35
|
* pnpm exec powersync some-shared-cmd --api-url=https://...
|
|
35
36
|
* # Force cloud with flags
|
|
36
|
-
* pnpm exec powersync some-shared-cmd --instance-id=...
|
|
37
|
+
* pnpm exec powersync some-shared-cmd --instance-id=...
|
|
37
38
|
*/
|
|
38
39
|
export class SharedInstanceCommand extends InstanceCommand {
|
|
39
40
|
static baseFlags = {
|
|
@@ -45,19 +46,26 @@ export class SharedInstanceCommand extends InstanceCommand {
|
|
|
45
46
|
required: false
|
|
46
47
|
}),
|
|
47
48
|
'instance-id': Flags.string({
|
|
48
|
-
dependsOn: ['project-id'],
|
|
49
49
|
description: '[Cloud] PowerSync Cloud instance ID (BSON ObjectID). When set, context is treated as cloud (exclusive with --api-url). Resolved: flag → cli.yaml → INSTANCE_ID.',
|
|
50
50
|
helpGroup: HelpGroup.CLOUD_PROJECT,
|
|
51
51
|
required: false
|
|
52
52
|
}),
|
|
53
53
|
'org-id': Flags.string({
|
|
54
|
-
|
|
54
|
+
deprecated: {
|
|
55
|
+
message: '--org-id is a no-op. Organization ID is resolved automatically.'
|
|
56
|
+
},
|
|
57
|
+
description: '[Cloud] [Deprecated] Organization ID. Automatically resolved from --instance-id.',
|
|
55
58
|
helpGroup: HelpGroup.CLOUD_PROJECT,
|
|
59
|
+
hidden: true,
|
|
56
60
|
required: false
|
|
57
61
|
}),
|
|
58
62
|
'project-id': Flags.string({
|
|
59
|
-
|
|
63
|
+
deprecated: {
|
|
64
|
+
message: '--project-id is a no-op. Project ID is resolved automatically.'
|
|
65
|
+
},
|
|
66
|
+
description: '[Cloud] [Deprecated] Project ID. Automatically resolved from --instance-id.',
|
|
60
67
|
helpGroup: HelpGroup.CLOUD_PROJECT,
|
|
68
|
+
hidden: true,
|
|
61
69
|
required: false
|
|
62
70
|
}),
|
|
63
71
|
...InstanceCommand.baseFlags
|
|
@@ -92,7 +100,7 @@ export class SharedInstanceCommand extends InstanceCommand {
|
|
|
92
100
|
const projectDir = this.ensureProjectDirectory(flags);
|
|
93
101
|
const linkPath = join(projectDir, CLI_FILENAME);
|
|
94
102
|
// 1) Context type: flags first, then link file, then env (see class JSDoc for resolution order).
|
|
95
|
-
const hasCloudFlagInputs = flags['instance-id']
|
|
103
|
+
const hasCloudFlagInputs = flags['instance-id'];
|
|
96
104
|
const hasSelfHostedFlagInputs = flags['api-url'];
|
|
97
105
|
if (hasCloudFlagInputs && hasSelfHostedFlagInputs) {
|
|
98
106
|
this.styledError({ message: 'Cannot use both cloud and self-hosted inputs. Use one or the other.' });
|
|
@@ -116,20 +124,16 @@ export class SharedInstanceCommand extends InstanceCommand {
|
|
|
116
124
|
}
|
|
117
125
|
// If type still not set, use env inputs.
|
|
118
126
|
if (!projectType) {
|
|
119
|
-
const hasCloudEnvInputs = env.INSTANCE_ID
|
|
127
|
+
const hasCloudEnvInputs = env.INSTANCE_ID;
|
|
120
128
|
const hasSelfHostedEnvInputs = env.API_URL;
|
|
121
129
|
if (hasCloudEnvInputs && hasSelfHostedEnvInputs) {
|
|
122
130
|
this.styledError({ message: 'Cannot use both cloud and self-hosted inputs. Use one or the other.' });
|
|
123
131
|
}
|
|
124
132
|
projectType = hasSelfHostedEnvInputs ? ServiceType.SELF_HOSTED : hasCloudEnvInputs ? ServiceType.CLOUD : null;
|
|
125
133
|
}
|
|
126
|
-
const linkMissingErrorMessage = [
|
|
127
|
-
'Linking is required before using this command.',
|
|
128
|
-
'Provide --api-url (self-hosted) or --instance-id with --org-id and --project-id (cloud), or link the project first.'
|
|
129
|
-
].join('\n');
|
|
130
134
|
// If we don't have a project type by now, we need to error
|
|
131
135
|
if (!projectType) {
|
|
132
|
-
this.styledError({ message:
|
|
136
|
+
this.styledError({ message: LINK_MISSING_ERROR_MESSAGE });
|
|
133
137
|
}
|
|
134
138
|
// 2) Per-field: flags → link file → env (see class JSDoc).
|
|
135
139
|
let cliConfig = null;
|
|
@@ -143,29 +147,30 @@ export class SharedInstanceCommand extends InstanceCommand {
|
|
|
143
147
|
});
|
|
144
148
|
}
|
|
145
149
|
catch (error) {
|
|
146
|
-
this.styledError({ error, message:
|
|
150
|
+
this.styledError({ error, message: LINK_MISSING_ERROR_MESSAGE });
|
|
147
151
|
}
|
|
148
152
|
}
|
|
149
153
|
else {
|
|
150
154
|
const _rawCloudCLIConfig = rawCLIConfig ?? { type: 'cloud' };
|
|
155
|
+
const instanceId = flags['instance-id'] ?? _rawCloudCLIConfig.instance_id ?? env.INSTANCE_ID;
|
|
156
|
+
if (!instanceId) {
|
|
157
|
+
this.styledError({ message: LINK_MISSING_ERROR_MESSAGE });
|
|
158
|
+
}
|
|
151
159
|
try {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
org_id: org_id,
|
|
160
|
-
project_id: flags['project-id'] ?? _rawCloudCLIConfig.project_id ?? env.PROJECT_ID
|
|
161
|
-
});
|
|
160
|
+
cliConfig = ResolvedCloudCLIConfig.decode(await resolveCloudInstanceLink({
|
|
161
|
+
client: this.cloudClient,
|
|
162
|
+
instanceId,
|
|
163
|
+
// orgId and projectId can either be set via cli.yaml or resolved via instanceId
|
|
164
|
+
orgId: _rawCloudCLIConfig.org_id,
|
|
165
|
+
projectId: _rawCloudCLIConfig.project_id
|
|
166
|
+
}));
|
|
162
167
|
}
|
|
163
168
|
catch (error) {
|
|
164
|
-
this.styledError({ error, message:
|
|
169
|
+
this.styledError({ error, message: LINK_MISSING_ERROR_MESSAGE });
|
|
165
170
|
}
|
|
166
171
|
}
|
|
167
172
|
if (!cliConfig) {
|
|
168
|
-
this.styledError({ message:
|
|
173
|
+
this.styledError({ message: LINK_MISSING_ERROR_MESSAGE });
|
|
169
174
|
}
|
|
170
175
|
// ensure the link config is valid
|
|
171
176
|
ensureServiceTypeMatches({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SharedInstanceCommand.js","sourceRoot":"","sources":["../../src/command-types/SharedInstanceCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAc,EAAE,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EACL,SAAS,EAET,sBAAsB,EACtB,2BAA2B,EAE3B,kBAAkB,EAElB,uBAAuB,EAEvB,mBAAmB,EACnB,wBAAwB,EACzB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"SharedInstanceCommand.js","sourceRoot":"","sources":["../../src/command-types/SharedInstanceCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAc,EAAE,EAAE,MAAM,aAAa,C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,CAAC,+BAA+B,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACxF,CAAC;QAED,OAAO,uBAAuB,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;IAChE,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export * from './utils/ensure-service-type.js';
|
|
|
23
23
|
export * from './utils/env.js';
|
|
24
24
|
export * from './utils/object-id.js';
|
|
25
25
|
export * from './utils/project-config.js';
|
|
26
|
+
export * from './utils/resolve-cloud-instance-link.js';
|
|
26
27
|
export * from './utils/resolve-sync-rules-content.js';
|
|
27
28
|
export * from './utils/sync-config-file-path-flags.js';
|
|
28
29
|
export * from './utils/yaml.js';
|
package/dist/index.js
CHANGED
|
@@ -23,6 +23,7 @@ export * from './utils/ensure-service-type.js';
|
|
|
23
23
|
export * from './utils/env.js';
|
|
24
24
|
export * from './utils/object-id.js';
|
|
25
25
|
export * from './utils/project-config.js';
|
|
26
|
+
export * from './utils/resolve-cloud-instance-link.js';
|
|
26
27
|
export * from './utils/resolve-sync-rules-content.js';
|
|
27
28
|
export * from './utils/sync-config-file-path-flags.js';
|
|
28
29
|
export * from './utils/yaml.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yCAAyC,CAAC;AACxD,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC;AACjD,cAAc,wCAAwC,CAAC;AACvD,cAAc,yCAAyC,CAAC;AACxD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oCAAoC,CAAC;AACnD,cAAc,qCAAqC,CAAC;AACpD,cAAc,8CAA8C,CAAC;AAC7D,cAAc,0CAA0C,CAAC;AACzD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,oDAAoD,CAAC;AACnE,cAAc,wDAAwD,CAAC;AACvE,cAAc,wBAAwB,CAAC;AACvC,cAAc,kCAAkC,CAAC;AACjD,cAAc,sCAAsC,CAAC;AACrD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uCAAuC,CAAC;AACtD,cAAc,wCAAwC,CAAC;AACvD,cAAc,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yCAAyC,CAAC;AACxD,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC;AACjD,cAAc,wCAAwC,CAAC;AACvD,cAAc,yCAAyC,CAAC;AACxD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oCAAoC,CAAC;AACnD,cAAc,qCAAqC,CAAC;AACpD,cAAc,8CAA8C,CAAC;AAC7D,cAAc,0CAA0C,CAAC;AACzD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,oDAAoD,CAAC;AACnE,cAAc,wDAAwD,CAAC;AACvE,cAAc,wBAAwB,CAAC;AACvC,cAAc,kCAAkC,CAAC;AACjD,cAAc,sCAAsC,CAAC;AACrD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wCAAwC,CAAC;AACvD,cAAc,uCAAuC,CAAC;AACtD,cAAc,wCAAwC,CAAC;AACvD,cAAc,iBAAiB,CAAC"}
|
|
@@ -24,7 +24,7 @@ export function ensureServiceTypeMatches(options) {
|
|
|
24
24
|
}
|
|
25
25
|
const service = parseYamlFile(servicePath);
|
|
26
26
|
const serviceJson = service.contents?.toJSON();
|
|
27
|
-
if (serviceJson?._type
|
|
27
|
+
if (serviceJson?._type == null) {
|
|
28
28
|
command.styledError({
|
|
29
29
|
message: `${SERVICE_FILENAME} in "./${directoryLabel}/" is missing \`_type\`. Add \`_type: ${expectedType}\` for this command.`
|
|
30
30
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ensure-service-type.js","sourceRoot":"","sources":["../../src/utils/ensure-service-type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C,MAAM,CAAN,IAAY,WAGX;AAHD,WAAY,WAAW;IACrB,8BAAe,CAAA;IACf,0CAA2B,CAAA;AAC7B,CAAC,EAHW,WAAW,KAAX,WAAW,QAGtB;AAUD;;GAEG;AACH,MAAM,UAAU,wBAAwB,CAAC,OAAwC;IAC/E,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,YAAY,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IACtF,MAAM,WAAW,GAAG,IAAI,CAAC,UAAU,EAAE,gBAAgB,CAAC,CAAC;IAEvD,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;QAC7B,IAAI,cAAc,EAAE,CAAC;YACnB,OAAO,CAAC,WAAW,CAAC;gBAClB,OAAO,EAAE,GAAG,gBAAgB,UAAU,cAAc,oDAAoD,YAAY,WAAW,EAAE,CAAC,QAAQ,CAAC,MAAM,EAAE,kBAAkB,YAAY,EAAE,CAAC,2CAA2C;aAChO,CAAC,CAAC;QACL,CAAC;QAED,OAAO;IACT,CAAC;IAED,MAAM,OAAO,GAAG,aAAa,CAAC,WAAW,CAAC,CAAC;IAC3C,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AAK,IAAI,IAAI,EAAE,CAAC;QAC/B,OAAO,CAAC,WAAW,CAAC;YAClB,OAAO,EAAE,GAAG,gBAAgB,UAAU,cAAc,yCAAyC,YAAY,sBAAsB;SAChI,CAAC,CAAC;IACL,CAAC;IAED,IAAI,WAAW,EAAE,KAAK,KAAK,YAAY,EAAE,CAAC;QACxC,OAAO,CAAC,WAAW,CAAC;YAClB,OAAO,EAAE,GAAG,gBAAgB,QAAQ,cAAc,kBAAkB,WAAW,EAAE,KAAK,yCAAyC,YAAY,WAAW,EAAE,CAAC,QAAQ,CAAC,MAAM,EAAE,kBAAkB,YAAY,EAAE,CAAC,gEAAgE,gBAAgB,GAAG;SAC/R,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shown when a command needs an instance link but none of the inputs (flags, cli.yaml, env) resolved one.
|
|
3
|
+
*/
|
|
4
|
+
export const LINK_MISSING_ERROR_MESSAGE = [
|
|
5
|
+
'Linking is required before using this command.',
|
|
6
|
+
'Provide --api-url (self-hosted) or --instance-id (cloud), or link the project first.'
|
|
7
|
+
].join('\n');
|
|
8
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,gDAAgD;IAChD,sFAAsF;CACvF,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC"}
|
package/dist/utils/object-id.js
CHANGED
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
export const OBJECT_ID_REGEX = /^[0-9a-fA-F]{24}$/;
|
|
2
|
+
export function ensureObjectId(value, label) {
|
|
3
|
+
if (!OBJECT_ID_REGEX.test(value)) {
|
|
4
|
+
throw new Error(`Invalid ${label} "${value}". Expected a BSON ObjectID (24 hex characters).`);
|
|
5
|
+
}
|
|
6
|
+
}
|
|
2
7
|
//# sourceMappingURL=object-id.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"object-id.js","sourceRoot":"","sources":["../../src/utils/object-id.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"object-id.js","sourceRoot":"","sources":["../../src/utils/object-id.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG,mBAAmB,CAAC;AAEnD,MAAM,UAAU,cAAc,CAAC,KAAa,EAAE,KAAa;IACzD,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACjC,MAAM,IAAI,KAAK,CAAC,WAAW,KAAK,KAAK,KAAK,kDAAkD,CAAC,CAAC;IAChG,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ResolvedCloudCLIConfig } from '@powersync/cli-schemas';
|
|
2
|
+
import type { PowerSyncManagementClient } from '@powersync/management-client';
|
|
3
|
+
export type ResolveCloudInstanceLinkInput = {
|
|
4
|
+
client: PowerSyncManagementClient;
|
|
5
|
+
instanceId: string;
|
|
6
|
+
orgId?: string;
|
|
7
|
+
projectId?: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Resolves the full Cloud link from an instance ID. If org/project IDs are missing, fetches them from the instance.
|
|
11
|
+
*
|
|
12
|
+
* Note that this function does NOT check if the org/project IDs reference valid destinations if provided manually.
|
|
13
|
+
*/
|
|
14
|
+
export declare function resolveCloudInstanceLink(input: ResolveCloudInstanceLinkInput): Promise<ResolvedCloudCLIConfig>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ensureObjectId } from './object-id.js';
|
|
2
|
+
/**
|
|
3
|
+
* Resolves the full Cloud link from an instance ID. If org/project IDs are missing, fetches them from the instance.
|
|
4
|
+
*
|
|
5
|
+
* Note that this function does NOT check if the org/project IDs reference valid destinations if provided manually.
|
|
6
|
+
*/
|
|
7
|
+
export async function resolveCloudInstanceLink(input) {
|
|
8
|
+
const { client, instanceId, orgId, projectId } = input;
|
|
9
|
+
ensureObjectId(instanceId, '--instance-id');
|
|
10
|
+
if (orgId)
|
|
11
|
+
ensureObjectId(orgId, '--org-id');
|
|
12
|
+
if (projectId)
|
|
13
|
+
ensureObjectId(projectId, '--project-id');
|
|
14
|
+
// Skip the API request when org and project IDs are **both** provided; otherwise ignore
|
|
15
|
+
// the provided values and re-fetch them via getInstance.
|
|
16
|
+
//
|
|
17
|
+
// If both values are provided (i.e. if the values are present in cli.yaml), we trust that the
|
|
18
|
+
// org and project ID are both correct for the given instance. This lets us save an API call, and
|
|
19
|
+
// if we are incorrect, then we will receive a server-side validation error later in the chain.
|
|
20
|
+
//
|
|
21
|
+
// In most cases the ID fields in the cli.yaml file are generated by the CLI and will therefore contain the correct values.
|
|
22
|
+
if (orgId && projectId) {
|
|
23
|
+
return {
|
|
24
|
+
instance_id: instanceId,
|
|
25
|
+
org_id: orgId,
|
|
26
|
+
project_id: projectId,
|
|
27
|
+
type: 'cloud'
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
let instance;
|
|
31
|
+
try {
|
|
32
|
+
instance = await client.getInstance({ id: instanceId });
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
throw new Error(`Instance ${instanceId} was not found or is not accessible with the current token.`);
|
|
36
|
+
}
|
|
37
|
+
if (orgId && orgId !== instance.org_id) {
|
|
38
|
+
throw new Error(`Instance ${instanceId} belongs to organization ${instance.org_id}, not ${orgId}.`);
|
|
39
|
+
}
|
|
40
|
+
if (projectId && projectId !== instance.app_id) {
|
|
41
|
+
throw new Error(`Instance ${instanceId} belongs to project ${instance.app_id}, not ${projectId}.`);
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
instance_id: instance.id,
|
|
45
|
+
org_id: instance.org_id,
|
|
46
|
+
project_id: instance.app_id,
|
|
47
|
+
type: 'cloud'
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=resolve-cloud-instance-link.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-cloud-instance-link.js","sourceRoot":"","sources":["../../src/utils/resolve-cloud-instance-link.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAShD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAAC,KAAoC;IACjF,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;IAEvD,cAAc,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;IAC5C,IAAI,KAAK;QAAE,cAAc,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;IAC7C,IAAI,SAAS;QAAE,cAAc,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;IAEzD,wFAAwF;IACxF,yDAAyD;IACzD,EAAE;IACF,8FAA8F;IAC9F,iGAAiG;IACjG,+FAA+F;IAC/F,EAAE;IACF,2HAA2H;IAC3H,IAAI,KAAK,IAAI,SAAS,EAAE,CAAC;QACvB,OAAO;YACL,WAAW,EAAE,UAAU;YACvB,MAAM,EAAE,KAAK;YACb,UAAU,EAAE,SAAS;YACrB,IAAI,EAAE,OAAO;SACd,CAAC;IACJ,CAAC;IAED,IAAI,QAAQ,CAAC;IACb,IAAI,CAAC;QACH,QAAQ,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,EAAE,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC;IAC1D,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CAAC,YAAY,UAAU,6DAA6D,CAAC,CAAC;IACvG,CAAC;IAED,IAAI,KAAK,IAAI,KAAK,KAAK,QAAQ,CAAC,MAAM,EAAE,CAAC;QACvC,MAAM,IAAI,KAAK,CAAC,YAAY,UAAU,4BAA4B,QAAQ,CAAC,MAAM,SAAS,KAAK,GAAG,CAAC,CAAC;IACtG,CAAC;IAED,IAAI,SAAS,IAAI,SAAS,KAAK,QAAQ,CAAC,MAAM,EAAE,CAAC;QAC/C,MAAM,IAAI,KAAK,CAAC,YAAY,UAAU,uBAAuB,QAAQ,CAAC,MAAM,SAAS,SAAS,GAAG,CAAC,CAAC;IACrG,CAAC;IAED,OAAO;QACL,WAAW,EAAE,QAAQ,CAAC,EAAE;QACxB,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,UAAU,EAAE,QAAQ,CAAC,MAAM;QAC3B,IAAI,EAAE,OAAO;KACd,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powersync/cli-core",
|
|
3
3
|
"description": "Core types and base commands for PowerSync CLI and plugins (shared by CLI and plugin-docker).",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.10.1",
|
|
5
5
|
"license": "FSL-1.1-ALv2",
|
|
6
6
|
"author": "POWERSYNC",
|
|
7
7
|
"type": "module",
|
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
"@journeyapps-labs/common-sdk": "^1.0.2",
|
|
31
31
|
"@journeyapps-labs/micro-errors": "^1.0.1",
|
|
32
32
|
"@oclif/core": "^4.10.6",
|
|
33
|
-
"@powersync/management-client": "^0.1.
|
|
34
|
-
"@powersync/management-types": "^0.2.
|
|
33
|
+
"@powersync/management-client": "^0.1.3",
|
|
34
|
+
"@powersync/management-types": "^0.2.2",
|
|
35
35
|
"@powersync/service-client": "^0.0.6",
|
|
36
36
|
"keychain": "^1.5.0",
|
|
37
37
|
"yaml": "^2.8.3",
|
|
38
|
-
"@powersync/cli-schemas": "0.
|
|
38
|
+
"@powersync/cli-schemas": "0.10.1"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/keychain": "^1.4.4",
|