platform

package
v0.0.0-...-42bcb57 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package platform contains the hosted WhoDB client used by CLI commands.

Index

Constants

View Source
const (
	// DefaultHost is the hosted WhoDB platform URL used when no host is provided.
	DefaultHost = "https://app.whodb.com"
)

Variables

View Source
var GenericWriteSpecs = map[string]GenericWriteSpec{
	"create:secret":                               {Resource: "secret", Action: "create", Mutation: "CreateSecret", Mode: GenericWriteModeInput, InjectProjectID: true},
	"update:secret":                               {Resource: "secret", Action: "update", Mutation: "UpdateSecret", Mode: GenericWriteModeInput, NeedsID: true, InjectProjectID: true},
	"delete:secret":                               {Resource: "secret", Action: "delete", Mutation: "DeleteSecret", Mode: GenericWriteModeProjectID, NeedsID: true},
	"create:ai_provider":                          {Resource: "ai_provider", Action: "create", Mutation: "CreateAIProvider", Mode: GenericWriteModeInput, InjectProjectID: true},
	"update:ai_provider":                          {Resource: "ai_provider", Action: "update", Mutation: "UpdateAIProvider", Mode: GenericWriteModeInput, NeedsID: true},
	"delete:ai_provider":                          {Resource: "ai_provider", Action: "delete", Mutation: "DeleteAIProvider", Mode: GenericWriteModeID, NeedsID: true},
	"create:ontology":                             {Resource: "ontology", Action: "create", Mutation: "CreateOntology", Mode: GenericWriteModeInput, InjectProjectID: true},
	"update:ontology":                             {Resource: "ontology", Action: "update", Mutation: "UpdateOntology", Mode: GenericWriteModeInput, NeedsID: true, InjectProjectID: true},
	"delete:ontology":                             {Resource: "ontology", Action: "delete", Mutation: "DeleteOntology", Mode: GenericWriteModeProjectID, NeedsID: true},
	"create:ontology_fast_lookup":                 {Resource: "ontology_fast_lookup", Action: "create", Mutation: "CreateOntologyFastLookup", Mode: GenericWriteModeInput, InjectProjectID: true},
	"delete:ontology_fast_lookup":                 {Resource: "ontology_fast_lookup", Action: "delete", Mutation: "RemoveOntologyFastLookup", Mode: GenericWriteModeProjectID, NeedsID: true},
	"action:add_record:ontology":                  {Resource: "ontology", Action: "add_record", Mutation: "OntologyAddRow", Mode: GenericWriteModeDirect, NeedsID: true, InjectProjectID: true},
	"action:update_record:ontology":               {Resource: "ontology", Action: "update_record", Mutation: "OntologyUpdateRow", Mode: GenericWriteModeDirect, NeedsID: true, InjectProjectID: true},
	"action:delete_record:ontology":               {Resource: "ontology", Action: "delete_record", Mutation: "OntologyDeleteRow", Mode: GenericWriteModeDirect, NeedsID: true, InjectProjectID: true},
	"create:dataset":                              {Resource: "dataset", Action: "create", Mutation: "CreateDataset", Mode: GenericWriteModeInput, InjectProjectID: true},
	"update:dataset":                              {Resource: "dataset", Action: "update", Mutation: "UpdateDataset", Mode: GenericWriteModeInput, NeedsID: true, InjectProjectID: true},
	"delete:dataset":                              {Resource: "dataset", Action: "delete", Mutation: "DeleteDataset", Mode: GenericWriteModeProjectID, NeedsID: true},
	"create:transform":                            {Resource: "transform", Action: "create", Mutation: "SaveTransform", Mode: GenericWriteModeInput, InjectProjectID: true},
	"update:transform":                            {Resource: "transform", Action: "update", Mutation: "SaveTransform", Mode: GenericWriteModeInput, NeedsID: true, InjectProjectID: true},
	"delete:transform":                            {Resource: "transform", Action: "delete", Mutation: "DeleteTransform", Mode: GenericWriteModeProjectID, NeedsID: true},
	"create:folder":                               {Resource: "folder", Action: "create", Mutation: "CreateProjectFolder", Mode: GenericWriteModeInput, InjectProjectID: true},
	"delete:folder":                               {Resource: "folder", Action: "delete", Mutation: "DeleteProjectFolder", Mode: GenericWriteModeProjectID, NeedsID: true},
	"delete:file":                                 {Resource: "file", Action: "delete", Mutation: "DeleteProjectFile", Mode: GenericWriteModeProjectID, NeedsID: true},
	"create:function":                             {Resource: "function", Action: "create", Mutation: "CreateFunction", Mode: GenericWriteModeInput, InjectProjectID: true},
	"update:function":                             {Resource: "function", Action: "update", Mutation: "UpdateFunction", Mode: GenericWriteModeInput, NeedsID: true, InjectProjectID: true},
	"delete:function":                             {Resource: "function", Action: "delete", Mutation: "DeleteFunction", Mode: GenericWriteModeProjectID, NeedsID: true},
	"create:source_object":                        {Resource: "source_object", Action: "create", Mutation: "CreatePlatformSourceObject", Mode: GenericWriteModeDirect, InjectProjectID: true},
	"update:source_object":                        {Resource: "source_object", Action: "update", Mutation: "UpdatePlatformSourceObject", Mode: GenericWriteModeDirect, InjectProjectID: true},
	"delete:source_object":                        {Resource: "source_object", Action: "delete", Mutation: "DeletePlatformSourceObject", Mode: GenericWriteModeDirect, InjectProjectID: true},
	"action:run:transform":                        {Resource: "transform", Action: "run", Mutation: "RunTransform", Mode: GenericWriteModeProjectID, NeedsID: true},
	"action:upload:file":                          {Resource: "file", Action: "upload", Mutation: "UploadProjectFile", Mode: GenericWriteModeFileUpload, InjectProjectID: true},
	"action:rename:file":                          {Resource: "file", Action: "rename", Mutation: "RenameProjectFile", Mode: GenericWriteModeProjectIDName, NeedsID: true},
	"action:rename:folder":                        {Resource: "folder", Action: "rename", Mutation: "RenameProjectFolder", Mode: GenericWriteModeProjectIDName, NeedsID: true},
	"action:move:file":                            {Resource: "file", Action: "move", Mutation: "MoveProjectFile", Mode: GenericWriteModeInput, NeedsID: true, InjectProjectID: true},
	"action:move:folder":                          {Resource: "folder", Action: "move", Mutation: "MoveProjectFolder", Mode: GenericWriteModeInput, NeedsID: true, InjectProjectID: true},
	"action:promote_to_dataset:file":              {Resource: "file", Action: "promote_to_dataset", Mutation: "PromoteFileToDataset", Mode: GenericWriteModeInput, NeedsID: true, InjectProjectID: true},
	"action:deploy:function":                      {Resource: "function", Action: "deploy", Mutation: "DeployFunction", Mode: GenericWriteModeProjectID, NeedsID: true},
	"action:redeploy:function":                    {Resource: "function", Action: "redeploy", Mutation: "RedeployFunction", Mode: GenericWriteModeProjectID, NeedsID: true},
	"create:app":                                  {Resource: "app", Action: "create", Mutation: "CreateApp", Mode: GenericWriteModeInput, InjectProjectID: true},
	"update:app":                                  {Resource: "app", Action: "update", Mutation: "UpdateApp", Mode: GenericWriteModeInput, NeedsID: true, InjectProjectID: true},
	"delete:app":                                  {Resource: "app", Action: "delete", Mutation: "DeleteApp", Mode: GenericWriteModeProjectID, NeedsID: true},
	"action:restore:app":                          {Resource: "app", Action: "restore", Mutation: "RestoreApp", Mode: GenericWriteModeProjectID, NeedsID: true},
	"action:purge:app":                            {Resource: "app", Action: "purge", Mutation: "PurgeApp", Mode: GenericWriteModeProjectID, NeedsID: true},
	"action:generate:app":                         {Resource: "app", Action: "generate", Mutation: "GenerateApp", Mode: GenericWriteModeInput, InjectProjectID: true},
	"action:upsert_file:app":                      {Resource: "app", Action: "upsert_file", Mutation: "UpsertAppFile", Mode: GenericWriteModeDirect, InjectProjectID: true},
	"action:delete_file:app":                      {Resource: "app", Action: "delete_file", Mutation: "DeleteAppFile", Mode: GenericWriteModeDirect, InjectProjectID: true},
	"action:restore_version_to_draft:app":         {Resource: "app", Action: "restore_version_to_draft", Mutation: "RestoreAppVersionToDraft", Mode: GenericWriteModeDirect, InjectProjectID: true},
	"action:restore:source":                       {Resource: "source", Action: "restore", Mutation: "RestoreSource", Mode: GenericWriteModeProjectID, NeedsID: true},
	"action:purge:source":                         {Resource: "source", Action: "purge", Mutation: "PurgeSource", Mode: GenericWriteModeProjectID, NeedsID: true},
	"action:restore:ontology":                     {Resource: "ontology", Action: "restore", Mutation: "RestoreOntology", Mode: GenericWriteModeProjectID, NeedsID: true},
	"action:purge:ontology":                       {Resource: "ontology", Action: "purge", Mutation: "PurgeOntology", Mode: GenericWriteModeProjectID, NeedsID: true},
	"action:restore:dataset":                      {Resource: "dataset", Action: "restore", Mutation: "RestoreDataset", Mode: GenericWriteModeProjectID, NeedsID: true},
	"action:purge:dataset":                        {Resource: "dataset", Action: "purge", Mutation: "PurgeDataset", Mode: GenericWriteModeProjectID, NeedsID: true},
	"action:restore:transform":                    {Resource: "transform", Action: "restore", Mutation: "RestoreTransform", Mode: GenericWriteModeProjectID, NeedsID: true},
	"action:purge:transform":                      {Resource: "transform", Action: "purge", Mutation: "PurgeTransform", Mode: GenericWriteModeProjectID, NeedsID: true},
	"action:restore:function":                     {Resource: "function", Action: "restore", Mutation: "RestoreFunction", Mode: GenericWriteModeProjectID, NeedsID: true},
	"action:purge:function":                       {Resource: "function", Action: "purge", Mutation: "PurgeFunction", Mode: GenericWriteModeProjectID, NeedsID: true},
	"action:restore_version_to_draft:ontology":    {Resource: "ontology", Action: "restore_version_to_draft", Mutation: "RestoreOntologyVersionToDraft", Mode: GenericWriteModeDirect, InjectProjectID: true},
	"action:restore_version_to_draft:dataset":     {Resource: "dataset", Action: "restore_version_to_draft", Mutation: "RestoreDatasetVersionToDraft", Mode: GenericWriteModeDirect, InjectProjectID: true},
	"action:restore_version_to_draft:transform":   {Resource: "transform", Action: "restore_version_to_draft", Mutation: "RestoreTransformVersionToDraft", Mode: GenericWriteModeDirect, InjectProjectID: true},
	"create:package":                              {Resource: "package", Action: "create", Mutation: "CreatePackage", Mode: GenericWriteModeInput, InjectProjectID: true},
	"action:install:package":                      {Resource: "package", Action: "install", Mutation: "InstallPackage", Mode: GenericWriteModeInput},
	"action:install_shared:package":               {Resource: "package", Action: "install_shared", Mutation: "InstallSharedPackage", Mode: GenericWriteModeInput},
	"action:update_installation:package":          {Resource: "package", Action: "update_installation", Mutation: "UpdatePackageInstallation", Mode: GenericWriteModeInput},
	"action:uninstall:package":                    {Resource: "package", Action: "uninstall", Mutation: "UninstallPackage", Mode: GenericWriteModeInput},
	"action:import:package":                       {Resource: "package", Action: "import", Mutation: "ImportPackage", Mode: GenericWriteModeInput},
	"action:import_shared:package":                {Resource: "package", Action: "import_shared", Mutation: "ImportSharedPackage", Mode: GenericWriteModeInput},
	"action:create_share:package":                 {Resource: "package", Action: "create_share", Mutation: "CreatePackageShare", Mode: GenericWriteModeInput},
	"action:rename:organization":                  {Resource: "organization", Action: "rename", Mutation: "RenameOrganization", Mode: GenericWriteModeDirect},
	"action:delete:organization":                  {Resource: "organization", Action: "delete", Mutation: "DeleteOrganization", Mode: GenericWriteModeDirect},
	"action:upsert_domain:organization":           {Resource: "organization", Action: "upsert_domain", Mutation: "UpsertOrganizationDomain", Mode: GenericWriteModeDirect},
	"action:delete_domain:organization":           {Resource: "organization", Action: "delete_domain", Mutation: "DeleteOrganizationDomain", Mode: GenericWriteModeID, NeedsID: true},
	"action:create_sso:organization":              {Resource: "organization", Action: "create_sso", Mutation: "CreateOrganizationSSOProvider", Mode: GenericWriteModeDirect},
	"action:update_sso:organization":              {Resource: "organization", Action: "update_sso", Mutation: "UpdateOrganizationSSOProvider", Mode: GenericWriteModeDirect, NeedsID: true},
	"action:delete_sso:organization":              {Resource: "organization", Action: "delete_sso", Mutation: "DeleteOrganizationSSOProvider", Mode: GenericWriteModeID, NeedsID: true},
	"action:invite_user:organization":             {Resource: "organization", Action: "invite_user", Mutation: "InviteUser", Mode: GenericWriteModeInput},
	"action:reinvite_user:organization":           {Resource: "organization", Action: "reinvite_user", Mutation: "ReinviteUser", Mode: GenericWriteModeDirect},
	"action:remove_user:organization":             {Resource: "organization", Action: "remove_user", Mutation: "RemoveUser", Mode: GenericWriteModeDirect},
	"action:grant_access:organization":            {Resource: "organization", Action: "grant_access", Mutation: "GrantAccess", Mode: GenericWriteModeInput},
	"action:revoke_access:organization":           {Resource: "organization", Action: "revoke_access", Mutation: "RevokeAccess", Mode: GenericWriteModeInput},
	"action:share_by_email:resource":              {Resource: "resource", Action: "share_by_email", Mutation: "ShareByEmail", Mode: GenericWriteModeDirect},
	"action:transfer_ownership_by_email:resource": {Resource: "resource", Action: "transfer_ownership_by_email", Mutation: "TransferOwnershipByEmail", Mode: GenericWriteModeDirect},
	"action:transfer_ownership:resource":          {Resource: "resource", Action: "transfer_ownership", Mutation: "TransferOwnership", Mode: GenericWriteModeDirect},
	"action:claim_orphan:resource":                {Resource: "resource", Action: "claim_orphan", Mutation: "ClaimOrphan", Mode: GenericWriteModeDirect},
	"action:create_team:organization":             {Resource: "organization", Action: "create_team", Mutation: "CreateTeam", Mode: GenericWriteModeDirect},
	"action:delete_team:organization":             {Resource: "organization", Action: "delete_team", Mutation: "DeleteTeam", Mode: GenericWriteModeID, NeedsID: true},
	"action:add_team_member:organization":         {Resource: "organization", Action: "add_team_member", Mutation: "AddTeamMember", Mode: GenericWriteModeDirect},
	"action:remove_team_member:organization":      {Resource: "organization", Action: "remove_team_member", Mutation: "RemoveTeamMember", Mode: GenericWriteModeDirect},
	"action:sync_app_permissions:organization":    {Resource: "organization", Action: "sync_app_permissions", Mutation: "SyncAllAppPermissions", Mode: GenericWriteModeDirect},
	"action:promote:object":                       {Resource: "object", Action: "promote", Mutation: "PromoteObject", Mode: GenericWriteModeInput, InjectProjectID: true},
	"action:rollback:object":                      {Resource: "object", Action: "rollback", Mutation: "RollbackObject", Mode: GenericWriteModeInput, InjectProjectID: true},
	"action:test:function":                        {Resource: "function", Action: "test", Mutation: "TestFunction", Mode: GenericWriteModeInput, InjectProjectID: true},
	"action:preview:function":                     {Resource: "function", Action: "preview", Mutation: "PreviewFunction", Mode: GenericWriteModeInput, InjectProjectID: true},
	"action:execute:function":                     {Resource: "function", Action: "execute", Mutation: "ExecuteFunction", Mode: GenericWriteModeDirect, InjectProjectID: true},
}

