@rockcarver/frodo-lib 0.19.0 → 0.19.2
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 +32 -1
- package/cjs/api/ApiTypes.js.map +1 -1
- package/cjs/api/cloud/LogApi.js +39 -4
- package/cjs/api/cloud/LogApi.js.map +1 -1
- package/cjs/ops/PolicyOps.js +105 -47
- package/cjs/ops/PolicyOps.js.map +1 -1
- package/cjs/ops/PolicyOps.test.js.map +1 -1
- package/cjs/ops/PolicySetOps.js +102 -51
- package/cjs/ops/PolicySetOps.js.map +1 -1
- package/cjs/ops/PolicySetOps.test.js.map +1 -1
- package/cjs/ops/cloud/LogOps.js +57 -137
- package/cjs/ops/cloud/LogOps.js.map +1 -1
- package/cjs/ops/utils/ExportImportUtils.js +1 -6
- package/cjs/ops/utils/ExportImportUtils.js.map +1 -1
- package/esm/api/cloud/LogApi.mjs +42 -4
- package/esm/ops/PolicyOps.mjs +77 -27
- package/esm/ops/PolicyOps.test.mjs +21 -7
- package/esm/ops/PolicySetOps.mjs +80 -36
- package/esm/ops/PolicySetOps.test.mjs +12 -4
- package/esm/ops/cloud/LogOps.mjs +35 -116
- package/esm/ops/utils/ExportImportUtils.mjs +1 -5
- package/package.json +1 -1
- package/types/api/ApiTypes.d.ts +23 -0
- package/types/api/ApiTypes.d.ts.map +1 -1
- package/types/api/cloud/LogApi.d.ts +28 -5
- package/types/api/cloud/LogApi.d.ts.map +1 -1
- package/types/ops/PolicyOps.d.ts +23 -11
- package/types/ops/PolicyOps.d.ts.map +1 -1
- package/types/ops/PolicySetOps.d.ts +21 -13
- package/types/ops/PolicySetOps.d.ts.map +1 -1
- package/types/ops/cloud/LogOps.d.ts +30 -7
- package/types/ops/cloud/LogOps.d.ts.map +1 -1
- package/types/ops/utils/ExportImportUtils.d.ts +0 -1
- package/types/ops/utils/ExportImportUtils.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,33 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.19.2] - 2023-05-25
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- \#248: Frodo Library now exports all essential log api functions through the LogOps module export `Log`.
|
|
15
|
+
|
|
16
|
+
## [0.19.1] - 2023-05-21
|
|
17
|
+
|
|
18
|
+
### Added
|
|
19
|
+
|
|
20
|
+
- Support for authorization policies, policy sets, and resource types through new exported modules:
|
|
21
|
+
- ResourceType
|
|
22
|
+
- PolicySet
|
|
23
|
+
- Policy
|
|
24
|
+
|
|
25
|
+
### Changed
|
|
26
|
+
|
|
27
|
+
- Updated dependencies
|
|
28
|
+
- rockcarver/frodo-cli#213: More debug logging for connection profile lookup by a unique substring. Use --debug to see the additional output. This is not yet a solution for rockcarver/frodo-cli#213 but should help identify the root cause.
|
|
29
|
+
- rockcarver/frodo-cli#216: More debug logging for the 2fa process and proper detection of unsupported webauthn factor.
|
|
30
|
+
|
|
31
|
+
### Fixed
|
|
32
|
+
|
|
33
|
+
- \#236: Frodo now properly handles logging in as a tenant admin when admin federation is enabled.
|
|
34
|
+
- \#225: Always output original log event JSON in tailLogs function (`frodo logs tail` command in the cli)
|
|
35
|
+
- rockcarver/frodo-cli#218: Frodo now allows 3 errors when polling for status during a `frodo esv apply` before aborting.
|
|
36
|
+
|
|
10
37
|
## [0.19.0] - 2023-05-21
|
|
11
38
|
|
|
12
39
|
### Added
|
|
@@ -1122,7 +1149,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
1122
1149
|
- Fixed problem with adding connection profiles
|
|
1123
1150
|
- Miscellaneous bug fixes
|
|
1124
1151
|
|
|
1125
|
-
[Unreleased]: https://github.com/rockcarver/frodo-lib/compare/v0.19.
|
|
1152
|
+
[Unreleased]: https://github.com/rockcarver/frodo-lib/compare/v0.19.2...HEAD
|
|
1153
|
+
|
|
1154
|
+
[0.19.2]: https://github.com/rockcarver/frodo-lib/compare/v0.19.1...v0.19.2
|
|
1155
|
+
|
|
1156
|
+
[0.19.1]: https://github.com/rockcarver/frodo-lib/compare/v0.19.0...v0.19.1
|
|
1126
1157
|
|
|
1127
1158
|
[0.19.0]: https://github.com/rockcarver/frodo-lib/compare/v0.18.9-7...v0.19.0
|
|
1128
1159
|
|
package/cjs/api/ApiTypes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiTypes.js","names":["PolicyConditionType","exports","ScriptLanguage","ScriptContext","Saml2ProiderLocation"],"sources":["api/ApiTypes.ts"],"sourcesContent":["export interface NoIdObjectSkeletonInterface {\n _rev?: number;\n [k: string]:\n | string\n | number\n | boolean\n | string[]\n | IdObjectSkeletonInterface\n | object\n | null;\n}\n\nexport interface IdObjectSkeletonInterface extends NoIdObjectSkeletonInterface {\n _id: string;\n}\n\nexport interface PagedResults {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n result: any[];\n resultCount: number;\n pagedResultsCookie: string;\n totalPagedResultsPolicy: string;\n totalPagedResults: number;\n remainingPagedResults: number;\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 = IdObjectSkeletonInterface & {\n entryNodeId: string;\n nodes: Record<string, NodeRefSkeletonInterface>;\n identityResource?: string;\n uiConfig?: UiConfigInterface;\n enabled?: boolean;\n};\n\nexport type AmServiceType = IdObjectSkeletonInterface & {\n name: string;\n};\n\nexport type NodeSkeleton = IdObjectSkeletonInterface & {\n _type: AmServiceType;\n nodes?: InnerNodeRefSkeletonInterface[];\n tree?: string;\n identityResource?: string;\n};\n\nexport type SocialIdpSkeleton = IdObjectSkeletonInterface & {\n _type: AmServiceType;\n enabled: boolean;\n};\n\nexport type PolicySetSkeleton = NoIdObjectSkeletonInterface & {\n name: string;\n resourceTypeUuids: string[];\n};\n\nexport type ResourceTypeSkeleton = NoIdObjectSkeletonInterface & {\n uuid: string;\n name: string;\n};\n\nexport enum PolicyConditionType {\n Script = 'Script',\n AMIdentityMembership = 'AMIdentityMembership',\n IPv6 = 'IPv6',\n IPv4 = 'IPv4',\n SimpleTime = 'SimpleTime',\n LEAuthLevel = 'LEAuthLevel',\n LDAPFilter = 'LDAPFilter',\n AuthScheme = 'AuthScheme',\n Session = 'Session',\n AND = 'AND',\n AuthenticateToRealm = 'AuthenticateToRealm',\n ResourceEnvIP = 'ResourceEnvIP',\n Policy = 'Policy',\n OAuth2Scope = 'OAuth2Scope',\n SessionProperty = 'SessionProperty',\n OR = 'OR',\n Transaction = 'Transaction',\n NOT = 'NOT',\n AuthLevel = 'AuthLevel',\n AuthenticateToService = 'AuthenticateToService',\n}\n\nexport type PolicyCondition = NoIdObjectSkeletonInterface & {\n type: keyof typeof PolicyConditionType;\n condition?: PolicyCondition;\n conditions?: PolicyCondition[];\n};\n\nexport type PolicySkeleton = IdObjectSkeletonInterface & {\n name: string;\n applicationName: string;\n condition?: PolicyCondition;\n resourceTypeUuid: string;\n};\n\nexport type OAuth2ClientSkeleton = IdObjectSkeletonInterface & {\n overrideOAuth2ClientConfig?: {\n [k: string]: string | number | boolean | string[] | object | null;\n };\n advancedOAuth2ClientConfig?: {\n descriptions: {\n inherited: boolean;\n value: string[];\n };\n [k: string]: string | number | boolean | string[] | object | null;\n };\n signEncOAuth2ClientConfig?: {\n [k: string]: string | number | boolean | string[] | object | null;\n };\n coreOpenIDClientConfig?: {\n [k: string]: string | number | boolean | string[] | object | null;\n };\n coreOAuth2ClientConfig?: {\n userpassword?: null;\n clientName?: {\n inherited: boolean;\n value: string[];\n };\n accessTokenLifetime?: {\n inherited: boolean;\n value: number;\n };\n [k: string]: string | number | boolean | string[] | object | null;\n };\n coreUmaClientConfig?: {\n [k: string]: string | number | boolean | string[] | object | null;\n };\n _type: AmServiceType;\n};\n\nexport type AmServiceSkeleton = IdObjectSkeletonInterface & {\n _type: AmServiceType;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key: string]: any;\n};\n\nexport type AgentSkeleton = IdObjectSkeletonInterface & {\n _type: AmServiceType;\n};\n\nexport type EmailTemplateSkeleton = IdObjectSkeletonInterface & {\n defaultLocale?: string;\n displayName?: string;\n enabled?: boolean;\n from: string;\n subject: Record<string, string>;\n message?: Record<string, string>;\n html?: Record<string, string>;\n};\n\nexport type ThemeSkeleton = IdObjectSkeletonInterface & {\n name: string;\n isDefault: boolean;\n linkedTrees: string[];\n};\n\nexport type UiThemeRealmObject = IdObjectSkeletonInterface & {\n name: string;\n realm: Map<string, ThemeSkeleton[]>;\n};\n\nexport enum ScriptLanguage {\n GROOVY,\n JAVASCRIPT,\n}\n\nexport enum ScriptContext {\n OAUTH2_ACCESS_TOKEN_MODIFICATION,\n AUTHENTICATION_CLIENT_SIDE,\n AUTHENTICATION_TREE_DECISION_NODE,\n AUTHENTICATION_SERVER_SIDE,\n SOCIAL_IDP_PROFILE_TRANSFORMATION,\n OAUTH2_VALIDATE_SCOPE,\n CONFIG_PROVIDER_NODE,\n OAUTH2_AUTHORIZE_ENDPOINT_DATA_PROVIDER,\n OAUTH2_EVALUATE_SCOPE,\n POLICY_CONDITION,\n OIDC_CLAIMS,\n SAML2_IDP_ADAPTER,\n SAML2_IDP_ATTRIBUTE_MAPPER,\n OAUTH2_MAY_ACT,\n}\n\nexport type ScriptSkeleton = IdObjectSkeletonInterface & {\n name: string;\n description: string;\n default: boolean;\n script: string | string[];\n language: keyof typeof ScriptLanguage;\n context: keyof typeof 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 = IdObjectSkeletonInterface & {\n entityId: string;\n location: Saml2ProiderLocation;\n roles: string[];\n};\n\nexport type Saml2ProviderSkeleton = IdObjectSkeletonInterface & {\n entityId: string;\n entityLocation: Saml2ProiderLocation;\n serviceProvider: unknown;\n identityProvider: unknown;\n attributeQueryProvider: unknown;\n xacmlPolicyEnforcementPoint: unknown;\n};\n\nexport type CircleOfTrustSkeleton = IdObjectSkeletonInterface & {\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":";;;;;;IA8EYA,mBAAmB,0BAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAA,OAAnBA,mBAAmB;AAAA;AAAAC,OAAA,CAAAD,mBAAA,GAAAA,mBAAA;AAAA,IAsGnBE,cAAc,0BAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA;AAAAD,OAAA,CAAAC,cAAA,GAAAA,cAAA;AAAA,IAKdC,aAAa,0BAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAA,OAAbA,aAAa;AAAA;AAAAF,OAAA,CAAAE,aAAA,GAAAA,aAAA;AAAA,IA8BbC,oBAAoB,0BAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAAA,OAApBA,oBAAoB;AAAA;AAAAH,OAAA,CAAAG,oBAAA,GAAAA,oBAAA"}
|
|
1
|
+
{"version":3,"file":"ApiTypes.js","names":["PolicyConditionType","exports","ScriptLanguage","ScriptContext","Saml2ProiderLocation"],"sources":["api/ApiTypes.ts"],"sourcesContent":["export interface NoIdObjectSkeletonInterface {\n _rev?: number;\n [k: string]:\n | string\n | number\n | boolean\n | string[]\n | IdObjectSkeletonInterface\n | object\n | null;\n}\n\nexport interface IdObjectSkeletonInterface extends NoIdObjectSkeletonInterface {\n _id: string;\n}\n\nexport interface PagedResults {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n result: any[];\n resultCount: number;\n pagedResultsCookie: string;\n totalPagedResultsPolicy: string;\n totalPagedResults: number;\n remainingPagedResults: number;\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 = IdObjectSkeletonInterface & {\n entryNodeId: string;\n nodes: Record<string, NodeRefSkeletonInterface>;\n identityResource?: string;\n uiConfig?: UiConfigInterface;\n enabled?: boolean;\n};\n\nexport type AmServiceType = IdObjectSkeletonInterface & {\n name: string;\n};\n\nexport type NodeSkeleton = IdObjectSkeletonInterface & {\n _type: AmServiceType;\n nodes?: InnerNodeRefSkeletonInterface[];\n tree?: string;\n identityResource?: string;\n};\n\nexport type SocialIdpSkeleton = IdObjectSkeletonInterface & {\n _type: AmServiceType;\n enabled: boolean;\n};\n\nexport type PolicySetSkeleton = NoIdObjectSkeletonInterface & {\n name: string;\n resourceTypeUuids: string[];\n};\n\nexport type ResourceTypeSkeleton = NoIdObjectSkeletonInterface & {\n uuid: string;\n name: string;\n};\n\nexport enum PolicyConditionType {\n Script = 'Script',\n AMIdentityMembership = 'AMIdentityMembership',\n IPv6 = 'IPv6',\n IPv4 = 'IPv4',\n SimpleTime = 'SimpleTime',\n LEAuthLevel = 'LEAuthLevel',\n LDAPFilter = 'LDAPFilter',\n AuthScheme = 'AuthScheme',\n Session = 'Session',\n AND = 'AND',\n AuthenticateToRealm = 'AuthenticateToRealm',\n ResourceEnvIP = 'ResourceEnvIP',\n Policy = 'Policy',\n OAuth2Scope = 'OAuth2Scope',\n SessionProperty = 'SessionProperty',\n OR = 'OR',\n Transaction = 'Transaction',\n NOT = 'NOT',\n AuthLevel = 'AuthLevel',\n AuthenticateToService = 'AuthenticateToService',\n}\n\nexport type PolicyCondition = NoIdObjectSkeletonInterface & {\n type: keyof typeof PolicyConditionType;\n condition?: PolicyCondition;\n conditions?: PolicyCondition[];\n};\n\nexport type PolicySkeleton = IdObjectSkeletonInterface & {\n name: string;\n applicationName: string;\n condition?: PolicyCondition;\n resourceTypeUuid: string;\n};\n\nexport type OAuth2ClientSkeleton = IdObjectSkeletonInterface & {\n overrideOAuth2ClientConfig?: {\n [k: string]: string | number | boolean | string[] | object | null;\n };\n advancedOAuth2ClientConfig?: {\n descriptions: {\n inherited: boolean;\n value: string[];\n };\n [k: string]: string | number | boolean | string[] | object | null;\n };\n signEncOAuth2ClientConfig?: {\n [k: string]: string | number | boolean | string[] | object | null;\n };\n coreOpenIDClientConfig?: {\n [k: string]: string | number | boolean | string[] | object | null;\n };\n coreOAuth2ClientConfig?: {\n userpassword?: null;\n clientName?: {\n inherited: boolean;\n value: string[];\n };\n accessTokenLifetime?: {\n inherited: boolean;\n value: number;\n };\n [k: string]: string | number | boolean | string[] | object | null;\n };\n coreUmaClientConfig?: {\n [k: string]: string | number | boolean | string[] | object | null;\n };\n _type: AmServiceType;\n};\n\nexport type AmServiceSkeleton = IdObjectSkeletonInterface & {\n _type: AmServiceType;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key: string]: any;\n};\n\nexport type AgentSkeleton = IdObjectSkeletonInterface & {\n _type: AmServiceType;\n};\n\nexport type EmailTemplateSkeleton = IdObjectSkeletonInterface & {\n defaultLocale?: string;\n displayName?: string;\n enabled?: boolean;\n from: string;\n subject: Record<string, string>;\n message?: Record<string, string>;\n html?: Record<string, string>;\n};\n\nexport type ThemeSkeleton = IdObjectSkeletonInterface & {\n name: string;\n isDefault: boolean;\n linkedTrees: string[];\n};\n\nexport type UiThemeRealmObject = IdObjectSkeletonInterface & {\n name: string;\n realm: Map<string, ThemeSkeleton[]>;\n};\n\nexport enum ScriptLanguage {\n GROOVY,\n JAVASCRIPT,\n}\n\nexport enum ScriptContext {\n OAUTH2_ACCESS_TOKEN_MODIFICATION,\n AUTHENTICATION_CLIENT_SIDE,\n AUTHENTICATION_TREE_DECISION_NODE,\n AUTHENTICATION_SERVER_SIDE,\n SOCIAL_IDP_PROFILE_TRANSFORMATION,\n OAUTH2_VALIDATE_SCOPE,\n CONFIG_PROVIDER_NODE,\n OAUTH2_AUTHORIZE_ENDPOINT_DATA_PROVIDER,\n OAUTH2_EVALUATE_SCOPE,\n POLICY_CONDITION,\n OIDC_CLAIMS,\n SAML2_IDP_ADAPTER,\n SAML2_IDP_ATTRIBUTE_MAPPER,\n OAUTH2_MAY_ACT,\n}\n\nexport type ScriptSkeleton = IdObjectSkeletonInterface & {\n name: string;\n description: string;\n default: boolean;\n script: string | string[];\n language: keyof typeof ScriptLanguage;\n context: keyof typeof 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 = IdObjectSkeletonInterface & {\n entityId: string;\n location: Saml2ProiderLocation;\n roles: string[];\n};\n\nexport type Saml2ProviderSkeleton = IdObjectSkeletonInterface & {\n entityId: string;\n entityLocation: Saml2ProiderLocation;\n serviceProvider: unknown;\n identityProvider: unknown;\n attributeQueryProvider: unknown;\n xacmlPolicyEnforcementPoint: unknown;\n};\n\nexport type CircleOfTrustSkeleton = IdObjectSkeletonInterface & {\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\nexport type LogApiKey = {\n name: string;\n api_key_id: string;\n created_at: string;\n};\n\nexport type LogEventPayloadSkeleton = NoIdObjectSkeletonInterface & {\n context: string;\n level: string;\n logger: string;\n mdc: {\n transactionId: string;\n };\n message: string;\n thread: string;\n timestamp: string;\n transactionId: string;\n};\n\nexport type LogEventSkeleton = NoIdObjectSkeletonInterface & {\n payload: string | LogEventPayloadSkeleton;\n timestamp: string;\n type: string;\n source: string;\n};\n"],"mappings":";;;;;;IA8EYA,mBAAmB,0BAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAA,OAAnBA,mBAAmB;AAAA;AAAAC,OAAA,CAAAD,mBAAA,GAAAA,mBAAA;AAAA,IAsGnBE,cAAc,0BAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA;AAAAD,OAAA,CAAAC,cAAA,GAAAA,cAAA;AAAA,IAKdC,aAAa,0BAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAA,OAAbA,aAAa;AAAA;AAAAF,OAAA,CAAAE,aAAA,GAAAA,aAAA;AAAA,IA8BbC,oBAAoB,0BAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAAA,OAApBA,oBAAoB;AAAA;AAAAH,OAAA,CAAAG,oBAAA,GAAAA,oBAAA"}
|
package/cjs/api/cloud/LogApi.js
CHANGED
|
@@ -22,9 +22,18 @@ var logsFetchURLTemplate = '%s/monitoring/logs?source=%s&beginTime=%s&endTime=%s
|
|
|
22
22
|
var logsSourcesURLTemplate = '%s/monitoring/logs/sources';
|
|
23
23
|
var logsCreateAPIKeyAndSecretURLTemplate = '%s/keys?_action=create';
|
|
24
24
|
var logsGetAPIKeysURLTemplate = '%s/keys';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Get available API keys
|
|
28
|
+
* @returns {Promise<PagedResult<LogApiKey>>} a promise resolving to a paged log api key results object
|
|
29
|
+
*/
|
|
25
30
|
function getAPIKeys() {
|
|
26
31
|
return _getAPIKeys.apply(this, arguments);
|
|
27
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Get available log sources
|
|
35
|
+
* @returns {Promise<PagedResult<string>>} a promise resolving to a paged string results object
|
|
36
|
+
*/
|
|
28
37
|
function _getAPIKeys() {
|
|
29
38
|
_getAPIKeys = _asyncToGenerator(function* () {
|
|
30
39
|
var urlString = _util.default.format(logsGetAPIKeysURLTemplate, (0, _ApiUtils.getTenantURL)(state.getHost()));
|
|
@@ -41,32 +50,55 @@ function getSources() {
|
|
|
41
50
|
function _getSources() {
|
|
42
51
|
_getSources = _asyncToGenerator(function* () {
|
|
43
52
|
var urlString = _util.default.format(logsSourcesURLTemplate, (0, _ApiUtils.getTenantURL)(state.getHost()));
|
|
44
|
-
|
|
53
|
+
var {
|
|
54
|
+
data
|
|
55
|
+
} = yield (0, _BaseApi.generateLogApi)().get(urlString);
|
|
56
|
+
return data;
|
|
45
57
|
});
|
|
46
58
|
return _getSources.apply(this, arguments);
|
|
47
59
|
}
|
|
48
60
|
function createAPIKeyAndSecret(_x) {
|
|
49
61
|
return _createAPIKeyAndSecret.apply(this, arguments);
|
|
50
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* Tail logs
|
|
65
|
+
* @param {string} source log source(s) to tail
|
|
66
|
+
* @param {string} cookie paged results cookie
|
|
67
|
+
* @returns {Promise<PagedResult<LogEventSkeleton>>} promise resolving to paged log event result
|
|
68
|
+
*/
|
|
51
69
|
function _createAPIKeyAndSecret() {
|
|
52
70
|
_createAPIKeyAndSecret = _asyncToGenerator(function* (keyName) {
|
|
53
71
|
var urlString = _util.default.format(logsCreateAPIKeyAndSecretURLTemplate, (0, _ApiUtils.getTenantURL)(state.getHost()));
|
|
54
|
-
|
|
72
|
+
var {
|
|
73
|
+
data
|
|
74
|
+
} = yield (0, _BaseApi.generateLogKeysApi)().post(urlString, {
|
|
55
75
|
name: keyName
|
|
56
76
|
});
|
|
77
|
+
return data;
|
|
57
78
|
});
|
|
58
79
|
return _createAPIKeyAndSecret.apply(this, arguments);
|
|
59
80
|
}
|
|
60
81
|
function tail(_x2, _x3) {
|
|
61
82
|
return _tail.apply(this, arguments);
|
|
62
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* Fetch logs
|
|
86
|
+
* @param {string} source log source(s) to tail
|
|
87
|
+
* @param {string} startTs start timestamp
|
|
88
|
+
* @param {string} endTs end timestamp
|
|
89
|
+
* @param {string} cookie paged results cookie
|
|
90
|
+
* @returns {Promise<PagedResult<LogEventSkeleton>>} promise resolving to paged log event result
|
|
91
|
+
*/
|
|
63
92
|
function _tail() {
|
|
64
93
|
_tail = _asyncToGenerator(function* (source, cookie) {
|
|
65
94
|
var urlString = _util.default.format(logsTailURLTemplate, (0, _ApiUtils.getTenantURL)(state.getHost()), encodeURIComponent(source));
|
|
66
95
|
if (cookie) {
|
|
67
96
|
urlString += "&_pagedResultsCookie=".concat(encodeURIComponent(cookie));
|
|
68
97
|
}
|
|
69
|
-
|
|
98
|
+
var {
|
|
99
|
+
data
|
|
100
|
+
} = yield (0, _BaseApi.generateLogApi)().get(urlString);
|
|
101
|
+
return data;
|
|
70
102
|
});
|
|
71
103
|
return _tail.apply(this, arguments);
|
|
72
104
|
}
|
|
@@ -79,9 +111,12 @@ function _fetch() {
|
|
|
79
111
|
if (cookie) {
|
|
80
112
|
urlString += "&_pagedResultsCookie=".concat(encodeURIComponent(cookie));
|
|
81
113
|
}
|
|
82
|
-
|
|
114
|
+
var {
|
|
115
|
+
data
|
|
116
|
+
} = yield (0, _BaseApi.generateLogApi)({
|
|
83
117
|
timeout: 60000
|
|
84
118
|
}).get(urlString);
|
|
119
|
+
return data;
|
|
85
120
|
});
|
|
86
121
|
return _fetch.apply(this, arguments);
|
|
87
122
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LogApi.js","names":["_util","_interopRequireDefault","require","_BaseApi","_ApiUtils","state","_interopRequireWildcard","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","asyncGeneratorStep","gen","resolve","reject","_next","_throw","arg","info","value","error","done","Promise","then","_asyncToGenerator","fn","self","args","arguments","apply","err","undefined","logsTailURLTemplate","logsFetchURLTemplate","logsSourcesURLTemplate","logsCreateAPIKeyAndSecretURLTemplate","logsGetAPIKeysURLTemplate","getAPIKeys","_getAPIKeys","urlString","util","format","getTenantURL","getHost","data","generateLogKeysApi","getSources","_getSources","generateLogApi","createAPIKeyAndSecret","_x","_createAPIKeyAndSecret","keyName","post","name","tail","_x2","_x3","_tail","source","cookie","encodeURIComponent","concat","fetch","_x4","_x5","_x6","_x7","_fetch","startTs","endTs","timeout"],"sources":["api/cloud/LogApi.ts"],"sourcesContent":["import util from 'util';\nimport { generateLogApi, generateLogKeysApi } from '../BaseApi';\nimport { getTenantURL } from '../utils/ApiUtils';\nimport * as state from '../../shared/State';\n\nconst logsTailURLTemplate = '%s/monitoring/logs/tail?source=%s';\nconst logsFetchURLTemplate =\n '%s/monitoring/logs?source=%s&beginTime=%s&endTime=%s';\nconst logsSourcesURLTemplate = '%s/monitoring/logs/sources';\nconst logsCreateAPIKeyAndSecretURLTemplate = '%s/keys?_action=create';\nconst logsGetAPIKeysURLTemplate = '%s/keys';\n\nexport async function getAPIKeys() {\n const urlString = util.format(\n logsGetAPIKeysURLTemplate,\n getTenantURL(state.getHost())\n );\n const { data } = await generateLogKeysApi().get(urlString);\n return data;\n}\n\nexport async function getSources() {\n const urlString = util.format(\n logsSourcesURLTemplate,\n getTenantURL(state.getHost())\n );\n
|
|
1
|
+
{"version":3,"file":"LogApi.js","names":["_util","_interopRequireDefault","require","_BaseApi","_ApiUtils","state","_interopRequireWildcard","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","asyncGeneratorStep","gen","resolve","reject","_next","_throw","arg","info","value","error","done","Promise","then","_asyncToGenerator","fn","self","args","arguments","apply","err","undefined","logsTailURLTemplate","logsFetchURLTemplate","logsSourcesURLTemplate","logsCreateAPIKeyAndSecretURLTemplate","logsGetAPIKeysURLTemplate","getAPIKeys","_getAPIKeys","urlString","util","format","getTenantURL","getHost","data","generateLogKeysApi","getSources","_getSources","generateLogApi","createAPIKeyAndSecret","_x","_createAPIKeyAndSecret","keyName","post","name","tail","_x2","_x3","_tail","source","cookie","encodeURIComponent","concat","fetch","_x4","_x5","_x6","_x7","_fetch","startTs","endTs","timeout"],"sources":["api/cloud/LogApi.ts"],"sourcesContent":["import util from 'util';\nimport { generateLogApi, generateLogKeysApi } from '../BaseApi';\nimport { getTenantURL } from '../utils/ApiUtils';\nimport * as state from '../../shared/State';\nimport { LogApiKey, LogEventSkeleton, PagedResult } from '../ApiTypes';\n\nconst logsTailURLTemplate = '%s/monitoring/logs/tail?source=%s';\nconst logsFetchURLTemplate =\n '%s/monitoring/logs?source=%s&beginTime=%s&endTime=%s';\nconst logsSourcesURLTemplate = '%s/monitoring/logs/sources';\nconst logsCreateAPIKeyAndSecretURLTemplate = '%s/keys?_action=create';\nconst logsGetAPIKeysURLTemplate = '%s/keys';\n\n/**\n * Get available API keys\n * @returns {Promise<PagedResult<LogApiKey>>} a promise resolving to a paged log api key results object\n */\nexport async function getAPIKeys(): Promise<PagedResult<LogApiKey>> {\n const urlString = util.format(\n logsGetAPIKeysURLTemplate,\n getTenantURL(state.getHost())\n );\n const { data } = await generateLogKeysApi().get(urlString);\n return data;\n}\n\n/**\n * Get available log sources\n * @returns {Promise<PagedResult<string>>} a promise resolving to a paged string results object\n */\nexport async function getSources(): Promise<PagedResult<string>> {\n const urlString = util.format(\n logsSourcesURLTemplate,\n getTenantURL(state.getHost())\n );\n const { data } = await generateLogApi().get(urlString);\n return data;\n}\n\nexport async function createAPIKeyAndSecret(keyName: string) {\n const urlString = util.format(\n logsCreateAPIKeyAndSecretURLTemplate,\n getTenantURL(state.getHost())\n );\n const { data } = await generateLogKeysApi().post(urlString, {\n name: keyName,\n });\n return data;\n}\n\n/**\n * Tail logs\n * @param {string} source log source(s) to tail\n * @param {string} cookie paged results cookie\n * @returns {Promise<PagedResult<LogEventSkeleton>>} promise resolving to paged log event result\n */\nexport async function tail(\n source: string,\n cookie: string\n): Promise<PagedResult<LogEventSkeleton>> {\n let urlString = util.format(\n logsTailURLTemplate,\n getTenantURL(state.getHost()),\n encodeURIComponent(source)\n );\n if (cookie) {\n urlString += `&_pagedResultsCookie=${encodeURIComponent(cookie)}`;\n }\n const { data } = await generateLogApi().get(urlString);\n return data as PagedResult<LogEventSkeleton>;\n}\n\n/**\n * Fetch logs\n * @param {string} source log source(s) to tail\n * @param {string} startTs start timestamp\n * @param {string} endTs end timestamp\n * @param {string} cookie paged results cookie\n * @returns {Promise<PagedResult<LogEventSkeleton>>} promise resolving to paged log event result\n */\nexport async function fetch(\n source: string,\n startTs: string,\n endTs: string,\n cookie: string\n): Promise<PagedResult<LogEventSkeleton>> {\n let urlString = util.format(\n logsFetchURLTemplate,\n getTenantURL(state.getHost()),\n encodeURIComponent(source),\n startTs,\n endTs\n );\n if (cookie) {\n urlString += `&_pagedResultsCookie=${encodeURIComponent(cookie)}`;\n }\n const { data } = await generateLogApi({ timeout: 60000 }).get(urlString);\n return data as PagedResult<LogEventSkeleton>;\n}\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAC,uBAAA,CAAAJ,OAAA;AAA4C,SAAAK,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,WAAA,WAAAA,WAAA,GAAAG,g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AwB,MAAA,CAAAvC,KAAA,OAAAD,SAAA;AAAA"}
|
package/cjs/ops/PolicyOps.js
CHANGED
|
@@ -232,17 +232,18 @@ function _getScripts() {
|
|
|
232
232
|
});
|
|
233
233
|
return _getScripts.apply(this, arguments);
|
|
234
234
|
}
|
|
235
|
-
function
|
|
236
|
-
return
|
|
235
|
+
function exportPolicyPrerequisites(_x7, _x8) {
|
|
236
|
+
return _exportPolicyPrerequisites.apply(this, arguments);
|
|
237
237
|
}
|
|
238
238
|
/**
|
|
239
|
-
*
|
|
240
|
-
* @param {
|
|
241
|
-
* @
|
|
239
|
+
* Helper function to export dependencies of a policy set
|
|
240
|
+
* @param {unknown} policyData policy set data
|
|
241
|
+
* @param {PolicyExportOptions} options export options
|
|
242
|
+
* @param {PolicyExportInterface} exportData export data
|
|
242
243
|
*/
|
|
243
|
-
function
|
|
244
|
-
|
|
245
|
-
(0, _Console.debugMessage)("PolicyOps.
|
|
244
|
+
function _exportPolicyPrerequisites() {
|
|
245
|
+
_exportPolicyPrerequisites = _asyncToGenerator(function* (policyData, exportData) {
|
|
246
|
+
(0, _Console.debugMessage)("PolicyOps.exportPolicyPrerequisites: start [policy=".concat(policyData['name'], "]"));
|
|
246
247
|
// resource types
|
|
247
248
|
if (policyData.resourceTypeUuid) {
|
|
248
249
|
var resourceType = yield (0, _ResourceTypesApi.getResourceType)(policyData.resourceTypeUuid);
|
|
@@ -253,6 +254,21 @@ function _exportPolicyDependencies() {
|
|
|
253
254
|
var policySet = yield (0, _PolicySetOps.getPolicySet)(policyData.applicationName);
|
|
254
255
|
exportData.policyset[policyData.applicationName] = policySet;
|
|
255
256
|
}
|
|
257
|
+
(0, _Console.debugMessage)("PolicySetOps.exportPolicyPrerequisites: end");
|
|
258
|
+
});
|
|
259
|
+
return _exportPolicyPrerequisites.apply(this, arguments);
|
|
260
|
+
}
|
|
261
|
+
function exportPolicyDependencies(_x9, _x10, _x11) {
|
|
262
|
+
return _exportPolicyDependencies.apply(this, arguments);
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Export policy
|
|
266
|
+
* @param {string} policyId policy id/name
|
|
267
|
+
* @returns {Promise<PolicyExportInterface>} a promise that resolves to a PolicyExportInterface object
|
|
268
|
+
*/
|
|
269
|
+
function _exportPolicyDependencies() {
|
|
270
|
+
_exportPolicyDependencies = _asyncToGenerator(function* (policyData, options, exportData) {
|
|
271
|
+
(0, _Console.debugMessage)("PolicyOps.exportPolicyDependencies: start [policy=".concat(policyData['name'], "]"));
|
|
256
272
|
// scripts
|
|
257
273
|
var scripts = yield getScripts(policyData);
|
|
258
274
|
for (var scriptData of scripts) {
|
|
@@ -265,7 +281,7 @@ function _exportPolicyDependencies() {
|
|
|
265
281
|
});
|
|
266
282
|
return _exportPolicyDependencies.apply(this, arguments);
|
|
267
283
|
}
|
|
268
|
-
function exportPolicy(
|
|
284
|
+
function exportPolicy(_x12) {
|
|
269
285
|
return _exportPolicy.apply(this, arguments);
|
|
270
286
|
}
|
|
271
287
|
/**
|
|
@@ -274,11 +290,19 @@ function exportPolicy(_x10, _x11) {
|
|
|
274
290
|
* @returns {Promise<PolicyExportInterface>} a promise that resolves to an PolicyExportInterface object
|
|
275
291
|
*/
|
|
276
292
|
function _exportPolicy() {
|
|
277
|
-
_exportPolicy = _asyncToGenerator(function* (policyId
|
|
293
|
+
_exportPolicy = _asyncToGenerator(function* (policyId) {
|
|
294
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
295
|
+
deps: true,
|
|
296
|
+
prereqs: false,
|
|
297
|
+
useStringArrays: true
|
|
298
|
+
};
|
|
278
299
|
(0, _Console.debugMessage)("PolicyOps.exportPolicy: start");
|
|
279
300
|
var policyData = yield getPolicy(policyId);
|
|
280
301
|
var exportData = createPolicyExportTemplate();
|
|
281
302
|
exportData.policy[policyData._id] = policyData;
|
|
303
|
+
if (options.prereqs) {
|
|
304
|
+
yield exportPolicyPrerequisites(policyData, exportData);
|
|
305
|
+
}
|
|
282
306
|
if (options.deps) {
|
|
283
307
|
yield exportPolicyDependencies(policyData, options, exportData);
|
|
284
308
|
}
|
|
@@ -287,17 +311,22 @@ function _exportPolicy() {
|
|
|
287
311
|
});
|
|
288
312
|
return _exportPolicy.apply(this, arguments);
|
|
289
313
|
}
|
|
290
|
-
function exportPolicies(
|
|
314
|
+
function exportPolicies() {
|
|
291
315
|
return _exportPolicies.apply(this, arguments);
|
|
292
316
|
}
|
|
293
317
|
/**
|
|
294
318
|
* Export policies by policy set
|
|
295
|
-
* @param {string}
|
|
319
|
+
* @param {string} policySetName policy set id/name
|
|
296
320
|
* @param {PolicyExportOptions} options export options
|
|
297
321
|
* @returns {Promise<PolicyExportInterface>} a promise that resolves to an PolicyExportInterface object
|
|
298
322
|
*/
|
|
299
323
|
function _exportPolicies() {
|
|
300
|
-
_exportPolicies = _asyncToGenerator(function* (
|
|
324
|
+
_exportPolicies = _asyncToGenerator(function* () {
|
|
325
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
326
|
+
deps: true,
|
|
327
|
+
prereqs: false,
|
|
328
|
+
useStringArrays: true
|
|
329
|
+
};
|
|
301
330
|
(0, _Console.debugMessage)("PolicyOps.exportPolicies: start");
|
|
302
331
|
var exportData = createPolicyExportTemplate();
|
|
303
332
|
var errors = [];
|
|
@@ -305,6 +334,13 @@ function _exportPolicies() {
|
|
|
305
334
|
var policies = yield getPolicies();
|
|
306
335
|
for (var policyData of policies) {
|
|
307
336
|
exportData.policy[policyData._id] = policyData;
|
|
337
|
+
if (options.prereqs) {
|
|
338
|
+
try {
|
|
339
|
+
yield exportPolicyPrerequisites(policyData, exportData);
|
|
340
|
+
} catch (error) {
|
|
341
|
+
errors.push(error);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
308
344
|
if (options.deps) {
|
|
309
345
|
try {
|
|
310
346
|
yield exportPolicyDependencies(policyData, options, exportData);
|
|
@@ -325,7 +361,7 @@ function _exportPolicies() {
|
|
|
325
361
|
});
|
|
326
362
|
return _exportPolicies.apply(this, arguments);
|
|
327
363
|
}
|
|
328
|
-
function exportPoliciesByPolicySet(_x13
|
|
364
|
+
function exportPoliciesByPolicySet(_x13) {
|
|
329
365
|
return _exportPoliciesByPolicySet.apply(this, arguments);
|
|
330
366
|
}
|
|
331
367
|
/**
|
|
@@ -334,14 +370,26 @@ function exportPoliciesByPolicySet(_x13, _x14) {
|
|
|
334
370
|
* @param {PolicyExportInterface} exportData export data
|
|
335
371
|
*/
|
|
336
372
|
function _exportPoliciesByPolicySet() {
|
|
337
|
-
_exportPoliciesByPolicySet = _asyncToGenerator(function* (
|
|
373
|
+
_exportPoliciesByPolicySet = _asyncToGenerator(function* (policySetName) {
|
|
374
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
375
|
+
deps: true,
|
|
376
|
+
prereqs: false,
|
|
377
|
+
useStringArrays: true
|
|
378
|
+
};
|
|
338
379
|
(0, _Console.debugMessage)("PolicyOps.exportPolicies: start");
|
|
339
380
|
var exportData = createPolicyExportTemplate();
|
|
340
381
|
var errors = [];
|
|
341
382
|
try {
|
|
342
|
-
var policies = yield getPoliciesByPolicySet(
|
|
383
|
+
var policies = yield getPoliciesByPolicySet(policySetName);
|
|
343
384
|
for (var policyData of policies) {
|
|
344
385
|
exportData.policy[policyData._id] = policyData;
|
|
386
|
+
if (options.prereqs) {
|
|
387
|
+
try {
|
|
388
|
+
yield exportPolicyPrerequisites(policyData, exportData);
|
|
389
|
+
} catch (error) {
|
|
390
|
+
errors.push(error);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
345
393
|
if (options.deps) {
|
|
346
394
|
try {
|
|
347
395
|
yield exportPolicyDependencies(policyData, options, exportData);
|
|
@@ -362,16 +410,16 @@ function _exportPoliciesByPolicySet() {
|
|
|
362
410
|
});
|
|
363
411
|
return _exportPoliciesByPolicySet.apply(this, arguments);
|
|
364
412
|
}
|
|
365
|
-
function
|
|
366
|
-
return
|
|
413
|
+
function importPolicyPrerequisites(_x14, _x15) {
|
|
414
|
+
return _importPolicyPrerequisites.apply(this, arguments);
|
|
367
415
|
}
|
|
368
416
|
/**
|
|
369
417
|
* Helper function to import soft dependencies of a policy
|
|
370
418
|
* @param {PolicySkeleton} policyData policy object
|
|
371
419
|
* @param {PolicyExportInterface} exportData export data
|
|
372
420
|
*/
|
|
373
|
-
function
|
|
374
|
-
|
|
421
|
+
function _importPolicyPrerequisites() {
|
|
422
|
+
_importPolicyPrerequisites = _asyncToGenerator(function* (policyData, exportData) {
|
|
375
423
|
(0, _Console.debugMessage)("PolicyOps.importPolicyHardDependencies: start [policy=".concat(policyData._id, "]"));
|
|
376
424
|
var errors = [];
|
|
377
425
|
try {
|
|
@@ -409,20 +457,20 @@ function _importPolicyHardDependencies() {
|
|
|
409
457
|
}
|
|
410
458
|
(0, _Console.debugMessage)("PolicyOps.importPolicyHardDependencies: end");
|
|
411
459
|
});
|
|
412
|
-
return
|
|
460
|
+
return _importPolicyPrerequisites.apply(this, arguments);
|
|
413
461
|
}
|
|
414
|
-
function
|
|
415
|
-
return
|
|
462
|
+
function importPolicyDependencies(_x16, _x17) {
|
|
463
|
+
return _importPolicyDependencies.apply(this, arguments);
|
|
416
464
|
}
|
|
417
465
|
/**
|
|
418
466
|
* Import policy by id
|
|
419
|
-
* @param {string}
|
|
467
|
+
* @param {string} policyId policy id
|
|
420
468
|
* @param {PolicyExportInterface} importData import data
|
|
421
469
|
* @param {PolicyImportOptions} options import options
|
|
422
470
|
* @returns {Promise<PolicySkeleton>} imported policy object
|
|
423
471
|
*/
|
|
424
|
-
function
|
|
425
|
-
|
|
472
|
+
function _importPolicyDependencies() {
|
|
473
|
+
_importPolicyDependencies = _asyncToGenerator(function* (policyData, exportData) {
|
|
426
474
|
(0, _Console.debugMessage)("PolicyOps.importPolicySoftDependencies: start [policy=".concat(policyData._id, "]"));
|
|
427
475
|
var errors = [];
|
|
428
476
|
try {
|
|
@@ -454,9 +502,9 @@ function _importPolicySoftDependencies() {
|
|
|
454
502
|
}
|
|
455
503
|
(0, _Console.debugMessage)("PolicyOps.importPolicySoftDependencies: end");
|
|
456
504
|
});
|
|
457
|
-
return
|
|
505
|
+
return _importPolicyDependencies.apply(this, arguments);
|
|
458
506
|
}
|
|
459
|
-
function importPolicy(
|
|
507
|
+
function importPolicy(_x18, _x19) {
|
|
460
508
|
return _importPolicy.apply(this, arguments);
|
|
461
509
|
}
|
|
462
510
|
/**
|
|
@@ -466,22 +514,25 @@ function importPolicy(_x19, _x20) {
|
|
|
466
514
|
* @returns {Promise<PolicySkeleton>} imported policy object
|
|
467
515
|
*/
|
|
468
516
|
function _importPolicy() {
|
|
469
|
-
_importPolicy = _asyncToGenerator(function* (
|
|
517
|
+
_importPolicy = _asyncToGenerator(function* (policyId, importData) {
|
|
470
518
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
|
|
471
|
-
deps: true
|
|
519
|
+
deps: true,
|
|
520
|
+
prereqs: false
|
|
472
521
|
};
|
|
473
522
|
var response = null;
|
|
474
523
|
var errors = [];
|
|
475
524
|
var imported = [];
|
|
476
525
|
for (var id of Object.keys(importData.policy)) {
|
|
477
|
-
if (id ===
|
|
526
|
+
if (id === policyId) {
|
|
478
527
|
try {
|
|
479
528
|
var policyData = importData.policy[id];
|
|
480
|
-
delete policyData._provider;
|
|
481
529
|
delete policyData._rev;
|
|
482
|
-
if (options.
|
|
530
|
+
if (options.policySetName) {
|
|
531
|
+
policyData.applicationName = options.policySetName;
|
|
532
|
+
}
|
|
533
|
+
if (options.prereqs) {
|
|
483
534
|
try {
|
|
484
|
-
yield
|
|
535
|
+
yield importPolicyPrerequisites(policyData, importData);
|
|
485
536
|
} catch (error) {
|
|
486
537
|
errors.push(error);
|
|
487
538
|
}
|
|
@@ -494,7 +545,7 @@ function _importPolicy() {
|
|
|
494
545
|
}
|
|
495
546
|
if (options.deps) {
|
|
496
547
|
try {
|
|
497
|
-
yield
|
|
548
|
+
yield importPolicyDependencies(policyData, importData);
|
|
498
549
|
} catch (error) {
|
|
499
550
|
errors.push(error);
|
|
500
551
|
}
|
|
@@ -512,13 +563,13 @@ function _importPolicy() {
|
|
|
512
563
|
throw new Error("Import error:\n".concat(errorMessages));
|
|
513
564
|
}
|
|
514
565
|
if (0 === imported.length) {
|
|
515
|
-
throw new Error("Import error:\n".concat(
|
|
566
|
+
throw new Error("Import error:\n".concat(policyId, " not found in import data!"));
|
|
516
567
|
}
|
|
517
568
|
return response;
|
|
518
569
|
});
|
|
519
570
|
return _importPolicy.apply(this, arguments);
|
|
520
571
|
}
|
|
521
|
-
function importFirstPolicy(
|
|
572
|
+
function importFirstPolicy(_x20) {
|
|
522
573
|
return _importFirstPolicy.apply(this, arguments);
|
|
523
574
|
}
|
|
524
575
|
/**
|
|
@@ -530,7 +581,8 @@ function importFirstPolicy(_x21) {
|
|
|
530
581
|
function _importFirstPolicy() {
|
|
531
582
|
_importFirstPolicy = _asyncToGenerator(function* (importData) {
|
|
532
583
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
533
|
-
deps: true
|
|
584
|
+
deps: true,
|
|
585
|
+
prereqs: false
|
|
534
586
|
};
|
|
535
587
|
var response = null;
|
|
536
588
|
var errors = [];
|
|
@@ -538,11 +590,13 @@ function _importFirstPolicy() {
|
|
|
538
590
|
for (var id of Object.keys(importData.policy)) {
|
|
539
591
|
try {
|
|
540
592
|
var policyData = importData.policy[id];
|
|
541
|
-
delete policyData._provider;
|
|
542
593
|
delete policyData._rev;
|
|
543
|
-
if (options.
|
|
594
|
+
if (options.policySetName) {
|
|
595
|
+
policyData.applicationName = options.policySetName;
|
|
596
|
+
}
|
|
597
|
+
if (options.prereqs) {
|
|
544
598
|
try {
|
|
545
|
-
yield
|
|
599
|
+
yield importPolicyPrerequisites(policyData, importData);
|
|
546
600
|
} catch (error) {
|
|
547
601
|
errors.push(error);
|
|
548
602
|
}
|
|
@@ -555,7 +609,7 @@ function _importFirstPolicy() {
|
|
|
555
609
|
}
|
|
556
610
|
if (options.deps) {
|
|
557
611
|
try {
|
|
558
|
-
yield
|
|
612
|
+
yield importPolicyDependencies(policyData, importData);
|
|
559
613
|
} catch (error) {
|
|
560
614
|
errors.push(error);
|
|
561
615
|
}
|
|
@@ -579,13 +633,14 @@ function _importFirstPolicy() {
|
|
|
579
633
|
});
|
|
580
634
|
return _importFirstPolicy.apply(this, arguments);
|
|
581
635
|
}
|
|
582
|
-
function importPolicies(
|
|
636
|
+
function importPolicies(_x21) {
|
|
583
637
|
return _importPolicies.apply(this, arguments);
|
|
584
638
|
}
|
|
585
639
|
function _importPolicies() {
|
|
586
640
|
_importPolicies = _asyncToGenerator(function* (importData) {
|
|
587
641
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
588
|
-
deps: true
|
|
642
|
+
deps: true,
|
|
643
|
+
prereqs: false
|
|
589
644
|
};
|
|
590
645
|
var response = [];
|
|
591
646
|
var errors = [];
|
|
@@ -594,9 +649,12 @@ function _importPolicies() {
|
|
|
594
649
|
try {
|
|
595
650
|
var policyData = importData.policy[id];
|
|
596
651
|
delete policyData._rev;
|
|
597
|
-
if (options.
|
|
652
|
+
if (options.policySetName) {
|
|
653
|
+
policyData.applicationName = options.policySetName;
|
|
654
|
+
}
|
|
655
|
+
if (options.prereqs) {
|
|
598
656
|
try {
|
|
599
|
-
yield
|
|
657
|
+
yield importPolicyPrerequisites(policyData, importData);
|
|
600
658
|
} catch (error) {
|
|
601
659
|
errors.push(error);
|
|
602
660
|
}
|
|
@@ -609,7 +667,7 @@ function _importPolicies() {
|
|
|
609
667
|
}
|
|
610
668
|
if (options.deps) {
|
|
611
669
|
try {
|
|
612
|
-
yield
|
|
670
|
+
yield importPolicyDependencies(policyData, importData);
|
|
613
671
|
} catch (error) {
|
|
614
672
|
errors.push(error);
|
|
615
673
|
}
|