github.com/voedger/voedger@v0.0.0-20240520144910-273e84102129/pkg/registry/provide.go (about)

     1  /*
     2   * Copyright (c) 2021-present unTill Pro, Ltd.
     3   * @author Denis Gribanov
     4   */
     5  
     6  package registry
     7  
     8  import (
     9  	"github.com/voedger/voedger/pkg/appdef"
    10  	"github.com/voedger/voedger/pkg/istructs"
    11  	"github.com/voedger/voedger/pkg/istructsmem"
    12  	"github.com/voedger/voedger/pkg/itokens"
    13  	"github.com/voedger/voedger/pkg/parser"
    14  	_ "github.com/voedger/voedger/pkg/sys"
    15  	"github.com/voedger/voedger/pkg/utils/federation"
    16  )
    17  
    18  func Provide(cfg *istructsmem.AppConfigType, asp istructs.IAppStructsProvider, itokens itokens.ITokens,
    19  	federation federation.IFederation) parser.PackageFS {
    20  	cfg.Resources.Add(istructsmem.NewCommandFunction(
    21  		QNameCommandCreateLogin,
    22  		execCmdCreateLogin(asp),
    23  	))
    24  
    25  	cfg.Resources.Add(istructsmem.NewQueryFunction(
    26  		appdef.NewQName(RegistryPackage, "IssuePrincipalToken"),
    27  		provideIssuePrincipalTokenExec(itokens)))
    28  	provideChangePassword(cfg)
    29  	provideResetPassword(cfg, itokens, federation)
    30  	cfg.AddAsyncProjectors(
    31  		provideAsyncProjectorInvokeCreateWorkspaceID(federation, itokens),
    32  	)
    33  	return ProvidePackageFS()
    34  }
    35  
    36  func ProvidePackageFS() parser.PackageFS {
    37  	return parser.PackageFS{
    38  		Path: RegistryPackageFQN,
    39  		FS:   schemasFS,
    40  	}
    41  }
    42  
    43  func provideAsyncProjectorInvokeCreateWorkspaceID(federation federation.IFederation, tokensAPI itokens.ITokens) istructs.Projector {
    44  	return istructs.Projector{
    45  		Name: qNameProjectorInvokeCreateWorkspaceID_registry,
    46  		Func: invokeCreateWorkspaceIDProjector(federation, tokensAPI),
    47  	}
    48  }
    49  
    50  func ProvideSyncProjectorLoginIdx() istructs.Projector {
    51  	return istructs.Projector{
    52  		Name: QNameProjectorLoginIdx,
    53  		Func: projectorLoginIdx,
    54  	}
    55  }