@rockcarver/frodo-lib 2.0.0-57 → 2.0.0-58

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.
Files changed (32) hide show
  1. package/build.zip +0 -0
  2. package/cjs/api/NodeApi.js.map +1 -1
  3. package/cjs/ops/ConfigOps.js +8 -4
  4. package/cjs/ops/ConfigOps.js.map +1 -1
  5. package/cjs/ops/ConfigOps.test.js +20 -5
  6. package/cjs/ops/ConfigOps.test.js.map +1 -1
  7. package/cjs/ops/JourneyOps.js +149 -66
  8. package/cjs/ops/JourneyOps.js.map +1 -1
  9. package/cjs/ops/JourneyOps.test.js +160 -4
  10. package/cjs/ops/JourneyOps.test.js.map +1 -1
  11. package/cjs/test/mocks/JourneyOps/importJourney/FrodoTestJourney10.journey.json +37 -0
  12. package/cjs/test/mocks/JourneyOps/importJourney/FrodoTestJourney10NoCoords.journey.json +27 -0
  13. package/cjs/test/mocks/JourneyOps/importJourney/FrodoTestJourney11.journey.json +22 -0
  14. package/esm/api/NodeApi.js.map +1 -1
  15. package/esm/ops/ConfigOps.js +8 -4
  16. package/esm/ops/ConfigOps.js.map +1 -1
  17. package/esm/ops/ConfigOps.test.js +20 -6
  18. package/esm/ops/ConfigOps.test.js.map +1 -1
  19. package/esm/ops/JourneyOps.js +78 -6
  20. package/esm/ops/JourneyOps.js.map +1 -1
  21. package/esm/ops/JourneyOps.test.js +160 -4
  22. package/esm/ops/JourneyOps.test.js.map +1 -1
  23. package/esm/test/mocks/JourneyOps/importJourney/FrodoTestJourney10.journey.json +37 -0
  24. package/esm/test/mocks/JourneyOps/importJourney/FrodoTestJourney10NoCoords.journey.json +27 -0
  25. package/esm/test/mocks/JourneyOps/importJourney/FrodoTestJourney11.journey.json +22 -0
  26. package/package.json +1 -1
  27. package/types/api/NodeApi.d.ts +4 -0
  28. package/types/api/NodeApi.d.ts.map +1 -1
  29. package/types/ops/ConfigOps.d.ts +4 -0
  30. package/types/ops/ConfigOps.d.ts.map +1 -1
  31. package/types/ops/JourneyOps.d.ts +17 -0
  32. package/types/ops/JourneyOps.d.ts.map +1 -1
