Skip to content

Commit

Permalink
Merge pull request #441 from trivir/feature/update-export-formats
Browse files Browse the repository at this point in the history
Update Export Formats and Bug Fixes
  • Loading branch information
vscheuber authored Jul 16, 2024
2 parents 3cf38bc + e733a69 commit ac1c61b
Show file tree
Hide file tree
Showing 89 changed files with 438,741 additions and 209,295 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ out
# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# Stores JetBrain IDE's configuration
.idea

# yarn v2
.yarn/cache
.yarn/unplugged
Expand All @@ -127,4 +130,4 @@ out
.pnp.*

test/fs_tmp/*
!test/fs_tmp/.gitkeep
!test/fs_tmp/.gitkeep
4 changes: 2 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ module.exports = {
testEnvironment: 'node',
snapshotResolver: '<rootDir>/snapshotResolve.js',
testMatch: ['**/?(*.)(test).ts'],
testTimeout: 30000,
testTimeout: 90000,
extensionsToTreatAsEsm: ['.ts'],
transform: {
'^.+\\.tsx?$': ['ts-jest', { useESM: true }]
},
};
};
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"test:record_noauth": "NODE_OPTIONS=--experimental-vm-modules FRODO_POLLY_MODE=record_noauth npx jest --verbose=true --silent=false --updateSnapshot --testPathIgnorePatterns cjs --testPathPattern",
"test:update": "NODE_OPTIONS=--experimental-vm-modules npx jest --verbose=true --silent=false --updateSnapshot --testPathPattern",
"lint": "eslint --ext .ts --ignore-path .gitignore .",
"lint:fix": "eslint --fix --ext .ts --ignore-path .gitignore .",
"clean-types": "rimraf types",
"generate-types": "tsc",
"build": "npx tsup && npm run clean-types && npm run generate-types",
Expand Down
3 changes: 2 additions & 1 deletion src/api/AgentApi.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
import * as AgentApi from './AgentApi';
import { state } from '../index';
import { getAgent } from '../test/mocks/ForgeRockApiMockEngine';
import { autoSetupPolly, filterRecording } from '../utils/AutoSetupPolly';
import { autoSetupPolly } from '../utils/AutoSetupPolly';
import { filterRecording } from '../utils/PollyUtils';

const ctx = autoSetupPolly();

Expand Down
13 changes: 7 additions & 6 deletions src/api/AgentApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ import { State } from '../shared/State';
import { debugMessage } from '../utils/Console';
import { getCurrentRealmPath } from '../utils/ForgeRockUtils';
import { deleteDeepByKey } from '../utils/JsonUtils';
import { type IdObjectSkeletonInterface } from './ApiTypes';
import { type AmConfigEntityInterface, EntityType } from './ApiTypes';
import { generateAmApi } from './BaseApi';
import { type AmServiceType } from './ServiceApi';