GenericWriteSpecs maps operation/resource tokens to hosted platform mutations.

View Source
var PayloadShapes = map[string]PayloadShape{
	"create:secret": {
		Key: "create:secret", Resource: "secret", Action: "create", Description: "Create secret metadata and value. projectId is injected from the selected workspace.",
		Fields: []PayloadField{
			{Name: "name", Type: "string", Required: true, Description: "Secret name"},
			{Name: "description", Type: "string", Description: "Optional secret description"},
			{Name: "value", Type: "string", Required: true, Secret: true, Description: "Secret value"},
		},
		Examples: []string{`{"name":"OPENAI_API_KEY","description":"OpenAI key","value":"sk-..."}`},
	},
	"update:secret": {
		Key: "update:secret", Resource: "secret", Action: "update", Description: "Update secret metadata or rotate its value. id and projectId are injected.",
		Fields: []PayloadField{
			{Name: "name", Type: "string", Description: "New secret name"},
			{Name: "description", Type: "string", Description: "New secret description"},
			{Name: "value", Type: "string", Secret: true, Description: "New secret value"},
		},
		Examples: []string{`{"description":"rotated July 2026","value":"new-secret"}`},
	},
	"create:ai_provider": {
		Key: "create:ai_provider", Resource: "ai_provider", Action: "create", Description: "Create an AI provider. projectId is injected from the selected workspace.",
		Fields: []PayloadField{
			{Name: "name", Type: "string", Required: true, Description: "Provider display name"},
			{Name: "providerType", Type: "string", Required: true, Description: "Provider type such as openai or anthropic"},
			{Name: "endpoint", Type: "string", Required: true, Description: "Provider API base URL"},
			{Name: "apiKey", Type: "string", Required: true, Secret: true, Description: "Provider API key"},
			{Name: "models", Type: "[string]", Description: "Optional allow-list of model names"},
		},
		Examples: []string{`{"name":"OpenAI","providerType":"openai","endpoint":"https://api.openai.com/v1","apiKey":"sk-...","models":["gpt-4.1"]}`},
	},
	"update:ai_provider": {
		Key: "update:ai_provider", Resource: "ai_provider", Action: "update", Description: "Update an AI provider. id is injected.",
		Fields: []PayloadField{
			{Name: "name", Type: "string", Description: "New provider display name"},
			{Name: "endpoint", Type: "string", Description: "New provider API base URL"},
			{Name: "apiKey", Type: "string", Secret: true, Description: "New provider API key"},
			{Name: "models", Type: "[string]", Description: "Replacement allow-list of model names"},
		},
		Examples: []string{`{"models":["gpt-4.1","gpt-4.1-mini"]}`},
	},
	"create:dataset": {
		Key: "create:dataset", Resource: "dataset", Action: "create", Description: "Create a dataset. projectId is injected from the selected workspace.",
		Fields: []PayloadField{
			{Name: "name", Type: "string", Required: true, Description: "Dataset name"},
			{Name: "description", Type: "string", Required: true, Description: "Dataset description"},
			{Name: "sourceId", Type: "string", Description: "Optional source id for source-backed datasets"},
			{Name: "sourceObjectRef", Type: "SourceObjectRefInput", Description: "Optional source object reference"},
			{Name: "columns", Type: "[ColumnDefInput]", Description: "Manual schema columns"},
			{Name: "schemaMode", Type: "string", Description: "Schema mode such as manual"},
		},
		Examples: []string{`{"name":"Customers","schemaMode":"manual","columns":[{"name":"id","type":"text","isNullable":false,"isPrimary":true}]}`},
	},
	"update:dataset": {
		Key: "update:dataset", Resource: "dataset", Action: "update", Description: "Update a dataset. id and projectId are injected.",
		Fields: []PayloadField{
			{Name: "name", Type: "string", Description: "New dataset name"},
			{Name: "description", Type: "string", Description: "New dataset description"},
			{Name: "columns", Type: "[ColumnDefInput]", Description: "Replacement manual schema columns"},
			{Name: "schemaMode", Type: "string", Description: "New schema mode"},
		},
		Examples: []string{`{"description":"Customer import","schemaMode":"manual"}`},
	},
	"create:ontology_fast_lookup": {
		Key: "create:ontology_fast_lookup", Resource: "ontology_fast_lookup", Action: "create", Description: "Create an ontology fast lookup. projectId is injected from the selected workspace.",
		Fields: []PayloadField{
			{Name: "entityId", Type: "string", Required: true, Description: "Ontology id"},
			{Name: "fields", Type: "[string]", Required: true, Description: "Ontology properties to include"},
			{Name: "reason", Type: "string", Description: "Optional reason"},
		},
		Examples: []string{`{"entityId":"ontology_123","fields":["id","email"],"reason":"common lookup"}`},
	},
	"action:add_record:ontology": {
		Key: "action:add_record:ontology", Resource: "ontology", Action: "add_record", Description: "Add an ontology row. id becomes entityId and projectId is injected.",
		Fields: []PayloadField{
			{Name: "values", Type: "[RecordInput]", Required: true, Description: "Record values as key/value entries"},
		},
		Examples: []string{`{"values":[{"key":"id","value":"1"},{"key":"name","value":"Ada"}]}`},
	},
	"action:update_record:ontology": {
		Key: "action:update_record:ontology", Resource: "ontology", Action: "update_record", Description: "Update an ontology row. id becomes entityId and projectId is injected.",
		Fields: []PayloadField{
			{Name: "values", Type: "[RecordInput]", Required: true, Description: "Matcher and replacement values as key/value entries"},
			{Name: "updatedColumns", Type: "[string]", Required: true, Description: "Ontology properties to update"},
		},
		Examples: []string{`{"values":[{"key":"id","value":"1"},{"key":"name","value":"Grace"}],"updatedColumns":["name"]}`},
	},
	"action:delete_record:ontology": {
		Key: "action:delete_record:ontology", Resource: "ontology", Action: "delete_record", Description: "Delete an ontology row. id becomes entityId and projectId is injected.",
		Fields: []PayloadField{
			{Name: "values", Type: "[RecordInput]", Required: true, Description: "Matcher values, usually primary key values"},
		},
		Examples: []string{`{"values":[{"key":"id","value":"1"}]}`},
	},
	"action:run:transform": {
		Key: "action:run:transform", Resource: "transform", Action: "run", Description: "Run an existing transform. id and projectId are injected.",
	},
	"action:upload:file": {
		Key: "action:upload:file", Resource: "file", Action: "upload", Description: "Upload a local file. projectId is injected.",
		Fields: []PayloadField{
			{Name: "file_path", Type: "string", Required: true, Description: "Local file path"},
			{Name: "folderId", Type: "string", Description: "Destination folder id"},
		},
		Examples: []string{`{"file_path":"./customers.csv","folderId":"folder_123"}`},
	},
	"action:rename:file": {
		Key: "action:rename:file", Resource: "file", Action: "rename", Description: "Rename a file. id and projectId are injected.",
		Fields:   []PayloadField{{Name: "name", Type: "string", Required: true, Description: "New file name"}},
		Examples: []string{`{"name":"customers-2026.csv"}`},
	},
	"action:move:file": {
		Key: "action:move:file", Resource: "file", Action: "move", Description: "Move a file. id and projectId are injected.",
		Fields:   []PayloadField{{Name: "newFolderId", Type: "string|null", Description: "Destination folder id; null or empty means project root"}},
		Examples: []string{`{"newFolderId":"folder_123"}`},
	},
	"action:promote_to_dataset:file": {
		Key: "action:promote_to_dataset:file", Resource: "file", Action: "promote_to_dataset", Description: "Promote a tabular file to a dataset. id becomes fileId and projectId is injected.",
		Fields: []PayloadField{
			{Name: "datasetName", Type: "string", Required: true, Description: "Dataset name"},
			{Name: "description", Type: "string", Description: "Dataset description"},
			{Name: "sheetIndex", Type: "int", Description: "Optional tabular sheet index"},
			{Name: "columnMap", Type: "[FileColumnMapInput]", Required: true, Description: "Column mappings, usually from file inspection"},
		},
		Examples: []string{`{"datasetName":"Customers","columnMap":[{"sourceColumn":"id","datasetColumn":"id","dataType":"text","isNullable":false,"isPrimary":true}]}`},
	},
	"action:deploy:function": {
		Key: "action:deploy:function", Resource: "function", Action: "deploy", Description: "Deploy an existing function. id and projectId are injected.",
	},
	"action:redeploy:function": {
		Key: "action:redeploy:function", Resource: "function", Action: "redeploy", Description: "Redeploy an existing function. id and projectId are injected.",
	},
}

