typekro 0.25.0 → 0.26.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.
Files changed (50) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/core/deployment/direct-factory.d.ts +8 -1
  3. package/dist/core/deployment/direct-factory.d.ts.map +1 -1
  4. package/dist/core/deployment/direct-factory.js +80 -61
  5. package/dist/core/deployment/direct-factory.js.map +1 -1
  6. package/dist/core/deployment/engine.d.ts +2 -0
  7. package/dist/core/deployment/engine.d.ts.map +1 -1
  8. package/dist/core/deployment/engine.js +22 -1
  9. package/dist/core/deployment/engine.js.map +1 -1
  10. package/dist/core/deployment/readiness-waiter.d.ts.map +1 -1
  11. package/dist/core/deployment/readiness-waiter.js +6 -2
  12. package/dist/core/deployment/readiness-waiter.js.map +1 -1
  13. package/dist/core/deployment/rollback-manager.d.ts +1 -1
  14. package/dist/core/deployment/rollback-manager.d.ts.map +1 -1
  15. package/dist/core/deployment/rollback-manager.js +16 -9
  16. package/dist/core/deployment/rollback-manager.js.map +1 -1
  17. package/dist/factories/index.d.ts +1 -0
  18. package/dist/factories/index.d.ts.map +1 -1
  19. package/dist/factories/index.js +4 -0
  20. package/dist/factories/index.js.map +1 -1
  21. package/dist/factories/nats/compositions/index.d.ts +2 -0
  22. package/dist/factories/nats/compositions/index.d.ts.map +1 -0
  23. package/dist/factories/nats/compositions/index.js +2 -0
  24. package/dist/factories/nats/compositions/index.js.map +1 -0
  25. package/dist/factories/nats/compositions/nats-bootstrap.d.ts +49 -0
  26. package/dist/factories/nats/compositions/nats-bootstrap.d.ts.map +1 -0
  27. package/dist/factories/nats/compositions/nats-bootstrap.js +135 -0
  28. package/dist/factories/nats/compositions/nats-bootstrap.js.map +1 -0
  29. package/dist/factories/nats/index.d.ts +5 -0
  30. package/dist/factories/nats/index.d.ts.map +1 -0
  31. package/dist/factories/nats/index.js +5 -0
  32. package/dist/factories/nats/index.js.map +1 -0
  33. package/dist/factories/nats/resources/helm.d.ts +28 -0
  34. package/dist/factories/nats/resources/helm.d.ts.map +1 -0
  35. package/dist/factories/nats/resources/helm.js +39 -0
  36. package/dist/factories/nats/resources/helm.js.map +1 -0
  37. package/dist/factories/nats/resources/index.d.ts +3 -0
  38. package/dist/factories/nats/resources/index.d.ts.map +1 -0
  39. package/dist/factories/nats/resources/index.js +3 -0
  40. package/dist/factories/nats/resources/index.js.map +1 -0
  41. package/dist/factories/nats/resources/jetstream.d.ts +13 -0
  42. package/dist/factories/nats/resources/jetstream.d.ts.map +1 -0
  43. package/dist/factories/nats/resources/jetstream.js +105 -0
  44. package/dist/factories/nats/resources/jetstream.js.map +1 -0
  45. package/dist/factories/nats/types.d.ts +91 -0
  46. package/dist/factories/nats/types.d.ts.map +1 -0
  47. package/dist/factories/nats/types.js +72 -0
  48. package/dist/factories/nats/types.js.map +1 -0
  49. package/dist/factories/rook/types.d.ts +1 -1
  50. package/package.json +5 -1
