/* eslint-disable */
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
    for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AuthorizationServer = void 0;
// robustly support requiring ambassador runtime from both private reg and scoped package
var requireAmbassadorRuntime = function () {
    var result;
    try {
        result = require('@wix/ambassador/runtime/rpc');
    }
    catch (err) {
        result = require('@wix/ambassador/runtime');
    }
    requireAmbassadorRuntime = function () { return result; };
    return result;
};
var AuthorizationServer = function (overrideArtifactUrl) { return ({
    AbacAttributesService: function (overrideRpcFactory, _rpcOptions) {
        if (_rpcOptions === void 0) { _rpcOptions = {}; }
        // lazily create the rpc client only upon first invocation, to prevent premature error throwing
        var _rpcClient;
        var getRpcClient = function () {
            if (!_rpcClient) {
                var rpcFactory = overrideRpcFactory || requireAmbassadorRuntime().getRpcFactory({ ambassadorArtifactName: 'AuthorizationServer', packageConfig: { transport: 'json-rpc' } });
                var artifactUrl = overrideArtifactUrl || requireAmbassadorRuntime().getArtifactUrl('AuthorizationServer');
                _rpcClient = rpcFactory.clientFactory(artifactUrl, 'AbacAttributesService', _rpcOptions).client;
            }
            return _rpcClient;
        };
        return function (_aspects) {
            var bulkUpdateResourceAttribute = function (request) {
                return getRpcClient()(_aspects).invoke('bulkUpdateResourceAttribute', request);
            };
            var bulkUpdateResourcesWithAttribute = function (request) {
                return getRpcClient()(_aspects).invoke('bulkUpdateResourcesWithAttribute', request);
            };
            var deleteAttributesByTenant = function (request) { return getRpcClient()(_aspects).invoke('deleteAttributesByTenant', request); };
            var getAttributes = function (request) { return getRpcClient()(_aspects).invoke('getAttributes', request); };
            var updateResourceAttribute = function (request) { return getRpcClient()(_aspects).invoke('updateResourceAttribute', request); };
            var updateResourcesWithAttribute = function (request) { return getRpcClient()(_aspects).invoke('updateResourcesWithAttribute', request); };
            return {
                bulkUpdateResourceAttribute: bulkUpdateResourceAttribute,
                bulkUpdateResourcesWithAttribute: bulkUpdateResourcesWithAttribute,
                deleteAttributesByTenant: deleteAttributesByTenant,
                getAttributes: getAttributes,
                updateResourceAttribute: updateResourceAttribute,
                updateResourcesWithAttribute: updateResourcesWithAttribute,
            };
        };
    },
    AbacAuthorizationDevService: function (overrideRpcFactory, _rpcOptions) {
        if (_rpcOptions === void 0) { _rpcOptions = {}; }
        // lazily create the rpc client only upon first invocation, to prevent premature error throwing
        var _rpcClient;
        var getRpcClient = function () {
            if (!_rpcClient) {
                var rpcFactory = overrideRpcFactory || requireAmbassadorRuntime().getRpcFactory({ ambassadorArtifactName: 'AuthorizationServer', packageConfig: { transport: 'json-rpc' } });
                var artifactUrl = overrideArtifactUrl || requireAmbassadorRuntime().getArtifactUrl('AuthorizationServer');
                _rpcClient = rpcFactory.clientFactory(artifactUrl, 'AbacAuthorizationDevService', _rpcOptions).client;
            }
            return _rpcClient;
        };
        return function (_aspects) {
            var assignPolicy = function (request) { return getRpcClient()(_aspects).invoke('assignPolicy', request); };
            var changePolicyOwner = function (request) { return getRpcClient()(_aspects).invoke('changePolicyOwner', request); };
            var fixBrokenTeamMembersAssignments = function (request) {
                return getRpcClient()(_aspects).invoke('fixBrokenTeamMembersAssignments', request);
            };
            var forceDeleteAssignments = function (request) {
                return getRpcClient()(_aspects).invoke('forceDeleteAssignments', request);
            };
            var getPoliciesMissingSubPoliciesPermissions = function (request) {
                return getRpcClient()(_aspects).invoke('getPoliciesMissingSubPoliciesPermissions', request);
            };
            var getPoliciesScopesDiff = function (request) {
                return getRpcClient()(_aspects).invoke('getPoliciesScopesDiff', request);
            };
            var hardDeleteStatement = function (request) { return getRpcClient()(_aspects).invoke('hardDeleteStatement', request); };
            var updateSiteContextAssignments = function (request) {
                return getRpcClient()(_aspects).invoke('updateSiteContextAssignments', request);
            };
            return {
                assignPolicy: assignPolicy,
                changePolicyOwner: changePolicyOwner,
                fixBrokenTeamMembersAssignments: fixBrokenTeamMembersAssignments,
                forceDeleteAssignments: forceDeleteAssignments,
                getPoliciesMissingSubPoliciesPermissions: getPoliciesMissingSubPoliciesPermissions,
                getPoliciesScopesDiff: getPoliciesScopesDiff,
                hardDeleteStatement: hardDeleteStatement,
                updateSiteContextAssignments: updateSiteContextAssignments,
            };
        };
    },
    AbacAuthorizationService: function (overrideRpcFactory, _rpcOptions) {
        if (_rpcOptions === void 0) { _rpcOptions = {}; }
        // lazily create the rpc client only upon first invocation, to prevent premature error throwing
        var _rpcClient;
        var getRpcClient = function () {
            if (!_rpcClient) {
                var rpcFactory = overrideRpcFactory || requireAmbassadorRuntime().getRpcFactory({ ambassadorArtifactName: 'AuthorizationServer', packageConfig: { transport: 'json-rpc' } });
                var artifactUrl = overrideArtifactUrl || requireAmbassadorRuntime().getArtifactUrl('AuthorizationServer');
                _rpcClient = rpcFactory.clientFactory(artifactUrl, 'AbacAuthorizationService', _rpcOptions).client;
            }
            return _rpcClient;
        };
        return function (_aspects) {
            var bulkIsPermitted = function (request) { return getRpcClient()(_aspects).invoke('bulkIsPermitted', request); };
            var getRestrictions = function (request) { return getRpcClient()(_aspects).invoke('getRestrictions', request); };
            var implicitIsPermitted = function (request) { return getRpcClient()(_aspects).invoke('implicitIsPermitted', request); };
            var isPermitted = function (request) { return getRpcClient()(_aspects).invoke('isPermitted', request); };
            return {
                bulkIsPermitted: bulkIsPermitted,
                getRestrictions: getRestrictions,
                implicitIsPermitted: implicitIsPermitted,
                isPermitted: isPermitted,
            };
        };
    },
    AbacManagementService: function (overrideRpcFactory, _rpcOptions) {
        if (_rpcOptions === void 0) { _rpcOptions = {}; }
        // lazily create the rpc client only upon first invocation, to prevent premature error throwing
        var _rpcClient;
        var getRpcClient = function () {
            if (!_rpcClient) {
                var rpcFactory = overrideRpcFactory || requireAmbassadorRuntime().getRpcFactory({ ambassadorArtifactName: 'AuthorizationServer', packageConfig: { transport: 'json-rpc' } });
                var artifactUrl = overrideArtifactUrl || requireAmbassadorRuntime().getArtifactUrl('AuthorizationServer');
                _rpcClient = rpcFactory.clientFactory(artifactUrl, 'AbacManagementService', _rpcOptions).client;
            }
            return _rpcClient;
        };
        return function (_aspects) {
            var addStatementToPolicy = function (request) {
                return getRpcClient()(_aspects).invoke('addStatementToPolicy', request);
            };
            var assignPolicy = function (request) { return getRpcClient()(_aspects).invoke('assignPolicy', request); };
            var createPolicy = function (request) { return getRpcClient()(_aspects).invoke('createPolicy', request); };
            var deleteAssignments = function (request) { return getRpcClient()(_aspects).invoke('deleteAssignments', request); };
            var deletePolicy = function (request) { return getRpcClient()(_aspects).invoke('deletePolicy', request); };
            var deletePolicyStatement = function (request) {
                return getRpcClient()(_aspects).invoke('deletePolicyStatement', request);
            };
            var foldExperiment = function (request) { return getRpcClient()(_aspects).invoke('foldExperiment', request); };
            var getPolicies = function (request) { return getRpcClient()(_aspects).invoke('getPolicies', request); };
            var getPolicy = function (request) { return getRpcClient()(_aspects).invoke('getPolicy', request); };
            var unassignPolicyFromSubject = function (request) {
                return getRpcClient()(_aspects).invoke('unassignPolicyFromSubject', request);
            };
            var updateAssignment = function (request) { return getRpcClient()(_aspects).invoke('updateAssignment', request); };
            var updatePolicyAuthorizationData = function (request) {
                return getRpcClient()(_aspects).invoke('updatePolicyAuthorizationData', request);
            };
            var updatePolicyMetadata = function (request) { return getRpcClient()(_aspects).invoke('updatePolicyMetadata', request); };
            return {
                addStatementToPolicy: addStatementToPolicy,
                assignPolicy: assignPolicy,
                createPolicy: createPolicy,
                deleteAssignments: deleteAssignments,
                deletePolicy: deletePolicy,
                deletePolicyStatement: deletePolicyStatement,
                foldExperiment: foldExperiment,
                getPolicies: getPolicies,
                getPolicy: getPolicy,
                unassignPolicyFromSubject: unassignPolicyFromSubject,
                updateAssignment: updateAssignment,
                updatePolicyAuthorizationData: updatePolicyAuthorizationData,
                updatePolicyMetadata: updatePolicyMetadata,
            };
        };
    },
    AbacQueryService: function (overrideRpcFactory, _rpcOptions) {
        if (_rpcOptions === void 0) { _rpcOptions = {}; }
        // lazily create the rpc client only upon first invocation, to prevent premature error throwing
        var _rpcClient;
        var getRpcClient = function () {
            if (!_rpcClient) {
                var rpcFactory = overrideRpcFactory || requireAmbassadorRuntime().getRpcFactory({ ambassadorArtifactName: 'AuthorizationServer', packageConfig: { transport: 'json-rpc' } });
                var artifactUrl = overrideArtifactUrl || requireAmbassadorRuntime().getArtifactUrl('AuthorizationServer');
                _rpcClient = rpcFactory.clientFactory(artifactUrl, 'AbacQueryService', _rpcOptions).client;
            }
            return _rpcClient;
        };
        return function (_aspects) {
            var bulkIsPolicyAssigned = function (request) {
                return getRpcClient()(_aspects).invoke('bulkIsPolicyAssigned', request);
            };
            var filterPolicies = function (request) { return getRpcClient()(_aspects).invoke('filterPolicies', request); };
            var getAssignments = function (request) { return getRpcClient()(_aspects).invoke('getAssignments', request); };
            var getBulkSubjectPoliciesBySubjectContext = function (request) {
                return getRpcClient()(_aspects).invoke('getBulkSubjectPoliciesBySubjectContext', request);
            };
            var getContainedPolicies = function (request) {
                return getRpcClient()(_aspects).invoke('getContainedPolicies', request);
            };
            var getCurrentSubjectPermissionsOnResource = function (request) {
                return getRpcClient()(_aspects).invoke('getCurrentSubjectPermissionsOnResource', request);
            };
            var getCurrentSubjectPermissionsOnResources = function (request) {
                return getRpcClient()(_aspects).invoke('getCurrentSubjectPermissionsOnResources', request);
            };
            var getPolicies = function (request) { return getRpcClient()(_aspects).invoke('getPolicies', request); };
            var getPoliciesApplicableRestrictions = function (request) {
                return getRpcClient()(_aspects).invoke('getPoliciesApplicableRestrictions', request);
            };
            var getPoliciesAssignedOnResource = function (request) {
                return getRpcClient()(_aspects).invoke('getPoliciesAssignedOnResource', request);
            };
            var getPoliciesPermissions = function (request) {
                return getRpcClient()(_aspects).invoke('getPoliciesPermissions', request);
            };
            var getPolicy = function (request) { return getRpcClient()(_aspects).invoke('getPolicy', request); };
            var getSubjectPermissionsOnResource = function (request) {
                return getRpcClient()(_aspects).invoke('getSubjectPermissionsOnResource', request);
            };
            var getSubjectPoliciesBySubjectContext = function (request) {
                return getRpcClient()(_aspects).invoke('getSubjectPoliciesBySubjectContext', request);
            };
            var getSubjectPoliciesOnCurrentAccount = function (request) {
                return getRpcClient()(_aspects).invoke('getSubjectPoliciesOnCurrentAccount', request);
            };
            return {
                bulkIsPolicyAssigned: bulkIsPolicyAssigned,
                filterPolicies: filterPolicies,
                getAssignments: getAssignments,
                getBulkSubjectPoliciesBySubjectContext: getBulkSubjectPoliciesBySubjectContext,
                getContainedPolicies: getContainedPolicies,
                getCurrentSubjectPermissionsOnResource: getCurrentSubjectPermissionsOnResource,
                getCurrentSubjectPermissionsOnResources: getCurrentSubjectPermissionsOnResources,
                getPolicies: getPolicies,
                getPoliciesApplicableRestrictions: getPoliciesApplicableRestrictions,
                getPoliciesAssignedOnResource: getPoliciesAssignedOnResource,
                getPoliciesPermissions: getPoliciesPermissions,
                getPolicy: getPolicy,
                getSubjectPermissionsOnResource: getSubjectPermissionsOnResource,
                getSubjectPoliciesBySubjectContext: getSubjectPoliciesBySubjectContext,
                getSubjectPoliciesOnCurrentAccount: getSubjectPoliciesOnCurrentAccount,
            };
        };
    },
    AccountInviteService: function (overrideRpcFactory, _rpcOptions) {
        if (_rpcOptions === void 0) { _rpcOptions = {}; }
        // lazily create the rpc client only upon first invocation, to prevent premature error throwing
        var _rpcClient;
        var getRpcClient = function () {
            if (!_rpcClient) {
                var rpcFactory = overrideRpcFactory || requireAmbassadorRuntime().getRpcFactory({ ambassadorArtifactName: 'AuthorizationServer', packageConfig: { transport: 'json-rpc' } });
                var artifactUrl = overrideArtifactUrl || requireAmbassadorRuntime().getArtifactUrl('AuthorizationServer');
                _rpcClient = rpcFactory.clientFactory(artifactUrl, 'AccountInviteService', _rpcOptions).client;
            }
            return _rpcClient;
        };
        return function (_aspects) {
            var acceptInvite = function (request) { return getRpcClient()(_aspects).invoke('acceptInvite', request); };
            var changeInvitePolicies = function (request) { return getRpcClient()(_aspects).invoke('changeInvitePolicies', request); };
            var createNewInvite = function (request) { return getRpcClient()(_aspects).invoke('createNewInvite', request); };
            var deleteInvite = function (request) { return getRpcClient()(_aspects).invoke('deleteInvite', request); };
            var getInvite = function (request) { return getRpcClient()(_aspects).invoke('getInvite', request); };
            var getInvitesByAccount = function (request) { return getRpcClient()(_aspects).invoke('getInvitesByAccount', request); };
            var resetInvite = function (request) { return getRpcClient()(_aspects).invoke('resetInvite', request); };
            var updateInviteAssignments = function (request) {
                return getRpcClient()(_aspects).invoke('updateInviteAssignments', request);
            };
            return {
                acceptInvite: acceptInvite,
                changeInvitePolicies: changeInvitePolicies,
                createNewInvite: createNewInvite,
                deleteInvite: deleteInvite,
                getInvite: getInvite,
                getInvitesByAccount: getInvitesByAccount,
                resetInvite: resetInvite,
                updateInviteAssignments: updateInviteAssignments,
            };
        };
    },
    AccountPoliciesManagement: function (overrideRpcFactory, _rpcOptions) {
        if (_rpcOptions === void 0) { _rpcOptions = {}; }
        // lazily create the rpc client only upon first invocation, to prevent premature error throwing
        var _rpcClient;
        var getRpcClient = function () {
            if (!_rpcClient) {
                var rpcFactory = overrideRpcFactory || requireAmbassadorRuntime().getRpcFactory({ ambassadorArtifactName: 'AuthorizationServer', packageConfig: { transport: 'json-rpc' } });
                var artifactUrl = overrideArtifactUrl || requireAmbassadorRuntime().getArtifactUrl('AuthorizationServer');
                _rpcClient = rpcFactory.clientFactory(artifactUrl, 'AccountPoliciesManagement', _rpcOptions).client;
            }
            return _rpcClient;
        };
        return function (_aspects) {
            var assignPoliciesToTeamMember = function (request) {
                return getRpcClient()(_aspects).invoke('assignPoliciesToTeamMember', request);
            };
            var bulkOverrideSubjectPolicies = function (request) {
                return getRpcClient()(_aspects).invoke('bulkOverrideSubjectPolicies', request);
            };
            var clearTeamMemberPolicies = function (request) {
                return getRpcClient()(_aspects).invoke('clearTeamMemberPolicies', request);
            };
            var createPolicy = function (request) { return getRpcClient()(_aspects).invoke('createPolicy', request); };
            var deletePolicy = function (request) { return getRpcClient()(_aspects).invoke('deletePolicy', request); };
            var deleteTeamMemberAssignments = function (request) {
                return getRpcClient()(_aspects).invoke('deleteTeamMemberAssignments', request);
            };
            var replaceAllTeamMemberPolicies = function (request) {
                return getRpcClient()(_aspects).invoke('replaceAllTeamMemberPolicies', request);
            };
            var replaceTeamMemberPolicies = function (request) {
                return getRpcClient()(_aspects).invoke('replaceTeamMemberPolicies', request);
            };
            var updatePolicyAuthorizationData = function (request) {
                return getRpcClient()(_aspects).invoke('updatePolicyAuthorizationData', request);
            };
            var updatePolicyMetadata = function (request) { return getRpcClient()(_aspects).invoke('updatePolicyMetadata', request); };
            return {
                assignPoliciesToTeamMember: assignPoliciesToTeamMember,
                bulkOverrideSubjectPolicies: bulkOverrideSubjectPolicies,
                clearTeamMemberPolicies: clearTeamMemberPolicies,
                createPolicy: createPolicy,
                deletePolicy: deletePolicy,
                deleteTeamMemberAssignments: deleteTeamMemberAssignments,
                replaceAllTeamMemberPolicies: replaceAllTeamMemberPolicies,
                replaceTeamMemberPolicies: replaceTeamMemberPolicies,
                updatePolicyAuthorizationData: updatePolicyAuthorizationData,
                updatePolicyMetadata: updatePolicyMetadata,
            };
        };
    },
    AppInviteService: function (overrideRpcFactory, _rpcOptions) {
        if (_rpcOptions === void 0) { _rpcOptions = {}; }
        // lazily create the rpc client only upon first invocation, to prevent premature error throwing
        var _rpcClient;
        var getRpcClient = function () {
            if (!_rpcClient) {
                var rpcFactory = overrideRpcFactory || requireAmbassadorRuntime().getRpcFactory({ ambassadorArtifactName: 'AuthorizationServer', packageConfig: { transport: 'json-rpc' } });
                var artifactUrl = overrideArtifactUrl || requireAmbassadorRuntime().getArtifactUrl('AuthorizationServer');
                _rpcClient = rpcFactory.clientFactory(artifactUrl, 'AppInviteService', _rpcOptions).client;
            }
            return _rpcClient;
        };
        return function (_aspects) {
            var acceptAppInvite = function (request) { return getRpcClient()(_aspects).invoke('acceptAppInvite', request); };
            var createAppInvite = function (request) { return getRpcClient()(_aspects).invoke('createAppInvite', request); };
            var deleteAppInvite = function (request) { return getRpcClient()(_aspects).invoke('deleteAppInvite', request); };
            var getAppInvite = function (request) { return getRpcClient()(_aspects).invoke('getAppInvite', request); };
            var getAppInvites = function (request) { return getRpcClient()(_aspects).invoke('getAppInvites', request); };
            var resetAppInvite = function (request) { return getRpcClient()(_aspects).invoke('resetAppInvite', request); };
            return {
                acceptAppInvite: acceptAppInvite,
                createAppInvite: createAppInvite,
                deleteAppInvite: deleteAppInvite,
                getAppInvite: getAppInvite,
                getAppInvites: getAppInvites,
                resetAppInvite: resetAppInvite,
            };
        };
    },
    AppPoliciesManagementService: function (overrideRpcFactory, _rpcOptions) {
        if (_rpcOptions === void 0) { _rpcOptions = {}; }
        // lazily create the rpc client only upon first invocation, to prevent premature error throwing
        var _rpcClient;
        var getRpcClient = function () {
            if (!_rpcClient) {
                var rpcFactory = overrideRpcFactory || requireAmbassadorRuntime().getRpcFactory({ ambassadorArtifactName: 'AuthorizationServer', packageConfig: { transport: 'json-rpc' } });
                var artifactUrl = overrideArtifactUrl || requireAmbassadorRuntime().getArtifactUrl('AuthorizationServer');
                _rpcClient = rpcFactory.clientFactory(artifactUrl, 'AppPoliciesManagementService', _rpcOptions).client;
            }
            return _rpcClient;
        };
        return function (_aspects) {
            var clearAssignedAppPolicies = function (request) {
                return getRpcClient()(_aspects).invoke('clearAssignedAppPolicies', request);
            };
            return {
                clearAssignedAppPolicies: clearAssignedAppPolicies,
            };
        };
    },
    AuthorizationManagementService: function (overrideRpcFactory, _rpcOptions) {
        if (_rpcOptions === void 0) { _rpcOptions = {}; }
        // lazily create the rpc client only upon first invocation, to prevent premature error throwing
        var _rpcClient;
        var getRpcClient = function () {
            if (!_rpcClient) {
                var rpcFactory = overrideRpcFactory || requireAmbassadorRuntime().getRpcFactory({ ambassadorArtifactName: 'AuthorizationServer', packageConfig: { transport: 'json-rpc' } });
                var artifactUrl = overrideArtifactUrl || requireAmbassadorRuntime().getArtifactUrl('AuthorizationServer');
                _rpcClient = rpcFactory.clientFactory(artifactUrl, 'AuthorizationManagementService', _rpcOptions).client;
            }
            return _rpcClient;
        };
        return function (_aspects) {
            var addRole = function (accountId, metasiteId, role) { return getRpcClient()(_aspects).invoke('addRole', accountId, metasiteId, role); };
            var addRoles = function (userId, metasiteId, roles) { return getRpcClient()(_aspects).invoke('addRoles', userId, metasiteId, roles); };
            var changeRole = function (accountId, resourceId, role, staffId) {
                return getRpcClient()(_aspects).invoke('changeRole', accountId, resourceId, role, staffId);
            };
            var changeRole$default$4 = function () { return getRpcClient()(_aspects).invoke('changeRole$default$4'); };
            var changeRole$default$4$ = function ($this) { return getRpcClient()(_aspects).invoke('changeRole$default$4$', $this); };
            var changeRoles = function (userId, resourceId, newRoles, staffId) {
                return getRpcClient()(_aspects).invoke('changeRoles', userId, resourceId, newRoles, staffId);
            };
            var changeRoles$default$4 = function () { return getRpcClient()(_aspects).invoke('changeRoles$default$4'); };
            var changeRoles$default$4$ = function ($this) { return getRpcClient()(_aspects).invoke('changeRoles$default$4$', $this); };
            var cleanRolesForSite = function (resourceId) { return getRpcClient()(_aspects).invoke('cleanRolesForSite', resourceId); };
            var clearRole = function (accountId, resourceId) { return getRpcClient()(_aspects).invoke('clearRole', accountId, resourceId); };
            var clearRoles = function (userId, resourceId) { return getRpcClient()(_aspects).invoke('clearRoles', userId, resourceId); };
            var fetchRoles = function (userId, resourceId) { return getRpcClient()(_aspects).invoke('fetchRoles', userId, resourceId); };
            var fetchSiteAccountsInfo = function (metasiteId) { return getRpcClient()(_aspects).invoke('fetchSiteAccountsInfo', metasiteId); };
            var fetchSitesAccountsInfo = function (metasiteIds) { return getRpcClient()(_aspects).invoke('fetchSitesAccountsInfo', metasiteIds); };
            var fetchSitesUsersInfo = function (metasiteIds) { return getRpcClient()(_aspects).invoke('fetchSitesUsersInfo', metasiteIds); };
            var fetchSiteUsersInfo = function (metasiteId) { return getRpcClient()(_aspects).invoke('fetchSiteUsersInfo', metasiteId); };
            var fetchUserSitesInfo = function (userId) { return getRpcClient()(_aspects).invoke('fetchUserSitesInfo', userId); };
            return {
                addRole: addRole,
                addRoles: addRoles,
                changeRole: changeRole,
                changeRole$default$4: changeRole$default$4,
                changeRole$default$4$: changeRole$default$4$,
                changeRoles: changeRoles,
                changeRoles$default$4: changeRoles$default$4,
                changeRoles$default$4$: changeRoles$default$4$,
                cleanRolesForSite: cleanRolesForSite,
                clearRole: clearRole,
                clearRoles: clearRoles,
                fetchRoles: fetchRoles,
                fetchSiteAccountsInfo: fetchSiteAccountsInfo,
                fetchSitesAccountsInfo: fetchSitesAccountsInfo,
                fetchSitesUsersInfo: fetchSitesUsersInfo,
                fetchSiteUsersInfo: fetchSiteUsersInfo,
                fetchUserSitesInfo: fetchUserSitesInfo,
            };
        };
    },
    AuthorizationService: function (overrideRpcFactory, _rpcOptions) {
        if (_rpcOptions === void 0) { _rpcOptions = {}; }
        // lazily create the rpc client only upon first invocation, to prevent premature error throwing
        var _rpcClient;
        var getRpcClient = function () {
            if (!_rpcClient) {
                var rpcFactory = overrideRpcFactory || requireAmbassadorRuntime().getRpcFactory({ ambassadorArtifactName: 'AuthorizationServer', packageConfig: { transport: 'json-rpc' } });
                var artifactUrl = overrideArtifactUrl || requireAmbassadorRuntime().getArtifactUrl('AuthorizationServer');
                _rpcClient = rpcFactory.clientFactory(artifactUrl, 'AuthorizationService', _rpcOptions).client;
            }
            return _rpcClient;
        };
        return function (_aspects) {
            var fetchOwner = function (resourceId) { return getRpcClient()(_aspects).invoke('fetchOwner', resourceId); };
            var fetchRoles = function (userId, resourceId) { return getRpcClient()(_aspects).invoke('fetchRoles', userId, resourceId); };
            return {
                fetchOwner: fetchOwner,
                fetchRoles: fetchRoles,
            };
        };
    },
    AuthorizationServiceDevApi: function (overrideRpcFactory, _rpcOptions) {
        if (_rpcOptions === void 0) { _rpcOptions = {}; }
        // lazily create the rpc client only upon first invocation, to prevent premature error throwing
        var _rpcClient;
        var getRpcClient = function () {
            if (!_rpcClient) {
                var rpcFactory = overrideRpcFactory || requireAmbassadorRuntime().getRpcFactory({ ambassadorArtifactName: 'AuthorizationServer', packageConfig: { transport: 'json-rpc' } });
                var artifactUrl = overrideArtifactUrl || requireAmbassadorRuntime().getArtifactUrl('AuthorizationServer');
                _rpcClient = rpcFactory.clientFactory(artifactUrl, 'AuthorizationServiceDevApi', _rpcOptions).client;
            }
            return _rpcClient;
        };
        return function (_aspects) {
            var deleteAccountInvite = function (request) { return getRpcClient()(_aspects).invoke('deleteAccountInvite', request); };
            var deleteAccountInvites = function (request) { return getRpcClient()(_aspects).invoke('deleteAccountInvites', request); };
            var migrateInviteToAccount = function (request) { return getRpcClient()(_aspects).invoke('migrateInviteToAccount', request); };
            var triggerGdprDeleteUserData = function (request) {
                return getRpcClient()(_aspects).invoke('triggerGdprDeleteUserData', request);
            };
            return {
                deleteAccountInvite: deleteAccountInvite,
                deleteAccountInvites: deleteAccountInvites,
                migrateInviteToAccount: migrateInviteToAccount,
                triggerGdprDeleteUserData: triggerGdprDeleteUserData,
            };
        };
    },
    BackOfficeAuthorizationService: function (overrideRpcFactory, _rpcOptions) {
        if (_rpcOptions === void 0) { _rpcOptions = {}; }
        // lazily create the rpc client only upon first invocation, to prevent premature error throwing
        var _rpcClient;
        var getRpcClient = function () {
            if (!_rpcClient) {
                var rpcFactory = overrideRpcFactory || requireAmbassadorRuntime().getRpcFactory({ ambassadorArtifactName: 'AuthorizationServer', packageConfig: { transport: 'json-rpc' } });
                var artifactUrl = overrideArtifactUrl || requireAmbassadorRuntime().getArtifactUrl('AuthorizationServer');
                _rpcClient = rpcFactory.clientFactory(artifactUrl, 'BackOfficeAuthorizationService', _rpcOptions).client;
            }
            return _rpcClient;
        };
        return function (_aspects) {
            var bulkIsPermitted = function (request) { return getRpcClient()(_aspects).invoke('bulkIsPermitted', request); };
            var bulkSubjectIsPermitted = function (request) {
                return getRpcClient()(_aspects).invoke('bulkSubjectIsPermitted', request);
            };
            var isPermitted = function (request) { return getRpcClient()(_aspects).invoke('isPermitted', request); };
            var isPermittedByAppInstance = function (request) {
                return getRpcClient()(_aspects).invoke('isPermittedByAppInstance', request);
            };
            return {
                bulkIsPermitted: bulkIsPermitted,
                bulkSubjectIsPermitted: bulkSubjectIsPermitted,
                isPermitted: isPermitted,
                isPermittedByAppInstance: isPermittedByAppInstance,
            };
        };
    },
    GlobalGroupsManagementService: function (overrideRpcFactory, _rpcOptions) {
        if (_rpcOptions === void 0) { _rpcOptions = {}; }
        // lazily create the rpc client only upon first invocation, to prevent premature error throwing
        var _rpcClient;
        var getRpcClient = function () {
            if (!_rpcClient) {
                var rpcFactory = overrideRpcFactory || requireAmbassadorRuntime().getRpcFactory({ ambassadorArtifactName: 'AuthorizationServer', packageConfig: { transport: 'json-rpc' } });
                var artifactUrl = overrideArtifactUrl || requireAmbassadorRuntime().getArtifactUrl('AuthorizationServer');
                _rpcClient = rpcFactory.clientFactory(artifactUrl, 'GlobalGroupsManagementService', _rpcOptions).client;
            }
            return _rpcClient;
        };
        return function (_aspects) {
            var addRoleToGlobalGroup = function (groupName, role) { return getRpcClient()(_aspects).invoke('addRoleToGlobalGroup', groupName, role); };
            var addUserIdToGroup = function (userId, groupName) { return getRpcClient()(_aspects).invoke('addUserIdToGroup', userId, groupName); };
            var addUserToGroup = function (email, groupName) { return getRpcClient()(_aspects).invoke('addUserToGroup', email, groupName); };
            var allGlobalGroups = function () { return getRpcClient()(_aspects).invoke('allGlobalGroups'); };
            var getUserGroups = function (email) { return getRpcClient()(_aspects).invoke('getUserGroups', email); };
            var removeRoleFromGlobalGroup = function (groupName, role) { return getRpcClient()(_aspects).invoke('removeRoleFromGlobalGroup', groupName, role); };
            var removeUserFromGroup = function (email, groupName) { return getRpcClient()(_aspects).invoke('removeUserFromGroup', email, groupName); };
            return {
                addRoleToGlobalGroup: addRoleToGlobalGroup,
                addUserIdToGroup: addUserIdToGroup,
                addUserToGroup: addUserToGroup,
                allGlobalGroups: allGlobalGroups,
                getUserGroups: getUserGroups,
                removeRoleFromGlobalGroup: removeRoleFromGlobalGroup,
                removeUserFromGroup: removeUserFromGroup,
            };
        };
    },
    GlobalGroupsService: function (overrideRpcFactory, _rpcOptions) {
        if (_rpcOptions === void 0) { _rpcOptions = {}; }
        // lazily create the rpc client only upon first invocation, to prevent premature error throwing
        var _rpcClient;
        var getRpcClient = function () {
            if (!_rpcClient) {
                var rpcFactory = overrideRpcFactory || requireAmbassadorRuntime().getRpcFactory({ ambassadorArtifactName: 'AuthorizationServer', packageConfig: { transport: 'json-rpc' } });
                var artifactUrl = overrideArtifactUrl || requireAmbassadorRuntime().getArtifactUrl('AuthorizationServer');
                _rpcClient = rpcFactory.clientFactory(artifactUrl, 'GlobalGroupsService', _rpcOptions).client;
            }
            return _rpcClient;
        };
        return function (_aspects) {
            var getAllGroupsRoles = function () { return getRpcClient()(_aspects).invoke('getAllGroupsRoles'); };
            var getAllUsersGroups = function () { return getRpcClient()(_aspects).invoke('getAllUsersGroups'); };
            var getUserGroups = function (userId) { return getRpcClient()(_aspects).invoke('getUserGroups', userId); };
            return {
                getAllGroupsRoles: getAllGroupsRoles,
                getAllUsersGroups: getAllUsersGroups,
                getUserGroups: getUserGroups,
            };
        };
    },
    ImmigratorSingleMigrationService: function (overrideRpcFactory, _rpcOptions) {
        if (_rpcOptions === void 0) { _rpcOptions = {}; }
        // lazily create the rpc client only upon first invocation, to prevent premature error throwing
        var _rpcClient;
        var getRpcClient = function () {
            if (!_rpcClient) {
                var rpcFactory = overrideRpcFactory || requireAmbassadorRuntime().getRpcFactory({ ambassadorArtifactName: 'AuthorizationServer', packageConfig: { transport: 'json-rpc' } });
                var artifactUrl = overrideArtifactUrl || requireAmbassadorRuntime().getArtifactUrl('AuthorizationServer');
                _rpcClient = rpcFactory.clientFactory(artifactUrl, 'ImmigratorSingleMigrationService', _rpcOptions).client;
            }
            return _rpcClient;
        };
        return function (_aspects) {
            var runMigration = function (request) { return getRpcClient()(_aspects).invoke('runMigration', request); };
            return {
                runMigration: runMigration,
            };
        };
    },
    InvitesService: function (overrideRpcFactory, _rpcOptions) {
        if (_rpcOptions === void 0) { _rpcOptions = {}; }
        // lazily create the rpc client only upon first invocation, to prevent premature error throwing
        var _rpcClient;
        var getRpcClient = function () {
            if (!_rpcClient) {
                var rpcFactory = overrideRpcFactory || requireAmbassadorRuntime().getRpcFactory({ ambassadorArtifactName: 'AuthorizationServer', packageConfig: { transport: 'json-rpc' } });
                var artifactUrl = overrideArtifactUrl || requireAmbassadorRuntime().getArtifactUrl('AuthorizationServer');
                _rpcClient = rpcFactory.clientFactory(artifactUrl, 'InvitesService', _rpcOptions).client;
            }
            return _rpcClient;
        };
        return function (_aspects) {
            var acceptInvite = function (inviteId, assignedUser) { return getRpcClient()(_aspects).invoke('acceptInvite', inviteId, assignedUser); };
            var changeInviteRole = function (inviteId, newRole, staffId) { return getRpcClient()(_aspects).invoke('changeInviteRole', inviteId, newRole, staffId); };
            var changeInviteRole$default$3 = function () { return getRpcClient()(_aspects).invoke('changeInviteRole$default$3'); };
            var changeInviteRole$default$3$ = function ($this) { return getRpcClient()(_aspects).invoke('changeInviteRole$default$3$', $this); };
            var changeInviteRoles = function (inviteId, policyIds, locationIds, staffId, locationRestrictions) {
                return getRpcClient()(_aspects).invoke('changeInviteRoles', inviteId, policyIds, staffId, locationIds, locationRestrictions);
            };
            var changeInviteRoles$default$3 = function () { return getRpcClient()(_aspects).invoke('changeInviteRoles$default$3'); };
            var changeInviteRoles$default$3$ = function ($this) { return getRpcClient()(_aspects).invoke('changeInviteRoles$default$3$', $this); };
            var changeInviteRoles$default$4 = function () { return getRpcClient()(_aspects).invoke('changeInviteRoles$default$4'); };
            var changeInviteRoles$default$4$ = function ($this) { return getRpcClient()(_aspects).invoke('changeInviteRoles$default$4$', $this); };
            var changeInviteRoles$default$5 = function () { return getRpcClient()(_aspects).invoke('changeInviteRoles$default$5'); };
            var changeInviteRoles$default$5$ = function ($this) { return getRpcClient()(_aspects).invoke('changeInviteRoles$default$5$', $this); };
            var createInviteNew = function (inviteReq) { return getRpcClient()(_aspects).invoke('createInviteNew', inviteReq); };
            var decline = function (guid) { return getRpcClient()(_aspects).invoke('decline', guid); };
            var __js_reserved_word_delete = function (inviteId) { return getRpcClient()(_aspects).invoke('delete', inviteId); };
            var getContributorLimit = function (metaSiteId) { return getRpcClient()(_aspects).invoke('getContributorLimit', metaSiteId); };
            var getContributorsQuota = function (metaSiteId) { return getRpcClient()(_aspects).invoke('getContributorsQuota', metaSiteId); };
            var getInvite = function (id) { return getRpcClient()(_aspects).invoke('getInvite', id); };
            var getInvitesByInvitedUserId = function (invitedUserId) { return getRpcClient()(_aspects).invoke('getInvitesByInvitedUserId', invitedUserId); };
            var getValidSiteInvites = function (metasiteId) { return getRpcClient()(_aspects).invoke('getValidSiteInvites', metasiteId); };
            var querySiteInvites = function (metasiteId, filter) { return getRpcClient()(_aspects).invoke('querySiteInvites', metasiteId, filter); };
            var resetInvite = function (inviteId) { return getRpcClient()(_aspects).invoke('resetInvite', inviteId); };
            var updateGivenToEmail = function (inviteId, givenToEmail, dateUpdated) {
                return getRpcClient()(_aspects).invoke('updateGivenToEmail', inviteId, givenToEmail, dateUpdated);
            };
            return {
                acceptInvite: acceptInvite,
                changeInviteRole: changeInviteRole,
                changeInviteRole$default$3: changeInviteRole$default$3,
                changeInviteRole$default$3$: changeInviteRole$default$3$,
                changeInviteRoles: changeInviteRoles,
                changeInviteRoles$default$3: changeInviteRoles$default$3,
                changeInviteRoles$default$3$: changeInviteRoles$default$3$,
                changeInviteRoles$default$4: changeInviteRoles$default$4,
                changeInviteRoles$default$4$: changeInviteRoles$default$4$,
                changeInviteRoles$default$5: changeInviteRoles$default$5,
                changeInviteRoles$default$5$: changeInviteRoles$default$5$,
                createInviteNew: createInviteNew,
                decline: decline,
                delete: __js_reserved_word_delete,
                getContributorLimit: getContributorLimit,
                getContributorsQuota: getContributorsQuota,
                getInvite: getInvite,
                getInvitesByInvitedUserId: getInvitesByInvitedUserId,
                getValidSiteInvites: getValidSiteInvites,
                querySiteInvites: querySiteInvites,
                resetInvite: resetInvite,
                updateGivenToEmail: updateGivenToEmail,
            };
        };
    },
    LegacyAuthorizationService: function (overrideRpcFactory, _rpcOptions) {
        if (_rpcOptions === void 0) { _rpcOptions = {}; }
        // lazily create the rpc client only upon first invocation, to prevent premature error throwing
        var _rpcClient;
        var getRpcClient = function () {
            if (!_rpcClient) {
                var rpcFactory = overrideRpcFactory || requireAmbassadorRuntime().getRpcFactory({ ambassadorArtifactName: 'AuthorizationServer', packageConfig: { transport: 'json-rpc' } });
                var artifactUrl = overrideArtifactUrl || requireAmbassadorRuntime().getArtifactUrl('AuthorizationServer');
                _rpcClient = rpcFactory.clientFactory(artifactUrl, 'LegacyAuthorizationService', _rpcOptions).client;
            }
            return _rpcClient;
        };
        return function (_aspects) {
            var getPermissions = function (request) { return getRpcClient()(_aspects).invoke('getPermissions', request); };
            return {
                getPermissions: getPermissions,
            };
        };
    },
    LegacyMembersWithRoleApi: function (overrideRpcFactory, _rpcOptions) {
        if (_rpcOptions === void 0) { _rpcOptions = {}; }
        // lazily create the rpc client only upon first invocation, to prevent premature error throwing
        var _rpcClient;
        var getRpcClient = function () {
            if (!_rpcClient) {
                var rpcFactory = overrideRpcFactory || requireAmbassadorRuntime().getRpcFactory({ ambassadorArtifactName: 'AuthorizationServer', packageConfig: { transport: 'json-rpc' } });
                var artifactUrl = overrideArtifactUrl || requireAmbassadorRuntime().getArtifactUrl('AuthorizationServer');
                _rpcClient = rpcFactory.clientFactory(artifactUrl, 'LegacyMembersWithRoleApi', _rpcOptions).client;
            }
            return _rpcClient;
        };
        return function (_aspects) {
            var authorize = function (request) { return getRpcClient()(_aspects).invoke('authorize', request); };
            return {
                authorize: authorize,
            };
        };
    },
    MetaSiteRestrictedSubjectsFacade: function (overrideRpcFactory, _rpcOptions) {
        if (_rpcOptions === void 0) { _rpcOptions = {}; }
        // lazily create the rpc client only upon first invocation, to prevent premature error throwing
        var _rpcClient;
        var getRpcClient = function () {
            if (!_rpcClient) {
                var rpcFactory = overrideRpcFactory || requireAmbassadorRuntime().getRpcFactory({ ambassadorArtifactName: 'AuthorizationServer', packageConfig: { transport: 'json-rpc' } });
                var artifactUrl = overrideArtifactUrl || requireAmbassadorRuntime().getArtifactUrl('AuthorizationServer');
                _rpcClient = rpcFactory.clientFactory(artifactUrl, 'MetaSiteRestrictedSubjectsFacade', _rpcOptions).client;
            }
            return _rpcClient;
        };
        return function (_aspects) {
            var getRestrictedSubjects = function (request) {
                return getRpcClient()(_aspects).invoke('getRestrictedSubjects', request);
            };
            return {
                getRestrictedSubjects: getRestrictedSubjects,
            };
        };
    },
    SitePoliciesManagement: function (overrideRpcFactory, _rpcOptions) {
        if (_rpcOptions === void 0) { _rpcOptions = {}; }
        // lazily create the rpc client only upon first invocation, to prevent premature error throwing
        var _rpcClient;
        var getRpcClient = function () {
            if (!_rpcClient) {
                var rpcFactory = overrideRpcFactory || requireAmbassadorRuntime().getRpcFactory({ ambassadorArtifactName: 'AuthorizationServer', packageConfig: { transport: 'json-rpc' } });
                var artifactUrl = overrideArtifactUrl || requireAmbassadorRuntime().getArtifactUrl('AuthorizationServer');
                _rpcClient = rpcFactory.clientFactory(artifactUrl, 'SitePoliciesManagement', _rpcOptions).client;
            }
            return _rpcClient;
        };
        return function (_aspects) {
            var assignPolicies = function (request) { return getRpcClient()(_aspects).invoke('assignPolicies', request); };
            var clearAssignedPolicies = function (request) {
                return getRpcClient()(_aspects).invoke('clearAssignedPolicies', request);
            };
            var replaceAllAssignedPolicies = function (request) {
                return getRpcClient()(_aspects).invoke('replaceAllAssignedPolicies', request);
            };
            var replaceAllAssignedPoliciesCondition = function (request) {
                return getRpcClient()(_aspects).invoke('replaceAllAssignedPoliciesCondition', request);
            };
            var updatePoliciesOnSiteTransfer = function (request) {
                return getRpcClient()(_aspects).invoke('updatePoliciesOnSiteTransfer', request);
            };
            return {
                assignPolicies: assignPolicies,
                clearAssignedPolicies: clearAssignedPolicies,
                replaceAllAssignedPolicies: replaceAllAssignedPolicies,
                replaceAllAssignedPoliciesCondition: replaceAllAssignedPoliciesCondition,
                updatePoliciesOnSiteTransfer: updatePoliciesOnSiteTransfer,
            };
        };
    },
    SubjectsQueryService: function (overrideRpcFactory, _rpcOptions) {
        if (_rpcOptions === void 0) { _rpcOptions = {}; }
        // lazily create the rpc client only upon first invocation, to prevent premature error throwing
        var _rpcClient;
        var getRpcClient = function () {
            if (!_rpcClient) {
                var rpcFactory = overrideRpcFactory || requireAmbassadorRuntime().getRpcFactory({ ambassadorArtifactName: 'AuthorizationServer', packageConfig: { transport: 'json-rpc' } });
                var artifactUrl = overrideArtifactUrl || requireAmbassadorRuntime().getArtifactUrl('AuthorizationServer');
                _rpcClient = rpcFactory.clientFactory(artifactUrl, 'SubjectsQueryService', _rpcOptions).client;
            }
            return _rpcClient;
        };
        return function (_aspects) {
            var bulkGetSubjectRoles = function (request) { return getRpcClient()(_aspects).invoke('bulkGetSubjectRoles', request); };
            var getCurrentSubjectContainedPolicies = function (request) {
                return getRpcClient()(_aspects).invoke('getCurrentSubjectContainedPolicies', request);
            };
            var getSubjectAssignedPolicies = function (request) {
                return getRpcClient()(_aspects).invoke('getSubjectAssignedPolicies', request);
            };
            var getSubjectPermittedResources = function (request) {
                return getRpcClient()(_aspects).invoke('getSubjectPermittedResources', request);
            };
            var getSubjectPermittingAssignments = function (request) {
                return getRpcClient()(_aspects).invoke('getSubjectPermittingAssignments', request);
            };
            var getSubjectRoles = function (request) { return getRpcClient()(_aspects).invoke('getSubjectRoles', request); };
            return {
                bulkGetSubjectRoles: bulkGetSubjectRoles,
                getCurrentSubjectContainedPolicies: getCurrentSubjectContainedPolicies,
                getSubjectAssignedPolicies: getSubjectAssignedPolicies,
                getSubjectPermittedResources: getSubjectPermittedResources,
                getSubjectPermittingAssignments: getSubjectPermittingAssignments,
                getSubjectRoles: getSubjectRoles,
            };
        };
    },
    UsersAuthorizationQueryService: function (overrideRpcFactory, _rpcOptions) {
        if (_rpcOptions === void 0) { _rpcOptions = {}; }
        // lazily create the rpc client only upon first invocation, to prevent premature error throwing
        var _rpcClient;
        var getRpcClient = function () {
            if (!_rpcClient) {
                var rpcFactory = overrideRpcFactory || requireAmbassadorRuntime().getRpcFactory({ ambassadorArtifactName: 'AuthorizationServer', packageConfig: { transport: 'json-rpc' } });
                var artifactUrl = overrideArtifactUrl || requireAmbassadorRuntime().getArtifactUrl('AuthorizationServer');
                _rpcClient = rpcFactory.clientFactory(artifactUrl, 'UsersAuthorizationQueryService', _rpcOptions).client;
            }
            return _rpcClient;
        };
        return function (_aspects) {
            var bulkGetPermittedSubjectsCount = function (request) {
                return getRpcClient()(_aspects).invoke('bulkGetPermittedSubjectsCount', request);
            };
            var getPermittedSubjectsRoles = function (request) {
                return getRpcClient()(_aspects).invoke('getPermittedSubjectsRoles', request);
            };
            var getPermittedSubjectsStatements = function (request) {
                return getRpcClient()(_aspects).invoke('getPermittedSubjectsStatements', request);
            };
            return {
                bulkGetPermittedSubjectsCount: bulkGetPermittedSubjectsCount,
                getPermittedSubjectsRoles: getPermittedSubjectsRoles,
                getPermittedSubjectsStatements: getPermittedSubjectsStatements,
            };
        };
    },
}); };
exports.AuthorizationServer = AuthorizationServer;
exports.AuthorizationServer.__artifactName = 'AuthorizationServer';
exports.AuthorizationServer.__transport = 'json-rpc';
__exportStar(require("./types"), exports);
//# sourceMappingURL=rpc.js.map