PayloadShapes describes payload_json shapes for common hosted platform writes.

Functions

func AIProviderCreatePayloadFromExport

func AIProviderCreatePayloadFromExport(provider AIProvider) map[string]any

AIProviderCreatePayloadFromExport converts exported AI provider metadata to a create payload.

func AddBundleDependencyMapping

func AddBundleDependencyMapping(dependencies BundleDependencyMap, sourceID, targetID string)

AddBundleDependencyMapping records a source to target id mapping.

func ApplyBundleDependencyMap

func ApplyBundleDependencyMap(action *BundleAction, dependencies BundleDependencyMap)

ApplyBundleDependencyMap rewrites project-local ids in a bundle action payload.

func AssignSourceConfigField

func AssignSourceConfigField(config *SourceConfig, key, value string)

AssignSourceConfigField maps a public source field name into a source config.

func BuildClonePayload

func BuildClonePayload(ctx context.Context, client CloneClient, projectID, resource, sourceRef, newName string) (map[string]any, error)

BuildClonePayload returns a create payload for cloning one resource in the same project.

func BundleMutationPayload

func BundleMutationPayload(action *BundleAction) map[string]any

BundleMutationPayload returns a copy of an import action payload suitable for GraphQL mutations.

func DatasetCreatePayloadFromExport

func DatasetCreatePayloadFromExport(dataset Dataset) map[string]any

DatasetCreatePayloadFromExport converts exported dataset metadata to a create payload.

func DefaultString

func DefaultString(value, fallback string) string

DefaultString returns fallback when value is empty.

func FunctionCreatePayloadFromExport

func FunctionCreatePayloadFromExport(fn Function, keepProjectReferences bool) map[string]any

FunctionCreatePayloadFromExport converts exported function metadata to a create payload.

func ImportAIProviderKeyEnvName

func ImportAIProviderKeyEnvName(name string) string

ImportAIProviderKeyEnvName returns the environment variable used for importing an AI provider API key.

func ImportSecretEnvName

func ImportSecretEnvName(name string) string

ImportSecretEnvName returns the environment variable used for importing a secret value.

func IsGraphQLValidationError

func IsGraphQLValidationError(err error) bool

IsGraphQLValidationError reports whether err is a GraphQL validation error.

func IsInvalidGrant

func IsInvalidGrant(err error) bool

IsInvalidGrant reports whether an auth failure means the refresh token is no longer usable.

func Logout

func Logout(ctx context.Context, host, accessToken string) error

Logout revokes the current authenticated platform session.

func NamesBy

func NamesBy[T any](values []T, name func(T) string) map[string]bool

NamesBy indexes values by a derived non-empty name.

func NormalizeHost

