@wtfalch/foundry 0.39.5 → 0.39.6

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.
@@ -28,10 +28,14 @@ export interface CreateComposeServiceInput {
28
28
  compose: string;
29
29
  }
30
30
  /**
31
- * `POST /services` with `docker_compose_raw`. `connect_to_docker_network` makes
32
- * the container join the destination's network under the alias
33
- * `<service key>-<service uuid>` (`StartService.php`), which the tunnel dials.
34
- * Nothing starts: `instant_deploy` is false.
31
+ * `POST /services` with `docker_compose_raw`, then `PATCH` with
32
+ * `connect_to_docker_network`, which makes the container join the
33
+ * destination's network under the alias `<service key>-<service uuid>`
34
+ * (`StartService.php`), which the tunnel dials. The create cannot carry the
35
+ * flag: Coolify 4.4.2 checks its fields against the list for every create
36
+ * first, which lacks it (`ServicesController.php:391`), and answers 422.
37
+ * A PATCH that fails leaves the service without the flag; the next run finds
38
+ * it and `updateComposeService` sets it. Nothing starts: `instant_deploy` is false.
35
39
  */
36
40
  export declare function createComposeService(coolify: Raw, input: CreateComposeServiceInput): Promise<string>;
37
41
  /** `PATCH /services/{uuid}`: the compose file and the network flag. Coolify parses the file again; nothing restarts. */
@@ -32,23 +32,29 @@ export async function findComposeService(coolify, name, environmentId) {
32
32
  return null;
33
33
  }
34
34
  /**
35
- * `POST /services` with `docker_compose_raw`. `connect_to_docker_network` makes
36
- * the container join the destination's network under the alias
37
- * `<service key>-<service uuid>` (`StartService.php`), which the tunnel dials.
38
- * Nothing starts: `instant_deploy` is false.
35
+ * `POST /services` with `docker_compose_raw`, then `PATCH` with
36
+ * `connect_to_docker_network`, which makes the container join the
37
+ * destination's network under the alias `<service key>-<service uuid>`
38
+ * (`StartService.php`), which the tunnel dials. The create cannot carry the
39
+ * flag: Coolify 4.4.2 checks its fields against the list for every create
40
+ * first, which lacks it (`ServicesController.php:391`), and answers 422.
41
+ * A PATCH that fails leaves the service without the flag; the next run finds
42
+ * it and `updateComposeService` sets it. Nothing starts: `instant_deploy` is false.
39
43
  */
40
44
  export async function createComposeService(coolify, input) {
41
45
  const { compose, ...rest } = input;
42
46
  const created = await call(coolify, `creating service ${input.name}`, 'POST', '/services', {
43
47
  ...rest,
44
48
  docker_compose_raw: Buffer.from(compose, 'utf8').toString('base64'),
45
- connect_to_docker_network: true,
46
49
  instant_deploy: false,
47
50
  });
48
51
  const uuid = isRecord(created) ? created.uuid : undefined;
49
52
  if (typeof uuid !== 'string' || uuid === '') {
50
53
  throw new Error(`creating service ${input.name}: Coolify answered with no uuid`);
51
54
  }
55
+ await call(coolify, `updating service ${uuid}`, 'PATCH', `/services/${uuid}`, {
56
+ connect_to_docker_network: true,
57
+ });
52
58
  return uuid;
53
59
  }
54
60
  /** `PATCH /services/{uuid}`: the compose file and the network flag. Coolify parses the file again; nothing restarts. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wtfalch/foundry",
3
- "version": "0.39.5",
3
+ "version": "0.39.6",
4
4
  "description": "Foundry's SDK: the declared org's types, the plan and apply contracts, and the state store's interface.",
5
5
  "repository": {
6
6
  "type": "git",