@firestartr/cli 2.7.0-snapshot-18 → 2.7.0-snapshot-20

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.
@@ -39,5 +39,11 @@ export declare enum envVars {
39
39
  operatorDeploymentName = "OPERATOR_DEPLOYMENT_NAME",
40
40
  operatorNumberOfMaxSlots = "OPERATOR_NUMBER_OF_MAX_SLOTS",
41
41
  kubernetesServiceHost = "KUBERNETES_SERVICE_HOST",
42
- kubernetesServicePort = "KUBERNETES_SERVICE_PORT"
42
+ kubernetesServicePort = "KUBERNETES_SERVICE_PORT",
43
+ crsStatusTombstoneTtl = "CRS_STATUS_TOMBSTONE_TTL",
44
+ crsStatusPort = "CRS_STATUS_PORT",
45
+ crsStatusKindList = "CRS_STATUS_KIND_LIST",
46
+ crsStatusNamespace = "CRS_STATUS_NAMESPACE",
47
+ crsStatusApiGroup = "CRS_STATUS_API_GROUP",
48
+ crsStatusApiVersion = "CRS_STATUS_API_VERSION"
43
49
  }
@@ -0,0 +1,2 @@
1
+ import { Subcommand } from '../types';
2
+ export declare const crsStatusSubcommand: Subcommand;
@@ -0,0 +1 @@
1
+ export declare function runService(): Promise<void>;
@@ -0,0 +1,19 @@
1
+ import type { StatusProjection } from './types';
2
+ export declare class StatusCache {
3
+ private live;
4
+ private tombstones;
5
+ private claimRefIndex;
6
+ private cacheKey;
7
+ private claimRefKey;
8
+ private indexClaimRef;
9
+ private unindexClaimRef;
10
+ upsert(kind: string, name: string, projection: StatusProjection): void;
11
+ delete(kind: string, name: string, tombstoneTtlMs: number): void;
12
+ getByClaimRef(claimKind: string, claimName: string): StatusProjection[];
13
+ getAll(): StatusProjection[];
14
+ getSize(): {
15
+ live: number;
16
+ tombstones: number;
17
+ };
18
+ private evictExpiredTombstones;
19
+ }
@@ -0,0 +1,9 @@
1
+ export interface ServiceConfig {
2
+ port: number;
3
+ kindList: string[];
4
+ namespace: string;
5
+ apiGroup: string;
6
+ apiVersion: string;
7
+ tombstoneTtlMs: number;
8
+ }
9
+ export declare function loadConfig(): ServiceConfig;
@@ -0,0 +1,22 @@
1
+ import type { StatusCache } from './cache';
2
+ import type { ServiceConfig } from './config';
3
+ export declare class KindInformer {
4
+ private config;
5
+ private plural;
6
+ private cache;
7
+ private kc;
8
+ private api;
9
+ private watch;
10
+ private watchRequest;
11
+ private shouldReconnect;
12
+ private reconnectTimer;
13
+ private resourceVersion;
14
+ constructor(config: ServiceConfig, plural: string, cache: StatusCache);
15
+ private watchPath;
16
+ start(): Promise<void>;
17
+ stop(): void;
18
+ private listExisting;
19
+ private startWatch;
20
+ private handleEvent;
21
+ private scheduleReconnect;
22
+ }
@@ -0,0 +1,11 @@
1
+ declare const _default: {
2
+ error: (...args: any) => void;
3
+ warn: (...args: any) => void;
4
+ info: (...args: any) => void;
5
+ debug: (...args: any) => void;
6
+ verbose: (...args: any) => void;
7
+ silly: (...args: any) => void;
8
+ enableFileLogging: typeof import("../../catalog_common/src/logger/logger").enableFileLogging;
9
+ disableFileLogging: typeof import("../../catalog_common/src/logger/logger").disableFileLogging;
10
+ };
11
+ export default _default;
@@ -0,0 +1,4 @@
1
+ export declare function derivePhase(conditions: {
2
+ type: string;
3
+ status: string;
4
+ }[]): string;
@@ -0,0 +1,2 @@
1
+ import type { StatusCache } from './cache';
2
+ export declare function createServer(cache: StatusCache, port: number): Promise<void>;
@@ -0,0 +1,17 @@
1
+ export interface Condition {
2
+ type: string;
3
+ status: string;
4
+ reason: string;
5
+ message: string;
6
+ lastTransitionTime: string;
7
+ }
8
+ export interface StatusProjection {
9
+ kind: string;
10
+ name: string;
11
+ namespace: string;
12
+ claimKind: string | null;
13
+ claimName: string | null;
14
+ phase: string;
15
+ conditions: Condition[];
16
+ observedAt: string;
17
+ }
@@ -1 +1,2 @@
1
- export { provisionManagedFiles } from './managed_files';
1
+ export { provisionManagedFiles, seedForMigrationReimport, } from './managed_files';
2
+ export type { ManagedFilesResult } from './managed_files';
@@ -1,2 +1,15 @@
1
1
  import { EntityGHFeature } from '../';
