powersync 0.9.2 → 0.9.4

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.
Files changed (141) hide show
  1. package/README.md +103 -74
  2. package/bin/dev.js +7 -1
  3. package/dist/api/BaseDeployCommand.d.ts +39 -0
  4. package/dist/api/BaseDeployCommand.js +230 -0
  5. package/dist/api/BaseDeployCommand.js.map +1 -0
  6. package/dist/api/build-service-yaml.d.ts +29 -0
  7. package/dist/api/build-service-yaml.js +246 -0
  8. package/dist/api/build-service-yaml.js.map +1 -0
  9. package/dist/api/cloud/create-cloud-instance.js +1 -0
  10. package/dist/api/cloud/create-cloud-instance.js.map +1 -0
  11. package/dist/api/cloud/create-cloud-template.d.ts +15 -0
  12. package/dist/api/cloud/create-cloud-template.js +33 -0
  13. package/dist/api/cloud/create-cloud-template.js.map +1 -0
  14. package/dist/api/cloud/fetch-cloud-config.js +1 -0
  15. package/dist/api/cloud/fetch-cloud-config.js.map +1 -0
  16. package/dist/api/cloud/fetch-cloud-sync-rules-content.js +6 -7
  17. package/dist/api/cloud/fetch-cloud-sync-rules-content.js.map +1 -0
  18. package/dist/api/cloud/test-connection.js +3 -3
  19. package/dist/api/cloud/test-connection.js.map +1 -0
  20. package/dist/api/cloud/validate-cloud-link-config.js +1 -0
  21. package/dist/api/cloud/validate-cloud-link-config.js.map +1 -0
  22. package/dist/api/cloud/wait-for-operation.js +1 -0
  23. package/dist/api/cloud/wait-for-operation.js.map +1 -0
  24. package/dist/api/cloud/write-cloud-link.js +1 -0
  25. package/dist/api/cloud/write-cloud-link.js.map +1 -0
  26. package/dist/api/display-status.js +1 -0
  27. package/dist/api/display-status.js.map +1 -0
  28. package/dist/api/ide/configure-vscode-ide.js +1 -0
  29. package/dist/api/ide/configure-vscode-ide.js.map +1 -0
  30. package/dist/api/login-server.js +1 -0
  31. package/dist/api/login-server.js.map +1 -0
  32. package/dist/api/parse-local-cloud-service-config.d.ts +13 -0
  33. package/dist/api/parse-local-cloud-service-config.js +35 -0
  34. package/dist/api/parse-local-cloud-service-config.js.map +1 -0
  35. package/dist/api/self-hosted/fetch-self-hosted-sync-rules-content.js +7 -8
  36. package/dist/api/self-hosted/fetch-self-hosted-sync-rules-content.js.map +1 -0
  37. package/dist/api/validations/ValidationTestDefinition.d.ts +23 -0
  38. package/dist/api/validations/ValidationTestDefinition.js +10 -0
  39. package/dist/api/validations/ValidationTestDefinition.js.map +1 -0
  40. package/dist/api/validations/ValidationsRunner.d.ts +35 -0
  41. package/dist/api/validations/ValidationsRunner.js +82 -0
  42. package/dist/api/validations/ValidationsRunner.js.map +1 -0
  43. package/dist/api/validations/cloud-validations.d.ts +15 -0
  44. package/dist/api/validations/cloud-validations.js +120 -0
  45. package/dist/api/validations/cloud-validations.js.map +1 -0
  46. package/dist/api/validations/self-hosted-validations.d.ts +7 -0
  47. package/dist/api/validations/self-hosted-validations.js +25 -0
  48. package/dist/api/validations/self-hosted-validations.js.map +1 -0
  49. package/dist/api/validations/validation-flags.d.ts +38 -0
  50. package/dist/api/validations/validation-flags.js +77 -0
  51. package/dist/api/validations/validation-flags.js.map +1 -0
  52. package/dist/api/validations/validation-utils.d.ts +46 -0
  53. package/dist/api/validations/validation-utils.js +154 -0
  54. package/dist/api/validations/validation-utils.js.map +1 -0
  55. package/dist/api/validations/validations.d.ts +15 -0
  56. package/dist/api/validations/validations.js +102 -0
  57. package/dist/api/validations/validations.js.map +1 -0
  58. package/dist/commands/configure/ide.js +1 -0
  59. package/dist/commands/configure/ide.js.map +1 -0
  60. package/dist/commands/configure/index.js +1 -0
  61. package/dist/commands/configure/index.js.map +1 -0
  62. package/dist/commands/deploy/index.d.ts +5 -41
  63. package/dist/commands/deploy/index.js +69 -279
  64. package/dist/commands/deploy/index.js.map +1 -0
  65. package/dist/commands/deploy/service-config.d.ts +3 -7
  66. package/dist/commands/deploy/service-config.js +30 -7
  67. package/dist/commands/deploy/service-config.js.map +1 -0
  68. package/dist/commands/deploy/sync-config.d.ts +5 -8
  69. package/dist/commands/deploy/sync-config.js +43 -20
  70. package/dist/commands/deploy/sync-config.js.map +1 -0
  71. package/dist/commands/destroy.d.ts +0 -4
  72. package/dist/commands/destroy.js +2 -2
  73. package/dist/commands/destroy.js.map +1 -0
  74. package/dist/commands/fetch/config.d.ts +0 -4
  75. package/dist/commands/fetch/config.js +2 -2
  76. package/dist/commands/fetch/config.js.map +1 -0
  77. package/dist/commands/fetch/index.js +1 -0
  78. package/dist/commands/fetch/index.js.map +1 -0
  79. package/dist/commands/fetch/instances.js +1 -0
  80. package/dist/commands/fetch/instances.js.map +1 -0
  81. package/dist/commands/fetch/status.d.ts +0 -5
  82. package/dist/commands/fetch/status.js +2 -2
  83. package/dist/commands/fetch/status.js.map +1 -0
  84. package/dist/commands/generate/index.js +1 -0
  85. package/dist/commands/generate/index.js.map +1 -0
  86. package/dist/commands/generate/schema.d.ts +3 -6
  87. package/dist/commands/generate/schema.js +5 -5
  88. package/dist/commands/generate/schema.js.map +1 -0
  89. package/dist/commands/generate/token.d.ts +0 -5
  90. package/dist/commands/generate/token.js +2 -2
  91. package/dist/commands/generate/token.js.map +1 -0
  92. package/dist/commands/init/cloud.d.ts +0 -3
  93. package/dist/commands/init/cloud.js +21 -18
  94. package/dist/commands/init/cloud.js.map +1 -0
  95. package/dist/commands/init/index.js +1 -0
  96. package/dist/commands/init/index.js.map +1 -0
  97. package/dist/commands/init/self-hosted.d.ts +0 -3
  98. package/dist/commands/init/self-hosted.js +29 -6
  99. package/dist/commands/init/self-hosted.js.map +1 -0
  100. package/dist/commands/link/cloud.d.ts +0 -1
  101. package/dist/commands/link/cloud.js +3 -3
  102. package/dist/commands/link/cloud.js.map +1 -0
  103. package/dist/commands/link/index.js +1 -0
  104. package/dist/commands/link/index.js.map +1 -0
  105. package/dist/commands/link/self-hosted.d.ts +0 -1
  106. package/dist/commands/link/self-hosted.js +3 -3
  107. package/dist/commands/link/self-hosted.js.map +1 -0
  108. package/dist/commands/login.js +1 -0
  109. package/dist/commands/login.js.map +1 -0
  110. package/dist/commands/logout.js +1 -0
  111. package/dist/commands/logout.js.map +1 -0
  112. package/dist/commands/migrate/index.js +1 -0
  113. package/dist/commands/migrate/index.js.map +1 -0
  114. package/dist/commands/migrate/sync-rules.d.ts +0 -5
  115. package/dist/commands/migrate/sync-rules.js +4 -4
  116. package/dist/commands/migrate/sync-rules.js.map +1 -0
  117. package/dist/commands/pull/index.js +1 -0
  118. package/dist/commands/pull/index.js.map +1 -0
  119. package/dist/commands/pull/instance.d.ts +1 -4
  120. package/dist/commands/pull/instance.js +26 -12
  121. package/dist/commands/pull/instance.js.map +1 -0
  122. package/dist/commands/status.js +1 -0
  123. package/dist/commands/status.js.map +1 -0
  124. package/dist/commands/stop.d.ts +0 -4
  125. package/dist/commands/stop.js +2 -2
  126. package/dist/commands/stop.js.map +1 -0
  127. package/dist/commands/validate.d.ts +4 -8
  128. package/dist/commands/validate.js +50 -128
  129. package/dist/commands/validate.js.map +1 -0
  130. package/dist/help.js +1 -0
  131. package/dist/help.js.map +1 -0
  132. package/dist/index.js +1 -0
  133. package/dist/index.js.map +1 -0
  134. package/oclif.manifest.json +263 -161
  135. package/package.json +11 -10
  136. package/templates/cloud/powersync/service.template.yaml +164 -0
  137. package/templates/self-hosted/base/powersync/service.template.yaml +209 -0
  138. package/dist/api/run-validation-tests.d.ts +0 -63
  139. package/dist/api/run-validation-tests.js +0 -202
  140. package/templates/cloud/powersync/service.yaml +0 -174
  141. package/templates/self-hosted/base/powersync/service.yaml +0 -243