package/build.zip CHANGED
Binary file
@@ -1 +1 @@
1
- {"version":3,"file":"NodeApi.js","names":["_util","_interopRequireDefault","require","_ForgeRockUtils","_JsonUtils","_BaseApi","obj","__esModule","default","asyncGeneratorStep","gen","resolve","reject","_next","_throw","key","arg","info","value","error","done","Promise","then","_asyncToGenerator","fn","self","args","arguments","apply","err","undefined","queryAllNodeTypesURLTemplate","queryAllNodesByTypeURLTemplate","queryAllNodesURLTemplate","nodeURLTemplate","createNodeURLTemplate","apiVersion","getNodeApiConfig","getNodeTypes","_x","_getNodeTypes","_ref","state","urlString","util","format","getHost","getCurrentRealmPath","data","generateAmApi","resource","post","withCredentials","headers","getNodes","_x2","_getNodes","_ref2","getNodesByType","_x3","_getNodesByType","_ref3","nodeType","get","getNode","_x4","_getNode","_ref4","nodeId","createNode","_x5","_createNode","_ref5","nodeData","putNode","_x6","_putNode","_ref6","cleanData","deleteDeepByKey","put","deleteNode","_x7","_deleteNode","_ref7","delete"],"sources":["../../src/api/NodeApi.ts"],"sourcesContent":["import util from 'util';\n\nimport { State } from '../shared/State';\nimport { getCurrentRealmPath } from '../utils/ForgeRockUtils';\nimport { deleteDeepByKey } from '../utils/JsonUtils';\nimport {\n type IdObjectSkeletonInterface,\n type NoIdObjectSkeletonInterface,\n type PagedResult,\n type QueryResult,\n} from './ApiTypes';\nimport { generateAmApi } from './BaseApi';\nimport { type AmServiceType } from './ServiceApi';\n\nconst queryAllNodeTypesURLTemplate =\n '%s/json%s/realm-config/authentication/authenticationtrees/nodes?_action=getAllTypes';\nconst queryAllNodesByTypeURLTemplate =\n '%s/json%s/realm-config/authentication/authenticationtrees/nodes/%s?_queryFilter=true';\nconst queryAllNodesURLTemplate =\n '%s/json%s/realm-config/authentication/authenticationtrees/nodes?_action=nextdescendents';\nconst nodeURLTemplate =\n '%s/json%s/realm-config/authentication/authenticationtrees/nodes/%s/%s';\nconst createNodeURLTemplate =\n '%s/json%s/realm-config/authentication/authenticationtrees/nodes/%s?_action=create';\n\nconst apiVersion = 'protocol=2.1,resource=1.0';\nconst getNodeApiConfig = () => {\n return {\n apiVersion,\n };\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 NodeSkeleton = IdObjectSkeletonInterface & {\n _type: AmServiceType;\n nodes?: InnerNodeRefSkeletonInterface[];\n tree?: string;\n identityResource?: string;\n script?: string;\n emailTemplateName?: string;\n filteredProviders?: string[];\n useScript?: boolean;\n};\n\nexport type NodeTypeSkeleton = IdObjectSkeletonInterface & {\n name: string;\n collection: boolean;\n tags: string[];\n metadata: {\n tags: string[];\n [k: string]: string | number | boolean | string[];\n };\n help: string;\n};\n\n/**\n * Get all node types\n * @returns {Promise<QueryResult<NodeTypeSkeleton>>} a promise that resolves to an array of node type objects\n */\nexport async function getNodeTypes({\n state,\n}: {\n state: State;\n}): Promise<QueryResult<NodeTypeSkeleton>> {\n const urlString = util.format(\n queryAllNodeTypesURLTemplate,\n state.getHost(),\n getCurrentRealmPath(state)\n );\n const { data } = await generateAmApi({\n resource: getNodeApiConfig(),\n state,\n }).post(\n urlString,\n {},\n {\n withCredentials: true,\n headers: { 'Accept-Encoding': 'gzip, deflate, br' },\n }\n );\n return data;\n}\n\n/**\n * Get all nodes\n * @returns {Promise} a promise that resolves to an object containing an array of node objects\n */\nexport async function getNodes({\n state,\n}: {\n state: State;\n}): Promise<QueryResult<NodeSkeleton>> {\n const urlString = util.format(\n queryAllNodesURLTemplate,\n state.getHost(),\n getCurrentRealmPath(state)\n );\n const { data } = await generateAmApi({\n resource: getNodeApiConfig(),\n state,\n }).post(\n urlString,\n {},\n {\n withCredentials: true,\n headers: { 'Accept-Encoding': 'gzip, deflate, br' },\n }\n );\n return data;\n}\n\n/**\n * Get all nodes by type\n * @param {string} nodeType node type\n * @returns {Promise<PagedResult<NodeSkeleton>>} a promise that resolves to an object containing an array of node objects of the requested type\n */\nexport async function getNodesByType({\n nodeType,\n state,\n}: {\n nodeType: string;\n state: State;\n}): Promise<PagedResult<NodeSkeleton>> {\n const urlString = util.format(\n queryAllNodesByTypeURLTemplate,\n state.getHost(),\n getCurrentRealmPath(state),\n nodeType\n );\n const { data } = await generateAmApi({\n resource: getNodeApiConfig(),\n state,\n }).get(urlString, {\n withCredentials: true,\n });\n return data;\n}\n\n/**\n * Get node by uuid and type\n * @param {string} nodeId node uuid\n * @param {string} nodeType node type\n * @returns {Promise<NodeSkeleton>} a promise that resolves to a node object\n */\nexport async function getNode({\n nodeId,\n nodeType,\n state,\n}: {\n nodeId: string;\n nodeType: string;\n state: State;\n}): Promise<NodeSkeleton> {\n const urlString = util.format(\n nodeURLTemplate,\n state.getHost(),\n getCurrentRealmPath(state),\n nodeType,\n nodeId\n );\n const { data } = await generateAmApi({\n resource: getNodeApiConfig(),\n state,\n }).get(urlString, {\n withCredentials: true,\n });\n return data;\n}\n\n/**\n * Create node by type\n * @param {string} nodeType node type\n * @param {object} nodeData node object\n * @returns {Promise<NodeSkeleton>} a promise that resolves to a node object\n */\nexport async function createNode({\n nodeType,\n nodeData,\n state,\n}: {\n nodeType: string;\n nodeData: NodeSkeleton;\n state: State;\n}): Promise<NodeSkeleton> {\n const urlString = util.format(\n createNodeURLTemplate,\n state.getHost(),\n getCurrentRealmPath(state),\n nodeType\n );\n const { data } = await generateAmApi({\n resource: getNodeApiConfig(),\n state,\n }).post(urlString, nodeData, {\n withCredentials: true,\n headers: { 'Accept-Encoding': 'gzip, deflate, br' },\n });\n return data;\n}\n\n/**\n * Put node by uuid and type\n * @param {string} nodeId node uuid\n * @param {string} nodeType node type\n * @param {object} nodeData node object\n * @returns {Promise} a promise that resolves to an object containing a node object\n */\nexport async function putNode({\n nodeId,\n nodeType,\n nodeData,\n state,\n}: {\n nodeId: string;\n nodeType: string;\n nodeData: NodeSkeleton | NoIdObjectSkeletonInterface;\n state: State;\n}) {\n // until we figure out a way to use transport keys in Frodo,\n // we'll have to drop those encrypted attributes.\n const cleanData = deleteDeepByKey(nodeData, '-encrypted');\n const urlString = util.format(\n nodeURLTemplate,\n state.getHost(),\n getCurrentRealmPath(state),\n nodeType,\n nodeId\n );\n const { data } = await generateAmApi({\n resource: getNodeApiConfig(),\n state,\n }).put(urlString, cleanData, {\n withCredentials: true,\n });\n return data;\n}\n\n/**\n * Delete node by uuid and type\n * @param {String} nodeId node uuid\n * @param {String} nodeType node type\n * @returns {Promise} a promise that resolves to an object containing a node object\n */\nexport async function deleteNode({\n nodeId,\n nodeType,\n state,\n}: {\n nodeId: string;\n nodeType: string;\n state: State;\n}) {\n const urlString = util.format(\n nodeURLTemplate,\n state.getHost(),\n getCurrentRealmPath(state),\n nodeType,\n nodeId\n );\n const { data } = await generateAmApi({\n resource: getNodeApiConfig(),\n state,\n }).delete(urlString, {\n withCredentials: true,\n });\n return data;\n}\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAwB,IAAAC,eAAA,GAAAD,OAAA;AAAA,IAAAE,UAAA,GAAAF,OAAA;AAAA,IAAAG,QAAA,GAAAH,OAAA;AAAA,SAAAD,uBAAAK,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,mBAAAC,GAAA,EAAAC,OAAA,EAAAC,MAAA,EAAAC,KAAA,EAAAC,MAAA,EAAAC,GAAA,EAAAC,GAAA,cAAAC,IAAA,GAAAP,GAAA,CAAAK,GAAA,EAAAC,GAAA,OAAAE,KAAA,GAAAD,IAAA,CAAAC,KAAA,WAAAC,KAAA,IAAAP,MAAA,CAAAO,KAAA,iBAAAF,IAAA,CAAAG,IAAA,IAAAT,OAAA,CAAAO,KAAA,YAAAG,OAAA,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AmB,EAACL,KAAK,CAAC,EAC1BoB,QAAQ,EACRM,MACF,CAAC;IACD,IAAM;MAAEpB;IAAK,CAAC,SAAS,IAAAC,sBAAa,EAAC;MACnCC,QAAQ,EAAEb,gBAAgB,CAAC,CAAC;MAC5BK;IACF,CAAC,CAAC,CAACsC,GAAG,CAACrC,SAAS,EAAEmC,SAAS,EAAE;MAC3B1B,eAAe,EAAE;IACnB,CAAC,CAAC;IACF,OAAOJ,IAAI;EACb,CAAC;EAAA,OAAA4B,QAAA,CAAAhD,KAAA,OAAAD,SAAA;AAAA;AAAA,SAQqBsD,UAAUA,CAAAC,GAAA;EAAA,OAAAC,WAAA,CAAAvD,KAAA,OAAAD,SAAA;AAAA;AAAA,SAAAwD,YAAA;EAAAA,WAAA,GAAA5D,iBAAA,CAAzB,WAAA6D,KAAA,EAQJ;IAAA,IAR8B;MAC/BhB,MAAM;MACNN,QAAQ;MACRpB;IAKF,CAAC,GAAA0C,KAAA;IACC,IAAMzC,SAAS,GAAGC,aAAI,CAACC,MAAM,CAC3BX,eAAe,EACfQ,KAAK,CAACI,OAAO,CAAC,CAAC,EACf,IAAAC,mCAAmB,EAACL,KAAK,CAAC,EAC1BoB,QAAQ,EACRM,MACF,CAAC;IACD,IAAM;MAAEpB;IAAK,CAAC,SAAS,IAAAC,sBAAa,EAAC;MACnCC,QAAQ,EAAEb,gBAAgB,CAAC,CAAC;MAC5BK;IACF,CAAC,CAAC,CAAC2C,MAAM,CAAC1C,SAAS,EAAE;MACnBS,eAAe,EAAE;IACnB,CAAC,CAAC;IACF,OAAOJ,IAAI;EACb,CAAC;EAAA,OAAAmC,WAAA,CAAAvD,KAAA,OAAAD,SAAA;AAAA"}
1
+ {"version":3,"file":"NodeApi.js","names":["_util","_interopRequireDefault","require","_ForgeRockUtils","_JsonUtils","_BaseApi","obj","__esModule","default","asyncGeneratorStep","gen","resolve","reject","_next","_throw","key","arg","info","value","error","done","Promise","then","_asyncToGenerator","fn","self","args","arguments","apply","err","undefined","queryAllNodeTypesURLTemplate","queryAllNodesByTypeURLTemplate","queryAllNodesURLTemplate","nodeURLTemplate","createNodeURLTemplate","apiVersion","getNodeApiConfig","getNodeTypes","_x","_getNodeTypes","_ref","state","urlString","util","format","getHost","getCurrentRealmPath","data","generateAmApi","resource","post","withCredentials","headers","getNodes","_x2","_getNodes","_ref2","getNodesByType","_x3","_getNodesByType","_ref3","nodeType","get","getNode","_x4","_getNode","_ref4","nodeId","createNode","_x5","_createNode","_ref5","nodeData","putNode","_x6","_putNode","_ref6","cleanData","deleteDeepByKey","put","deleteNode","_x7","_deleteNode","_ref7","delete"],"sources":["../../src/api/NodeApi.ts"],"sourcesContent":["import util from 'util';\n\nimport { State } from '../shared/State';\nimport { getCurrentRealmPath } from '../utils/ForgeRockUtils';\nimport { deleteDeepByKey } from '../utils/JsonUtils';\nimport {\n type IdObjectSkeletonInterface,\n type NoIdObjectSkeletonInterface,\n type PagedResult,\n type QueryResult,\n} from './ApiTypes';\nimport { generateAmApi } from './BaseApi';\nimport { type AmServiceType } from './ServiceApi';\n\nconst queryAllNodeTypesURLTemplate =\n '%s/json%s/realm-config/authentication/authenticationtrees/nodes?_action=getAllTypes';\nconst queryAllNodesByTypeURLTemplate =\n '%s/json%s/realm-config/authentication/authenticationtrees/nodes/%s?_queryFilter=true';\nconst queryAllNodesURLTemplate =\n '%s/json%s/realm-config/authentication/authenticationtrees/nodes?_action=nextdescendents';\nconst nodeURLTemplate =\n '%s/json%s/realm-config/authentication/authenticationtrees/nodes/%s/%s';\nconst createNodeURLTemplate =\n '%s/json%s/realm-config/authentication/authenticationtrees/nodes/%s?_action=create';\n\nconst apiVersion = 'protocol=2.1,resource=1.0';\nconst getNodeApiConfig = () => {\n return {\n apiVersion,\n };\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 StaticNodeRefSkeletonInterface {\n x: number;\n y: number;\n}\n\nexport interface InnerNodeRefSkeletonInterface {\n _id: string;\n displayName: string;\n nodeType: string;\n}\n\nexport type NodeSkeleton = IdObjectSkeletonInterface & {\n _type: AmServiceType;\n nodes?: InnerNodeRefSkeletonInterface[];\n tree?: string;\n identityResource?: string;\n script?: string;\n emailTemplateName?: string;\n filteredProviders?: string[];\n useScript?: boolean;\n};\n\nexport type NodeTypeSkeleton = IdObjectSkeletonInterface & {\n name: string;\n collection: boolean;\n tags: string[];\n metadata: {\n tags: string[];\n [k: string]: string | number | boolean | string[];\n };\n help: string;\n};\n\n/**\n * Get all node types\n * @returns {Promise<QueryResult<NodeTypeSkeleton>>} a promise that resolves to an array of node type objects\n */\nexport async function getNodeTypes({\n state,\n}: {\n state: State;\n}): Promise<QueryResult<NodeTypeSkeleton>> {\n const urlString = util.format(\n queryAllNodeTypesURLTemplate,\n state.getHost(),\n getCurrentRealmPath(state)\n );\n const { data } = await generateAmApi({\n resource: getNodeApiConfig(),\n state,\n }).post(\n urlString,\n {},\n {\n withCredentials: true,\n headers: { 'Accept-Encoding': 'gzip, deflate, br' },\n }\n );\n return data;\n}\n\n/**\n * Get all nodes\n * @returns {Promise} a promise that resolves to an object containing an array of node objects\n */\nexport async function getNodes({\n state,\n}: {\n state: State;\n}): Promise<QueryResult<NodeSkeleton>> {\n const urlString = util.format(\n queryAllNodesURLTemplate,\n state.getHost(),\n getCurrentRealmPath(state)\n );\n const { data } = await generateAmApi({\n resource: getNodeApiConfig(),\n state,\n }).post(\n urlString,\n {},\n {\n withCredentials: true,\n headers: { 'Accept-Encoding': 'gzip, deflate, br' },\n }\n );\n return data;\n}\n\n/**\n * Get all nodes by type\n * @param {string} nodeType node type\n * @returns {Promise<PagedResult<NodeSkeleton>>} a promise that resolves to an object containing an array of node objects of the requested type\n */\nexport async function getNodesByType({\n nodeType,\n state,\n}: {\n nodeType: string;\n state: State;\n}): Promise<PagedResult<NodeSkeleton>> {\n const urlString = util.format(\n queryAllNodesByTypeURLTemplate,\n state.getHost(),\n getCurrentRealmPath(state),\n nodeType\n );\n const { data } = await generateAmApi({\n resource: getNodeApiConfig(),\n state,\n }).get(urlString, {\n withCredentials: true,\n });\n return data;\n}\n\n/**\n * Get node by uuid and type\n * @param {string} nodeId node uuid\n * @param {string} nodeType node type\n * @returns {Promise<NodeSkeleton>} a promise that resolves to a node object\n */\nexport async function getNode({\n nodeId,\n nodeType,\n state,\n}: {\n nodeId: string;\n nodeType: string;\n state: State;\n}): Promise<NodeSkeleton> {\n const urlString = util.format(\n nodeURLTemplate,\n state.getHost(),\n getCurrentRealmPath(state),\n nodeType,\n nodeId\n );\n const { data } = await generateAmApi({\n resource: getNodeApiConfig(),\n state,\n }).get(urlString, {\n withCredentials: true,\n });\n return data;\n}\n\n/**\n * Create node by type\n * @param {string} nodeType node type\n * @param {object} nodeData node object\n * @returns {Promise<NodeSkeleton>} a promise that resolves to a node object\n */\nexport async function createNode({\n nodeType,\n nodeData,\n state,\n}: {\n nodeType: string;\n nodeData: NodeSkeleton;\n state: State;\n}): Promise<NodeSkeleton> {\n const urlString = util.format(\n createNodeURLTemplate,\n state.getHost(),\n getCurrentRealmPath(state),\n nodeType\n );\n const { data } = await generateAmApi({\n resource: getNodeApiConfig(),\n state,\n }).post(urlString, nodeData, {\n withCredentials: true,\n headers: { 'Accept-Encoding': 'gzip, deflate, br' },\n });\n return data;\n}\n\n/**\n * Put node by uuid and type\n * @param {string} nodeId node uuid\n * @param {string} nodeType node type\n * @param {object} nodeData node object\n * @returns {Promise} a promise that resolves to an object containing a node object\n */\nexport async function putNode({\n nodeId,\n nodeType,\n nodeData,\n state,\n}: {\n nodeId: string;\n nodeType: string;\n nodeData: NodeSkeleton | NoIdObjectSkeletonInterface;\n state: State;\n}) {\n // until we figure out a way to use transport keys in Frodo,\n // we'll have to drop those encrypted attributes.\n const cleanData = deleteDeepByKey(nodeData, '-encrypted');\n const urlString = util.format(\n nodeURLTemplate,\n state.getHost(),\n getCurrentRealmPath(state),\n nodeType,\n nodeId\n );\n const { data } = await generateAmApi({\n resource: getNodeApiConfig(),\n state,\n }).put(urlString, cleanData, {\n withCredentials: true,\n });\n return data;\n}\n\n/**\n * Delete node by uuid and type\n * @param {String} nodeId node uuid\n * @param {String} nodeType node type\n * @returns {Promise} a promise that resolves to an object containing a node object\n */\nexport async function deleteNode({\n nodeId,\n nodeType,\n state,\n}: {\n nodeId: string;\n nodeType: string;\n state: State;\n}) {\n const urlString = util.format(\n nodeURLTemplate,\n state.getHost(),\n getCurrentRealmPath(state),\n nodeType,\n nodeId\n );\n const { data } = await generateAmApi({\n resource: getNodeApiConfig(),\n state,\n }).delete(urlString, {\n withCredentials: true,\n });\n return data;\n}\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAwB,IAAAC,eAAA,GAAAD,OAAA;AAAA,IAAAE,UAAA,GAAAF,OAAA;AAAA,IAAAG,QAAA,GAAAH,OAAA;AAAA,SAAAD,uBAAAK,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,mBAAAC,GAAA,EAAAC,OAAA,EAAAC,MAAA,EAAAC,KAAA,EAAAC,MAAA,EAAAC,GAAA,EAAAC,GAAA,cAAAC,IAAA,GAAAP,GAAA,CAAAK,GAAA,EAAAC,GAAA,OAAAE,KAAA,GAAAD,IAAA,CAAAC,KAAA,WAAAC,KAAA,IAAAP,MAAA,CAAAO,KAAA,iBAAAF,IAAA,CAAAG,IAAA,IAAAT,OAAA,CAAAO,KAAA,YAAAG,OAAA,CAAAV,OAAA,CAAAO,KAAA,EAAAI,IAAA,CAAAT,KAAA,EAAAC,MAAA;AAAA,SAAAS,kBAAAC,EAAA,6BAAAC,IAAA,SAAAC,IAAA,GAAAC,SAAA,aAAAN,OAAA,WAAAV,OAAA,EAAAC,MAAA,QAAAF,GAAA,GAAAc,EAAA,CAAAI,KAAA,CAAAH,IAAA,EAAAC,IAAA,YAAAb,MA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IACnB,CAAC,CAAC;IACF,OAAOJ,IAAI;EACb,CAAC;EAAA,OAAA4B,QAAA,CAAAhD,KAAA,OAAAD,SAAA;AAAA;AAAA,SAQqBsD,UAAUA,CAAAC,GAAA;EAAA,OAAAC,WAAA,CAAAvD,KAAA,OAAAD,SAAA;AAAA;AAAA,SAAAwD,YAAA;EAAAA,WAAA,GAAA5D,iBAAA,CAAzB,WAAA6D,KAAA,EAQJ;IAAA,IAR8B;MAC/BhB,MAAM;MACNN,QAAQ;MACRpB;IAKF,CAAC,GAAA0C,KAAA;IACC,IAAMzC,SAAS,GAAGC,aAAI,CAACC,MAAM,CAC3BX,eAAe,EACfQ,KAAK,CAACI,OAAO,CAAC,CAAC,EACf,IAAAC,mCAAmB,EAACL,KAAK,CAAC,EAC1BoB,QAAQ,EACRM,MACF,CAAC;IACD,IAAM;MAAEpB;IAAK,CAAC,SAAS,IAAAC,sBAAa,EAAC;MACnCC,QAAQ,EAAEb,gBAAgB,CAAC,CAAC;MAC5BK;IACF,CAAC,CAAC,CAAC2C,MAAM,CAAC1C,SAAS,EAAE;MACnBS,eAAe,EAAE;IACnB,CAAC,CAAC;IACF,OAAOJ,IAAI;EACb,CAAC;EAAA,OAAAmC,WAAA,CAAAvD,KAAA,OAAAD,SAAA;AAAA"}
@@ -40,7 +40,8 @@ var _default = state => {
40
40
  return _asyncToGenerator(function* () {
41
41
  var options = _arguments.length > 0 && _arguments[0] !== undefined ? _arguments[0] : {
42
42
  useStringArrays: true,
43
- noDecode: false
43
+ noDecode: false,
44
+ coords: true
44
45
  };
45
46
  return exportFullConfiguration({
46
47
  options,
@@ -92,13 +93,15 @@ function _exportFullConfiguration() {
92
93
  var {
93
94
  options = {
94
95
  useStringArrays: true,
95
- noDecode: false
96
+ noDecode: false,
97
+ coords: true
96
98
  },
97
99
  state
98
100
  } = _ref;
99
101
  var {
100
102
  useStringArrays,
101
- noDecode
103
+ noDecode,
104
+ coords
102
105
  } = options;
103
106
  var stateObj = {
104
107
  state
@@ -164,7 +167,8 @@ function _exportFullConfiguration() {
164
167
  trees: (_yield$exportOrImport17 = yield (0, _ExportImportUtils.exportOrImportWithErrorHandling)(_JourneyOps.exportJourneys, {
165
168
  options: {
166
169
  deps: false,
167
- useStringArrays
170
+ useStringArrays,
171
+ coords
168
172
  },
169
173
  state
170
174
  })) === null || _yield$exportOrImport17 === void 0 ? void 0 : _yield$exportOrImport17.trees,
@@ -1 +1 @@
1
- {"version":3,"file":"ConfigOps.js","names":["state","exportFullConfiguration","_arguments","arguments","_asyncToGenerator","options","length","undefined","useStringArrays","noDecode","importFullConfiguration","importData","_arguments2","reUuidJourneys","reUuidScripts","cleanServices","global","realm","exports","default","_default","_x","_exportFullConfiguration","apply","_ref","_yield$exportOrImport","_yield$exportOrImport2","_yield$exportOrImport3","_yield$exportOrImport4","_yield$exportOrImport5","_yield$exportOrImport6","_yield$exportOrImport7","_yield$exportOrImport8","_yield$exportOrImport9","_yield$exportOrImport10","_yield$exportOrImport11","_yield$exportOrImport12","_yield$exportOrImport13","_yield$exportOrImport14","_yield$exportOrImport15","_yield$exportOrImport16","_yield$exportOrImport17","_yield$exportOrImport18","stateObj","saml","exportOrImportWithErrorHandling","exportSaml2Providers","cotExport","exportCirclesOfTrust","cot","meta","getMetadata","agents","exportAgents","application","exportOAuth2Clients","deps","authentication","exportAuthenticationSettings","config","exportConfigEntities","emailTemplate","exportEmailTemplates","idp","exportSocialIdentityProviders","managedApplication","exportApplications","policy","exportPolicies","prereqs","policyset","exportPolicySets","resourcetype","exportResourceTypes","script","exportScripts","secrets","exportSecrets","service","_objectSpread","exportServices","globalConfig","theme","exportThemes","trees","exportJourneys","variables","exportVariables","_x2","_importFullConfiguration","_ref2","indicatorId","createProgressIndicator","total","message","updateProgressIndicator","id","importScripts","scriptName","reUuid","validate","importAuthenticationSettings","importAgents","importConfigEntities","importEmailTemplates","importResourceTypes","importCirclesOfTrust","importServices","clean","importThemes","importSaml2Providers","importSocialIdentityProviders","importOAuth2Clients","importApplications","importPolicySets","importPolicies","importJourneys","stopProgressIndicator","status"],"sources":["../../src/ops/ConfigOps.ts"],"sourcesContent":["import { AgentSkeleton } from '../api/AgentApi';\nimport { IdObjectSkeletonInterface } from '../api/ApiTypes';\nimport { AuthenticationSettingsSkeleton } from '../api/AuthenticationSettingsApi';\nimport { CircleOfTrustSkeleton } from '../api/CirclesOfTrustApi';\nimport { SecretSkeleton } from '../api/cloud/SecretsApi';\nimport { VariableSkeleton } from '../api/cloud/VariablesApi';\nimport { OAuth2ClientSkeleton } from '../api/OAuth2ClientApi';\nimport { PolicySkeleton } from '../api/PoliciesApi';\nimport { PolicySetSkeleton } from '../api/PolicySetApi';\nimport { ResourceTypeSkeleton } from '../api/ResourceTypesApi';\nimport { Saml2ProviderSkeleton } from '../api/Saml2Api';\nimport { ScriptSkeleton } from '../api/ScriptApi';\nimport { AmServiceSkeleton } from '../api/ServiceApi';\nimport { SocialIdpSkeleton } from '../api/SocialIdentityProvidersApi';\nimport { State } from '../shared/State';\nimport {\n createProgressIndicator,\n stopProgressIndicator,\n updateProgressIndicator,\n} from '../utils/Console';\nimport {\n exportOrImportWithErrorHandling,\n getMetadata,\n} from '../utils/ExportImportUtils';\nimport { exportAgents, importAgents } from './AgentOps';\nimport {\n ApplicationSkeleton,\n exportApplications,\n importApplications,\n} from './ApplicationOps';\nimport {\n exportAuthenticationSettings,\n importAuthenticationSettings,\n} from './AuthenticationSettingsOps';\nimport {\n CirclesOfTrustExportInterface,\n exportCirclesOfTrust,\n importCirclesOfTrust,\n} from './CirclesOfTrustOps';\nimport { exportSecrets } from './cloud/SecretsOps';\nimport { exportVariables } from './cloud/VariablesOps';\nimport {\n EmailTemplateSkeleton,\n exportEmailTemplates,\n importEmailTemplates,\n} from './EmailTemplateOps';\nimport { exportConfigEntities, importConfigEntities } from './IdmConfigOps';\nimport {\n exportSocialIdentityProviders,\n importSocialIdentityProviders,\n} from './IdpOps';\nimport {\n exportJourneys,\n importJourneys,\n SingleTreeExportInterface,\n} from './JourneyOps';\nimport { exportOAuth2Clients, importOAuth2Clients } from './OAuth2ClientOps';\nimport { ExportMetaData } from './OpsTypes';\nimport { exportPolicies, importPolicies } from './PolicyOps';\nimport { exportPolicySets, importPolicySets } from './PolicySetOps';\nimport { exportResourceTypes, importResourceTypes } from './ResourceTypeOps';\nimport { exportSaml2Providers, importSaml2Providers } from './Saml2Ops';\nimport { exportScripts, importScripts } from './ScriptOps';\nimport { exportServices, importServices } from './ServiceOps';\nimport { exportThemes, importThemes, ThemeSkeleton } from './ThemeOps';\n\nexport type Config = {\n /**\n * Export full configuration\n * @param {FullExportOptions} options export options\n * @returns {Promise<IdObjectSkeletonInterface>} a promise resolving to a full export object\n */\n exportFullConfiguration(\n options: FullExportOptions\n ): Promise<FullExportInterface>;\n /**\n * Import full configuration\n * @param {FullExportInterface} importData import data\n * @param {FullImportOptions} options import options\n */\n importFullConfiguration(\n importData: FullExportInterface,\n options: FullImportOptions\n ): Promise<void>;\n};\n\nexport default (state: State): Config => {\n return {\n async exportFullConfiguration(\n options: FullExportOptions = { useStringArrays: true, noDecode: false }\n ) {\n return exportFullConfiguration({ options, state });\n },\n async importFullConfiguration(\n importData: FullExportInterface,\n options: FullImportOptions = {\n reUuidJourneys: false,\n reUuidScripts: false,\n cleanServices: false,\n global: false,\n realm: false,\n }\n ) {\n return importFullConfiguration({\n importData,\n options,\n state,\n });\n },\n };\n};\n\n/**\n * Full export options\n */\nexport interface FullExportOptions {\n /**\n * Use string arrays to store multi-line text in scripts.\n */\n useStringArrays: boolean;\n /**\n * Do not include decoded variable value in export\n */\n noDecode: boolean;\n}\n\n/**\n * Full import options\n */\nexport interface FullImportOptions {\n /**\n * Generate new UUIDs for all journey nodes during import.\n */\n reUuidJourneys: boolean;\n /**\n * Generate new UUIDs for all scripts during import.\n */\n reUuidScripts: boolean;\n /**\n * Indicates whether to remove previously existing services of the same id before importing\n */\n cleanServices: boolean;\n /**\n * Indicates whether to import service(s) as global services\n */\n global: boolean;\n /**\n * Indicates whether to import service(s) to the current realm\n */\n realm: boolean;\n}\n\nexport interface FullExportInterface {\n meta?: ExportMetaData;\n agents: Record<string, AgentSkeleton> | undefined;\n application: Record<string, OAuth2ClientSkeleton> | undefined;\n authentication: AuthenticationSettingsSkeleton | undefined;\n config: Record<string, IdObjectSkeletonInterface> | undefined;\n emailTemplate: Record<string, EmailTemplateSkeleton> | undefined;\n idp: Record<string, SocialIdpSkeleton> | undefined;\n managedApplication: Record<string, ApplicationSkeleton> | undefined;\n policy: Record<string, PolicySkeleton> | undefined;\n policyset: Record<string, PolicySetSkeleton> | undefined;\n resourcetype: Record<string, ResourceTypeSkeleton> | undefined;\n saml:\n | {\n hosted: Record<string, Saml2ProviderSkeleton>;\n remote: Record<string, Saml2ProviderSkeleton>;\n metadata: Record<string, string[]>;\n cot: Record<string, CircleOfTrustSkeleton> | undefined;\n }\n | undefined;\n script: Record<string, ScriptSkeleton> | undefined;\n secrets: Record<string, SecretSkeleton> | undefined;\n service: Record<string, AmServiceSkeleton> | undefined;\n theme: Record<string, ThemeSkeleton> | undefined;\n trees: Record<string, SingleTreeExportInterface> | undefined;\n variables: Record<string, VariableSkeleton> | undefined;\n}\n\n/**\n * Export full configuration\n * @param {FullExportOptions} options export options\n */\nexport async function exportFullConfiguration({\n options = { useStringArrays: true, noDecode: false },\n state,\n}: {\n options: FullExportOptions;\n state: State;\n}): Promise<FullExportInterface> {\n const { useStringArrays, noDecode } = options;\n const stateObj = { state };\n //Export saml2 providers and circle of trusts\n let saml = (\n (await exportOrImportWithErrorHandling(\n exportSaml2Providers,\n stateObj\n )) as CirclesOfTrustExportInterface\n )?.saml;\n const cotExport = await exportOrImportWithErrorHandling(\n exportCirclesOfTrust,\n stateObj\n );\n if (saml) {\n saml.cot = cotExport?.saml.cot;\n } else {\n saml = cotExport?.saml;\n }\n //Create full export\n return {\n meta: getMetadata(stateObj),\n agents: (await exportOrImportWithErrorHandling(exportAgents, stateObj))\n ?.agents,\n application: (\n await exportOrImportWithErrorHandling(exportOAuth2Clients, {\n options: { deps: false, useStringArrays },\n state,\n })\n )?.application,\n authentication: (\n await exportOrImportWithErrorHandling(\n exportAuthenticationSettings,\n stateObj\n )\n )?.authentication,\n config: (\n await exportOrImportWithErrorHandling(exportConfigEntities, stateObj)\n )?.config,\n emailTemplate: (\n await exportOrImportWithErrorHandling(exportEmailTemplates, stateObj)\n )?.emailTemplate,\n idp: (\n await exportOrImportWithErrorHandling(\n exportSocialIdentityProviders,\n stateObj\n )\n )?.idp,\n managedApplication: (\n await exportOrImportWithErrorHandling(exportApplications, {\n options: { deps: false, useStringArrays },\n state,\n })\n )?.managedApplication,\n policy: (\n await exportOrImportWithErrorHandling(exportPolicies, {\n options: { deps: false, prereqs: false, useStringArrays },\n state,\n })\n )?.policy,\n policyset: (\n await exportOrImportWithErrorHandling(exportPolicySets, {\n options: { deps: false, prereqs: false, useStringArrays },\n state,\n })\n )?.policyset,\n resourcetype: (\n await exportOrImportWithErrorHandling(exportResourceTypes, stateObj)\n )?.resourcetype,\n saml,\n script: (await exportOrImportWithErrorHandling(exportScripts, stateObj))\n ?.script,\n secrets: (await exportOrImportWithErrorHandling(exportSecrets, stateObj))\n ?.secrets,\n service: {\n ...(\n await exportOrImportWithErrorHandling(exportServices, {\n globalConfig: true,\n state,\n })\n )?.service,\n ...(\n await exportOrImportWithErrorHandling(exportServices, {\n globalConfig: false,\n state,\n })\n )?.service,\n },\n theme: (await exportOrImportWithErrorHandling(exportThemes, stateObj))\n ?.theme,\n trees: (\n await exportOrImportWithErrorHandling(exportJourneys, {\n options: { deps: false, useStringArrays },\n state,\n })\n )?.trees,\n variables: (\n await exportOrImportWithErrorHandling(exportVariables, {\n noDecode,\n state,\n })\n )?.variables,\n };\n}\n\n/**\n * Import full configuration\n * @param {FullExportInterface} importData import data\n * @param {FullImportOptions} options import options\n */\nexport async function importFullConfiguration({\n importData,\n options = {\n reUuidJourneys: false,\n reUuidScripts: false,\n cleanServices: false,\n global: false,\n realm: false,\n },\n state,\n}: {\n importData: FullExportInterface;\n options: FullImportOptions;\n state: State;\n}): Promise<void> {\n const { reUuidJourneys, reUuidScripts, cleanServices, global, realm } =\n options;\n const indicatorId = createProgressIndicator({\n total: 16,\n message: 'Importing everything...',\n state,\n });\n // Order of imports matter here since we want dependencies to be imported first. For example, journeys depend on a lot of things, so they are last, and many things depend on scripts, so they are first.\n updateProgressIndicator({\n id: indicatorId,\n message: `Importing Scripts...`,\n state,\n });\n await exportOrImportWithErrorHandling(importScripts, {\n scriptName: '',\n importData,\n reUuid: reUuidScripts,\n validate: false,\n state,\n });\n updateProgressIndicator({\n id: indicatorId,\n message: `Importing Authentication Settings...`,\n state,\n });\n await exportOrImportWithErrorHandling(importAuthenticationSettings, {\n importData,\n state,\n });\n updateProgressIndicator({\n id: indicatorId,\n message: `Importing Agents...`,\n state,\n });\n await exportOrImportWithErrorHandling(importAgents, { importData, state });\n updateProgressIndicator({\n id: indicatorId,\n message: `Importing IDM Config Entities...`,\n state,\n });\n await exportOrImportWithErrorHandling(importConfigEntities, {\n importData,\n options: { validate: false },\n state,\n });\n updateProgressIndicator({\n id: indicatorId,\n message: `Importing Email Templates...`,\n state,\n });\n await exportOrImportWithErrorHandling(importEmailTemplates, {\n importData,\n state,\n });\n updateProgressIndicator({\n id: indicatorId,\n message: `Importing Resource Types...`,\n state,\n });\n await exportOrImportWithErrorHandling(importResourceTypes, {\n importData,\n state,\n });\n updateProgressIndicator({\n id: indicatorId,\n message: `Importing Circles of Trust...`,\n state,\n });\n await exportOrImportWithErrorHandling(importCirclesOfTrust, {\n importData,\n state,\n });\n updateProgressIndicator({\n id: indicatorId,\n message: `Importing Services...`,\n state,\n });\n await exportOrImportWithErrorHandling(importServices, {\n importData,\n options: { clean: cleanServices, global, realm },\n state,\n });\n updateProgressIndicator({\n id: indicatorId,\n message: `Importing Themes...`,\n state,\n });\n await exportOrImportWithErrorHandling(importThemes, {\n importData,\n state,\n });\n updateProgressIndicator({\n id: indicatorId,\n message: `Importing Saml2 Providers...`,\n state,\n });\n await exportOrImportWithErrorHandling(importSaml2Providers, {\n importData,\n options: { deps: false },\n state,\n });\n updateProgressIndicator({\n id: indicatorId,\n message: `Importing Social Identity Providers...`,\n state,\n });\n await exportOrImportWithErrorHandling(importSocialIdentityProviders, {\n importData,\n options: { deps: false },\n state,\n });\n updateProgressIndicator({\n id: indicatorId,\n message: `Importing OAuth2 Clients...`,\n state,\n });\n await exportOrImportWithErrorHandling(importOAuth2Clients, {\n importData,\n options: { deps: false },\n state,\n });\n updateProgressIndicator({\n id: indicatorId,\n message: `Importing Applications...`,\n state,\n });\n await exportOrImportWithErrorHandling(importApplications, {\n importData,\n options: { deps: false },\n state,\n });\n updateProgressIndicator({\n id: indicatorId,\n message: `Importing Policy Sets...`,\n state,\n });\n await exportOrImportWithErrorHandling(importPolicySets, {\n importData,\n options: { deps: false, prereqs: false },\n state,\n });\n updateProgressIndicator({\n id: indicatorId,\n message: `Importing Policies...`,\n state,\n });\n await exportOrImportWithErrorHandling(importPolicies, {\n importData,\n options: { deps: false, prereqs: false },\n state,\n });\n updateProgressIndicator({\n id: indicatorId,\n message: `Importing Journeys...`,\n state,\n });\n await exportOrImportWithErrorHandling(importJourneys, {\n importData,\n options: { deps: false, reUuid: reUuidJourneys },\n state,\n });\n stopProgressIndicator({\n id: indicatorId,\n message: 'Finished Importing Everything!',\n status: 'success',\n state,\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAsFgBA,KAAY,IAAa;EACvC,OAAO;IACCC,uBAAuBA,CAAA,EAE3B;MAAA,IAAAC,UAAA,GAAAC,SAAA;MAAA,OAAAC,iBAAA;QAAA,IADAC,OAA0B,GAAAH,UAAA,CAAAI,MAAA,QAAAJ,UAAA,QAAAK,SAAA,GAAAL,UAAA,MAAG;UAAEM,eAAe,EAAE,IAAI;UAAEC,QAAQ,EAAE;QAAM,CAAC;QAEvE,OAAOR,uBAAuB,CAAC;UAAEI,OAAO;UAAEL;QA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,gCAAuB,EAAC;MACtBC,EAAE,EAAEL,WAAW;MACfG,OAAO,yBAAyB;MAChC9F;IACF,CAAC,CAAC;IACF,MAAM,IAAA6C,kDAA+B,EAACuE,0BAAc,EAAE;MACpDzG,UAAU;MACVN,OAAO,EAAE;QAAEmD,IAAI,EAAE,KAAK;QAAE2C,MAAM,EAAEtF;MAAe,CAAC;MAChDb;IACF,CAAC,CAAC;IACF,IAAAqH,8BAAqB,EAAC;MACpBrB,EAAE,EAAEL,WAAW;MACfG,OAAO,EAAE,gCAAgC;MACzCwB,MAAM,EAAE,SAAS;MACjBtH;IACF,CAAC,CAAC;EACJ,CAAC;EAAA,OAAAyF,wBAAA,CAAAlE,KAAA,OAAApB,SAAA;AAAA"}
1
+ {"version":3,"file":"ConfigOps.js","names":["state","exportFullConfiguration","_arguments","arguments","_asyncToGenerator","options","length","undefined","useStringArrays","noDecode","coords","importFullConfiguration","importData","_arguments2","reUuidJourneys","reUuidScripts","cleanServices","global","realm","exports","default","_default","_x","_exportFullConfiguration","apply","_ref","_yield$exportOrImport","_yield$exportOrImport2","_yield$exportOrImport3","_yield$exportOrImport4","_yield$exportOrImport5","_yield$exportOrImport6","_yield$exportOrImport7","_yield$exportOrImport8","_yield$exportOrImport9","_yield$exportOrImport10","_yield$exportOrImport11","_yield$exportOrImport12","_yield$exportOrImport13","_yield$exportOrImport14","_yield$exportOrImport15","_yield$exportOrImport16","_yield$exportOrImport17","_yield$exportOrImport18","stateObj","saml","exportOrImportWithErrorHandling","exportSaml2Providers","cotExport","exportCirclesOfTrust","cot","meta","getMetadata","agents","exportAgents","application","exportOAuth2Clients","deps","authentication","exportAuthenticationSettings","config","exportConfigEntities","emailTemplate","exportEmailTemplates","idp","exportSocialIdentityProviders","managedApplication","exportApplications","policy","exportPolicies","prereqs","policyset","exportPolicySets","resourcetype","exportResourceTypes","script","exportScripts","secrets","exportSecrets","service","_objectSpread","exportServices","globalConfig","theme","exportThemes","trees","exportJourneys","variables","exportVariables","_x2","_importFullConfiguration","_ref2","indicatorId","createProgressIndicator","total","message","updateProgressIndicator","id","importScripts","scriptName","reUuid","validate","importAuthenticationSettings","importAgents","importConfigEntities","importEmailTemplates","importResourceTypes","importCirclesOfTrust","importServices","clean","importThemes","importSaml2Providers","importSocialIdentityProviders","importOAuth2Clients","importApplications","importPolicySets","importPolicies","importJourneys","stopProgressIndicator","status"],"sources":["../../src/ops/ConfigOps.ts"],"sourcesContent":["import { AgentSkeleton } from '../api/AgentApi';\nimport { IdObjectSkeletonInterface } from '../api/ApiTypes';\nimport { AuthenticationSettingsSkeleton } from '../api/AuthenticationSettingsApi';\nimport { CircleOfTrustSkeleton } from '../api/CirclesOfTrustApi';\nimport { SecretSkeleton } from '../api/cloud/SecretsApi';\nimport { VariableSkeleton } from '../api/cloud/VariablesApi';\nimport { OAuth2ClientSkeleton } from '../api/OAuth2ClientApi';\nimport { PolicySkeleton } from '../api/PoliciesApi';\nimport { PolicySetSkeleton } from '../api/PolicySetApi';\nimport { ResourceTypeSkeleton } from '../api/ResourceTypesApi';\nimport { Saml2ProviderSkeleton } from '../api/Saml2Api';\nimport { ScriptSkeleton } from '../api/ScriptApi';\nimport { AmServiceSkeleton } from '../api/ServiceApi';\nimport { SocialIdpSkeleton } from '../api/SocialIdentityProvidersApi';\nimport { State } from '../shared/State';\nimport {\n createProgressIndicator,\n stopProgressIndicator,\n updateProgressIndicator,\n} from '../utils/Console';\nimport {\n exportOrImportWithErrorHandling,\n getMetadata,\n} from '../utils/ExportImportUtils';\nimport { exportAgents, importAgents } from './AgentOps';\nimport {\n ApplicationSkeleton,\n exportApplications,\n importApplications,\n} from './ApplicationOps';\nimport {\n exportAuthenticationSettings,\n importAuthenticationSettings,\n} from './AuthenticationSettingsOps';\nimport {\n CirclesOfTrustExportInterface,\n exportCirclesOfTrust,\n importCirclesOfTrust,\n} from './CirclesOfTrustOps';\nimport { exportSecrets } from './cloud/SecretsOps';\nimport { exportVariables } from './cloud/VariablesOps';\nimport {\n EmailTemplateSkeleton,\n exportEmailTemplates,\n importEmailTemplates,\n} from './EmailTemplateOps';\nimport { exportConfigEntities, importConfigEntities } from './IdmConfigOps';\nimport {\n exportSocialIdentityProviders,\n importSocialIdentityProviders,\n} from './IdpOps';\nimport {\n exportJourneys,\n importJourneys,\n SingleTreeExportInterface,\n} from './JourneyOps';\nimport { exportOAuth2Clients, importOAuth2Clients } from './OAuth2ClientOps';\nimport { ExportMetaData } from './OpsTypes';\nimport { exportPolicies, importPolicies } from './PolicyOps';\nimport { exportPolicySets, importPolicySets } from './PolicySetOps';\nimport { exportResourceTypes, importResourceTypes } from './ResourceTypeOps';\nimport { exportSaml2Providers, importSaml2Providers } from './Saml2Ops';\nimport { exportScripts, importScripts } from './ScriptOps';\nimport { exportServices, importServices } from './ServiceOps';\nimport { exportThemes, importThemes, ThemeSkeleton } from './ThemeOps';\n\nexport type Config = {\n /**\n * Export full configuration\n * @param {FullExportOptions} options export options\n * @returns {Promise<IdObjectSkeletonInterface>} a promise resolving to a full export object\n */\n exportFullConfiguration(\n options: FullExportOptions\n ): Promise<FullExportInterface>;\n /**\n * Import full configuration\n * @param {FullExportInterface} importData import data\n * @param {FullImportOptions} options import options\n */\n importFullConfiguration(\n importData: FullExportInterface,\n options: FullImportOptions\n ): Promise<void>;\n};\n\nexport default (state: State): Config => {\n return {\n async exportFullConfiguration(\n options: FullExportOptions = {\n useStringArrays: true,\n noDecode: false,\n coords: true,\n }\n ) {\n return exportFullConfiguration({ options, state });\n },\n async importFullConfiguration(\n importData: FullExportInterface,\n options: FullImportOptions = {\n reUuidJourneys: false,\n reUuidScripts: false,\n cleanServices: false,\n global: false,\n realm: false,\n }\n ) {\n return importFullConfiguration({\n importData,\n options,\n state,\n });\n },\n };\n};\n\n/**\n * Full export options\n */\nexport interface FullExportOptions {\n /**\n * Use string arrays to store multi-line text in scripts.\n */\n useStringArrays: boolean;\n /**\n * Do not include decoded variable value in export\n */\n noDecode: boolean;\n /**\n * Include x and y coordinate positions of the journey/tree nodes.\n */\n coords: boolean;\n}\n\n/**\n * Full import options\n */\nexport interface FullImportOptions {\n /**\n * Generate new UUIDs for all journey nodes during import.\n */\n reUuidJourneys: boolean;\n /**\n * Generate new UUIDs for all scripts during import.\n */\n reUuidScripts: boolean;\n /**\n * Indicates whether to remove previously existing services of the same id before importing\n */\n cleanServices: boolean;\n /**\n * Indicates whether to import service(s) as global services\n */\n global: boolean;\n /**\n * Indicates whether to import service(s) to the current realm\n */\n realm: boolean;\n}\n\nexport interface FullExportInterface {\n meta?: ExportMetaData;\n agents: Record<string, AgentSkeleton> | undefined;\n application: Record<string, OAuth2ClientSkeleton> | undefined;\n authentication: AuthenticationSettingsSkeleton | undefined;\n config: Record<string, IdObjectSkeletonInterface> | undefined;\n emailTemplate: Record<string, EmailTemplateSkeleton> | undefined;\n idp: Record<string, SocialIdpSkeleton> | undefined;\n managedApplication: Record<string, ApplicationSkeleton> | undefined;\n policy: Record<string, PolicySkeleton> | undefined;\n policyset: Record<string, PolicySetSkeleton> | undefined;\n resourcetype: Record<string, ResourceTypeSkeleton> | undefined;\n saml:\n | {\n hosted: Record<string, Saml2ProviderSkeleton>;\n remote: Record<string, Saml2ProviderSkeleton>;\n metadata: Record<string, string[]>;\n cot: Record<string, CircleOfTrustSkeleton> | undefined;\n }\n | undefined;\n script: Record<string, ScriptSkeleton> | undefined;\n secrets: Record<string, SecretSkeleton> | undefined;\n service: Record<string, AmServiceSkeleton> | undefined;\n theme: Record<string, ThemeSkeleton> | undefined;\n trees: Record<string, SingleTreeExportInterface> | undefined;\n variables: Record<string, VariableSkeleton> | undefined;\n}\n\n/**\n * Export full configuration\n * @param {FullExportOptions} options export options\n */\nexport async function exportFullConfiguration({\n options = { useStringArrays: true, noDecode: false, coords: true },\n state,\n}: {\n options: FullExportOptions;\n state: State;\n}): Promise<FullExportInterface> {\n const { useStringArrays, noDecode, coords } = options;\n const stateObj = { state };\n //Export saml2 providers and circle of trusts\n let saml = (\n (await exportOrImportWithErrorHandling(\n exportSaml2Providers,\n stateObj\n )) as CirclesOfTrustExportInterface\n )?.saml;\n const cotExport = await exportOrImportWithErrorHandling(\n exportCirclesOfTrust,\n stateObj\n );\n if (saml) {\n saml.cot = cotExport?.saml.cot;\n } else {\n saml = cotExport?.saml;\n }\n //Create full export\n return {\n meta: getMetadata(stateObj),\n agents: (await exportOrImportWithErrorHandling(exportAgents, stateObj))\n ?.agents,\n application: (\n await exportOrImportWithErrorHandling(exportOAuth2Clients, {\n options: { deps: false, useStringArrays },\n state,\n })\n )?.application,\n authentication: (\n await exportOrImportWithErrorHandling(\n exportAuthenticationSettings,\n stateObj\n )\n )?.authentication,\n config: (\n await exportOrImportWithErrorHandling(exportConfigEntities, stateObj)\n )?.config,\n emailTemplate: (\n await exportOrImportWithErrorHandling(exportEmailTemplates, stateObj)\n )?.emailTemplate,\n idp: (\n await exportOrImportWithErrorHandling(\n exportSocialIdentityProviders,\n stateObj\n )\n )?.idp,\n managedApplication: (\n await exportOrImportWithErrorHandling(exportApplications, {\n options: { deps: false, useStringArrays },\n state,\n })\n )?.managedApplication,\n policy: (\n await exportOrImportWithErrorHandling(exportPolicies, {\n options: { deps: false, prereqs: false, useStringArrays },\n state,\n })\n )?.policy,\n policyset: (\n await exportOrImportWithErrorHandling(exportPolicySets, {\n options: { deps: false, prereqs: false, useStringArrays },\n state,\n })\n )?.policyset,\n resourcetype: (\n await exportOrImportWithErrorHandling(exportResourceTypes, stateObj)\n )?.resourcetype,\n saml,\n script: (await exportOrImportWithErrorHandling(exportScripts, stateObj))\n ?.script,\n secrets: (await exportOrImportWithErrorHandling(exportSecrets, stateObj))\n ?.secrets,\n service: {\n ...(\n await exportOrImportWithErrorHandling(exportServices, {\n globalConfig: true,\n state,\n })\n )?.service,\n ...(\n await exportOrImportWithErrorHandling(exportServices, {\n globalConfig: false,\n state,\n })\n )?.service,\n },\n theme: (await exportOrImportWithErrorHandling(exportThemes, stateObj))\n ?.theme,\n trees: (\n await exportOrImportWithErrorHandling(exportJourneys, {\n options: { deps: false, useStringArrays, coords },\n state,\n })\n )?.trees,\n variables: (\n await exportOrImportWithErrorHandling(exportVariables, {\n noDecode,\n state,\n })\n )?.variables,\n };\n}\n\n/**\n * Import full configuration\n * @param {FullExportInterface} importData import data\n * @param {FullImportOptions} options import options\n */\nexport async function importFullConfiguration({\n importData,\n options = {\n reUuidJourneys: false,\n reUuidScripts: false,\n cleanServices: false,\n global: false,\n realm: false,\n },\n state,\n}: {\n importData: FullExportInterface;\n options: FullImportOptions;\n state: State;\n}): Promise<void> {\n const { reUuidJourneys, reUuidScripts, cleanServices, global, realm } =\n options;\n const indicatorId = createProgressIndicator({\n total: 16,\n message: 'Importing everything...',\n state,\n });\n // Order of imports matter here since we want dependencies to be imported first. For example, journeys depend on a lot of things, so they are last, and many things depend on scripts, so they are first.\n updateProgressIndicator({\n id: indicatorId,\n message: `Importing Scripts...`,\n state,\n });\n await exportOrImportWithErrorHandling(importScripts, {\n scriptName: '',\n importData,\n reUuid: reUuidScripts,\n validate: false,\n state,\n });\n updateProgressIndicator({\n id: indicatorId,\n message: `Importing Authentication Settings...`,\n state,\n });\n await exportOrImportWithErrorHandling(importAuthenticationSettings, {\n importData,\n state,\n });\n updateProgressIndicator({\n id: indicatorId,\n message: `Importing Agents...`,\n state,\n });\n await exportOrImportWithErrorHandling(importAgents, { importData, state });\n updateProgressIndicator({\n id: indicatorId,\n message: `Importing IDM Config Entities...`,\n state,\n });\n await exportOrImportWithErrorHandling(importConfigEntities, {\n importData,\n options: { validate: false },\n state,\n });\n updateProgressIndicator({\n id: indicatorId,\n message: `Importing Email Templates...`,\n state,\n });\n await exportOrImportWithErrorHandling(importEmailTemplates, {\n importData,\n state,\n });\n updateProgressIndicator({\n id: indicatorId,\n message: `Importing Resource Types...`,\n state,\n });\n await exportOrImportWithErrorHandling(importResourceTypes, {\n importData,\n state,\n });\n updateProgressIndicator({\n id: indicatorId,\n message: `Importing Circles of Trust...`,\n state,\n });\n await exportOrImportWithErrorHandling(importCirclesOfTrust, {\n importData,\n state,\n });\n updateProgressIndicator({\n id: indicatorId,\n message: `Importing Services...`,\n state,\n });\n await exportOrImportWithErrorHandling(importServices, {\n importData,\n options: { clean: cleanServices, global, realm },\n state,\n });\n updateProgressIndicator({\n id: indicatorId,\n message: `Importing Themes...`,\n state,\n });\n await exportOrImportWithErrorHandling(importThemes, {\n importData,\n state,\n });\n updateProgressIndicator({\n id: indicatorId,\n message: `Importing Saml2 Providers...`,\n state,\n });\n await exportOrImportWithErrorHandling(importSaml2Providers, {\n importData,\n options: { deps: false },\n state,\n });\n updateProgressIndicator({\n id: indicatorId,\n message: `Importing Social Identity Providers...`,\n state,\n });\n await exportOrImportWithErrorHandling(importSocialIdentityProviders, {\n importData,\n options: { deps: false },\n state,\n });\n updateProgressIndicator({\n id: indicatorId,\n message: `Importing OAuth2 Clients...`,\n state,\n });\n await exportOrImportWithErrorHandling(importOAuth2Clients, {\n importData,\n options: { deps: false },\n state,\n });\n updateProgressIndicator({\n id: indicatorId,\n message: `Importing Applications...`,\n state,\n });\n await exportOrImportWithErrorHandling(importApplications, {\n importData,\n options: { deps: false },\n state,\n });\n updateProgressIndicator({\n id: indicatorId,\n message: `Importing Policy Sets...`,\n state,\n });\n await exportOrImportWithErrorHandling(importPolicySets, {\n importData,\n options: { deps: false, prereqs: false },\n state,\n });\n updateProgressIndicator({\n id: indicatorId,\n message: `Importing Policies...`,\n state,\n });\n await exportOrImportWithErrorHandling(importPolicies, {\n importData,\n options: { deps: false, prereqs: false },\n state,\n });\n updateProgressIndicator({\n id: indicatorId,\n message: `Importing Journeys...`,\n state,\n });\n await exportOrImportWithErrorHandling(importJourneys, {\n importData,\n options: { deps: false, reUuid: reUuidJourneys },\n state,\n });\n stopProgressIndicator({\n id: indicatorId,\n message: 'Finished Importing Everything!',\n status: 'success',\n state,\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAsFgBA,KAAY,IAAa;EACvC,OAAO;IACCC,uBAAuB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,IAAI,EAAE,KAAK;QAAEa,OAAO,EAAE;MAAM,CAAC;MACxCtE;IACF,CAAC,CAAC;IACF,IAAAgG,gCAAuB,EAAC;MACtBC,EAAE,EAAEL,WAAW;MACfG,OAAO,yBAAyB;MAChC/F;IACF,CAAC,CAAC;IACF,MAAM,IAAA8C,kDAA+B,EAACsE,yBAAc,EAAE;MACpDxG,UAAU;MACVP,OAAO,EAAE;QAAEoD,IAAI,EAAE,KAAK;QAAEa,OAAO,EAAE;MAAM,CAAC;MACxCtE;IACF,CAAC,CAAC;IACF,IAAAgG,gCAAuB,EAAC;MACtBC,EAAE,EAAEL,WAAW;MACfG,OAAO,yBAAyB;MAChC/F;IACF,CAAC,CAAC;IACF,MAAM,IAAA8C,kDAA+B,EAACuE,0BAAc,EAAE;MACpDzG,UAAU;MACVP,OAAO,EAAE;QAAEoD,IAAI,EAAE,KAAK;QAAE2C,MAAM,EAAEtF;MAAe,CAAC;MAChDd;IACF,CAAC,CAAC;IACF,IAAAsH,8BAAqB,EAAC;MACpBrB,EAAE,EAAEL,WAAW;MACfG,OAAO,EAAE,gCAAgC;MACzCwB,MAAM,EAAE,SAAS;MACjBvH;IACF,CAAC,CAAC;EACJ,CAAC;EAAA,OAAA0F,wBAAA,CAAAlE,KAAA,OAAArB,SAAA;AAAA"}
@@ -3,6 +3,8 @@
3
3
  var _AutoSetupPolly = require("../utils/AutoSetupPolly.js");
4
4
  var ConfigOps = _interopRequireWildcard(require("./ConfigOps.js"));
5
5
  var _index = require("../index.js");
6
+ var _Constants = _interopRequireDefault(require("../shared/Constants.js"));
7
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6
8
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
7
9
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
8
10
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
@@ -40,17 +42,27 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
40
42
  * Note: FRODO_DEBUG=1 is optional and enables debug logging for some output
41
43
  * in case things don't function as expected
42
44
  */
43
- (0, _AutoSetupPolly.autoSetupPolly)();
45
+ var ctx = (0, _AutoSetupPolly.autoSetupPolly)();
44
46
  describe('ConfigOps', () => {
47
+ beforeEach( /*#__PURE__*/_asyncToGenerator(function* () {
48
+ if (process.env.FRODO_POLLY_MODE === 'record') {
49
+ ctx.polly.server.any().on('beforePersist', (_req, recording) => {
50
+ (0, _AutoSetupPolly.filterRecording)(recording);
51
+ });
52
+ }
53
+ }));
45
54
  describe('exportFullConfiguration()', () => {
46
55
  test('0: Method is implemented', /*#__PURE__*/_asyncToGenerator(function* () {
47
56
  expect(ConfigOps.exportFullConfiguration).toBeDefined();
48
57
  }));
49
- test('1: Export everything with string arrays and decoding', /*#__PURE__*/_asyncToGenerator(function* () {
58
+ test('1: Export everything with string arrays and decoding and coords', /*#__PURE__*/_asyncToGenerator(function* () {
59
+ // Set deployment type to cloud since it is necessary for exporting applications correctly. It does this automatically when recording the mock, but not when running the test after recording
60
+ _index.state.setDeploymentType(_Constants.default.CLOUD_DEPLOYMENT_TYPE_KEY);
50
61
  var response = yield ConfigOps.exportFullConfiguration({
51
62
  options: {
52
63
  useStringArrays: true,
53
- noDecode: false
64
+ noDecode: false,
65
+ coords: true
54
66
  },
55
67
  state: _index.state
56
68
  });
@@ -58,11 +70,14 @@ describe('ConfigOps', () => {
58
70
  meta: expect.any(Object)
59
71
  });
60
72
  }));
61
- test('2: Export everything without string arrays and decoding', /*#__PURE__*/_asyncToGenerator(function* () {
73
+ test('2: Export everything without string arrays and decoding and coords', /*#__PURE__*/_asyncToGenerator(function* () {
74
+ // Set deployment type to cloud since it is necessary for exporting applications correctly. It does this automatically when recording the mock, but not when running the test after recording
75
+ _index.state.setDeploymentType(_Constants.default.CLOUD_DEPLOYMENT_TYPE_KEY);
62
76
  var response = yield ConfigOps.exportFullConfiguration({
63
77
  options: {
64
78
  useStringArrays: false,
65
- noDecode: true
79
+ noDecode: true,
80
+ coords: false
66
81
  },
67
82
  state: _index.state
68
83
  });
@@ -1 +1 @@
1
- {"version":3,"file":"ConfigOps.test.js","names":["autoSetupPolly","describe","test","_asyncToGenerator","expect","ConfigOps","exportFullConfiguration","toBeDefined","response","options","useStringArrays","noDecode","state","toMatchSnapshot","meta","any","Object","importFullConfiguration"],"sources":["../../src/ops/ConfigOps.test.ts"],"sourcesContent":["/**\n * To record and update snapshots, you must perform 3 steps in order:\n *\n * 1. Record API responses\n *\n * To record API responses, you must call the test:record script and\n * override all the connection state required to connect to the\n * env to record from:\n *\n * ATTENTION: For the recording to succeed, you MUST make sure to use a\n * user account, not a service account.\n *\n * FRODO_DEBUG=1 FRODO_HOST=frodo-dev npm run test:record ConfigOps\n *\n * The above command assumes that you have a connection profile for\n * 'frodo-dev' on your development machine.\n *\n * 2. Update snapshots\n *\n * After recording API responses, you must manually update/create snapshots\n * by running:\n *\n * FRODO_DEBUG=1 npm run test:update ConfigOps\n *\n * 3. Test your changes\n *\n * If 1 and 2 didn't produce any errors, you are ready to run the tests in\n * replay mode and make sure they all succeed as well:\n *\n * FRODO_DEBUG=1 npm run test:only ConfigOps\n *\n * Note: FRODO_DEBUG=1 is optional and enables debug logging for some output\n * in case things don't function as expected\n */\n\nimport { autoSetupPolly } from \"../utils/AutoSetupPolly\";\nimport * as ConfigOps from \"./ConfigOps\";\nimport { state } from \"../index\";\n\nautoSetupPolly();\n\ndescribe('ConfigOps', () => {\n describe('exportFullConfiguration()', () => {\n test('0: Method is implemented', async () => {\n expect(ConfigOps.exportFullConfiguration).toBeDefined();\n });\n\n test('1: Export everything with string arrays and decoding', async () => {\n const response = await ConfigOps.exportFullConfiguration({ options: { useStringArrays: true, noDecode: false }, state });\n expect(response).toMatchSnapshot({\n meta: expect.any(Object)\n });\n });\n\n test('2: Export everything without string arrays and decoding', async () => {\n const response = await ConfigOps.exportFullConfiguration({ options: { useStringArrays: false, noDecode: true }, state });\n expect(response).toMatchSnapshot({\n meta: expect.any(Object)\n });\n });\n });\n\n describe('importFullConfiguration()', () => {\n test('0: Method is implemented', async () => {\n expect(ConfigOps.importFullConfiguration).toBeDefined();\n });\n // TODO: Write tests for full import\n });\n});\n"],"mappings":";;;;;;;;sYAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAMA,IAAAA,8BAAc,EAAC,CAAC;AAEhBC,QAAQ,CAAC,WAAW,EAAE,MAAM;EAC1BA,QAAQ,CAAC,2BAA2B,EAAE,MAAM;IAC1CC,IAAI,CAAC,0BAA0B,eAAAC,iBAAA,CAAE,aAAY;MAC3CC,MAAM,CAACC,SAAS,CAACC,uBAAuB,CAAC,CAACC,WAAW,CAAC,CAAC;IACzD,CAAC,EAAC;IAEFL,IAAI,CAAC,sDAAsD,eAAAC,iBAAA,CAAE,aAAY;MACvE,IAAMK,QAAQ,SAASH,SAAS,CAACC,uBAAuB,CAAC;QAAEG,OAAO,EAAE;UAAEC,eAAe,EAAE,IAAI;UAAEC,QAAQ,EAAE;QAAM,CAAC;QAAEC,KAAK,EAALA;MAAM,CAAC,CAAC;MACxHR,MAAM,CAACI,QAAQ,CAAC,CAACK,eAAe,CAAC;QAC/BC,IAAI,EAAEV,MAAM,CAACW,GAAG,CAACC,MAAM;MACzB,CAAC,CAAC;IACJ,CAAC,EAAC;IAEFd,IAAI,CAAC,yDAAyD,eAAAC,iBAAA,CAAE,aAAY;MAC1E,IAAMK,QAAQ,SAASH,SAAS,CAACC,uBAAuB,CAAC;QAAEG,OAAO,EAAE;UAAEC,eAAe,EAAE,KAAK;UAAEC,QAAQ,EAAE;QAAK,CAAC;QAAEC,KAAK,EAALA;MAAM,CAAC,CAAC;MACxHR,MAAM,CAACI,QAAQ,CAAC,CAACK,eAAe,CAAC;QAC/BC,IAAI,EAAEV,MAAM,CAACW,GAAG,CAACC,MAAM;MACzB,CAAC,CAAC;IACJ,CAAC,EAAC;EACJ,CAAC,CAAC;EAEFf,QAAQ,CAAC,2BAA2B,EAAE,MAAM;IAC1CC,IAAI,CAAC,0BAA0B,eAAAC,iBAAA,CAAE,aAAY;MAC3CC,MAAM,CAACC,SAAS,CAACY,uBAAuB,CAAC,CAACV,WAAW,CAAC,CAAC;IACzD,CAAC,EAAC;IACF;EACF,CAAC,CAAC;AACJ,CAAC,CAAC"}
1
+ {"version":3,"file":"ConfigOps.test.js","names":["ctx","autoSetupPolly","describe","beforeEach","_asyncToGenerator","process","env","FRODO_POLLY_MODE","polly","server","any","on","_req","recording","filterRecording","test","expect","ConfigOps","exportFullConfiguration","toBeDefined","state","setDeploymentType","Constants","CLOUD_DEPLOYMENT_TYPE_KEY","response","options","useStringArrays","noDecode","coords","toMatchSnapshot","meta","Object","importFullConfiguration"],"sources":["../../src/ops/ConfigOps.test.ts"],"sourcesContent":["/**\n * To record and update snapshots, you must perform 3 steps in order:\n *\n * 1. Record API responses\n *\n * To record API responses, you must call the test:record script and\n * override all the connection state required to connect to the\n * env to record from:\n *\n * ATTENTION: For the recording to succeed, you MUST make sure to use a\n * user account, not a service account.\n *\n * FRODO_DEBUG=1 FRODO_HOST=frodo-dev npm run test:record ConfigOps\n *\n * The above command assumes that you have a connection profile for\n * 'frodo-dev' on your development machine.\n *\n * 2. Update snapshots\n *\n * After recording API responses, you must manually update/create snapshots\n * by running:\n *\n * FRODO_DEBUG=1 npm run test:update ConfigOps\n *\n * 3. Test your changes\n *\n * If 1 and 2 didn't produce any errors, you are ready to run the tests in\n * replay mode and make sure they all succeed as well:\n *\n * FRODO_DEBUG=1 npm run test:only ConfigOps\n *\n * Note: FRODO_DEBUG=1 is optional and enables debug logging for some output\n * in case things don't function as expected\n */\n\nimport { autoSetupPolly, filterRecording } from \"../utils/AutoSetupPolly\";\nimport * as ConfigOps from \"./ConfigOps\";\nimport { state } from \"../index\";\nimport Constants from '../shared/Constants';\n\nconst ctx = autoSetupPolly();\n\ndescribe('ConfigOps', () => {\n beforeEach(async () => {\n if (process.env.FRODO_POLLY_MODE === 'record') {\n ctx.polly.server.any().on('beforePersist', (_req, recording) => {\n filterRecording(recording);\n });\n }\n });\n describe('exportFullConfiguration()', () => {\n test('0: Method is implemented', async () => {\n expect(ConfigOps.exportFullConfiguration).toBeDefined();\n });\n\n test('1: Export everything with string arrays and decoding and coords', async () => {\n // Set deployment type to cloud since it is necessary for exporting applications correctly. It does this automatically when recording the mock, but not when running the test after recording\n state.setDeploymentType(Constants.CLOUD_DEPLOYMENT_TYPE_KEY);\n const response = await ConfigOps.exportFullConfiguration({ options: { useStringArrays: true, noDecode: false, coords: true }, state });\n expect(response).toMatchSnapshot({\n meta: expect.any(Object)\n });\n });\n\n test('2: Export everything without string arrays and decoding and coords', async () => {\n // Set deployment type to cloud since it is necessary for exporting applications correctly. It does this automatically when recording the mock, but not when running the test after recording\n state.setDeploymentType(Constants.CLOUD_DEPLOYMENT_TYPE_KEY);\n const response = await ConfigOps.exportFullConfiguration({ options: { useStringArrays: false, noDecode: true, coords: false }, state });\n expect(response).toMatchSnapshot({\n meta: expect.any(Object)\n });\n });\n });\n\n describe('importFullConfiguration()', () => {\n test('0: Method is implemented', async () => {\n expect(ConfigOps.importFullConfiguration).toBeDefined();\n });\n // TODO: Write tests for full import\n });\n});\n"],"mappings":";;;;;;;;;;sYAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOA,IAAMA,GAAG,GAAG,IAAAC,8BAAc,EAAC,CAAC;AAE5BC,QAAQ,CAAC,WAAW,EAAE,MAAM;EAC1BC,UAAU,eAAAC,iBAAA,CAAC,aAAY;IACrB,IAAIC,OAAO,CAACC,GAAG,CAACC,gBAAgB,KAAK,QAAQ,EAAE;MAC7CP,GAAG,CAACQ,KAAK,CAACC,MAAM,CAACC,GAAG,CAAC,CAAC,CAACC,EAAE,CAAC,eAAe,EAAE,CAACC,IAAI,EAAEC,SAAS,KAAK;QAC9D,IAAAC,+BAAe,EAACD,SAAS,CAAC;MAC5B,CAAC,CAAC;IACJ;EACF,CAAC,EAAC;EACFX,QAAQ,CAAC,2BAA2B,EAAE,MAAM;IAC1Ca,IAAI,CAAC,0BAA0B,eAAAX,iBAAA,CAAE,aAAY;MAC3CY,MAAM,CAACC,SAAS,CAACC,uBAAuB,CAAC,CAACC,WAAW,CAAC,CAAC;IACzD,CAAC,EAAC;IAEFJ,IAAI,CAAC,iEAAiE,eAAAX,iBAAA,CAAE,aAAY;MAClF;MACAgB,YAAK,CAACC,iBAAiB,CAACC,kBAAS,CAACC,yBAAyB,CAAC;MAC5D,IAAMC,QAAQ,SAASP,SAAS,CAACC,uBAAuB,CAAC;QAAEO,OAAO,EAAE;UAAEC,eAAe,EAAE,IAAI;UAAEC,QAAQ,EAAE,KAAK;UAAEC,MAAM,EAAE;QAAK,CAAC;QAAER,KAAK,EAALA;MAAM,CAAC,CAAC;MACtIJ,MAAM,CAACQ,QAAQ,CAAC,CAACK,eAAe,CAAC;QAC/BC,IAAI,EA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