func NormalizeHost(raw string) (string, error)

NormalizeHost canonicalizes hosted WhoDB URLs for config and requests.

func OntologyCreatePayloadFromExport

func OntologyCreatePayloadFromExport(ontology Ontology) map[string]any

OntologyCreatePayloadFromExport converts exported ontology metadata to a create payload.

func RedactSourceValue

func RedactSourceValue(key, value string, sourceType *SourceType) string

RedactSourceValue masks a value when its source field is secret.

func RedactedValue

func RedactedValue() string

RedactedValue returns the placeholder used for masked source secrets.

func ResolveAuthHost

func ResolveAuthHost(ctx context.Context, host string) (string, error)

ResolveAuthHost returns the Mothergate base URL advertised by the WhoDB host.

func ResolveResourceID

func ResolveResourceID(ctx context.Context, client CloneClient, projectID, resource, value string) (string, error)

ResolveResourceID resolves a project resource by id or common display name.

func SafeIdentifier

func SafeIdentifier(value string) string

SafeIdentifier returns a lower-case API-safe identifier for cloned resources.

func SourceConfigFieldSecret

func SourceConfigFieldSecret(key string, sourceType *SourceType) bool

SourceConfigFieldSecret reports whether a source config field contains secret material.

func SourceFieldSecret

func SourceFieldSecret(field SourceConnectionField) bool

SourceFieldSecret reports whether a source type field should be treated as secret.

func TransformCreatePayloadFromExport

func TransformCreatePayloadFromExport(transform Transform) map[string]any

TransformCreatePayloadFromExport converts exported transform metadata to a create payload.

Types

type AIProvider

type AIProvider struct {
	ID           string `json:"id"`
	ProjectID    string `json:"projectId"`
	Name         string `json:"name"`
	ProviderType string `json:"providerType"`
	Endpoint     string `json:"endpoint"`
	CreatedBy    string `json:"createdBy"`
	CreatedAt    string `json:"createdAt"`
	UpdatedAt    string `json:"updatedAt"`
}

AIProvider describes a hosted AI provider without API key material.

type ActiveProdVersion

type ActiveProdVersion struct {
	ObjectID    string `json:"objectId"`
	ObjectType  string `json:"objectType"`
	Version     int    `json:"version"`
	ActivatedAt string `json:"activatedAt"`
	ActivatedBy string `json:"activatedBy"`
}

ActiveProdVersion describes the currently active hosted platform object version.

type AuthConfig

type AuthConfig struct {
	MothergateURL string `json:"mothergateUrl"`
}

AuthConfig is the public auth configuration advertised by a WhoDB platform host.

type AuthHTTPError

type AuthHTTPError struct {
	StatusCode int
	Status     string
	Code       string
	Message    string
}

AuthHTTPError describes a failed Mothergate auth endpoint response.

func (*AuthHTTPError) Error

func (e *AuthHTTPError) Error() string

type BundleAction

type BundleAction struct {
	Resource string         `json:"resource"`
	Name     string         `json:"name"`
	SourceID string         `json:"sourceId,omitempty"`
	TargetID string         `json:"targetId,omitempty"`
	Action   string         `json:"action"`
	Reason   string         `json:"reason,omitempty"`
	Impacts  []string       `json:"impacts,omitempty"`
	Payload  map[string]any `json:"payload,omitempty"`
}

BundleAction describes one import-plan action for a project bundle item.

type BundleClient

type BundleClient interface {
	ProjectSecrets(context.Context, string) ([]ProjectSecret, error)
	AIProviders(context.Context, string) ([]AIProvider, error)
	Datasets(context.Context, string) ([]Dataset, error)
	Ontologies(context.Context, string) ([]Ontology, error)
	Transforms(context.Context, string) ([]Transform, error)
	Functions(context.Context, string, []string) ([]Function, error)
	FolderContents(context.Context, string, string, []string) (*FolderContents, error)
	FilePreview(context.Context, string, string, *int, []string) (*FilePreviewResult, error)
}

BundleClient is the platform API surface needed to export and plan project bundles.

type BundleDependencyMap

type BundleDependencyMap map[string]string

BundleDependencyMap maps exported resource ids to target resource ids during import.

type BundleExportOptions

type BundleExportOptions struct {
	IncludeFiles bool
	MaxFileBytes int
}

BundleExportOptions controls project bundle export behavior.

type BundleImportOptions

type BundleImportOptions struct {
	DryRun             bool
	Prefix             string
	RenameConflicts    bool
	OverwriteConflicts bool
	Getenv             func(string) string
}

BundleImportOptions controls how a project bundle is planned.

type BundlePlan

type BundlePlan struct {
	Host              string         `json:"host"`
	SourceProjectID   string         `json:"sourceProjectId,omitempty"`
	SourceProjectName string         `json:"sourceProjectName,omitempty"`
	TargetProjectID   string         `json:"targetProjectId"`
	TargetProjectName string         `json:"targetProjectName"`
	DryRun            bool           `json:"dryRun"`
	Actions           []BundleAction `json:"actions"`
}

BundlePlan describes how a bundle would apply to a selected project.

func PlanBundleImport

func PlanBundleImport(ctx context.Context, client BundleClient, host string, project *Project, bundle *ProjectBundle, dryRun bool, getenv func(string) string) (*BundlePlan, error)

PlanBundleImport returns create/skip actions for applying a bundle to a project.

func PlanBundleImportWithOptions

func PlanBundleImportWithOptions(ctx context.Context, client BundleClient, host string, project *Project, bundle *ProjectBundle, options BundleImportOptions) (*BundlePlan, error)

PlanBundleImportWithOptions returns actions for applying a bundle to a project.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client sends authenticated requests to a hosted WhoDB platform endpoint.

func NewClient

func NewClient(host, accessToken string) (*Client, error)

NewClient creates a hosted WhoDB platform client.

func (*Client) AIProviderModels

func (c *Client) AIProviderModels(ctx context.Context, projectID, providerID string) ([]string, error)

AIProviderModels returns model names advertised by one hosted AI provider.

func (*Client) AIProviders

func (c *Client) AIProviders(ctx context.Context, projectID string) ([]AIProvider, error)

AIProviders returns hosted AI provider metadata without API keys.

func (*Client) ActiveProdVersion

func (c *Client) ActiveProdVersion(ctx context.Context, projectID, objectID, objectType string) (*ActiveProdVersion, error)

ActiveProdVersion returns the currently active version for one hosted platform object.

func (*Client) CreateSource

func (c *Client) CreateSource(ctx context.Context, input CreateSourceInput) (*Source, error)

CreateSource creates a hosted source in one project.

func (*Client) Dataset

func (c *Client) Dataset(ctx context.Context, projectID, id string) (*Dataset, error)

Dataset returns one hosted dataset.

func (*Client) DatasetRows

func (c *Client) DatasetRows(ctx context.Context, projectID, datasetID string, pageSize, pageOffset int) (*DatasetQueryResult, error)

DatasetRows returns row previews for one hosted dataset.

func (*Client) Datasets

func (c *Client) Datasets(ctx context.Context, projectID string) ([]Dataset, error)

Datasets returns hosted datasets in one project.

func (*Client) DeleteSource

func (c *Client) DeleteSource(ctx context.Context, orgID, projectID, sourceID string) error

DeleteSource deletes a hosted source from one project.

func (*Client) ExecuteFunction

func (c *Client) ExecuteFunction(ctx context.Context, projectID, functionID, input string, inputFileIDs []string) (*FunctionExecutionResult, error)

ExecuteFunction runs one hosted ontology function with a JSON input string.

func (*Client) FilePreview

func (c *Client) FilePreview(ctx context.Context, projectID, fileID string, sheetIndex *int, fields []string) (*FilePreviewResult, error)

FilePreview returns a hosted project file preview.

func (*Client) FolderContents

func (c *Client) FolderContents(ctx context.Context, projectID, folderID string, fields []string) (*FolderContents, error)

FolderContents returns hosted project folder contents.

func (*Client) Function

func (c *Client) Function(ctx context.Context, projectID, id string, fields []string) (*Function, error)

Function returns one hosted ontology function.

func (*Client) Functions

func (c *Client) Functions(ctx context.Context, projectID string, fields []string) ([]Function, error)

Functions returns hosted ontology functions in one project.

func (*Client) Host

func (c *Client) Host() string

Host returns the canonical hosted WhoDB platform URL.

func (*Client) Lineage

func (c *Client) Lineage(ctx context.Context, projectID, rootID, rootType, direction string, maxDepth int) (*LineageGraph, error)

Lineage returns lineage around one root node.

func (*Client) LineageNeighbors

func (c *Client) LineageNeighbors(ctx context.Context, projectID, nodeID, nodeType string) (*LineageGraph, error)

LineageNeighbors returns immediate lineage neighbors for one node.

func (*Client) Me

func (c *Client) Me(ctx context.Context) (*User, error)

Me returns the authenticated platform user.

func (*Client) ObjectVersions

func (c *Client) ObjectVersions(ctx context.Context, projectID, objectID, objectType string) ([]ObjectVersion, error)

ObjectVersions returns promoted versions for one hosted platform object.

func (*Client) Ontologies

func (c *Client) Ontologies(ctx context.Context, projectID string) ([]Ontology, error)