const getAgentTypesURLTemplate =
'%s/json%s/realm-config/agents?_action=getAllTypes';
Expand All @@ -29,11 +28,13 @@ const getApiConfig = () => {
export type GatewayAgentType = 'IdentityGatewayAgent';
export type JavaAgentType = 'J2EEAgent';
export type WebAgentType = 'WebAgent';
export type AgentType = GatewayAgentType | JavaAgentType | WebAgentType;
export type AgentType =
| GatewayAgentType
| JavaAgentType
| WebAgentType
| EntityType;

export type AgentSkeleton = IdObjectSkeletonInterface & {
_type: AmServiceType;
};
export type AgentSkeleton = AmConfigEntityInterface;

/**
* Get agent types
Expand Down
9 changes: 9 additions & 0 deletions src/api/ApiTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ export interface IdObjectSkeletonInterface extends NoIdObjectSkeletonInterface {
_id?: string;
}

export interface AmConfigEntityInterface extends IdObjectSkeletonInterface {
_type?: EntityType;
}

export type Readable<Type> = Type;

export type Writable<Type> = {
Expand All @@ -33,3 +37,8 @@ export type PagedResult<Type> = {
totalPagedResults: number;
remainingPagedResults: number;
};

export type EntityType = IdObjectSkeletonInterface & {
name: string;
collection: boolean;
};
7 changes: 2 additions & 5 deletions src/api/AuthenticateApi.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,8 @@
*/
import * as AuthenticateApi from './AuthenticateApi';
import { state } from '../index';
import {
autoSetupPolly,
defaultMatchRequestsBy,
filterRecording,
} from '../utils/AutoSetupPolly';
import { autoSetupPolly } from '../utils/AutoSetupPolly';
import { defaultMatchRequestsBy, filterRecording } from '../utils/PollyUtils';

// need to modify the default matching rules to allow the mocking to work for an authentication flow.
const matchConfig = defaultMatchRequestsBy();
Expand Down
4 changes: 2 additions & 2 deletions src/api/AuthenticationSettingsApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ export async function getAuthenticationSettings({
}

/**
* Put authentiction settings
* @param {AuthenticationSettingsSkeleton} settings authentiction settings object
* Put authentication settings
* @param {AuthenticationSettingsSkeleton} settings authentication settings object
* @returns {Promise<AuthenticationSettingsSkeleton>} a promise that resolves to an authentiction settings object
*/
export async function putAuthenticationSettings({
Expand Down
6 changes: 2 additions & 4 deletions src/api/CirclesOfTrustApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ import util from 'util';
import { State } from '../shared/State';
import { getCurrentRealmPath } from '../utils/ForgeRockUtils';
import { cloneDeep } from '../utils/JsonUtils';
import { type IdObjectSkeletonInterface, type PagedResult } from './ApiTypes';
import { type AmConfigEntityInterface, type PagedResult } from './ApiTypes';
import { generateAmApi } from './BaseApi';
import { type AmServiceType } from './ServiceApi';

const circleOfTrustByIdURLTemplate =
'%s/json%s/realm-config/federation/circlesoftrust/%s';
Expand All @@ -20,10 +19,9 @@ const getApiConfig = () => {
};
};

export type CircleOfTrustSkeleton = IdObjectSkeletonInterface & {
export type CircleOfTrustSkeleton = AmConfigEntityInterface & {
status?: string;
trustedProviders?: string[];
_type?: AmServiceType;
};

/**
Expand Down
3 changes: 2 additions & 1 deletion src/api/NodeApi.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
*/
import * as NodeApi from './NodeApi';
import { state } from '../index';
import { autoSetupPolly, filterRecording } from '../utils/AutoSetupPolly';
import { autoSetupPolly } from '../utils/AutoSetupPolly';
import { filterRecording } from '../utils/PollyUtils';

const ctx = autoSetupPolly();

Expand Down
5 changes: 2 additions & 3 deletions src/api/NodeApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import { State } from '../shared/State';
import { getCurrentRealmPath } from '../utils/ForgeRockUtils';
import { deleteDeepByKey } from '../utils/JsonUtils';
import {
AmConfigEntityInterface,
type IdObjectSkeletonInterface,
type NoIdObjectSkeletonInterface,
type PagedResult,
type QueryResult,
} from './ApiTypes';
import { generateAmApi } from './BaseApi';
import { type AmServiceType } from './ServiceApi';

const queryAllNodeTypesURLTemplate =
'%s/json%s/realm-config/authentication/authenticationtrees/nodes?_action=getAllTypes';
Expand Down Expand Up @@ -49,8 +49,7 @@ export interface InnerNodeRefSkeletonInterface {
nodeType: string;
}

export type NodeSkeleton = IdObjectSkeletonInterface & {
_type: AmServiceType;
export type NodeSkeleton = AmConfigEntityInterface & {
nodes?: InnerNodeRefSkeletonInterface[];
tree?: string;
identityResource?: string;
Expand Down
6 changes: 2 additions & 4 deletions src/api/OAuth2ClientApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ import { State } from '../shared/State';
import { getCurrentRealmPath } from '../utils/ForgeRockUtils';
import { deleteDeepByKey } from '../utils/JsonUtils';
import {
type IdObjectSkeletonInterface,
type AmConfigEntityInterface,
type NoIdObjectSkeletonInterface,
type PagedResult,
type Readable,
type Writable,
} from './ApiTypes';
import { generateAmApi } from './BaseApi';
import { AmServiceType } from './ServiceApi';

const oauth2ClientURLTemplate = '%s/json%s/realm-config/agents/OAuth2Client/%s';
const oauth2ClientListURLTemplate =
Expand All @@ -23,7 +22,7 @@ const getApiConfig = () => {
};
};

export type OAuth2ClientSkeleton = IdObjectSkeletonInterface & {
export type OAuth2ClientSkeleton = AmConfigEntityInterface & {
overrideOAuth2ClientConfig?: {
[k: string]: string | number | boolean | string[] | object | undefined;
};
Expand Down Expand Up @@ -61,7 +60,6 @@ export type OAuth2ClientSkeleton = IdObjectSkeletonInterface & {
coreUmaClientConfig?: {
[k: string]: string | number | boolean | string[] | object | undefined;
};
_type: AmServiceType;
};

/**
Expand Down
6 changes: 2 additions & 4 deletions src/api/OAuth2ProviderApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ import util from 'util';
import { State } from '../shared/State';
import { getCurrentRealmPath } from '../utils/ForgeRockUtils';
import { cloneDeep } from '../utils/JsonUtils';
import { type IdObjectSkeletonInterface } from './ApiTypes';
import { type AmConfigEntityInterface } from './ApiTypes';
import { generateAmApi } from './BaseApi';
import { type AmServiceType } from './ServiceApi';

const oAuth2ProviderServiceURLTemplate =
'%s/json%s/realm-config/services/oauth-oidc';
Expand All @@ -20,7 +19,7 @@ const getApiConfig = () => {
};
};

export type OAuth2ProviderSkeleton = IdObjectSkeletonInterface & {
export type OAuth2ProviderSkeleton = AmConfigEntityInterface & {
advancedOIDCConfig: {
supportedRequestParameterEncryptionEnc?: string[];
authorisedOpenIdConnectSSOClients?: string[];
Expand Down Expand Up @@ -159,7 +158,6 @@ export type OAuth2ProviderSkeleton = IdObjectSkeletonInterface & {
cibaAuthReqIdLifetime: number;
[k: string]: string | number | boolean | string[] | object | undefined;
};
_type?: AmServiceType;
[k: string]: string | number | boolean | string[] | object | undefined;
};

Expand Down
3 changes: 2 additions & 1 deletion src/api/PoliciesApi.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
*/
import * as PolicySetApi from './PolicySetApi';
import * as PoliciesApi from './PoliciesApi';
import { autoSetupPolly, filterRecording } from '../utils/AutoSetupPolly';
import { autoSetupPolly } from '../utils/AutoSetupPolly';
import { filterRecording } from '../utils/PollyUtils';
import { type PolicySetSkeleton } from './PolicySetApi';
import { type PolicySkeleton } from './PoliciesApi';
import { cloneDeep } from '../utils/JsonUtils';
Expand Down
3 changes: 2 additions & 1 deletion src/api/PolicySetApi.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
*/
import * as PolicySetApi from './PolicySetApi';
import { state } from '../index';
import { autoSetupPolly, filterRecording } from '../utils/AutoSetupPolly';
import { autoSetupPolly } from '../utils/AutoSetupPolly';
import { filterRecording } from '../utils/PollyUtils';
import { type PolicySetSkeleton } from './PolicySetApi';
import { cloneDeep } from '../utils/JsonUtils';

Expand Down
3 changes: 2 additions & 1 deletion src/api/ResourceTypesApi.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
*/
import * as ResourceTypesApi from './ResourceTypesApi';
import { state } from '../index';
import { autoSetupPolly, filterRecording } from '../utils/AutoSetupPolly';
import { autoSetupPolly } from '../utils/AutoSetupPolly';
import { filterRecording } from '../utils/PollyUtils';
import { type ResourceTypeSkeleton } from './ResourceTypesApi';

const ctx = autoSetupPolly();
Expand Down
Loading

0 comments on commit ac1c61b

Please sign in to comment.