Documentation
¶
Index ¶
- Constants
- Variables
- func AddAuthProvider(appData AppData, name string, config map[string]interface{})
- func AddDataSource(appData AppData, config map[string]interface{})
- func MarshalJSON(o interface{}) ([]byte, error)
- func PrepareDependencies(app App, ui terminal.UI) (string, error)
- func WriteFile(path string, perm os.FileMode, r io.Reader) error
- func WriteHostingAssets(assetClient HostingAssetClient, rootDir, groupID, appID string, ...) error
- func WriteZip(wd string, zipPkg *zip.Reader) error
- type App
- type AppConfigJSON
- type AppData
- type AppDataV1
- func (a AppDataV1) ConfigData() ([]byte, error)
- func (a AppDataV1) ConfigVersion() realm.AppConfigVersion
- func (a AppDataV1) DeploymentModel() realm.DeploymentModel
- func (a AppDataV1) Environment() realm.Environment
- func (a AppDataV1) ID() string
- func (a *AppDataV1) LoadData(rootDir string) error
- func (a AppDataV1) Location() realm.Location
- func (a AppDataV1) Name() string
- func (a *AppDataV1) WriteData(rootDir string) error
- type AppDataV2
- func (a AppDataV2) ConfigData() ([]byte, error)
- func (a AppDataV2) ConfigVersion() realm.AppConfigVersion
- func (a AppDataV2) DeploymentModel() realm.DeploymentModel
- func (a AppDataV2) Environment() realm.Environment
- func (a AppDataV2) ID() string
- func (a *AppDataV2) LoadData(rootDir string) error
- func (a AppDataV2) Location() realm.Location
- func (a AppDataV2) Name() string
- func (a AppDataV2) WriteData(rootDir string) error
- type AppRealmConfigJSON
- type AppStitchJSON
- type AppStructureV1
- type AppStructureV2
- type ArchiveReader
- type AuthStructure
- type DataSourceStructure
- type Dependencies
- type File
- type FileHeader
- type FunctionsStructure
- type GraphQLStructure
- type HTTPEndpointStructure
- type Hosting
- type HostingAssetClient
- type HostingDiffs
- type ModifiedHostingAsset
- type SecretsStructure
- type ServiceStructure
- type SyncStructure
- type Transpiler
Constants ¶
const ( // app configs NameRealmConfig = "realm_config" NameConfig = "config" NameStitch = "stitch" // environments NameEnvironments = "environments" // auth NameAuth = "auth" NameAuthProviders = "auth_providers" NameCustomUserData = "custom_user_data" NameProviders = "providers" // functions NameFunctions = "functions" NameSource = "source" // graphql NameGraphQL = "graphql" NameCustomResolvers = "custom_resolvers" // hosting NameHosting = "hosting" NameFiles = "files" NameMetadata = "metadata" // services NameDataSources = "data_sources" NameHTTPEndpoints = "http_endpoints" NameIncomingWebhooks = "incoming_webhooks" NameRules = "rules" NameSchema = "schema" NameServices = "services" NameRelationships = "relationships" // triggers NameTriggers = "triggers" // sync NameSync = "sync" // values NameSecrets = "secrets" NameValues = "values" )
set of supported local names
Variables ¶
var ( // app configs FileRealmConfig = File{NameRealmConfig, extJSON} FileConfig = File{NameConfig, extJSON} FileStitch = File{NameStitch, extJSON} // auth FileCustomUserData = File{NameCustomUserData, extJSON} FileProviders = File{NameProviders, extJSON} // data sources FileRules = File{NameRules, extJSON} FileSchema = File{NameSchema, extJSON} FileRelationships = File{NameRelationships, extJSON} // functions FileSource = File{NameSource, extJS} // values FileSecrets = File{NameSecrets, extJSON} )
set of supported local files
Functions ¶
func AddAuthProvider ¶
AddAuthProvider adds an auth provider to the provided app data
func AddDataSource ¶
AddDataSource adds a data source to the app data
func MarshalJSON ¶
MarshalJSON returns the json representation of the passed in interface
func PrepareDependencies ¶
PrepareDependencies finds and prepares an app's dependencies upload package by creating a .zip file, while using the ui spinner during the transpiling containing the specified archive's transpiled file contents in a tempmorary directory and returns that file path
func WriteHostingAssets ¶
func WriteHostingAssets(assetClient HostingAssetClient, rootDir, groupID, appID string, appAssets []realm.HostingAsset) error
WriteHostingAssets writes the hosting assets to disk
Types ¶
type App ¶
App is the Realm app data represented on the local filesystem
func FindApp ¶
FindApp searches upwards for the root of a Realm app project and returns the local app structure, a boolean indicating if the current working directory is part of a Realm app project, and any error that occurs
func LoadAppConfig ¶
LoadAppConfig will load the local app config
func NewApp ¶
func NewApp(rootDir, clientAppID, name string, location realm.Location, deploymentModel realm.DeploymentModel, environment realm.Environment, configVersion realm.AppConfigVersion) App
NewApp returns a new local app
func (*App) LoadConfig ¶
LoadConfig will load the local app's config
func (App) WriteConfig ¶
WriteConfig writes the app config file to disk
type AppConfigJSON ¶
type AppConfigJSON struct {
AppDataV1
}
AppConfigJSON is the app config.json data
func NewAppConfigJSON ¶
func NewAppConfigJSON(name string, meta realm.AppMeta) AppConfigJSON
NewAppConfigJSON returns app config.json data
type AppData ¶
type AppData interface {
ConfigData() ([]byte, error)
ConfigVersion() realm.AppConfigVersion
ID() string
Name() string
Location() realm.Location
DeploymentModel() realm.DeploymentModel
Environment() realm.Environment
LoadData(rootDir string) error
WriteData(rootDir string) error
}
AppData is the Realm app data
type AppDataV1 ¶
type AppDataV1 struct {
AppStructureV1
}
AppDataV1 is the v1 local Realm app data
func (AppDataV1) ConfigData ¶
ConfigData marshals the config data out to JSON
func (AppDataV1) ConfigVersion ¶
func (a AppDataV1) ConfigVersion() realm.AppConfigVersion
ConfigVersion returns the local Realm app config version
func (AppDataV1) DeploymentModel ¶
func (a AppDataV1) DeploymentModel() realm.DeploymentModel
DeploymentModel returns the local Realm app deployment model
func (AppDataV1) Environment ¶
func (a AppDataV1) Environment() realm.Environment
Environment returns the local Realm app environment
type AppDataV2 ¶
type AppDataV2 struct {
AppStructureV2
}
AppDataV2 is the v2 local Realm app data
func (AppDataV2) ConfigData ¶
ConfigData marshals the config data out to JSON
func (AppDataV2) ConfigVersion ¶
func (a AppDataV2) ConfigVersion() realm.AppConfigVersion
ConfigVersion returns the local Realm app config version
func (AppDataV2) DeploymentModel ¶
func (a AppDataV2) DeploymentModel() realm.DeploymentModel
DeploymentModel returns the local Realm app deployment model
func (AppDataV2) Environment ¶
func (a AppDataV2) Environment() realm.Environment
Environment returns the local Realm app environment
type AppRealmConfigJSON ¶
type AppRealmConfigJSON struct {
AppDataV2
}
AppRealmConfigJSON is the app realm_config.json data
func NewAppRealmConfigJSON ¶
func NewAppRealmConfigJSON(name string, meta realm.AppMeta) AppRealmConfigJSON
NewAppRealmConfigJSON returns app realm_config.json data
type AppStitchJSON ¶
type AppStitchJSON struct {
AppDataV1
}
AppStitchJSON is the app stitch.json data
func NewAppStitchJSON ¶
func NewAppStitchJSON(name string, meta realm.AppMeta) AppStitchJSON
NewAppStitchJSON returns app stitch.json data
type AppStructureV1 ¶
type AppStructureV1 struct {
ConfigVersion realm.AppConfigVersion `json:"config_version"`
ID string `json:"app_id,omitempty"`
Name string `json:"name"`
Location realm.Location `json:"location"`
DeploymentModel realm.DeploymentModel `json:"deployment_model"`
Environment realm.Environment `json:"environment,omitempty"`
Environments map[string]map[string]interface{} `json:"environments,omitempty"`
Security map[string]interface{} `json:"security"`
Hosting map[string]interface{} `json:"hosting,omitempty"`
CustomUserDataConfig map[string]interface{} `json:"custom_user_data_config"`
Sync map[string]interface{} `json:"sync"`
Secrets SecretsStructure `json:"secrets,omitempty"`
AuthProviders []map[string]interface{} `json:"auth_providers,omitempty"`
Functions []map[string]interface{} `json:"functions,omitempty"`
Triggers []map[string]interface{} `json:"triggers,omitempty"`
GraphQL GraphQLStructure `json:"graphql,omitempty"`
Services []ServiceStructure `json:"services,omitempty"`
Values []map[string]interface{} `json:"values,omitempty"`
}
AppStructureV1 represents the v1 Realm app structure
type AppStructureV2 ¶
type AppStructureV2 struct {
ConfigVersion realm.AppConfigVersion `json:"config_version"`
ID string `json:"app_id,omitempty"`
Name string `json:"name,omitempty"`
Location realm.Location `json:"location,omitempty"`
DeploymentModel realm.DeploymentModel `json:"deployment_model,omitempty"`
Environment realm.Environment `json:"environment,omitempty"`
Environments map[string]map[string]interface{} `json:"environments,omitempty"`
AllowedRequestOrigins []string `json:"allowed_request_origins,omitempty"`
Values []map[string]interface{} `json:"values,omitempty"`
Auth AuthStructure `json:"auth,omitempty"`
Functions FunctionsStructure `json:"functions,omitempty"`
Triggers []map[string]interface{} `json:"triggers,omitempty"`
DataSources []DataSourceStructure `json:"data_sources,omitempty"`
HTTPEndpoints []HTTPEndpointStructure `json:"http_endpoints,omitempty"`
Services []ServiceStructure `json:"services,omitempty"`
GraphQL GraphQLStructure `json:"graphql,omitempty"`
Hosting map[string]interface{} `json:"hosting,omitempty"`
Sync SyncStructure `json:"sync,omitempty"`
Secrets SecretsStructure `json:"secrets,omitempty"`
}
AppStructureV2 represents the v2 Realm app structure
type ArchiveReader ¶
type ArchiveReader interface {
Next() (FileHeader, error)
Read(b []byte) (int, error)
}
ArchiveReader provides sequential access to the contents of the supported archive formats
type AuthStructure ¶
type AuthStructure struct {
CustomUserData map[string]interface{} `json:"custom_user_data,omitempty"`
Providers map[string]interface{} `json:"providers,omitempty"`
}
AuthStructure represents the v2 Realm app auth structure
type DataSourceStructure ¶
type DataSourceStructure struct {
Config map[string]interface{} `json:"config,omitempty"`
Rules []map[string]interface{} `json:"rules,omitempty"`
}
DataSourceStructure represents the v2 Realm app data source structure
type Dependencies ¶
Dependencies holds the data related to a local Realm app's dependencies
func FindAppDependencies ¶
func FindAppDependencies(path string) (Dependencies, error)
FindAppDependencies finds the Realm app dependencies archive
func (Dependencies) PrepareUpload ¶
func (d Dependencies) PrepareUpload() (string, error)
PrepareUpload prepares a dependencies upload package by creating a .zip file containing the specified archive's transpiled file contents in a tempmorary directory and returns that file path
type FileHeader ¶
FileHeader holds the path and file information
type FunctionsStructure ¶
type FunctionsStructure struct {
Configs []map[string]interface{} `json:"config,omitempty"`
Sources map[string]string `json:"sources,omitempty"`
}
FunctionsStructure represents the v2 Realm app functions structure
type GraphQLStructure ¶
type GraphQLStructure struct {
Config map[string]interface{} `json:"config,omitempty"`
CustomResolvers []map[string]interface{} `json:"custom_resolvers,omitempty"`
}
GraphQLStructure represents the Realm app graphql structure
type HTTPEndpointStructure ¶
type HTTPEndpointStructure struct {
Config map[string]interface{} `json:"config,omitempty"`
IncomingWebhooks []map[string]interface{} `json:"incoming_webhooks,omitempty"`
Rules []map[string]interface{} `json:"rules,omitempty"`
}
HTTPEndpointStructure represents the v2 Realm app http endpoint structure
type Hosting ¶
type Hosting struct {
RootDir string
}
Hosting is the local Realm app hosting
func FindAppHosting ¶
FindAppHosting finds the local Realm app hosting files
func (Hosting) Diffs ¶
func (h Hosting) Diffs(cachePath, appID string, appAssets []realm.HostingAsset) (HostingDiffs, error)
Diffs returns the local Realm app's hosting asset differences with the provided remote Realm app's hosting assets
func (Hosting) UploadHostingAssets ¶
func (h Hosting) UploadHostingAssets(realmClient realm.Client, groupID, appID string, hostingDiffs HostingDiffs, errHandler func(err error)) error
UploadHostingAssets uploads the hosting assets based on the diff of that file
type HostingAssetClient ¶
HostingAssetClient is the hosting asset client
type HostingDiffs ¶
type HostingDiffs struct {
Added []realm.HostingAsset
Deleted []realm.HostingAsset
Modified []ModifiedHostingAsset
}
HostingDiffs are the hosting asset differences between a local and remote Realm app
func (HostingDiffs) Cap ¶
func (d HostingDiffs) Cap() int
Cap returns the hosting diffs' total capacity
func (HostingDiffs) Strings ¶
func (d HostingDiffs) Strings() []string
Strings returns the hosting diffs' formatted output
type ModifiedHostingAsset ¶
type ModifiedHostingAsset struct {
realm.HostingAsset
BodyModified bool
AttrsModified bool
}
ModifiedHostingAsset is a Realm hosting asset with information about its local file changes
type SecretsStructure ¶
type SecretsStructure struct {
AuthProviders map[string]map[string]string `json:"auth_providers,omitempty"`
Services map[string]map[string]string `json:"services,omitempty"`
}
SecretsStructure represents the Realm app secrets
type ServiceStructure ¶
type ServiceStructure struct {
Config map[string]interface{} `json:"config,omitempty"`
IncomingWebhooks []map[string]interface{} `json:"incoming_webhooks"`
Rules []map[string]interface{} `json:"rules"`
}
ServiceStructure represents the Realm app service structure
type SyncStructure ¶
type SyncStructure struct {
Config map[string]interface{} `json:"config,omitempty"`
}
SyncStructure represents the v2 Realm app sync structure