Ontologies returns hosted ontology object types in one project.

func (*Client) Ontology

func (c *Client) Ontology(ctx context.Context, projectID, id string) (*Ontology, error)

Ontology returns one hosted ontology object type.

func (*Client) OntologyFastLookupSuggestions

func (c *Client) OntologyFastLookupSuggestions(ctx context.Context, projectID, entityID string) ([]OntologyFastLookupSuggestion, error)

OntologyFastLookupSuggestions returns suggested fast lookups for one ontology.

func (*Client) OntologyFastLookups

func (c *Client) OntologyFastLookups(ctx context.Context, projectID, entityID string) ([]OntologyFastLookup, error)

OntologyFastLookups returns saved fast lookups for one ontology.

func (c *Client) OntologyFollowIncomingLink(ctx context.Context, projectID, entityID, pk, sourceEntityID, linkAPIName string, pageSize, pageOffset int) (*DatasetQueryResult, error)

OntologyFollowIncomingLink returns rows that reference one ontology record.

func (c *Client) OntologyFollowLink(ctx context.Context, projectID, entityID, pk, linkAPIName string, pageSize, pageOffset int) (*DatasetQueryResult, error)

OntologyFollowLink returns linked rows for one ontology row.

func (*Client) OntologyRows

func (c *Client) OntologyRows(ctx context.Context, projectID, id string, pageSize, pageOffset int) (*DatasetQueryResult, error)

OntologyRows returns row previews for one ontology.

func (*Client) Organizations

func (c *Client) Organizations(ctx context.Context) ([]Organization, error)

Organizations returns organizations visible to the authenticated user.

func (*Client) PlatformManifest

func (c *Client) PlatformManifest(ctx context.Context) (*PlatformManifest, error)

PlatformManifest returns the hosted platform contract advertised to the CLI.

func (*Client) PlatformMutation

func (c *Client) PlatformMutation(ctx context.Context, operation string, variables map[string]any) (*PlatformMutationResult, error)

PlatformMutation executes one whitelisted hosted platform mutation.

func (*Client) PlatformQuery

func (c *Client) PlatformQuery(ctx context.Context, operation string, variables map[string]any) (any, error)

PlatformQuery executes one allow-listed hosted platform query and returns its decoded data object. Workspace identifiers are injected by the MCP layer.

func (*Client) PlatformVersion

func (c *Client) PlatformVersion(ctx context.Context) (string, error)

PlatformVersion returns the hosted platform version string.

func (*Client) PreviewFunction

func (c *Client) PreviewFunction(ctx context.Context, projectID, language, entryPoint, input string, files []FunctionFile, dependencies []string) (*FunctionExecutionResult, error)

PreviewFunction runs an unsaved function definition without persisting it.

func (*Client) ProjectLineage

func (c *Client) ProjectLineage(ctx context.Context, projectID string) (*LineageGraph, error)

ProjectLineage returns the hosted project lineage graph.

func (*Client) ProjectSecrets

func (c *Client) ProjectSecrets(ctx context.Context, projectID string) ([]ProjectSecret, error)

ProjectSecrets returns hosted project secret metadata and usage without values.

func (*Client) ProjectSources

func (c *Client) ProjectSources(ctx context.Context, orgID, projectID string) ([]Source, error)

ProjectSources returns sources visible to the user in one project.

func (*Client) ProjectStorageUsage

func (c *Client) ProjectStorageUsage(ctx context.Context, projectID string) (int, error)

ProjectStorageUsage returns hosted project storage usage in bytes.

func (*Client) ProjectTabularFiles

func (c *Client) ProjectTabularFiles(ctx context.Context, projectID string) ([]ProjectFile, error)

ProjectTabularFiles returns hosted project files that can back datasets.

func (*Client) Projects

func (c *Client) Projects(ctx context.Context, orgID string) ([]Project, error)

Projects returns projects visible in one organization.

func (*Client) PromoteObject

func (c *Client) PromoteObject(ctx context.Context, projectID, objectID, objectType, message string) (*ObjectVersion, error)

PromoteObject snapshots a draft object and makes the new version active.

func (*Client) RequireOperation

func (c *Client) RequireOperation(kind, name, feature string) error

RequireOperation returns an error when the cached manifest does not publish an operation.

func (*Client) RestoreFunctionVersionToDraft

func (c *Client) RestoreFunctionVersionToDraft(ctx context.Context, projectID, functionID string, version int) (*Function, error)

RestoreFunctionVersionToDraft copies a promoted function version back into the draft function.

func (*Client) SearchProjectFiles

func (c *Client) SearchProjectFiles(ctx context.Context, projectID, query string) ([]ProjectFile, error)

SearchProjectFiles returns hosted project files matching a query.

func (*Client) SetActiveObjectVersion

func (c *Client) SetActiveObjectVersion(ctx context.Context, projectID, objectID, objectType string, version int) (*ActiveProdVersion, error)

SetActiveObjectVersion makes an existing promoted object version active.

func (*Client) SetManifestRefresher

func (c *Client) SetManifestRefresher(refresher ManifestRefresher)

SetManifestRefresher sets the callback used for one-shot schema refresh retries.

func (*Client) SetPlatformManifest

func (c *Client) SetPlatformManifest(manifest *PlatformManifest)

SetPlatformManifest attaches a cached hosted platform manifest to the client.

func (*Client) SetWorkspaceContext

func (c *Client) SetWorkspaceContext(orgID, projectID string)

SetWorkspaceContext attaches the selected hosted workspace to future platform requests.

func (*Client) SourceColumns

func (c *Client) SourceColumns(ctx context.Context, orgID, projectID, sourceID string, ref SourceObjectRefInput) ([]Column, error)

SourceColumns returns columns for one hosted source object.

func (*Client) SourceConfig

func (c *Client) SourceConfig(ctx context.Context, orgID, projectID, sourceID string) (*SourceConfig, error)

SourceConfig returns one hosted source's connection configuration.

func (*Client) SourceContent

func (c *Client) SourceContent(ctx context.Context, projectID, sourceID string, ref SourceObjectRefInput, fields []string) (*SourceContent, error)

SourceContent returns content for one hosted source object.

func (*Client) SourceFieldConstraints

func (c *Client) SourceFieldConstraints(ctx context.Context, projectID, sourceID string, ref SourceObjectRefInput) ([]SourceFieldConstraints, error)

SourceFieldConstraints returns field constraints for one hosted source object.

func (*Client) SourceObjects

func (c *Client) SourceObjects(ctx context.Context, orgID, projectID, sourceID string, parent *SourceObjectRefInput, kinds []SourceObjectKind, pageSize, pageOffset int) ([]SourceObject, error)

SourceObjects returns browseable objects for one hosted source.

func (*Client) SourceRows

func (c *Client) SourceRows(ctx context.Context, orgID, projectID, sourceID string, ref SourceObjectRefInput, pageSize, pageOffset int) (*RowsResult, error)

SourceRows returns rows for one hosted source object.

func (*Client) SourceTypes

func (c *Client) SourceTypes(ctx context.Context) ([]SourceType, error)

SourceTypes returns source types available on the hosted platform.

func (*Client) TestFunction

func (c *Client) TestFunction(ctx context.Context, projectID, functionID, input string, files []FunctionFile, inputFileIDs []string) (*FunctionExecutionResult, error)

TestFunction runs a saved function draft with optional local file overrides.

func (*Client) TestSourceConnection

func (c *Client) TestSourceConnection(ctx context.Context, input CreateSourceInput) error

TestSourceConnection checks whether a draft source configuration can connect.

func (*Client) TransformRuns

func (c *Client) TransformRuns(ctx context.Context, projectID, transformID string, limit int) ([]TransformRun, error)

TransformRuns returns recent runs for one hosted transform.

func (*Client) Transforms

func (c *Client) Transforms(ctx context.Context, projectID string) ([]Transform, error)

Transforms returns hosted transforms in one project.

func (*Client) UpdateSource

func (c *Client) UpdateSource(ctx context.Context, input UpdateSourceInput) (*Source, error)

UpdateSource updates one hosted source's metadata or connection configuration.

func (*Client) UploadProjectFile

func (c *Client) UploadProjectFile(ctx context.Context, projectID string, folderID *string, filePath string) (*ProjectFile, error)

UploadProjectFile uploads one local file to hosted project storage.

type CloneClient

type CloneClient interface {
	Datasets(context.Context, string) ([]Dataset, error)
	Dataset(context.Context, string, string) (*Dataset, error)
	Ontologies(context.Context, string) ([]Ontology, error)
	Ontology(context.Context, string, string) (*Ontology, error)
	Transforms(context.Context, string) ([]Transform, error)
	Functions(context.Context, string, []string) ([]Function, error)
	Function(context.Context, string, string, []string) (*Function, error)
}

CloneClient is the platform API surface needed to clone project resources.

type Column

type Column struct {
	Type             string `json:"type"`
	Name             string `json:"name"`
	MetadataFidelity string `json:"metadataFidelity"`
	IsPrimary        bool   `json:"isPrimary"`
	IsForeignKey     bool   `json:"isForeignKey"`
	ReferencedTable  string `json:"referencedTable,omitempty"`
	ReferencedColumn string `json:"referencedColumn,omitempty"`
	Length           *int   `json:"length,omitempty"`
	Precision        *int   `json:"precision,omitempty"`
	Scale            *int   `json:"scale,omitempty"`
}

