@sylphx/cli 0.14.6 → 0.14.8

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/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @sylphx/cli
2
2
 
3
+ ## 0.14.8
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1523](https://github.com/SylphxAI/platform/pull/1523) [`c6297fa`](https://github.com/SylphxAI/platform/commit/c6297fa1fab2a8fa7fd4bb83705ffbea9f17b7d2) Thanks [@shtse8](https://github.com/shtse8)! - Keep deploy log streaming attached across transient SSE disconnects so native
8
+ EventSource reconnect can recover without prematurely failing `sylphx deploy`.
9
+
10
+ ## 0.14.7
11
+
12
+ ### Patch Changes
13
+
14
+ - [#1473](https://github.com/SylphxAI/platform/pull/1473) [`e282a6a`](https://github.com/SylphxAI/platform/commit/e282a6a00fa9149e5cd3a1dfd6b70c255d3101f0) Thanks [@shtse8](https://github.com/shtse8)! - Add service-name targeting to the canonical deploy contract and route service deploys through it so single-service deploys trigger the same build pipeline as project deploys.
15
+
16
+ - Updated dependencies []:
17
+ - @sylphx/sdk@0.15.3
18
+
3
19
  ## 0.14.6
4
20
 
5
21
  ### Patch Changes
package/dist/main.js CHANGED
@@ -15,7 +15,7 @@ var init_package = __esm({
15
15
  "package.json"() {
16
16
  package_default = {
17
17
  name: "@sylphx/cli",
18
- version: "0.14.6",
18
+ version: "0.14.8",
19
19
  description: "Sylphx Platform CLI \u2014 deploy and manage your applications from the terminal. 63 commands across deployment, logs, env vars, domains, databases, storage, monitoring, self-service (user), admin (users/quotas/audit/invitations/jwt-keys/project-migrate), and more.",
20
20
  type: "module",
21
21
  homepage: "https://sylphx.com",
@@ -71,7 +71,7 @@ var init_package = __esm({
71
71
  "@effect/cli": "0.75.1",
72
72
  "@effect/platform": "0.96.0",
73
73
  "@effect/platform-bun": "0.89.0",
74
- "@sylphx/sdk": "0.15.2",
74
+ "@sylphx/sdk": "0.15.3",
75
75
  chalk: "^5.3.0",
76
76
  effect: "3.21.0",
77
77
  eventsource: "^2.0.2",
@@ -7588,7 +7588,7 @@ var init_databases = __esm({
7588
7588
 
7589
7589
  // ../contract/dist/schemas/deployment.js
7590
7590
  import { Schema as Schema53 } from "effect";
7591
- var DeploymentEnvironmentStatus, DeploymentStatus, DeployResult, DeploymentHistoryItem, DeploymentHistoryResult, RollbackResult, ProjectStatusEnvironment, ProjectStatus, DeploymentServiceStatus, DeploymentDetail, DeploySupplyChain, TriggerDeploymentFrameworkSignals, TriggerDeploymentInput, RollbackDeploymentInput, DeployServiceStatus, EnvScopedAppEnvInfo, EnvScopedAppDeployments, EnvScopedTriggerDeployResult, EnvScopedRollbackByCommitInput, EnvScopedRollbackByCommitResult, CancelBuildResult, BuildDetail, EnvScopedEnvVar, EnvScopedListEnvVarsResult, EnvScopedSetEnvVarInput, EnvScopedSetEnvVarResult, EnvScopedDeleteEnvVarResult, EnvScopedDeploymentView, EnvScopedDeploymentHistory, EnvScopedAppHealthStatus, EnvServiceRollbackInput, EnvServiceRollbackResult, PromoteArtifactInput, PromoteArtifactResult, DeployStatusLiteral, TriggerSourceLiteral, EnvServiceHistoryDeployment, EnvServiceHistoryResult;
7591
+ var DeploymentEnvironmentStatus, DeploymentStatus, DeployResult, DeploymentHistoryItem, DeploymentHistoryResult, RollbackResult, ProjectStatusEnvironment, ProjectStatus, DeploymentServiceStatus, DeploymentDetail, DeploySupplyChain, TriggerDeploymentFrameworkSignals, DeploymentServiceNamePattern, DeploymentServiceName, TriggerDeploymentInput, RollbackDeploymentInput, DeployServiceStatus, EnvScopedAppEnvInfo, EnvScopedAppDeployments, EnvScopedTriggerDeployResult, EnvScopedRollbackByCommitInput, EnvScopedRollbackByCommitResult, CancelBuildResult, BuildDetail, EnvScopedEnvVar, EnvScopedListEnvVarsResult, EnvScopedSetEnvVarInput, EnvScopedSetEnvVarResult, EnvScopedDeleteEnvVarResult, EnvScopedDeploymentView, EnvScopedDeploymentHistory, EnvScopedAppHealthStatus, EnvServiceRollbackInput, EnvServiceRollbackResult, PromoteArtifactInput, PromoteArtifactResult, DeployStatusLiteral, TriggerSourceLiteral, EnvServiceHistoryDeployment, EnvServiceHistoryResult;
7592
7592
  var init_deployment = __esm({
7593
7593
  "../contract/dist/schemas/deployment.js"() {
7594
7594
  "use strict";
@@ -7744,6 +7744,10 @@ var init_deployment = __esm({
7744
7744
  sdkHealthDetected: Schema53.optional(Schema53.Boolean)
7745
7745
  })
7746
7746
  });
7747
+ DeploymentServiceNamePattern = /^[a-z0-9-]{1,48}$/;
7748
+ DeploymentServiceName = Schema53.String.pipe(Schema53.minLength(1), Schema53.maxLength(48), Schema53.pattern(DeploymentServiceNamePattern, {
7749
+ message: () => "serviceName must be lowercase alphanumeric or hyphen"
7750
+ }));
7747
7751
  TriggerDeploymentInput = Schema53.Struct({
7748
7752
  envType: Schema53.optional(Schema53.Literal("production", "staging", "development")),
7749
7753
  envId: Schema53.optional(EnvironmentId),
@@ -7751,6 +7755,11 @@ var init_deployment = __esm({
7751
7755
  image: Schema53.optional(Schema53.String),
7752
7756
  /** Required when `image` is set — deploys are always per-service. */
7753
7757
  serviceId: Schema53.optional(ServiceId),
7758
+ /**
7759
+ * Stable project-local service name. Preferred by operator-facing clients
7760
+ * because it avoids leaking internal service row ids into deploy workflows.
7761
+ */
7762
+ serviceName: Schema53.optional(DeploymentServiceName),
7754
7763
  /**
7755
7764
  * ADR-141 — per-service framework-detection signals captured by the
7756
7765
  * client (typically `sylphx deploy` scanning `package.json`). The API
@@ -17247,7 +17256,8 @@ __export(deployments_exports, {
17247
17256
  rollback: () => rollback,
17248
17257
  status: () => status,
17249
17258
  supplyChain: () => supplyChain,
17250
- trigger: () => trigger2
17259
+ trigger: () => trigger2,
17260
+ triggerResolved: () => triggerResolved
17251
17261
  });
17252
17262
  async function triggerResolved(client, projectId, environment, options) {
17253
17263
  const { method, path: path7 } = deploymentsEndpoints.trigger;
@@ -17256,6 +17266,9 @@ async function triggerResolved(client, projectId, environment, options) {
17256
17266
  throw new ApiError2(404, `Environment '${environment}' not found`);
17257
17267
  }
17258
17268
  const body = { envId };
17269
+ if (options.serviceName) {
17270
+ body.serviceName = options.serviceName;
17271
+ }
17259
17272
  if (options.frameworkSignals && Object.keys(options.frameworkSignals).length > 0) {
17260
17273
  body.frameworkSignals = options.frameworkSignals;
17261
17274
  }
@@ -18617,6 +18630,7 @@ var list22, get11, update7, deploy, _delete13;
18617
18630
  var init_services = __esm({
18618
18631
  "../management/dist/services.js"() {
18619
18632
  "use strict";
18633
+ init_deployments2();
18620
18634
  init_environments2();
18621
18635
  init_errors2();
18622
18636
  init_http();
@@ -18634,9 +18648,10 @@ var init_services = __esm({
18634
18648
  if (!environmentId) {
18635
18649
  throw new ApiError2(404, `Environment '${envType}' not found`);
18636
18650
  }
18637
- return request(client, "POST", `/projects/${encodeURIComponent(projectId)}/services/${encodeURIComponent(name)}/deploy`, {
18638
- body: { environmentId },
18639
- headers: { "x-preferred-org-id": options.orgId }
18651
+ return triggerResolved(client, projectId, envType, {
18652
+ ...options,
18653
+ envId: environmentId,
18654
+ serviceName: name
18640
18655
  });
18641
18656
  };
18642
18657
  _delete13 = (client, projectId, name, options = {}) => request(client, "DELETE", `/projects/${encodeURIComponent(projectId)}/services/${encodeURIComponent(name)}`, { headers: { "x-preferred-org-id": options.orgId } });
@@ -26753,6 +26768,19 @@ var TERMINAL_GRACE_MS = 500;
26753
26768
  var LogStreamTransportError = class extends Error {
26754
26769
  name = "LogStreamTransportError";
26755
26770
  };
26771
+ function statusFromEventSourceError(event) {
26772
+ const raw = event.status ?? event.code;
26773
+ if (typeof raw === "number") return Number.isInteger(raw) ? raw : void 0;
26774
+ if (typeof raw === "string" && /^\d+$/.test(raw)) return Number.parseInt(raw, 10);
26775
+ return void 0;
26776
+ }
26777
+ function isFatalEventSourceError(event) {
26778
+ const status3 = statusFromEventSourceError(event);
26779
+ if (!status3) return false;
26780
+ if (status3 === 204 || status3 === 401 || status3 === 403 || status3 === 404) return true;
26781
+ if (status3 === 408 || status3 === 429) return false;
26782
+ return status3 >= 400 && status3 < 500;
26783
+ }
26756
26784
  function streamLogs(url, token, opts = {}) {
26757
26785
  return new Promise((resolve2, reject) => {
26758
26786
  const headers = {
@@ -26868,14 +26896,18 @@ function streamLogs(url, token, opts = {}) {
26868
26896
  }
26869
26897
  });
26870
26898
  es.addEventListener("error", (event) => {
26899
+ touchIdle();
26871
26900
  const errorEvent = event;
26872
26901
  const message = errorEvent.message ?? "log stream connection closed unexpectedly";
26873
26902
  if (gracefulDone || terminalStatus) {
26874
26903
  finishAfterDone();
26875
- } else {
26904
+ } else if (isFatalEventSourceError(errorEvent)) {
26876
26905
  opts.onTransportError?.(message);
26877
26906
  console.log(chalk_default.red(` Stream error: ${message}`));
26878
26907
  failTransport(message);
26908
+ } else {
26909
+ opts.onTransportError?.(message);
26910
+ console.log(chalk_default.yellow(` Stream reconnecting: ${message}`));
26879
26911
  }
26880
26912
  });
26881
26913
  if (!opts.follow) {