2
- export declare function provisionManagedFiles(ghFeature: EntityGHFeature): Promise<void>;
2
+ export interface ManagedFilesResult {
3
+ newlyProvisionedAddresses: string[];
4
+ installedManagedFiles: string[];
5
+ }
6
+ /**
7
+ * Migration reimport path for `import-with-reimport` operations.
8
+ *
9
+ * Populates `config.files` with ONLY non-user-managed files so the subsequent
10
+ * `loadAddressesToImport` can generate correct import blocks for them.
11
+ * Seeds `installed_managed_files` from ALL `userManaged: true` addresses in the
12
+ * current CR spec so the TFM input is ready for the next regular apply cycle.
13
+ */
14
+ export declare function seedForMigrationReimport(ghFeature: EntityGHFeature): Promise<void>;
15
+ export declare function provisionManagedFiles(ghFeature: EntityGHFeature): Promise<ManagedFilesResult>;
@@ -1,9 +1,39 @@
1
1
  import { Entity } from '../base';
2
2
  export declare class EntityGHFeature extends Entity {
3
+ _newlyProvisionedAddresses: string[];
3
4
  constructor(artifact: any);
4
5
  loadResources(tfOp: string): Promise<void>;
5
6
  postProvision(tfOp: string): Promise<void>;
7
+ /**
8
+ * Called by `runOnTerraform` during `import-with-reimport` after
9
+ * `loadResources('import-with-reimport')` has already seeded `config.files`
10
+ * with only non-user-managed files.
11
+ *
12
+ * Emits one import block per file:
13
+ * to: github_repository_file.managed["<file>/<branch>"]
14
+ * id: <repoName>:<file>:<branch>
15
+ *
16
+ * User-managed files are intentionally excluded (see ADR 0005).
17
+ */
6
18
  loadAddressesToImport(): Promise<void>;
7
- keepUntrackedFiles(tfOp: string): Promise<void>;
19
+ /**
20
+ * Pre-apply state rm — runs inside loadResources before the main TF operation.
21
+ *
22
+ * Fetches the current TF state list, then removes any user-managed resource
23
+ * addresses that are in installedManagedFiles AND are not currently
24
+ * transitioning from userManaged:true to userManaged:false. This prevents
25
+ * Terraform from planning a destroy for files that were dropped from the
26
+ * feature definition or are still under user control from a previous apply.
27
+ */
28
+ preApplyStateRm(installedManagedFiles: string[]): Promise<void>;
29
+ /**
30
+ * Destroy path — removes user-managed file resources from TF state before
31
+ * the destroy operation so Terraform does not delete them from GitHub.
32
+ *
33
+ * Uses `terraform state list` to discover what is actually in state rather
34
+ * than reading config.files, making this robust whether the entity was last
35
+ * provisioned with old or new code.
36
+ */
37
+ keepUntrackedFiles(_tfOp: string): Promise<void>;
8
38
  getFileContentFromProvider(org: string, url: string): Promise<string>;
9
39
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firestartr/cli",
3
- "version": "2.7.0-snapshot-18",
3
+ "version": "2.7.0-snapshot-20",
4
4
  "private": false,
5
5
  "description": "Commandline tool",
6
6
  "main": "build/main.js",
@@ -28,6 +28,7 @@
28
28
  "cdk8s_renderer": "file:../cdk8s_renderer",
29
29
  "command-line-args": "^5.2.1",
30
30
  "crs_analyzer": "file:../crs_analyzer",
31
+ "crs_status_service": "file:../crs_status_service",
31
32
  "importer": "file:../importer",
32
33
  "operator": "file:../operator",
33
34
  "scaffolder": "file:../scaffolder"