Column describes a column returned by a hosted source.

type ColumnDef

type ColumnDef struct {
	Name       string `json:"name"`
	Type       string `json:"type"`
	IsNullable bool   `json:"isNullable"`
	IsPrimary  bool   `json:"isPrimary"`
}

ColumnDef describes one dataset column.

type CreateSourceInput

type CreateSourceInput struct {
	OrgID        string
	ProjectID    string
	Name         string
	DatabaseType string
	Hostname     string
	Port         string
	Username     string
	Password     string
	Database     string
	Advanced     map[string]string
}

CreateSourceInput describes a hosted WhoDB source to create in one project.

type Dataset

type Dataset struct {
	ID          string      `json:"id"`
	ProjectID   string      `json:"projectId"`
	SourceID    string      `json:"sourceId"`
	Name        string      `json:"name"`
	Description string      `json:"description"`
	Schema      []ColumnDef `json:"schema"`
	SchemaMode  string      `json:"schemaMode"`
	OwnerID     string      `json:"ownerId"`
	RowCount    int         `json:"rowCount"`
	SizeBytes   int         `json:"sizeBytes"`
	CreatedAt   string      `json:"createdAt"`
	UpdatedAt   string      `json:"updatedAt"`
}

Dataset describes one hosted dataset.

type DatasetQueryResult

type DatasetQueryResult struct {
	Columns []string   `json:"columns"`
	Rows    [][]string `json:"rows"`
	Total   int        `json:"total"`
}

DatasetQueryResult contains tabular dataset or ontology rows.

type FileColumnInspection

type FileColumnInspection struct {
	SourceColumn     string `json:"sourceColumn"`
	DatasetColumn    string `json:"datasetColumn"`
	DataType         string `json:"dataType"`
	IsNullable       bool   `json:"isNullable"`
	IsPrimary        bool   `json:"isPrimary"`
	ColumnMapFlag    string `json:"columnMapFlag"`
	ColumnMapSnippet string `json:"columnMapSnippet"`
}

FileColumnInspection describes one inferred tabular file column.

type FileInspection

type FileInspection struct {
	FileID           string                 `json:"fileId"`
	MIMEType         string                 `json:"mimeType"`
	SizeBytes        int                    `json:"sizeBytes"`
	IsTabular        bool                   `json:"isTabular"`
	SheetName        *string                `json:"sheetName,omitempty"`
	SheetIndex       *int                   `json:"sheetIndex,omitempty"`
	SheetCount       *int                   `json:"sheetCount,omitempty"`
	SheetNames       []string               `json:"sheetNames,omitempty"`
	Columns          []FileColumnInspection `json:"columns"`
	Rows             [][]string             `json:"rows,omitempty"`
	Total            int                    `json:"total"`
	ColumnMapFlags   []string               `json:"columnMapFlags"`
	ColumnMapExample string                 `json:"columnMapExample"`
}

FileInspection describes a project file and promotion-ready column mappings.

func InspectFilePreview

func InspectFilePreview(fileID string, preview *FilePreviewResult) *FileInspection

InspectFilePreview builds a stable inspection payload from a file preview.

type FilePreviewColumn

type FilePreviewColumn struct {
	Name string `json:"name"`
	Type string `json:"type"`
}

FilePreviewColumn describes one tabular file preview column.

type FilePreviewResult

type FilePreviewResult struct {
	MIMEType    string              `json:"mimeType"`
	SizeBytes   int                 `json:"sizeBytes"`
	IsTabular   bool                `json:"isTabular"`
	Tabular     *TabularPreviewData `json:"tabular,omitempty"`
	TextContent *string             `json:"textContent,omitempty"`
}

FilePreviewResult describes a hosted project file preview.

type FolderContents

type FolderContents struct {
	Folders     []ProjectFolder `json:"folders"`
	Files       []ProjectFile   `json:"files"`
	Breadcrumbs []ProjectFolder `json:"breadcrumbs"`
	StorageUsed int             `json:"storageUsed"`
}

FolderContents describes a hosted project folder listing.

type ForeignKeyDefinition

type ForeignKeyDefinition struct {
	Table  string `json:"table"`
	Column string `json:"column"`
}

ForeignKeyDefinition describes a source field foreign key target.

type Function

type Function struct {
	ID                  string                   `json:"id"`
	ProjectID           string                   `json:"projectId"`
	Name                string                   `json:"name"`
	Description         string                   `json:"description"`
	Language            string                   `json:"language"`
	EntryPoint          string                   `json:"entryPoint"`
	TimeoutSeconds      int                      `json:"timeoutSeconds"`
	Memory              string                   `json:"memory"`
	CPU                 string                   `json:"cpu"`
	CreatedBy           string                   `json:"createdBy"`
	CreatedAt           string                   `json:"createdAt"`
	UpdatedAt           string                   `json:"updatedAt"`
	Files               []FunctionFile           `json:"files"`
	Dependencies        []FunctionDependency     `json:"dependencies"`
	ProviderIDs         []string                 `json:"providerIds"`
	OntologyIDs         []string                 `json:"ontologyIds"`
	ReadOnlyOntologyIDs []string                 `json:"readOnlyOntologyIds"`
	ProviderConfigs     []FunctionProviderConfig `json:"providerConfigs"`
	SecretBindings      []FunctionSecretBinding  `json:"secretBindings"`
	DefaultMaxTokens    int                      `json:"defaultMaxTokens"`
	DefaultTemperature  float64                  `json:"defaultTemperature"`
	IsDeployed          bool                     `json:"isDeployed"`
}

Function describes one hosted ontology function.

type FunctionDependency

type FunctionDependency struct {
	ID      string `json:"id"`
	Name    string `json:"name"`
	Version string `json:"version"`
}

FunctionDependency describes one hosted function dependency.

type FunctionExecutionResult

type FunctionExecutionResult struct {
	Output     *string `json:"output,omitempty"`
	Logs       string  `json:"logs"`
	DurationMS int     `json:"durationMs"`
	Success    bool    `json:"success"`
	Error      *string `json:"error,omitempty"`
}

FunctionExecutionResult describes one hosted function execution result.

type FunctionFile

type FunctionFile struct {
	ID      string `json:"id"`
	Path    string `json:"path"`
	Content string `json:"content"`
}

FunctionFile describes one hosted function source file.

type FunctionProviderConfig

type FunctionProviderConfig struct {
	ProviderID string `json:"providerId"`
	Model      string `json:"model"`
}

FunctionProviderConfig describes one function AI provider model binding.

type FunctionSecretBinding

type FunctionSecretBinding struct {
	Name     string `json:"name"`
	SecretID string `json:"secretId"`
	Target   string `json:"target"`
}

FunctionSecretBinding describes a function secret reference without secret values.

type GenericWriteMode

type GenericWriteMode string

GenericWriteMode describes how generic hosted platform write variables are shaped.

const (
	// GenericWriteModeInput wraps payload fields in an input variable.
	GenericWriteModeInput GenericWriteMode = "input"
	// GenericWriteModeProjectID passes projectId and id as top-level variables.
	GenericWriteModeProjectID GenericWriteMode = "project_id"
	// GenericWriteModeID passes id as the only top-level identity variable.
	GenericWriteModeID GenericWriteMode = "id"
	// GenericWriteModeProjectIDName passes projectId, id, and name as top-level variables.
	GenericWriteModeProjectIDName GenericWriteMode = "project_id_name"
	// GenericWriteModeDirect passes the payload as direct GraphQL variables.
	GenericWriteModeDirect GenericWriteMode = "direct"
	// GenericWriteModeFileUpload uses the hosted multipart file upload path.
	GenericWriteModeFileUpload GenericWriteMode = "file_upload"
)

type GenericWriteSpec

type GenericWriteSpec struct {
	Resource        string
	Action          string
	Mutation        string
	Mode            GenericWriteMode
	NeedsID         bool
	InjectProjectID bool
}

GenericWriteSpec describes one hosted platform resource write supported by CLI and MCP.

type GraphQLError

type GraphQLError struct {
	Message string
	Code    string
}

GraphQLError is a GraphQL response error from the hosted platform.

func (GraphQLError) Error

func (e GraphQLError) Error() string

type LineageEdge

type LineageEdge struct {
	SourceID   string `json:"sourceId"`
	SourceType string `json:"sourceType"`
	TargetID   string `json:"targetId"`
	TargetType string `json:"targetType"`
	CreatedAt  string `json:"createdAt"`
}

LineageEdge describes one lineage graph edge.

type LineageGraph

type LineageGraph struct {
	Nodes []LineageNode `json:"nodes"`
	Edges []LineageEdge `json:"edges"`
}

LineageGraph describes a hosted lineage graph.

type LineageNode

type LineageNode struct {
	ID       string `json:"id"`
	NodeType string `json:"nodeType"`
	Name     string `json:"name"`
}

LineageNode describes one lineage graph node.

type LoginOptions

type LoginOptions struct {
	Host        string
	OpenBrowser bool
	PrintURL    func(string)
	Timeout     time.Duration
}

LoginOptions configures the browser PKCE login flow.

type ManifestRefresher

