@firestartr/cli 2.11.0-snapshot-patch-claims-2 → 2.11.0-snapshot-mco-03

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.
@@ -9,6 +9,8 @@ export { InitializerDefault } from './src/defaults/initializer';
9
9
  export { InitializerClaimRef } from './src/initializers/claimRef';
10
10
  export { GithubRepositoryOverrider } from './src/overriders/githubRepositoryOverride';
11
11
  export { InitializerPatches as Initializer } from './src/initializers/base';
12
+ export { resolveCodeownersRef } from './src/utils/repositoryClaimUtils';
13
+ export { setRenderedClaim, emptyRenderedClaims } from './src/refresolver';
12
14
  import { runComparer } from './src/comparer';
13
15
  import { AllowedProviders, setDefaultBranch, setPath, setRepositoryUrl } from './src/config';
14
16
  import { render } from './src/renderer/renderer';
@@ -12,7 +12,7 @@ export declare class FeaturesOverrider extends OverriderPatches {
12
12
  getFeatureConfig(cr: any): any;
13
13
  setUpAndRunRenderer(cr: any): any;
14
14
  __validate(): Promise<boolean>;
15
- __patches(claim: any, _previousCR: any): Promise<{
15
+ __patches(claim: any, _previousCR: any): Promise<({
16
16
  validate(_cr: any): boolean;
17
17
  apply(cr: any): Promise<any>;
18
18
  identify(): string;
@@ -20,5 +20,14 @@ export declare class FeaturesOverrider extends OverriderPatches {
20
20
  applicableProviders: string[];
21
21
  };
22
22
  post(cr: any): Promise<import("../claims/github/repositoryFeature").IGithubRepositoryFeatureClaim>;
23
- }[]>;
23
+ isPostPatch?: undefined;
24
+ } | {
25
+ isPostPatch: boolean;
26
+ validate(): boolean;
27
+ apply(cr: any): Promise<any>;
28
+ identify(): string;
29
+ applicable(): {
30
+ applicableProviders: string[];
31
+ };
32
+ })[]>;
24
33
  }
