@rockcarver/frodo-lib 0.16.2-7 → 0.16.2-9
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.
- package/CHANGELOG.md +9 -1
- package/cjs/api/ApiTypes.js.map +1 -1
- package/cjs/api/Saml2Api.js +21 -56
- package/cjs/api/Saml2Api.js.map +1 -1
- package/cjs/api/ServiceApi.js +2 -6
- package/cjs/api/ServiceApi.js.map +1 -1
- package/cjs/api/utils/Base64.js +1 -0
- package/cjs/api/utils/Base64.js.map +1 -1
- package/cjs/ops/AgentOps.js +1 -1
- package/cjs/ops/AgentOps.js.map +1 -1
- package/cjs/ops/JourneyOps.js +1 -1
- package/cjs/ops/JourneyOps.js.map +1 -1
- package/cjs/ops/JourneyOps.test.js.map +1 -1
- package/cjs/ops/OpsTypes.js.map +1 -1
- package/cjs/ops/Saml2Ops.js +265 -713
- package/cjs/ops/Saml2Ops.js.map +1 -1
- package/cjs/ops/Saml2Ops.test.js.map +1 -1
- package/cjs/ops/ScriptOps.js +3 -1
- package/cjs/ops/ScriptOps.js.map +1 -1
- package/cjs/ops/ServiceOps.js +125 -69
- package/cjs/ops/ServiceOps.js.map +1 -1
- package/cjs/test/mocks/ForgeRockApiMockEngine.js +31 -5
- package/cjs/test/mocks/ForgeRockApiMockEngine.js.map +1 -1
- package/cjs/test/mocks/Saml2Api/findSaml2Providers/https:sts.windows.net711ffa9c-5972-4713-ace3-688c9732614a_stub.json +18 -0
- package/cjs/test/mocks/Saml2Api/findSaml2Providers/iSPAzure_stub.json +18 -0
- package/cjs/test/mocks/Saml2Api/getProvider/aVNQQXp1cmU.json +1 -2
- package/cjs/test/mocks/Saml2Api/getProvider/dXJuOmZlZGVyYXRpb246TWljcm9zb2Z0T25saW5l.json +1 -3
- package/cjs/test/mocks/Saml2Api/getProviderByLocationAndId/hosted/U1BBenVyZQ.json +147 -0
- package/cjs/test/mocks/Saml2Api/getProviderByLocationAndId/hosted/aHR0cHM6Ly9pZGMuc2NoZXViZXIuaW8vYW0vc2FtbDIvSURQQXp1cmU.json +182 -0
- package/cjs/test/mocks/Saml2Api/getProviderByLocationAndId/hosted/aHR0cHM6Ly9pZGMuc2NoZXViZXIuaW8vYW0vc2FtbDIvSURQQnJvYWRjb20.json +149 -0
- package/cjs/test/mocks/Saml2Api/getProviderByLocationAndId/hosted/aHR0cHM6Ly9pZGMuc2NoZXViZXIuaW8vYW0vc2FtbDIvSURQRmVkbGV0.json +141 -0
- package/cjs/test/mocks/Saml2Api/getProviderByLocationAndId/hosted/aVNQQXp1cmU.json +1 -2
- package/cjs/test/mocks/Saml2Api/getProviderByLocationAndId/hosted/dm9sa2VyRGV2U1A.json +118 -0
- package/cjs/test/mocks/Saml2Api/getProviderByLocationAndId/remote/aHR0cHM6Ly9zYW1sLm15dGVzdHJ1bi5jb20vc3A.json +66 -0
- package/cjs/test/mocks/Saml2Api/getProviderByLocationAndId/remote/aHR0cHM6Ly9zdHMud2luZG93cy5uZXQvNzExZmZhOWMtNTk3Mi00NzEzLWFjZTMtNjg4Yzk3MzI2MTRhLw.json +35 -0
- package/cjs/test/mocks/Saml2Api/getProviderByLocationAndId/remote/aWRw.json +83 -0
- package/cjs/test/mocks/Saml2Api/getProviderByLocationAndId/remote/dXJuOmZlZGVyYXRpb246TWljcm9zb2Z0T25saW5l.json +1 -3
- package/cjs/test/mocks/Saml2Api/getProviderMetadata/alpha/SPAzure.xml +74 -0
- package/cjs/test/mocks/Saml2Api/getProviderMetadata/alpha/https%3A%2F%2Fidc.scheuber.io%2Fam%2Fsaml2%2FIDPAzure.xml +78 -0
- package/cjs/test/mocks/Saml2Api/getProviderMetadata/alpha/https%3A%2F%2Fidc.scheuber.io%2Fam%2Fsaml2%2FIDPBroadcom.xml +78 -0
- package/cjs/test/mocks/Saml2Api/getProviderMetadata/alpha/https%3A%2F%2Fidc.scheuber.io%2Fam%2Fsaml2%2FIDPFedlet.xml +78 -0
- package/cjs/test/mocks/Saml2Api/getProviderMetadata/alpha/https%3A%2F%2Fsaml.mytestrun.com%2Fsp.xml +13 -0
- package/cjs/test/mocks/Saml2Api/getProviderMetadata/alpha/{dXJuOmZlZGVyYXRpb246TWljcm9zb2Z0T25saW5l.xml → https%3A%2F%2Fsts.windows.net%2F711ffa9c-5972-4713-ace3-688c9732614a%2F.xml} +0 -0
- package/cjs/test/mocks/Saml2Api/getProviderMetadata/alpha/{aVNQQXp1cmU.xml → iSPAzure.xml} +0 -0
- package/cjs/test/mocks/Saml2Api/getProviderMetadata/alpha/urn%3Afederation%3AMicrosoftOnline.xml +84 -0
- package/cjs/test/mocks/Saml2Ops/importSaml2Provider/SPAzure.saml.json +243 -0
- package/cjs/test/mocks/Saml2Ops/importSaml2Provider/iSPAzure.saml.json +242 -0
- package/cjs/test/mocks/Saml2Ops/importSaml2Provider/idc.scheuber.ioamsaml2IDPAzure.saml.json +454 -0
- package/cjs/test/mocks/Saml2Ops/importSaml2Provider/idc.scheuber.ioamsaml2IDPBroadcom.saml.json +586 -0
- package/cjs/test/mocks/Saml2Ops/importSaml2Provider/idc.scheuber.ioamsaml2IDPFedlet.saml.json +241 -0
- package/cjs/test/mocks/Saml2Ops/importSaml2Provider/idp.saml.json +185 -0
- package/cjs/test/mocks/Saml2Ops/importSaml2Provider/saml.mytestrun.comsp.saml.json +101 -0
- package/cjs/test/mocks/Saml2Ops/importSaml2Provider/sts.windows.net711ffa9c-5972-4713-ace3-688c9732614a.saml.json +113 -0
- package/cjs/test/mocks/Saml2Ops/importSaml2Provider/urn:federation:MicrosoftOnline.saml.json +199 -0
- package/cjs/test/mocks/Saml2Ops/importSaml2Provider/volkerDevSP.saml.json +212 -0
- package/cjs/test/mocks/Saml2Ops/importSaml2Providers/allAlphaProviders.saml.json +2414 -0
- package/cjs/test/mocks/ScriptApi/getScript/5b29c5b7-b161-4a42-a41f-d6c85316b951.json +13 -0
- package/cjs/test/mocks/ScriptApi/getScript/85523e71-2d77-4577-b078-6f9674cc54e2.json +13 -0
- package/cjs/test/mocks/ScriptApi/getScript/90c4eca5-05f0-42f5-b9bf-88b693eabbbd.json +13 -0
- package/esm/api/Saml2Api.mjs +12 -38
- package/esm/api/ServiceApi.mjs +2 -4
- package/esm/api/utils/Base64.mjs +1 -0
- package/esm/ops/AgentOps.mjs +1 -1
- package/esm/ops/JourneyOps.mjs +1 -1
- package/esm/ops/JourneyOps.test.mjs +1 -1
- package/esm/ops/Saml2Ops.mjs +188 -542
- package/esm/ops/Saml2Ops.test.mjs +301 -79
- package/esm/ops/ScriptOps.mjs +3 -1
- package/esm/ops/ServiceOps.mjs +110 -63
- package/esm/test/mocks/ForgeRockApiMockEngine.mjs +26 -6
- package/esm/test/mocks/Saml2Api/findSaml2Providers/https:sts.windows.net711ffa9c-5972-4713-ace3-688c9732614a_stub.json +18 -0
- package/esm/test/mocks/Saml2Api/findSaml2Providers/iSPAzure_stub.json +18 -0
- package/esm/test/mocks/Saml2Api/getProvider/aVNQQXp1cmU.json +1 -2
- package/esm/test/mocks/Saml2Api/getProvider/dXJuOmZlZGVyYXRpb246TWljcm9zb2Z0T25saW5l.json +1 -3
- package/esm/test/mocks/Saml2Api/getProviderByLocationAndId/hosted/U1BBenVyZQ.json +147 -0
- package/esm/test/mocks/Saml2Api/getProviderByLocationAndId/hosted/aHR0cHM6Ly9pZGMuc2NoZXViZXIuaW8vYW0vc2FtbDIvSURQQXp1cmU.json +182 -0
- package/esm/test/mocks/Saml2Api/getProviderByLocationAndId/hosted/aHR0cHM6Ly9pZGMuc2NoZXViZXIuaW8vYW0vc2FtbDIvSURQQnJvYWRjb20.json +149 -0
- package/esm/test/mocks/Saml2Api/getProviderByLocationAndId/hosted/aHR0cHM6Ly9pZGMuc2NoZXViZXIuaW8vYW0vc2FtbDIvSURQRmVkbGV0.json +141 -0
- package/esm/test/mocks/Saml2Api/getProviderByLocationAndId/hosted/aVNQQXp1cmU.json +1 -2
- package/esm/test/mocks/Saml2Api/getProviderByLocationAndId/hosted/dm9sa2VyRGV2U1A.json +118 -0
- package/esm/test/mocks/Saml2Api/getProviderByLocationAndId/remote/aHR0cHM6Ly9zYW1sLm15dGVzdHJ1bi5jb20vc3A.json +66 -0
- package/esm/test/mocks/Saml2Api/getProviderByLocationAndId/remote/aHR0cHM6Ly9zdHMud2luZG93cy5uZXQvNzExZmZhOWMtNTk3Mi00NzEzLWFjZTMtNjg4Yzk3MzI2MTRhLw.json +35 -0
- package/esm/test/mocks/Saml2Api/getProviderByLocationAndId/remote/aWRw.json +83 -0
- package/esm/test/mocks/Saml2Api/getProviderByLocationAndId/remote/dXJuOmZlZGVyYXRpb246TWljcm9zb2Z0T25saW5l.json +1 -3
- package/esm/test/mocks/Saml2Api/getProviderMetadata/alpha/SPAzure.xml +74 -0
- package/esm/test/mocks/Saml2Api/getProviderMetadata/alpha/https%3A%2F%2Fidc.scheuber.io%2Fam%2Fsaml2%2FIDPAzure.xml +78 -0
- package/esm/test/mocks/Saml2Api/getProviderMetadata/alpha/https%3A%2F%2Fidc.scheuber.io%2Fam%2Fsaml2%2FIDPBroadcom.xml +78 -0
- package/esm/test/mocks/Saml2Api/getProviderMetadata/alpha/https%3A%2F%2Fidc.scheuber.io%2Fam%2Fsaml2%2FIDPFedlet.xml +78 -0
- package/esm/test/mocks/Saml2Api/getProviderMetadata/alpha/https%3A%2F%2Fsaml.mytestrun.com%2Fsp.xml +13 -0
- package/esm/test/mocks/Saml2Api/getProviderMetadata/alpha/{dXJuOmZlZGVyYXRpb246TWljcm9zb2Z0T25saW5l.xml → https%3A%2F%2Fsts.windows.net%2F711ffa9c-5972-4713-ace3-688c9732614a%2F.xml} +0 -0
- package/esm/test/mocks/Saml2Api/getProviderMetadata/alpha/{aVNQQXp1cmU.xml → iSPAzure.xml} +0 -0
- package/esm/test/mocks/Saml2Api/getProviderMetadata/alpha/urn%3Afederation%3AMicrosoftOnline.xml +84 -0
- package/esm/test/mocks/Saml2Ops/importSaml2Provider/SPAzure.saml.json +243 -0
- package/esm/test/mocks/Saml2Ops/importSaml2Provider/iSPAzure.saml.json +242 -0
- package/esm/test/mocks/Saml2Ops/importSaml2Provider/idc.scheuber.ioamsaml2IDPAzure.saml.json +454 -0
- package/esm/test/mocks/Saml2Ops/importSaml2Provider/idc.scheuber.ioamsaml2IDPBroadcom.saml.json +586 -0
- package/esm/test/mocks/Saml2Ops/importSaml2Provider/idc.scheuber.ioamsaml2IDPFedlet.saml.json +241 -0
- package/esm/test/mocks/Saml2Ops/importSaml2Provider/idp.saml.json +185 -0
- package/esm/test/mocks/Saml2Ops/importSaml2Provider/saml.mytestrun.comsp.saml.json +101 -0
- package/esm/test/mocks/Saml2Ops/importSaml2Provider/sts.windows.net711ffa9c-5972-4713-ace3-688c9732614a.saml.json +113 -0
- package/esm/test/mocks/Saml2Ops/importSaml2Provider/urn:federation:MicrosoftOnline.saml.json +199 -0
- package/esm/test/mocks/Saml2Ops/importSaml2Provider/volkerDevSP.saml.json +212 -0
- package/esm/test/mocks/Saml2Ops/importSaml2Providers/allAlphaProviders.saml.json +2414 -0
- package/esm/test/mocks/ScriptApi/getScript/5b29c5b7-b161-4a42-a41f-d6c85316b951.json +13 -0
- package/esm/test/mocks/ScriptApi/getScript/85523e71-2d77-4577-b078-6f9674cc54e2.json +13 -0
- package/esm/test/mocks/ScriptApi/getScript/90c4eca5-05f0-42f5-b9bf-88b693eabbbd.json +13 -0
- package/package.json +3 -2
- package/types/api/ApiTypes.d.ts +5 -0
- package/types/api/ApiTypes.d.ts.map +1 -1
- package/types/api/Saml2Api.d.ts +7 -13
- package/types/api/Saml2Api.d.ts.map +1 -1
- package/types/api/ServiceApi.d.ts.map +1 -1
- package/types/api/utils/Base64.d.ts +1 -0
- package/types/api/utils/Base64.d.ts.map +1 -1
- package/types/ops/AgentOps.d.ts +1 -1
- package/types/ops/AgentOps.d.ts.map +1 -1
- package/types/ops/JourneyOps.d.ts.map +1 -1
- package/types/ops/OpsTypes.d.ts +16 -0
- package/types/ops/OpsTypes.d.ts.map +1 -1
- package/types/ops/Saml2Ops.d.ts +52 -55
- package/types/ops/Saml2Ops.d.ts.map +1 -1
- package/types/ops/ScriptOps.d.ts.map +1 -1
- package/types/ops/ServiceOps.d.ts +4 -0
- package/types/ops/ServiceOps.d.ts.map +1 -1
- package/types/test/mocks/ForgeRockApiMockEngine.d.ts +2 -0
- package/types/test/mocks/ForgeRockApiMockEngine.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.16.2-9] - 2022-11-21
|
|
11
|
+
|
|
12
|
+
## [0.16.2-8] - 2022-11-16
|
|
13
|
+
|
|
10
14
|
## [0.16.2-7] - 2022-11-16
|
|
11
15
|
|
|
12
16
|
## [0.16.2-6] - 2022-11-11
|
|
@@ -696,7 +700,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
696
700
|
- Fixed problem with adding connection profiles
|
|
697
701
|
- Miscellaneous bug fixes
|
|
698
702
|
|
|
699
|
-
[Unreleased]: https://github.com/rockcarver/frodo-lib/compare/v0.16.2-
|
|
703
|
+
[Unreleased]: https://github.com/rockcarver/frodo-lib/compare/v0.16.2-9...HEAD
|
|
704
|
+
|
|
705
|
+
[0.16.2-9]: https://github.com/rockcarver/frodo-lib/compare/v0.16.2-8...v0.16.2-9
|
|
706
|
+
|
|
707
|
+
[0.16.2-8]: https://github.com/rockcarver/frodo-lib/compare/v0.16.2-7...v0.16.2-8
|
|
700
708
|
|
|
701
709
|
[0.16.2-7]: https://github.com/rockcarver/frodo-lib/compare/v0.16.2-6...v0.16.2-7
|
|
702
710
|
|
package/cjs/api/ApiTypes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiTypes.js","names":["ScriptLanguage","ScriptContext","Saml2ProiderLocation"],"sources":["api/ApiTypes.ts"],"sourcesContent":["interface ObjectSkeletonInterface {\n _id: string;\n _rev?: number;\n [k: string]: string | number | boolean | string[] | ObjectSkeletonInterface;\n}\n\nexport interface UiConfigInterface {\n categories: string;\n}\n\nexport interface NodeRefSkeletonInterface {\n connections: Record<string, string>;\n displayName: string;\n nodeType: string;\n x: number;\n y: number;\n}\n\nexport interface InnerNodeRefSkeletonInterface {\n _id: string;\n displayName: string;\n nodeType: string;\n}\n\nexport type TreeSkeleton = ObjectSkeletonInterface & {\n entryNodeId: string;\n nodes: Record<string, NodeRefSkeletonInterface>;\n identityResource?: string;\n uiConfig?: UiConfigInterface;\n enabled?: boolean;\n};\n\nexport type AmServiceType = ObjectSkeletonInterface & {\n name: string;\n};\n\nexport type NodeSkeleton = ObjectSkeletonInterface & {\n _type: AmServiceType;\n nodes?: InnerNodeRefSkeletonInterface[];\n tree?: string;\n identityResource?: string;\n};\n\nexport type SocialIdpSkeleton = ObjectSkeletonInterface & {\n _type: AmServiceType;\n enabled: boolean;\n};\n\nexport type AmServiceSkeleton = ObjectSkeletonInterface & {\n _type: AmServiceType;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key: string]: any;\n};\n\nexport type AgentSkeleton = ObjectSkeletonInterface & {\n _type: AmServiceType;\n};\n\nexport type EmailTemplateSkeleton = ObjectSkeletonInterface & {\n defaultLocale?: string;\n displayName?: string;\n enabled?: boolean;\n from: string;\n subject: Record<string, string>;\n};\n\nexport type ThemeSkeleton = ObjectSkeletonInterface & {\n name: string;\n isDefault: boolean;\n linkedTrees: string[];\n};\n\nexport type UiThemeRealmObject = ObjectSkeletonInterface & {\n name: string;\n realm: Map<string, ThemeSkeleton[]>;\n};\n\nexport enum ScriptLanguage {\n GROOVY = 'GROOVY',\n JAVASCRIPT = 'JAVASCRIPT',\n}\n\nexport enum ScriptContext {\n OAUTH2_ACCESS_TOKEN_MODIFICATION = 'OAUTH2_ACCESS_TOKEN_MODIFICATION',\n AUTHENTICATION_CLIENT_SIDE = 'AUTHENTICATION_CLIENT_SIDE',\n AUTHENTICATION_TREE_DECISION_NODE = 'AUTHENTICATION_TREE_DECISION_NODE',\n AUTHENTICATION_SERVER_SIDE = 'AUTHENTICATION_SERVER_SIDE',\n SOCIAL_IDP_PROFILE_TRANSFORMATION = 'SOCIAL_IDP_PROFILE_TRANSFORMATION',\n OAUTH2_VALIDATE_SCOPE = 'OAUTH2_VALIDATE_SCOPE',\n CONFIG_PROVIDER_NODE = 'CONFIG_PROVIDER_NODE',\n OAUTH2_AUTHORIZE_ENDPOINT_DATA_PROVIDER = 'OAUTH2_AUTHORIZE_ENDPOINT_DATA_PROVIDER',\n OAUTH2_EVALUATE_SCOPE = 'OAUTH2_EVALUATE_SCOPE',\n POLICY_CONDITION = 'POLICY_CONDITION',\n OIDC_CLAIMS = 'OIDC_CLAIMS',\n SAML2_IDP_ADAPTER = 'SAML2_IDP_ADAPTER',\n SAML2_IDP_ATTRIBUTE_MAPPER = 'SAML2_IDP_ATTRIBUTE_MAPPER',\n OAUTH2_MAY_ACT = 'OAUTH2_MAY_ACT',\n}\n\nexport type ScriptSkeleton = ObjectSkeletonInterface & {\n name: string;\n description: string;\n isDefault: boolean;\n script: string;\n language: ScriptLanguage;\n context: ScriptContext;\n createdBy: string;\n creationDate: number;\n lastModifiedBy: string;\n lastModifiedDate: number;\n};\n\nexport enum Saml2ProiderLocation {\n HOSTED = 'hosted',\n REMOTE = 'remote',\n}\n\nexport type Saml2ProviderSkeleton = ObjectSkeletonInterface & {\n entityId: string;\n entityLocation: Saml2ProiderLocation;\n serviceProvider: unknown;\n identityProvider: unknown;\n attributeQueryProvider: unknown;\n xacmlPolicyEnforcementPoint: unknown;\n};\n\nexport type CircleOfTrustSkeleton = ObjectSkeletonInterface & {\n _type: AmServiceType;\n status: string;\n trustedProviders: string[];\n};\n\nexport type PagedResult<Result> = {\n result: Result[];\n resultCount: number;\n pagedResultsCookie: string;\n totalPagedResultsPolicy: 'EXACT';\n totalPagedResults: number;\n remainingPagedResults: number;\n};\n"],"mappings":";;;;;;IA6EYA,c;;;WAAAA,c;EAAAA,c;EAAAA,c;GAAAA,c,8BAAAA,c;;IAKAC,a;;;WAAAA,a;EAAAA,a;EAAAA,a;EAAAA,a;EAAAA,a;EAAAA,a;EAAAA,a;EAAAA,a;EAAAA,a;EAAAA,a;EAAAA,a;EAAAA,a;EAAAA,a;EAAAA,a;EAAAA,a;GAAAA,a,6BAAAA,a;;IA8BAC,oB;;;WAAAA,oB;EAAAA,oB;EAAAA,oB;GAAAA,oB,oCAAAA,oB"}
|
|
1
|
+
{"version":3,"file":"ApiTypes.js","names":["ScriptLanguage","ScriptContext","Saml2ProiderLocation"],"sources":["api/ApiTypes.ts"],"sourcesContent":["interface ObjectSkeletonInterface {\n _id: string;\n _rev?: number;\n [k: string]: string | number | boolean | string[] | ObjectSkeletonInterface;\n}\n\nexport interface UiConfigInterface {\n categories: string;\n}\n\nexport interface NodeRefSkeletonInterface {\n connections: Record<string, string>;\n displayName: string;\n nodeType: string;\n x: number;\n y: number;\n}\n\nexport interface InnerNodeRefSkeletonInterface {\n _id: string;\n displayName: string;\n nodeType: string;\n}\n\nexport type TreeSkeleton = ObjectSkeletonInterface & {\n entryNodeId: string;\n nodes: Record<string, NodeRefSkeletonInterface>;\n identityResource?: string;\n uiConfig?: UiConfigInterface;\n enabled?: boolean;\n};\n\nexport type AmServiceType = ObjectSkeletonInterface & {\n name: string;\n};\n\nexport type NodeSkeleton = ObjectSkeletonInterface & {\n _type: AmServiceType;\n nodes?: InnerNodeRefSkeletonInterface[];\n tree?: string;\n identityResource?: string;\n};\n\nexport type SocialIdpSkeleton = ObjectSkeletonInterface & {\n _type: AmServiceType;\n enabled: boolean;\n};\n\nexport type AmServiceSkeleton = ObjectSkeletonInterface & {\n _type: AmServiceType;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key: string]: any;\n};\n\nexport type AgentSkeleton = ObjectSkeletonInterface & {\n _type: AmServiceType;\n};\n\nexport type EmailTemplateSkeleton = ObjectSkeletonInterface & {\n defaultLocale?: string;\n displayName?: string;\n enabled?: boolean;\n from: string;\n subject: Record<string, string>;\n};\n\nexport type ThemeSkeleton = ObjectSkeletonInterface & {\n name: string;\n isDefault: boolean;\n linkedTrees: string[];\n};\n\nexport type UiThemeRealmObject = ObjectSkeletonInterface & {\n name: string;\n realm: Map<string, ThemeSkeleton[]>;\n};\n\nexport enum ScriptLanguage {\n GROOVY = 'GROOVY',\n JAVASCRIPT = 'JAVASCRIPT',\n}\n\nexport enum ScriptContext {\n OAUTH2_ACCESS_TOKEN_MODIFICATION = 'OAUTH2_ACCESS_TOKEN_MODIFICATION',\n AUTHENTICATION_CLIENT_SIDE = 'AUTHENTICATION_CLIENT_SIDE',\n AUTHENTICATION_TREE_DECISION_NODE = 'AUTHENTICATION_TREE_DECISION_NODE',\n AUTHENTICATION_SERVER_SIDE = 'AUTHENTICATION_SERVER_SIDE',\n SOCIAL_IDP_PROFILE_TRANSFORMATION = 'SOCIAL_IDP_PROFILE_TRANSFORMATION',\n OAUTH2_VALIDATE_SCOPE = 'OAUTH2_VALIDATE_SCOPE',\n CONFIG_PROVIDER_NODE = 'CONFIG_PROVIDER_NODE',\n OAUTH2_AUTHORIZE_ENDPOINT_DATA_PROVIDER = 'OAUTH2_AUTHORIZE_ENDPOINT_DATA_PROVIDER',\n OAUTH2_EVALUATE_SCOPE = 'OAUTH2_EVALUATE_SCOPE',\n POLICY_CONDITION = 'POLICY_CONDITION',\n OIDC_CLAIMS = 'OIDC_CLAIMS',\n SAML2_IDP_ADAPTER = 'SAML2_IDP_ADAPTER',\n SAML2_IDP_ATTRIBUTE_MAPPER = 'SAML2_IDP_ATTRIBUTE_MAPPER',\n OAUTH2_MAY_ACT = 'OAUTH2_MAY_ACT',\n}\n\nexport type ScriptSkeleton = ObjectSkeletonInterface & {\n name: string;\n description: string;\n isDefault: boolean;\n script: string;\n language: ScriptLanguage;\n context: ScriptContext;\n createdBy: string;\n creationDate: number;\n lastModifiedBy: string;\n lastModifiedDate: number;\n};\n\nexport enum Saml2ProiderLocation {\n HOSTED = 'hosted',\n REMOTE = 'remote',\n}\n\nexport type Saml2ProviderStub = ObjectSkeletonInterface & {\n entityId: string;\n location: Saml2ProiderLocation;\n roles: string[];\n};\n\nexport type Saml2ProviderSkeleton = ObjectSkeletonInterface & {\n entityId: string;\n entityLocation: Saml2ProiderLocation;\n serviceProvider: unknown;\n identityProvider: unknown;\n attributeQueryProvider: unknown;\n xacmlPolicyEnforcementPoint: unknown;\n};\n\nexport type CircleOfTrustSkeleton = ObjectSkeletonInterface & {\n _type: AmServiceType;\n status: string;\n trustedProviders: string[];\n};\n\nexport type PagedResult<Result> = {\n result: Result[];\n resultCount: number;\n pagedResultsCookie: string;\n totalPagedResultsPolicy: 'EXACT';\n totalPagedResults: number;\n remainingPagedResults: number;\n};\n"],"mappings":";;;;;;IA6EYA,c;;;WAAAA,c;EAAAA,c;EAAAA,c;GAAAA,c,8BAAAA,c;;IAKAC,a;;;WAAAA,a;EAAAA,a;EAAAA,a;EAAAA,a;EAAAA,a;EAAAA,a;EAAAA,a;EAAAA,a;EAAAA,a;EAAAA,a;EAAAA,a;EAAAA,a;EAAAA,a;EAAAA,a;EAAAA,a;GAAAA,a,6BAAAA,a;;IA8BAC,oB;;;WAAAA,oB;EAAAA,oB;EAAAA,oB;GAAAA,oB,oCAAAA,oB"}
|
package/cjs/api/Saml2Api.js
CHANGED
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.createProvider = createProvider;
|
|
7
7
|
exports.deleteProvider = deleteProvider;
|
|
8
8
|
exports.findProviders = findProviders;
|
|
9
|
-
exports.getProvider = getProvider;
|
|
10
9
|
exports.getProviderByLocationAndId = getProviderByLocationAndId;
|
|
11
10
|
exports.getProviderMetadata = getProviderMetadata;
|
|
12
11
|
exports.getProviderMetadataUrl = getProviderMetadataUrl;
|
|
@@ -38,8 +37,8 @@ var createRemoteProviderURLTemplate = '%s/json%s/realm-config/saml2/remote/?_act
|
|
|
38
37
|
var queryAllProvidersURLTemplate = '%s/json%s/realm-config/saml2?_queryFilter=true';
|
|
39
38
|
var queryProvidersByEntityIdURLTemplate = '%s/json%s/realm-config/saml2?_queryFilter=%s&_fields=%s';
|
|
40
39
|
var metadataByEntityIdURLTemplate = '%s/saml2/jsp/exportmetadata.jsp?entityid=%s&realm=%s';
|
|
41
|
-
var
|
|
42
|
-
var
|
|
40
|
+
var samlApplicationQueryURLTemplateRaw = '%s/json%s/realm-config/federation/entityproviders/saml2?_queryFilter=true';
|
|
41
|
+
var samlApplicationByEntityIdURLTemplate = '%s/json%s/realm-config/federation/entityproviders/saml2/%s';
|
|
43
42
|
var apiVersion = 'protocol=2.1,resource=1.0';
|
|
44
43
|
|
|
45
44
|
var getApiConfig = () => {
|
|
@@ -61,7 +60,7 @@ function getProviders() {
|
|
|
61
60
|
/**
|
|
62
61
|
* Find all providers matching the filter and return the requested fields
|
|
63
62
|
* @param {string} filter CREST filter string, eg "entityId+eq+'${entityId}'" or "true" for all providers
|
|
64
|
-
* @param {string} fields
|
|
63
|
+
* @param {string[]} fields array of field names to include in the response
|
|
65
64
|
* @returns {Promise} a promise that resolves to an object containing an array of saml2 entities
|
|
66
65
|
*/
|
|
67
66
|
|
|
@@ -94,9 +93,9 @@ function findProviders() {
|
|
|
94
93
|
function _findProviders() {
|
|
95
94
|
_findProviders = _asyncToGenerator(function* () {
|
|
96
95
|
var filter = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'true';
|
|
97
|
-
var fields = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '*';
|
|
96
|
+
var fields = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ['*'];
|
|
98
97
|
|
|
99
|
-
var urlString = _util.default.format(queryProvidersByEntityIdURLTemplate, _SessionStorage.default.session.getTenant(), (0, _ApiUtils.getCurrentRealmPath)(), encodeURIComponent(filter), fields);
|
|
98
|
+
var urlString = _util.default.format(queryProvidersByEntityIdURLTemplate, _SessionStorage.default.session.getTenant(), (0, _ApiUtils.getCurrentRealmPath)(), encodeURIComponent(filter), fields.join(','));
|
|
100
99
|
|
|
101
100
|
var {
|
|
102
101
|
data
|
|
@@ -112,9 +111,9 @@ function getProviderByLocationAndId(_x, _x2) {
|
|
|
112
111
|
return _getProviderByLocationAndId.apply(this, arguments);
|
|
113
112
|
}
|
|
114
113
|
/**
|
|
115
|
-
* Get SAML2 entity provider by entity id
|
|
116
|
-
* @param {string} entityId
|
|
117
|
-
* @returns {
|
|
114
|
+
* Get a SAML2 entity provider's metadata URL by entity id
|
|
115
|
+
* @param {string} entityId SAML2 entity id
|
|
116
|
+
* @returns {string} the URL to get the metadata from
|
|
118
117
|
*/
|
|
119
118
|
|
|
120
119
|
|
|
@@ -132,40 +131,6 @@ function _getProviderByLocationAndId() {
|
|
|
132
131
|
return _getProviderByLocationAndId.apply(this, arguments);
|
|
133
132
|
}
|
|
134
133
|
|
|
135
|
-
function getProvider(_x3) {
|
|
136
|
-
return _getProvider.apply(this, arguments);
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* Get a SAML2 entity provider's metadata URL by entity id
|
|
140
|
-
* @param {string} entityId SAML2 entity id
|
|
141
|
-
* @returns {string} the URL to get the metadata from
|
|
142
|
-
*/
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
function _getProvider() {
|
|
146
|
-
_getProvider = _asyncToGenerator(function* (entityId) {
|
|
147
|
-
var response = yield findProviders("entityId eq '".concat(entityId, "'"), 'location');
|
|
148
|
-
|
|
149
|
-
switch (response.resultCount) {
|
|
150
|
-
case 0:
|
|
151
|
-
throw new Error("No provider with entity id '".concat(entityId, "' found"));
|
|
152
|
-
|
|
153
|
-
case 1:
|
|
154
|
-
{
|
|
155
|
-
var {
|
|
156
|
-
location
|
|
157
|
-
} = response.result[0];
|
|
158
|
-
var id = response.result[0]._id;
|
|
159
|
-
return getProviderByLocationAndId(location, id);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
default:
|
|
163
|
-
throw new Error("Multiple providers with entity id '".concat(entityId, "' found"));
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
return _getProvider.apply(this, arguments);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
134
|
function getProviderMetadataUrl(entityId) {
|
|
170
135
|
return _util.default.format(metadataByEntityIdURLTemplate, _SessionStorage.default.session.getTenant(), encodeURIComponent(entityId), _SessionStorage.default.session.getRealm());
|
|
171
136
|
}
|
|
@@ -176,7 +141,7 @@ function getProviderMetadataUrl(entityId) {
|
|
|
176
141
|
*/
|
|
177
142
|
|
|
178
143
|
|
|
179
|
-
function getProviderMetadata(
|
|
144
|
+
function getProviderMetadata(_x3) {
|
|
180
145
|
return _getProviderMetadata.apply(this, arguments);
|
|
181
146
|
}
|
|
182
147
|
/**
|
|
@@ -200,7 +165,7 @@ function _getProviderMetadata() {
|
|
|
200
165
|
return _getProviderMetadata.apply(this, arguments);
|
|
201
166
|
}
|
|
202
167
|
|
|
203
|
-
function createProvider(_x5, _x6
|
|
168
|
+
function createProvider(_x4, _x5, _x6) {
|
|
204
169
|
return _createProvider.apply(this, arguments);
|
|
205
170
|
}
|
|
206
171
|
/**
|
|
@@ -237,7 +202,7 @@ function _createProvider() {
|
|
|
237
202
|
return _createProvider.apply(this, arguments);
|
|
238
203
|
}
|
|
239
204
|
|
|
240
|
-
function updateProvider(
|
|
205
|
+
function updateProvider(_x7, _x8) {
|
|
241
206
|
return _updateProvider.apply(this, arguments);
|
|
242
207
|
} // Contributions using legacy APIs. Need to investigate if those will be deprecated in the future
|
|
243
208
|
|
|
@@ -262,7 +227,7 @@ function _updateProvider() {
|
|
|
262
227
|
return _updateProvider.apply(this, arguments);
|
|
263
228
|
}
|
|
264
229
|
|
|
265
|
-
function deleteProvider(
|
|
230
|
+
function deleteProvider(_x9) {
|
|
266
231
|
return _deleteProvider.apply(this, arguments);
|
|
267
232
|
}
|
|
268
233
|
/**
|
|
@@ -273,7 +238,7 @@ function deleteProvider(_x10) {
|
|
|
273
238
|
|
|
274
239
|
function _deleteProvider() {
|
|
275
240
|
_deleteProvider = _asyncToGenerator(function* (entityId) {
|
|
276
|
-
var urlString = _util.default.format(
|
|
241
|
+
var urlString = _util.default.format(samlApplicationByEntityIdURLTemplate, _SessionStorage.default.session.getTenant(), (0, _ApiUtils.getCurrentRealmPath)(), entityId);
|
|
277
242
|
|
|
278
243
|
var {
|
|
279
244
|
data
|
|
@@ -290,14 +255,14 @@ function getRawProviders() {
|
|
|
290
255
|
}
|
|
291
256
|
/**
|
|
292
257
|
* Gets the data for an entity provider including the raw XML.
|
|
293
|
-
* @param {string}
|
|
258
|
+
* @param {string} entityId The entity provider id
|
|
294
259
|
* @returns Promise that when resolved includes the configuration and raw xml for a SAML entity provider
|
|
295
260
|
*/
|
|
296
261
|
|
|
297
262
|
|
|
298
263
|
function _getRawProviders() {
|
|
299
264
|
_getRawProviders = _asyncToGenerator(function* () {
|
|
300
|
-
var urlString = _util.default.format(
|
|
265
|
+
var urlString = _util.default.format(samlApplicationQueryURLTemplateRaw, _SessionStorage.default.session.getTenant(), (0, _ApiUtils.getCurrentRealmPath)());
|
|
301
266
|
|
|
302
267
|
var {
|
|
303
268
|
data
|
|
@@ -309,12 +274,12 @@ function _getRawProviders() {
|
|
|
309
274
|
return _getRawProviders.apply(this, arguments);
|
|
310
275
|
}
|
|
311
276
|
|
|
312
|
-
function getRawProvider(
|
|
277
|
+
function getRawProvider(_x10) {
|
|
313
278
|
return _getRawProvider.apply(this, arguments);
|
|
314
279
|
}
|
|
315
280
|
/**
|
|
316
281
|
* Stores a new SAML2 entity provider
|
|
317
|
-
* @param {string}
|
|
282
|
+
* @param {string} entityId The entity provider id
|
|
318
283
|
* @param {string} entityData The actual data containing the entity provider configuration
|
|
319
284
|
* @returns {Promise} Promise that resolves to a provider object
|
|
320
285
|
*/
|
|
@@ -322,7 +287,7 @@ function getRawProvider(_x11) {
|
|
|
322
287
|
|
|
323
288
|
function _getRawProvider() {
|
|
324
289
|
_getRawProvider = _asyncToGenerator(function* (entityId) {
|
|
325
|
-
var urlString = _util.default.format(
|
|
290
|
+
var urlString = _util.default.format(samlApplicationByEntityIdURLTemplate, _SessionStorage.default.session.getTenant(), (0, _ApiUtils.getCurrentRealmPath)(), encodeURIComponent(entityId));
|
|
326
291
|
|
|
327
292
|
var {
|
|
328
293
|
data
|
|
@@ -334,13 +299,13 @@ function _getRawProvider() {
|
|
|
334
299
|
return _getRawProvider.apply(this, arguments);
|
|
335
300
|
}
|
|
336
301
|
|
|
337
|
-
function putRawProvider(
|
|
302
|
+
function putRawProvider(_x11, _x12) {
|
|
338
303
|
return _putRawProvider.apply(this, arguments);
|
|
339
304
|
}
|
|
340
305
|
|
|
341
306
|
function _putRawProvider() {
|
|
342
|
-
_putRawProvider = _asyncToGenerator(function* (
|
|
343
|
-
var urlString = _util.default.format(
|
|
307
|
+
_putRawProvider = _asyncToGenerator(function* (entityId, entityData) {
|
|
308
|
+
var urlString = _util.default.format(samlApplicationByEntityIdURLTemplate, _SessionStorage.default.session.getTenant(), (0, _ApiUtils.getCurrentRealmPath)(), encodeURIComponent(entityId));
|
|
344
309
|
|
|
345
310
|
var {
|
|
346
311
|
data
|
package/cjs/api/Saml2Api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Saml2Api.js","names":["providerByLocationAndIdURLTemplate","createHostedProviderURLTemplate","createRemoteProviderURLTemplate","queryAllProvidersURLTemplate","queryProvidersByEntityIdURLTemplate","metadataByEntityIdURLTemplate","samlApplicationListURLTemplateRaw","samlApplicationListURLTemplateEntityIdRaw","apiVersion","getApiConfig","configPath","getCurrentRealmPath","path","getProviders","urlString","util","format","storage","session","getTenant","data","generateAmApi","get","withCredentials","findProviders","filter","fields","encodeURIComponent","getProviderByLocationAndId","location","entityId64","getProvider","entityId","response","resultCount","Error","result","id","_id","getProviderMetadataUrl","getRealm","getProviderMetadata","createProvider","providerData","metaData","postData","_","cloneDeep","standardMetadata","post","updateProvider","put","deleteProvider","delete","getRawProviders","getRawProvider","putRawProvider","entityData"],"sources":["api/Saml2Api.ts"],"sourcesContent":["import _ from 'lodash';\nimport util from 'util';\nimport storage from '../storage/SessionStorage';\nimport { generateAmApi } from './BaseApi';\nimport { getCurrentRealmPath } from './utils/ApiUtils';\n\nconst providerByLocationAndIdURLTemplate = '%s/json%s/realm-config/saml2/%s/%s';\nconst createHostedProviderURLTemplate =\n '%s/json%s/realm-config/saml2/hosted/?_action=create';\nconst createRemoteProviderURLTemplate =\n '%s/json%s/realm-config/saml2/remote/?_action=importEntity';\nconst queryAllProvidersURLTemplate =\n '%s/json%s/realm-config/saml2?_queryFilter=true';\nconst queryProvidersByEntityIdURLTemplate =\n '%s/json%s/realm-config/saml2?_queryFilter=%s&_fields=%s';\nconst metadataByEntityIdURLTemplate =\n '%s/saml2/jsp/exportmetadata.jsp?entityid=%s&realm=%s';\nconst samlApplicationListURLTemplateRaw =\n '%s/json%s/realm-config/federation/entityproviders/saml2?_queryFilter=true';\nconst samlApplicationListURLTemplateEntityIdRaw =\n '%s/json%s/realm-config/federation/entityproviders/saml2/%s';\nconst apiVersion = 'protocol=2.1,resource=1.0';\nconst getApiConfig = () => {\n const configPath = getCurrentRealmPath();\n return {\n path: `${configPath}/realm-config/saml2`,\n apiVersion,\n };\n};\n\n/**\n * Get all SAML2 entity providers\n * @returns {Promise} a promise that resolves to an array of saml2 entity stubs\n */\nexport async function getProviders() {\n const urlString = util.format(\n queryAllProvidersURLTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath()\n );\n const { data } = await generateAmApi(getApiConfig()).get(urlString, {\n withCredentials: true,\n });\n return data;\n}\n\n/**\n * Find all providers matching the filter and return the requested fields\n * @param {string} filter CREST filter string, eg \"entityId+eq+'${entityId}'\" or \"true\" for all providers\n * @param {string} fields Comma-delimited list of fields to include in the response\n * @returns {Promise} a promise that resolves to an object containing an array of saml2 entities\n */\nexport async function findProviders(filter = 'true', fields = '*') {\n const urlString = util.format(\n queryProvidersByEntityIdURLTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath(),\n encodeURIComponent(filter),\n fields\n );\n const { data } = await generateAmApi(getApiConfig()).get(urlString, {\n withCredentials: true,\n });\n return data;\n}\n\n/**\n * Geta SAML2 entity provider by location and id\n * @param {string} location Entity provider location (hosted or remote)\n * @param {string} entityId64 Base64-encoded provider entity id\n * @returns {Promise} a promise that resolves to a saml2 entity provider object\n */\nexport async function getProviderByLocationAndId(\n location: string,\n entityId64: string\n) {\n const urlString = util.format(\n providerByLocationAndIdURLTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath(),\n location,\n entityId64\n );\n const { data } = await generateAmApi(getApiConfig()).get(urlString, {\n withCredentials: true,\n });\n return data;\n}\n\n/**\n * Get SAML2 entity provider by entity id\n * @param {string} entityId Provider entity id\n * @returns {Promise} a promise that resolves to a saml2 entity provider object or null\n */\nexport async function getProvider(entityId) {\n const response = await findProviders(`entityId eq '${entityId}'`, 'location');\n switch (response.resultCount) {\n case 0:\n throw new Error(`No provider with entity id '${entityId}' found`);\n case 1: {\n const { location } = response.result[0];\n const id = response.result[0]._id;\n return getProviderByLocationAndId(location, id);\n }\n default:\n throw new Error(`Multiple providers with entity id '${entityId}' found`);\n }\n}\n\n/**\n * Get a SAML2 entity provider's metadata URL by entity id\n * @param {string} entityId SAML2 entity id\n * @returns {string} the URL to get the metadata from\n */\nexport function getProviderMetadataUrl(entityId) {\n return util.format(\n metadataByEntityIdURLTemplate,\n storage.session.getTenant(),\n encodeURIComponent(entityId),\n storage.session.getRealm()\n );\n}\n\n/**\n * Get a SAML2 entity provider's metadata by entity id\n * @param {String} entityId SAML2 entity id\n * @returns {Promise} a promise that resolves to an object containing a SAML2 metadata\n */\nexport async function getProviderMetadata(entityId) {\n const { data } = await generateAmApi(getApiConfig()).get(\n getProviderMetadataUrl(entityId),\n {\n withCredentials: true,\n }\n );\n return data;\n}\n\n/**\n * Create a SAML2 entity provider\n * @param {String} location 'hosted' or 'remote'\n * @param {Object} providerData Object representing a SAML entity provider\n * @param {String} metaData Base64-encoded metadata XML. Only required for remote providers\n * @returns {Promise} a promise that resolves to a saml2 entity provider object\n */\nexport async function createProvider(location, providerData, metaData) {\n let postData = _.cloneDeep(providerData);\n let urlString = util.format(\n createHostedProviderURLTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath()\n );\n\n if (location === 'remote') {\n /**\n * Remote entity providers must be created using XML metadata\n */\n urlString = util.format(\n createRemoteProviderURLTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath()\n );\n postData = {\n standardMetadata: metaData,\n };\n }\n\n const { data } = await generateAmApi(getApiConfig()).post(\n urlString,\n postData,\n {\n withCredentials: true,\n }\n );\n return data;\n}\n\n/**\n * Update SAML2 entity provider\n * @param {String} location Entity provider location (hosted or remote)\n * @param {Object} providerData Object representing a SAML entity provider\n * @returns {Promise} a promise that resolves to a saml2 entity provider object\n */\nexport async function updateProvider(location, providerData) {\n const urlString = util.format(\n providerByLocationAndIdURLTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath(),\n location,\n providerData._id\n );\n const { data } = await generateAmApi(getApiConfig()).put(\n urlString,\n providerData,\n {\n withCredentials: true,\n }\n );\n return data;\n}\n\n// Contributions using legacy APIs. Need to investigate if those will be deprecated in the future\n\n/**\n * Deletes a SAML2 entity provider by entity id\n * @param {string} entityId Provider entity id\n * @returns {Promise} a promise that resolves to a provider object\n */\nexport async function deleteProvider(entityId) {\n const urlString = util.format(\n samlApplicationListURLTemplateEntityIdRaw,\n storage.session.getTenant(),\n getCurrentRealmPath(),\n entityId\n );\n const { data } = await generateAmApi(getApiConfig()).delete(urlString, {\n withCredentials: true,\n });\n return data;\n}\n\n/**\n * Retrieves all entity providers using the legacy federation enpoints.\n * @returns {Promise} a promise that resolves to an object containing an array of providers\n */\nexport async function getRawProviders() {\n const urlString = util.format(\n samlApplicationListURLTemplateRaw,\n storage.session.getTenant(),\n getCurrentRealmPath()\n );\n const { data } = await generateAmApi(getApiConfig()).get(urlString, {\n withCredentials: true,\n });\n return data;\n}\n\n/**\n * Gets the data for an entity provider including the raw XML.\n * @param {string} id The entity provider id\n * @returns Promise that when resolved includes the configuration and raw xml for a SAML entity provider\n */\nexport async function getRawProvider(entityId) {\n const urlString = util.format(\n samlApplicationListURLTemplateEntityIdRaw,\n storage.session.getTenant(),\n getCurrentRealmPath(),\n entityId\n );\n const { data } = await generateAmApi(getApiConfig()).get(urlString, {\n withCredentials: true,\n });\n return data;\n}\n\n/**\n * Stores a new SAML2 entity provider\n * @param {string} id The entity provider id\n * @param {string} entityData The actual data containing the entity provider configuration\n * @returns {Promise} Promise that resolves to a provider object\n */\nexport async function putRawProvider(id, entityData) {\n const urlString = util.format(\n samlApplicationListURLTemplateEntityIdRaw,\n storage.session.getTenant(),\n getCurrentRealmPath(),\n id\n );\n const { data } = await generateAmApi(getApiConfig()).put(\n urlString,\n entityData,\n {\n withCredentials: true,\n }\n );\n return data;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;;;AAEA,IAAMA,kCAAkC,GAAG,oCAA3C;AACA,IAAMC,+BAA+B,GACnC,qDADF;AAEA,IAAMC,+BAA+B,GACnC,2DADF;AAEA,IAAMC,4BAA4B,GAChC,gDADF;AAEA,IAAMC,mCAAmC,GACvC,yDADF;AAEA,IAAMC,6BAA6B,GACjC,sDADF;AAEA,IAAMC,iCAAiC,GACrC,2EADF;AAEA,IAAMC,yCAAyC,GAC7C,4DADF;AAEA,IAAMC,UAAU,GAAG,2BAAnB;;AACA,IAAMC,YAAY,GAAG,MAAM;EACzB,IAAMC,UAAU,GAAG,IAAAC,6BAAA,GAAnB;EACA,OAAO;IACLC,IAAI,YAAKF,UAAL,wBADC;IAELF;EAFK,CAAP;AAID,CAND;AAQA;AACA;AACA;AACA;;;SACsBK,Y;;;AAYtB;AACA;AACA;AACA;AACA;AACA;;;;oCAjBO,aAA8B;IACnC,IAAMC,SAAS,GAAGC,aAAA,CAAKC,MAAL,CAChBb,4B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hBU,uBAAA,CAAQC,OAAR,CAAgBC,SAAhB,EAFgB,EAGhB,IAAAR,6BAAA,GAHgB,EAIhB0B,EAJgB,CAAlB;;IAMA,IAAM;MAAEjB;IAAF,UAAiB,IAAAC,sBAAA,EAAcZ,YAAY,EAA1B,EAA8B0C,GAA9B,CACrBrC,SADqB,EAErB2C,UAFqB,EAGrB;MACElC,eAAe,EAAE;IADnB,CAHqB,CAAvB;IAOA,OAAOH,IAAP;EACD,C"}
|
|
1
|
+
{"version":3,"file":"Saml2Api.js","names":["providerByLocationAndIdURLTemplate","createHostedProviderURLTemplate","createRemoteProviderURLTemplate","queryAllProvidersURLTemplate","queryProvidersByEntityIdURLTemplate","metadataByEntityIdURLTemplate","samlApplicationQueryURLTemplateRaw","samlApplicationByEntityIdURLTemplate","apiVersion","getApiConfig","configPath","getCurrentRealmPath","path","getProviders","urlString","util","format","storage","session","getTenant","data","generateAmApi","get","withCredentials","findProviders","filter","fields","encodeURIComponent","join","getProviderByLocationAndId","location","entityId64","getProviderMetadataUrl","entityId","getRealm","getProviderMetadata","createProvider","providerData","metaData","postData","_","cloneDeep","standardMetadata","post","updateProvider","_id","put","deleteProvider","delete","getRawProviders","getRawProvider","putRawProvider","entityData"],"sources":["api/Saml2Api.ts"],"sourcesContent":["import _ from 'lodash';\nimport util from 'util';\nimport storage from '../storage/SessionStorage';\nimport { generateAmApi } from './BaseApi';\nimport { getCurrentRealmPath } from './utils/ApiUtils';\n\nconst providerByLocationAndIdURLTemplate = '%s/json%s/realm-config/saml2/%s/%s';\nconst createHostedProviderURLTemplate =\n '%s/json%s/realm-config/saml2/hosted/?_action=create';\nconst createRemoteProviderURLTemplate =\n '%s/json%s/realm-config/saml2/remote/?_action=importEntity';\nconst queryAllProvidersURLTemplate =\n '%s/json%s/realm-config/saml2?_queryFilter=true';\nconst queryProvidersByEntityIdURLTemplate =\n '%s/json%s/realm-config/saml2?_queryFilter=%s&_fields=%s';\nconst metadataByEntityIdURLTemplate =\n '%s/saml2/jsp/exportmetadata.jsp?entityid=%s&realm=%s';\nconst samlApplicationQueryURLTemplateRaw =\n '%s/json%s/realm-config/federation/entityproviders/saml2?_queryFilter=true';\nconst samlApplicationByEntityIdURLTemplate =\n '%s/json%s/realm-config/federation/entityproviders/saml2/%s';\nconst apiVersion = 'protocol=2.1,resource=1.0';\nconst getApiConfig = () => {\n const configPath = getCurrentRealmPath();\n return {\n path: `${configPath}/realm-config/saml2`,\n apiVersion,\n };\n};\n\n/**\n * Get all SAML2 entity providers\n * @returns {Promise} a promise that resolves to an array of saml2 entity stubs\n */\nexport async function getProviders() {\n const urlString = util.format(\n queryAllProvidersURLTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath()\n );\n const { data } = await generateAmApi(getApiConfig()).get(urlString, {\n withCredentials: true,\n });\n return data;\n}\n\n/**\n * Find all providers matching the filter and return the requested fields\n * @param {string} filter CREST filter string, eg \"entityId+eq+'${entityId}'\" or \"true\" for all providers\n * @param {string[]} fields array of field names to include in the response\n * @returns {Promise} a promise that resolves to an object containing an array of saml2 entities\n */\nexport async function findProviders(filter = 'true', fields = ['*']) {\n const urlString = util.format(\n queryProvidersByEntityIdURLTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath(),\n encodeURIComponent(filter),\n fields.join(',')\n );\n const { data } = await generateAmApi(getApiConfig()).get(urlString, {\n withCredentials: true,\n });\n return data;\n}\n\n/**\n * Geta SAML2 entity provider by location and id\n * @param {string} location Entity provider location (hosted or remote)\n * @param {string} entityId64 Base64-encoded provider entity id\n * @returns {Promise} a promise that resolves to a saml2 entity provider object\n */\nexport async function getProviderByLocationAndId(\n location: string,\n entityId64: string\n) {\n const urlString = util.format(\n providerByLocationAndIdURLTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath(),\n location,\n entityId64\n );\n const { data } = await generateAmApi(getApiConfig()).get(urlString, {\n withCredentials: true,\n });\n return data;\n}\n\n/**\n * Get a SAML2 entity provider's metadata URL by entity id\n * @param {string} entityId SAML2 entity id\n * @returns {string} the URL to get the metadata from\n */\nexport function getProviderMetadataUrl(entityId: string): string {\n return util.format(\n metadataByEntityIdURLTemplate,\n storage.session.getTenant(),\n encodeURIComponent(entityId),\n storage.session.getRealm()\n );\n}\n\n/**\n * Get a SAML2 entity provider's metadata by entity id\n * @param {String} entityId SAML2 entity id\n * @returns {Promise} a promise that resolves to an object containing a SAML2 metadata\n */\nexport async function getProviderMetadata(entityId) {\n const { data } = await generateAmApi(getApiConfig()).get(\n getProviderMetadataUrl(entityId),\n {\n withCredentials: true,\n }\n );\n return data;\n}\n\n/**\n * Create a SAML2 entity provider\n * @param {String} location 'hosted' or 'remote'\n * @param {Object} providerData Object representing a SAML entity provider\n * @param {String} metaData Base64-encoded metadata XML. Only required for remote providers\n * @returns {Promise} a promise that resolves to a saml2 entity provider object\n */\nexport async function createProvider(location, providerData, metaData) {\n let postData = _.cloneDeep(providerData);\n let urlString = util.format(\n createHostedProviderURLTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath()\n );\n\n if (location === 'remote') {\n /**\n * Remote entity providers must be created using XML metadata\n */\n urlString = util.format(\n createRemoteProviderURLTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath()\n );\n postData = {\n standardMetadata: metaData,\n };\n }\n\n const { data } = await generateAmApi(getApiConfig()).post(\n urlString,\n postData,\n {\n withCredentials: true,\n }\n );\n return data;\n}\n\n/**\n * Update SAML2 entity provider\n * @param {String} location Entity provider location (hosted or remote)\n * @param {Object} providerData Object representing a SAML entity provider\n * @returns {Promise} a promise that resolves to a saml2 entity provider object\n */\nexport async function updateProvider(location, providerData) {\n const urlString = util.format(\n providerByLocationAndIdURLTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath(),\n location,\n providerData._id\n );\n const { data } = await generateAmApi(getApiConfig()).put(\n urlString,\n providerData,\n {\n withCredentials: true,\n }\n );\n return data;\n}\n\n// Contributions using legacy APIs. Need to investigate if those will be deprecated in the future\n\n/**\n * Deletes a SAML2 entity provider by entity id\n * @param {string} entityId Provider entity id\n * @returns {Promise} a promise that resolves to a provider object\n */\nexport async function deleteProvider(entityId) {\n const urlString = util.format(\n samlApplicationByEntityIdURLTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath(),\n entityId\n );\n const { data } = await generateAmApi(getApiConfig()).delete(urlString, {\n withCredentials: true,\n });\n return data;\n}\n\n/**\n * Retrieves all entity providers using the legacy federation enpoints.\n * @returns {Promise} a promise that resolves to an object containing an array of providers\n */\nexport async function getRawProviders() {\n const urlString = util.format(\n samlApplicationQueryURLTemplateRaw,\n storage.session.getTenant(),\n getCurrentRealmPath()\n );\n const { data } = await generateAmApi(getApiConfig()).get(urlString, {\n withCredentials: true,\n });\n return data;\n}\n\n/**\n * Gets the data for an entity provider including the raw XML.\n * @param {string} entityId The entity provider id\n * @returns Promise that when resolved includes the configuration and raw xml for a SAML entity provider\n */\nexport async function getRawProvider(entityId: string) {\n const urlString = util.format(\n samlApplicationByEntityIdURLTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath(),\n encodeURIComponent(entityId)\n );\n const { data } = await generateAmApi(getApiConfig()).get(urlString, {\n withCredentials: true,\n });\n return data;\n}\n\n/**\n * Stores a new SAML2 entity provider\n * @param {string} entityId The entity provider id\n * @param {string} entityData The actual data containing the entity provider configuration\n * @returns {Promise} Promise that resolves to a provider object\n */\nexport async function putRawProvider(entityId: string, entityData) {\n const urlString = util.format(\n samlApplicationByEntityIdURLTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath(),\n encodeURIComponent(entityId)\n );\n const { data } = await generateAmApi(getApiConfig()).put(\n urlString,\n entityData,\n {\n withCredentials: true,\n }\n );\n return data;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;;;AAEA,IAAMA,kCAAkC,GAAG,oCAA3C;AACA,IAAMC,+BAA+B,GACnC,qDADF;AAEA,IAAMC,+BAA+B,GACnC,2DADF;AAEA,IAAMC,4BAA4B,GAChC,gDADF;AAEA,IAAMC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gB,EAGhB,IAAAR,6BAAA,GAHgB,EAIhBgB,kBAAkB,CAACM,QAAD,CAJF,CAAlB;;IAMA,IAAM;MAAEb;IAAF,UAAiB,IAAAC,sBAAA,EAAcZ,YAAY,EAA1B,EAA8BqC,GAA9B,CACrBhC,SADqB,EAErBsC,UAFqB,EAGrB;MACE7B,eAAe,EAAE;IADnB,CAHqB,CAAvB;IAOA,OAAOH,IAAP;EACD,C"}
|
package/cjs/api/ServiceApi.js
CHANGED
|
@@ -131,9 +131,7 @@ function putService(_x3, _x4) {
|
|
|
131
131
|
|
|
132
132
|
function _putService() {
|
|
133
133
|
_putService = _asyncToGenerator(function* (serviceId, serviceData) {
|
|
134
|
-
var
|
|
135
|
-
|
|
136
|
-
var urlString = _util.default.format(serviceURLTemplate, _SessionStorage.default.session.getTenant(), realm, serviceId);
|
|
134
|
+
var urlString = _util.default.format(serviceURLTemplate, _SessionStorage.default.session.getTenant(), (0, _ApiUtils.getCurrentRealmPath)(), serviceId);
|
|
137
135
|
|
|
138
136
|
var {
|
|
139
137
|
data
|
|
@@ -157,9 +155,7 @@ function putServiceNextDescendent(_x5, _x6, _x7, _x8) {
|
|
|
157
155
|
|
|
158
156
|
function _putServiceNextDescendent() {
|
|
159
157
|
_putServiceNextDescendent = _asyncToGenerator(function* (serviceId, serviceType, serviceNextDescendentId, serviceNextDescendentData) {
|
|
160
|
-
var
|
|
161
|
-
|
|
162
|
-
var urlString = _util.default.format(serviceURLNextDescendentTemplate, _SessionStorage.default.session.getTenant(), realm, serviceId, serviceType, serviceNextDescendentId);
|
|
158
|
+
var urlString = _util.default.format(serviceURLNextDescendentTemplate, _SessionStorage.default.session.getTenant(), (0, _ApiUtils.getCurrentRealmPath)(), serviceId, serviceType, serviceNextDescendentId);
|
|
163
159
|
|
|
164
160
|
var {
|
|
165
161
|
data
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServiceApi.js","names":["serviceURLTemplate","serviceURLNextDescendentsTemplate","serviceURLNextDescendentTemplate","serviceListURLTemplate","apiVersion","getApiConfig","configPath","getCurrentRealmPath","path","getListOfServices","urlString","util","format","storage","session","getTenant","data","generateAmApi","get","withCredentials","getService","serviceId","getServiceDescendents","post","result","putService","serviceData","realm","getRealm","put","putServiceNextDescendent","serviceType","serviceNextDescendentId","serviceNextDescendentData","deleteService","delete","deleteServiceNextDescendent"],"sources":["api/ServiceApi.ts"],"sourcesContent":["import util from 'util';\nimport storage from '../storage/SessionStorage';\nimport { AmServiceSkeleton, PagedResult } from './ApiTypes';\nimport { generateAmApi } from './BaseApi';\nimport { getCurrentRealmPath } from './utils/ApiUtils';\n\nconst serviceURLTemplate = '%s/json%s/realm-config/services/%s';\nconst serviceURLNextDescendentsTemplate =\n '%s/json%s/realm-config/services/%s?_action=nextdescendents';\nconst serviceURLNextDescendentTemplate =\n '%s/json%s/realm-config/services/%s/%s/%s';\nconst serviceListURLTemplate =\n '%s/json%s/realm-config/services?_queryFilter=true';\nconst apiVersion = 'protocol=2.0,resource=1.0';\n\nfunction getApiConfig() {\n const configPath = getCurrentRealmPath();\n return {\n path: `${configPath}/realm-config/services`,\n apiVersion,\n };\n}\n\nexport interface ServiceListItem {\n /**\n * The identifier for the service - used to construct the subpath for the service\n */\n _id: string;\n /**\n * The user-facing name of the service\n */\n name: string;\n /**\n * The revision number of the service\n */\n _rev: string;\n}\n\n// export interface AmService {\n// _id: '';\n// _rev: string;\n// _type: {\n// _id: string;\n// name: string;\n// collection: boolean;\n// };\n// [key: string]: any;\n// }\n\nexport interface ServiceNextDescendentResponse {\n result: ServiceNextDescendent;\n}\n\nexport interface ServiceNextDescendent {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key: string]: any;\n}\n\n/**\n * Get a list of services\n * @returns {Promise<ServiceListItem[]>} a promise resolving to an array of service list items.\n */\nexport async function getListOfServices(): Promise<\n PagedResult<ServiceListItem>\n> {\n const urlString = util.format(\n serviceListURLTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath()\n );\n const { data } = await generateAmApi(getApiConfig()).get<\n PagedResult<ServiceListItem>\n >(urlString, {\n withCredentials: true,\n });\n return data;\n}\n\n/**\n * Get service\n * @param {string} serviceId servide id\n * @returns {Promise<AmService>} a promise resolving to a service object\n */\nexport async function getService(\n serviceId: string\n): Promise<AmServiceSkeleton> {\n const urlString = util.format(\n serviceURLTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath(),\n serviceId\n );\n const { data } = await generateAmApi(getApiConfig()).get<AmServiceSkeleton>(\n urlString,\n {\n withCredentials: true,\n }\n );\n return data;\n}\n\n/**\n * Get a service's decendents (applicable for structured services only, e.g. SocialIdentityProviders)\n * @param {string} serviceId service id\n * @returns {Promise<ServiceNextDescendent[]>} a promise resolving to an array of the service's next decendents\n */\nexport async function getServiceDescendents(\n serviceId: string\n): Promise<ServiceNextDescendent[]> {\n const urlString = util.format(\n serviceURLNextDescendentsTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath(),\n serviceId\n );\n const { data } = await generateAmApi(\n getApiConfig()\n ).post<ServiceNextDescendentResponse>(urlString, {\n withCredentials: true,\n });\n return data.result as ServiceNextDescendent[];\n}\n\n/**\n * Create or update a service\n * @param {string} serviceId service id\n * @param {AmService} serviceData service configuration\n * @returns {Promise<AmService>} a promise resolving to a service object\n */\nexport async function putService(\n serviceId: string,\n serviceData: AmServiceSkeleton\n): Promise<AmServiceSkeleton> {\n const realm =\n storage.session.getRealm() === '/' ? '' : storage.session.getRealm();\n const urlString = util.format(\n serviceURLTemplate,\n storage.session.getTenant(),\n realm,\n serviceId\n );\n const { data } = await generateAmApi(getApiConfig()).put(\n urlString,\n serviceData,\n {\n withCredentials: true,\n }\n );\n return data;\n}\n\n/**\n * Create or update a service next descendent instance\n * @param {string} serviceId service id\n * @param {string} serviceType service type\n * @param {string} serviceNextDescendentId service instance id\n * @param {ServiceNextDescendent} serviceNextDescendentData service next descendent configuration\n * @returns {Promise<ServiceNextDescendent>} a promise resolving to a service next descendent\n */\nexport async function putServiceNextDescendent(\n serviceId: string,\n serviceType: string,\n serviceNextDescendentId: string,\n serviceNextDescendentData: ServiceNextDescendent\n): Promise<ServiceNextDescendent> {\n const realm =\n storage.session.getRealm() === '/' ? '' : storage.session.getRealm();\n const urlString = util.format(\n serviceURLNextDescendentTemplate,\n storage.session.getTenant(),\n realm,\n serviceId,\n serviceType,\n serviceNextDescendentId\n );\n const { data } = await generateAmApi(getApiConfig()).put(\n urlString,\n serviceNextDescendentData,\n {\n withCredentials: true,\n }\n );\n return data;\n}\n\n/**\n * Delete service\n * @param {string} serviceId service id\n * @returns {Promise<AmService>} a promise resolving to a service object\n */\nexport async function deleteService(\n serviceId: string\n): Promise<AmServiceSkeleton> {\n const urlString = util.format(\n serviceURLTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath(),\n serviceId\n );\n const { data } = await generateAmApi(getApiConfig()).delete(urlString, {\n withCredentials: true,\n });\n return data;\n}\n\n/**\n * Delete service next descendent\n * @param {string} serviceId service id\n * @param {string} serviceType service type\n * @param {string} serviceNextDescendentId service instance id\n * @returns {Promise<ServiceNextDescendent>} a promise resolving to a service next descendent\n */\nexport async function deleteServiceNextDescendent(\n serviceId: string,\n serviceType: string,\n serviceNextDescendentId: string\n): Promise<ServiceNextDescendent> {\n const urlString = util.format(\n serviceURLNextDescendentTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath(),\n serviceId,\n serviceType,\n serviceNextDescendentId\n );\n const { data } = await generateAmApi(getApiConfig()).delete(urlString, {\n withCredentials: true,\n });\n return data;\n}\n"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AAEA;;AACA;;;;;;;;AAEA,IAAMA,kBAAkB,GAAG,oCAA3B;AACA,IAAMC,iCAAiC,GACrC,4DADF;AAEA,IAAMC,gCAAgC,GACpC,0CADF;AAEA,IAAMC,sBAAsB,GAC1B,mDADF;AAEA,IAAMC,UAAU,GAAG,2BAAnB;;AAEA,SAASC,YAAT,GAAwB;EACtB,IAAMC,UAAU,GAAG,IAAAC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,EAGrB;MACEd,eAAe,EAAE;IADnB,CAHqB,CAAvB;IAOA,OAAOH,IAAP;EACD,C;;;;SAOqBkB,a;;;AAetB;AACA;AACA;AACA;AACA;AACA;AACA;;;;qCArBO,WACLb,SADK,EAEuB;IAC5B,IAAMX,SAAS,GAAGC,aAAA,CAAKC,MAAL,CAChBZ,kBADgB,EAEhBa,uBAAA,CAAQC,OAAR,CAAgBC,SAAhB,EAFgB,EAGhB,IAAAR,6BAAA,GAHgB,EAIhBc,SAJgB,CAAlB;;IAMA,IAAM;MAAEL;IAAF,UAAiB,IAAAC,sBAAA,EAAcZ,YAAY,EAA1B,EAA8B8B,MAA9B,CAAqCzB,SAArC,EAAgD;MACrES,eAAe,EAAE;IADoD,CAAhD,CAAvB;IAGA,OAAOH,IAAP;EACD,C;;;;SASqBoB,2B;;;;;mDAAf,WACLf,SADK,EAELU,WAFK,EAGLC,uBAHK,EAI2B;IAChC,IAAMtB,SAAS,GAAGC,aAAA,CAAKC,MAAL,CAChBV,gCADgB,EAEhBW,uBAAA,CAAQC,OAAR,CAAgBC,SAAhB,EAFgB,EAGhB,IAAAR,6BAAA,GAHgB,EAIhBc,SAJgB,EAKhBU,WALgB,EAMhBC,uBANgB,CAAlB;;IAQA,IAAM;MAAEhB;IAAF,UAAiB,IAAAC,sBAAA,EAAcZ,YAAY,EAA1B,EAA8B8B,MAA9B,CAAqCzB,SAArC,EAAgD;MACrES,eAAe,EAAE;IADoD,CAAhD,CAAvB;IAGA,OAAOH,IAAP;EACD,C"}
|
|
1
|
+
{"version":3,"file":"ServiceApi.js","names":["serviceURLTemplate","serviceURLNextDescendentsTemplate","serviceURLNextDescendentTemplate","serviceListURLTemplate","apiVersion","getApiConfig","configPath","getCurrentRealmPath","path","getListOfServices","urlString","util","format","storage","session","getTenant","data","generateAmApi","get","withCredentials","getService","serviceId","getServiceDescendents","post","result","putService","serviceData","put","putServiceNextDescendent","serviceType","serviceNextDescendentId","serviceNextDescendentData","deleteService","delete","deleteServiceNextDescendent"],"sources":["api/ServiceApi.ts"],"sourcesContent":["import util from 'util';\nimport storage from '../storage/SessionStorage';\nimport { AmServiceSkeleton, PagedResult } from './ApiTypes';\nimport { generateAmApi } from './BaseApi';\nimport { getCurrentRealmPath } from './utils/ApiUtils';\n\nconst serviceURLTemplate = '%s/json%s/realm-config/services/%s';\nconst serviceURLNextDescendentsTemplate =\n '%s/json%s/realm-config/services/%s?_action=nextdescendents';\nconst serviceURLNextDescendentTemplate =\n '%s/json%s/realm-config/services/%s/%s/%s';\nconst serviceListURLTemplate =\n '%s/json%s/realm-config/services?_queryFilter=true';\nconst apiVersion = 'protocol=2.0,resource=1.0';\n\nfunction getApiConfig() {\n const configPath = getCurrentRealmPath();\n return {\n path: `${configPath}/realm-config/services`,\n apiVersion,\n };\n}\n\nexport interface ServiceListItem {\n /**\n * The identifier for the service - used to construct the subpath for the service\n */\n _id: string;\n /**\n * The user-facing name of the service\n */\n name: string;\n /**\n * The revision number of the service\n */\n _rev: string;\n}\n\n// export interface AmService {\n// _id: '';\n// _rev: string;\n// _type: {\n// _id: string;\n// name: string;\n// collection: boolean;\n// };\n// [key: string]: any;\n// }\n\nexport interface ServiceNextDescendentResponse {\n result: ServiceNextDescendent;\n}\n\nexport interface ServiceNextDescendent {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key: string]: any;\n}\n\n/**\n * Get a list of services\n * @returns {Promise<ServiceListItem[]>} a promise resolving to an array of service list items.\n */\nexport async function getListOfServices(): Promise<\n PagedResult<ServiceListItem>\n> {\n const urlString = util.format(\n serviceListURLTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath()\n );\n const { data } = await generateAmApi(getApiConfig()).get<\n PagedResult<ServiceListItem>\n >(urlString, {\n withCredentials: true,\n });\n return data;\n}\n\n/**\n * Get service\n * @param {string} serviceId servide id\n * @returns {Promise<AmService>} a promise resolving to a service object\n */\nexport async function getService(\n serviceId: string\n): Promise<AmServiceSkeleton> {\n const urlString = util.format(\n serviceURLTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath(),\n serviceId\n );\n const { data } = await generateAmApi(getApiConfig()).get<AmServiceSkeleton>(\n urlString,\n {\n withCredentials: true,\n }\n );\n return data;\n}\n\n/**\n * Get a service's decendents (applicable for structured services only, e.g. SocialIdentityProviders)\n * @param {string} serviceId service id\n * @returns {Promise<ServiceNextDescendent[]>} a promise resolving to an array of the service's next decendents\n */\nexport async function getServiceDescendents(\n serviceId: string\n): Promise<ServiceNextDescendent[]> {\n const urlString = util.format(\n serviceURLNextDescendentsTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath(),\n serviceId\n );\n const { data } = await generateAmApi(\n getApiConfig()\n ).post<ServiceNextDescendentResponse>(urlString, {\n withCredentials: true,\n });\n return data.result as ServiceNextDescendent[];\n}\n\n/**\n * Create or update a service\n * @param {string} serviceId service id\n * @param {AmService} serviceData service configuration\n * @returns {Promise<AmService>} a promise resolving to a service object\n */\nexport async function putService(\n serviceId: string,\n serviceData: AmServiceSkeleton\n): Promise<AmServiceSkeleton> {\n const urlString = util.format(\n serviceURLTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath(),\n serviceId\n );\n const { data } = await generateAmApi(getApiConfig()).put(\n urlString,\n serviceData,\n {\n withCredentials: true,\n }\n );\n return data;\n}\n\n/**\n * Create or update a service next descendent instance\n * @param {string} serviceId service id\n * @param {string} serviceType service type\n * @param {string} serviceNextDescendentId service instance id\n * @param {ServiceNextDescendent} serviceNextDescendentData service next descendent configuration\n * @returns {Promise<ServiceNextDescendent>} a promise resolving to a service next descendent\n */\nexport async function putServiceNextDescendent(\n serviceId: string,\n serviceType: string,\n serviceNextDescendentId: string,\n serviceNextDescendentData: ServiceNextDescendent\n): Promise<ServiceNextDescendent> {\n const urlString = util.format(\n serviceURLNextDescendentTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath(),\n serviceId,\n serviceType,\n serviceNextDescendentId\n );\n const { data } = await generateAmApi(getApiConfig()).put(\n urlString,\n serviceNextDescendentData,\n {\n withCredentials: true,\n }\n );\n return data;\n}\n\n/**\n * Delete service\n * @param {string} serviceId service id\n * @returns {Promise<AmService>} a promise resolving to a service object\n */\nexport async function deleteService(\n serviceId: string\n): Promise<AmServiceSkeleton> {\n const urlString = util.format(\n serviceURLTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath(),\n serviceId\n );\n const { data } = await generateAmApi(getApiConfig()).delete(urlString, {\n withCredentials: true,\n });\n return data;\n}\n\n/**\n * Delete service next descendent\n * @param {string} serviceId service id\n * @param {string} serviceType service type\n * @param {string} serviceNextDescendentId service instance id\n * @returns {Promise<ServiceNextDescendent>} a promise resolving to a service next descendent\n */\nexport async function deleteServiceNextDescendent(\n serviceId: string,\n serviceType: string,\n serviceNextDescendentId: string\n): Promise<ServiceNextDescendent> {\n const urlString = util.format(\n serviceURLNextDescendentTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath(),\n serviceId,\n serviceType,\n serviceNextDescendentId\n );\n const { data } = await generateAmApi(getApiConfig()).delete(urlString, {\n withCredentials: true,\n });\n return data;\n}\n"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AAEA;;AACA;;;;;;;;AAEA,IAAMA,kBAAkB,GAAG,oCAA3B;AACA,IAAMC,iCAAiC,GACrC,4DADF;AAEA,IAAMC,gCAAgC,GACpC,0CADF;AAEA,IAAMC,sBAAsB,GAC1B,mDADF;AAEA,IAAMC,UAAU,GAAG,2BAAnB;;AAEA,SAASC,YAAT,GAAwB;EACtB,IAAMC,UAAU,GAAG,IAAAC,6BAAA,GAAnB;EACA,OAAO;IACLC,IAAI,YAAKF,UAAL,2BADC;IAELF;EAFK,CAAP;AAID;;AAqCD;AACA;AACA;AACA;SACsBK,iB;;;AAgBtB;AACA;AACA;AACA;AACA;;;;yCApBO,aAEL;IACA,IAAMC,SAAS,GAAGC,aAAA,CAAKC,MAAL,CAChBT,sBADgB,EAEhBU,uBAAA,CAAQC,OAAR,CAAgBC,SAAhB,EAFgB,EAGhB,IAAAR,6B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,EAGLC,uBAHK,EAI2B;IAChC,IAAMpB,SAAS,GAAGC,aAAA,CAAKC,MAAL,CAChBV,gCADgB,EAEhBW,uBAAA,CAAQC,OAAR,CAAgBC,SAAhB,EAFgB,EAGhB,IAAAR,6BAAA,GAHgB,EAIhBc,SAJgB,EAKhBQ,WALgB,EAMhBC,uBANgB,CAAlB;;IAQA,IAAM;MAAEd;IAAF,UAAiB,IAAAC,sBAAA,EAAcZ,YAAY,EAA1B,EAA8B4B,MAA9B,CAAqCvB,SAArC,EAAgD;MACrES,eAAe,EAAE;IADoD,CAAhD,CAAvB;IAGA,OAAOH,IAAP;EACD,C"}
|
package/cjs/api/utils/Base64.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Base64.js","names":["base64regex","isBase64Encoded","input","test","encode","padding","Buffer","from","toString","replace","decode","length","repeat","enc","isEncoding","encoding","fromBase64","base64","decodeBase64Url","encodeBase64Url"],"sources":["api/utils/Base64.ts"],"sourcesContent":["/**\n * Regex to determine if a string is Base64-encoded\n */\nconst base64regex =\n /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;\n\n/**\n * Is input Base64-encoded\n * @param {String} input\n * @returns {boolean} true if input is Base64-encoded, false otherwise\n */\nexport function isBase64Encoded(input) {\n return base64regex.test(input);\n}\n\n/**\n * Base64-encode a string\n * @param {String} input String to base64-encode\n * @returns {String} Base64-encoded input string\n */\nexport function encode(input, padding = true) {\n if (padding) {\n return Buffer.from(input).toString('base64');\n }\n return Buffer.from(input).toString('base64').replace(/=/g, '');\n}\n\n/**\n * Base64-decode a string\n * @param {String} input\n * @returns {String} Base64-decoded input string\n */\nexport function decode(input) {\n // eslint-disable-next-line no-param-reassign\n if (input.length % 4 !== 0) input += '='.repeat(4 - (input.length % 4));\n return Buffer.from(input, 'base64').toString();\n}\n\nlet enc;\nif (Buffer.isEncoding('base64url')) {\n enc = (input, encoding: BufferEncoding = 'utf8') =>\n Buffer.from(input, encoding).toString('base64url');\n} else {\n const fromBase64 = (base64) =>\n base64.replace(/=/g, '').replace(/\\+/g, '-').replace(/\\//g, '_');\n enc = (input, encoding: BufferEncoding = 'utf8') =>\n fromBase64(Buffer.from(input, encoding).toString('base64'));\n}\n\n/**\n * Decode Base64URL\n * @param {*} input the string to decode\n * @returns {String} the decoded string.\n */\nexport const decodeBase64Url = (input) => `${Buffer.from(input, 'base64')}`;\n\n/**\n * Encode Base65URL\n * @param {*} input the string to encode\n * @returns {String} the encoded string.\n */\nexport const encodeBase64Url = enc;\n"],"mappings":";;;;;;;;;;;AAAA;AACA;AACA;AACA,IAAMA,WAAW,GACf,kEADF;AAGA;AACA;AACA;AACA;AACA;;AACO,SAASC,eAAT,CAAyBC,KAAzB,EAAgC;EACrC,OAAOF,WAAW,CAACG,IAAZ,CAAiBD,KAAjB,CAAP;AACD;AAED;AACA;AACA;AACA;AACA;;;AACO,SAASE,MAAT,CAAgBF,KAAhB,EAAuC;EAAA,IAAhBG,OAAgB,uEAAN,IAAM;;EAC5C,IAAIA,OAAJ,EAAa;IACX,OAAOC,MAAM,CAACC,IAAP,CAAYL,KAAZ,EAAmBM,QAAnB,CAA4B,QAA5B,CAAP;EACD;;EACD,OAAOF,MAAM,CAACC,IAAP,CAAYL,KAAZ,EAAmBM,QAAnB,CAA4B,QAA5B,EAAsCC,OAAtC,CAA8C,IAA9C,EAAoD,EAApD,CAAP;AACD;AAED;AACA;AACA;AACA;AACA;;;AACO,SAASC,MAAT,CAAgBR,KAAhB,EAAuB;EAC5B;EACA,IAAIA,KAAK,CAACS,MAAN,GAAe,CAAf,KAAqB,CAAzB,EAA4BT,KAAK,IAAI,IAAIU,MAAJ,CAAW,IAAKV,KAAK,CAACS,MAAN,GAAe,CAA/B,CAAT;EAC5B,OAAOL,MAAM,CAACC,IAAP,CAAYL,KAAZ,EAAmB,QAAnB,EAA6BM,QAA7B,EAAP;AACD;;AAED,IAAIK,GAAJ;;AACA,IAAIP,MAAM,CAACQ,UAAP,CAAkB,WAAlB,CAAJ,EAAoC;EAClCD,GAAG,GAAG,aAACX,KAAD;IAAA,IAAQa,QAAR,uEAAmC,MAAnC;IAAA,OACJT,MAAM,CAACC,IAAP,CAAYL,KAAZ,EAAmBa,QAAnB,EAA6BP,QAA7B,CAAsC,WAAtC,CADI;EAAA,CAAN;AAED,CAHD,MAGO;EACL,IAAMQ,UAAU,GAAIC,MAAD,IACjBA,MAAM,CAACR,OAAP,CAAe,IAAf,EAAqB,EAArB,EAAyBA,OAAzB,CAAiC,KAAjC,EAAwC,GAAxC,EAA6CA,OAA7C,CAAqD,KAArD,EAA4D,GAA5D,CADF;;EAEAI,GAAG,GAAG,aAACX,KAAD;IAAA,IAAQa,QAAR,uEAAmC,MAAnC;IAAA,OACJC,UAAU,CAACV,MAAM,CAACC,IAAP,CAAYL,KAAZ,EAAmBa,QAAnB,EAA6BP,QAA7B,CAAsC,QAAtC,CAAD,CADN;EAAA,CAAN;AAED;AAED;AACA;AACA;AACA;AACA;;;AACO,IAAMU,eAAe,GAAIhB,KAAD,cAAcI,MAAM,CAACC,IAAP,CAAYL,KAAZ,EAAmB,QAAnB,CAAd,CAAxB;AAEP;AACA;AACA;AACA;AACA;;;;AACO,IAAMiB,eAAe,GAAGN,GAAxB"}
|
|
1
|
+
{"version":3,"file":"Base64.js","names":["base64regex","isBase64Encoded","input","test","encode","padding","Buffer","from","toString","replace","decode","length","repeat","enc","isEncoding","encoding","fromBase64","base64","decodeBase64Url","encodeBase64Url"],"sources":["api/utils/Base64.ts"],"sourcesContent":["/**\n * Regex to determine if a string is Base64-encoded\n */\nconst base64regex =\n /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;\n\n/**\n * Is input Base64-encoded\n * @param {String} input\n * @returns {boolean} true if input is Base64-encoded, false otherwise\n */\nexport function isBase64Encoded(input) {\n return base64regex.test(input);\n}\n\n/**\n * Base64-encode a string\n * @param {String} input String to base64-encode\n * @param {boolean} padding add padding\n * @returns {String} Base64-encoded input string\n */\nexport function encode(input, padding = true) {\n if (padding) {\n return Buffer.from(input).toString('base64');\n }\n return Buffer.from(input).toString('base64').replace(/=/g, '');\n}\n\n/**\n * Base64-decode a string\n * @param {String} input\n * @returns {String} Base64-decoded input string\n */\nexport function decode(input) {\n // eslint-disable-next-line no-param-reassign\n if (input.length % 4 !== 0) input += '='.repeat(4 - (input.length % 4));\n return Buffer.from(input, 'base64').toString();\n}\n\nlet enc;\nif (Buffer.isEncoding('base64url')) {\n enc = (input, encoding: BufferEncoding = 'utf8') =>\n Buffer.from(input, encoding).toString('base64url');\n} else {\n const fromBase64 = (base64) =>\n base64.replace(/=/g, '').replace(/\\+/g, '-').replace(/\\//g, '_');\n enc = (input, encoding: BufferEncoding = 'utf8') =>\n fromBase64(Buffer.from(input, encoding).toString('base64'));\n}\n\n/**\n * Decode Base64URL\n * @param {*} input the string to decode\n * @returns {String} the decoded string.\n */\nexport const decodeBase64Url = (input) => `${Buffer.from(input, 'base64')}`;\n\n/**\n * Encode Base65URL\n * @param {*} input the string to encode\n * @returns {String} the encoded string.\n */\nexport const encodeBase64Url = enc;\n"],"mappings":";;;;;;;;;;;AAAA;AACA;AACA;AACA,IAAMA,WAAW,GACf,kEADF;AAGA;AACA;AACA;AACA;AACA;;AACO,SAASC,eAAT,CAAyBC,KAAzB,EAAgC;EACrC,OAAOF,WAAW,CAACG,IAAZ,CAAiBD,KAAjB,CAAP;AACD;AAED;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASE,MAAT,CAAgBF,KAAhB,EAAuC;EAAA,IAAhBG,OAAgB,uEAAN,IAAM;;EAC5C,IAAIA,OAAJ,EAAa;IACX,OAAOC,MAAM,CAACC,IAAP,CAAYL,KAAZ,EAAmBM,QAAnB,CAA4B,QAA5B,CAAP;EACD;;EACD,OAAOF,MAAM,CAACC,IAAP,CAAYL,KAAZ,EAAmBM,QAAnB,CAA4B,QAA5B,EAA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+328,7 @@ function putWebAgent(_x11, _x12) {
|
|
|
328
328
|
}
|
|
329
329
|
/**
|
|
330
330
|
* Export all agents. The response can be saved to file as is.
|
|
331
|
-
* @returns {Promise<AgentExportInterface} Promise resolving to an AgentExportInterface object.
|
|
331
|
+
* @returns {Promise<AgentExportInterface>} Promise resolving to an AgentExportInterface object.
|
|
332
332
|
*/
|
|
333
333
|
|
|
334
334
|
|
package/cjs/ops/AgentOps.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentOps.js","names":["AGENT_TYPE_IG","AGENT_TYPE_JAVA","AGENT_TYPE_WEB","createAgentExportTemplate","meta","agents","getAgents","debugMessage","resolved","Promise","all","getAgentsByType","concat","result","error","printMessage","message","response","data","sort","a","b","_id","localeCompare","getAgent","agentId","findAgentById","length","_getAgentByTypeAndId","_type","Error","getAgentByTypeAndId","agentType","getIdentityGatewayAgents","getIdentityGatewayAgent","gatewayId","putIdentityGatewayAgent","gatewayData","putAgentByTypeAndId","getJavaAgents","getJavaAgent","putJavaAgent","agentData","getWebAgents","getWebAgent","putWebAgent","exportAgents","exportData","agent","exportIdentityGatewayAgents","exportJavaAgents","exportWebAgents","exportAgent","agentObject","exportIdentityGatewayAgent","exportJavaAgent","exportWebAgent","importAgents","importData","validateImport","Object","keys","importIdentityGatewayAgents","importJavaAgents","importWebAgents","importAgent","importIdentityGatewayAgent","importJavaAgent","importWebAgent","deleteAgents","deleteAgentByTypeAndId","deleteAgent","deleteIdentityGatewayAgents","deleteIdentityGatewayAgent","findAgentByTypeAndId","deleteJavaAgents","deleteJavaAgent","deleteWebAgents","deleteWebAgent"],"sources":["ops/AgentOps.ts"],"sourcesContent":["import { debugMessage, printMessage } from './utils/Console';\nimport {\n getAgentsByType,\n getAgentByTypeAndId as _getAgentByTypeAndId,\n putAgentByTypeAndId,\n findAgentById,\n deleteAgentByTypeAndId,\n findAgentByTypeAndId,\n} from '../api/AgentApi';\nimport { AgentSkeleton } from '../api/ApiTypes';\nimport { AgentExportInterface } from './OpsTypes';\nimport { validateImport } from './utils/ExportImportUtils';\n\nexport const AGENT_TYPE_IG = 'IdentityGatewayAgent';\nexport const AGENT_TYPE_JAVA = 'J2EEAgent';\nexport const AGENT_TYPE_WEB = 'WebAgent';\n\n/**\n * Create an empty agent export template\n * @returns {AgentExportInterface} an empty agent export template\n */\nexport function createAgentExportTemplate(): AgentExportInterface {\n return {\n meta: {},\n agents: {},\n } as AgentExportInterface;\n}\n\n/**\n * Get all agents. Results are sorted aphabetically.\n * @returns {Promise<TreeSkeleton[]>} a promise that resolves to an array of agent objects\n */\nexport async function getAgents(): Promise<AgentSkeleton[]> {\n debugMessage(`AgentOps.getAgents: start`);\n let agents = [];\n try {\n const resolved = await Promise.all([\n getAgentsByType('IdentityGatewayAgent'),\n getAgentsByType('J2EEAgent'),\n getAgentsByType('WebAgent'),\n ]);\n agents = agents.concat(resolved[0].result);\n agents = agents.concat(resolved[1].result);\n agents = agents.concat(resolved[2].result);\n } catch (error) {\n printMessage(`${error.message}`, 'error');\n printMessage(error.response.data, 'error');\n }\n agents.sort((a, b) => a._id.localeCompare(b._id));\n debugMessage(`AgentOps.getAgents: end`);\n return agents;\n}\n\n/**\n * Get agent\n * @param {string} agentId agent id/name\n * @returns {Promise} a promise that resolves to an agent object\n */\nexport async function getAgent(agentId) {\n debugMessage(`AgentOps.getAgent: start`);\n const agents = await findAgentById(agentId);\n if (agents.length === 1) {\n const result = await _getAgentByTypeAndId(agents[0]._type, agents[0]._id);\n debugMessage(`AgentOps.getAgent: end`);\n return result;\n } else if (agents.length === 0) {\n throw new Error(`Agent '${agentId}' not found`);\n } else {\n throw new Error(`${agents.length} agents '${agentId}' found`);\n }\n}\n\n/**\n * Get agent by type and id\n * @param {string} agentType agent type (IdentityGatewayAgent, J2EEAgent, WebAgent)\n * @param {string} agentId agent id/name\n * @returns {Promise} a promise that resolves to an agent object\n */\nexport async function getAgentByTypeAndId(agentType, agentId) {\n debugMessage(`AgentOps.getAgentByTypeAndId: start`);\n const result = await _getAgentByTypeAndId(agentType, agentId);\n debugMessage(`AgentOps.getAgentByTypeAndId: start`);\n return result;\n}\n\n/**\n * Get identity gateway agents\n * @returns {Promise} a promise that resolves to an array of IdentityGatewayAgent objects\n */\nexport async function getIdentityGatewayAgents() {\n debugMessage(`AgentOps.getIdentityGatewayAgents: start`);\n const { result } = await getAgentsByType(AGENT_TYPE_IG);\n debugMessage(`AgentOps.getIdentityGatewayAgents: end`);\n return result;\n}\n\n/**\n * Get identity gateway agent\n * @param {string} gatewayId gateway id\n * @returns {Promise} a promise that resolves to an object containing an IdentityGatewayAgent object\n */\nexport async function getIdentityGatewayAgent(gatewayId: string) {\n debugMessage(`AgentOps.getIdentityGatewayAgent: start`);\n const result = await getAgentByTypeAndId(AGENT_TYPE_IG, gatewayId);\n debugMessage(`AgentOps.getIdentityGatewayAgent: end`);\n return result;\n}\n\n/**\n * Put identity gateway agent\n * @param {string} gatewayId gateway id\n * @param {Object} gatewayData IdentityGatewayAgent object\n * @returns {Promise} a promise that resolves to an object containing an IdentityGatewayAgent object\n */\nexport async function putIdentityGatewayAgent(gatewayId: string, gatewayData) {\n debugMessage(`AgentOps.putIdentityGatewayAgent: start`);\n const result = await putAgentByTypeAndId(\n AGENT_TYPE_IG,\n gatewayId,\n gatewayData\n );\n debugMessage(`AgentOps.putIdentityGatewayAgent: end`);\n return result;\n}\n\n/**\n * Get java agents\n * @returns {Promise} a promise that resolves to an array of J2EEAgent objects\n */\nexport async function getJavaAgents() {\n debugMessage(`AgentOps.getJavaAgents: start`);\n const { result } = await getAgentsByType(AGENT_TYPE_JAVA);\n debugMessage(`AgentOps.getJavaAgents: end`);\n return result;\n}\n\n/**\n * Get java agent\n * @param {string} agentId java agent id\n * @returns {Promise} a promise that resolves to an object containing an J2EEAgent object\n */\nexport async function getJavaAgent(agentId: string) {\n debugMessage(`AgentOps.getJavaAgent: start`);\n const result = await getAgentByTypeAndId(AGENT_TYPE_JAVA, agentId);\n debugMessage(`AgentOps.getJavaAgent: end`);\n return result;\n}\n\n/**\n * Put java agent\n * @param {string} agentId java agent id\n * @param {Object} agentData java agent object\n * @returns {Promise} a promise that resolves to an object containing an java agent object\n */\nexport async function putJavaAgent(agentId: string, agentData) {\n debugMessage(`AgentOps.putJavaAgent: start`);\n const result = await putAgentByTypeAndId(AGENT_TYPE_JAVA, agentId, agentData);\n debugMessage(`AgentOps.putJavaAgent: end`);\n return result;\n}\n\n/**\n * Get web agents\n * @returns {Promise} a promise that resolves to an array of WebAgent objects\n */\nexport async function getWebAgents() {\n debugMessage(`AgentOps.getWebAgents: start`);\n const { result } = await getAgentsByType(AGENT_TYPE_WEB);\n debugMessage(`AgentOps.getWebAgents: end`);\n return result;\n}\n\n/**\n * Get web agent\n * @param {string} agentId web agent id\n * @returns {Promise} a promise that resolves to an object containing an WebAgent object\n */\nexport async function getWebAgent(agentId: string) {\n debugMessage(`AgentOps.getWebAgent: start`);\n const result = await getAgentByTypeAndId(AGENT_TYPE_WEB, agentId);\n debugMessage(`AgentOps.getWebAgent: end`);\n return result;\n}\n\n/**\n * Put web agent\n * @param {string} agentId web agent id\n * @param {Object} agentData WebAgent object\n * @returns {Promise} a promise that resolves to an object containing an WebAgent object\n */\nexport async function putWebAgent(agentId: string, agentData) {\n debugMessage(`AgentOps.putWebAgent: start`);\n const result = await putAgentByTypeAndId(AGENT_TYPE_WEB, agentId, agentData);\n debugMessage(`AgentOps.putWebAgent: end`);\n return result;\n}\n\n/**\n * Export all agents. The response can be saved to file as is.\n * @returns {Promise<AgentExportInterface} Promise resolving to an AgentExportInterface object.\n */\nexport async function exportAgents(): Promise<AgentExportInterface> {\n debugMessage(`AgentOps.exportAgents: start`);\n const exportData = createAgentExportTemplate();\n const agents = await getAgents();\n for (const agent of agents) {\n exportData.agents[agent._id] = agent;\n }\n debugMessage(`AgentOps.exportAgents: end`);\n return exportData;\n}\n\n/**\n * Export all identity gateway agents. The response can be saved to file as is.\n * @returns {Promise<AgentExportInterface} Promise resolving to an AgentExportInterface object.\n */\nexport async function exportIdentityGatewayAgents(): Promise<AgentExportInterface> {\n debugMessage(`AgentOps.exportIdentityGatewayAgents: start`);\n const exportData = createAgentExportTemplate();\n const agents = await getIdentityGatewayAgents();\n for (const agent of agents) {\n exportData.agents[agent._id] = agent;\n }\n debugMessage(`AgentOps.exportIdentityGatewayAgents: end`);\n return exportData;\n}\n\n/**\n * Export all java agents. The response can be saved to file as is.\n * @returns {Promise<AgentExportInterface} Promise resolving to an AgentExportInterface object.\n */\nexport async function exportJavaAgents(): Promise<AgentExportInterface> {\n debugMessage(`AgentOps.exportJavaAgents: start`);\n const exportData = createAgentExportTemplate();\n const agents = await getJavaAgents();\n for (const agent of agents) {\n exportData.agents[agent._id] = agent;\n }\n debugMessage(`AgentOps.exportJavaAgents: end`);\n return exportData;\n}\n\n/**\n * Export all web agents. The response can be saved to file as is.\n * @returns {Promise<AgentExportInterface} Promise resolving to an AgentExportInterface object.\n */\nexport async function exportWebAgents(): Promise<AgentExportInterface> {\n debugMessage(`AgentOps.exportWebAgents: start`);\n const exportData = createAgentExportTemplate();\n const agents = await getWebAgents();\n for (const agent of agents) {\n exportData.agents[agent._id] = agent;\n }\n debugMessage(`AgentOps.exportWebAgents: end`);\n return exportData;\n}\n\n/**\n * Export agent. The response can be saved to file as is.\n * @param agentId agent id/name\n * @returns {Promise<AgentExportInterface} Promise resolving to an AgentExportInterface object.\n */\nexport async function exportAgent(agentId): Promise<AgentExportInterface> {\n debugMessage(`AgentOps.exportAgent: start`);\n const exportData = createAgentExportTemplate();\n const agentObject = await getAgent(agentId);\n exportData.agents[agentId] = agentObject;\n debugMessage(`AgentOps.exportAgent: end`);\n return exportData;\n}\n\n/**\n * Export identity gateway agent. The response can be saved to file as is.\n * @param agentId agent id/name\n * @returns {Promise<AgentExportInterface} Promise resolving to an AgentExportInterface object.\n */\nexport async function exportIdentityGatewayAgent(\n agentId\n): Promise<AgentExportInterface> {\n debugMessage(`AgentOps.exportIdentityGatewayAgent: start`);\n const exportData = createAgentExportTemplate();\n const agentObject = await getIdentityGatewayAgent(agentId);\n exportData.agents[agentId] = agentObject;\n debugMessage(`AgentOps.exportIdentityGatewayAgent: end`);\n return exportData;\n}\n\n/**\n * Export java agent. The response can be saved to file as is.\n * @param agentId agent id/name\n * @returns {Promise<AgentExportInterface} Promise resolving to an AgentExportInterface object.\n */\nexport async function exportJavaAgent(agentId): Promise<AgentExportInterface> {\n debugMessage(`AgentOps.exportJavaAgent: start`);\n const exportData = createAgentExportTemplate();\n const agentObject = await getJavaAgent(agentId);\n exportData.agents[agentId] = agentObject;\n debugMessage(`AgentOps.exportJavaAgent: end`);\n return exportData;\n}\n\n/**\n * Export web agent. The response can be saved to file as is.\n * @param agentId agent id/name\n * @returns {Promise<AgentExportInterface} Promise resolving to an AgentExportInterface object.\n */\nexport async function exportWebAgent(agentId): Promise<AgentExportInterface> {\n debugMessage(`AgentOps.exportWebAgent: start`);\n const exportData = createAgentExportTemplate();\n const agentObject = await getWebAgent(agentId);\n exportData.agents[agentId] = agentObject;\n debugMessage(`AgentOps.exportWebAgent: end`);\n return exportData;\n}\n\n/**\n * Import agents. The import data is usually read from an agent export file.\n * @param {AgentExportInterface} importData agent import data.\n */\nexport async function importAgents(\n importData: AgentExportInterface\n): Promise<void> {\n debugMessage(`AgentOps.importAgents: start`);\n if (validateImport(importData.meta)) {\n for (const agentId of Object.keys(importData.agents)) {\n const agentType = importData.agents[agentId]._type._id;\n debugMessage(`AgentOps.importAgents: ${agentId} [${agentType}]`);\n await putAgentByTypeAndId(agentType, agentId, importData.agents[agentId]);\n }\n } else {\n throw new Error('Invalid meta data.');\n }\n debugMessage(`AgentOps.importAgents: end`);\n}\n\n/**\n * Import identity gateway agents. The import data is usually read from an agent export file.\n * @param {AgentExportInterface} importData agent import data.\n */\nexport async function importIdentityGatewayAgents(\n importData: AgentExportInterface\n): Promise<void> {\n debugMessage(`AgentOps.importIdentityGatewayAgents: start`);\n if (validateImport(importData.meta)) {\n for (const agentId of Object.keys(importData.agents)) {\n const agentType = importData.agents[agentId]._type._id;\n if (agentType !== AGENT_TYPE_IG)\n throw new Error(\n `Wrong agent type! Expected '${AGENT_TYPE_IG}' but got '${agentType}'.`\n );\n await putAgentByTypeAndId(agentType, agentId, importData.agents[agentId]);\n }\n } else {\n throw new Error('Invalid meta data.');\n }\n debugMessage(`AgentOps.importIdentityGatewayAgents: end`);\n}\n\n/**\n * Import java agents. The import data is usually read from an agent export file.\n * @param {AgentExportInterface} importData agent import data.\n */\nexport async function importJavaAgents(\n importData: AgentExportInterface\n): Promise<void> {\n debugMessage(`AgentOps.importJavaAgents: start`);\n if (validateImport(importData.meta)) {\n for (const agentId of Object.keys(importData.agents)) {\n const agentType = importData.agents[agentId]._type._id;\n if (agentType !== AGENT_TYPE_JAVA)\n throw new Error(\n `Wrong agent type! Expected '${AGENT_TYPE_JAVA}' but got '${agentType}'.`\n );\n await putAgentByTypeAndId(agentType, agentId, importData.agents[agentId]);\n }\n } else {\n throw new Error('Invalid meta data.');\n }\n debugMessage(`AgentOps.importJavaAgents: end`);\n}\n\n/**\n * Import web agents. The import data is usually read from an agent export file.\n * @param {AgentExportInterface} importData agent import data.\n */\nexport async function importWebAgents(\n importData: AgentExportInterface\n): Promise<void> {\n debugMessage(`AgentOps.importWebAgents: start`);\n if (validateImport(importData.meta)) {\n for (const agentId of Object.keys(importData.agents)) {\n const agentType = importData.agents[agentId]._type._id;\n if (agentType !== AGENT_TYPE_WEB)\n throw new Error(\n `Wrong agent type! Expected '${AGENT_TYPE_WEB}' but got '${agentType}'.`\n );\n await putAgentByTypeAndId(agentType, agentId, importData.agents[agentId]);\n }\n } else {\n throw new Error('Invalid meta data.');\n }\n debugMessage(`AgentOps.importWebAgents: end`);\n}\n\n/**\n * Import agent. The import data is usually read from an agent export file.\n * @param {string} agentId agent id/name\n * @param {AgentExportInterface} importData agent import data.\n * @returns {Promise} Promise resolving to an agent object.\n */\nexport async function importAgent(agentId, importData: AgentExportInterface) {\n debugMessage(`AgentOps.importAgent: start`);\n if (validateImport(importData.meta)) {\n const agentType = importData.agents[agentId]?._type._id;\n const result = await putAgentByTypeAndId(\n agentType,\n agentId,\n importData.agents[agentId]\n );\n debugMessage(`AgentOps.importAgent: end`);\n return result;\n } else {\n throw new Error('Invalid meta data.');\n }\n}\n\n/**\n * Import identity gateway agent. The import data is usually read from an agent export file.\n * @param {string} agentId agent id/name\n * @param {AgentExportInterface} importData agent import data.\n * @returns {Promise} Promise resolving to an agent object.\n */\nexport async function importIdentityGatewayAgent(\n agentId,\n importData: AgentExportInterface\n) {\n debugMessage(`AgentOps.importIdentityGatewayAgent: start`);\n if (validateImport(importData.meta)) {\n const agentType = importData.agents[agentId]?._type._id;\n if (agentType !== AGENT_TYPE_IG)\n throw new Error(\n `Wrong agent type! Expected '${AGENT_TYPE_IG}' but got '${agentType}'.`\n );\n const result = await putAgentByTypeAndId(\n agentType,\n agentId,\n importData.agents[agentId]\n );\n debugMessage(`AgentOps.importIdentityGatewayAgent: end`);\n return result;\n } else {\n throw new Error('Invalid meta data.');\n }\n}\n\n/**\n * Import java agent. The import data is usually read from an agent export file.\n * @param {string} agentId agent id/name\n * @param {AgentExportInterface} importData agent import data.\n * @returns {Promise} Promise resolving to an agent object.\n */\nexport async function importJavaAgent(\n agentId,\n importData: AgentExportInterface\n) {\n debugMessage(`AgentOps.importJavaAgent: start`);\n if (validateImport(importData.meta)) {\n const agentType = importData.agents[agentId]?._type._id;\n if (agentType !== AGENT_TYPE_JAVA)\n throw new Error(\n `Wrong agent type! Expected '${AGENT_TYPE_JAVA}' but got '${agentType}'.`\n );\n const result = await putAgentByTypeAndId(\n agentType,\n agentId,\n importData.agents[agentId]\n );\n debugMessage(`AgentOps.importJavaAgent: end`);\n return result;\n } else {\n throw new Error('Invalid meta data.');\n }\n}\n\n/**\n * Import java agent. The import data is usually read from an agent export file.\n * @param {string} agentId agent id/name\n * @param {AgentExportInterface} importData agent import data.\n * @returns {Promise} Promise resolving to an agent object.\n */\nexport async function importWebAgent(\n agentId,\n importData: AgentExportInterface\n) {\n debugMessage(`AgentOps.importWebAgent: start`);\n if (validateImport(importData.meta)) {\n const agentType = importData.agents[agentId]?._type._id;\n if (agentType !== AGENT_TYPE_WEB)\n throw new Error(\n `Wrong agent type! Expected '${AGENT_TYPE_WEB}' but got '${agentType}'.`\n );\n const result = await putAgentByTypeAndId(\n agentType,\n agentId,\n importData.agents[agentId]\n );\n debugMessage(`AgentOps.importWebAgent: end`);\n return result;\n } else {\n throw new Error('Invalid meta data.');\n }\n}\n\n/**\n * Delete all agents\n */\nexport async function deleteAgents() {\n debugMessage(`AgentOps.deleteAgents: start`);\n const agents = await getAgents();\n for (const agent of agents) {\n debugMessage(`AgentOps.deleteAgent: '${agent['_id']}'`);\n await deleteAgentByTypeAndId(agent['_type']['_id'], agent['_id']);\n }\n debugMessage(`AgentOps.deleteAgents: end`);\n}\n\n/**\n * Delete agent\n * @param agentId agent id/name\n */\nexport async function deleteAgent(agentId: string) {\n debugMessage(`AgentOps.deleteAgent: start`);\n const agents = await findAgentById(agentId);\n if (agents.length) {\n for (const agent of agents) {\n debugMessage(`AgentOps.deleteAgent: '${agent['_id']}'`);\n await deleteAgentByTypeAndId(agent['_type'], agent['_id']);\n }\n } else {\n throw new Error(`Agent '${agentId}' not found!`);\n }\n debugMessage(`AgentOps.deleteAgent: end`);\n}\n\n/**\n * Delete all identity gateway agents\n */\nexport async function deleteIdentityGatewayAgents() {\n debugMessage(`AgentOps.deleteIdentityGatewayAgents: start`);\n const agents = await getIdentityGatewayAgents();\n for (const agent of agents) {\n debugMessage(`AgentOps.deleteIdentityGatewayAgent: '${agent['_id']}'`);\n await deleteAgentByTypeAndId(agent['_type']['_id'], agent['_id']);\n }\n debugMessage(`AgentOps.deleteIdentityGatewayAgents: end`);\n}\n\n/**\n * Delete identity gateway agent\n * @param agentId agent id/name\n */\nexport async function deleteIdentityGatewayAgent(agentId: string) {\n debugMessage(`AgentOps.deleteIdentityGatewayAgent: start`);\n const agents = await findAgentByTypeAndId(AGENT_TYPE_IG, agentId);\n if (agents.length) {\n for (const agent of agents) {\n debugMessage(`AgentOps.deleteIdentityGatewayAgent: '${agent['_id']}'`);\n await deleteAgentByTypeAndId(agent['_type']['_id'], agent['_id']);\n }\n } else {\n throw new Error(`Identity gateway agent '${agentId}' not found!`);\n }\n debugMessage(`AgentOps.deleteIdentityGatewayAgent: end`);\n}\n\n/**\n * Delete all java agents\n */\nexport async function deleteJavaAgents() {\n debugMessage(`AgentOps.deleteJavaAgents: start`);\n const agents = await getJavaAgents();\n for (const agent of agents) {\n debugMessage(`AgentOps.deleteJavaAgent: '${agent['_id']}'`);\n await deleteAgentByTypeAndId(agent['_type']['_id'], agent['_id']);\n }\n debugMessage(`AgentOps.deleteJavaAgents: end`);\n}\n\n/**\n * Delete java agent\n * @param agentId agent id/name\n */\nexport async function deleteJavaAgent(agentId: string) {\n debugMessage(`AgentOps.deleteJavaAgent: start`);\n const agents = await findAgentByTypeAndId(AGENT_TYPE_JAVA, agentId);\n if (agents.length) {\n for (const agent of agents) {\n debugMessage(`AgentOps.deleteJavaAgent: '${agent['_id']}'`);\n await deleteAgentByTypeAndId(agent['_type']['_id'], agent['_id']);\n }\n } else {\n throw new Error(`Java agent '${agentId}' not found!`);\n }\n debugMessage(`AgentOps.deleteJavaAgent: end`);\n}\n\n/**\n * Delete all web agents\n */\nexport async function deleteWebAgents() {\n debugMessage(`AgentOps.deleteWebAgents: start`);\n const agents = await getWebAgents();\n for (const agent of agents) {\n debugMessage(`AgentOps.deleteWebAgent: '${agent['_id']}'`);\n await deleteAgentByTypeAndId(agent['_type']['_id'], agent['_id']);\n }\n debugMessage(`AgentOps.deleteWebAgents: end`);\n}\n\n/**\n * Delete web agent\n * @param agentId agent id/name\n */\nexport async function deleteWebAgent(agentId: string) {\n debugMessage(`AgentOps.deleteWebAgent: start`);\n const agents = await findAgentByTypeAndId(AGENT_TYPE_WEB, agentId);\n if (agents.length) {\n for (const agent of agents) {\n debugMessage(`AgentOps.deleteWebAgent: '${agent['_id']}'`);\n await deleteAgentByTypeAndId(agent['_type']['_id'], agent['_id']);\n }\n } else {\n throw new Error(`Web agent '${agentId}' not found!`);\n }\n debugMessage(`AgentOps.deleteWebAgent: end`);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AAUA;;;;;;AAEO,IAAMA,aAAa,GAAG,sBAAtB;;AACA,IAAMC,eAAe,GAAG,WAAxB;;AACA,IAAMC,cAAc,GAAG,UAAvB;AAEP;AACA;AACA;AACA;;;;AACO,SAASC,yBAAT,GAA2D;EAChE,OAAO;IACLC,IAAI,EAAE,EADD;IAELC,MAAM,EAAE;EAFH,CAAP;AAID;AAED;AACA;AACA;AACA;;;SACsBC,S;;;AAqBtB;AACA;AACA;AACA;AACA;;;;iCAzBO,aAAqD;IAC1D,IAAAC,qBAAA;IACA,IAAIF,MAAM,GAAG,EAAb;;IACA,IAAI;MACF,IAAMG,QAAQ,SAASC,OAAO,CAACC,GAAR,CAAY,CACjC,IAAAC,yBAAA,EAAgB,sBAAhB,CADiC,EAEjC,IAAAA,yBAAA,EAAgB,WAAhB,CAFiC,EAGjC,IAAAA,yBAAA,EAAgB,UAAhB,CAHiC,CAAZ,CAAvB;MAKAN,MAAM,GAAGA,MAAM,CAACO,MAAP,CAAcJ,QAAQ,CAAC,CAAD,CAAR,CAAYK,MAA1B,CAAT;MACAR,MAAM,GAAGA,MAAM,CAACO,MAAP,CAAcJ,QAAQ,CAAC,CAAD,CAAR,CAAYK,MAA1B,CAAT;MACAR,MAAM,GAAGA,MAAM,CAACO,MAAP,CAAcJ,QAAQ,CAAC,CAAD,CAAR,CAAYK,MAA1B,CAAT;IACD,CATD,CASE,OAAOC,KAAP,EAAc;MACd,IAAAC,qBAAA,YAAgBD,KAAK,CAACE,OAAtB,GAAiC,OAAjC;MACA,IAAAD,qBAAA,EAAaD,KAAK,CAACG,QAAN,CAAeC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AAA;IACA,IAAMF,MAAM,SAASsC,YAAY,EAAjC;;IACA,KAAK,IAAMK,KAAX,IAAoB3C,MAApB,EAA4B;MAC1B,IAAAE,qBAAA,sCAA0CyC,KAAK,CAAC,KAAD,CAA/C;MACA,MAAM,IAAAsB,gCAAA,EAAuBtB,KAAK,CAAC,OAAD,CAAL,CAAe,KAAf,CAAvB,EAA8CA,KAAK,CAAC,KAAD,CAAnD,CAAN;IACD;;IACD,IAAAzC,qBAAA;EACD,C;;;;SAMqBuE,c;;;;;sCAAf,WAA8BrD,OAA9B,EAA+C;IACpD,IAAAlB,qBAAA;IACA,IAAMF,MAAM,SAAS,IAAAqE,8BAAA,EAAqBxE,cAArB,EAAqCuB,OAArC,CAArB;;IACA,IAAIpB,MAAM,CAACsB,MAAX,EAAmB;MACjB,KAAK,IAAMqB,KAAX,IAAoB3C,MAApB,EAA4B;QAC1B,IAAAE,qBAAA,sCAA0CyC,KAAK,CAAC,KAAD,CAA/C;QACA,MAAM,IAAAsB,gCAAA,EAAuBtB,KAAK,CAAC,OAAD,CAAL,CAAe,KAAf,CAAvB,EAA8CA,KAAK,CAAC,KAAD,CAAnD,CAAN;MACD;IACF,CALD,MAKO;MACL,MAAM,IAAIlB,KAAJ,sBAAwBL,OAAxB,kBAAN;IACD;;IACD,IAAAlB,qBAAA;EACD,C"}
|
|
1
|
+
{"version":3,"file":"AgentOps.js","names":["AGENT_TYPE_IG","AGENT_TYPE_JAVA","AGENT_TYPE_WEB","createAgentExportTemplate","meta","agents","getAgents","debugMessage","resolved","Promise","all","getAgentsByType","concat","result","error","printMessage","message","response","data","sort","a","b","_id","localeCompare","getAgent","agentId","findAgentById","length","_getAgentByTypeAndId","_type","Error","getAgentByTypeAndId","agentType","getIdentityGatewayAgents","getIdentityGatewayAgent","gatewayId","putIdentityGatewayAgent","gatewayData","putAgentByTypeAndId","getJavaAgents","getJavaAgent","putJavaAgent","agentData","getWebAgents","getWebAgent","putWebAgent","exportAgents","exportData","agent","exportIdentityGatewayAgents","exportJavaAgents","exportWebAgents","exportAgent","agentObject","exportIdentityGatewayAgent","exportJavaAgent","exportWebAgent","importAgents","importData","validateImport","Object","keys","importIdentityGatewayAgents","importJavaAgents","importWebAgents","importAgent","importIdentityGatewayAgent","importJavaAgent","importWebAgent","deleteAgents","deleteAgentByTypeAndId","deleteAgent","deleteIdentityGatewayAgents","deleteIdentityGatewayAgent","findAgentByTypeAndId","deleteJavaAgents","deleteJavaAgent","deleteWebAgents","deleteWebAgent"],"sources":["ops/AgentOps.ts"],"sourcesContent":["import { debugMessage, printMessage } from './utils/Console';\nimport {\n getAgentsByType,\n getAgentByTypeAndId as _getAgentByTypeAndId,\n putAgentByTypeAndId,\n findAgentById,\n deleteAgentByTypeAndId,\n findAgentByTypeAndId,\n} from '../api/AgentApi';\nimport { AgentSkeleton } from '../api/ApiTypes';\nimport { AgentExportInterface } from './OpsTypes';\nimport { validateImport } from './utils/ExportImportUtils';\n\nexport const AGENT_TYPE_IG = 'IdentityGatewayAgent';\nexport const AGENT_TYPE_JAVA = 'J2EEAgent';\nexport const AGENT_TYPE_WEB = 'WebAgent';\n\n/**\n * Create an empty agent export template\n * @returns {AgentExportInterface} an empty agent export template\n */\nexport function createAgentExportTemplate(): AgentExportInterface {\n return {\n meta: {},\n agents: {},\n } as AgentExportInterface;\n}\n\n/**\n * Get all agents. Results are sorted aphabetically.\n * @returns {Promise<TreeSkeleton[]>} a promise that resolves to an array of agent objects\n */\nexport async function getAgents(): Promise<AgentSkeleton[]> {\n debugMessage(`AgentOps.getAgents: start`);\n let agents = [];\n try {\n const resolved = await Promise.all([\n getAgentsByType('IdentityGatewayAgent'),\n getAgentsByType('J2EEAgent'),\n getAgentsByType('WebAgent'),\n ]);\n agents = agents.concat(resolved[0].result);\n agents = agents.concat(resolved[1].result);\n agents = agents.concat(resolved[2].result);\n } catch (error) {\n printMessage(`${error.message}`, 'error');\n printMessage(error.response.data, 'error');\n }\n agents.sort((a, b) => a._id.localeCompare(b._id));\n debugMessage(`AgentOps.getAgents: end`);\n return agents;\n}\n\n/**\n * Get agent\n * @param {string} agentId agent id/name\n * @returns {Promise} a promise that resolves to an agent object\n */\nexport async function getAgent(agentId) {\n debugMessage(`AgentOps.getAgent: start`);\n const agents = await findAgentById(agentId);\n if (agents.length === 1) {\n const result = await _getAgentByTypeAndId(agents[0]._type, agents[0]._id);\n debugMessage(`AgentOps.getAgent: end`);\n return result;\n } else if (agents.length === 0) {\n throw new Error(`Agent '${agentId}' not found`);\n } else {\n throw new Error(`${agents.length} agents '${agentId}' found`);\n }\n}\n\n/**\n * Get agent by type and id\n * @param {string} agentType agent type (IdentityGatewayAgent, J2EEAgent, WebAgent)\n * @param {string} agentId agent id/name\n * @returns {Promise} a promise that resolves to an agent object\n */\nexport async function getAgentByTypeAndId(agentType, agentId) {\n debugMessage(`AgentOps.getAgentByTypeAndId: start`);\n const result = await _getAgentByTypeAndId(agentType, agentId);\n debugMessage(`AgentOps.getAgentByTypeAndId: start`);\n return result;\n}\n\n/**\n * Get identity gateway agents\n * @returns {Promise} a promise that resolves to an array of IdentityGatewayAgent objects\n */\nexport async function getIdentityGatewayAgents() {\n debugMessage(`AgentOps.getIdentityGatewayAgents: start`);\n const { result } = await getAgentsByType(AGENT_TYPE_IG);\n debugMessage(`AgentOps.getIdentityGatewayAgents: end`);\n return result;\n}\n\n/**\n * Get identity gateway agent\n * @param {string} gatewayId gateway id\n * @returns {Promise} a promise that resolves to an object containing an IdentityGatewayAgent object\n */\nexport async function getIdentityGatewayAgent(gatewayId: string) {\n debugMessage(`AgentOps.getIdentityGatewayAgent: start`);\n const result = await getAgentByTypeAndId(AGENT_TYPE_IG, gatewayId);\n debugMessage(`AgentOps.getIdentityGatewayAgent: end`);\n return result;\n}\n\n/**\n * Put identity gateway agent\n * @param {string} gatewayId gateway id\n * @param {Object} gatewayData IdentityGatewayAgent object\n * @returns {Promise} a promise that resolves to an object containing an IdentityGatewayAgent object\n */\nexport async function putIdentityGatewayAgent(gatewayId: string, gatewayData) {\n debugMessage(`AgentOps.putIdentityGatewayAgent: start`);\n const result = await putAgentByTypeAndId(\n AGENT_TYPE_IG,\n gatewayId,\n gatewayData\n );\n debugMessage(`AgentOps.putIdentityGatewayAgent: end`);\n return result;\n}\n\n/**\n * Get java agents\n * @returns {Promise} a promise that resolves to an array of J2EEAgent objects\n */\nexport async function getJavaAgents() {\n debugMessage(`AgentOps.getJavaAgents: start`);\n const { result } = await getAgentsByType(AGENT_TYPE_JAVA);\n debugMessage(`AgentOps.getJavaAgents: end`);\n return result;\n}\n\n/**\n * Get java agent\n * @param {string} agentId java agent id\n * @returns {Promise} a promise that resolves to an object containing an J2EEAgent object\n */\nexport async function getJavaAgent(agentId: string) {\n debugMessage(`AgentOps.getJavaAgent: start`);\n const result = await getAgentByTypeAndId(AGENT_TYPE_JAVA, agentId);\n debugMessage(`AgentOps.getJavaAgent: end`);\n return result;\n}\n\n/**\n * Put java agent\n * @param {string} agentId java agent id\n * @param {Object} agentData java agent object\n * @returns {Promise} a promise that resolves to an object containing an java agent object\n */\nexport async function putJavaAgent(agentId: string, agentData) {\n debugMessage(`AgentOps.putJavaAgent: start`);\n const result = await putAgentByTypeAndId(AGENT_TYPE_JAVA, agentId, agentData);\n debugMessage(`AgentOps.putJavaAgent: end`);\n return result;\n}\n\n/**\n * Get web agents\n * @returns {Promise} a promise that resolves to an array of WebAgent objects\n */\nexport async function getWebAgents() {\n debugMessage(`AgentOps.getWebAgents: start`);\n const { result } = await getAgentsByType(AGENT_TYPE_WEB);\n debugMessage(`AgentOps.getWebAgents: end`);\n return result;\n}\n\n/**\n * Get web agent\n * @param {string} agentId web agent id\n * @returns {Promise} a promise that resolves to an object containing an WebAgent object\n */\nexport async function getWebAgent(agentId: string) {\n debugMessage(`AgentOps.getWebAgent: start`);\n const result = await getAgentByTypeAndId(AGENT_TYPE_WEB, agentId);\n debugMessage(`AgentOps.getWebAgent: end`);\n return result;\n}\n\n/**\n * Put web agent\n * @param {string} agentId web agent id\n * @param {Object} agentData WebAgent object\n * @returns {Promise} a promise that resolves to an object containing an WebAgent object\n */\nexport async function putWebAgent(agentId: string, agentData) {\n debugMessage(`AgentOps.putWebAgent: start`);\n const result = await putAgentByTypeAndId(AGENT_TYPE_WEB, agentId, agentData);\n debugMessage(`AgentOps.putWebAgent: end`);\n return result;\n}\n\n/**\n * Export all agents. The response can be saved to file as is.\n * @returns {Promise<AgentExportInterface>} Promise resolving to an AgentExportInterface object.\n */\nexport async function exportAgents(): Promise<AgentExportInterface> {\n debugMessage(`AgentOps.exportAgents: start`);\n const exportData = createAgentExportTemplate();\n const agents = await getAgents();\n for (const agent of agents) {\n exportData.agents[agent._id] = agent;\n }\n debugMessage(`AgentOps.exportAgents: end`);\n return exportData;\n}\n\n/**\n * Export all identity gateway agents. The response can be saved to file as is.\n * @returns {Promise<AgentExportInterface} Promise resolving to an AgentExportInterface object.\n */\nexport async function exportIdentityGatewayAgents(): Promise<AgentExportInterface> {\n debugMessage(`AgentOps.exportIdentityGatewayAgents: start`);\n const exportData = createAgentExportTemplate();\n const agents = await getIdentityGatewayAgents();\n for (const agent of agents) {\n exportData.agents[agent._id] = agent;\n }\n debugMessage(`AgentOps.exportIdentityGatewayAgents: end`);\n return exportData;\n}\n\n/**\n * Export all java agents. The response can be saved to file as is.\n * @returns {Promise<AgentExportInterface} Promise resolving to an AgentExportInterface object.\n */\nexport async function exportJavaAgents(): Promise<AgentExportInterface> {\n debugMessage(`AgentOps.exportJavaAgents: start`);\n const exportData = createAgentExportTemplate();\n const agents = await getJavaAgents();\n for (const agent of agents) {\n exportData.agents[agent._id] = agent;\n }\n debugMessage(`AgentOps.exportJavaAgents: end`);\n return exportData;\n}\n\n/**\n * Export all web agents. The response can be saved to file as is.\n * @returns {Promise<AgentExportInterface} Promise resolving to an AgentExportInterface object.\n */\nexport async function exportWebAgents(): Promise<AgentExportInterface> {\n debugMessage(`AgentOps.exportWebAgents: start`);\n const exportData = createAgentExportTemplate();\n const agents = await getWebAgents();\n for (const agent of agents) {\n exportData.agents[agent._id] = agent;\n }\n debugMessage(`AgentOps.exportWebAgents: end`);\n return exportData;\n}\n\n/**\n * Export agent. The response can be saved to file as is.\n * @param agentId agent id/name\n * @returns {Promise<AgentExportInterface} Promise resolving to an AgentExportInterface object.\n */\nexport async function exportAgent(agentId): Promise<AgentExportInterface> {\n debugMessage(`AgentOps.exportAgent: start`);\n const exportData = createAgentExportTemplate();\n const agentObject = await getAgent(agentId);\n exportData.agents[agentId] = agentObject;\n debugMessage(`AgentOps.exportAgent: end`);\n return exportData;\n}\n\n/**\n * Export identity gateway agent. The response can be saved to file as is.\n * @param agentId agent id/name\n * @returns {Promise<AgentExportInterface} Promise resolving to an AgentExportInterface object.\n */\nexport async function exportIdentityGatewayAgent(\n agentId\n): Promise<AgentExportInterface> {\n debugMessage(`AgentOps.exportIdentityGatewayAgent: start`);\n const exportData = createAgentExportTemplate();\n const agentObject = await getIdentityGatewayAgent(agentId);\n exportData.agents[agentId] = agentObject;\n debugMessage(`AgentOps.exportIdentityGatewayAgent: end`);\n return exportData;\n}\n\n/**\n * Export java agent. The response can be saved to file as is.\n * @param agentId agent id/name\n * @returns {Promise<AgentExportInterface} Promise resolving to an AgentExportInterface object.\n */\nexport async function exportJavaAgent(agentId): Promise<AgentExportInterface> {\n debugMessage(`AgentOps.exportJavaAgent: start`);\n const exportData = createAgentExportTemplate();\n const agentObject = await getJavaAgent(agentId);\n exportData.agents[agentId] = agentObject;\n debugMessage(`AgentOps.exportJavaAgent: end`);\n return exportData;\n}\n\n/**\n * Export web agent. The response can be saved to file as is.\n * @param agentId agent id/name\n * @returns {Promise<AgentExportInterface} Promise resolving to an AgentExportInterface object.\n */\nexport async function exportWebAgent(agentId): Promise<AgentExportInterface> {\n debugMessage(`AgentOps.exportWebAgent: start`);\n const exportData = createAgentExportTemplate();\n const agentObject = await getWebAgent(agentId);\n exportData.agents[agentId] = agentObject;\n debugMessage(`AgentOps.exportWebAgent: end`);\n return exportData;\n}\n\n/**\n * Import agents. The import data is usually read from an agent export file.\n * @param {AgentExportInterface} importData agent import data.\n */\nexport async function importAgents(\n importData: AgentExportInterface\n): Promise<void> {\n debugMessage(`AgentOps.importAgents: start`);\n if (validateImport(importData.meta)) {\n for (const agentId of Object.keys(importData.agents)) {\n const agentType = importData.agents[agentId]._type._id;\n debugMessage(`AgentOps.importAgents: ${agentId} [${agentType}]`);\n await putAgentByTypeAndId(agentType, agentId, importData.agents[agentId]);\n }\n } else {\n throw new Error('Invalid meta data.');\n }\n debugMessage(`AgentOps.importAgents: end`);\n}\n\n/**\n * Import identity gateway agents. The import data is usually read from an agent export file.\n * @param {AgentExportInterface} importData agent import data.\n */\nexport async function importIdentityGatewayAgents(\n importData: AgentExportInterface\n): Promise<void> {\n debugMessage(`AgentOps.importIdentityGatewayAgents: start`);\n if (validateImport(importData.meta)) {\n for (const agentId of Object.keys(importData.agents)) {\n const agentType = importData.agents[agentId]._type._id;\n if (agentType !== AGENT_TYPE_IG)\n throw new Error(\n `Wrong agent type! Expected '${AGENT_TYPE_IG}' but got '${agentType}'.`\n );\n await putAgentByTypeAndId(agentType, agentId, importData.agents[agentId]);\n }\n } else {\n throw new Error('Invalid meta data.');\n }\n debugMessage(`AgentOps.importIdentityGatewayAgents: end`);\n}\n\n/**\n * Import java agents. The import data is usually read from an agent export file.\n * @param {AgentExportInterface} importData agent import data.\n */\nexport async function importJavaAgents(\n importData: AgentExportInterface\n): Promise<void> {\n debugMessage(`AgentOps.importJavaAgents: start`);\n if (validateImport(importData.meta)) {\n for (const agentId of Object.keys(importData.agents)) {\n const agentType = importData.agents[agentId]._type._id;\n if (agentType !== AGENT_TYPE_JAVA)\n throw new Error(\n `Wrong agent type! Expected '${AGENT_TYPE_JAVA}' but got '${agentType}'.`\n );\n await putAgentByTypeAndId(agentType, agentId, importData.agents[agentId]);\n }\n } else {\n throw new Error('Invalid meta data.');\n }\n debugMessage(`AgentOps.importJavaAgents: end`);\n}\n\n/**\n * Import web agents. The import data is usually read from an agent export file.\n * @param {AgentExportInterface} importData agent import data.\n */\nexport async function importWebAgents(\n importData: AgentExportInterface\n): Promise<void> {\n debugMessage(`AgentOps.importWebAgents: start`);\n if (validateImport(importData.meta)) {\n for (const agentId of Object.keys(importData.agents)) {\n const agentType = importData.agents[agentId]._type._id;\n if (agentType !== AGENT_TYPE_WEB)\n throw new Error(\n `Wrong agent type! Expected '${AGENT_TYPE_WEB}' but got '${agentType}'.`\n );\n await putAgentByTypeAndId(agentType, agentId, importData.agents[agentId]);\n }\n } else {\n throw new Error('Invalid meta data.');\n }\n debugMessage(`AgentOps.importWebAgents: end`);\n}\n\n/**\n * Import agent. The import data is usually read from an agent export file.\n * @param {string} agentId agent id/name\n * @param {AgentExportInterface} importData agent import data.\n * @returns {Promise} Promise resolving to an agent object.\n */\nexport async function importAgent(agentId, importData: AgentExportInterface) {\n debugMessage(`AgentOps.importAgent: start`);\n if (validateImport(importData.meta)) {\n const agentType = importData.agents[agentId]?._type._id;\n const result = await putAgentByTypeAndId(\n agentType,\n agentId,\n importData.agents[agentId]\n );\n debugMessage(`AgentOps.importAgent: end`);\n return result;\n } else {\n throw new Error('Invalid meta data.');\n }\n}\n\n/**\n * Import identity gateway agent. The import data is usually read from an agent export file.\n * @param {string} agentId agent id/name\n * @param {AgentExportInterface} importData agent import data.\n * @returns {Promise} Promise resolving to an agent object.\n */\nexport async function importIdentityGatewayAgent(\n agentId,\n importData: AgentExportInterface\n) {\n debugMessage(`AgentOps.importIdentityGatewayAgent: start`);\n if (validateImport(importData.meta)) {\n const agentType = importData.agents[agentId]?._type._id;\n if (agentType !== AGENT_TYPE_IG)\n throw new Error(\n `Wrong agent type! Expected '${AGENT_TYPE_IG}' but got '${agentType}'.`\n );\n const result = await putAgentByTypeAndId(\n agentType,\n agentId,\n importData.agents[agentId]\n );\n debugMessage(`AgentOps.importIdentityGatewayAgent: end`);\n return result;\n } else {\n throw new Error('Invalid meta data.');\n }\n}\n\n/**\n * Import java agent. The import data is usually read from an agent export file.\n * @param {string} agentId agent id/name\n * @param {AgentExportInterface} importData agent import data.\n * @returns {Promise} Promise resolving to an agent object.\n */\nexport async function importJavaAgent(\n agentId,\n importData: AgentExportInterface\n) {\n debugMessage(`AgentOps.importJavaAgent: start`);\n if (validateImport(importData.meta)) {\n const agentType = importData.agents[agentId]?._type._id;\n if (agentType !== AGENT_TYPE_JAVA)\n throw new Error(\n `Wrong agent type! Expected '${AGENT_TYPE_JAVA}' but got '${agentType}'.`\n );\n const result = await putAgentByTypeAndId(\n agentType,\n agentId,\n importData.agents[agentId]\n );\n debugMessage(`AgentOps.importJavaAgent: end`);\n return result;\n } else {\n throw new Error('Invalid meta data.');\n }\n}\n\n/**\n * Import java agent. The import data is usually read from an agent export file.\n * @param {string} agentId agent id/name\n * @param {AgentExportInterface} importData agent import data.\n * @returns {Promise} Promise resolving to an agent object.\n */\nexport async function importWebAgent(\n agentId,\n importData: AgentExportInterface\n) {\n debugMessage(`AgentOps.importWebAgent: start`);\n if (validateImport(importData.meta)) {\n const agentType = importData.agents[agentId]?._type._id;\n if (agentType !== AGENT_TYPE_WEB)\n throw new Error(\n `Wrong agent type! Expected '${AGENT_TYPE_WEB}' but got '${agentType}'.`\n );\n const result = await putAgentByTypeAndId(\n agentType,\n agentId,\n importData.agents[agentId]\n );\n debugMessage(`AgentOps.importWebAgent: end`);\n return result;\n } else {\n throw new Error('Invalid meta data.');\n }\n}\n\n/**\n * Delete all agents\n */\nexport async function deleteAgents() {\n debugMessage(`AgentOps.deleteAgents: start`);\n const agents = await getAgents();\n for (const agent of agents) {\n debugMessage(`AgentOps.deleteAgent: '${agent['_id']}'`);\n await deleteAgentByTypeAndId(agent['_type']['_id'], agent['_id']);\n }\n debugMessage(`AgentOps.deleteAgents: end`);\n}\n\n/**\n * Delete agent\n * @param agentId agent id/name\n */\nexport async function deleteAgent(agentId: string) {\n debugMessage(`AgentOps.deleteAgent: start`);\n const agents = await findAgentById(agentId);\n if (agents.length) {\n for (const agent of agents) {\n debugMessage(`AgentOps.deleteAgent: '${agent['_id']}'`);\n await deleteAgentByTypeAndId(agent['_type'], agent['_id']);\n }\n } else {\n throw new Error(`Agent '${agentId}' not found!`);\n }\n debugMessage(`AgentOps.deleteAgent: end`);\n}\n\n/**\n * Delete all identity gateway agents\n */\nexport async function deleteIdentityGatewayAgents() {\n debugMessage(`AgentOps.deleteIdentityGatewayAgents: start`);\n const agents = await getIdentityGatewayAgents();\n for (const agent of agents) {\n debugMessage(`AgentOps.deleteIdentityGatewayAgent: '${agent['_id']}'`);\n await deleteAgentByTypeAndId(agent['_type']['_id'], agent['_id']);\n }\n debugMessage(`AgentOps.deleteIdentityGatewayAgents: end`);\n}\n\n/**\n * Delete identity gateway agent\n * @param agentId agent id/name\n */\nexport async function deleteIdentityGatewayAgent(agentId: string) {\n debugMessage(`AgentOps.deleteIdentityGatewayAgent: start`);\n const agents = await findAgentByTypeAndId(AGENT_TYPE_IG, agentId);\n if (agents.length) {\n for (const agent of agents) {\n debugMessage(`AgentOps.deleteIdentityGatewayAgent: '${agent['_id']}'`);\n await deleteAgentByTypeAndId(agent['_type']['_id'], agent['_id']);\n }\n } else {\n throw new Error(`Identity gateway agent '${agentId}' not found!`);\n }\n debugMessage(`AgentOps.deleteIdentityGatewayAgent: end`);\n}\n\n/**\n * Delete all java agents\n */\nexport async function deleteJavaAgents() {\n debugMessage(`AgentOps.deleteJavaAgents: start`);\n const agents = await getJavaAgents();\n for (const agent of agents) {\n debugMessage(`AgentOps.deleteJavaAgent: '${agent['_id']}'`);\n await deleteAgentByTypeAndId(agent['_type']['_id'], agent['_id']);\n }\n debugMessage(`AgentOps.deleteJavaAgents: end`);\n}\n\n/**\n * Delete java agent\n * @param agentId agent id/name\n */\nexport async function deleteJavaAgent(agentId: string) {\n debugMessage(`AgentOps.deleteJavaAgent: start`);\n const agents = await findAgentByTypeAndId(AGENT_TYPE_JAVA, agentId);\n if (agents.length) {\n for (const agent of agents) {\n debugMessage(`AgentOps.deleteJavaAgent: '${agent['_id']}'`);\n await deleteAgentByTypeAndId(agent['_type']['_id'], agent['_id']);\n }\n } else {\n throw new Error(`Java agent '${agentId}' not found!`);\n }\n debugMessage(`AgentOps.deleteJavaAgent: end`);\n}\n\n/**\n * Delete all web agents\n */\nexport async function deleteWebAgents() {\n debugMessage(`AgentOps.deleteWebAgents: start`);\n const agents = await getWebAgents();\n for (const agent of agents) {\n debugMessage(`AgentOps.deleteWebAgent: '${agent['_id']}'`);\n await deleteAgentByTypeAndId(agent['_type']['_id'], agent['_id']);\n }\n debugMessage(`AgentOps.deleteWebAgents: end`);\n}\n\n/**\n * Delete web agent\n * @param agentId agent id/name\n */\nexport async function deleteWebAgent(agentId: string) {\n debugMessage(`AgentOps.deleteWebAgent: start`);\n const agents = await findAgentByTypeAndId(AGENT_TYPE_WEB, agentId);\n if (agents.length) {\n for (const agent of agents) {\n debugMessage(`AgentOps.deleteWebAgent: '${agent['_id']}'`);\n await deleteAgentByTypeAndId(agent['_type']['_id'], agent['_id']);\n }\n } else {\n throw new Error(`Web agent '${agentId}' not found!`);\n }\n debugMessage(`AgentOps.deleteWebAgent: end`);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AAUA;;;;;;AAEO,IAAMA,aAAa,GAAG,sBAAtB;;AACA,IAAMC,eAAe,GAAG,WAAxB;;AACA,IAAMC,cAAc,GAAG,UAAvB;AAEP;AACA;AACA;AACA;;;;AACO,SAASC,yBAAT,GAA2D;EAChE,OAAO;IACLC,IAAI,EAAE,EADD;IAELC,MAAM,EAAE;EAFH,CAAP;AAID;AAED;AACA;AACA;AACA;;;SACsBC,S;;;AAqBtB;AACA;AACA;AACA;AACA;;;;iCAzBO,aAAqD;IAC1D,IAAAC,qBAAA;IACA,IAAIF,MAAM,GAAG,EAAb;;IACA,IAAI;MACF,IAAMG,QAAQ,SAASC,OAAO,CAACC,GAAR,CAAY,CACjC,IAAAC,yBAAA,EAAgB,sBAAhB,CADiC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