@@ -0,0 +1,135 @@
1
+ import { mergeValuesExpression } from '../../../core/aspects/values-merge.js';
2
+ import { kubernetesComposition } from '../../../core/composition/imperative.js';
3
+ import { Cel } from '../../../core/references/cel.js';
4
+ import { isKubernetesRef } from '../../../utils/type-guards.js';
5
+ import { namespace } from '../../kubernetes/core/namespace.js';
6
+ import { DEFAULT_NACK_VERSION, DEFAULT_NATS_REPOSITORY_NAME, DEFAULT_NATS_REPOSITORY_URL, DEFAULT_NATS_VERSION, natsHelmRelease, natsHelmRepository, } from '../resources/helm.js';
7
+ import { NatsBootstrapConfigSchema, NatsBootstrapStatusSchema, } from '../types.js';
8
+ const DEFAULT_NATS_NAMESPACE = 'nats-system';
9
+ /** Install an official NATS cluster with JetStream and the NACK controller. */
10
+ export const natsBootstrap = kubernetesComposition({
11
+ name: 'nats-bootstrap',
12
+ kind: 'NatsBootstrap',
13
+ spec: NatsBootstrapConfigSchema,
14
+ status: NatsBootstrapStatusSchema,
15
+ }, (spec) => {
16
+ const graphMode = isKubernetesRef(spec.name);
17
+ const targetNamespace = graphMode
18
+ ? Cel.expr('has(schema.spec.namespace) ? schema.spec.namespace : "nats-system"')
19
+ : (spec.namespace ?? DEFAULT_NATS_NAMESPACE);
20
+ const ownsTargetNamespace = graphMode
21
+ ? Cel.expr('!has(schema.spec.namespaceOwnership) || schema.spec.namespaceOwnership == "owned"')
22
+ : spec.namespaceOwnership !== 'external';
23
+ const repositoryName = spec.repositoryName ?? DEFAULT_NATS_REPOSITORY_NAME;
24
+ const repositoryNamespace = spec.repositoryNamespace ?? targetNamespace;
25
+ const repositoryUrl = spec.repositoryUrl ?? DEFAULT_NATS_REPOSITORY_URL;
26
+ if (!graphMode) {
27
+ validateReplicaCount(spec.replicas);
28
+ }
29
+ const replicas = graphMode
30
+ ? Cel.expr('has(schema.spec.replicas) ? schema.spec.replicas : 1')
31
+ : (spec.replicas ?? 1);
32
+ const clusteringEnabled = graphMode ? Cel.expr(replicas, ' > 1') : replicas > 1;
33
+ const pvcWhenDeleted = graphMode
34
+ ? Cel.expr('has(schema.spec.pvcRetentionPolicy) && schema.spec.pvcRetentionPolicy == "delete" ? "Delete" : "Retain"')
35
+ : spec.pvcRetentionPolicy === 'delete'
36
+ ? 'Delete'
37
+ : 'Retain';
38
+ const endpoint = graphMode
39
+ ? Cel.expr('"nats://" + string(schema.spec.name) + "." + string(has(schema.spec.namespace) ? schema.spec.namespace : "nats-system") + ".svc:4222"')
40
+ : `nats://${spec.name}.${targetNamespace}.svc:4222`;
41
+ const serverDefaults = {
42
+ // Keep the chart Service identity identical to the public endpoint for
43
+ // every release name. Without this, Helm appends "-nats" whenever the
44
+ // release name itself does not contain the chart name.
45
+ fullnameOverride: spec.name,
46
+ config: {
47
+ cluster: { enabled: clusteringEnabled, replicas },
48
+ jetstream: {
49
+ enabled: true,
50
+ fileStore: {
51
+ enabled: true,
52
+ pvc: {
53
+ enabled: true,
54
+ size: spec.storageSize ?? '10Gi',
55
+ ...(spec.storageClassName && { storageClassName: spec.storageClassName }),
56
+ },
57
+ },
58
+ },
59
+ },
60
+ natsBox: { enabled: true },
61
+ statefulSet: {
62
+ merge: {
63
+ persistentVolumeClaimRetentionPolicy: {
64
+ whenDeleted: pvcWhenDeleted,
65
+ whenScaled: 'Retain',
66
+ },
67
+ },
68
+ },
69
+ };
70
+ const nackDefaults = {
71
+ jetstream: { enabled: true, nats: { url: endpoint }, controlLoop: true },
72
+ namespaced: false,
73
+ };
74
+ const serverValues = spec.values
75
+ ? mergeValuesExpression(serverDefaults, spec.values)
76
+ : serverDefaults;
77
+ const nackValues = spec.nackValues
78
+ ? mergeValuesExpression(nackDefaults, spec.nackValues)
79
+ : nackDefaults;
80
+ const _namespace = namespace({
81
+ id: 'natsNamespace',
82
+ metadata: {
83
+ name: targetNamespace,
84
+ labels: {
85
+ 'app.kubernetes.io/name': 'nats',
86
+ 'app.kubernetes.io/instance': spec.name,
87
+ 'app.kubernetes.io/managed-by': 'typekro',
88
+ },
89
+ },
90
+ }).withIncludeWhen(ownsTargetNamespace);
91
+ const _repository = natsHelmRepository({
92
+ id: 'natsHelmRepository',
93
+ name: repositoryName,
94
+ namespace: repositoryNamespace,
95
+ url: repositoryUrl,
96
+ });
97
+ const server = natsHelmRelease({
98
+ id: 'natsHelmRelease',
99
+ name: spec.name,
100
+ namespace: targetNamespace,
101
+ chart: 'nats',
102
+ version: spec.version ?? DEFAULT_NATS_VERSION,
103
+ values: serverValues,
104
+ repositoryName,
105
+ repositoryNamespace,
106
+ repositoryUrl,
107
+ });
108
+ const controller = natsHelmRelease({
109
+ id: 'nackHelmRelease',
110
+ name: 'nack',
111
+ namespace: targetNamespace,
112
+ chart: 'nack',
113
+ version: spec.nackVersion ?? DEFAULT_NACK_VERSION,
114
+ values: nackValues,
115
+ repositoryName,
116
+ repositoryNamespace,
117
+ repositoryUrl,
118
+ });
119
+ return {
120
+ ready: Cel.expr(server.status.conditions, '.exists(c, c.type == "Ready" && c.status == "True") && ', controller.status.conditions, '.exists(c, c.type == "Ready" && c.status == "True")'),
121
+ failed: Cel.expr(server.status.conditions, '.exists(c, c.type == "Ready" && c.status == "False") || ', controller.status.conditions, '.exists(c, c.type == "Ready" && c.status == "False")'),
122
+ phase: Cel.expr(server.status.conditions, '.exists(c, c.type == "Ready" && c.status == "True") && ', controller.status.conditions, '.exists(c, c.type == "Ready" && c.status == "True")', ' ? "Ready" : "Installing"'),
123
+ serverVersion: spec.version ?? DEFAULT_NATS_VERSION,
124
+ controllerVersion: spec.nackVersion ?? DEFAULT_NACK_VERSION,
125
+ endpoint,
126
+ };
127
+ });
128
+ /** Explicit lifecycle alias for shared platform ownership. */
129
+ export const natsInstallation = natsBootstrap;
130
+ function validateReplicaCount(value) {
131
+ if (value !== undefined && (!Number.isInteger(value) || value < 1)) {
132
+ throw new Error('NATS replicas must be an integer greater than or equal to 1.');
133
+ }
134
+ }
135
+ //# sourceMappingURL=nats-bootstrap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nats-bootstrap.js","sourceRoot":"","sources":["../../../../src/factories/nats/compositions/nats-bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAChF,OAAO,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAC/D,OAAO,EACL,oBAAoB,EACpB,4BAA4B,EAC5B,2BAA2B,EAC3B,oBAAoB,EACpB,eAAe,EACf,kBAAkB,GACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAEL,yBAAyB,EACzB,yBAAyB,GAE1B,MAAM,aAAa,CAAC;AAErB,MAAM,sBAAsB,GAAG,aAAa,CAAC;AAE7C,+EAA+E;AAC/E,MAAM,CAAC,MAAM,aAAa,GAAG,qBAAqB,CAChD;IACE,IAAI,EAAE,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,EAAE,GAAG,CAAC,IAAI,CACd,MAAM,CAAC,MAAM,CAAC,UAAU,EACxB,0DAA0D,EAC1D,UAAU,CAAC,MAAM,CAAC,UAAU,EAC5B,sDAAsD,CACvD;QACD,KAAK,EAAE,GAAG,CAAC,IAAI,CACb,MAAM,CAAC,MAAM,CAAC,UAAU,EACxB,yDAAyD,EACzD,UAAU,CAAC,MAAM,CAAC,UAAU,EAC5B,qDAAqD,EACrD,2BAA2B,CAC5B;QACD,aAAa,EAAE,IAAI,CAAC,OAAO,IAAI,oBAAoB;QACnD,iBAAiB,EAAE,IAAI,CAAC,WAAW,IAAI,oBAAoB;QAC3D,QAAQ;KACT,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,8DAA8D;AAC9D,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAAC;AAE9C,SAAS,oBAAoB,CAAC,KAAyB;IACrD,IAAI,KAAK,KAAK,SAAS,IAAI,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,EAAE,CAAC;QACnE,MAAM,IAAI,KAAK,CAAC,8DAA8D,CAAC,CAAC;IAClF,CAAC;AACH,CAAC"}
@@ -0,0 +1,5 @@
1
+ /** Official NATS, JetStream, and NACK integration for TypeKro. */
2
+ export * from './compositions/index.js';
3
+ export * from './resources/index.js';
4
+ export * from './types.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/factories/nats/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,YAAY,CAAC"}
@@ -0,0 +1,5 @@
1
+ /** Official NATS, JetStream, and NACK integration for TypeKro. */
2
+ export * from './compositions/index.js';
3
+ export * from './resources/index.js';
4
+ export * from './types.js';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/factories/nats/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,YAAY,CAAC"}
@@ -0,0 +1,28 @@
1
+ import type { Enhanced } from '../../../core/types/index.js';
2
+ import type { HelmReleaseSpec, HelmReleaseStatus } from '../../helm/types.js';
3
+ import type { HelmRepositorySpec, HelmRepositoryStatus } from '../../helm/helm-repository.js';
4
+ import type { NatsHelmValues } from '../types.js';
5
+ export declare const DEFAULT_NATS_REPOSITORY_URL = "https://nats-io.github.io/k8s/helm/charts/";
6
+ export declare const DEFAULT_NATS_REPOSITORY_NAME = "nats";
7
+ export declare const DEFAULT_NATS_VERSION = "2.14.0";
8
+ export declare const DEFAULT_NACK_VERSION = "0.34.0";
9
+ export declare function natsHelmRepository(config: {
10
+ name?: string;
11
+ namespace?: string;
12
+ url?: string;
13
+ id?: string;
14
+ }): Enhanced<HelmRepositorySpec, HelmRepositoryStatus>;
15
+ declare function natsChartRelease(config: {
16
+ name: string;
17
+ namespace: string;
18
+ chart: 'nats' | 'nack';
19
+ version: string;
20
+ values: NatsHelmValues;
21
+ repositoryName?: string;
22
+ repositoryNamespace?: string;
23
+ repositoryUrl?: string;
24
+ id?: string;
25
+ }): Enhanced<HelmReleaseSpec, HelmReleaseStatus>;
26
+ export declare function natsHelmRelease(config: Parameters<typeof natsChartRelease>[0]): Enhanced<HelmReleaseSpec, HelmReleaseStatus>;
27
+ export {};
28
+ //# sourceMappingURL=helm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helm.d.ts","sourceRoot":"","sources":["../../../../src/factories/nats/resources/helm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAI7D,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAC9F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,eAAO,MAAM,2BAA2B,+CAA+C,CAAC;AACxF,eAAO,MAAM,4BAA4B,SAAS,CAAC;AACnD,eAAO,MAAM,oBAAoB,WAAW,CAAC;AAC7C,eAAO,MAAM,oBAAoB,WAAW,CAAC;AAE7C,wBAAgB,kBAAkB,CAAC,MAAM,EAAE;IACzC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,GAAG,QAAQ,CAAC,kBAAkB,EAAE,oBAAoB,CAAC,CAQrD;AAED,iBAAS,gBAAgB,CAAC,MAAM,EAAE;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,cAAc,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,GAAG,QAAQ,CAAC,eAAe,EAAE,iBAAiB,CAAC,CAqB/C;AAED,wBAAgB,eAAe,CAC7B,MAAM,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC,CAAC,CAAC,GAC7C,QAAQ,CAAC,eAAe,EAAE,iBAAiB,CAAC,CAE9C"}
@@ -0,0 +1,39 @@
1
+ import { helmRelease } from '../../helm/helm-release.js';
2
+ import { createLabeledHelmReleaseEvaluator } from '../../helm/readiness-evaluators.js';
3
+ import { helmRepository } from '../../helm/helm-repository.js';
4
+ export const DEFAULT_NATS_REPOSITORY_URL = 'https://nats-io.github.io/k8s/helm/charts/';
5
+ export const DEFAULT_NATS_REPOSITORY_NAME = 'nats';
6
+ export const DEFAULT_NATS_VERSION = '2.14.0';
7
+ export const DEFAULT_NACK_VERSION = '0.34.0';
8
+ export function natsHelmRepository(config) {
9
+ return helmRepository({
10
+ name: config.name ?? DEFAULT_NATS_REPOSITORY_NAME,
11
+ namespace: config.namespace ?? 'flux-system',
12
+ url: config.url ?? DEFAULT_NATS_REPOSITORY_URL,
13
+ interval: '5m',
14
+ ...(config.id && { id: config.id }),
15
+ });
16
+ }
17
+ function natsChartRelease(config) {
18
+ return helmRelease({
19
+ name: config.name,
20
+ namespace: config.namespace,
21
+ chart: {
22
+ repository: config.repositoryUrl ?? DEFAULT_NATS_REPOSITORY_URL,
23
+ name: config.chart,
24
+ version: config.version,
25
+ },
26
+ sourceRef: {
27
+ name: config.repositoryName ?? DEFAULT_NATS_REPOSITORY_NAME,
28
+ namespace: config.repositoryNamespace ?? config.namespace,
29
+ kind: 'HelmRepository',
30
+ },
31
+ driftDetection: { mode: 'enabled' },
32
+ values: config.values,
33
+ ...(config.id && { id: config.id }),
34
+ }).withReadinessEvaluator(createLabeledHelmReleaseEvaluator('NATS'));
35
+ }
36
+ export function natsHelmRelease(config) {
37
+ return natsChartRelease(config);
38
+ }
39
+ //# sourceMappingURL=helm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helm.js","sourceRoot":"","sources":["../../../../src/factories/nats/resources/helm.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,iCAAiC,EAAE,MAAM,oCAAoC,CAAC;AACvF,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAK/D,MAAM,CAAC,MAAM,2BAA2B,GAAG,4CAA4C,CAAC;AACxF,MAAM,CAAC,MAAM,4BAA4B,GAAG,MAAM,CAAC;AACnD,MAAM,CAAC,MAAM,oBAAoB,GAAG,QAAQ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@@
1
+ export * from './helm.js';
2
+ export * from './jetstream.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/factories/nats/resources/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './helm.js';
2
+ export * from './jetstream.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/factories/nats/resources/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { Composable, Enhanced } from '../../../core/types/index.js';
2
+ import type { JetStreamConsumerConfig, JetStreamResourceStatus, JetStreamStreamConfig } from '../types.js';
3
+ /** Create a NACK-managed JetStream Stream. */
4
+ export declare function jetStreamStream(config: Composable<JetStreamStreamConfig>): Enhanced<JetStreamStreamConfig, JetStreamResourceStatus>;
5
+ /**
6
+ * Create a NACK-managed durable JetStream Consumer.
7
+ *
8
+ * `durableName` defaults to the Kubernetes resource `name`; this factory does
9
+ * not expose ephemeral consumers because NACK continuously reconciles the
10
+ * declared Consumer resource.
11
+ */
12
+ export declare function jetStreamConsumer(config: Composable<JetStreamConsumerConfig>): Enhanced<JetStreamConsumerConfig, JetStreamResourceStatus>;
13
+ //# sourceMappingURL=jetstream.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jetstream.d.ts","sourceRoot":"","sources":["../../../../src/factories/nats/resources/jetstream.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAkB,MAAM,8BAA8B,CAAC;AAEzF,OAAO,KAAK,EACV,uBAAuB,EACvB,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,aAAa,CAAC;AAuBrB,8CAA8C;AAC9C,wBAAgB,eAAe,CAC7B,MAAM,EAAE,UAAU,CAAC,qBAAqB,CAAC,GACxC,QAAQ,CAAC,qBAAqB,EAAE,uBAAuB,CAAC,CA2C1D;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,UAAU,CAAC,uBAAuB,CAAC,GAC1C,QAAQ,CAAC,uBAAuB,EAAE,uBAAuB,CAAC,CAuC5D"}
@@ -0,0 +1,105 @@
1
+ import { createResource } from '../../shared.js';
2
+ function jetStreamReadiness(resource) {
3
+ const typed = resource;
4
+ const status = typed?.status;
5
+ const ready = status?.conditions?.find((condition) => condition.type === 'Ready');
6
+ const generation = typed?.metadata?.generation;
7
+ const generationCurrent = generation !== undefined && status?.observedGeneration === generation;
8
+ return {
9
+ ready: generationCurrent && ready?.status === 'True',
10
+ reason: !status
11
+ ? 'StatusMissing'
12
+ : !generationCurrent
13
+ ? 'ObservedGenerationStale'
14
+ : (ready?.reason ?? 'ReadyConditionMissing'),
15
+ message: !generationCurrent
16
+ ? `NACK observed generation ${status?.observedGeneration ?? 'none'}; expected ${generation ?? 'none'}.`
17
+ : (ready?.message ?? 'NACK has not reported the resource ready.'),
18
+ };
19
+ }
20
+ /** Create a NACK-managed JetStream Stream. */
21
+ export function jetStreamStream(config) {
22
+ validateOptionalInteger('Stream replicas', config.replicas, 1);
23
+ validateOptionalInteger('Stream maxConsumers', config.maxConsumers, -1);
24
+ validateOptionalInteger('Stream maxMsgs', config.maxMsgs, -1);
25
+ validateOptionalInteger('Stream maxBytes', config.maxBytes, -1);
26
+ validateOptionalInteger('Stream maxMsgSize', config.maxMsgSize, -1);
27
+ return createResource({
28
+ apiVersion: 'jetstream.nats.io/v1beta2',
29
+ kind: 'Stream',
30
+ metadata: {
31
+ name: config.name,
32
+ ...(config.namespace && { namespace: config.namespace }),
33
+ labels: { 'app.kubernetes.io/managed-by': 'typekro' },
34
+ },
35
+ spec: {
36
+ name: config.streamName ?? config.name,
37
+ subjects: config.subjects,
38
+ ...(config.description && { description: config.description }),
39
+ ...(config.retention && { retention: config.retention }),
40
+ ...(config.storage && { storage: config.storage }),
41
+ ...(config.replicas && { replicas: config.replicas }),
42
+ ...(config.maxConsumers !== undefined && { maxConsumers: config.maxConsumers }),
43
+ ...(config.maxMsgs !== undefined && { maxMsgs: config.maxMsgs }),
44
+ ...(config.maxBytes !== undefined && { maxBytes: config.maxBytes }),
45
+ ...(config.maxAge && { maxAge: config.maxAge }),
46
+ ...(config.maxMsgSize !== undefined && { maxMsgSize: config.maxMsgSize }),
47
+ ...(config.duplicateWindow && { duplicateWindow: config.duplicateWindow }),
48
+ ...(config.discard && { discard: config.discard }),
49
+ ...(config.preventDelete !== undefined && { preventDelete: config.preventDelete }),
50
+ ...(config.preventUpdate !== undefined && { preventUpdate: config.preventUpdate }),
51
+ ...(config.servers && { servers: config.servers }),
52
+ ...(config.creds && { creds: config.creds }),
53
+ ...(config.nkey && { nkey: config.nkey }),
54
+ ...(config.jsDomain && { jsDomain: config.jsDomain }),
55
+ },
56
+ ...(config.id && { id: config.id }),
57
+ }, { scope: 'namespaced', dnsAddressable: false }).withReadinessEvaluator(jetStreamReadiness);
58
+ }
59
+ /**
60
+ * Create a NACK-managed durable JetStream Consumer.
61
+ *
62
+ * `durableName` defaults to the Kubernetes resource `name`; this factory does
63
+ * not expose ephemeral consumers because NACK continuously reconciles the
64
+ * declared Consumer resource.
65
+ */
66
+ export function jetStreamConsumer(config) {
67
+ validateOptionalInteger('Consumer maxDeliver', config.maxDeliver, -1);
68
+ validateOptionalInteger('Consumer maxAckPending', config.maxAckPending, -1);
69
+ validateOptionalInteger('Consumer replicas', config.replicas, 1);
70
+ return createResource({
71
+ apiVersion: 'jetstream.nats.io/v1beta2',
72
+ kind: 'Consumer',
73
+ metadata: {
74
+ name: config.name,
75
+ ...(config.namespace && { namespace: config.namespace }),
76
+ labels: { 'app.kubernetes.io/managed-by': 'typekro' },
77
+ },
78
+ spec: {
79
+ durableName: config.durableName ?? config.name,
80
+ streamName: config.streamName,
81
+ ...(config.ackPolicy && { ackPolicy: config.ackPolicy }),
82
+ ...(config.ackWait && { ackWait: config.ackWait }),
83
+ ...(config.maxDeliver !== undefined && { maxDeliver: config.maxDeliver }),
84
+ ...(config.filterSubject && { filterSubject: config.filterSubject }),
85
+ ...(config.filterSubjects && { filterSubjects: config.filterSubjects }),
86
+ ...(config.deliverPolicy && { deliverPolicy: config.deliverPolicy }),
87
+ ...(config.replayPolicy && { replayPolicy: config.replayPolicy }),
88
+ ...(config.maxAckPending !== undefined && { maxAckPending: config.maxAckPending }),
89
+ ...(config.replicas && { replicas: config.replicas }),
90
+ ...(config.servers && { servers: config.servers }),
91
+ ...(config.creds && { creds: config.creds }),
92
+ ...(config.nkey && { nkey: config.nkey }),
93
+ ...(config.jsDomain && { jsDomain: config.jsDomain }),
94
+ ...(config.preventDelete !== undefined && { preventDelete: config.preventDelete }),
95
+ ...(config.preventUpdate !== undefined && { preventUpdate: config.preventUpdate }),
96
+ },
97
+ ...(config.id && { id: config.id }),
98
+ }, { scope: 'namespaced', dnsAddressable: false }).withReadinessEvaluator(jetStreamReadiness);
99
+ }
100
+ function validateOptionalInteger(label, value, minimum) {
101
+ if (typeof value === 'number' && (!Number.isInteger(value) || value < minimum)) {
102
+ throw new Error(`${label} must be an integer greater than or equal to ${minimum}.`);
103
+ }
104
+ }
105
+ //# sourceMappingURL=jetstream.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jetstream.js","sourceRoot":"","sources":["../../../../src/factories/nats/resources/jetstream.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAOjD,SAAS,kBAAkB,CAAC,QAAiB;IAC3C,MAAM,KAAK,GAAG,QAED,CAAC;IACd,MAAM,MAAM,GAAG,KAAK,EAAE,MAAM,CAAC;IAC7B,MAAM,KAAK,GAAG,MAAM,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,IA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EAAE,MAAM,CAAC,OAAO,EAAE,CAAC;YAClD,GAAG,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC;YAC5C,GAAG,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;YACzC,GAAG,CAAC,MAAM,CAAC,QAAQ,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC;YACrD,GAAG,CAAC,MAAM,CAAC,aAAa,KAAK,SAAS,IAAI,EAAE,aAAa,EAAE,MAAM,CAAC,aAAa,EAAE,CAAC;YAClF,GAAG,CAAC,MAAM,CAAC,aAAa,KAAK,SAAS,IAAI,EAAE,aAAa,EAAE,MAAM,CAAC,aAAa,EAAE,CAAC;SACnF;QACD,GAAG,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC;KACpC,EACD,EAAE,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,KAAK,EAAE,CAC/C,CAAC,sBAAsB,CAAC,kBAAkB,CAG1C,CAAC;AACJ,CAAC;AAED,SAAS,uBAAuB,CAAC,KAAa,EAAE,KAAc,EAAE,OAAe;IAC7E,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,OAAO,CAAC,EAAE,CAAC;QAC/E,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,gDAAgD,OAAO,GAAG,CAAC,CAAC;IACtF,CAAC;AACH,CAAC"}
@@ -0,0 +1,91 @@
1
+ import type { TypeKroChartValue } from '../../core/types/common.js';
2
+ export declare const NatsBootstrapConfigSchema: import("arktype/internal/variants/object.ts").ObjectType<{
3
+ name: string;
4
+ namespace?: string;
5
+ namespaceOwnership?: "external" | "owned";
6
+ version?: string;
7
+ nackVersion?: string;
8
+ repositoryName?: string;
9
+ repositoryNamespace?: string;
10
+ repositoryUrl?: string;
11
+ replicas?: number;
12
+ storageSize?: string;
13
+ storageClassName?: string;
14
+ pvcRetentionPolicy?: "delete" | "retain";
15
+ values?: Record<string, unknown>;
16
+ nackValues?: Record<string, unknown>;
17
+ }, {}>;
18
+ export type NatsBootstrapConfig = Omit<typeof NatsBootstrapConfigSchema.infer, 'values' | 'nackValues'> & {
19
+ values?: TypeKroChartValue<Record<string, unknown>>;
20
+ nackValues?: TypeKroChartValue<Record<string, unknown>>;
21
+ };
22
+ export declare const NatsBootstrapStatusSchema: import("arktype/internal/variants/object.ts").ObjectType<{
23
+ ready: boolean;
24
+ failed: boolean;
25
+ phase: "Ready" | "Installing";
26
+ serverVersion: string;
27
+ controllerVersion: string;
28
+ endpoint: string;
29
+ }, {}>;
30
+ export type NatsBootstrapStatus = typeof NatsBootstrapStatusSchema.infer;
31
+ export declare const JetStreamStreamConfigSchema: import("arktype/internal/variants/object.ts").ObjectType<{
32
+ name: string;
33
+ subjects: string[];
34
+ streamName?: string;
35
+ namespace?: string;
36
+ id?: string;
37
+ description?: string;
38
+ retention?: "limits" | "interest" | "workqueue";
39
+ storage?: "memory" | "file";
40
+ replicas?: number;
41
+ maxConsumers?: number;
42
+ maxMsgs?: number;
43
+ maxBytes?: number;
44
+ maxAge?: string;
45
+ maxMsgSize?: number;
46
+ duplicateWindow?: string;
47
+ discard?: "old" | "new";
48
+ preventDelete?: boolean;
49
+ preventUpdate?: boolean;
50
+ servers?: string[];
51
+ creds?: string;
52
+ nkey?: string;
53
+ jsDomain?: string;
54
+ }, {}>;
55
+ export type JetStreamStreamConfig = typeof JetStreamStreamConfigSchema.infer;
56
+ export declare const JetStreamConsumerConfigSchema: import("arktype/internal/variants/object.ts").ObjectType<{
57
+ name: string;
58
+ streamName: string;
59
+ namespace?: string;
60
+ id?: string;
61
+ durableName?: string;
62
+ ackPolicy?: "none" | "all" | "explicit";
63
+ ackWait?: string;
64
+ maxDeliver?: number;
65
+ filterSubject?: string;
66
+ filterSubjects?: string[];
67
+ deliverPolicy?: "all" | "new" | "last" | "lastPerSubject";
68
+ replayPolicy?: "original" | "instant";
69
+ maxAckPending?: number;
70
+ replicas?: number;
71
+ servers?: string[];
72
+ creds?: string;
73
+ nkey?: string;
74
+ jsDomain?: string;
75
+ preventDelete?: boolean;
76
+ preventUpdate?: boolean;
77
+ }, {}>;
78
+ export type JetStreamConsumerConfig = typeof JetStreamConsumerConfigSchema.infer;
79
+ export interface JetStreamCondition {
80
+ type: string;
81
+ status: 'True' | 'False' | 'Unknown';
82
+ reason?: string;
83
+ message?: string;
84
+ lastTransitionTime?: string;
85
+ }
86
+ export interface JetStreamResourceStatus {
87
+ observedGeneration?: number;
88
+ conditions?: JetStreamCondition[];
89
+ }
90
+ export type NatsHelmValues = TypeKroChartValue<Record<string, unknown>>;
91
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/factories/nats/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAEpE,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;MAepC,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,IAAI,CACpC,OAAO,yBAAyB,CAAC,KAAK,EACtC,QAAQ,GAAG,YAAY,CACxB,GAAG;IACF,MAAM,CAAC,EAAE,iBAAiB,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACpD,UAAU,CAAC,EAAE,iBAAiB,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACzD,CAAC;AAEF,eAAO,MAAM,yBAAyB;;;;;;;MAOpC,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,OAAO,yBAAyB,CAAC,KAAK,CAAC;AAEzE,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;MAuBtC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,OAAO,2BAA2B,CAAC,KAAK,CAAC;AAE7E,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;MAqBxC,CAAC;AAEH,MAAM,MAAM,uBAAuB,GAAG,OAAO,6BAA6B,CAAC,KAAK,CAAC;AAEjF,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,uBAAuB;IACtC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,UAAU,CAAC,EAAE,kBAAkB,EAAE,CAAC;CACnC;AAED,MAAM,MAAM,cAAc,GAAG,iBAAiB,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC"}
@@ -0,0 +1,72 @@
1
+ import { type } from 'arktype';
2
+ export const NatsBootstrapConfigSchema = type({
3
+ name: 'string',
4
+ 'namespace?': 'string',
5
+ 'namespaceOwnership?': '"owned" | "external"',
6
+ 'version?': 'string',
7
+ 'nackVersion?': 'string',
8
+ 'repositoryName?': 'string',
9
+ 'repositoryNamespace?': 'string',
10
+ 'repositoryUrl?': 'string',
11
+ 'replicas?': 'number.integer >= 1',
12
+ 'storageSize?': 'string',
13
+ 'storageClassName?': 'string',
14
+ 'pvcRetentionPolicy?': '"retain" | "delete"',
15
+ 'values?': 'Record<string, unknown>',
16
+ 'nackValues?': 'Record<string, unknown>',
17
+ });
18
+ export const NatsBootstrapStatusSchema = type({
19
+ ready: 'boolean',
20
+ failed: 'boolean',
21
+ phase: '"Ready" | "Installing"',
22
+ serverVersion: 'string',
23
+ controllerVersion: 'string',
24
+ endpoint: 'string',
25
+ });
26
+ export const JetStreamStreamConfigSchema = type({
27
+ name: 'string',
28
+ 'streamName?': 'string',
29
+ 'namespace?': 'string',
30
+ 'id?': 'string',
31
+ subjects: 'string[]',
32
+ 'description?': 'string',
33
+ 'retention?': '"limits" | "interest" | "workqueue"',
34
+ 'storage?': '"file" | "memory"',
35
+ 'replicas?': 'number.integer >= 1',
36
+ 'maxConsumers?': 'number.integer >= -1',
37
+ 'maxMsgs?': 'number.integer >= -1',
38
+ 'maxBytes?': 'number.integer >= -1',
39
+ 'maxAge?': 'string',
40
+ 'maxMsgSize?': 'number.integer >= -1',
41
+ 'duplicateWindow?': 'string',
42
+ 'discard?': '"old" | "new"',
43
+ 'preventDelete?': 'boolean',
44
+ 'preventUpdate?': 'boolean',
45
+ 'servers?': 'string[]',
46
+ 'creds?': 'string',
47
+ 'nkey?': 'string',
48
+ 'jsDomain?': 'string',
49
+ });
50
+ export const JetStreamConsumerConfigSchema = type({
51
+ name: 'string',
52
+ 'namespace?': 'string',
53
+ 'id?': 'string',
54
+ streamName: 'string',
55
+ 'durableName?': 'string',
56
+ 'ackPolicy?': '"none" | "all" | "explicit"',
57
+ 'ackWait?': 'string',
58
+ 'maxDeliver?': 'number.integer >= -1',
59
+ 'filterSubject?': 'string',
60
+ 'filterSubjects?': 'string[]',
61
+ 'deliverPolicy?': '"all" | "last" | "new" | "lastPerSubject"',
62
+ 'replayPolicy?': '"instant" | "original"',
63
+ 'maxAckPending?': 'number.integer >= -1',
64
+ 'replicas?': 'number.integer >= 1',
65
+ 'servers?': 'string[]',
66
+ 'creds?': 'string',
67
+ 'nkey?': 'string',
68
+ 'jsDomain?': 'string',
69
+ 'preventDelete?': 'boolean',
70
+ 'preventUpdate?': 'boolean',
71
+ });
72
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/factories/nats/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAG/B,MAAM,CAAC,MAAM,yBAA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AAE,QAAQ;IACjB,WAAW,EAAE,QAAQ;CACtB,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,6BAA6B,GAAG,IAAI,CAAC;IAChD,IAAI,EAAE,QAAQ;IACd,YAAY,EAAE,QAAQ;IACtB,KAAK,EAAE,QAAQ;IACf,UAAU,EAAE,QAAQ;IACpB,cAAc,EAAE,QAAQ;IACxB,YAAY,EAAE,6BAA6B;IAC3C,UAAU,EAAE,QAAQ;IACpB,aAAa,EAAE,sBAAsB;IACrC,gBAAgB,EAAE,QAAQ;IAC1B,iBAAiB,EAAE,UAAU;IAC7B,gBAAgB,EAAE,2CAA2C;IAC7D,eAAe,EAAE,wBAAwB;IACzC,gBAAgB,EAAE,sBAAsB;IACxC,WAAW,EAAE,qBAAqB;IAClC,UAAU,EAAE,UAAU;IACtB,QAAQ,EAAE,QAAQ;IAClB,OAAO,EAAE,QAAQ;IACjB,WAAW,EAAE,QAAQ;IACrB,gBAAgB,EAAE,SAAS;IAC3B,gBAAgB,EAAE,SAAS;CAC5B,CAAC,CAAC"}
@@ -241,7 +241,7 @@ export declare const RookBucketStorageClassConfigSchema: import("arktype/interna
241
241
  objectStoreNamespace: string;
242
242
  operatorNamespace: string;
243
243
  provisionerNamePrefix?: string;
244
- reclaimPolicy?: "Retain" | "Delete";
244
+ reclaimPolicy?: "Delete" | "Retain";
245
245
  existingBucketName?: string;
246
246
  labels?: Record<string, string>;
247
247
  annotations?: Record<string, string>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "typekro",
3
- "version": "0.25.0",
3
+ "version": "0.26.0",
4
4
  "description": "A control plane aware framework for orchestrating kubernetes resources like a programmer.",
5
5
  "type": "module",
6
6
  "repository": {
@@ -98,6 +98,10 @@
98
98
  "import": "./dist/factories/valkey/index.js",
99
99
  "types": "./dist/factories/valkey/index.d.ts"
100
100
  },
101
+ "./nats": {
102
+ "import": "./dist/factories/nats/index.js",
103
+ "types": "./dist/factories/nats/index.d.ts"
104
+ },
101
105
  "./containers": {
102
106
  "import": "./dist/core/containers/index.js",
103
107
  "types": "./dist/core/containers/index.d.ts"