Skip to content

Commit 6adfd13

Browse files
constantantclaude
andcommitted
feat(openapi-resource-mocks): reload status, event fixes, clearHistory, requestCount, keyDiscriminator
- reload() now sets status 'reloading' (keeps value) and fires _notifyRequest, returning true; exposed on WindowMockEntry and openapi-mock-control 'reload' action - simulateProgress and resolveAfter now emit history entries and DOM events for every intermediate tick and the final resolve (previously bypassed the emit closure) - simulateProgress in DOM control listener now routes through the window entry so events fire - requestCount: Signal<number> added to MockResourceRef — increments on every _notifyRequest including reactive param changes and reload(); included in getState() snapshot - clearHistory() added to WindowMockEntry and wired to openapi-mock-control 'clearHistory' - MockProviderOptions.keyDiscriminator added to provideMockResource — appends a runtime suffix to the bus key so list-row components using the same token are independently controllable (e.g. 'GET_PET_BY_ID:42'); exported from package index - Generator render-mock-file.ts passes options? through generated provide{Op}Mock wrappers; all four data-access libs regenerated Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 037a8b5 commit 6adfd13

2,327 files changed

Lines changed: 73560 additions & 949 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { FactoryProvider } from '@angular/core';
2+
import { provideMockResource } from '@constantant/openapi-resource-mocks';
3+
import type {
4+
ProviderInitialBehavior,
5+
MockProviderOptions,
6+
MockResourceMeta,
7+
} from '@constantant/openapi-resource-mocks';
8+
import { ACTIONS_ADD_CUSTOM_LABELS_TO_SELF_HOSTED_RUNNER_FOR_ORG } from './actions-add-custom-labels-to-self-hosted-runner-for-org.token';
9+
import type { ActionsAddCustomLabelsToSelfHostedRunnerForOrgResponse } from './actions-add-custom-labels-to-self-hosted-runner-for-org.token';
10+
11+
const _meta: MockResourceMeta = {
12+
specId: 'github',
13+
operationId: 'actions/add-custom-labels-to-self-hosted-runner-for-org',
14+
path: '/orgs/{org}/actions/runners/{runner_id}/labels',
15+
method: 'post',
16+
tag: 'actions',
17+
};
18+
19+
export function provideActionsAddCustomLabelsToSelfHostedRunnerForOrgMock(
20+
initialBehavior?: ProviderInitialBehavior<ActionsAddCustomLabelsToSelfHostedRunnerForOrgResponse>,
21+
options?: MockProviderOptions,
22+
): FactoryProvider {
23+
return provideMockResource(
24+
ACTIONS_ADD_CUSTOM_LABELS_TO_SELF_HOSTED_RUNNER_FOR_ORG,
25+
'ACTIONS_ADD_CUSTOM_LABELS_TO_SELF_HOSTED_RUNNER_FOR_ORG',
26+
initialBehavior,
27+
_meta,
28+
options,
29+
);
30+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import { InjectionToken, inject, Signal, FactoryProvider } from '@angular/core';
2+
import { httpResource } from '@angular/common/http';
3+
import type { paths } from '../schema.d';
4+
import { GITHUB_BASE_URL } from '../api-base-url.token';
5+
6+
export type ActionsAddCustomLabelsToSelfHostedRunnerForOrgBody = NonNullable<
7+
paths['/orgs/{org}/actions/runners/{runner_id}/labels']['post']['requestBody']
8+
>['content']['application/json'];
9+
10+
export type ActionsAddCustomLabelsToSelfHostedRunnerForOrgResponse =
11+
paths['/orgs/{org}/actions/runners/{runner_id}/labels']['post']['responses']['200']['content']['application/json'];
12+
13+
export const ACTIONS_ADD_CUSTOM_LABELS_TO_SELF_HOSTED_RUNNER_FOR_ORG =
14+
new InjectionToken<
15+
(
16+
org: string,
17+
runnerId: string,
18+
body:
19+
| ActionsAddCustomLabelsToSelfHostedRunnerForOrgBody
20+
| Signal<ActionsAddCustomLabelsToSelfHostedRunnerForOrgBody>,
21+
) => ReturnType<
22+
typeof httpResource<ActionsAddCustomLabelsToSelfHostedRunnerForOrgResponse>
23+
>
24+
>('ACTIONS_ADD_CUSTOM_LABELS_TO_SELF_HOSTED_RUNNER_FOR_ORG');
25+
26+
export function provideActionsAddCustomLabelsToSelfHostedRunnerForOrg(): FactoryProvider {
27+
return {
28+
provide: ACTIONS_ADD_CUSTOM_LABELS_TO_SELF_HOSTED_RUNNER_FOR_ORG,
29+
useFactory: () => {
30+
const base = inject(GITHUB_BASE_URL);
31+
return (
32+
org: string,
33+
runnerId: string,
34+
body:
35+
| ActionsAddCustomLabelsToSelfHostedRunnerForOrgBody
36+
| Signal<ActionsAddCustomLabelsToSelfHostedRunnerForOrgBody>,
37+
) =>
38+
httpResource<ActionsAddCustomLabelsToSelfHostedRunnerForOrgResponse>(
39+
() => ({
40+
url: `${base}/orgs/${org}/actions/runners/${runnerId}/labels`,
41+
method: 'POST',
42+
body,
43+
}),
44+
);
45+
},
46+
};
47+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { FactoryProvider } from '@angular/core';
2+
import { provideMockResource } from '@constantant/openapi-resource-mocks';
3+
import type {
4+
ProviderInitialBehavior,
5+
MockProviderOptions,
6+
MockResourceMeta,
7+
} from '@constantant/openapi-resource-mocks';
8+
import { ACTIONS_ADD_CUSTOM_LABELS_TO_SELF_HOSTED_RUNNER_FOR_REPO } from './actions-add-custom-labels-to-self-hosted-runner-for-repo.token';
9+
import type { ActionsAddCustomLabelsToSelfHostedRunnerForRepoResponse } from './actions-add-custom-labels-to-self-hosted-runner-for-repo.token';
10+
11+
const _meta: MockResourceMeta = {
12+
specId: 'github',
13+
operationId: 'actions/add-custom-labels-to-self-hosted-runner-for-repo',
14+
path: '/repos/{owner}/{repo}/actions/runners/{runner_id}/labels',
15+
method: 'post',
16+
tag: 'actions',
17+
};
18+
19+
export function provideActionsAddCustomLabelsToSelfHostedRunnerForRepoMock(
20+
initialBehavior?: ProviderInitialBehavior<ActionsAddCustomLabelsToSelfHostedRunnerForRepoResponse>,
21+
options?: MockProviderOptions,
22+
): FactoryProvider {
23+
return provideMockResource(
24+
ACTIONS_ADD_CUSTOM_LABELS_TO_SELF_HOSTED_RUNNER_FOR_REPO,
25+
'ACTIONS_ADD_CUSTOM_LABELS_TO_SELF_HOSTED_RUNNER_FOR_REPO',
26+
initialBehavior,
27+
_meta,
28+
options,
29+
);
30+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import { InjectionToken, inject, Signal, FactoryProvider } from '@angular/core';
2+
import { httpResource } from '@angular/common/http';
3+
import type { paths } from '../schema.d';
4+
import { GITHUB_BASE_URL } from '../api-base-url.token';
5+
6+
export type ActionsAddCustomLabelsToSelfHostedRunnerForRepoBody = NonNullable<
7+
paths['/repos/{owner}/{repo}/actions/runners/{runner_id}/labels']['post']['requestBody']
8+
>['content']['application/json'];
9+
10+
export type ActionsAddCustomLabelsToSelfHostedRunnerForRepoResponse =
11+
paths['/repos/{owner}/{repo}/actions/runners/{runner_id}/labels']['post']['responses']['200']['content']['application/json'];
12+
13+
export const ACTIONS_ADD_CUSTOM_LABELS_TO_SELF_HOSTED_RUNNER_FOR_REPO =
14+
new InjectionToken<
15+
(
16+
owner: string,
17+
repo: string,
18+
runnerId: string,
19+
body:
20+
| ActionsAddCustomLabelsToSelfHostedRunnerForRepoBody
21+
| Signal<ActionsAddCustomLabelsToSelfHostedRunnerForRepoBody>,
22+
) => ReturnType<
23+
typeof httpResource<ActionsAddCustomLabelsToSelfHostedRunnerForRepoResponse>
24+
>
25+
>('ACTIONS_ADD_CUSTOM_LABELS_TO_SELF_HOSTED_RUNNER_FOR_REPO');
26+
27+
export function provideActionsAddCustomLabelsToSelfHostedRunnerForRepo(): FactoryProvider {
28+
return {
29+
provide: ACTIONS_ADD_CUSTOM_LABELS_TO_SELF_HOSTED_RUNNER_FOR_REPO,
30+
useFactory: () => {
31+
const base = inject(GITHUB_BASE_URL);
32+
return (
33+
owner: string,
34+
repo: string,
35+
runnerId: string,
36+
body:
37+
| ActionsAddCustomLabelsToSelfHostedRunnerForRepoBody
38+
| Signal<ActionsAddCustomLabelsToSelfHostedRunnerForRepoBody>,
39+
) =>
40+
httpResource<ActionsAddCustomLabelsToSelfHostedRunnerForRepoResponse>(
41+
() => ({
42+
url: `${base}/repos/${owner}/${repo}/actions/runners/${runnerId}/labels`,
43+
method: 'POST',
44+
body,
45+
}),
46+
);
47+
},
48+
};
49+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { FactoryProvider } from '@angular/core';
2+
import { provideMockResource } from '@constantant/openapi-resource-mocks';
3+
import type {
4+
ProviderInitialBehavior,
5+
MockProviderOptions,
6+
MockResourceMeta,
7+
} from '@constantant/openapi-resource-mocks';
8+
import { ACTIONS_ADD_REPO_ACCESS_TO_SELF_HOSTED_RUNNER_GROUP_IN_ORG } from './actions-add-repo-access-to-self-hosted-runner-group-in-org.token';
9+
10+
const _meta: MockResourceMeta = {
11+
specId: 'github',
12+
operationId: 'actions/add-repo-access-to-self-hosted-runner-group-in-org',
13+
path: '/orgs/{org}/actions/runner-groups/{runner_group_id}/repositories/{repository_id}',
14+
method: 'put',
15+
tag: 'actions',
16+
};
17+
18+
export function provideActionsAddRepoAccessToSelfHostedRunnerGroupInOrgMock(
19+
initialBehavior?: ProviderInitialBehavior<unknown>,
20+
options?: MockProviderOptions,
21+
): FactoryProvider {
22+
return provideMockResource(
23+
ACTIONS_ADD_REPO_ACCESS_TO_SELF_HOSTED_RUNNER_GROUP_IN_ORG,
24+
'ACTIONS_ADD_REPO_ACCESS_TO_SELF_HOSTED_RUNNER_GROUP_IN_ORG',
25+
initialBehavior,
26+
_meta,
27+
options,
28+
);
29+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { InjectionToken, inject, FactoryProvider } from '@angular/core';
2+
import { httpResource } from '@angular/common/http';
3+
import type { paths } from '../schema.d';
4+
import { GITHUB_BASE_URL } from '../api-base-url.token';
5+
6+
export const ACTIONS_ADD_REPO_ACCESS_TO_SELF_HOSTED_RUNNER_GROUP_IN_ORG =
7+
new InjectionToken<
8+
(
9+
org: string,
10+
runnerGroupId: string,
11+
repositoryId: string,
12+
) => ReturnType<typeof httpResource<unknown>>
13+
>('ACTIONS_ADD_REPO_ACCESS_TO_SELF_HOSTED_RUNNER_GROUP_IN_ORG');
14+
15+
export function provideActionsAddRepoAccessToSelfHostedRunnerGroupInOrg(): FactoryProvider {
16+
return {
17+
provide: ACTIONS_ADD_REPO_ACCESS_TO_SELF_HOSTED_RUNNER_GROUP_IN_ORG,
18+
useFactory: () => {
19+
const base = inject(GITHUB_BASE_URL);
20+
return (org: string, runnerGroupId: string, repositoryId: string) =>
21+
httpResource<unknown>(() => ({
22+
url: `${base}/orgs/${org}/actions/runner-groups/${runnerGroupId}/repositories/${repositoryId}`,
23+
method: 'PUT',
24+
}));
25+
},
26+
};
27+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { FactoryProvider } from '@angular/core';
2+
import { provideMockResource } from '@constantant/openapi-resource-mocks';
3+
import type {
4+
ProviderInitialBehavior,
5+
MockProviderOptions,
6+
MockResourceMeta,
7+
} from '@constantant/openapi-resource-mocks';
8+
import { ACTIONS_ADD_SELECTED_REPO_TO_ORG_SECRET } from './actions-add-selected-repo-to-org-secret.token';
9+
10+
const _meta: MockResourceMeta = {
11+
specId: 'github',
12+
operationId: 'actions/add-selected-repo-to-org-secret',
13+
path: '/orgs/{org}/actions/secrets/{secret_name}/repositories/{repository_id}',
14+
method: 'put',
15+
tag: 'actions',
16+
};
17+
18+
export function provideActionsAddSelectedRepoToOrgSecretMock(
19+
initialBehavior?: ProviderInitialBehavior<unknown>,
20+
options?: MockProviderOptions,
21+
): FactoryProvider {
22+
return provideMockResource(
23+
ACTIONS_ADD_SELECTED_REPO_TO_ORG_SECRET,
24+
'ACTIONS_ADD_SELECTED_REPO_TO_ORG_SECRET',
25+
initialBehavior,
26+
_meta,
27+
options,
28+
);
29+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { InjectionToken, inject, FactoryProvider } from '@angular/core';
2+
import { httpResource } from '@angular/common/http';
3+
import type { paths } from '../schema.d';
4+
import { GITHUB_BASE_URL } from '../api-base-url.token';
5+
6+
export const ACTIONS_ADD_SELECTED_REPO_TO_ORG_SECRET = new InjectionToken<
7+
(
8+
org: string,
9+
secretName: string,
10+
repositoryId: string,
11+
) => ReturnType<typeof httpResource<unknown>>
12+
>('ACTIONS_ADD_SELECTED_REPO_TO_ORG_SECRET');
13+
14+
export function provideActionsAddSelectedRepoToOrgSecret(): FactoryProvider {
15+
return {
16+
provide: ACTIONS_ADD_SELECTED_REPO_TO_ORG_SECRET,
17+
useFactory: () => {
18+
const base = inject(GITHUB_BASE_URL);
19+
return (org: string, secretName: string, repositoryId: string) =>
20+
httpResource<unknown>(() => ({
21+
url: `${base}/orgs/${org}/actions/secrets/${secretName}/repositories/${repositoryId}`,
22+
method: 'PUT',
23+
}));
24+
},
25+
};
26+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { FactoryProvider } from '@angular/core';
2+
import { provideMockResource } from '@constantant/openapi-resource-mocks';
3+
import type {
4+
ProviderInitialBehavior,
5+
MockProviderOptions,
6+
MockResourceMeta,
7+
} from '@constantant/openapi-resource-mocks';
8+
import { ACTIONS_ADD_SELECTED_REPO_TO_ORG_VARIABLE } from './actions-add-selected-repo-to-org-variable.token';
9+
10+
const _meta: MockResourceMeta = {
11+
specId: 'github',
12+
operationId: 'actions/add-selected-repo-to-org-variable',
13+
path: '/orgs/{org}/actions/variables/{name}/repositories/{repository_id}',
14+
method: 'put',
15+
tag: 'actions',
16+
};
17+
18+
export function provideActionsAddSelectedRepoToOrgVariableMock(
19+
initialBehavior?: ProviderInitialBehavior<unknown>,
20+
options?: MockProviderOptions,
21+
): FactoryProvider {
22+
return provideMockResource(
23+
ACTIONS_ADD_SELECTED_REPO_TO_ORG_VARIABLE,
24+
'ACTIONS_ADD_SELECTED_REPO_TO_ORG_VARIABLE',
25+
initialBehavior,
26+
_meta,
27+
options,
28+
);
29+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { InjectionToken, inject, FactoryProvider } from '@angular/core';
2+
import { httpResource } from '@angular/common/http';
3+
import type { paths } from '../schema.d';
4+
import { GITHUB_BASE_URL } from '../api-base-url.token';
5+
6+
export const ACTIONS_ADD_SELECTED_REPO_TO_ORG_VARIABLE = new InjectionToken<
7+
(
8+
org: string,
9+
name: string,
10+
repositoryId: string,
11+
) => ReturnType<typeof httpResource<unknown>>
12+
>('ACTIONS_ADD_SELECTED_REPO_TO_ORG_VARIABLE');
13+
14+
export function provideActionsAddSelectedRepoToOrgVariable(): FactoryProvider {
15+
return {
16+
provide: ACTIONS_ADD_SELECTED_REPO_TO_ORG_VARIABLE,
17+
useFactory: () => {
18+
const base = inject(GITHUB_BASE_URL);
19+
return (org: string, name: string, repositoryId: string) =>
20+
httpResource<unknown>(() => ({
21+
url: `${base}/orgs/${org}/actions/variables/${name}/repositories/${repositoryId}`,
22+
method: 'PUT',
23+
}));
24+
},
25+
};
26+
}

0 commit comments

Comments
 (0)