@kaupang/core 0.1.2 → 0.2.0

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/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { K as KaupangConfig, E as EnvironmentDefinition, P as Pipeline, S as ServiceSpec, a as SolutionRecipe, b as SecretRef, C as CatalogRef } from './types-33zDl_9c.js';
2
- export { B as BackendName, c as BuildConfig, d as CatalogConfig, e as CatalogSourceConfig, D as Dependable, f as EnvMap, g as EnvValue, H as HealthcheckConfig, h as HookCommand, i as Hooks, j as PipelineStep, k as PullPolicy, l as ServiceDefinition, m as ServiceInput, T as TargetConfig, W as WaitSpec } from './types-33zDl_9c.js';
1
+ import { K as KaupangConfig, E as EnvironmentDefinition, P as Pipeline, S as ServiceSpec, a as SolutionRecipe, b as SecretRef, C as CatalogRef } from './types-Dxq7omCK.js';
2
+ export { B as BackendName, c as BuildConfig, d as CatalogConfig, e as CatalogSourceConfig, D as Dependable, f as EnvMap, g as EnvValue, H as HealthcheckConfig, h as HookCommand, i as Hooks, j as PipelineStep, k as PullPolicy, l as ServiceDefinition, m as ServiceInput, T as TargetConfig, W as WaitSpec } from './types-Dxq7omCK.js';
3
3
 
4
4
  /** Identity helper with full type-checking + autocomplete in kaupang.config.ts. */
5
5
  declare function defineConfig(config: KaupangConfig): KaupangConfig;
@@ -1,5 +1,5 @@
1
- import { S as ServiceSpec, a as SolutionRecipe, d as CatalogConfig, l as ServiceDefinition, f as EnvMap, i as Hooks, E as EnvironmentDefinition, k as PullPolicy, D as Dependable, K as KaupangConfig, B as BackendName, g as EnvValue, b as SecretRef, h as HookCommand } from './types-33zDl_9c.js';
2
- export { c as BuildConfig, C as CatalogRef, e as CatalogSourceConfig, H as HealthcheckConfig, P as Pipeline, j as PipelineStep, m as ServiceInput, T as TargetConfig, W as WaitSpec } from './types-33zDl_9c.js';
1
+ import { S as ServiceSpec, a as SolutionRecipe, d as CatalogConfig, l as ServiceDefinition, f as EnvMap, i as Hooks, E as EnvironmentDefinition, k as PullPolicy, D as Dependable, K as KaupangConfig, B as BackendName, g as EnvValue, b as SecretRef, h as HookCommand } from './types-Dxq7omCK.js';
2
+ export { c as BuildConfig, C as CatalogRef, e as CatalogSourceConfig, H as HealthcheckConfig, N as NetworkAttachment, P as Pipeline, j as PipelineStep, m as ServiceInput, T as TargetConfig, W as WaitSpec } from './types-Dxq7omCK.js';
3
3
 
4
4
  /** A catalog manifest: reusable service presets and/or solution recipes. */
5
5
  interface CatalogManifest {
package/dist/internal.js CHANGED
@@ -502,7 +502,11 @@ function toComposeService(def, opts, envVars, completing) {
502
502
  if (def.command) svc.command = def.command;
503
503
  if (def.ports?.length) svc.ports = def.ports;
504
504
  if (def.volumes?.length) svc.volumes = def.volumes;
505
- if (def.networks?.length) svc.networks = def.networks;
505
+ if (Array.isArray(def.networks)) {
506
+ if (def.networks.length) svc.networks = def.networks;
507
+ } else if (def.networks && Object.keys(def.networks).length) {
508
+ svc.networks = def.networks;
509
+ }
506
510
  if (def.capAdd?.length) svc.cap_add = def.capAdd;
507
511
  if (def.entrypoint) svc.entrypoint = def.entrypoint;
508
512
  if (def.workingDirectory) svc.working_dir = def.workingDirectory;
@@ -555,7 +559,9 @@ function toSwarmCondition(restart) {
555
559
  function collectNetworks(env) {
556
560
  const set = /* @__PURE__ */ new Set();
557
561
  for (const svc of Object.values(env.services)) {
558
- for (const n of svc.networks ?? []) set.add(n);
562
+ const nets = svc.networks;
563
+ const names = Array.isArray(nets) ? nets : nets ? Object.keys(nets) : [];
564
+ for (const n of names) set.add(n);
559
565
  }
560
566
  return [...set];
561
567
  }
@@ -28,6 +28,10 @@ interface HealthcheckConfig {
28
28
  * (below), which the loader normalizes into this shape: image prefixed with the
29
29
  * docker repository, `dependsOn` coerced to an array, pull policy filled in.
30
30
  */
31
+ /** How a service attaches to a network (compose/swarm): extra DNS aliases it answers to. */
32
+ interface NetworkAttachment {
33
+ aliases?: string[];
34
+ }
31
35
  interface ServiceDefinition {
32
36
  image?: string;
33
37
  build?: string | BuildConfig;
@@ -43,7 +47,8 @@ interface ServiceDefinition {
43
47
  replicas?: number;
44
48
  restart?: "no" | "always" | "on-failure" | "unless-stopped";
45
49
  labels?: Record<string, string>;
46
- networks?: string[];
50
+ /** Networks this service joins: a plain list of names, or a map of name → { aliases }. */
51
+ networks?: string[] | Record<string, NetworkAttachment>;
47
52
  healthcheck?: HealthcheckConfig;
48
53
  /** Pull behavior for this service's image. */
49
54
  pull?: PullPolicy;
@@ -208,4 +213,4 @@ interface KaupangConfig {
208
213
  pipelines?: Record<string, Pipeline>;
209
214
  }
210
215
 
211
- export type { BackendName as B, CatalogRef as C, Dependable as D, EnvironmentDefinition as E, HealthcheckConfig as H, KaupangConfig as K, Pipeline as P, ServiceSpec as S, TargetConfig as T, WaitSpec as W, SolutionRecipe as a, SecretRef as b, BuildConfig as c, CatalogConfig as d, CatalogSourceConfig as e, EnvMap as f, EnvValue as g, HookCommand as h, Hooks as i, PipelineStep as j, PullPolicy as k, ServiceDefinition as l, ServiceInput as m };
216
+ export type { BackendName as B, CatalogRef as C, Dependable as D, EnvironmentDefinition as E, HealthcheckConfig as H, KaupangConfig as K, NetworkAttachment as N, Pipeline as P, ServiceSpec as S, TargetConfig as T, WaitSpec as W, SolutionRecipe as a, SecretRef as b, BuildConfig as c, CatalogConfig as d, CatalogSourceConfig as e, EnvMap as f, EnvValue as g, HookCommand as h, Hooks as i, PipelineStep as j, PullPolicy as k, ServiceDefinition as l, ServiceInput as m };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaupang/core",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "description": "kaupang's engine + config-authoring API (defineConfig/defineEnvironment/secret/use + types). The CLI lives in @kaupang/cli.",
5
5
  "license": "MIT",
6
6
  "author": "Andreas Quist Batista",