@toolproof-npm/shared 0.1.115 → 0.1.116
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BranchStepIdentityJson, ExecutionIdentityJson, ForStepIdentityJson,
|
|
1
|
+
import type { BranchStepIdentityJson, ExecutionIdentityJson, ForStepIdentityJson, JobIdentityJson, ResourceFormatIdentityJson, ResourceIdentityJson, ResourceRoleIdentityJson, ResourceTypeIdentityJson, StatefulStrategyIdentityJson, StatelessStrategyIdentityJson, StrategyRunIdentityJson, StrategyThreadIdentityJson, WhileStepIdentityJson, WorkStepIdentityJson } from '@toolproof-npm/schema';
|
|
2
2
|
import type { ResourceMap, IdentityPrefix } from './_lib/types.js';
|
|
3
3
|
import { CONSTANTS } from './constants.js';
|
|
4
4
|
type StripTrailingS<S extends string> = S extends `${infer Rest}S` ? Rest : S;
|
|
@@ -7,7 +7,19 @@ export type StepKind = keyof typeof CONSTANTS.STEPS;
|
|
|
7
7
|
export type StepIdentityPrefix = (typeof CONSTANTS.STEP_IDENTITY_PREFIX_BY_KIND)[StepKind];
|
|
8
8
|
type StepIdentityForPrefix<P extends StepIdentityPrefix> = P extends 'workstep' ? WorkStepIdentityJson : P extends 'branchstep' ? BranchStepIdentityJson : P extends 'forstep' ? ForStepIdentityJson : P extends 'whilestep' ? WhileStepIdentityJson : never;
|
|
9
9
|
type AnyIdentityPrefix = IdentityPrefix | StepIdentityPrefix;
|
|
10
|
-
|
|
10
|
+
type IdentityJsonByPrefix = {
|
|
11
|
+
format: ResourceFormatIdentityJson;
|
|
12
|
+
type: ResourceTypeIdentityJson;
|
|
13
|
+
role: ResourceRoleIdentityJson;
|
|
14
|
+
job: JobIdentityJson;
|
|
15
|
+
execution: ExecutionIdentityJson;
|
|
16
|
+
resource: ResourceIdentityJson;
|
|
17
|
+
stateless_strategy: StatelessStrategyIdentityJson;
|
|
18
|
+
stateful_strategy: StatefulStrategyIdentityJson;
|
|
19
|
+
strategy_thread: StrategyThreadIdentityJson;
|
|
20
|
+
strategy_run: StrategyRunIdentityJson;
|
|
21
|
+
};
|
|
22
|
+
export type NewIdentity<T extends AnyIdentityPrefix = AnyIdentityPrefix> = T extends keyof IdentityJsonByPrefix ? IdentityJsonByPrefix[T] : T extends StepIdentityPrefix ? StepIdentityForPrefix<T> : `${IdentityPrefixFor<T>}-${string}`;
|
|
11
23
|
export declare function getNewIdentity<T extends AnyIdentityPrefix>(identifiable: T): NewIdentity<T>;
|
|
12
24
|
export declare function getNewStepIdentityPrefix<K extends StepKind>(kind: K): (typeof CONSTANTS.STEP_IDENTITY_PREFIX_BY_KIND)[K];
|
|
13
25
|
export declare function getNewStepIdentity<K extends StepKind>(kind: K): Promise<StepIdentityForPrefix<(typeof CONSTANTS.STEP_IDENTITY_PREFIX_BY_KIND)[K]>>;
|