@@ -45,6 +45,7 @@ export interface CollaboratorPermission {
45
45
  * @returns string
46
46
  */
47
47
  export declare function createCodeOwnersData(claim: any, additionalRules?: any[]): string;
48
+ export declare function resolveCodeownersRef(ref: string, org: string): string;
48
49
  /**
49
50
  * A reference to a secret, which can be an internal or external source.
50
51
  */
@@ -1,11 +1,8 @@
1
- import { getFeatureConfigFromRef, getFeatureConfig, getFeaturePatches, getFeaturePatchesFromRef, prepareFeature } from './installer';
2
- import { renderFeature, renderFeatureFromPath, getFeaturePatchesFromPath } from './renderer';
1
+ import { getFeatureConfigFromRef, getFeatureConfig, prepareFeature } from './installer';
2
+ import { renderFeature, renderFeatureFromPath } from './renderer';
3
3
  declare const _default: {
4
4
  renderFeature: typeof renderFeature;
5
5
  renderFeatureFromPath: typeof renderFeatureFromPath;
6
- getFeaturePatches: typeof getFeaturePatches;
7
- getFeaturePatchesFromRef: typeof getFeaturePatchesFromRef;
8
- getFeaturePatchesFromPath: typeof getFeaturePatchesFromPath;
9
6
  getFeatureConfigFromRef: typeof getFeatureConfigFromRef;
10
7
  getFeatureConfig: typeof getFeatureConfig;
11
8
  prepareFeature: typeof prepareFeature;
@@ -2,7 +2,5 @@ export declare function getFeatureConfigFromRef(featureName: string, featureRef:
2
2
  featureArgs?: any, repo?: string, owner?: string): Promise<any>;
3
3
  export declare function getFeatureConfig(featureName: string, version: string, featureOwner: any, // -> cr
4
4
  featureArgs?: any, repo?: string, owner?: string): Promise<any>;
5
- export declare function getFeaturePatches(featureName: string, version: string, featureOwner: any, featureArgs?: any, repo?: string, owner?: string): Promise<any[]>;
6
- export declare function getFeaturePatchesFromRef(featureName: string, featureRef: string, featureOwner: any, featureArgs?: any, repo?: string, owner?: string): Promise<any[]>;
7
5
  export declare function prepareFeature(featureName: string, version: string, repo?: string, owner?: string): Promise<void>;
8
6
  export declare function downloadFeatureZip(repo: string, featureName: string, reference: string, owner?: string): Promise<string>;
@@ -1,4 +1,2 @@
1
1
  export declare function renderFeature(featureName: string, version: string, owner: any, repo: any, featureOwner: any, renderPath?: string, featureArgs?: any): any;
2
2
  export declare function renderFeatureFromPath(extractPath: string, renderedPath: string, featureOwner: any, featureArgs?: any): any;
3
- export declare function getFeaturePatches(featureName: string, version: string, owner: any, repo: any, featureOwner: any, featureArgs?: any): any[];
4
- export declare function getFeaturePatchesFromPath(extractPath: string, featureOwner: any, featureArgs?: any): any[];
@@ -1,8 +1,7 @@
1
1
  import validate from './src/validate';
2
- import render, { buildContext, renderContent, expandFiles, getPatches } from './src/render';
2
+ import render, { buildContext, renderContent, expandFiles } from './src/render';
3
3
  import updateFileContent from './src/update_file';
4
4
  import { validateFeatureArgs } from './src/featureArgsValidation';
5
- export { getPatches, buildContext, renderContent, expandFiles };
6
5
  declare const _default: {
7
6
  validate: typeof validate;
8
7
  render: typeof render;
@@ -13,12 +12,10 @@ declare const _default: {
13
12
  buildExpectedOutput: (config: import("./src/auxiliar").FeatureConfig, renderDir: string) => import("./src/auxiliar").ExpectedOutput;
14
13
  loadAndValidateRenderTests: (featurePath: string) => import("./src/auxiliar").RenderTestsFile;
15
14
  resolveCrPath: (featurePath: string, crRelPath: string) => string;
16
- resolveClaimPath: (featurePath: string, claimRelPath: string) => string;
17
15
  };
18
16
  buildContext: typeof buildContext;
19
17
  renderContent: typeof renderContent;
20
18
  expandFiles: typeof expandFiles;
21
19
  validateFeatureArgs: typeof validateFeatureArgs;
22
- getPatches: typeof getPatches;
23
20
  };
24
21
  export default _default;
@@ -25,8 +25,7 @@ export interface ExpectedOutput {
25
25
  }
26
26
  export interface RenderTest {
27
27
  name: string;
28
- cr?: string;
29
- claim?: string;
28
+ cr: string;
30
29
  args?: Record<string, unknown>;
31
30
  }
32
31
  export interface RenderTestsFile {
@@ -61,7 +60,6 @@ export interface RenderContext {
61
60
  export declare function formatAjvErrors(errors: ErrorObject[] | null | undefined): string;
62
61
  declare function loadAndValidateRenderTests(featurePath: string): RenderTestsFile;
63
62
  declare function resolveCrPath(featurePath: string, crRelPath: string): string;
64
- declare function resolveClaimPath(featurePath: string, claimRelPath: string): string;
65
63
  export declare function listYamlFiles(dir: string): string[];
66
64
  declare function loadYaml<T = unknown>(file: string): T;
67
65
  declare function mkNamedTmp(...names: string[]): Promise<string>;
@@ -74,6 +72,5 @@ declare const _default: {
74
72
  buildExpectedOutput: typeof buildExpectedOutput;
75
73
  loadAndValidateRenderTests: typeof loadAndValidateRenderTests;
76
74
  resolveCrPath: typeof resolveCrPath;
77
- resolveClaimPath: typeof resolveClaimPath;
78
75
  };
79
76
  export default _default;
@@ -1,6 +1,5 @@
1
1
  export default function render(featurePath: string, featureRenderPath: string, entity: any, firestartrConfig?: any, featureArgs?: any): any;
2
- export declare function getPatches(featurePath: string, entity: any, firestartrConfig?: any, featureArgs?: any): any[];
3
- export declare function buildContext(stitchedClaim: any, args: any, firestartrConfig: any, featureArgs: any): any;
2
+ export declare function buildContext(entity: any, args: any, firestartrConfig: any, featureArgs: any): any;
4
3
  export declare function expandFiles(featurePath: string, configData: any, context: any): void;
5
4
  export declare function renderContent(template: string, ctx: any): any;
6
5
  export declare function assertNonEmptyString(value: unknown, what: string): asserts value is string;
@@ -20,8 +20,13 @@ declare const _default: {
20
20
  };
21
21
  patches: {
22
22
  type: string;
23
- items: {
24
- $ref: string;
23
+ patternProperties: {
24
+ '^.+$': {
25
+ type: string;
26
+ items: {
27
+ $ref: string;
28
+ };
29
+ };
25
30
  };
26
31
  };
27
32
  filesTemplates: {
@@ -124,7 +129,7 @@ declare const _default: {
124
129
  type: string;
125
130
  };
126
131
  value: {
127
- type: string[];
132
+ type: string;
128
133
  };
129
134
  };
130
135
  required: string[];
@@ -4,6 +4,36 @@ export declare function setResourcesPath(path: string): void;
4
4
  export declare function getResourcesPath(): string;
5
5
  export declare function setConfigPath(path: string): void;
6
6
  export declare function getConfigPath(): string;
7
+ export declare function setClaimsDefaultsPath(path: string): void;
8
+ export declare function getClaimsDefaultsPath(): string;
9
+ /**
10
+ * Loads claims_defaults.yaml once and caches the default owner claim reference.
11
+ * Must be called after setClaimsDefaultsPath() and before any decanter runs.
12
+ */
13
+ export declare function loadClaimsDefaultsOnce(): void;
14
+ /**
15
+ * Returns the cached default owner claim reference (e.g., "group:group_a" or "user:user_a").
16
+ * Returns null if not loaded or not set in claims_defaults.yaml.
17
+ */
18
+ export declare function getDefaultOwnerClaimRef(): string | null;
19
+ /**
20
+ * Resolves the default owner claim reference to CODEOWNERS handle(s) using the
21
+ * same claim-to-external-name mapping used by CODEOWNERS generation.
22
+ * Must be called after the referenced claims have been seeded into the renderer
23
+ * (i.e., after setPreviousCRs) so resolveCodeownersRef can resolve them.
24
+ */
25
+ export declare function resolveDefaultOwnerHandles(org: string): void;
26
+ /**
27
+ * Returns the resolved default owner CODEOWNERS handles, if any.
28
+ */
29
+ export declare function getDefaultOwnerHandles(): {
30
+ team: string | null;
31
+ user: string | null;
32
+ };
33
+ /**
34
+ * Resets the cached default owner claim ref and handles (useful for testing).
35
+ */
36
+ export declare function resetClaimsDefaultsCache(): void;
7
37
  declare const _default: {
8
38
  setClaimsPath: typeof setClaimsPath;
9
39
  getClaimsPath: typeof getClaimsPath;
@@ -11,5 +41,12 @@ declare const _default: {
11
41
  getResourcesPath: typeof getResourcesPath;
12
42
  setConfigPath: typeof setConfigPath;
13
43
  getConfigPath: typeof getConfigPath;
44
+ setClaimsDefaultsPath: typeof setClaimsDefaultsPath;
45
+ getClaimsDefaultsPath: typeof getClaimsDefaultsPath;
46
+ loadClaimsDefaultsOnce: typeof loadClaimsDefaultsOnce;
47
+ getDefaultOwnerClaimRef: typeof getDefaultOwnerClaimRef;
48
+ resolveDefaultOwnerHandles: typeof resolveDefaultOwnerHandles;
49
+ getDefaultOwnerHandles: typeof getDefaultOwnerHandles;
50
+ resetClaimsDefaultsCache: typeof resetClaimsDefaultsCache;
14
51
  };
15
52
  export default _default;
@@ -11,7 +11,7 @@ export declare const collections: {
11
11
  RepoCollectionGithubDecanter: typeof RepoCollectionGithubDecanter;
12
12
  };
13
13
  export declare function isInPreviousCRs(kind: string, name: string): boolean;
14
- export declare function setPreviousCRs(resourcesPath: string): Promise<void>;
14
+ export declare function setPreviousCRs(resourcesPath: string, org?: string): Promise<void>;
15
15
  export declare function importGithubGitopsRepository(org: string, skipPlan: boolean, claimsPath: string, resourcesPath: string, configPath: string, filters: CollectionFilter[], needsReImport: boolean, force: boolean): Promise<void>;
16
16
  export declare function getPreviousCrs(crsPath: string): Promise<void>;
17
17
  declare const _default: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firestartr/cli",
3
- "version": "2.11.0-snapshot-patch-claims-2",
3
+ "version": "2.11.0-snapshot-mco-03",
4
4
  "private": false,
5
5
  "description": "Commandline tool",
6
6
  "main": "build/main.js",
@@ -1,14 +0,0 @@
1
- export type StitchingViolationReason = 'protected-path' | 'overwrite-protected' | 'duplicate-path';
2
- export interface StitchingViolation {
3
- feature: string;
4
- op: string;
5
- path: string;
6
- reason: StitchingViolationReason;
7
- conflictingFeature?: string;
8
- message: string;
9
- }
10
- export declare class StitchingError extends Error {
11
- violations: StitchingViolation[];
12
- constructor(violations: StitchingViolation[]);
13
- }
14
- export declare function formatStitchingError(error: StitchingError): string;
@@ -1,3 +0,0 @@
1
- export declare const PROTECTED_CLAIM_PATHS: string[];
2
- export declare function isProtectedPath(patchPath: string): boolean;
3
- export declare function normalizePointer(pointer: string): string;
@@ -1,19 +0,0 @@
1
- export interface FeaturePatchEnvelope {
2
- feature: string;
3
- patches: Array<{
4
- op: string;
5
- path: string;
6
- value?: unknown;
7
- name?: string;
8
- }>;
9
- }
10
- export declare function MOCK_STITCHING_FEATURES(mock?: (claim: unknown) => Promise<FeaturePatchEnvelope[]>): void;
11
- export declare function stitchClaim(claimAfterDefaults: unknown, preCollectedEnvelopes?: FeaturePatchEnvelope[]): Promise<unknown>;
12
- export declare function extractClaimPatches(rendered: {
13
- patches?: unknown;
14
- }): Array<{
15
- op: string;
16
- path: string;
17
- value?: unknown;
18
- name?: string;
19
- }>;