type ManifestRefresher func(context.Context, *Client) (*PlatformManifest, error)

ManifestRefresher reloads a hosted platform manifest after schema validation drift.

type ObjectVersion

type ObjectVersion struct {
	ID         string `json:"id"`
	ObjectID   string `json:"objectId"`
	ObjectType string `json:"objectType"`
	Version    int    `json:"version"`
	Message    string `json:"message"`
	PromotedBy string `json:"promotedBy"`
	CreatedAt  string `json:"createdAt"`
}

ObjectVersion describes one promoted hosted platform object version.

type Ontology

type Ontology struct {
	ID                string             `json:"id"`
	ProjectID         string             `json:"projectId"`
	APIName           string             `json:"apiName"`
	DisplayName       string             `json:"displayName"`
	PluralDisplayName string             `json:"pluralDisplayName"`
	Description       string             `json:"description"`
	PrimaryKey        string             `json:"primaryKey"`
	SourceID          *string            `json:"sourceId,omitempty"`
	TableName         string             `json:"tableName"`
	SchemaName        string             `json:"schemaName"`
	Status            string             `json:"status"`
	Icon              string             `json:"icon"`
	Color             string             `json:"color"`
	CreatedAt         string             `json:"createdAt"`
	UpdatedAt         string             `json:"updatedAt"`
	Properties        []OntologyProperty `json:"properties"`
	Links             []OntologyLink     `json:"links"`
}

Ontology describes one hosted ontology object type.

type OntologyFastLookup

type OntologyFastLookup struct {
	ID          string   `json:"id"`
	EntityID    string   `json:"entityId"`
	DisplayName string   `json:"displayName"`
	Fields      []string `json:"fields"`
	Status      string   `json:"status"`
	Reason      string   `json:"reason"`
	CreatedAt   string   `json:"createdAt"`
	UpdatedAt   string   `json:"updatedAt"`
}

OntologyFastLookup describes one saved ontology fast lookup.

type OntologyFastLookupSuggestion

type OntologyFastLookupSuggestion struct {
	EntityID    string   `json:"entityId"`
	DisplayName string   `json:"displayName"`
	Fields      []string `json:"fields"`
	Reason      string   `json:"reason"`
	CanCreate   bool     `json:"canCreate"`
}

OntologyFastLookupSuggestion describes one suggested ontology fast lookup.

type OntologyLink struct {
	ID                       string `json:"id"`
	APIName                  string `json:"apiName"`
	TargetOntologyAPIName    string `json:"targetOntologyApiName"`
	Cardinality              string `json:"cardinality"`
	ForeignKeyProperty       string `json:"foreignKeyProperty"`
	TargetForeignKeyProperty string `json:"targetForeignKeyProperty"`
	JoinTable                string `json:"joinTable"`
	SourceColumnInJoinTable  string `json:"sourceColumnInJoinTable"`
	TargetColumnInJoinTable  string `json:"targetColumnInJoinTable"`
	DisplayName              string `json:"displayName"`
	PluralDisplayName        string `json:"pluralDisplayName"`
	ReverseDisplayName       string `json:"reverseDisplayName"`
}

OntologyLink describes one ontology relationship.

type OntologyProperty

type OntologyProperty struct {
	ID               string `json:"id"`
	APIName          string `json:"apiName"`
	DisplayName      string `json:"displayName"`
	Description      string `json:"description"`
	ColumnName       string `json:"columnName"`
	DataType         string `json:"dataType"`
	ArrayElementType string `json:"arrayElementType"`
	IsRequired       bool   `json:"isRequired"`
	Visibility       string `json:"visibility"`
	IsSearchable     bool   `json:"isSearchable"`
	IsSortable       bool   `json:"isSortable"`
	IsEditOnly       bool   `json:"isEditOnly"`
	SortOrder        int    `json:"sortOrder"`
}

OntologyProperty describes one ontology field.

type Organization

type Organization struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Slug string `json:"slug"`
}

Organization is a WhoDB platform organization visible to the user.

type PayloadField

type PayloadField struct {
	Name        string
	Type        string
	Required    bool
	Secret      bool
	Description string
}

PayloadField describes one payload_json field for a generic write.

type PayloadShape

type PayloadShape struct {
	Key         string
	Resource    string
	Action      string
	Description string
	Fields      []PayloadField
	Examples    []string
}

PayloadShape describes the payload_json object expected for one generic write.

type PlatformManifest

type PlatformManifest struct {
	PlatformVersion         string                      `json:"platformVersion"`
	ManifestProtocolVersion string                      `json:"manifestProtocolVersion"`
	GeneratedAt             string                      `json:"generatedAt"`
	Operations              []PlatformManifestOperation `json:"operations"`
	Types                   []PlatformManifestType      `json:"types"`
}

PlatformManifest describes the hosted CLI contract published by WhoDB.

func (*PlatformManifest) HasOperation

func (m *PlatformManifest) HasOperation(kind, name string) bool

HasOperation reports whether the hosted platform published an operation.

func (*PlatformManifest) RequireOperation

func (m *PlatformManifest) RequireOperation(kind, name, feature string) error

RequireOperation returns an error if the hosted platform did not publish an operation.

func (*PlatformManifest) SelectFields

func (m *PlatformManifest) SelectFields(typeName string, desired []string) []string

SelectFields returns desired fields that are present in the hosted type.

type PlatformManifestField

type PlatformManifestField struct {
	Name     string `json:"name"`
	Type     string `json:"type"`
	Required bool   `json:"required"`
	List     bool   `json:"list"`
}

PlatformManifestField describes one field or argument in the hosted CLI contract.

type PlatformManifestOperation

type PlatformManifestOperation struct {
	Name    string                  `json:"name"`
	Kind    string                  `json:"kind"`
	Args    []PlatformManifestField `json:"args"`
	Returns string                  `json:"returns"`
}

PlatformManifestOperation describes one hosted operation available to the CLI.

type PlatformManifestType

type PlatformManifestType struct {
	Name   string                  `json:"name"`
	Fields []PlatformManifestField `json:"fields"`
}

PlatformManifestType describes one hosted object type available to the CLI.

type PlatformMutationResult

type PlatformMutationResult struct {
	Operation string
	Data      json.RawMessage
}

PlatformMutationResult contains the raw JSON payload returned by one hosted platform mutation.

type PlatformSecretUsage

type PlatformSecretUsage struct {
	ConsumerType string `json:"consumerType"`
	ConsumerID   string `json:"consumerId"`
	ConsumerName string `json:"consumerName"`
	BindingName  string `json:"bindingName"`
	Mode         string `json:"mode"`
}

PlatformSecretUsage describes where a hosted secret is bound.

type Project

type Project struct {
	ID          string `json:"id"`
	OrgID       string `json:"orgId"`
	Name        string `json:"name"`
	Slug        string `json:"slug"`
	Description string `json:"description"`
}

Project is a WhoDB platform project visible to the user.

type ProjectBundle

type ProjectBundle struct {
	BundleVersion int             `json:"bundleVersion"`
	ExportedAt    string          `json:"exportedAt"`
	Host          string          `json:"host"`
	OrgID         string          `json:"orgId"`
	OrgName       string          `json:"orgName"`
	ProjectID     string          `json:"projectId"`
	ProjectName   string          `json:"projectName"`
	Secrets       []ProjectSecret `json:"secrets"`
	AIProviders   []AIProvider    `json:"aiProviders"`
	Datasets      []Dataset       `json:"datasets"`
	Ontologies    []Ontology      `json:"ontologies"`
	Transforms    []Transform     `json:"transforms"`
	Functions     []Function      `json:"functions"`
	Folders       []ProjectFolder `json:"folders"`
	Files         []ProjectFile   `json:"files"`
	Notes         []string        `json:"notes,omitempty"`
}

ProjectBundle is a portable metadata bundle for one hosted WhoDB project.

func BuildProjectBundle

func BuildProjectBundle(ctx context.Context, client BundleClient, host, orgID, orgName string, project *Project) (*ProjectBundle, error)

BuildProjectBundle exports project metadata into a portable bundle.

func BuildProjectBundleWithOptions

func BuildProjectBundleWithOptions(ctx context.Context, client BundleClient, host, orgID, orgName string, project *Project, options BundleExportOptions) (*ProjectBundle, error)

BuildProjectBundleWithOptions exports project metadata into a portable bundle.

type ProjectFile

type ProjectFile struct {
	ID          string  `json:"id"`
	ProjectID   string  `json:"projectId"`
	FolderID    *string `json:"folderId,omitempty"`
	Name        string  `json:"name"`
	MIMEType    string  `json:"mimeType"`
	SizeBytes   int     `json:"sizeBytes"`
	IsTabular   bool    `json:"isTabular"`
	RowCount    *int    `json:"rowCount,omitempty"`
	ColumnCount *int    `json:"columnCount,omitempty"`
	DatasetID   *string `json:"datasetId,omitempty"`
	UploadedBy  string  `json:"uploadedBy"`
	CreatedAt   string  `json:"createdAt"`
	UpdatedAt   string  `json:"updatedAt"`
	Content     string  `json:"content,omitempty"`
	ContentType string  `json:"contentType,omitempty"`
	Truncated   bool    `json:"truncated,omitempty"`
	Path        string  `json:"path,omitempty"`
	FolderPath  string  `json:"folderPath,omitempty"`
}