@@ -0,0 +1,77 @@
1
+ import { Flags } from '@oclif/core';
2
+ import { ValidationTest } from './ValidationTestDefinition.js';
3
+ /**
4
+ * Helpers for validation test flags for all options of {@link ValidationTest}.
5
+ */
6
+ export const GENERAL_VALIDATION_FLAG_HELPERS = generateValidationTestFlags();
7
+ /**
8
+ * Generates flag definitions and parsing logic for validation test selection flags, based on the provided options or all {@link ValidationTest} options by default.
9
+ * Ensures that the flags are mutually exclusive and validates the input against the allowed options.
10
+ * Allows specifying a limit set of {@ValidationTest} options to generate flags for, which is useful for commands that only support a subset of validation tests.
11
+ */
12
+ export function generateValidationTestFlags(params) {
13
+ const { limitOptions } = params ?? {};
14
+ const optionsToUse = limitOptions ?? Object.values(ValidationTest);
15
+ const parseValidationFlagValues = (input, flagName) => {
16
+ const split = input.split(',').map((s) => s.trim());
17
+ const invalid = split.filter((s) => !optionsToUse.includes(s));
18
+ if (invalid.length > 0) {
19
+ throw new Error(`Invalid validation test(s) specified in --${flagName}: ${invalid.join(', ')}. Valid options are: ${optionsToUse.join(', ')}.`);
20
+ }
21
+ return split;
22
+ };
23
+ const validateValidationFlagValues = (input, flagName) => {
24
+ parseValidationFlagValues(input, flagName);
25
+ // Can't map the return type here.
26
+ return input;
27
+ };
28
+ const flags = {
29
+ 'skip-validations': Flags.string({
30
+ description: `Comma-separated list of validation tests to skip. Options: ${optionsToUse.join(', ')}. Example: --skip-validations="${optionsToUse[0]}"`,
31
+ exclusive: ['validate-only'],
32
+ parse: async (input) => validateValidationFlagValues(input, 'skip-validations')
33
+ })
34
+ };
35
+ // This only makes sense if we have more than one option
36
+ if (optionsToUse.length > 1) {
37
+ flags['validate-only'] = Flags.string({
38
+ description: `Comma-separated list of validation tests to run, skipping all others. Options: ${optionsToUse.join(', ')}. Example: --validate-only="${optionsToUse[0]}"`,
39
+ exclusive: ['skip-validations'],
40
+ parse: async (input) => validateValidationFlagValues(input, 'validate-only')
41
+ });
42
+ }
43
+ return {
44
+ flags,
45
+ /**
46
+ * Parses the input validation test flags
47
+ * @returns A validation test filter to use.
48
+ */
49
+ parseValidationTestFlags(flags) {
50
+ if (flags['skip-validations'] && flags['validate-only']) {
51
+ throw new Error('Cannot specify both --skip-validations and --validate-only flags.');
52
+ }
53
+ else if (flags['skip-validations']) {
54
+ const toSkip = parseValidationFlagValues(flags['skip-validations'], 'skip-validations');
55
+ return {
56
+ skipped: toSkip,
57
+ testsToRun: optionsToUse.filter((test) => !toSkip.includes(test))
58
+ };
59
+ }
60
+ else if (flags['validate-only']) {
61
+ const toRun = parseValidationFlagValues(flags['validate-only'], 'validate-only');
62
+ return {
63
+ skipped: optionsToUse.filter((test) => !toRun.includes(test)),
64
+ testsToRun: toRun
65
+ };
66
+ }
67
+ else {
68
+ return {
69
+ skipped: [],
70
+ testsToRun: optionsToUse
71
+ };
72
+ }
73
+ },
74
+ validateValidationFlagValues
75
+ };
76
+ }
77
+ //# sourceMappingURL=validation-flags.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation-flags.js","sourceRoot":"","sources":["../../../src/api/validations/validation-flags.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGpC,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAc/D;;GAEG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,2BAA2B,EAAE,CAAC;AAE7E;;;;GAIG;AACH,MAAM,UAAU,2BAA2B,CAAC,MAA0C;IACpF,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,IAAI,EAAE,CAAC;IACtC,MAAM,YAAY,GAAG,YAAY,IAAI,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;IAEnE,MAAM,yBAAyB,GAAG,CAAC,KAAa,EAAE,QAAgB,EAAE,EAAE;QACpE,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;QACpD,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAmB,CAAC,CAAC,CAAC;QACjF,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CACb,6CAA6C,QAAQ,KAAK,OAAO,CAAC,IAAI,CAAC,IAAI,C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AAI,KAAK,CAAC,kBAAkB,CAAC,EAAE,CAAC;gBACrC,MAAM,MAAM,GAAG,yBAAyB,CAAC,KAAK,CAAC,kBAAkB,CAAW,EAAE,kBAAkB,CAAC,CAAC;gBAClG,OAAO;oBACL,OAAO,EAAE,MAAM;oBACf,UAAU,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;iBAClE,CAAC;YACJ,CAAC;iBAAM,IAAI,KAAK,CAAC,eAAe,CAAC,EAAE,CAAC;gBAClC,MAAM,KAAK,GAAG,yBAAyB,CAAC,KAAK,CAAC,eAAe,CAAW,EAAE,eAAe,CAAC,CAAC;gBAC3F,OAAO;oBACL,OAAO,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;oBAC7D,UAAU,EAAE,KAAK;iBAClB,CAAC;YACJ,CAAC;iBAAM,CAAC;gBACN,OAAO;oBACL,OAAO,EAAE,EAAE;oBACX,UAAU,EAAE,YAAY;iBACzB,CAAC;YACJ,CAAC;QACH,CAAC;QACD,4BAA4B;KAC7B,CAAC;AACJ,CAAC"}
@@ -0,0 +1,46 @@
1
+ import { SyncDiagnostic, ValidationResult, ValidationTestRunResult } from '@powersync/cli-core';
2
+ import { ValidationTest } from './ValidationTestDefinition.js';
3
+ /**
4
+ * Stable output names used as the `name` field in JSON/YAML output.
5
+ * These match the values from before the ValidationTest enum was refactored to kebab-case IDs,
6
+ * preserving backward compatibility for scripts that pattern-match `--output=json|yaml` results.
7
+ * Also used as display names in human-readable terminal output.
8
+ */
9
+ export declare const STABLE_OUTPUT_NAMES: Record<ValidationTest, string>;
10
+ /**
11
+ * Merges two or more `ValidationTestRunResult` objects into one.
12
+ * The merged result passes only if all inputs passed.
13
+ * Errors, warnings, and prettyOutput from all inputs are combined.
14
+ */
15
+ export declare function mergeValidationTestRunResults(...results: ValidationTestRunResult[]): ValidationTestRunResult;
16
+ /**
17
+ * Formats spinner text showing per-test progress while tests are running.
18
+ * These logs are indeted with bullets for readability, and update in-place as each test settles to show pass/fail status.
19
+ */
20
+ export declare function formatOraMessage(tests: ValidationTest[], entries: Map<ValidationTest, ValidationTestRunResult>): string;
21
+ /**
22
+ * Formats a validation error for human-readable output.
23
+ */
24
+ export declare function formatValidationErrorHuman(error: unknown): string;
25
+ /**
26
+ * Formats suite output for `--output=human`.
27
+ */
28
+ export declare function formatValidationHuman(result: ValidationResult): string;
29
+ /**
30
+ * Formats suite output for `--output=json`.
31
+ */
32
+ export declare function formatValidationJson(result: ValidationResult): string;
33
+ /**
34
+ * Formats suite output for `--output=yaml`.
35
+ */
36
+ export declare function formatValidationYaml(result: ValidationResult): string;
37
+ /**
38
+ * Builds a two-line diagnostic message containing a source fragment and location-prefixed message.
39
+ */
40
+ export declare function formatSyncDiagnosticMessage(diagnostic: SyncDiagnostic, syncRulesContent: string): string;
41
+ /**
42
+ * Renders a sync diagnostic into two lines for human output:
43
+ * 1) gray source fragment
44
+ * 2) colored `[error]` or `[warning]` label with `line:column` prefix followed by plain message text
45
+ */
46
+ export declare function renderDiagnosticForHumanOutput(diagnostic: string, level: 'error' | 'warning'): string[];
@@ -0,0 +1,154 @@
1
+ import { ux } from '@oclif/core';
2
+ import { Document } from 'yaml';
3
+ import { ValidationTest } from './ValidationTestDefinition.js';
4
+ /** Indentation used for nested human-readable output rows. */
5
+ const INDENT = ' ';
6
+ /** Bullet character used for list rows in human-readable output. */
7
+ const BULLET = '•';
8
+ /**
9
+ * Stable output names used as the `name` field in JSON/YAML output.
10
+ * These match the values from before the ValidationTest enum was refactored to kebab-case IDs,
11
+ * preserving backward compatibility for scripts that pattern-match `--output=json|yaml` results.
12
+ * Also used as display names in human-readable terminal output.
13
+ */
14
+ export const STABLE_OUTPUT_NAMES = {
15
+ [ValidationTest.CONFIGURATION]: 'Validate Configuration Schema',
16
+ [ValidationTest.CONNECTIONS]: 'Test Connections',
17
+ [ValidationTest['SYNC-CONFIG']]: 'Validate Sync Config'
18
+ };
19
+ /**
20
+ * Merges two or more `ValidationTestRunResult` objects into one.
21
+ * The merged result passes only if all inputs passed.
22
+ * Errors, warnings, and prettyOutput from all inputs are combined.
23
+ */
24
+ export function mergeValidationTestRunResults(...results) {
25
+ const errors = results.flatMap((r) => r.errors ?? []);
26
+ const warnings = results.flatMap((r) => r.warnings ?? []);
27
+ const prettyParts = results.map((r) => r.prettyOutput).filter(Boolean);
28
+ return {
29
+ errors: errors.length > 0 ? errors : undefined,
30
+ passed: results.every((r) => r.passed),
31
+ prettyOutput: prettyParts.length > 0 ? prettyParts.join('\n') : undefined,
32
+ warnings: warnings.length > 0 ? warnings : undefined
33
+ };
34
+ }
35
+ /**
36
+ * Formats spinner text showing per-test progress while tests are running.
37
+ * These logs are indeted with bullets for readability, and update in-place as each test settles to show pass/fail status.
38
+ */
39
+ export function formatOraMessage(tests, entries) {
40
+ return tests
41
+ .map((test) => {
42
+ const result = entries.get(test);
43
+ const prettyName = STABLE_OUTPUT_NAMES[test] ?? test;
44
+ return result === undefined ? `\t... ${prettyName}` : result.passed ? `\t✓ ${prettyName}` : `\t✗ ${prettyName}`;
45
+ })
46
+ .join('\n');
47
+ }
48
+ /**
49
+ * Formats a validation error for human-readable output.
50
+ */
51
+ export function formatValidationErrorHuman(error) {
52
+ return ux.colorize('red', `${INDENT}${BULLET} ${error}`);
53
+ }
54
+ /**
55
+ * Formats one test result into human-readable plain text.
56
+ */
57
+ function formatTestResultHuman(test) {
58
+ const status = test.passed ? '✓' : '✗';
59
+ const name = `${status} ${STABLE_OUTPUT_NAMES[test.name] ?? test.name}`;
60
+ if (test.prettyOutput) {
61
+ // Use custom pretty output if provided.
62
+ return `${name}\n${test.prettyOutput}`;
63
+ }
64
+ const warningLines = (test.warnings ?? []).map((warning) => `${INDENT}${BULLET} ${ux.colorize('yellow', '[warning]')} ${warning}`);
65
+ if (test.passed && warningLines.length === 0)
66
+ return name;
67
+ const errorLines = (test.errors ?? []).map((e) => `${INDENT}${BULLET} ${ux.colorize('red', '[error]')} ${e}`);
68
+ return [name, ...warningLines, ...errorLines].join('\n');
69
+ }
70
+ /**
71
+ * Formats suite output for `--output=human`.
72
+ */
73
+ export function formatValidationHuman(result) {
74
+ const footer = result.passed
75
+ ? ux.colorize('green', 'All validation tests passed.')
76
+ : ux.colorize('red', 'Some validation tests failed.');
77
+ const lines = [...result.tests.map((test) => formatTestResultHuman(test)), '', footer];
78
+ return lines.join('\n');
79
+ }
80
+ /**
81
+ * Formats suite output for `--output=json`.
82
+ */
83
+ export function formatValidationJson(result) {
84
+ return JSON.stringify(result, null, 2);
85
+ }
86
+ /**
87
+ * Formats suite output for `--output=yaml`.
88
+ */
89
+ export function formatValidationYaml(result) {
90
+ return new Document(result).toString();
91
+ }
92
+ /**
93
+ * Builds a two-line diagnostic message containing a source fragment and location-prefixed message.
94
+ */
95
+ export function formatSyncDiagnosticMessage(diagnostic, syncRulesContent) {
96
+ const lineText = getLineAt(syncRulesContent, diagnostic.startLine);
97
+ const fragment = getLineFragment(lineText, diagnostic.startColumn);
98
+ return `${fragment}\n${diagnostic.startLine}:${diagnostic.startColumn} ${diagnostic.message}`;
99
+ }
100
+ /**
101
+ * Retrieves a specific 1-based line from text content.
102
+ */
103
+ function getLineAt(content, lineNumber) {
104
+ if (!content) {
105
+ return '';
106
+ }
107
+ const lines = content.split(/\r?\n/);
108
+ return lines[Math.max(0, lineNumber - 1)] ?? '';
109
+ }
110
+ /**
111
+ * Extracts a nearby fragment around `startColumn`, clipping to a fixed width for readability.
112
+ */
113
+ function getLineFragment(lineText, startColumn) {
114
+ if (!lineText) {
115
+ return '(line unavailable)';
116
+ }
117
+ const maxWidth = 120;
118
+ if (lineText.length <= maxWidth) {
119
+ return lineText;
120
+ }
121
+ const centerIndex = Math.max(0, startColumn - 1);
122
+ let start = Math.max(0, centerIndex - Math.floor(maxWidth / 2));
123
+ const end = Math.min(lineText.length, start + maxWidth);
124
+ if (end - start < maxWidth) {
125
+ start = Math.max(0, end - maxWidth);
126
+ }
127
+ const prefix = start > 0 ? '…' : '';
128
+ const suffix = end < lineText.length ? '…' : '';
129
+ return `${prefix}${lineText.slice(start, end)}${suffix}`;
130
+ }
131
+ /**
132
+ * Renders a sync diagnostic into two lines for human output:
133
+ * 1) gray source fragment
134
+ * 2) colored `[error]` or `[warning]` label with `line:column` prefix followed by plain message text
135
+ */
136
+ export function renderDiagnosticForHumanOutput(diagnostic, level) {
137
+ const [fragmentRaw, locationAndMessageRaw] = diagnostic.split('\n', 2);
138
+ const fragment = fragmentRaw ?? '';
139
+ const locationAndMessage = locationAndMessageRaw ?? '';
140
+ const parsed = locationAndMessage.match(/^(\d+:\d+)\s+([\s\S]+)$/);
141
+ const location = parsed?.[1] ?? '';
142
+ const message = parsed?.[2] ?? locationAndMessage;
143
+ const color = level === 'error' ? 'red' : 'yellow';
144
+ const label = level === 'error' ? '[error]' : '[warning]';
145
+ const lines = [ux.colorize('gray', `${INDENT}${BULLET} ${fragment}`)];
146
+ if (location) {
147
+ lines.push(`${INDENT}${ux.colorize(color, label)} ${ux.colorize(color, location)} ${message}`);
148
+ }
149
+ else {
150
+ lines.push(`${INDENT}${ux.colorize(color, label)} ${message}`);
151
+ }
152
+ return lines;
153
+ }
154
+ //# sourceMappingURL=validation-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation-utils.js","sourceRoot":"","sources":["../../../src/api/validations/validation-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAEjC,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAEhC,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,8DAA8D;AAC9D,MAAM,MAAM,GAAG,IAAI,CAAC;AAEpB,oEAAoE;AACpE,MAAM,MAAM,GAAG,GAAG,CAAC;AAEnB;;;;;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C;QACb,KAAK,CAAC,IAAI,CAAC,GAAG,MAAM,GAAG,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,IAAI,OAAO,EAAE,CAAC,CAAC;IACjG,CAAC;SAAM,CAAC;QACN,KAAK,CAAC,IAAI,CAAC,GAAG,MAAM,GAAG,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,OAAO,EAAE,CAAC,CAAC;IACjE,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { CloudProject, SelfHostedProject, SyncValidationTestRunResult, ValidationTestRunResult } from '@powersync/cli-core';
2
+ import { ServiceCloudConfigDecoded } from '@powersync/cli-schemas';
3
+ /**
4
+ * Validates `service.yaml` against the cloud or self-hosted schema, depending on project type.
5
+ */
6
+ export declare function runConfigTest(projectDir: string, isCloud: boolean): Promise<ValidationTestRunResult>;
7
+ /**
8
+ * Runs cloud sync-rules validation and maps diagnostics into warning/error message arrays.
9
+ */
10
+ export declare function runSyncConfigTestCloud(project: CloudProject): Promise<SyncValidationTestRunResult>;
11
+ /**
12
+ * Runs self-hosted sync-rules validation and maps diagnostics into warning/error message arrays.
13
+ */
14
+ export declare function runSyncConfigTestSelfHosted(project: SelfHostedProject): Promise<SyncValidationTestRunResult>;
15
+ export declare function parseCloudConfig(projectDirectory: string): ServiceCloudConfigDecoded;
@@ -0,0 +1,102 @@
1
+ import { parseYamlFile, SERVICE_FILENAME, SYNC_FILENAME, validateCloudSyncRules, validateSelfHostedSyncRules } from '@powersync/cli-core';
2
+ import { ServiceCloudConfig, ServiceSelfHostedConfig, validateCloudConfig } from '@powersync/cli-schemas';
3
+ import { existsSync, readFileSync } from 'node:fs';
4
+ import { join } from 'node:path';
5
+ import { formatSyncDiagnosticMessage, renderDiagnosticForHumanOutput } from './validation-utils.js';
6
+ /**
7
+ * Validates `service.yaml` against the cloud or self-hosted schema, depending on project type.
8
+ */
9
+ export async function runConfigTest(projectDir, isCloud) {
10
+ const servicePath = join(projectDir, SERVICE_FILENAME);
11
+ try {
12
+ const doc = parseYamlFile(servicePath);
13
+ const raw = doc.contents?.toJSON();
14
+ if (isCloud) {
15
+ ServiceCloudConfig.decode(raw);
16
+ }
17
+ else {
18
+ ServiceSelfHostedConfig.decode(raw);
19
+ }
20
+ return { passed: true };
21
+ }
22
+ catch (error) {
23
+ const message = error instanceof Error ? error.message : String(error);
24
+ return { errors: [message], passed: false };
25
+ }
26
+ }
27
+ /**
28
+ * Wraps the sync validation with enhanced error and warning information.
29
+ * - Adds line numbers to locations of sync config errors.
30
+ * - Adds a pretty human-readable output string with color formatting for terminal display.
31
+ */
32
+ function wrapsSyncValidation(params) {
33
+ const { result, syncText } = params;
34
+ const errors = result.diagnostics
35
+ .filter((diagnostic) => diagnostic.level === 'fatal')
36
+ .map((diagnostic) => formatSyncDiagnosticMessage(diagnostic, syncText));
37
+ const warnings = result.diagnostics
38
+ .filter((diagnostic) => diagnostic.level === 'warning')
39
+ .map((diagnostic) => formatSyncDiagnosticMessage(diagnostic, syncText));
40
+ const prettyOutput = [
41
+ ...errors.map((line) => renderDiagnosticForHumanOutput(line, 'error').join('\n')),
42
+ ...warnings.map((line) => renderDiagnosticForHumanOutput(line, 'warning').join('\n'))
43
+ ].join('\n');
44
+ return {
45
+ diagnostics: result.diagnostics,
46
+ errors: errors.length > 0 ? errors : undefined,
47
+ passed: errors.length === 0,
48
+ prettyOutput,
49
+ warnings: warnings.length > 0 ? warnings : undefined
50
+ };
51
+ }
52
+ /**
53
+ * Runs cloud sync-rules validation and maps diagnostics into warning/error message arrays.
54
+ */
55
+ export async function runSyncConfigTestCloud(project) {
56
+ const syncRulesPath = join(project.projectDirectory, SYNC_FILENAME);
57
+ const syncRulesContent = project.syncRulesContent ?? (existsSync(syncRulesPath) ? readFileSync(syncRulesPath, 'utf8') : undefined);
58
+ const syncText = syncRulesContent ?? '';
59
+ try {
60
+ return wrapsSyncValidation({
61
+ result: await validateCloudSyncRules({
62
+ linked: project.linked,
63
+ syncRulesContent: syncText
64
+ }),
65
+ syncText
66
+ });
67
+ }
68
+ catch (error) {
69
+ const message = error instanceof Error ? error.message : String(error);
70
+ return { diagnostics: [], errors: [message], passed: false };
71
+ }
72
+ }
73
+ /**
74
+ * Runs self-hosted sync-rules validation and maps diagnostics into warning/error message arrays.
75
+ */
76
+ export async function runSyncConfigTestSelfHosted(project) {
77
+ const syncRulesContent = project.syncRulesContent ?? '';
78
+ try {
79
+ return wrapsSyncValidation({
80
+ result: await validateSelfHostedSyncRules({
81
+ linked: project.linked,
82
+ syncRulesContent
83
+ }),
84
+ syncText: syncRulesContent
85
+ });
86
+ }
87
+ catch (error) {
88
+ const message = error instanceof Error ? error.message : String(error);
89
+ return { diagnostics: [], errors: [message], passed: false };
90
+ }
91
+ }
92
+ export function parseCloudConfig(projectDirectory) {
93
+ const servicePath = join(projectDirectory, SERVICE_FILENAME);
94
+ const doc = parseYamlFile(servicePath);
95
+ // validate the config with full schema
96
+ const validationResult = validateCloudConfig(doc.contents?.toJSON());
97
+ if (!validationResult.valid) {
98
+ throw new Error(`Invalid cloud config: ${validationResult.errors?.join('\n')}`);
99
+ }
100
+ return ServiceCloudConfig.decode(doc.contents?.toJSON());
101
+ }
102
+ //# sourceMappingURL=validations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validations.js","sourceRoot":"","sources":["../../../src/api/validations/validations.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,EAEb,gBAAgB,EAChB,aAAa,EAGb,sBAAsB,EACtB,2BAA2B,EAE5B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,kBAAkB,EAElB,uBAAuB,EACvB,mBAAmB,EACpB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,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C7D,MAAM,GAAG,GAAG,aAAa,CAAC,WAAW,CAAC,CAAC;IAEvC,uCAAuC;IACvC,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;IACrE,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CAAC,yBAAyB,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAClF,CAAC;IAED,OAAO,kBAAkB,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;AAC3D,CAAC"}
@@ -56,3 +56,4 @@ export default class ConfigureIde extends PowerSyncCommand {
56
56
  configurator(process.cwd(), projectDirs, (msg) => this.log(msg));
57
57
  }
58
58
  }
59
+ //# sourceMappingURL=ide.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ide.js","sourceRoot":"","sources":["../../../src/commands/configure/ide.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACtG,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,kBAAkB,EAAwB,MAAM,uCAAuC,CAAC;AAEjG,MAAM,iBAAiB,GAAoC;IACzD,MAAM,EAAE,kBAAkB;CAC3B,CAAC;AAEF;;;GAGG;AACH,SAAS,qBAAqB,CAAC,GAAW;IACxC,MAAM,WAAW,GAAa,EAAE,CAAC;IAEjC,KAAK,MAAM,K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O,EAAE,kEAAkE;SAC5E,CAAC,CAAC;QAEH,IAAI,GAAG,KAAK,MAAM;YAAE,OAAO;QAE3B,MAAM,WAAW,GAAG,qBAAqB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QACzD,MAAM,YAAY,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC;QAC5C,YAAY,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,WAAW,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;IACnE,CAAC"}
@@ -9,3 +9,4 @@ export default class Configure extends Command {
9
9
  this.log('Use a subcommand: configure ide');
10
10
  }
11
11
  }
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/configure/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,OAAO;IAC5C,MAAM,CAAC,WAAW,GAAG,4DAA4D,CAAC;IAClF,MAAM,CAAC,QAAQ,GAAG,CAAC,qCAAqC,CAAC,CAAC;IAC1D,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC;IACrB,MAAM,CAAC,OAAO,GAAG,4DAA4D,CAAC;IAE9E,KAAK,CAAC,GAAG;QACP,MAAM,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QAC5B,IAAI,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;IAC9C,CAAC"}
@@ -1,48 +1,12 @@
1
- import { CloudInstanceCommand } from '@powersync/cli-core';
2
- import { ServiceCloudConfigDecoded } from '@powersync/cli-schemas';
3
- import { routes } from '@powersync/management-types';
4
- /**
5
- * Deploys the sync config and service configuration
6
- */
7
- export default class DeployAll extends CloudInstanceCommand {
1
+ import BaseDeployCommand from '../../api/BaseDeployCommand.js';
2
+ declare const DeployAll_base: typeof BaseDeployCommand;
3
+ export default class DeployAll extends DeployAll_base {
8
4
  static description: string;
9
5
  static examples: string[];
10
6
  static flags: {
11
- 'instance-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
- 'org-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
13
- 'project-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
14
- directory: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
15
- 'deploy-timeout': import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
7
+ [x: string]: import("@oclif/core/interfaces").Flag<string>;
16
8
  };
17
9
  static summary: string;
18
- protected deployAll(params: {
19
- cloudConfigState: routes.InstanceConfigResponse;
20
- deployTimeoutMs: number;
21
- updateSyncConfig: boolean;
22
- }): Promise<void>;
23
- protected deployInstanceConfig(params: {
24
- cloudConfigState: routes.InstanceConfigResponse;
25
- updateSyncConfig: boolean;
26
- }): Promise<routes.DeployInstanceResponse>;
27
- protected loadCloudConfigState(): Promise<routes.InstanceConfigResponse>;
28
- parseLocalConfig(projectDirectory: string): ServiceCloudConfigDecoded;
29
- protected provision(params: {
30
- cloudConfigState: routes.InstanceConfigResponse;
31
- deployTimeoutMs: number;
32
- indentationLevel: number;
33
- }): Promise<void>;
34
10
  run(): Promise<void>;
35
- protected testConnections(): Promise<void>;
36
- protected validateServiceConfig(params: {
37
- cloudConfigState: routes.InstanceConfigResponse;
38
- }): Promise<void>;
39
- protected validateSyncConfig(): Promise<void>;
40
- protected waitForDeployCompletion(params: {
41
- deployResult: routes.DeployInstanceResponse;
42
- indentation?: string;
43
- logCompletionMessage?: boolean;
44
- logScheduledMessage?: boolean;
45
- timeoutMs: number;
46
- }): Promise<void>;
47
- protected withDeploy(timeoutMs: number, fn: () => Promise<routes.DeployInstanceResponse>): Promise<void>;
48
11
  }
12
+ export {};