ProjectFile describes one hosted project file.

type ProjectFolder

type ProjectFolder struct {
	ID        string  `json:"id"`
	ProjectID string  `json:"projectId"`
	ParentID  *string `json:"parentId,omitempty"`
	Name      string  `json:"name"`
	CreatedBy string  `json:"createdBy"`
	CreatedAt string  `json:"createdAt"`
	Path      string  `json:"path,omitempty"`
}

ProjectFolder describes one hosted project folder.

type ProjectSecret

type ProjectSecret struct {
	ID          string                `json:"id"`
	ProjectID   string                `json:"projectId"`
	Name        string                `json:"name"`
	Description string                `json:"description"`
	CreatedBy   string                `json:"createdBy"`
	UpdatedBy   string                `json:"updatedBy"`
	CreatedAt   string                `json:"createdAt"`
	UpdatedAt   string                `json:"updatedAt"`
	LastUsedAt  *string               `json:"lastUsedAt,omitempty"`
	UsedBy      []PlatformSecretUsage `json:"usedBy"`
}

ProjectSecret describes secret metadata and usage without secret values.

type Record

type Record struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

Record is a key-value metadata entry returned by WhoDB.

type RedactedSourceConfig

type RedactedSourceConfig struct {
	Hostname string            `json:"hostname"`
	Port     string            `json:"port"`
	Username string            `json:"username"`
	Password string            `json:"password"`
	Database string            `json:"database"`
	Advanced map[string]string `json:"advanced"`
}

RedactedSourceConfig is a source connection configuration with secrets masked.

func RedactSourceConfig

func RedactSourceConfig(config *SourceConfig, sourceType *SourceType) RedactedSourceConfig

RedactSourceConfig masks secrets in source connection configuration.

type RowsResult

type RowsResult struct {
	Columns       []Column   `json:"columns"`
	Rows          [][]string `json:"rows"`
	DisableUpdate bool       `json:"disableUpdate"`
	TotalCount    int        `json:"totalCount"`
}

RowsResult contains tabular rows returned by a hosted source.

type Source

type Source struct {
	ID           string `json:"id"`
	ProjectID    string `json:"projectId"`
	Name         string `json:"name"`
	DatabaseType string `json:"databaseType"`
	CreatedBy    string `json:"createdBy"`
	CreatedAt    string `json:"createdAt"`
}

Source is a hosted WhoDB project source visible to the authenticated user.

type SourceConfig

type SourceConfig struct {
	Hostname string            `json:"hostname"`
	Port     string            `json:"port"`
	Username string            `json:"username"`
	Password string            `json:"password"`
	Database string            `json:"database"`
	Advanced map[string]string `json:"advanced"`
}

SourceConfig is a hosted source's connection configuration.

func MergeSourceConfig

func MergeSourceConfig(existing *SourceConfig, values map[string]string, advanced map[string]string) SourceConfig

MergeSourceConfig applies explicit field updates to an existing source config.

type SourceConnectionField

type SourceConnectionField struct {
	Key             string  `json:"key"`
	Kind            string  `json:"kind"`
	Section         string  `json:"section"`
	Required        bool    `json:"required"`
	LabelKey        string  `json:"labelKey"`
	PlaceholderKey  *string `json:"placeholderKey,omitempty"`
	DefaultValue    *string `json:"defaultValue,omitempty"`
	SupportsOptions bool    `json:"supportsOptions"`
}

SourceConnectionField describes one source credential/configuration field.

type SourceContent

type SourceContent struct {
	Text       *string `json:"text,omitempty"`
	MIMEType   string  `json:"mimeType"`
	IsBinary   bool    `json:"isBinary"`
	SizeBytes  string  `json:"sizeBytes"`
	Truncated  bool    `json:"truncated"`
	FileName   string  `json:"fileName"`
	ModifiedAt *string `json:"modifiedAt,omitempty"`
}

SourceContent describes readable content returned from a hosted source object.

type SourceFieldConstraints

type SourceFieldConstraints struct {
	Name             string                `json:"name"`
	Type             string                `json:"type"`
	MetadataFidelity string                `json:"metadataFidelity"`
	Nullable         *bool                 `json:"nullable,omitempty"`
	Primary          bool                  `json:"primary"`
	Unique           bool                  `json:"unique"`
	Identity         bool                  `json:"identity"`
	DefaultValue     *string               `json:"defaultValue,omitempty"`
	AllowedValues    []string              `json:"allowedValues"`
	CheckMin         *float64              `json:"checkMin,omitempty"`
	CheckMax         *float64              `json:"checkMax,omitempty"`
	ForeignKey       *ForeignKeyDefinition `json:"foreignKey,omitempty"`
	Length           *int                  `json:"length,omitempty"`
	Precision        *int                  `json:"precision,omitempty"`
	Scale            *int                  `json:"scale,omitempty"`
}

SourceFieldConstraints describes editable field constraints for a source object.

type SourceObject

type SourceObject struct {
	Ref         SourceObjectRef  `json:"ref"`
	Kind        SourceObjectKind `json:"kind"`
	Name        string           `json:"name"`
	Path        []string         `json:"path"`
	HasChildren bool             `json:"hasChildren"`
	Actions     []string         `json:"actions"`
	Metadata    []Record         `json:"metadata"`
}

SourceObject is a browsable object returned by a hosted source.

type SourceObjectKind

type SourceObjectKind string

SourceObjectKind identifies a source hierarchy object kind.

type SourceObjectRef

type SourceObjectRef struct {
	Kind    SourceObjectKind `json:"kind"`
	Locator string           `json:"locator"`
	Path    []string         `json:"path"`
}

SourceObjectRef identifies one object inside a source hierarchy.

type SourceObjectRefInput

type SourceObjectRefInput struct {
	Kind    SourceObjectKind
	Locator string
	Path    []string
}

SourceObjectRefInput identifies one source object in GraphQL variables.

type SourceType

type SourceType struct {
	ID               string                  `json:"id"`
	Label            string                  `json:"label"`
	Connector        string                  `json:"connector"`
	Category         string                  `json:"category"`
	ConnectionFields []SourceConnectionField `json:"connectionFields"`
}

SourceType describes one hosted WhoDB source type available for creation.

type TabularPreviewData

type TabularPreviewData struct {
	Columns    []FilePreviewColumn `json:"columns"`
	Rows       [][]string          `json:"rows"`
	Total      int                 `json:"total"`
	SheetName  *string             `json:"sheetName,omitempty"`
	SheetIndex *int                `json:"sheetIndex,omitempty"`
	SheetCount *int                `json:"sheetCount,omitempty"`
	SheetNames []string            `json:"sheetNames,omitempty"`
}

TabularPreviewData describes tabular file preview data.

type TokenResponse

type TokenResponse struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token,omitempty"`
	IDToken      string `json:"id_token,omitempty"`
	ExpiresIn    int    `json:"expires_in,omitempty"`
}

TokenResponse is returned by Mothergate auth exchange and refresh endpoints.

func ExchangeCode

func ExchangeCode(ctx context.Context, authHost, code, redirectURI, verifier string) (*TokenResponse, error)

ExchangeCode exchanges a PKCE authorization code for platform tokens.

func Login

func Login(ctx context.Context, opts LoginOptions) (*TokenResponse, error)

Login runs the browser-based PKCE flow and returns platform tokens.

func RefreshToken

func RefreshToken(ctx context.Context, host, refreshToken string) (*TokenResponse, error)

RefreshToken exchanges a refresh token for new platform tokens.

type Transform

type Transform struct {
	ID           string `json:"id"`
	ProjectID    string `json:"projectId"`
	Name         string `json:"name"`
	Description  string `json:"description"`
	GraphJSON    string `json:"graphJson"`
	ScheduleCron string `json:"scheduleCron"`
	TriggerMode  string `json:"triggerMode"`
	CreatedAt    string `json:"createdAt"`
	UpdatedAt    string `json:"updatedAt"`
}

Transform describes one hosted transform.

func ResolveTransform

func ResolveTransform(ctx context.Context, client CloneClient, projectID, value string) (*Transform, error)

ResolveTransform resolves a transform by id or name.

type TransformRun

type TransformRun struct {
	ID           string `json:"id"`
	TransformID  string `json:"transformId"`
	Status       string `json:"status"`
	ErrorMessage string `json:"errorMessage"`
	TriggeredBy  string `json:"triggeredBy"`
	StartedAt    string `json:"startedAt"`
	CompletedAt  string `json:"completedAt"`
}

TransformRun describes one hosted transform run.

type UnsupportedFeatureError

type UnsupportedFeatureError struct {
	Feature   string
	Operation string
}

UnsupportedFeatureError reports that the host does not publish a CLI feature.

func (UnsupportedFeatureError) Error

func (e UnsupportedFeatureError) Error() string

type UpdateSourceInput

type UpdateSourceInput struct {
	OrgID     string
	ProjectID string
	ID        string
	Name      *string
	Config    *SourceConfig
}

UpdateSourceInput describes source metadata/config fields to update.

type User

type User struct {
	ID          string `json:"id"`
	Email       string `json:"email"`
	DisplayName string `json:"displayName"`
}

User is the platform identity returned by WhoDB.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL