resource

package
v0.12.30 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: LGPL-3.0, LGPL-3.0 Imports: 111 Imported by: 3 modules, 6 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	OAuthAccessTokenLifetimeSeconds  = int64(3600)
	OAuthRefreshTokenLifetimeSeconds = int64(60 * 60 * 24 * 30)
	OAuthCodeLifetimeSeconds         = int64(600)
)
View Source
const DATE_LAYOUT = "2006-01-02 15:04:05"
View Source
const USER_ACCOUNT_ID_COLUMN = "user_account_id"
View Source
const USER_ACCOUNT_TABLE_NAME = "user_account"

Variables

View Source
var CRUD_MAP = make(map[string]*DbResource)
View Source
var ColumnTypes = []ColumnType{
	{
		Name:          "id",
		BlueprintType: "string",
		ReclineType:   "string",
		Validations:   []string{},
		DataTypes:     []string{"varchar(20)", "varchar(10)"},
		GraphqlType:   graphql.ID,
	},
	{
		Name:          "alias",
		BlueprintType: "string",
		ReclineType:   "string",
		DataTypes:     []string{"varchar(100)", "varchar(20)", "varchar(10)"},
		GraphqlType:   graphql.String,
	},
	{
		Name:          "enum",
		BlueprintType: "string",
		ReclineType:   "string",
		DataTypes:     []string{"varchar(50)", "varchar(20)", "varchar(10)"},
		GraphqlType:   graphql.String,
	},
	{
		Name:          "date",
		BlueprintType: "string",
		ReclineType:   "date",
		DataTypes:     []string{"timestamp"},
		GraphqlType:   graphql.DateTime,
	},
	{
		Name:          "time",
		BlueprintType: "string",
		ReclineType:   "time",
		DataTypes:     []string{"timestamp"},
		GraphqlType:   graphql.String,
	},
	{
		Name:          "day",
		BlueprintType: "string",
		ReclineType:   "string",
		DataTypes:     []string{"varchar(10)"},
		GraphqlType:   graphql.String,
	},
	{
		Name:          "month",
		BlueprintType: "number",
		ReclineType:   "string",
		Validations:   []string{"min=1,max=12"},
		DataTypes:     []string{"int(4)"},
		GraphqlType:   graphql.Int,
	},
	{
		Name:          "year",
		BlueprintType: "number",
		ReclineType:   "string",
		Validations:   []string{"min=100,max=2100"},
		DataTypes:     []string{"int(4)"},
		GraphqlType:   graphql.Int,
	},
	{
		Name:          "minute",
		BlueprintType: "number",
		Validations:   []string{"min=0,max=59"},
		DataTypes:     []string{"int(4)"},
		GraphqlType:   graphql.Int,
	},
	{
		Name:          "hour",
		BlueprintType: "number",
		ReclineType:   "string",
		DataTypes:     []string{"int(4)"},
		GraphqlType:   graphql.Int,
	},
	{
		Name:          "datetime",
		BlueprintType: "string",
		ReclineType:   "date-time",
		DataTypes:     []string{"timestamp"},
		GraphqlType:   graphql.DateTime,
	},
	{
		Name:          "email",
		BlueprintType: "string",
		ReclineType:   "string",
		Validations:   []string{"email"},
		Conformations: []string{"email"},
		DataTypes:     []string{"varchar(100)"},
		GraphqlType:   graphql.String,
	},
	{
		Name:          "namespace",
		BlueprintType: "string",
		ReclineType:   "string",
		DataTypes:     []string{"varchar(200)"},
		GraphqlType:   graphql.String,
	},
	{
		Name:          "name",
		BlueprintType: "string",
		ReclineType:   "string",
		Validations:   []string{"required"},
		Conformations: []string{"name"},
		DataTypes:     []string{"varchar(100)"},
		GraphqlType:   graphql.String,
	},
	{
		Name:          "encrypted",
		ReclineType:   "string",
		BlueprintType: "string",
		DataTypes:     []string{"varchar(100)", "varchar(500)", "varchar(500)", "text"},
		GraphqlType:   graphql.String,
	},
	{
		Name:          "json",
		ReclineType:   "string",
		BlueprintType: "string",
		DataTypes:     []string{"text", "varchar(100)"},
		GraphqlType:   graphql.String,
	},
	{
		Name:          "password",
		BlueprintType: "string",
		ReclineType:   "string",
		Validations:   []string{"required"},
		DataTypes:     []string{"varchar(200)"},
		GraphqlType:   graphql.String,
	},
	{
		Name:          "md5",
		BlueprintType: "string",
		ReclineType:   "string",
		Validations:   []string{"required"},
		DataTypes:     []string{"varchar(200)"},
		GraphqlType:   graphql.String,
	},
	{
		Name:          "bcrypt",
		BlueprintType: "string",
		ReclineType:   "string",
		Validations:   []string{"required"},
		DataTypes:     []string{"varchar(200)"},
		GraphqlType:   graphql.String,
	},
	{
		Name:          "md5-bcrypt",
		BlueprintType: "string",
		ReclineType:   "string",
		Validations:   []string{"required"},
		DataTypes:     []string{"varchar(200)"},
		GraphqlType:   graphql.String,
	},
	{
		Name:          "value",
		ReclineType:   "string",
		BlueprintType: "string",
		DataTypes:     []string{"varchar(100)"},
		GraphqlType:   graphql.String,
	},
	{
		Name:          "truefalse",
		BlueprintType: "boolean",
		ReclineType:   "boolean",
		DataTypes:     []string{"boolean"},
		GraphqlType:   graphql.Boolean,
	},
	{
		Name:          "timestamp",
		BlueprintType: "string",
		ReclineType:   "date-time",
		DataTypes:     []string{"timestamp"},
		GraphqlType:   graphql.DateTime,
	},
	{
		Name:          "location",
		BlueprintType: "string",
		ReclineType:   "geo_point",
		DataTypes:     []string{"varchar(50)"},
		GraphqlType:   graphql.String,
	},
	{
		Name:          "location.latitude",
		BlueprintType: "number",
		ReclineType:   "number",
		Validations:   []string{"latitude"},
		DataTypes:     []string{"float(7,4)"},
		GraphqlType:   graphql.Float,
	},
	{
		Name:          "location.longitude",
		BlueprintType: "number",
		ReclineType:   "number",
		Validations:   []string{"longitude"},
		DataTypes:     []string{"float(7,4)"},
		GraphqlType:   graphql.Float,
	},
	{
		Name:          "location.altitude",
		BlueprintType: "number",
		ReclineType:   "number",
		DataTypes:     []string{"float(7,4)"},
		GraphqlType:   graphql.Float,
	},
	{
		Name:          "color",
		BlueprintType: "string",
		ReclineType:   "string",
		Validations:   []string{"iscolor"},
		DataTypes:     []string{"varchar(50)"},
		GraphqlType:   graphql.String,
	},
	{
		Name:          "rating",
		BlueprintType: "number",
		ReclineType:   "number",
		Validations:   []string{"min=0,max=10"},
		DataTypes:     []string{"int(4)"},
		GraphqlType:   graphql.Int,
	},
	{
		Name:          "measurement",
		ReclineType:   "number",
		BlueprintType: "number",
		DataTypes:     []string{"int(10)"},
		GraphqlType:   graphql.Int,
	},
	{
		Name:          "float",
		ReclineType:   "number",
		BlueprintType: "number",
		DataTypes:     []string{"float(7,4)"},
		GraphqlType:   graphql.Float,
	},
	{
		Name:          "label",
		ReclineType:   "string",
		BlueprintType: "string",
		DataTypes:     []string{"varchar(100)"},
		GraphqlType:   graphql.String,
	},
	{
		Name:          "hidden",
		ReclineType:   "string",
		BlueprintType: "string",
		DataTypes:     []string{"varchar(100)"},
		GraphqlType:   graphql.String,
	},
	{
		Name:          "content",
		ReclineType:   "string",
		BlueprintType: "string",
		DataTypes:     []string{"text"},
		GraphqlType:   graphql.String,
	},
	{
		Name:          "html",
		ReclineType:   "string",
		BlueprintType: "string",
		DataTypes:     []string{"text"},
		GraphqlType:   graphql.String,
	},
	{
		Name:          "markdown",
		ReclineType:   "string",
		BlueprintType: "string",
		DataTypes:     []string{"text"},
		GraphqlType:   graphql.String,
	},
	{
		Name:          "file",
		BlueprintType: "string",
		ReclineType:   "binary",
		Validations:   []string{"base64"},
		DataTypes:     []string{"blob"},
		GraphqlType:   graphql.String,
	},
	{
		Name:          "json",
		BlueprintType: "string",
		ReclineType:   "string",
		Validations:   []string{"text"},
		DataTypes:     []string{"JSON"},
		GraphqlType:   graphql.String,
	},
	{
		Name:          "image",
		BlueprintType: "string",
		ReclineType:   "binary",
		Validations:   []string{"base64"},
		DataTypes:     []string{"blob"},
		GraphqlType:   graphql.String,
	},
	{
		Name:          "gzip",
		BlueprintType: "string",
		ReclineType:   "binary",
		Validations:   []string{"base64"},
		DataTypes:     []string{"blob"},
		GraphqlType:   graphql.String,
	},
	{
		Name:          "video",
		BlueprintType: "string",
		ReclineType:   "binary",
		Validations:   []string{"base64"},
		DataTypes:     []string{"blob"},
		GraphqlType:   graphql.String,
	},
	{
		Name:          "url",
		BlueprintType: "string",
		ReclineType:   "string",
		Validations:   []string{"url"},
		DataTypes:     []string{"varchar(500)"},
		GraphqlType:   graphql.String,
	},
}
View Source
var ConfigTableStructure = table_info.TableInfo{
	TableName: settingsTableName,
	Columns: []api2go.ColumnInfo{
		{
			Name:            "id",
			ColumnName:      "id",
			ColumnType:      "id",
			DataType:        "INTEGER",
			IsPrimaryKey:    true,
			IsAutoIncrement: true,
		},
		{
			Name:       "name",
			ColumnName: "name",
			ColumnType: "string",
			DataType:   "varchar(100)",
			IsNullable: false,
			IsIndexed:  true,
		},
		{
			Name:       "ConfigType",
			ColumnName: "configtype",
			ColumnType: "string",
			DataType:   "varchar(100)",
			IsNullable: false,
			IsIndexed:  true,
		},
		{
			Name:       "ConfigState",
			ColumnName: "configstate",
			ColumnType: "string",
			DataType:   "varchar(100)",
			IsNullable: false,
			IsIndexed:  true,
		},
		{
			Name:       "ConfigEnv",
			ColumnName: "configenv",
			ColumnType: "string",
			DataType:   "varchar(100)",
			IsNullable: false,
			IsIndexed:  true,
		},
		{
			Name:       "Value",
			ColumnName: "value",
			ColumnType: "string",
			DataType:   "varchar(5000)",
			IsNullable: true,
			IsIndexed:  true,
		},
		{
			Name:       "ValueType",
			ColumnName: "valuetype",
			ColumnType: "string",
			DataType:   "varchar(100)",
			IsNullable: true,
			IsIndexed:  true,
		},
		{
			Name:       "PreviousValue",
			ColumnName: "previousvalue",
			ColumnType: "string",
			DataType:   "varchar(100)",
			IsNullable: true,
			IsIndexed:  true,
		},
		{
			Name:         "CreatedAt",
			ColumnName:   "created_at",
			ColumnType:   "datetime",
			DataType:     "timestamp",
			DefaultValue: "current_timestamp",
			IsNullable:   false,
			IsIndexed:    true,
		},
		{
			Name:       "UpdatedAt",
			ColumnName: "updated_at",
			ColumnType: "datetime",
			DataType:   "timestamp",
			IsNullable: true,
			IsIndexed:  true,
		},
	},
}
View Source
var CryptoFuncMap = map[string]interface{}{
	"SHA256Hash":     SHA256Hash,
	"SHA512Hash":     SHA512Hash,
	"MD5Hash":        MD5Hash,
	"HMACSHA256":     HMACSHA256,
	"HMACSHA512":     HMACSHA512,
	"AESGCMEncrypt":  AESGCMEncrypt,
	"AESGCMDecrypt":  AESGCMDecrypt,
	"RSAGenerateKey": RSAGenerateKey,
	"RSAEncrypt":     RSAEncrypt,
	"RSADecrypt":     RSADecrypt,
	"ECDSASign":      ECDSASign,
	"ECDSAVerify":    ECDSAVerify,
	"Encrypt":        Encrypt,
	"Decrypt":        Decrypt,
}

Map of frequently used cryptographic functions

View Source
var EncodingFuncMap = map[string]interface{}{
	"btoa":         Btoa,
	"atob":         Atob,
	"FromJson":     FromJson,
	"ToJson":       ToJson,
	"HexEncode":    HexEncode,
	"HexDecode":    HexDecode,
	"Base64Encode": Base64Encode,
	"Base64Decode": Base64Decode,
	"URLEncode":    URLEncode,
	"URLDecode":    URLDecode,
}

Map of frequently used encoding/decoding functions

View Source
var (
	// Error Unauthorized
	ErrUnauthorized = errors.New("forbidden")
)
View Source
var OlricCache olric.DMap
View Source
var OperatorMap = map[string]string{
	"contains":     "like",
	"like":         "like",
	"ilike":        "iLike",
	"begins with":  "like",
	"ends with":    "like",
	"not contains": "notLike",
	"not like":     "notLike",
	"not ilike":    "notILike",
	"is":           "is",
	"eq":           "eq",
	"neq":          "neq",
	"in":           "in",
	"is not":       "isNot",
	"before":       "lt",
	"after":        "gt",
	"more than":    "gt",
	"any of":       "in",
	"none of":      "notIn",
	"less than":    "lt",
	"is empty":     "is nil",
	"is true":      "is true",
	"is false":     "is false",
	"fuzzy":        "fuzzy",
	"fuzzy_any":    "fuzzy_any",
	"fuzzy_all":    "fuzzy_all",
}
View Source
var ReservedWords = []string{}/* 826 elements not displayed */

thanks to https://www.drupal.org/node/141051

View Source
var StandardColumns = []api2go.ColumnInfo{
	{
		Name:            "id",
		ColumnName:      "id",
		DataType:        "INTEGER",
		IsPrimaryKey:    true,
		IsAutoIncrement: true,
		ExcludeFromApi:  true,
		ColumnDescription: "The primary internal identifier for each database record. This auto-incrementing " +
			"integer serves as the unique primary key but is excluded from API responses to maintain data abstraction.",
		ColumnType: "id",
	},
	{
		Name:       "version",
		ColumnName: "version",
		DataType:   "INTEGER",
		ColumnType: "measurement",
		ColumnDescription: "A counter that tracks the number of modifications made to a record. Starting at 1 for " +
			"new records, this integer increments with each update to support optimistic " +
			"concurrency control and change tracking. Exposed through the API.",
		DefaultValue:   "1",
		ExcludeFromApi: true,
	},
	{
		Name:       "created_at",
		ColumnName: "created_at",
		DataType:   "timestamp",
		ColumnDescription: "Timestamp recording when the record was initially created in the database. " +
			"Automatically set to the current time upon record creation and indexed for efficient temporal queries.",
		DefaultValue: "current_timestamp",
		ColumnType:   "datetime",
		IsIndexed:    true,
	},
	{
		Name:       "updated_at",
		ColumnName: "updated_at",
		DataType:   "timestamp",
		ColumnDescription: "Timestamp indicating when the record was last modified. This " +
			"non-nullable field is indexed to enable efficient filtering and sorting of records by modification time.",
		IsIndexed:  true,
		IsNullable: true,
		ColumnType: "datetime",
	},
	{
		Name:       "reference_id",
		ColumnName: "reference_id",
		DataType:   "blob",
		IsIndexed:  true,
		ColumnDescription: "A unique external identifier stored as a blob that allows referencing the record from " +
			"outside systems. This non-nullable field serves as a public-facing alias for the " +
			"internal ID and is indexed for quick lookups.",
		IsUnique:   true,
		IsNullable: false,
		ColumnType: "alias",
	},
	{
		Name:       "permission",
		ColumnName: "permission",
		DataType:   "int(11)",
		ColumnDescription: "An integer BITMASK value representing access control settings for the record. This field " +
			"determines what operations can be performed on the record based on user roles and privileges.",
		IsIndexed:  false,
		ColumnType: "value",
	},
}
View Source
var StandardRelations = []api2go.TableRelation{
	api2go.NewTableRelation("action", "belongs_to", "world"),
	api2go.NewTableRelation("feed", "belongs_to", "stream"),
	api2go.NewTableRelation("world", "has_many", "smd"),
	api2go.NewTableRelation("oauth_token", "has_one", "oauth_connect"),
	api2go.NewTableRelation("oauth_state", "has_one", "oauth_connect"),
	api2go.NewTableRelation("oauth_code", "belongs_to", "oauth_app"),
	api2go.NewTableRelation("oauth_access", "belongs_to", "oauth_app"),
	api2go.NewTableRelation("oauth_refresh", "belongs_to", "oauth_app"),
	api2go.NewTableRelation("oauth_grant", "belongs_to", "oauth_app"),
	api2go.NewTableRelation("data_exchange", "has_one", "oauth_token"),
	api2go.NewTableRelationWithNames("data_exchange", "user_data_exchange", "has_one", "user_account", "as_user_id"),
	api2go.NewTableRelation("timeline", "belongs_to", "world"),
	api2go.NewTableRelation("cloud_store", "has_one", "credential"),
	api2go.NewTableRelation("llm_provider", "has_one", "credential"),
	api2go.NewTableRelation("api_member", "has_one", "api_plan"),
	api2go.NewTableRelation("api_usage", "has_one", "api_plan"),
	api2go.NewTableRelation("api_usage", "has_one", "api_member"),
	api2go.NewTableRelation("api_quota", "has_one", "api_plan"),
	api2go.NewTableRelation("api_quota", "has_one", "api_member"),
	api2go.NewTableRelation("site", "has_one", "cloud_store"),
	api2go.NewTableRelation("outbox", "belongs_to", "mail_server"),
	api2go.NewTableRelation("mail_account", "belongs_to", "mail_server"),
	api2go.NewTableRelation("mail_box", "belongs_to", "mail_account"),
	api2go.NewTableRelation("mail", "belongs_to", "mail_box"),
	api2go.NewTableRelationWithNames("task", "task_executed", "has_one", USER_ACCOUNT_TABLE_NAME, "as_user_id"),
	api2go.NewTableRelation("calendar", "has_one", "collection"),
	api2go.NewTableRelationWithNames("user_otp_account", "primary_user_otp", "belongs_to", "user_account", "otp_of_account"),
}
View Source
var StandardStreams = []StreamContract{
	{
		StreamName:     "table",
		RootEntityName: "world",
		Columns: []api2go.ColumnInfo{
			{
				Name:       "table_name",
				ColumnType: "label",
			},
			{
				Name:       "reference_id",
				ColumnType: "label",
			},
		},
	},
	{
		StreamName:     "transformed_user",
		RootEntityName: USER_ACCOUNT_TABLE_NAME,
		Columns: []api2go.ColumnInfo{
			{
				Name:       "transformed_user_name",
				ColumnType: "label",
			},
			{
				Name:       "primary_email",
				ColumnType: "label",
			},
		},
		Transformations: []Transformation{
			{
				Operation: "select",
				Attributes: map[string]interface{}{
					"Columns": []string{"name", "email"},
				},
			},
			{
				Operation: "rename",
				Attributes: map[string]interface{}{
					"OldName": "name",
					"NewName": "transformed_user_name",
				},
			},
			{
				Operation: "rename",
				Attributes: map[string]interface{}{
					"OldName": "email",
					"NewName": "primary_email",
				},
			},
			{
				Operation:  "filter",
				Attributes: map[string]interface{}{},
			},
		},
	},
}
View Source
var StandardTables = []table_info.TableInfo{
	{
		TableName:     "document",
		IsHidden:      false,
		DefaultGroups: adminsGroup,
		Icon:          "fa-file",
		Columns: []api2go.ColumnInfo{
			{
				ColumnName:        "document_name",
				Name:              "document_name",
				ColumnType:        "label",
				DataType:          "varchar(99999)",
				IsNullable:        false,
				IsIndexed:         true,
				ColumnDescription: "The name of the document file, used for identification and display purposes. This field is indexed for quick searching and retrieval.",
			},
			{
				ColumnName:        "document_path",
				Name:              "document_path",
				ColumnType:        "label",
				DataType:          "varchar(99999)",
				IsNullable:        false,
				IsIndexed:         true,
				ColumnDescription: "The file system path or URL where the document is stored. Supports paths up to 2000 characters and is indexed for efficient lookup.",
			},
			{
				ColumnName:        "document_extension",
				Name:              "document_extension",
				ColumnType:        "label",
				DataType:          "varchar(1000)",
				IsNullable:        false,
				IsIndexed:         true,
				ColumnDescription: "The file extension of the document (e.g., pdf, docx, txt), used for file type identification and filtering. Indexed for quick file type searches.",
			},
			{
				ColumnName:        "mime_type",
				Name:              "mime_type",
				ColumnType:        "label",
				DataType:          "varchar(1000)",
				IsNullable:        false,
				IsIndexed:         true,
				ColumnDescription: "The MIME type of the document (e.g., application/pdf, text/plain), which identifies the file format. Indexed to support content type filtering.",
			},
			{
				ColumnName:        "document_content",
				Name:              "document_content",
				IsForeignKey:      true,
				IsNullable:        false,
				ColumnType:        "file.*",
				DataType:          "longblob",
				ColumnDescription: "The actual binary content of the document, stored as a reference to cloud storage. Supports files of any type through the generic file.* handler.",
			},
		},
	},
	{
		TableName:     "calendar",
		IsHidden:      false,
		DefaultGroups: adminsGroup,
		Icon:          "fa-calendar-alt",
		Columns: []api2go.ColumnInfo{
			{
				ColumnName:        "rpath",
				Name:              "rpath",
				ColumnType:        "label",
				IsUnique:          true,
				DataType:          "varchar(500)",
				IsNullable:        false,
				ColumnDescription: "The resource path for the calendar item, serving as a unique identifier within the calendaring system. Must be unique across all calendar resources.",
			},
			{
				ColumnName:        "content",
				Name:              "content",
				ColumnType:        "file.ical",
				DataType:          "longblob",
				IsNullable:        false,
				IsForeignKey:      true,
				ColumnDescription: "The iCalendar (RFC 5545) format content of the calendar entry, stored as a binary blob. This contains all event details including dates, recurrence rules, and attendees.",
			},
		},
	},
	{
		TableName:     "collection",
		IsHidden:      false,
		DefaultGroups: adminsGroup,
		Icon:          "fa-folder-open",
		Columns: []api2go.ColumnInfo{
			{
				ColumnName:        "name",
				Name:              "name",
				ColumnType:        "label",
				DataType:          "varchar(500)",
				IsNullable:        false,
				IsIndexed:         true,
				ColumnDescription: "The name of the collection, which serves as the primary identifier for users. This field is indexed to enable quick lookups and filtering by collection name.",
			},
			{
				ColumnName:        "description",
				Name:              "description",
				ColumnType:        "label",
				DataType:          "text",
				IsNullable:        false,
				IsIndexed:         true,
				ColumnDescription: "A detailed description of the collection's purpose, contents, and other relevant information. Indexed to support searching collections by their descriptions.",
			},
		},
	},
	{
		TableName:     "credential",
		IsHidden:      false,
		DefaultGroups: adminsGroup,
		Icon:          "fa-key",
		Columns: []api2go.ColumnInfo{
			{
				ColumnName:        "name",
				Name:              "name",
				ColumnType:        "label",
				DataType:          "varchar(500)",
				IsNullable:        false,
				IsIndexed:         true,
				ColumnDescription: "A human-readable identifier for the credential entry, allowing users to recognize the purpose or system associated with these credentials. Indexed for quick search and reference.",
			},
			{
				ColumnName:        "content",
				Name:              "content",
				ColumnType:        "encrypted",
				DataType:          "text",
				IsNullable:        false,
				IsIndexed:         false,
				ColumnDescription: "The sensitive credential information stored in encrypted format. May contain passwords, API keys, tokens, or other authentication data that requires security protection.",
			},
		},
	},
	{
		TableName:     "certificate",
		IsHidden:      false,
		DefaultGroups: adminsGroup,
		Icon:          "fa-certificate",
		Columns: []api2go.ColumnInfo{
			{
				Name:              "hostname",
				ColumnName:        "hostname",
				IsUnique:          true,
				IsIndexed:         true,
				ColumnType:        "label",
				DataType:          "varchar(100)",
				IsNullable:        false,
				ColumnDescription: "The fully qualified domain name (FQDN) for which this certificate is valid. This field is unique and indexed as it serves as the primary identifier for certificate lookup.",
			},
			{
				Name:              "issuer",
				ColumnName:        "issuer",
				ColumnType:        "label",
				DataType:          "varchar(100)",
				IsNullable:        false,
				DefaultValue:      "'self'",
				ColumnDescription: "The authority that issued the certificate, such as a Certificate Authority (CA) name or 'self' for self-signed certificates. Defaults to 'self' when not specified.",
			},
			{
				Name:              "generated_at",
				ColumnName:        "generated_at",
				ColumnType:        "datetime",
				DataType:          "timestamp",
				IsNullable:        true,
				ColumnDescription: "The timestamp when the certificate was generated. This helps track certificate age and can be used to determine when renewal is necessary.",
			},
			{
				Name:              "certificate_pem",
				ColumnName:        "certificate_pem",
				ColumnType:        "content",
				DataType:          "text",
				IsNullable:        true,
				ColumnDescription: "The X.509 certificate in PEM format, containing the public key and certificate information. This is the primary certificate data used by services.",
			},
			{
				Name:              "root_certificate",
				ColumnName:        "root_certificate",
				ColumnType:        "content",
				DataType:          "text",
				IsNullable:        true,
				ColumnDescription: "The root certificate in PEM format, used to establish the chain of trust for this certificate. May be null for self-signed certificates or when not available.",
			},
			{
				Name:              "private_key_pem",
				ColumnName:        "private_key_pem",
				ColumnType:        "encrypted",
				DataType:          "text",
				IsNullable:        true,
				ColumnDescription: "The private key corresponding to the certificate in PEM format, stored with encryption for security. This is used for certificate authentication and signing operations.",
			},
			{
				Name:              "public_key_pem",
				ColumnName:        "public_key_pem",
				ColumnType:        "content",
				DataType:          "text",
				IsNullable:        true,
				ColumnDescription: "The public key extracted from the certificate in PEM format. This is used for encryption and verification operations.",
			},
		},
	},
	{
		TableName:     "feed",
		IsHidden:      false,
		DefaultGroups: adminsGroup,
		Icon:          "fa-rss",
		Columns: []api2go.ColumnInfo{
			{
				Name:              "feed_name",
				ColumnName:        "feed_name",
				IsUnique:          true,
				IsIndexed:         true,
				ColumnType:        "label",
				DataType:          "varchar(100)",
				IsNullable:        false,
				ColumnDescription: "A unique identifier for the feed that serves as the primary reference key. This name is used in URLs and API calls to identify the specific feed resource.",
			},
			{
				Name:              "title",
				ColumnName:        "title",
				ColumnType:        "label",
				DataType:          "varchar(500)",
				IsNullable:        false,
				DefaultValue:      "''",
				ColumnDescription: "The display title of the feed shown to users and subscribers. This is the primary human-readable identifier in feed readers and syndication services.",
			},
			{
				Name:              "description",
				ColumnName:        "description",
				ColumnType:        "label",
				DataType:          "text",
				IsNullable:        false,
				ColumnDescription: "A detailed description of the feed's content and purpose. This text appears in feed readers to help users understand what the feed contains.",
			},
			{
				Name:              "link",
				ColumnName:        "link",
				ColumnType:        "label",
				DataType:          "varchar(1000)",
				IsNullable:        false,
				DefaultValue:      "''",
				ColumnDescription: "The URL to the website or resource associated with this feed. This allows users to visit the original source of the content.",
			},
			{
				Name:              "author_name",
				ColumnName:        "author_name",
				ColumnType:        "label",
				DataType:          "varchar(500)",
				IsNullable:        false,
				DefaultValue:      "''",
				ColumnDescription: "The name of the feed author or publisher, displayed in feed readers to identify the content creator or provider.",
			},
			{
				Name:              "author_email",
				ColumnName:        "author_email",
				ColumnType:        "label",
				DataType:          "varchar(500)",
				IsNullable:        false,
				DefaultValue:      "''",
				ColumnDescription: "The contact email address of the feed author or administrator, used for communication regarding the feed content.",
			},
			{
				Name:              "enable",
				ColumnName:        "enable",
				ColumnType:        "truefalse",
				DataType:          "bool",
				IsNullable:        false,
				DefaultValue:      "false",
				ColumnDescription: "Controls whether the feed is active and publicly accessible. When set to false, the feed is disabled and cannot be accessed by subscribers.",
			},
			{
				Name:              "enable_atom",
				ColumnName:        "enable_atom",
				ColumnType:        "truefalse",
				DataType:          "bool",
				IsNullable:        false,
				DefaultValue:      "true",
				ColumnDescription: "Determines whether the feed is available in Atom format. When enabled, the system generates and serves an Atom version of this feed.",
			},
			{
				Name:              "enable_json",
				ColumnName:        "enable_json",
				ColumnType:        "truefalse",
				DataType:          "bool",
				IsNullable:        false,
				DefaultValue:      "true",
				ColumnDescription: "Controls whether the feed is available in JSON Feed format. When enabled, the system generates and serves a JSON version of this feed.",
			},
			{
				Name:              "enable_rss",
				ColumnName:        "enable_rss",
				ColumnType:        "truefalse",
				DataType:          "bool",
				IsNullable:        false,
				DefaultValue:      "true",
				ColumnDescription: "Specifies whether the feed is available in RSS format. When enabled, the system generates and serves an RSS version of this feed.",
			},
			{
				Name:              "page_size",
				ColumnName:        "page_size",
				ColumnType:        "measurement",
				DataType:          "int(11)",
				IsNullable:        false,
				DefaultValue:      "1000",
				ColumnDescription: "The maximum number of items to include in a single feed response. This controls pagination and feed size to optimize loading times and bandwidth usage.",
			},
		},
	},
	{
		TableName:     "integration",
		IsHidden:      false,
		DefaultGroups: adminsGroup,
		Icon:          "fa-exchange-alt",
		Columns: []api2go.ColumnInfo{
			{
				Name:              "name",
				ColumnName:        "name",
				IsUnique:          true,
				IsIndexed:         true,
				ColumnType:        "label",
				DataType:          "varchar(100)",
				IsNullable:        false,
				ColumnDescription: "A unique identifier for the integration that serves as the primary reference key. Used in logs, API calls, and internal references to identify this specific integration.",
			},
			{
				Name:              "specification_language",
				ColumnName:        "specification_language",
				ColumnType:        "label",
				DataType:          "varchar(20)",
				IsNullable:        false,
				ColumnDescription: "The language or format used to define the integration specification, such as 'OpenAPI', 'GraphQL', 'WSDL', or custom formats. This determines how the specification is interpreted.",
			},
			{
				Name:              "specification_format",
				ColumnName:        "specification_format",
				ColumnType:        "label",
				DataType:          "varchar(10)",
				DefaultValue:      "'json'",
				ColumnDescription: "The file format of the specification document, typically 'json', 'yaml', or 'xml'. Defaults to 'json' when not explicitly specified.",
			},
			{
				Name:              "specification",
				ColumnName:        "specification",
				ColumnType:        "content",
				DataType:          "mediumtext",
				IsNullable:        false,
				ColumnDescription: "The actual integration specification document that defines the API endpoints, operations, parameters, and other technical details of the integration.",
			},
			{
				Name:              "authentication_type",
				ColumnName:        "authentication_type",
				ColumnType:        "label",
				ColumnDescription: "The authentication method used for this integration. Supported values are 'oauth2' and 'custom_credentials'. This determines which per-user credential reference is required at execution time.",
			},
			{
				Name:              "authentication_specification",
				ColumnName:        "authentication_specification",
				ColumnType:        "encrypted",
				DataType:          "text",
				IsNullable:        false,
				ColumnDescription: "Encrypted authentication metadata for the integration. For OAuth2 this stores oauth_connect_id; for custom_credentials this stores how to use credential.content. User secrets are stored in oauth_token or credential rows and selected at execution time.",
			},
			{
				Name:              "enable",
				ColumnName:        "enable",
				ColumnType:        "truefalse",
				DataType:          "bool",
				DefaultValue:      "true",
				IsNullable:        false,
				ColumnDescription: "Controls whether the integration is active and available for use. When set to false, the integration is disabled and will not be executed regardless of triggers.",
			},
		},
	},
	{
		TableName:     "task",
		IsHidden:      false,
		DefaultGroups: adminsGroup,
		Icon:          "fa-tasks",
		Columns: []api2go.ColumnInfo{
			{
				Name:              "name",
				ColumnName:        "name",
				DataType:          "varchar(100)",
				ColumnType:        "label",
				IsIndexed:         true,
				ColumnDescription: "A descriptive name for the task that serves as the primary user-facing identifier. This field is indexed to support efficient searching and sorting of tasks.",
			},
			{
				Name:              "action_name",
				ColumnName:        "action_name",
				DataType:          "varchar(100)",
				ColumnType:        "label",
				ColumnDescription: "The name of the action to be executed when this task runs. References an action defined in the system that contains the implementation logic.",
			},
			{
				Name:              "entity_name",
				ColumnName:        "entity_name",
				DataType:          "varchar(100)",
				ColumnType:        "label",
				ColumnDescription: "The name of the data entity or resource type that this task operates on. This determines the context and scope of the task's execution.",
			},
			{
				Name:              "schedule",
				ColumnName:        "schedule",
				DataType:          "varchar(100)",
				ColumnType:        "label",
				ColumnDescription: "The execution schedule for the task, typically defined as a cron expression or time interval pattern. Controls when and how frequently the task runs.",
			},
			{
				Name:              "active",
				ColumnName:        "active",
				DataType:          "bool",
				ColumnType:        "truefalse",
				ColumnDescription: "Indicates whether the task is currently active and should be executed according to its schedule. Inactive tasks are not run regardless of their schedule.",
			},
			{
				Name:              "attributes",
				ColumnName:        "attributes",
				DataType:          "text",
				ColumnType:        "json",
				ColumnDescription: "A JSON object containing additional parameters, settings, and configuration options specific to this task. These attributes are passed to the action when executed.",
			},
			{
				Name:              "job_type",
				ColumnName:        "job_type",
				DataType:          "varchar(100)",
				ColumnType:        "label",
				ColumnDescription: "Categorizes the task by type of job (e.g., 'backup', 'sync', 'report', 'maintenance'), allowing for filtering and grouping related tasks.",
			},
		},
	},
	{
		TableName:     "template",
		IsHidden:      false,
		DefaultGroups: adminsGroup,
		Icon:          "fa-file-alt",
		Columns: []api2go.ColumnInfo{
			{
				ColumnName:        "name",
				Name:              "name",
				ColumnType:        "label",
				DataType:          "varchar(500)",
				IsNullable:        false,
				IsUnique:          true,
				IsIndexed:         true,
				ColumnDescription: "A unique identifier for the template that serves as the primary reference key. Used in code, URLs, and API calls to identify specific templates.",
			},
			{
				ColumnName:        "content",
				Name:              "content",
				ColumnType:        "content",
				DataType:          "text",
				IsNullable:        false,
				IsIndexed:         false,
				ColumnDescription: "The actual template content, which may include HTML, text with placeholders, or template language syntax that will be processed when the template is rendered.",
			},
			{
				ColumnName:        "action_config",
				Name:              "action_config",
				ColumnType:        "json",
				DataType:          "text",
				IsNullable:        true,
				DefaultValue:      "'{}'",
				IsIndexed:         false,
				ColumnDescription: "JSON configuration for actions that can be performed on or with this template, such as pre-processing, post-processing, or conditional rendering logic.",
			},
			{
				ColumnName:        "cache_config",
				Name:              "cache_config",
				ColumnType:        "json",
				DataType:          "text",
				IsNullable:        true,
				DefaultValue:      "'{}'",
				IsIndexed:         false,
				ColumnDescription: "JSON configuration for caching behavior, including cache duration, invalidation rules, and cache storage options to optimize performance.",
			},
			{
				ColumnName:        "mime_type",
				Name:              "mime_type",
				ColumnType:        "label",
				DataType:          "varchar(500)",
				IsNullable:        false,
				IsIndexed:         false,
				ColumnDescription: "The MIME type of the content this template generates, such as 'text/html', 'application/json', or 'text/plain'. Used for HTTP response headers.",
			},
			{
				ColumnName:        "headers",
				Name:              "headers",
				ColumnType:        "json",
				DataType:          "text",
				IsNullable:        true,
				IsIndexed:         false,
				ColumnDescription: "JSON object containing additional HTTP headers to be included when serving content generated from this template. Used for custom headers beyond content type.",
			},
			{
				ColumnName:        "url_pattern",
				Name:              "url_pattern",
				ColumnType:        "json",
				DataType:          "text",
				IsNullable:        false,
				IsIndexed:         false,
				ColumnDescription: "JSON definition of URL patterns that map to this template, enabling dynamic routing and parameter extraction from request URLs.",
			},
		},
	},

	{
		TableName:     "json_schema",
		Icon:          "fa-code",
		DefaultGroups: adminsGroup,
		IsHidden:      false,
		Columns: []api2go.ColumnInfo{
			{
				Name:              "schema_name",
				ColumnName:        "schema_name",
				ColumnType:        "label",
				DataType:          "varchar(100)",
				IsNullable:        false,
				ColumnDescription: "A unique identifier for the JSON schema stored in the system. This name is used to reference and retrieve specific schemas for validation and documentation purposes.",
			},
			{
				Name:              "json_schema",
				ColumnType:        "json",
				DataType:          "text",
				ColumnName:        "json_schema",
				ColumnDescription: "The actual JSON Schema document stored as a JSON text field. Contains schema definitions including data types, validation rules, property constraints, and other schema specifications.",
			},
		},
	},
	{
		TableName:     "timeline",
		Icon:          "fa-history",
		DefaultGroups: adminsGroup,
		IsHidden:      false,
		Columns: []api2go.ColumnInfo{
			{
				Name:              "event_type",
				ColumnName:        "event_type",
				ColumnType:        "label",
				DataType:          "varchar(50)",
				IsNullable:        false,
				ColumnDescription: "Categorizes the timeline event by type (e.g., 'create', 'update', 'delete', 'login'), allowing for filtering and grouping related events in chronological sequences.",
			},
			{
				Name:              "title",
				ColumnName:        "title",
				ColumnType:        "label",
				IsIndexed:         true,
				DataType:          "varchar(50)",
				IsNullable:        false,
				ColumnDescription: "A concise summary of the event displayed to users when viewing the timeline. This field is indexed to enable efficient timeline searches and filtering by event title.",
			},
			{
				Name:              "payload",
				ColumnName:        "payload",
				ColumnType:        "content",
				DataType:          "text",
				IsNullable:        true,
				ColumnDescription: "Additional data or context related to the event, stored as text content. May contain JSON, XML, or plaintext details that provide comprehensive information about what occurred.",
			},
		},
	},
	{
		TableName:     "world",
		IsHidden:      false,
		DefaultGroups: adminsGroup,
		DefaultOrder:  "+table_name",
		Icon:          "fa-globe",
		Columns: []api2go.ColumnInfo{
			{
				Name:              "table_name",
				ColumnName:        "table_name",
				IsNullable:        false,
				IsUnique:          true,
				IsIndexed:         true,
				DataType:          "varchar(200)",
				ColumnType:        "name",
				ColumnDescription: "The name of the database table this world entity represents. This is a unique, indexed identifier used throughout the system to reference specific data models.",
			},
			{
				Name:              "world_schema_json",
				ColumnName:        "world_schema_json",
				DataType:          "text",
				IsNullable:        false,
				ColumnType:        "json",
				ColumnDescription: "A JSON representation of the complete schema for this world entity, including all columns, relationships, validations, and other metadata needed to define the data model.",
			},
			{
				Name:              "is_top_level",
				ColumnName:        "is_top_level",
				DataType:          "bool",
				IsNullable:        false,
				DefaultValue:      "true",
				ColumnType:        "truefalse",
				ColumnDescription: "Indicates whether this entity appears at the top level of the data hierarchy in the system. Top-level entities are directly accessible via API endpoints and user interfaces.",
			},
			{
				Name:              "is_hidden",
				ColumnName:        "is_hidden",
				DataType:          "bool",
				IsNullable:        false,
				DefaultValue:      "false",
				ColumnType:        "truefalse",
				ColumnDescription: "Controls the visibility of this entity in user interfaces and API documentation. When set to true, the entity exists but is not displayed in standard listings.",
			},
			{
				Name:              "is_join_table",
				ColumnName:        "is_join_table",
				DataType:          "bool",
				IsNullable:        false,
				DefaultValue:      "false",
				ColumnType:        "truefalse",
				ColumnDescription: "Specifies whether this table serves as a many-to-many join table between other entities. Join tables typically contain primarily foreign key references to related entities.",
			},
			{
				Name:              "is_state_tracking_enabled",
				ColumnName:        "is_state_tracking_enabled",
				DataType:          "bool",
				IsNullable:        false,
				DefaultValue:      "false",
				ColumnType:        "truefalse",
				ColumnDescription: "Determines whether state transitions for records in this table are tracked and logged. When enabled, the system maintains a history of status changes over time.",
			},
			{
				Name:              "default_order",
				ColumnName:        "default_order",
				DataType:          "varchar(100)",
				IsNullable:        true,
				DefaultValue:      "'+id'",
				ColumnType:        "value",
				ColumnDescription: "A string defining the default sorting order for records in this table. Uses a format like '+column' for ascending or '-column' for descending sort, defaulting to '+id'.",
			},
			{
				Name:              "icon",
				ColumnName:        "icon",
				DataType:          "varchar(20)",
				IsNullable:        true,
				DefaultValue:      "'fa-star'",
				ColumnType:        "label",
				ColumnDescription: "The Font Awesome icon identifier used to represent this entity in the user interface. Provides visual identification of entity types in lists and navigation elements.",
			},
		},
	},
	{
		TableName:     "stream",
		Icon:          "fa-stream",
		DefaultGroups: adminsGroup,
		IsHidden:      false,
		Columns: []api2go.ColumnInfo{
			{
				Name:       "stream_name",
				ColumnName: "stream_name",
				DataType:   "varchar(100)",
				IsNullable: false,
				ColumnType: "label",
				IsIndexed:  true,
			},
			{
				Name:         "enable",
				ColumnName:   "enable",
				DataType:     "bool",
				IsNullable:   false,
				ColumnType:   "truefalse",
				DefaultValue: "true",
			},
			{
				Name:       "stream_contract",
				ColumnName: "stream_contract",
				DataType:   "text",
				IsNullable: false,
				ColumnType: "json",
			},
		},
	},
	{
		TableName:     "user_otp_account",
		Icon:          "fa-sms",
		IsHidden:      false,
		DefaultGroups: table_info.DefaultGroups(),
		Columns: []api2go.ColumnInfo{
			{
				ColumnName:        "mobile_number",
				IsIndexed:         true,
				IsNullable:        true,
				DataType:          "varchar(20)",
				ColumnType:        "label",
				ColumnDescription: "The user's mobile phone number used for receiving OTP (One-Time Password) messages. This field is indexed to enable quick lookups for verification and authentication processes.",
			},
			{
				ColumnName:        "otp_secret",
				IsIndexed:         true,
				ExcludeFromApi:    true,
				DataType:          "varchar(100)",
				ColumnType:        "encrypted",
				ColumnDescription: "The encrypted secret key used to generate OTP (One-Time Password) codes for this account. This sensitive field is indexed for authentication lookups but excluded from API responses.",
			},
			{
				ColumnName:        "verified",
				DataType:          "bool",
				DefaultValue:      "false",
				ColumnType:        "truefalse",
				Name:              "verified",
				ColumnDescription: "Indicates whether the user's OTP account has been successfully verified through a validation process. Defaults to false until verification is completed.",
			},
		},
	},
	{
		TableName:     USER_ACCOUNT_TABLE_NAME,
		Icon:          "fa-user",
		DefaultGroups: table_info.DefaultGroups("users"),
		Columns: []api2go.ColumnInfo{
			{
				Name:              "name",
				ColumnName:        "name",
				IsIndexed:         true,
				DataType:          "varchar(80)",
				ColumnType:        "label",
				ColumnDescription: "The display name of the user, used for identification in the UI and communications. This field is indexed to support quick user lookups and searching by name.",
			},
			{
				Name:              "email",
				ColumnName:        "email",
				DataType:          "varchar(80)",
				IsIndexed:         true,
				IsUnique:          true,
				ColumnType:        "email",
				ColumnDescription: "The primary email address of the user, serving as a unique identifier for authentication and communication. This field is indexed and must be unique across all users.",
			},
			{
				Name:              "password",
				ColumnName:        "password",
				DataType:          "varchar(100)",
				ColumnType:        "password",
				IsNullable:        true,
				ColumnDescription: "The user's password stored in a secure hashed format. This field is nullable to support alternative authentication methods like OAuth or OTP.",
			},
			{
				Name:              "confirmed",
				ColumnName:        "confirmed",
				DataType:          "bool",
				ColumnType:        "truefalse",
				IsNullable:        false,
				DefaultValue:      "false",
				ColumnDescription: "Indicates whether the user has confirmed their account, typically through email verification. Defaults to false until the confirmation process is completed.",
			},
			{
				Name:              "auth_version",
				ColumnName:        "auth_version",
				DataType:          "INTEGER",
				ColumnType:        "measurement",
				IsNullable:        false,
				DefaultValue:      "1",
				ExcludeFromApi:    true,
				ColumnDescription: "Server-owned authentication lifecycle counter. Incremented when credentials change so older JWT sessions can be rejected.",
			},
		},
		Validations: []columns.ColumnTag{
			{
				ColumnName: "email",
				Tags:       "email",
			},
			{
				ColumnName: "password",
				Tags:       "required",
			},
			{
				ColumnName: "name",
				Tags:       "required",
			},
		},
		Conformations: []columns.ColumnTag{
			{
				ColumnName: "email",
				Tags:       "email",
			},
		},
	},
	{
		TableName: "usergroup",
		Icon:      "fa-users",
		IsHidden:  true,
		Columns: []api2go.ColumnInfo{
			{
				Name:              "name",
				ColumnName:        "name",
				IsIndexed:         true,
				IsUnique:          true,
				ColumnDescription: "A unique identifier for the user group that serves as the primary reference key. This indexed field ensures groups have distinct names for clear identification in permission assignments and user management.", DataType: "varchar(80)",
				ColumnType: "label",
			},
		},
	},
	{
		TableName:     "action",
		DefaultGroups: adminsGroup,
		IsHidden:      false,
		Icon:          "fa-bolt",
		CompositeKeys: [][]string{
			{"action_name", "world_id"},
		},
		Columns: []api2go.ColumnInfo{
			{
				Name:              "action_name",
				IsIndexed:         true,
				ColumnName:        "action_name",
				DataType:          "varchar(100)",
				ColumnType:        "label",
				ColumnDescription: "The internal identifier for the action that forms part of the composite primary key along with world_id. This indexed field enables quick lookups of actions by name.",
			},
			{
				Name:              "label",
				ColumnName:        "label",
				IsIndexed:         true,
				DataType:          "varchar(100)",
				ColumnType:        "label",
				ColumnDescription: "A human-readable display name for the action shown in user interfaces. This field is indexed to facilitate filtering and searching actions by their display names.",
			},
			{
				Name:              "instance_optional",
				ColumnName:        "instance_optional",
				IsIndexed:         false,
				DataType:          "bool",
				ColumnType:        "truefalse",
				DefaultValue:      "true",
				ColumnDescription: "Determines whether this action requires a specific instance to operate on. When true, the action can be executed at the entity level without selecting a particular record.",
			},
			{
				Name:              "action_schema",
				ColumnName:        "action_schema",
				DataType:          "text",
				ExcludeFromApi:    true,
				ColumnType:        "json",
				ColumnDescription: "The JSON schema defining the structure, input fields, validations, and outcome configurations for this action. Excluded from API responses due to its internal technical nature.",
			},
		},
	},
	{
		TableName:     "smd",
		IsHidden:      false,
		Icon:          "fa-project-diagram",
		DefaultGroups: adminsGroup,
		Columns: []api2go.ColumnInfo{
			{
				Name:       "name",
				ColumnName: "name",
				IsIndexed:  true,
				DataType:   "varchar(100)",
				ColumnType: "label",
				IsNullable: false,
			},
			{
				Name:       "label",
				ColumnName: "label",
				DataType:   "varchar(100)",
				ColumnType: "label",
				IsNullable: false,
			},
			{
				Name:       "initial_state",
				ColumnName: "initial_state",
				DataType:   "varchar(100)",
				ColumnType: "label",
				IsNullable: false,
			},
			{
				Name:       "events",
				ColumnName: "events",
				DataType:   "text",
				ColumnType: "json",
				IsNullable: false,
			},
		},
	},
	{
		TableName:     "oauth_connect",
		Icon:          "fa-plug",
		IsHidden:      false,
		DefaultGroups: adminsGroup,
		Columns: []api2go.ColumnInfo{
			{
				Name:              "name",
				ColumnName:        "name",
				IsUnique:          true,
				IsIndexed:         true,
				DataType:          "varchar(80)",
				ColumnType:        "label",
				ColumnDescription: "A unique identifier for the OAuth connection that serves as the primary reference key. This indexed field allows for quick lookup of specific OAuth provider configurations.",
			},
			{
				Name:              "client_id",
				ColumnName:        "client_id",
				DataType:          "varchar(150)",
				ColumnType:        "label",
				ColumnDescription: "The OAuth client identifier issued by the authentication provider when registering the application. This is used to identify the application to the OAuth service.",
			},
			{
				Name:              "client_secret",
				ColumnName:        "client_secret",
				DataType:          "varchar(500)",
				ColumnType:        "encrypted",
				ColumnDescription: "The confidential OAuth client secret issued by the authentication provider, stored with encryption for security. Used with the client_id to authenticate the application.",
			},
			{
				Name:              "scope",
				ColumnName:        "scope",
				DataType:          "varchar(1000)",
				ColumnType:        "content",
				DefaultValue:      "'https://www.googleapis.com/auth/spreadsheets'",
				ColumnDescription: "The OAuth permission scopes requested for this connection, defining what resources and operations the application can access. Defaults to Google Sheets access scope.",
			},
			{
				Name:              "response_type",
				ColumnName:        "response_type",
				DataType:          "varchar(80)",
				ColumnType:        "label",
				DefaultValue:      "'code'",
				ColumnDescription: "The OAuth response type expected from the authorization server, typically 'code' for authorization code flow or 'token' for implicit flow. Defaults to 'code'.",
			},
			{
				Name:              "redirect_uri",
				ColumnName:        "redirect_uri",
				DataType:          "varchar(80)",
				ColumnType:        "url",
				DefaultValue:      "'/oauth/response'",
				ColumnDescription: "The URL to which the OAuth provider will redirect users after authentication, sending authorization codes or tokens. Defaults to '/oauth/response'.",
			},
			{
				Name:              "auth_url",
				ColumnName:        "auth_url",
				DataType:          "varchar(200)",
				DefaultValue:      "'https://accounts.google.com/o/oauth2/auth'",
				ColumnType:        "url",
				ColumnDescription: "The OAuth provider's authorization endpoint URL where users are redirected to authenticate. Defaults to Google's OAuth authorization endpoint.",
			},
			{
				Name:              "token_url",
				ColumnName:        "token_url",
				DataType:          "varchar(200)",
				DefaultValue:      "'https://accounts.google.com/o/oauth2/token'",
				ColumnType:        "url",
				ColumnDescription: "The OAuth provider's token endpoint URL used to exchange authorization codes for access tokens. Defaults to Google's OAuth token endpoint.",
			},
			{
				Name:              "profile_url",
				ColumnName:        "profile_url",
				DataType:          "varchar(200)",
				DefaultValue:      "'https://www.googleapis.com/oauth2/v1/userinfo?alt=json'",
				ColumnType:        "url",
				ColumnDescription: "The URL to fetch user profile information after authentication, used for user creation or profile updates. Defaults to Google's user info endpoint.",
			},
			{
				Name:              "profile_email_path",
				ColumnName:        "profile_email_path",
				DataType:          "varchar(200)",
				DefaultValue:      "'email'",
				ColumnType:        "label",
				ColumnDescription: "The JSON path to extract the user's email from the profile response. Specifies where to find the email address in the provider's user profile data structure.",
			},
			{
				Name:              "allow_login",
				ColumnName:        "allow_login",
				DataType:          "bool",
				DefaultValue:      "false",
				ColumnType:        "truefalse",
				ColumnDescription: "Controls whether this OAuth connection can be used for user authentication and login. When enabled, users can sign in using this OAuth provider.",
			},
			{
				Name:              "access_type_offline",
				ColumnName:        "access_type_offline",
				DataType:          "bool",
				DefaultValue:      "false",
				ColumnType:        "truefalse",
				ColumnDescription: "Determines whether to request refresh tokens for offline access to resources. When enabled, the application can access resources even when the user is not present.",
			},
			{
				Name:              "pkce_enabled",
				ColumnName:        "pkce_enabled",
				DataType:          "bool",
				DefaultValue:      "false",
				ColumnType:        "truefalse",
				ColumnDescription: "Enables Proof Key for Code Exchange (PKCE) for OAuth providers that require a per-request code challenge and verifier.",
			},
			{
				Name:              "pkce_challenge_method",
				ColumnName:        "pkce_challenge_method",
				DataType:          "varchar(20)",
				DefaultValue:      "'S256'",
				ColumnType:        "label",
				ColumnDescription: "The PKCE challenge method to use when pkce_enabled is true. S256 is the supported and recommended method.",
			},
		},
	},
	{
		TableName:     "oauth_state",
		IsHidden:      true,
		Icon:          "fa-ticket-alt",
		DefaultGroups: adminsGroup,
		Columns: []api2go.ColumnInfo{
			{Name: "state_hash", ColumnName: "state_hash", ColumnType: "label", DataType: "varchar(128)", IsUnique: true, IsIndexed: true, IsNullable: false},
			{Name: "code_verifier", ColumnName: "code_verifier", ColumnType: "encrypted", DataType: "varchar(500)", IsNullable: true},
			{Name: "expires_at", ColumnName: "expires_at", ColumnType: "measurement", DataType: "bigint", IsIndexed: true, IsNullable: false},
			{Name: "used_at", ColumnName: "used_at", ColumnType: "measurement", DataType: "bigint", IsNullable: true},
		},
	},
	{
		TableName:     "data_exchange",
		IsHidden:      false,
		Icon:          "fa-sync",
		DefaultGroups: adminsGroup,
		Columns: []api2go.ColumnInfo{
			{
				Name:              "name",
				ColumnName:        "name",
				ColumnType:        "label",
				IsUnique:          true,
				DataType:          "varchar(200)",
				IsIndexed:         true,
				ColumnDescription: "A unique identifier for the data exchange configuration that serves as the primary reference key. This indexed field enables quick lookups of specific data exchange processes.",
			},
			{
				Name:              "source_attributes",
				ColumnName:        "source_attributes",
				ColumnType:        "json",
				DataType:          "text",
				ColumnDescription: "JSON configuration specifying details about the data source, including connection parameters, authentication credentials, and source-specific settings required for data extraction.",
			},
			{
				Name:              "source_type",
				ColumnName:        "source_type",
				ColumnType:        "label",
				DataType:          "varchar(100)",
				ColumnDescription: "The type of data source system (e.g., 'database', 'api', 'file', 'self') that identifies where data will be extracted from and determines how source_attributes are interpreted.",
			},
			{
				Name:              "target_attributes",
				ColumnName:        "target_attributes",
				ColumnType:        "json",
				DataType:          "text",
				ColumnDescription: "JSON configuration defining the destination for the exchanged data, including connection parameters, authentication details, and target-specific settings for data loading.",
			},
			{
				Name:              "attributes",
				ColumnName:        "attributes",
				ColumnType:        "json",
				DataType:          "text",
				ColumnDescription: "JSON mapping of source columns to target columns, defining how data fields are transformed, renamed, or modified during the exchange process between systems.",
			},
			{
				Name:              "target_type",
				ColumnName:        "target_type",
				ColumnType:        "label",
				DataType:          "varchar(100)",
				ColumnDescription: "The type of destination system (e.g., 'database', 'api', 'gsheet-append') that identifies where data will be loaded to and determines how target_attributes are interpreted.",
			},
			{
				Name:              "options",
				ColumnName:        "options",
				ColumnType:        "json",
				DataType:          "text",
				ColumnDescription: "JSON configuration containing additional exchange options like error handling, validation rules, scheduling parameters, and behavior controls for the data transfer process.",
			},
		},
	},
	{
		TableName:     "oauth_token",
		IsHidden:      false,
		Icon:          "fa-shield-alt",
		DefaultGroups: adminsGroup,
		Columns: []api2go.ColumnInfo{
			{
				Name:              "access_token",
				ColumnName:        "access_token",
				ColumnType:        "encrypted",
				DataType:          "varchar(1000)",
				ColumnDescription: "The encrypted OAuth access token used to authenticate API requests to the provider. This token is stored securely and used for authorized access to protected resources.",
			},
			{
				Name:              "expires_in",
				ColumnName:        "expires_in",
				ColumnType:        "measurement",
				DataType:          "int(11)",
				ColumnDescription: "The lifetime of the access token in seconds, indicating when the token will expire and require renewal. Used to determine when refresh operations should be triggered.",
			},
			{
				Name:              "refresh_token",
				ColumnName:        "refresh_token",
				ColumnType:        "encrypted",
				DataType:          "varchar(1000)",
				ColumnDescription: "The encrypted OAuth refresh token used to obtain new access tokens when they expire. This long-lived token enables continuous access without user re-authentication.",
			},
			{
				Name:              "token_type",
				ColumnName:        "token_type",
				ColumnType:        "label",
				DataType:          "varchar(20)",
				ColumnDescription: "The type of access token issued by the OAuth provider, typically 'Bearer'. This determines how the token should be included in subsequent API authorization headers.",
			},
		},
	},
	{
		TableName:     "oauth_app",
		IsHidden:      true,
		Icon:          "fa-id-card",
		DefaultGroups: adminsGroup,
		Columns: []api2go.ColumnInfo{
			{Name: "name", ColumnName: "name", ColumnType: "label", DataType: "varchar(150)", IsUnique: true, IsIndexed: true},
			{Name: "client_id", ColumnName: "client_id", ColumnType: "label", DataType: "varchar(200)", IsUnique: true, IsIndexed: true},
			{Name: "client_secret", ColumnName: "client_secret", ColumnType: "password", DataType: "varchar(500)", IsNullable: true},
			{Name: "redirect_uris", ColumnName: "redirect_uris", ColumnType: "content", DataType: "text"},
			{Name: "scopes", ColumnName: "scopes", ColumnType: "content", DataType: "text", DefaultValue: "'openid profile email'"},
			{Name: "grants", ColumnName: "grants", ColumnType: "label", DataType: "varchar(300)", DefaultValue: "'authorization_code,refresh_token'"},
			{Name: "is_confidential", ColumnName: "is_confidential", ColumnType: "truefalse", DataType: "bool", DefaultValue: "true"},
			{Name: "is_enabled", ColumnName: "is_enabled", ColumnType: "truefalse", DataType: "bool", DefaultValue: "true"},
		},
	},
	{
		TableName:     "oauth_code",
		IsHidden:      true,
		Icon:          "fa-ticket-alt",
		DefaultGroups: adminsGroup,
		Columns: []api2go.ColumnInfo{
			{Name: "code_hash", ColumnName: "code_hash", ColumnType: "label", DataType: "varchar(128)", IsUnique: true, IsIndexed: true, IsNullable: false},
			{Name: "redirect_uri", ColumnName: "redirect_uri", ColumnType: "url", DataType: "text"},
			{Name: "scope", ColumnName: "scope", ColumnType: "content", DataType: "text"},
			{Name: "expires_at", ColumnName: "expires_at", ColumnType: "measurement", DataType: "bigint"},
			{Name: "used_at", ColumnName: "used_at", ColumnType: "measurement", DataType: "bigint", IsNullable: true},
			{Name: "code_challenge", ColumnName: "code_challenge", ColumnType: "label", DataType: "varchar(200)", IsNullable: true},
			{Name: "code_challenge_method", ColumnName: "code_challenge_method", ColumnType: "label", DataType: "varchar(20)", IsNullable: true},
			{Name: "nonce", ColumnName: "nonce", ColumnType: "label", DataType: "varchar(200)", IsNullable: true},
		},
	},
	{
		TableName:     "oauth_access",
		IsHidden:      true,
		Icon:          "fa-key",
		DefaultGroups: adminsGroup,
		Columns: []api2go.ColumnInfo{
			{Name: "token_hash", ColumnName: "token_hash", ColumnType: "label", DataType: "varchar(128)", IsUnique: true, IsIndexed: true},
			{Name: "token_type", ColumnName: "token_type", ColumnType: "label", DataType: "varchar(40)", DefaultValue: "'Bearer'"},
			{Name: "scope", ColumnName: "scope", ColumnType: "content", DataType: "text"},
			{Name: "expires_at", ColumnName: "expires_at", ColumnType: "measurement", DataType: "bigint"},
			{Name: "revoked_at", ColumnName: "revoked_at", ColumnType: "measurement", DataType: "bigint", IsNullable: true},
		},
	},
	{
		TableName:     "oauth_refresh",
		IsHidden:      true,
		Icon:          "fa-redo",
		DefaultGroups: adminsGroup,
		Columns: []api2go.ColumnInfo{
			{Name: "token_hash", ColumnName: "token_hash", ColumnType: "label", DataType: "varchar(128)", IsUnique: true, IsIndexed: true},
			{Name: "scope", ColumnName: "scope", ColumnType: "content", DataType: "text"},
			{Name: "expires_at", ColumnName: "expires_at", ColumnType: "measurement", DataType: "bigint"},
			{Name: "revoked_at", ColumnName: "revoked_at", ColumnType: "measurement", DataType: "bigint", IsNullable: true},
		},
	},
	{
		TableName:     "oauth_grant",
		IsHidden:      false,
		Icon:          "fa-user-check",
		DefaultGroups: adminsGroup,
		Columns: []api2go.ColumnInfo{
			{Name: "scope", ColumnName: "scope", ColumnType: "content", DataType: "text"},
			{Name: "granted_at", ColumnName: "granted_at", ColumnType: "measurement", DataType: "bigint"},
			{Name: "revoked_at", ColumnName: "revoked_at", ColumnType: "measurement", DataType: "bigint", IsNullable: true},
		},
	},
	{
		TableName:     "oauth_key",
		IsHidden:      false,
		Icon:          "fa-fingerprint",
		DefaultGroups: adminsGroup,
		Columns: []api2go.ColumnInfo{
			{Name: "key_id", ColumnName: "key_id", ColumnType: "label", DataType: "varchar(120)", IsUnique: true, IsIndexed: true},
			{Name: "algorithm", ColumnName: "algorithm", ColumnType: "label", DataType: "varchar(40)", DefaultValue: "'RS256'"},
			{Name: "public_key", ColumnName: "public_key", ColumnType: "content", DataType: "text", IsNullable: true},
			{Name: "private_key", ColumnName: "private_key", ColumnType: "encrypted", DataType: "text", IsNullable: true},
			{Name: "is_active", ColumnName: "is_active", ColumnType: "truefalse", DataType: "bool", DefaultValue: "true"},
		},
	},
	{
		TableName:     "cloud_store",
		Icon:          "fa-cloud",
		DefaultGroups: adminsGroup,
		IsHidden:      false,
		Columns: []api2go.ColumnInfo{
			{
				Name:              "Name",
				ColumnName:        "name",
				ColumnType:        "label",
				DataType:          "varchar(100)",
				IsUnique:          true,
				ColumnDescription: "A unique identifier for the cloud storage connection that serves as the primary reference key. Used in file operations, site configurations, and throughout the system.",
			},
			{
				Name:              "store_type",
				ColumnName:        "store_type",
				ColumnType:        "label",
				DataType:          "varchar(100)",
				ColumnDescription: "Categorizes the storage service by type (e.g., 'local', 'cloud'), defining the general classification of storage architecture used by this connection.",
			},
			{
				Name:              "store_provider",
				ColumnName:        "store_provider",
				ColumnType:        "label",
				DataType:          "varchar(100)",
				ColumnDescription: "Identifies the specific cloud provider or service (e.g., 'aws', 'gcs', 'Azure Blob Storage', 'local') used for this storage connection.",
			},
			{
				Name:              "root_path",
				ColumnName:        "root_path",
				ColumnType:        "label",
				DataType:          "varchar(1000)",
				ColumnDescription: "The base directory path within the storage service where operations will be performed. Acts as the starting point for all relative paths used with this connection.",
			},
			{
				Name:              "credential_name",
				ColumnName:        "credential_name",
				ColumnType:        "label",
				IsNullable:        true,
				DataType:          "varchar(1000)",
				ColumnDescription: "References the name of a credential record containing authentication details for this storage service. Can be null for services that don't require authentication.",
			},
			{
				Name:              "store_parameters",
				ColumnName:        "store_parameters",
				ColumnType:        "json",
				DataType:          "text",
				ColumnDescription: "JSON configuration containing additional connection parameters specific to the storage provider, such as region, endpoint URLs, timeout settings, and retry policies.",
			},
		},
	},
	{
		TableName:     "llm_provider",
		Icon:          "fa-brain",
		DefaultGroups: adminsGroup,
		IsHidden:      false,
		Columns: []api2go.ColumnInfo{
			{
				Name:              "Name",
				ColumnName:        "name",
				ColumnType:        "label",
				DataType:          "varchar(100)",
				IsUnique:          true,
				IsIndexed:         true,
				ColumnDescription: "Unique identifier for this LLM provider configuration.",
			},
			{
				Name:              "provider_type",
				ColumnName:        "provider_type",
				ColumnType:        "label",
				DataType:          "varchar(100)",
				IsNullable:        false,
				ColumnDescription: "The LLM provider backend: openai, anthropic, gemini, ollama, groq, bedrock, azure, deepseek, mistral, or any openai-compatible.",
			},
			{
				Name:              "base_url",
				ColumnName:        "base_url",
				ColumnType:        "url",
				DataType:          "varchar(500)",
				IsNullable:        true,
				ColumnDescription: "Custom API base URL. If empty, uses provider default. Required for ollama, azure, and custom openai-compatible endpoints.",
			},
			{
				Name:              "models",
				ColumnName:        "models",
				ColumnType:        "content",
				DataType:          "text",
				IsNullable:        false,
				ColumnDescription: "Comma-separated list of model names this provider handles. Used for model-to-provider routing.",
			},
			{
				Name:              "credential_name",
				ColumnName:        "credential_name",
				ColumnType:        "label",
				IsNullable:        true,
				DataType:          "varchar(1000)",
				ColumnDescription: "References the name of a credential record containing the API key. Null for providers that don't require auth (e.g. local ollama).",
			},
			{
				Name:              "provider_parameters",
				ColumnName:        "provider_parameters",
				ColumnType:        "json",
				DataType:          "text",
				ColumnDescription: "JSON with provider-specific defaults: anthropic_version, api_version (azure), organization (openai), default temperature, max_tokens, etc.",
			},
			{
				Name:              "model_pricing",
				ColumnName:        "model_pricing",
				ColumnType:        "json",
				DataType:          "text",
				IsNullable:        true,
				ColumnDescription: "JSON pricing per model in USD per million tokens. Format: {\"model-name\": {\"input\": 2.50, \"output\": 10.00, \"cache_read\": 0.25, \"cache_write\": 3.75}}. Used for cost tracking in llm_usage.",
			},
			{
				Name:              "enable",
				ColumnName:        "enable",
				ColumnType:        "truefalse",
				DataType:          "bool",
				DefaultValue:      "true",
				IsNullable:        false,
				ColumnDescription: "Controls whether this provider is active. Disabled providers are skipped during model routing.",
			},
		},
	},
	{
		TableName:     "llm_usage",
		Icon:          "fa-chart-bar",
		DefaultGroups: adminsGroup,
		IsHidden:      false,
		Columns: []api2go.ColumnInfo{
			{
				Name:       "provider_name",
				ColumnName: "provider_name",
				ColumnType: "label",
				DataType:   "varchar(100)",
				IsIndexed:  true,
			},
			{
				Name:       "model",
				ColumnName: "model",
				ColumnType: "label",
				DataType:   "varchar(200)",
				IsIndexed:  true,
			},
			{
				Name:              "request_type",
				ColumnName:        "request_type",
				ColumnType:        "label",
				DataType:          "varchar(20)",
				ColumnDescription: "chat, completion, or embedding",
			},
			{
				Name:       "input_tokens",
				ColumnName: "input_tokens",
				ColumnType: "measurement",
				DataType:   "int(11)",
			},
			{
				Name:       "output_tokens",
				ColumnName: "output_tokens",
				ColumnType: "measurement",
				DataType:   "int(11)",
			},
			{
				Name:       "cache_read_tokens",
				ColumnName: "cache_read_tokens",
				ColumnType: "measurement",
				DataType:   "int(11)",
			},
			{
				Name:       "cache_write_tokens",
				ColumnName: "cache_write_tokens",
				ColumnType: "measurement",
				DataType:   "int(11)",
			},
			{
				Name:       "reasoning_tokens",
				ColumnName: "reasoning_tokens",
				ColumnType: "measurement",
				DataType:   "int(11)",
			},
			{
				Name:       "total_tokens",
				ColumnName: "total_tokens",
				ColumnType: "measurement",
				DataType:   "int(11)",
			},
			{
				Name:              "cost_micros",
				ColumnName:        "cost_micros",
				ColumnType:        "measurement",
				DataType:          "int(11)",
				ColumnDescription: "Cost in 1/1,000,000 USD. Divide by 1,000,000 for USD. Avoids float precision issues.",
			},
			{
				Name:       "duration_ms",
				ColumnName: "duration_ms",
				ColumnType: "measurement",
				DataType:   "int(11)",
			},
			{
				Name:       "finish_reason",
				ColumnName: "finish_reason",
				ColumnType: "label",
				DataType:   "varchar(30)",
			},
		},
	},
	{
		TableName:     "api_plan",
		Icon:          "fa-layer-group",
		DefaultGroups: adminsGroup,
		IsHidden:      false,
		Columns: []api2go.ColumnInfo{
			{
				Name:              "name",
				ColumnName:        "name",
				ColumnType:        "label",
				DataType:          "varchar(100)",
				IsUnique:          true,
				IsIndexed:         true,
				ColumnDescription: "Unique metering plan name.",
			},
			{Name: "requests_per_period", ColumnName: "requests_per_period", ColumnType: "measurement", DataType: "int(11)", DefaultValue: "-1"},
			{Name: "compute_units_per_period", ColumnName: "compute_units_per_period", ColumnType: "measurement", DataType: "int(11)", DefaultValue: "-1"},
			{Name: "rate_limit_per_minute", ColumnName: "rate_limit_per_minute", ColumnType: "measurement", DataType: "int(11)", DefaultValue: "-1"},
			{Name: "price_monthly_cents", ColumnName: "price_monthly_cents", ColumnType: "measurement", DataType: "int(11)", IsNullable: true},
			{Name: "overage_price_micros", ColumnName: "overage_price_micros", ColumnType: "measurement", DataType: "int(11)", IsNullable: true},
			{Name: "meter_type", ColumnName: "meter_type", ColumnType: "label", DataType: "varchar(50)", DefaultValue: "'requests'"},
			{Name: "quota_enforce_mode", ColumnName: "quota_enforce_mode", ColumnType: "label", DataType: "varchar(20)", DefaultValue: "'hard'"},
			{Name: "metadata", ColumnName: "metadata", ColumnType: "json", DataType: "text", IsNullable: true},
		},
	},
	{
		TableName:     "api_member",
		Icon:          "fa-id-card",
		DefaultGroups: adminsGroup,
		IsHidden:      false,
		Columns: []api2go.ColumnInfo{
			{Name: "status", ColumnName: "status", ColumnType: "label", DataType: "varchar(30)", DefaultValue: "'active'", IsIndexed: true},
			{Name: "period_start", ColumnName: "period_start", ColumnType: "datetime", DataType: "timestamp", DefaultValue: "current_timestamp", IsIndexed: true},
			{Name: "period_end", ColumnName: "period_end", ColumnType: "datetime", DataType: "timestamp", IsNullable: true},
			{Name: "metadata", ColumnName: "metadata", ColumnType: "json", DataType: "text", IsNullable: true},
		},
	},
	{
		TableName:     "api_usage",
		Icon:          "fa-chart-line",
		DefaultGroups: adminsGroup,
		IsHidden:      false,
		Columns: []api2go.ColumnInfo{
			{Name: "api_key_id", ColumnName: "api_key_id", ColumnType: "label", DataType: "varchar(100)", IsNullable: true, IsIndexed: true},
			{Name: "endpoint", ColumnName: "endpoint", ColumnType: "label", DataType: "varchar(500)", IsIndexed: true},
			{Name: "method", ColumnName: "method", ColumnType: "label", DataType: "varchar(20)"},
			{Name: "entity_type", ColumnName: "entity_type", ColumnType: "label", DataType: "varchar(200)", IsNullable: true, IsIndexed: true},
			{Name: "action_name", ColumnName: "action_name", ColumnType: "label", DataType: "varchar(200)", IsNullable: true, IsIndexed: true},
			{Name: "request_type", ColumnName: "request_type", ColumnType: "label", DataType: "varchar(50)", IsNullable: true, IsIndexed: true},
			{Name: "status_code", ColumnName: "status_code", ColumnType: "measurement", DataType: "int(11)"},
			{Name: "latency_ms", ColumnName: "latency_ms", ColumnType: "measurement", DataType: "int(11)"},
			{Name: "request_bytes", ColumnName: "request_bytes", ColumnType: "measurement", DataType: "int(11)"},
			{Name: "response_bytes", ColumnName: "response_bytes", ColumnType: "measurement", DataType: "int(11)"},
			{Name: "cost_units", ColumnName: "cost_units", ColumnType: "measurement", DataType: "int(11)", DefaultValue: "0"},
			{Name: "cost_micros", ColumnName: "cost_micros", ColumnType: "measurement", DataType: "int(11)", DefaultValue: "0"},
			{Name: "meter_type", ColumnName: "meter_type", ColumnType: "label", DataType: "varchar(50)", DefaultValue: "'requests'"},
			{Name: "metadata", ColumnName: "metadata", ColumnType: "json", DataType: "text", IsNullable: true},
			{Name: "error_message", ColumnName: "error_message", ColumnType: "content", DataType: "text", IsNullable: true},
		},
	},
	{
		TableName:     "api_quota",
		Icon:          "fa-gauge-high",
		DefaultGroups: adminsGroup,
		IsHidden:      false,
		Columns: []api2go.ColumnInfo{
			{Name: "period_start", ColumnName: "period_start", ColumnType: "datetime", DataType: "timestamp", IsIndexed: true},
			{Name: "period_end", ColumnName: "period_end", ColumnType: "datetime", DataType: "timestamp", IsNullable: true},
			{Name: "request_count", ColumnName: "request_count", ColumnType: "measurement", DataType: "int(11)", DefaultValue: "0"},
			{Name: "compute_units", ColumnName: "compute_units", ColumnType: "measurement", DataType: "int(11)", DefaultValue: "0"},
			{Name: "bytes_used", ColumnName: "bytes_used", ColumnType: "measurement", DataType: "int(11)", DefaultValue: "0"},
		},
	},
	{
		TableName:     "site",
		DefaultGroups: adminsGroup,
		Icon:          "fa-sitemap",
		IsHidden:      false,
		Columns: []api2go.ColumnInfo{
			{
				Name:       "name",
				ColumnName: "name",
				ColumnType: "label",
				DataType:   "varchar(100)",
			},
			{
				Name:       "hostname",
				ColumnName: "hostname",
				ColumnType: "label",
				DataType:   "varchar(100)",
			},
			{
				Name:              "path",
				ColumnName:        "path",
				ColumnType:        "label",
				DataType:          "varchar(100)",
				ColumnDescription: "path on the cloud store to host as base directory",
			},
			{
				Name:         "enable",
				ColumnName:   "enable",
				ColumnType:   "truefalse",
				DataType:     "bool",
				DefaultValue: "true",
			},
			{
				Name:         "ftp_enabled",
				ColumnName:   "ftp_enabled",
				ColumnType:   "truefalse",
				DataType:     "bool",
				DefaultValue: "false",
			},
			{
				Name:         "site_type",
				ColumnName:   "site_type",
				ColumnType:   "label",
				DataType:     "varchar(20)",
				DefaultValue: "'static'",
			},
		},
	},
	{
		TableName:     "mail_server",
		IsHidden:      false,
		Icon:          "fa-envelope",
		DefaultGroups: adminsGroup,
		Columns: []api2go.ColumnInfo{
			{
				Name:       "hostname",
				ColumnName: "hostname",
				DataType:   "varchar(100)",
				IsUnique:   true,
				ColumnType: "label",
			},
			{
				Name:         "is_enabled",
				ColumnName:   "is_enabled",
				DataType:     "bool",
				ColumnType:   "truefalse",
				DefaultValue: "false",
			},
			{
				Name:         "listen_interface",
				ColumnName:   "listen_interface",
				DataType:     "varchar(100)",
				ColumnType:   "label",
				DefaultValue: "'0.0.0.0:465'",
			},
			{
				Name:         "max_size",
				ColumnName:   "max_size",
				DataType:     "int(11)",
				ColumnType:   "measurement",
				DefaultValue: "10000",
			},
			{
				Name:         "max_clients",
				ColumnName:   "max_clients",
				DataType:     "int(11)",
				ColumnType:   "measurement",
				DefaultValue: "20",
			},
			{
				Name:         "xclient_on",
				ColumnName:   "xclient_on",
				DataType:     "bool",
				ColumnType:   "truefalse",
				DefaultValue: "false",
			},
			{
				Name:         "always_on_tls",
				ColumnName:   "always_on_tls",
				DataType:     "bool",
				ColumnType:   "truefalse",
				DefaultValue: "true",
			},
			{
				Name:         "authentication_required",
				ColumnName:   "authentication_required",
				DataType:     "bool",
				ColumnType:   "truefalse",
				DefaultValue: "true",
			},
		},
	},
	{
		TableName:     "mail_account",
		IsHidden:      false,
		DefaultGroups: adminsGroup,
		Icon:          "fa-at",
		Columns: []api2go.ColumnInfo{
			{
				Name:       "username",
				ColumnName: "username",
				DataType:   "varchar(100)",
				ColumnType: "label",
				IsUnique:   true,
			},
			{
				Name:       "password",
				ColumnName: "password",
				ColumnType: "password",
			},
			{
				Name:       "password_md5",
				ColumnName: "password_md5",
				ColumnType: "md5-bcrypt",
			},
		},
	},
	{
		TableName:     "mail_box",
		IsHidden:      false,
		Icon:          "fa-inbox",
		DefaultGroups: adminsGroup,
		Columns: []api2go.ColumnInfo{
			{
				Name:       "name",
				ColumnName: "name",
				DataType:   "varchar(100)",
				ColumnType: "label",
			},
			{
				Name:         "subscribed",
				ColumnName:   "subscribed",
				DataType:     "bool",
				ColumnType:   "truefalse",
				DefaultValue: "true",
			},
			{
				Name:         "uidvalidity",
				ColumnName:   "uidvalidity",
				DataType:     "int(11)",
				ColumnType:   "value",
				DefaultValue: "1",
			},
			{
				Name:         "nextuid",
				ColumnName:   "nextuid",
				DataType:     "int(11)",
				ColumnType:   "value",
				DefaultValue: "1",
			},
			{
				Name:       "attributes",
				ColumnName: "attributes",
				DataType:   "varchar(100)",
				ColumnType: "label",
			},
			{
				Name:       "flags",
				ColumnName: "flags",
				DataType:   "varchar(100)",
				ColumnType: "label",
			},
			{
				Name:       "permanent_flags",
				ColumnName: "permanent_flags",
				DataType:   "varchar(100)",
				ColumnType: "label",
			},
		},
	},
	{
		TableName:     "mail",
		IsHidden:      false,
		Icon:          "fa-envelope",
		DefaultGroups: adminsGroup,
		Columns: []api2go.ColumnInfo{
			{
				Name:       "message_id",
				ColumnName: "message_id",
				DataType:   "varchar(500)",
				ColumnType: "label",
				IsIndexed:  true,
			},
			{
				Name:       "mail_id",
				ColumnName: "mail_id",
				DataType:   "varchar(100)",
				ColumnType: "label",
			},
			{
				Name:       "from_address",
				ColumnName: "from_address",
				DataType:   "varchar(200)",
				ColumnType: "label",
			},
			{
				Name:       "internal_date",
				ColumnName: "internal_date",
				DataType:   "timestamp",
				ColumnType: "datetime",
				IsIndexed:  true,
			},
			{
				Name:       "to_address",
				ColumnName: "to_address",
				DataType:   "varchar(200)",
				ColumnType: "label",
			},
			{
				Name:       "reply_to_address",
				ColumnName: "reply_to_address",
				DataType:   "varchar(200)",
				ColumnType: "label",
			},
			{
				Name:       "sender_address",
				ColumnName: "sender_address",
				DataType:   "varchar(200)",
				ColumnType: "label",
			},
			{
				Name:       "subject",
				ColumnName: "subject",
				DataType:   "varchar(500)",
				ColumnType: "label",
			},
			{
				Name:       "body",
				ColumnName: "body",
				DataType:   "text",
				ColumnType: "label",
			},
			{
				Name:       "mail",
				ColumnName: "mail",
				ColumnType: "gzip",
				DataType:   "blob",
			},
			{
				Name:       "spam_score",
				ColumnName: "spam_score",
				ColumnType: "measurement",
				DataType:   "float",
			},
			{
				Name:       "hash",
				ColumnName: "hash",
				DataType:   "varchar(100)",
				ColumnType: "label",
			},
			{
				Name:       "content_type",
				ColumnName: "content_type",
				DataType:   "text",
				ColumnType: "content",
			},
			{
				Name:       "recipient",
				ColumnName: "recipient",
				DataType:   "varchar(200)",
				ColumnType: "label",
			},
			{
				Name:         "has_attachment",
				ColumnName:   "has_attachment",
				DataType:     "bool",
				ColumnType:   "truefalse",
				DefaultValue: "false",
			},
			{
				Name:       "ip_addr",
				ColumnName: "ip_addr",
				DataType:   "varchar(30)",
				ColumnType: "label",
			},
			{
				Name:       "return_path",
				ColumnName: "return_path",
				DataType:   "VARCHAR(255)",
				ColumnType: "content",
			},
			{
				Name:         "is_tls",
				ColumnName:   "is_tls",
				DataType:     "bool",
				ColumnType:   "truefalse",
				DefaultValue: "false",
			},
			{
				Name:         "seen",
				ColumnName:   "seen",
				DataType:     "bool",
				ColumnType:   "truefalse",
				DefaultValue: "false",
				IsIndexed:    true,
			},
			{
				Name:         "recent",
				ColumnName:   "recent",
				DataType:     "bool",
				ColumnType:   "truefalse",
				DefaultValue: "true",
				IsIndexed:    true,
			},
			{
				Name:         "deleted",
				ColumnName:   "deleted",
				DataType:     "bool",
				ColumnType:   "truefalse",
				DefaultValue: "false",
				IsIndexed:    true,
			},
			{
				Name:         "uid",
				ColumnName:   "uid",
				DataType:     "int(11)",
				ColumnType:   "value",
				DefaultValue: "0",
				IsIndexed:    true,
			},
			{
				Name:         "spam",
				ColumnName:   "spam",
				DataType:     "bool",
				ColumnType:   "truefalse",
				DefaultValue: "false",
			},
			{
				Name:       "size",
				ColumnName: "size",
				DataType:   "int(11)",
				ColumnType: "value",
			},
			{
				Name:         "flags",
				ColumnName:   "flags",
				DataType:     "varchar(500)",
				ColumnType:   "label",
				DefaultValue: "",
			},
		},
	},
	{
		TableName:     "outbox",
		IsHidden:      false,
		Icon:          "fa-paper-plane",
		DefaultGroups: adminsGroup,
		Columns: []api2go.ColumnInfo{
			{
				Name:       "from_address",
				ColumnName: "from_address",
				DataType:   "varchar(200)",
				ColumnType: "label",
			},
			{
				Name:       "to_address",
				ColumnName: "to_address",
				DataType:   "varchar(200)",
				ColumnType: "label",
			},
			{
				Name:       "to_host",
				ColumnName: "to_host",
				DataType:   "varchar(200)",
				ColumnType: "label",
			},
			{
				Name:       "mail",
				ColumnName: "mail",
				ColumnType: "gzip",
				DataType:   "blob",
			},
			{
				Name:         "sent",
				ColumnName:   "sent",
				ColumnType:   "truefalse",
				DataType:     "bool",
				DefaultValue: "false",
				IsIndexed:    true,
			},
			{
				Name:         "retry_count",
				ColumnName:   "retry_count",
				DataType:     "int(11)",
				ColumnType:   "value",
				DefaultValue: "0",
			},
			{
				Name:       "last_error",
				ColumnName: "last_error",
				DataType:   "text",
				ColumnType: "label",
				IsNullable: true,
			},
			{
				Name:       "next_retry_at",
				ColumnName: "next_retry_at",
				DataType:   "timestamp",
				ColumnType: "datetime",
				IsNullable: true,
				IsIndexed:  true,
			},
		},
	},
}
View Source
var StandardTasks []task.Task
View Source
var SystemActions = []actionresponse.Action{
	{
		Name:             "import_files_from_store",
		Label:            "Import files data to a table",
		OnType:           "world",
		InstanceOptional: false,
		InFields: []api2go.ColumnInfo{
			{
				Name:       "table_name",
				ColumnType: "label",
				ColumnName: "table_name",
			},
		},
		OutFields: []actionresponse.Outcome{
			{
				Type:   "cloud_store.files.import",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"table_name": "$.table_name",
				},
			},
		},
	},
	{
		Name:             "install_integration",
		Label:            "Install integration",
		OnType:           "integration",
		InstanceOptional: false,
		OutFields: []actionresponse.Outcome{
			{
				Type:   "integration.install",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"reference_id": "$.reference_id",
				},
			},
		},
	},
	{
		Name:             "download_certificate",
		Label:            "Download certificate",
		OnType:           "certificate",
		InstanceOptional: false,
		OutFields: []actionresponse.Outcome{
			{
				Type:   "client.file.download",
				Method: "ACTIONRESPONSE",
				Attributes: map[string]interface{}{
					"content":     "!btoa(subject.certificate_pem)",
					"name":        "!subject.hostname + '.pem.crt'",
					"contentType": "application/x-x509-ca-cert",
					"message":     "!'Certificate for ' + subject.hostname",
				},
			},
		},
	},
	{
		Name:             "get_action_schema",
		Label:            "Get Action Schema",
		OnType:           "action",
		InstanceOptional: false,
		OutFields: []actionresponse.Outcome{
			{
				Type:   "client.file.download",
				Method: "ACTIONRESPONSE",
				Attributes: map[string]interface{}{
					"content":     "!btoa(subject.action_schema)",
					"name":        "!subject.action_name + '.action.json'",
					"contentType": "application/json",
					"message":     "!'Action Schema for ' + subject.action_name",
				},
			},
		},
	},
	{
		Name:             "download_public_key",
		Label:            "Download public key",
		OnType:           "certificate",
		InstanceOptional: false,
		OutFields: []actionresponse.Outcome{
			{
				Type:   "client.file.download",
				Method: "ACTIONRESPONSE",
				Attributes: map[string]interface{}{
					"content":     "!btoa(subject.public_key_pem)",
					"name":        "!subject.hostname + '.pem.key.pub'",
					"contentType": "application/x-x509-ca-cert",
					"message":     "!'Public Key for ' + subject.hostname",
				},
			},
		},
	},
	{
		Name:             "generate_acme_certificate",
		Label:            "Generate ACME certificate",
		OnType:           "certificate",
		InstanceOptional: false,
		InFields: []api2go.ColumnInfo{
			{
				Name:       "email",
				ColumnType: "label",
				ColumnName: "email",
			},
		},
		OutFields: []actionresponse.Outcome{
			{
				Type:   "acme.tls.generate",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"email":       "~email",
					"certificate": "~subject",
				},
			},
		},
	},
	{
		Name:             "generate_self_certificate",
		Label:            "Generate Self certificate",
		OnType:           "certificate",
		InstanceOptional: false,
		InFields:         []api2go.ColumnInfo{},
		OutFields: []actionresponse.Outcome{
			{
				Type:   "self.tls.generate",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"certificate": "~subject",
				},
			},
		},
	},
	{
		Name:             "register_otp",
		Label:            "Register Mobile Number",
		OnType:           USER_ACCOUNT_TABLE_NAME,
		InstanceOptional: false,
		InFields: []api2go.ColumnInfo{
			{
				Name:       "mobile_number",
				ColumnName: "mobile_number",
				ColumnType: "label",
			},
		},
		OutFields: []actionresponse.Outcome{
			{
				Type:      "otp.generate",
				Method:    "EXECUTE",
				Reference: "otp",
				Attributes: map[string]interface{}{
					"email":  "$.email",
					"mobile": "~mobile_number",
				},
			},
		},
	},
	{
		Name:             "verify_mobile_number",
		Label:            "Verify Mobile Number",
		OnType:           "user_otp_account",
		InstanceOptional: true,
		InFields: []api2go.ColumnInfo{
			{
				Name:       "mobile_number",
				ColumnName: "mobile_number",
				ColumnType: "label",
			},
			{
				Name:       "email",
				ColumnName: "email",
				ColumnType: "label",
			},
			{
				Name:       "otp",
				ColumnName: "otp",
				ColumnType: "label",
			},
		},
		OutFields: []actionresponse.Outcome{
			{
				Type:   "otp.login.verify",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"otp":    "~otp",
					"mobile": "~mobile_number",
					"email":  "~email",
				},
			},
		},
	},
	{
		Name:             "send_otp",
		Label:            "Send OTP to mobile",
		OnType:           "user_otp_account",
		InstanceOptional: true,
		InFields: []api2go.ColumnInfo{
			{
				Name:       "mobile_number",
				ColumnName: "mobile_number",
				ColumnType: "label",
			},
			{
				Name:       "email",
				ColumnName: "email",
				ColumnType: "label",
			},
		},
		OutFields: []actionresponse.Outcome{
			{
				Type:      "otp.generate",
				Method:    "EXECUTE",
				Reference: "otp",
				Attributes: map[string]interface{}{
					"email":  "~email",
					"mobile": "~mobile_number",
				},
			},
		},
	},
	{
		Name:             "verify_otp",
		Label:            "Login with OTP",
		OnType:           "user_account",
		InstanceOptional: true,
		InFields: []api2go.ColumnInfo{
			{
				Name:       "otp",
				ColumnName: "otp",
				ColumnType: "label",
			},
			{
				Name:       "mobile_number",
				ColumnName: "mobile_number",
				ColumnType: "label",
			},
			{
				Name:       "email",
				ColumnName: "email",
				ColumnType: "label",
			},
		},
		OutFields: []actionresponse.Outcome{
			{
				Type:   "otp.login.verify",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"otp":    "~otp",
					"mobile": "~mobile_number",
					"email":  "~email",
				},
			},
		},
	},
	{
		Name:             "remove_column",
		Label:            "Delete column",
		OnType:           "world",
		InstanceOptional: false,
		InFields: []api2go.ColumnInfo{
			{
				Name:       "column_name",
				ColumnName: "column_name",
				ColumnType: "label",
			},
		},
		OutFields: []actionresponse.Outcome{
			{
				Type:   "world.column.delete",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"world_id":    "$.reference_id",
					"column_name": "~column_name",
				},
			},
		},
	},
	{
		Name:             "remove_table",
		Label:            "Delete table",
		OnType:           "world",
		InstanceOptional: false,
		InFields:         []api2go.ColumnInfo{},
		OutFields: []actionresponse.Outcome{
			{
				Type:   "world.delete",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"world_id": "$.reference_id",
				},
			},
		},
	},
	{
		Name:             "rename_column",
		Label:            "Rename column",
		OnType:           "world",
		InstanceOptional: true,
		InFields: []api2go.ColumnInfo{
			{
				Name:       "table_name",
				ColumnName: "table_name",
				ColumnType: "label",
			},
			{
				Name:       "column_name",
				ColumnName: "column_name",
				ColumnType: "label",
			},
			{
				Name:       "new_column_name",
				ColumnName: "new_column_name",
				ColumnType: "label",
			},
		},
		OutFields: []actionresponse.Outcome{
			{
				Type:   "world.column.rename",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"world_name":      "~table_name",
					"column_name":     "~column_name",
					"new_column_name": "~new_column_name",
				},
			},
		},
	},
	{
		Name:             "sync_site_storage",
		Label:            "Sync site storage",
		OnType:           "site",
		InstanceOptional: false,
		InFields: []api2go.ColumnInfo{
			{
				Name:       "Path",
				ColumnName: "path",
				ColumnType: "label",
			},
		},
		OutFields: []actionresponse.Outcome{
			{
				Type:   "site.storage.sync",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"cloud_store_id": "$.cloud_store_id",
					"site_id":        "$.reference_id",
					"path":           "~path",
				},
			},
		},
	},
	{
		Name:             "sync_column_storage",
		Label:            "Sync column storage",
		OnType:           "world",
		InstanceOptional: true,
		InFields: []api2go.ColumnInfo{
			{
				Name:       "Table name",
				ColumnName: "table_name",
				ColumnType: "label",
			},
			{
				Name:       "Column name",
				ColumnName: "column_name",
				ColumnType: "label",
			},
			{
				Name:       "Credential name",
				ColumnName: "credential_name",
				ColumnType: "label",
			},
		},
		OutFields: []actionresponse.Outcome{
			{
				Type:   "column.storage.sync",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"column_name":     "~column_name",
					"credential_name": "~credential_name",
					"table_name":      "~table_name",
				},
			},
		},
	},
	{
		Name:             "sync_mail_servers",
		Label:            "Sync Mail Servers",
		OnType:           "mail_server",
		InstanceOptional: true,
		InFields:         []api2go.ColumnInfo{},
		OutFields: []actionresponse.Outcome{
			{
				Type:       "mail.servers.sync",
				Method:     "EXECUTE",
				Attributes: map[string]interface{}{},
			},
		},
	},
	{
		Name:             "status",
		Label:            "Mailbox Status",
		OnType:           "mail_box",
		InstanceOptional: true,
		InFields: []api2go.ColumnInfo{
			{
				Name:       "mail_account_id",
				ColumnName: "mail_account_id",
				ColumnType: "label",
				IsNullable: true,
			},
			{
				Name:       "mail_box_id",
				ColumnName: "mail_box_id",
				ColumnType: "label",
				IsNullable: true,
			},
			{
				Name:         "page_size",
				ColumnName:   "page_size",
				ColumnType:   "value",
				DefaultValue: "50",
				IsNullable:   true,
			},
			{
				Name:         "page_number",
				ColumnName:   "page_number",
				ColumnType:   "value",
				DefaultValue: "1",
				IsNullable:   true,
			},
		},
		OutFields: []actionresponse.Outcome{
			{
				Type:   "mail_box.status",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"mail_account_id": "~mail_account_id",
					"mail_box_id":     "~mail_box_id",
					"page_size":       "~page_size",
					"page_number":     "~page_number",
				},
			},
		},
	},
	{
		Name:             "process_outbox",
		Label:            "Process Outbox Queue",
		OnType:           "outbox",
		InstanceOptional: true,
		InFields:         []api2go.ColumnInfo{},
		OutFields: []actionresponse.Outcome{
			{
				Type:       "outbox.process",
				Method:     "EXECUTE",
				Attributes: map[string]interface{}{},
			},
		},
	},
	{
		Name:             "restart_daptin",
		Label:            "Restart system",
		OnType:           "world",
		InstanceOptional: true,
		InFields:         []api2go.ColumnInfo{},
		OutFields: []actionresponse.Outcome{
			{
				Type:   "system_json_schema_update",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"json_schema": "!JSON.parse('[{\"name\":\"empty.json\",\"file\":\"data:application/json;base64,e30K\",\"type\":\"application/json\"}]')",
				},
			},
		},
	},
	{
		Name:             "generate_random_data",
		Label:            "Generate random data",
		OnType:           "world",
		InstanceOptional: true,
		InFields: []api2go.ColumnInfo{
			{
				Name:       "Number of records",
				ColumnName: "count",
				ColumnType: "measurement",
			},
			{
				Name:       "Table name",
				ColumnName: "table_name",
				ColumnType: "label",
			},
		},
		OutFields: []actionresponse.Outcome{
			{
				Type:   "generate.random.data",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"count":             "~count",
					"table_name":        "~table_name",
					"user_reference_id": "$user.reference_id",
					"user_account_id":   "$user.id",
				},
			},
		},
		Validations: []columns.ColumnTag{
			{
				ColumnName: "count",
				Tags:       "gt=0",
			},
		},
	},
	{
		Name:             "export_data",
		Label:            "Export data for backup",
		OnType:           "world",
		InstanceOptional: true,
		InFields: []api2go.ColumnInfo{
			{
				ColumnName: "table_name",
				Name:       "table_name",
				ColumnType: "label",
			},
			{
				ColumnName:   "format",
				Name:         "format",
				ColumnType:   "label",
				DefaultValue: "json",
			},
			{
				ColumnName: "columns",
				Name:       "columns",
				ColumnType: "label",
			},
			{
				ColumnName: "include_headers",
				Name:       "include_headers",
				ColumnType: "truefalse",
			},
		},
		OutFields: []actionresponse.Outcome{
			{
				Type:   "__data_export",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"table_name":      "~table_name",
					"format":          "~format",
					"include_headers": "~include_headers",
					"columns":         "~columns",
				},
			},
		},
	},
	{
		Name:             "export_csv_data",
		Label:            "Export CSV data",
		OnType:           "world",
		InstanceOptional: true,
		InFields: []api2go.ColumnInfo{
			{
				ColumnName: "table_name",
				Name:       "table_name",
				ColumnType: "label",
			},
		},
		OutFields: []actionresponse.Outcome{
			{
				Type:   "__csv_data_export",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"table_name": "~table_name",
				},
			},
		},
	},
	{
		Name:             "import_data",
		Label:            "Import data from dump",
		OnType:           "world",
		InstanceOptional: false,
		InFields: []api2go.ColumnInfo{
			{
				Name:       "Import file",
				ColumnName: "dump_file",
				ColumnType: "file.json|yaml|toml|hcl|csv|docx|xlsx|pdf|html",
				IsNullable: false,
			},
			{
				Name:       "truncate_before_insert",
				ColumnName: "truncate_before_insert",
				ColumnType: "truefalse",
			},
			{
				Name:       "batch_size",
				ColumnName: "batch_size",
				ColumnType: "measurement",
			},
		},
		OutFields: []actionresponse.Outcome{
			{
				Type:   "__data_import",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"world_reference_id":     "$.reference_id",
					"truncate_before_insert": "~truncate_before_insert",
					"dump_file":              "~dump_file",
					"table_name":             "$.table_name",
					"batch_size":             "~batch_size",
					"user":                   "~user",
				},
			},
		},
	},
	{
		Name:             "upload_file",
		Label:            "Upload file to external store",
		OnType:           "cloud_store",
		InstanceOptional: false,
		InFields: []api2go.ColumnInfo{
			{
				Name:       "File",
				ColumnName: "file",
				ColumnType: "file.*",
				IsNullable: false,
			},
			{
				Name:         "Path",
				ColumnName:   "path",
				ColumnType:   "label",
				IsNullable:   true,
				DefaultValue: "",
			},
		},
		OutFields: []actionresponse.Outcome{
			{
				Type:   "cloudstore.file.upload",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"file":            "~file",
					"credential_name": "$.credential_name",
					"store_provider":  "$.store_provider",
					"path":            "~path",
					"root_path":       "$.root_path",
				},
			},
		},
	},
	{
		Name:             "create_site",
		Label:            "Create new site on this store",
		OnType:           "cloud_store",
		InstanceOptional: false,
		InFields: []api2go.ColumnInfo{
			{
				Name:       "Site type",
				ColumnName: "site_type",
				ColumnType: "label",
				IsNullable: false,
			},
			{
				Name:         "Path",
				ColumnName:   "path",
				ColumnType:   "label",
				IsNullable:   false,
				DefaultValue: "",
			},
			{
				Name:       "Hostname",
				ColumnName: "hostname",
				ColumnType: "label",
				IsNullable: false,
			},
		},
		OutFields: []actionresponse.Outcome{
			{
				Type:   "cloudstore.site.create",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"credential_name": "$.credential_name",
					"store_provider":  "$.store_provider",
					"cloud_store_id":  "$.reference_id",
					"path":            "~path",
					"user_account_id": "$user.reference_id",
					"hostname":        "~hostname",
					"site_type":       "~site_type",
					"root_path":       "$.root_path",
				},
			},
		},
	},

	{
		Name:             "delete_path",
		Label:            "Delete path on a site",
		OnType:           "cloud_store",
		InstanceOptional: false,
		InFields: []api2go.ColumnInfo{
			{
				Name:         "Path",
				ColumnName:   "path",
				ColumnType:   "label",
				IsNullable:   true,
				DefaultValue: "",
			},
		},
		OutFields: []actionresponse.Outcome{
			{
				Type:   "site.file.delete",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"credential_name": "$.credential_name",
					"store_provider":  "$.store_provider",
					"path":            "~path",
					"root_path":       "$.root_path",
				},
			},
		},
	},

	{
		Name:             "create_folder",
		Label:            "Create folder on a cloud store",
		OnType:           "cloud_store",
		InstanceOptional: false,
		InFields: []api2go.ColumnInfo{
			{
				Name:         "Path",
				ColumnName:   "path",
				ColumnType:   "label",
				IsNullable:   true,
				DefaultValue: "",
			},
			{
				Name:       "Name",
				ColumnName: "name",
				ColumnType: "label",
				IsNullable: false,
			},
		},
		OutFields: []actionresponse.Outcome{
			{
				Type:   "cloudstore.folder.create",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"credential_name": "$.credential_name",
					"store_provider":  "$.store_provider",
					"path":            "~path",
					"name":            "~name",
					"root_path":       "$.root_path",
				},
			},
		},
	},

	{
		Name:             "move_path",
		Label:            "Create folder on a cloud store",
		OnType:           "cloud_store",
		InstanceOptional: false,
		InFields: []api2go.ColumnInfo{
			{
				Name:       "Source path",
				ColumnName: "source",
				ColumnType: "label",
			},
			{
				Name:       "Destination path",
				ColumnName: "destination",
				ColumnType: "label",
				IsNullable: false,
			},
		},
		OutFields: []actionresponse.Outcome{
			{
				Type:   "cloudstore.path.move",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"credential_name": "$.credential_name",
					"store_provider":  "$.store_provider",
					"source":          "~source",
					"destination":     "~destination",
					"root_path":       "$.root_path",
				},
			},
		},
	},
	{
		Name:             "list_files",
		Label:            "List files in the site path",
		OnType:           "site",
		InstanceOptional: false,
		InFields: []api2go.ColumnInfo{
			{
				Name:       "path",
				ColumnName: "path",
				ColumnType: "label",
				IsNullable: false,
			},
		},
		OutFields: []actionresponse.Outcome{
			{
				Type:   "site.file.list",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"site_id": "$.reference_id",
					"path":    "~path",
				},
			},
		},
	},

	{
		Name:             "get_file",
		Label:            "Get file at the path in site",
		OnType:           "site",
		InstanceOptional: false,
		InFields: []api2go.ColumnInfo{
			{
				Name:       "path",
				ColumnName: "path",
				ColumnType: "label",
				IsNullable: false,
			},
		},
		OutFields: []actionresponse.Outcome{
			{
				Type:   "site.file.get",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"site_id": "$.reference_id",
					"path":    "~path",
				},
			},
		},
	},
	{
		Name:             "delete_file",
		Label:            "Delete file in the site",
		OnType:           "site",
		InstanceOptional: false,
		InFields: []api2go.ColumnInfo{
			{
				Name:       "path",
				ColumnName: "path",
				ColumnType: "label",
				IsNullable: false,
			},
		},
		OutFields: []actionresponse.Outcome{
			{
				Type:   "site.file.delete",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"site_id": "$.reference_id",
					"path":    "~path",
				},
			},
		},
	},
	{
		Name:             "upload_system_schema",
		Label:            "Upload features",
		OnType:           "world",
		InstanceOptional: true,
		InFields: []api2go.ColumnInfo{
			{
				Name:       "Schema file",
				ColumnName: "schema_file",
				ColumnType: "file.json|yaml|toml|hcl",
				IsNullable: false,
			},
		},
		OutFields: []actionresponse.Outcome{
			{
				Type:   "system_json_schema_update",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"json_schema": "~schema_file",
				},
			},
		},
	},
	{
		Name:             "upload_xls_to_system_schema",
		Label:            "Upload xls to entity",
		OnType:           "world",
		InstanceOptional: true,
		InFields: []api2go.ColumnInfo{
			{
				Name:       "XLSX file",
				ColumnName: "data_xls_file",
				ColumnType: "file.xls|xlsx",
				IsNullable: false,
			},
			{
				Name:       "Entity name",
				ColumnName: "entity_name",
				ColumnType: "label",
				IsNullable: false,
			},
			{
				Name:       "Create entity if not exists",
				ColumnName: "create_if_not_exists",
				ColumnType: "truefalse",
				IsNullable: false,
			},
			{
				Name:       "Add missing columns",
				ColumnName: "add_missing_columns",
				ColumnType: "truefalse",
				IsNullable: false,
			},
		},
		Validations: []columns.ColumnTag{
			{
				ColumnName: "entity_name",
				Tags:       "required",
			},
		},
		OutFields: []actionresponse.Outcome{
			{
				Type:   "__upload_xlsx_file_to_entity",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"data_xls_file":        "~data_xls_file",
					"entity_name":          "~entity_name",
					"add_missing_columns":  "~add_missing_columns",
					"create_if_not_exists": "~create_if_not_exists",
				},
			},
		},
	},
	{
		Name:             "upload_csv_to_system_schema",
		Label:            "Upload CSV to entity",
		OnType:           "world",
		InstanceOptional: true,
		InFields: []api2go.ColumnInfo{
			{
				Name:       "CSV file",
				ColumnName: "data_csv_file",
				ColumnType: "file.csv",
				IsNullable: false,
			},
			{
				Name:       "Entity name",
				ColumnName: "entity_name",
				ColumnType: "label",
				IsNullable: false,
			},
			{
				Name:         "Create entity if not exists",
				ColumnName:   "create_if_not_exists",
				ColumnType:   "truefalse",
				DefaultValue: "false",
				IsNullable:   true,
			},
			{
				Name:         "Add missing columns",
				ColumnName:   "add_missing_columns",
				ColumnType:   "truefalse",
				DefaultValue: "false",
				IsNullable:   true,
			},
		},
		Validations: []columns.ColumnTag{
			{
				ColumnName: "entity_name",
				Tags:       "required",
			},
		},
		OutFields: []actionresponse.Outcome{
			{
				Type:   "__upload_csv_file_to_entity",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"data_csv_file":        "~data_csv_file",
					"entity_name":          "~entity_name",
					"add_missing_columns":  "~add_missing_columns",
					"create_if_not_exists": "~create_if_not_exists",
				},
			},
		},
	},
	{
		Name:             "download_system_schema",
		Label:            "Download system schema",
		OnType:           "world",
		InstanceOptional: true,
		InFields:         []api2go.ColumnInfo{},
		OutFields: []actionresponse.Outcome{
			{
				Type:       "__download_cms_config",
				Method:     "EXECUTE",
				Attributes: map[string]interface{}{},
			},
		},
	},
	{
		Name:             "publish_to_topic",
		Label:            "Publish message to topic",
		InstanceOptional: true,
		OnType:           "world",
		InFields: []api2go.ColumnInfo{
			{
				Name:       "topicName",
				ColumnName: "topicName",
				ColumnType: "label",
				IsNullable: false,
			},
			{
				Name:       "message",
				ColumnName: "message",
				ColumnType: "content",
				IsNullable: false,
			},
		},
		OutFields: []actionresponse.Outcome{
			{
				Type:   "__publish_to_topic",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"topicName": "~topicName",
					"message":   "~message",
				},
			},
		},
	},
	{
		Name:             "become_an_administrator",
		Label:            "Become Daptin Administrator",
		InstanceOptional: true,
		OnType:           "world",
		InFields:         []api2go.ColumnInfo{},
		OutFields: []actionresponse.Outcome{
			{
				Type:   "__become_admin",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"user_account_id": "$user.id",
					"user":            "~user",
				},
			},
		},
	},
	{
		Name:             "signup",
		Label:            "Sign up",
		InstanceOptional: true,
		OnType:           USER_ACCOUNT_TABLE_NAME,
		InFields: []api2go.ColumnInfo{
			{
				Name:       "name",
				ColumnName: "name",
				ColumnType: "label",
				IsNullable: false,
			},
			{
				Name:       "email",
				ColumnName: "email",
				ColumnType: "email",
				IsNullable: false,
			},
			{
				Name:       "mobile",
				ColumnName: "mobile",
				ColumnType: "label",
				IsNullable: true,
			},
			{
				Name:       "password",
				ColumnName: "password",
				ColumnType: "password",
				IsNullable: false,
			},
			{
				Name:       "Password Confirm",
				ColumnName: "passwordConfirm",
				ColumnType: "password",
				IsNullable: false,
			},
		},
		Validations: []columns.ColumnTag{
			{
				ColumnName: "email",
				Tags:       "email",
			},
			{
				ColumnName: "name",
				Tags:       "required",
			},
			{
				ColumnName: "password",
				Tags:       "eqfield=InnerStructField[passwordConfirm],min=8",
			},
		},
		Conformations: []columns.ColumnTag{
			{
				ColumnName: "email",
				Tags:       "email",
			},
			{
				ColumnName: "name",
				Tags:       "trim",
			},
			{
				ColumnName: "mobile",
				Tags:       "trim",
			},
		},
		OutFields: []actionresponse.Outcome{
			{
				Type:           USER_ACCOUNT_TABLE_NAME,
				Method:         "POST",
				Reference:      "user",
				SkipInResponse: true,
				Attributes: map[string]interface{}{
					"name":      "~name",
					"email":     "~email",
					"password":  "~password",
					"confirmed": "0",
				},
			},
			{
				Type:           "otp.generate",
				Method:         "EXECUTE",
				Reference:      "otp",
				SkipInResponse: true,
				Condition:      "!mobile != null && mobile != undefined && mobile != ''",
				Attributes: map[string]interface{}{
					"mobile": "~mobile",
					"email":  "~email",
				},
			},
			{
				Type:   "client.notify",
				Method: "ACTIONRESPONSE",
				Attributes: map[string]interface{}{
					"type":    "success",
					"title":   "Success",
					"message": "Sign-up successful. Redirecting to sign in",
				},
			},
			{
				Type:   "client.redirect",
				Method: "ACTIONRESPONSE",
				Attributes: map[string]interface{}{
					"location": "/auth/signin",
					"window":   "self",
					"delay":    2000,
				},
			},
		},
	},
	{
		Name:             "reset-password",
		Label:            "Reset password",
		InstanceOptional: true,
		OnType:           USER_ACCOUNT_TABLE_NAME,
		InFields: []api2go.ColumnInfo{
			{
				Name:       "email",
				ColumnName: "email",
				ColumnType: "email",
				IsNullable: false,
			},
		},
		Validations: []columns.ColumnTag{
			{
				ColumnName: "email",
				Tags:       "email",
			},
		},
		Conformations: []columns.ColumnTag{
			{
				ColumnName: "email",
				Tags:       "email",
			},
		},
		OutFields: []actionresponse.Outcome{
			{
				Type:           USER_ACCOUNT_TABLE_NAME,
				Method:         "GET",
				Reference:      "user",
				SkipInResponse: true,
				Attributes: map[string]interface{}{
					"query": "[{\"column\": \"email\", \"operator\": \"is\", \"value\": \"$email\"}]",
				},
			},
			{
				Type:           "otp.generate",
				Method:         "EXECUTE",
				Reference:      "otp",
				SkipInResponse: true,
				Attributes: map[string]interface{}{
					"email": "$email",
				},
			},
			{
				Type:           "mail.send",
				Method:         "EXECUTE",
				SkipInResponse: true,
				Attributes: map[string]interface{}{
					"to":               "~email",
					"subject":          "Request for password reset",
					"body":             "Your verification code is: $otp.otp",
					"from":             "no-reply@localhost",
					"send_immediately": true,
				},
			},
		},
	},
	{
		Name:             "reset-password-verify",
		Label:            "Reset password verify code",
		InstanceOptional: true,
		OnType:           USER_ACCOUNT_TABLE_NAME,
		InFields: []api2go.ColumnInfo{
			{
				Name:       "email",
				ColumnName: "email",
				ColumnType: "email",
				IsNullable: false,
			}, {
				Name:       "otp",
				ColumnName: "otp",
				ColumnType: "value",
				IsNullable: false,
			},
		},
		Validations: []columns.ColumnTag{
			{
				ColumnName: "email",
				Tags:       "email",
			},
		},
		Conformations: []columns.ColumnTag{
			{
				ColumnName: "email",
				Tags:       "email",
			},
		},
		OutFields: []actionresponse.Outcome{
			{
				Type:           USER_ACCOUNT_TABLE_NAME,
				Method:         "GET",
				Reference:      "user",
				SkipInResponse: true,
				Attributes: map[string]interface{}{
					"query": "[{\"column\": \"email\", \"operator\": \"is\", \"value\": \"$email\"}]",
				},
			},
			{
				Type:   "otp.login.verify",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"otp":   "~otp",
					"email": "~email",
				},
			},
			{
				Type:           "random.generate",
				Method:         "EXECUTE",
				Reference:      "newPassword",
				SkipInResponse: true,
				Attributes: map[string]interface{}{
					"type": "password",
				},
			},
			{
				Type:           USER_ACCOUNT_TABLE_NAME,
				SkipInResponse: true,
				Method:         "PATCH",
				Attributes: map[string]interface{}{
					"reference_id": "$user[0].reference_id",
					"password":     "!newPassword.value",
				},
			},
			{
				Type:           "mail.send",
				Method:         "EXECUTE",
				SkipInResponse: true,
				Attributes: map[string]interface{}{
					"to":               "~email",
					"subject":          "Request for password reset",
					"body":             "Your new password is: $newPassword.value",
					"from":             "no-reply@localhost",
					"send_immediately": true,
				},
			},
		},
	},
	{
		Name:             "signin",
		Label:            "Sign in",
		InstanceOptional: true,
		OnType:           USER_ACCOUNT_TABLE_NAME,
		InFields: []api2go.ColumnInfo{
			{
				Name:       "email",
				ColumnName: "email",
				ColumnType: "email",
				IsNullable: false,
			},
			{
				Name:       "password",
				ColumnName: "password",
				ColumnType: "password",
				IsNullable: false,
			},
		},
		OutFields: []actionresponse.Outcome{
			{
				Type:   "jwt.token",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"email":    "~email",
					"password": "~password",
				},
			},
		},
	},
	{
		Name:     "oauth_login_begin",
		Label:    "Authenticate via OAuth",
		OnType:   "oauth_connect",
		InFields: []api2go.ColumnInfo{},
		OutFields: []actionresponse.Outcome{
			{
				Type:   "oauth.client.redirect",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"authenticator": "$.name",
					"scope":         "$.scope",
				},
			},
		},
	},
	{
		Name:             "oauth.login.response",
		Label:            "Handle OAuth login response code and state",
		InstanceOptional: true,
		OnType:           "oauth_token",
		InFields: []api2go.ColumnInfo{
			{
				Name:       "code",
				ColumnName: "code",
				ColumnType: "hidden",
				IsNullable: false,
			},
			{
				Name:       "state",
				ColumnName: "state",
				ColumnType: "hidden",
				IsNullable: false,
			},
			{
				Name:       "authenticator",
				ColumnName: "authenticator",
				ColumnType: "hidden",
				IsNullable: false,
			},
		},
		OutFields: []actionresponse.Outcome{
			{
				Type:           "oauth_connect",
				Method:         "GET",
				SkipInResponse: true,
				Reference:      "connection",
				Attributes: map[string]interface{}{
					"filter":       "~authenticator",
					"page[number]": "1",
					"page[size]":   "1",
				},
			},
			{
				Type:           "oauth.login.response",
				Method:         "EXECUTE",
				SkipInResponse: false,
				Reference:      "auth",
				Attributes: map[string]interface{}{
					"authenticator":     "~authenticator",
					"user_account_id":   "~user.id",
					"user_reference_id": "~user.reference_id",
					"state":             "~state",
					"code":              "~code",
				},
			},
			{
				Type:           "oauth.profile.exchange",
				Method:         "EXECUTE",
				Reference:      "profile",
				SkipInResponse: true,
				Condition:      "$connection[0].allow_login",
				Attributes: map[string]interface{}{
					"authenticator": "~authenticator",
					"token":         "$auth.access_token",
					"tokenInfoUrl":  "$connection[0].token_url",
					"profileUrl":    "$connection[0].profile_url",
				},
			},
			{
				Type:           USER_ACCOUNT_TABLE_NAME,
				Method:         "GET",
				Reference:      "user",
				SkipInResponse: true,
				Condition:      "$connection[0].allow_login",
				Attributes: map[string]interface{}{
					"filter": "!profile.email || profile.emailAddress",
				},
			},
			{
				Type:           USER_ACCOUNT_TABLE_NAME,
				Method:         "POST",
				Reference:      "user",
				SkipInResponse: true,
				Condition:      "!!user || (!user.length && !user.reference_id)",
				Attributes: map[string]interface{}{
					"email":    "!profile.email || profile.emailAddress",
					"name":     "!profile.displayName || profile.name || profile.email || profile.emailAddress || profile.sub || profile.id",
					"password": "!profile.id || profile.sub || profile.email || profile.emailAddress",
				},
			},
			{
				Type:           "usergroup",
				Method:         "POST",
				Reference:      "usergroup",
				SkipInResponse: true,
				Condition:      "!!user || (!user.length && !user.reference_id)",
				Attributes: map[string]interface{}{
					"name": "!'Home group for ' + ((profile.emails && profile.emails[0] && profile.emails[0].value) || profile.email || profile.emailAddress || profile.sub || profile.id)",
				},
			},
			{
				Type:           "user_account_user_account_id_has_usergroup_usergroup_id",
				Method:         "POST",
				SkipInResponse: true,
				Condition:      "!!user || (!user.length && !user.reference_id)",
				Attributes: map[string]interface{}{
					"user_account_id": "$user.reference_id",
					"usergroup_id":    "$usergroup.reference_id",
				},
			},
			{
				Type:      "jwt.token",
				Method:    "EXECUTE",
				Condition: "$connection[0].allow_login",
				Attributes: map[string]interface{}{
					"email":             "!profile.email || profile.emailAddress",
					"skipPasswordCheck": true,
				},
			},
			{
				Type:      "client.redirect",
				Method:    "ACTIONRESPONSE",
				Condition: "$connection[0].allow_login",
				Attributes: map[string]interface{}{
					"location": "/",
					"window":   "self",
					"delay":    2000,
				},
			},
		},
	},
	{
		Name:             "get_token",
		Label:            "Get decrypted OAuth token",
		OnType:           "oauth_token",
		InstanceOptional: false,
		InFields:         []api2go.ColumnInfo{},
		OutFields: []actionresponse.Outcome{
			{
				Type:   "oauth.token",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"reference_id": "$.reference_id",
				},
			},
		},
	},
	{
		Name:             "register_client",
		Label:            "Register OAuth client",
		InstanceOptional: true,
		OnType:           "oauth_app",
		InFields: []api2go.ColumnInfo{
			{Name: "name", ColumnName: "name", ColumnType: "label", IsNullable: false},
			{Name: "redirect_uris", ColumnName: "redirect_uris", ColumnType: "content", IsNullable: false},
			{Name: "scopes", ColumnName: "scopes", ColumnType: "content", IsNullable: true},
			{Name: "grants", ColumnName: "grants", ColumnType: "label", IsNullable: true},
			{Name: "is_confidential", ColumnName: "is_confidential", ColumnType: "truefalse", IsNullable: true},
		},
		OutFields: []actionresponse.Outcome{
			{
				Type:   "oauth.client.register",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"request_attributes": "~attributes",
					"user":               "~user",
				},
			},
		},
	},
	{
		Name:             "update_client",
		Label:            "Update OAuth client",
		InstanceOptional: false,
		OnType:           "oauth_app",
		InFields: []api2go.ColumnInfo{
			{Name: "name", ColumnName: "name", ColumnType: "label", IsNullable: true},
			{Name: "redirect_uris", ColumnName: "redirect_uris", ColumnType: "content", IsNullable: true},
			{Name: "scopes", ColumnName: "scopes", ColumnType: "content", IsNullable: true},
			{Name: "grants", ColumnName: "grants", ColumnType: "label", IsNullable: true},
			{Name: "is_confidential", ColumnName: "is_confidential", ColumnType: "truefalse", IsNullable: true},
		},
		OutFields: []actionresponse.Outcome{
			{
				Type:   "oauth.client.update",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"request_attributes": "~attributes",
					"subject":            "~subject",
					"user":               "~user",
				},
			},
		},
	},
	{
		Name:             "rotate_client_secret",
		Label:            "Rotate OAuth client secret",
		InstanceOptional: false,
		OnType:           "oauth_app",
		InFields:         []api2go.ColumnInfo{},
		OutFields: []actionresponse.Outcome{
			{
				Type:   "oauth.client.rotate_secret",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"subject": "~subject",
					"user":    "~user",
				},
			},
		},
	},
	{
		Name:             "disable_client",
		Label:            "Disable OAuth client",
		InstanceOptional: false,
		OnType:           "oauth_app",
		InFields:         []api2go.ColumnInfo{},
		OutFields: []actionresponse.Outcome{
			{
				Type:   "oauth.client.disable",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"subject": "~subject",
					"user":    "~user",
				},
			},
		},
	},
	{
		Name:             "enable_client",
		Label:            "Enable OAuth client",
		InstanceOptional: false,
		OnType:           "oauth_app",
		InFields:         []api2go.ColumnInfo{},
		OutFields: []actionresponse.Outcome{
			{
				Type:   "oauth.client.enable",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"subject": "~subject",
					"user":    "~user",
				},
			},
		},
	},
	{
		Name:             "revoke_client_tokens",
		Label:            "Revoke OAuth client tokens",
		InstanceOptional: false,
		OnType:           "oauth_app",
		InFields:         []api2go.ColumnInfo{},
		OutFields: []actionresponse.Outcome{
			{
				Type:   "oauth.client.revoke_tokens",
				Method: "EXECUTE",
				Attributes: map[string]interface{}{
					"subject": "~subject",
					"user":    "~user",
				},
			},
		},
	},
	{
		Name:             "add_exchange",
		Label:            "Add new data exchange",
		OnType:           "world",
		InstanceOptional: false,
		InFields: []api2go.ColumnInfo{
			{
				Name:       "name",
				ColumnName: "name",
				ColumnType: "label",
				IsNullable: false,
			},
			{
				Name:       "sheet_id",
				ColumnName: "sheet_id",
				ColumnType: "alias",
				IsNullable: false,
			},
			{
				Name:       "app_key Key",
				ColumnName: "app_key",
				ColumnType: "alias",
				IsNullable: false,
			},
		},
		OutFields: []actionresponse.Outcome{
			{
				Type:   "data_exchange",
				Method: "POST",
				Attributes: map[string]interface{}{
					"name":              "!'Export ' + subject.table_name + ' to excel sheet'",
					"source_attributes": "!JSON.stringify({name: subject.table_name})",
					"source_type":       "self",
					"target_type":       "gsheet-append",
					"options":           "!JSON.stringify({hasHeader: true})",
					"attributes":        "!JSON.stringify([{SourceColumn: '$self.description', TargetColumn: 'Task description'}])",
					"target_attributes": "!JSON.stringify({sheetUrl: 'https://content-sheets.googleapis.com/v4/spreadsheets/' + sheet_id + '/values/A1:append', appKey: app_key})",
				},
			},
		},
	},
}
View Source
var SystemExchanges []ExchangeContract
View Source
var ValidatorInstance = validator.New()

Functions

func AESGCMDecrypt added in v0.11.4

func AESGCMDecrypt(key, nonce, ciphertext []byte) (plaintext []byte, err error)

AES-GCM decryption

func AESGCMEncrypt added in v0.11.4

func AESGCMEncrypt(key, plaintext []byte) (ciphertext, nonce []byte, err error)

AES-GCM encryption

func ActionFromActionRow added in v0.10.0

func ActionFromActionRow(actionRow ActionRow) (actionresponse.Action, error)

func AsStringOrEmpty added in v0.9.0

func AsStringOrEmpty(i interface{}) string

func Atob added in v0.11.4

func Atob(data string) string

Base64 decoding (similar to Atob in JavaScript)

func Base64Decode added in v0.11.4

func Base64Decode(data string) []byte

Base64 standard decoding function

func Base64Encode added in v0.11.4

func Base64Encode(data []byte) string

Base64 standard encoding function

func BcryptCheckStringHash

func BcryptCheckStringHash(newString, hash string) bool

func BcryptHashString

func BcryptHashString(password string) (string, error)

func BeginsWith added in v0.6.2

func BeginsWith(longerString string, smallerString string) bool

func BeginsWithCheck added in v0.11.4

func BeginsWithCheck(str string, beginsWith string) bool

func Btoa added in v0.11.4

func Btoa(data []byte) string

Base64 encoding (similar to Btoa in JavaScript)

func BuildActionContext added in v0.9.9

func BuildActionContext(outcomeAttributes interface{}, inFieldMap map[string]interface{}) (interface{}, error)

func BuildActionRequest added in v0.6.9

func BuildActionRequest(closer io.ReadCloser, actionType, actionName string,
	params gin.Params, queryParams url.Values) (actionresponse.ActionRequest, error)

func BuildOutcome

func BuildOutcome(inFieldMap map[string]interface{},
	outcome actionresponse.Outcome, sessionUser *auth.SessionUser) (*api2go.Api2GoModel,
	api2go.Request, error)

func BuildSMTPServerConfigs added in v0.12.19

func BuildSMTPServerConfigs(servers []map[string]interface{}, certificateManager *CertificateManager, transaction *sqlx.Tx) ([]guerrilla.ServerConfig, []string, error)

func BuildWhereClause added in v0.9.9

func BuildWhereClause(functionName string, leftVal string, rightVal interface{}) (goqu.Expression, error)

func CheckAllTableStatus

func CheckAllTableStatus(initConfig *CmsConfig, db database.DatabaseConnection)

func CheckAuditTables added in v0.2.1

func CheckAuditTables(config *CmsConfig)

func CheckErr

func CheckErr(err error, message ...interface{}) bool

func CheckInfo added in v0.6.2

func CheckInfo(err error, message ...interface{}) bool

func CheckRelations

func CheckRelations(config *CmsConfig)

func CheckTable

func CheckTable(tableInfo *table_info.TableInfo, db database.DatabaseConnection) error

func CheckTranslationTables added in v0.9.0

func CheckTranslationTables(config *CmsConfig)

func ColumnToInterfaceArray added in v0.9.9

func ColumnToInterfaceArray(s []column) []interface{}

func CreateAMapOfColumnsWeWantInTheFinalTable

func CreateAMapOfColumnsWeWantInTheFinalTable(tableInfo *table_info.TableInfo) (map[string]bool, map[string]api2go.ColumnInfo)

func CreateDefaultLocalStorage added in v0.9.2

func CreateDefaultLocalStorage(transaction *sqlx.Tx, localStoragePath string) error

func CreateGuestActionListHandler

func CreateGuestActionListHandler(initConfig *CmsConfig) func(*gin.Context)

func CreateIndexes

func CreateIndexes(initConfig *CmsConfig, db database.DatabaseConnection)

func CreateNewPublicPrivateKeyPEMBytes added in v0.9.10

func CreateNewPublicPrivateKeyPEMBytes() ([]byte, []byte, *rsa.PrivateKey, error)

func CreatePostActionHandler

func CreatePostActionHandler(initConfig *CmsConfig,
	cruds map[string]*DbResource, actionPerformers []actionresponse.ActionPerformerInterface) func(*gin.Context)

func CreateRelations

func CreateRelations(initConfig *CmsConfig, db database.DatabaseConnection)

func CreateTable

func CreateTable(tableInfo *table_info.TableInfo, db database.DatabaseConnection) error

func CreateUniqueConstraints

func CreateUniqueConstraints(initConfig *CmsConfig, db *sqlx.Tx)

func Decrypt

func Decrypt(key []byte, cryptoText string) (string, error)

Decrypt from base64 to decrypted string

func DeleteActionHandlerOnAll added in v0.12.12

func DeleteActionHandlerOnAll(cruds map[string]*DbResource, name string)

func ECDSASign added in v0.11.4

func ECDSASign(privKey *ecdsa.PrivateKey, data []byte) (r, s []byte, err error)

ECDSA signing

func ECDSAVerify added in v0.11.4

func ECDSAVerify(pubKey *ecdsa.PublicKey, data, r, s []byte) bool

ECDSA verification

func Encrypt

func Encrypt(key []byte, text string) (string, error)

Encrypt string to base64 crypto using AES

func EndsWith added in v0.9.0

func EndsWith(str string, endsWith string) (string, bool)

func EndsWithCheck added in v0.2.1

func EndsWithCheck(str string, endsWith string) bool

func EvaluateMeteringCost added in v0.11.7

func EvaluateMeteringCost(expr string, env map[string]interface{}) (int64, error)

func EvaluateString added in v0.11.4

func EvaluateString(fieldString string, inFieldMap map[string]interface{}) (interface{}, error)

func FromJson added in v0.11.4

func FromJson(data []byte) interface{}

Base64 encoding (similar to Btoa in JavaScript)

func GenerateCertPEMWithKey added in v0.9.0

func GenerateCertPEMWithKey(hostname string, privateKey *rsa.PrivateKey) ([]byte, error)

func GetActionHandler added in v0.12.12

func GetActionHandler(dbResource *DbResource, name string) (actionresponse.ActionPerformerInterface, bool)

func GetActionMapByTypeName

func GetActionMapByTypeName(transaction *sqlx.Tx) (map[string]map[string]interface{}, error)

func GetAdminReferenceIdWithTransaction added in v0.9.9

func GetAdminReferenceIdWithTransaction(transaction *sqlx.Tx) map[uuid.UUID]bool

func GetAdminUserIdAndUserGroupId

func GetAdminUserIdAndUserGroupId(db *sqlx.Tx) (int64, int64)

func GetDataArray added in v0.2.1

func GetDataArray(sheet *xlsx.Sheet) (dataMap []map[string]interface{}, columnNames []string, err error)

func GetExistingIndexes added in v0.9.9

func GetExistingIndexes(db *sqlx.Tx) map[string]bool

func GetGlobalActionHandler added in v0.12.12

func GetGlobalActionHandler(name string) (actionresponse.ActionPerformerInterface, bool)

func GetIdToReferenceIdWithTransaction added in v0.9.9

func GetIdToReferenceIdWithTransaction(typeName string, id int64, transaction *sqlx.Tx) (daptinid.DaptinReferenceId, error)

GetIdToReferenceIdWithTransaction Looks up an integer id and return a string reference id of an object of type `typeName`

func GetJoins added in v0.9.9

func GetJoins(rel api2go.TableRelation) []join

func GetMD5Hash

func GetMD5Hash(text []byte) string

func GetMD5HashString added in v0.9.9

func GetMD5HashString(text string) string

func GetObjectByWhereClauseWithTransaction added in v0.9.9

func GetObjectByWhereClauseWithTransaction(objType string, transaction *sqlx.Tx, queries ...goqu.Ex) ([]map[string]interface{}, error)

func GetObjectGroupsByObjectIdWithTransaction added in v0.9.9

func GetObjectGroupsByObjectIdWithTransaction(objectType string, objectId int64, transaction *sqlx.Tx) auth.GroupPermissionList

func GetObjectPermissionByReferenceIdWithTransaction added in v0.9.9

func GetObjectPermissionByReferenceIdWithTransaction(objectType string, referenceId daptinid.DaptinReferenceId, transaction *sqlx.Tx) permission.PermissionInstance

GetObjectPermissionByReferenceId Gets permission of an Object by typeName and string referenceId Loads the owner, usergroup and guest permission of the action from the database Return a PermissionInstance Return a NoPermissionToAnyone if no such object exist

func GetReferenceIdByWhereClauseWithTransaction added in v0.9.9

func GetReferenceIdByWhereClauseWithTransaction(typeName string, transaction *sqlx.Tx, queries ...goqu.Ex) ([]daptinid.DaptinReferenceId, error)

Load rows from the database of `typeName` with a where clause to filter rows Converts the queries to sql and run query with where clause Returns list of reference_ids

func GetReferenceIdListToIdListWithTransaction added in v0.9.9

func GetReferenceIdListToIdListWithTransaction(typeName string, referenceId []daptinid.DaptinReferenceId,
	transaction *sqlx.Tx) (map[daptinid.DaptinReferenceId]int64, error)

Lookup an string reference id and return a internal integer id of an object of type `typeName`

func GetReferenceIdToIdWithTransaction added in v0.9.9

func GetReferenceIdToIdWithTransaction(typeName string, referenceId daptinid.DaptinReferenceId, updateTransaction *sqlx.Tx) (int64, error)

GetReferenceIdToIdWithTransaction Looks up a string reference id and return an internal integer id of an object of type `typeName`

func GetReverseJoins added in v0.9.9

func GetReverseJoins(rel api2go.TableRelation) []join

func GetSingleColumnValueByReferenceIdWithTransaction added in v0.9.9

func GetSingleColumnValueByReferenceIdWithTransaction(
	typeName string, selectColumn []interface{}, matchColumn string, values []string, transaction *sqlx.Tx) ([]interface{}, error)

GetSingleColumnValueByReferenceId select "column" from "typeName" where matchColumn in (values) returns list of values of the column

func GetTasks added in v0.6.9

func GetTasks(connection *sqlx.Tx) ([]task.Task, error)

func GetTotalCountBySelectBuilderWithTransaction added in v0.9.9

func GetTotalCountBySelectBuilderWithTransaction(builder *goqu.SelectDataset, transaction *sqlx.Tx) (uint64, error)

func GetUserMembersByGroupNameWithTransaction added in v0.9.9

func GetUserMembersByGroupNameWithTransaction(groupName string, transaction *sqlx.Tx) []daptinid.DaptinReferenceId

func GetValidatedInFields

func GetValidatedInFields(actionRequest actionresponse.ActionRequest, action actionresponse.Action) (map[string]interface{}, error)

func GetWorldTableMapBy

func GetWorldTableMapBy(col string, transaction *sqlx.Tx) (map[string]map[string]interface{}, error)

func GroupNamesToIds added in v0.6.4

func GroupNamesToIds(db database.DatabaseConnection, groupsName []string) ([]int64, error)

func HMACSHA256 added in v0.11.4

func HMACSHA256(key, data []byte) []byte

HMAC-SHA256 function

func HMACSHA512 added in v0.11.4

func HMACSHA512(key, data []byte) []byte

HMAC-SHA512 function

func HasAnyFlag added in v0.9.0

func HasAnyFlag(flags []string, flagToFind []string) bool

func HasFlag added in v0.9.0

func HasFlag(flags []string, flagToFind string) bool

func HexDecode added in v0.11.4

func HexDecode(data string) []byte

Hex decoding function

func HexEncode added in v0.11.4

func HexEncode(data []byte) string

Hex encoding function

func ImportDataFiles added in v0.2.1

func ImportDataFiles(imports []rootpojo.DataFileImport, transaction *sqlx.Tx, cruds map[string]*DbResource)

func ImportDataMapArray added in v0.6.2

func ImportDataMapArray(data []map[string]interface{}, crud *DbResource, req api2go.Request, transaction *sqlx.Tx) []error

func ImportDataStringArray added in v0.6.2

func ImportDataStringArray(data [][]string, headers []string, entityName string, crud *DbResource, req api2go.Request, transaction *sqlx.Tx) []error

func InArray added in v0.6.8

func InArray(val []interface{}, ar interface{}) (exists bool)

func InStringArray added in v0.9.9

func InStringArray(val []string, ar string) (exists bool)

func InfoErr added in v0.2.1

func InfoErr(err error, message ...interface{}) bool

func InitialiseColumnManager added in v0.2.1

func InitialiseColumnManager()

func InvalidateActionCache added in v0.11.7

func InvalidateActionCache(typeName string, actionName string)

InvalidateActionCache removes the cached action schema row.

func InvalidateAdminCacheForUser added in v0.11.4

func InvalidateAdminCacheForUser(userReferenceId daptinid.DaptinReferenceId)

InvalidateAdminCacheForUser removes both the bulk administrator reference ID cache and the per-user admin status cache, forcing re-evaluation from the database.

func InvalidateObjectGroupsCache added in v0.11.4

func InvalidateObjectGroupsCache(objectType string, objectId int64)

InvalidateObjectGroupsCache removes the cached group permissions for a specific object.

func InvalidateObjectPermissionCache added in v0.11.4

func InvalidateObjectPermissionCache(objectType string, referenceId daptinid.DaptinReferenceId)

InvalidateObjectPermissionCache removes the cached PermissionInstance for a specific object, forcing the next access to re-fetch from the database.

func InvalidateObjectPermissionWhereCache added in v0.11.7

func InvalidateObjectPermissionWhereCache(objectType string, colName string, colValue string)

InvalidateObjectPermissionWhereCache removes permission caches keyed by a where clause.

func InvalidateObjectUsergroupRelationPermissionCaches added in v0.12.11

func InvalidateObjectUsergroupRelationPermissionCaches(objectType string, objectId int64, transaction *sqlx.Tx)

InvalidateObjectUsergroupRelationPermissionCaches removes all parent-object permission caches that depend on a _has_usergroup_usergroup_id relation row.

func InvalidateRowPermissionCache added in v0.11.4

func InvalidateRowPermissionCache(objectType string, referenceId daptinid.DaptinReferenceId)

InvalidateRowPermissionCache removes the cached row-level permission for a specific object.

func IsAdminWithTransaction added in v0.9.9

func IsAdminWithTransaction(userReferenceId *auth.SessionUser, transaction *sqlx.Tx) bool

func IsMeteringInternalRequest added in v0.11.7

func IsMeteringInternalRequest(req *http.Request) bool

func IsMeteringSystemTable added in v0.11.7

func IsMeteringSystemTable(tableName string) bool

func IsReservedWord added in v0.2.1

func IsReservedWord(w string) bool

func IsStandardColumn added in v0.9.0

func IsStandardColumn(colName string) bool

func MD5Hash added in v0.11.4

func MD5Hash(data []byte) []byte

MD5 hash function

func MakeCreateTableQuery

func MakeCreateTableQuery(tableInfo *table_info.TableInfo, sqlDriverName string) string

func MapArrayToInterfaceArray added in v0.9.9

func MapArrayToInterfaceArray(s []map[string]interface{}) []interface{}

func NewActionResponse

func NewActionResponse(responseType string, attrs interface{}) actionresponse.ActionResponse

func NewClientNotification

func NewClientNotification(notificationType string, message string, title string) map[string]interface{}

func NewMapStringScan

func NewMapStringScan(columnNames []string) *mapStringScan

func NewResponse

func NewResponse(metadata map[string]interface{}, result interface{}, statusCode int, pagination *api2go.Pagination) api2go.Responder

func NewTaskScheduler added in v0.6.9

func NewTaskScheduler(cmsConfig *CmsConfig, cruds map[string]*DbResource, configStore *ConfigStore) task_scheduler.TaskScheduler

func OAuthHashToken added in v0.11.6

func OAuthHashToken(token string) string

func OAuthPKCES256 added in v0.11.6

func OAuthPKCES256(verifier string) string

func OAuthRandomToken added in v0.11.6

func OAuthRandomToken() (string, error)

func PrintRelations added in v0.5.7

func PrintRelations(relations []api2go.TableRelation)

func PrintTableInfo added in v0.5.7

func PrintTableInfo(info *table_info.TableInfo, title string)

func RSADecrypt added in v0.11.4

func RSADecrypt(privKey *rsa.PrivateKey, ciphertext []byte) ([]byte, error)

RSA decryption

func RSAEncrypt added in v0.11.4

func RSAEncrypt(pubKey *rsa.PublicKey, data []byte) ([]byte, error)

RSA encryption

func RSAGenerateKey added in v0.11.4

func RSAGenerateKey(bits int) (*rsa.PrivateKey, error)

RSA key generation

func RegisterActionHandlerOnAll added in v0.12.12

func RegisterActionHandlerOnAll(cruds map[string]*DbResource, name string, performer actionresponse.ActionPerformerInterface)

func RegisterGlobalActionHandler added in v0.12.12

func RegisterGlobalActionHandler(name string, performer actionresponse.ActionPerformerInterface)

func RegisterTranslations added in v0.6.9

func RegisterTranslations()

func RelationNamesToIds added in v0.9.9

func RelationNamesToIds(db database.DatabaseConnection, tableInfo table_info.TableInfo) (map[string][]int64, error)

func RowsToMap

func RowsToMap(rows *sqlx.Rows, typeName string) ([]map[string]interface{}, error)

RowsToMap converts the result of db.QueryRowx => rows to array of data can be used on any *sqlx.Rows and assign a typeName

func SHA256Hash added in v0.11.4

func SHA256Hash(data []byte) []byte

SHA256 hash function

func SHA512Hash added in v0.11.4

func SHA512Hash(data []byte) []byte

SHA512 hash function

func SmallSnakeCaseText added in v0.2.1

func SmallSnakeCaseText(str string) string

func StringOrEmpty added in v0.11.4

func StringOrEmpty(i interface{}) string

func ToExpressionArray added in v0.9.9

func ToExpressionArray(s []string) []exp.Expression

func ToInterfaceArray added in v0.9.9

func ToInterfaceArray(s []string) []interface{}

func ToJson added in v0.11.4

func ToJson(mapIns interface{}) string

Base64 encoding (similar to Btoa in JavaScript)

func ToOrderedExpressionArray added in v0.9.9

func ToOrderedExpressionArray(s []string) []exp.OrderedExpression

func URLDecode added in v0.11.4

func URLDecode(data string) []byte

Base64 URL decoding function

func URLEncode added in v0.11.4

func URLEncode(data []byte) string

Base64 URL encoding function

func UpdateActionTable

func UpdateActionTable(initConfig *CmsConfig, transaction *sqlx.Tx) error

func UpdateExchanges

func UpdateExchanges(initConfig *CmsConfig, transaction *sqlx.Tx)

func UpdateStateMachineDescriptions

func UpdateStateMachineDescriptions(initConfig *CmsConfig, db *sqlx.Tx)

func UpdateStreams added in v0.4.0

func UpdateStreams(initConfig *CmsConfig, db *sqlx.Tx)

func UpdateTasksData added in v0.6.9

func UpdateTasksData(initConfig *CmsConfig, transaction *sqlx.Tx) error

func UpdateWorldTable

func UpdateWorldTable(initConfig *CmsConfig, transaction *sqlx.Tx) error

func ValueOf

func ValueOf(x interface{}) interface{}

func ValuesOf added in v0.9.9

func ValuesOf(mapItem map[daptinid.DaptinReferenceId]int64) []int64

func WithMeteringInternal added in v0.11.7

func WithMeteringInternal(ctx context.Context) context.Context

Types

type ActionExchangeHandler added in v0.9.9

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

func (*ActionExchangeHandler) ExecuteTarget added in v0.9.9

func (exchangeHandler *ActionExchangeHandler) ExecuteTarget(row map[string]interface{}, transaction *sqlx.Tx) (map[string]interface{}, error)

type ActionRow

type ActionRow struct {
	Name             string
	Label            string
	OnType           string
	InstanceOptional bool `db:"instance_optional"`
	ReferenceId      daptinid.DaptinReferenceId
	ActionSchema     string `db:"action_schema"`
}

ActionRow represents an action instance on the database Can be retrieved using GetActionByName

func (ActionRow) MarshalBinary added in v0.10.0

func (e ActionRow) MarshalBinary() (data []byte, err error)

MarshalBinary encodes the struct into binary format manually

func (*ActionRow) UnmarshalBinary added in v0.10.0

func (e *ActionRow) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the data into the struct using manual binary decoding

type ActiveTaskInstance added in v0.6.9

type ActiveTaskInstance struct {
	Task          task.Task
	ActionRequest actionresponse.ActionRequest
	DbResource    *DbResource
}

func (*ActiveTaskInstance) Run added in v0.6.9

func (ati *ActiveTaskInstance) Run()

type AdminMapType added in v0.10.0

type AdminMapType map[uuid.UUID]bool

func (AdminMapType) MarshalBinary added in v0.10.0

func (a AdminMapType) MarshalBinary() (data []byte, err error)

func (AdminMapType) UnmarshalBinary added in v0.10.0

func (a AdminMapType) UnmarshalBinary(data []byte) error

type AggregateData added in v0.6.2

type AggregateData struct {
	Data []AggregateRow `json:"data"`
}

PaginatedFindAll(req Request) (totalCount uint, response Responder, err error)

type AggregateRow added in v0.9.9

type AggregateRow struct {
	Type       string                 `json:"type"`
	Id         string                 `json:"id"`
	Attributes map[string]interface{} `json:"attributes"`
}

type AggregationRequest added in v0.6.2

type AggregationRequest struct {
	RootEntity    string
	Join          []string
	GroupBy       []string
	ProjectColumn []string
	Query         []Query
	Order         []string
	Having        []string
	Filter        []string
	TimeSample    TimeStamp
	TimeFrom      string
	TimeTo        string
}

type CertificateManager added in v0.9.0

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

func NewCertificateManager added in v0.9.0

func NewCertificateManager(cruds map[string]*DbResource, configStore *ConfigStore, transaction *sqlx.Tx) (*CertificateManager, error)

func (*CertificateManager) GetTLSConfig added in v0.9.0

func (cm *CertificateManager) GetTLSConfig(hostname string, createIfNotFound bool,
	transaction *sqlx.Tx) (*TLSCertificate, error)

func (*CertificateManager) GetTLSForEnabledSubsites added in v0.11.4

func (cm *CertificateManager) GetTLSForEnabledSubsites(transaction *sqlx.Tx) (map[string]*TLSCertificate, error)

type CmsConfig

type CmsConfig struct {
	Tables                   []table_info.TableInfo
	EnableGraphQL            bool
	Imports                  []rootpojo.DataFileImport
	StateMachineDescriptions []fsm.LoopbookFsmDescription
	Relations                []api2go.TableRelation
	Actions                  []actionresponse.Action
	ExchangeContracts        []ExchangeContract
	Hostname                 string
	SubSites                 map[string]SubSiteInformation
	Tasks                    []task.Task
	Streams                  []StreamContract
	ActionPerformers         []actionresponse.ActionPerformerInterface
}

func (*CmsConfig) AddRelations added in v0.5.7

func (ti *CmsConfig) AddRelations(relations ...api2go.TableRelation)

type ColumnMap

type ColumnMap struct {
	SourceColumn     string
	SourceColumnType string
	TargetColumn     string
	TargetColumnType string
}

type ColumnMapping

type ColumnMapping []ColumnMap

func (*ColumnMapping) UnmarshalJSON

func (c *ColumnMapping) UnmarshalJSON(payload []byte) error

type ColumnType added in v0.2.1

type ColumnType struct {
	BlueprintType string
	Name          string
	Validations   []string
	Conformations []string
	ReclineType   string
	DataTypes     []string
	GraphqlType   graphql.Type
}

func (ColumnType) Fake added in v0.2.1

func (ct ColumnType) Fake() interface{}

type ColumnTypeManager added in v0.2.1

type ColumnTypeManager struct {
	ColumnMap map[string]ColumnType
}
var ColumnManager *ColumnTypeManager

func (*ColumnTypeManager) GetBlueprintType added in v0.2.1

func (ctm *ColumnTypeManager) GetBlueprintType(columnType string) string

func (*ColumnTypeManager) GetFakeData added in v0.9.0

func (ctm *ColumnTypeManager) GetFakeData(colTypeName string) string

func (*ColumnTypeManager) GetGraphqlType added in v0.6.9

func (ctm *ColumnTypeManager) GetGraphqlType(columnType string) graphql.Type

func (*ColumnTypeManager) IsValidValue added in v0.2.1

func (ctm *ColumnTypeManager) IsValidValue(val string, colType string, validator *validator2.Validate) error

type Config

type Config struct {
	Name          string
	ConfigType    string // web/backend/mobile
	ConfigState   string // enabled/disabled
	ConfigEnv     string // debug/test/release
	Value         string
	ValueType     string // number/string/byteslice
	PreviousValue string
	UpdatedAt     time.Time
}

type ConfigStore

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

func NewConfigStore

func NewConfigStore(db database.DatabaseConnection) (*ConfigStore, error)

func (*ConfigStore) DeleteConfigValueFor added in v0.9.0

func (configStore *ConfigStore) DeleteConfigValueFor(key string, configtype string, transaction *sqlx.Tx) error

func (*ConfigStore) GetAllConfig added in v0.9.0

func (configStore *ConfigStore) GetAllConfig(transaction *sqlx.Tx) map[string]string

func (*ConfigStore) GetConfigIntValueFor added in v0.6.8

func (configStore *ConfigStore) GetConfigIntValueFor(key string, configtype string, transaction *sqlx.Tx) (int, error)

func (*ConfigStore) GetConfigValueFor

func (configStore *ConfigStore) GetConfigValueFor(key string, configtype string, transaction *sqlx.Tx) (string, error)

func (*ConfigStore) GetConfigValueForWithTransaction added in v0.9.9

func (configStore *ConfigStore) GetConfigValueForWithTransaction(key string, configtype string, transaction *sqlx.Tx) (string, error)

func (*ConfigStore) SetConfigIntValueFor added in v0.6.8

func (configStore *ConfigStore) SetConfigIntValueFor(key string, val int, configtype string, transaction *sqlx.Tx) error

func (*ConfigStore) SetConfigValueFor

func (configStore *ConfigStore) SetConfigValueFor(key string, val interface{}, configtype string, transaction *sqlx.Tx) error

func (*ConfigStore) SetConfigValueForWithTransaction added in v0.9.9

func (configStore *ConfigStore) SetConfigValueForWithTransaction(key string, val interface{}, configtype string, transaction *sqlx.Tx) error

func (*ConfigStore) SetDefaultEnv

func (configStore *ConfigStore) SetDefaultEnv(env string)

type DaptinCaldavBackend added in v0.11.4

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

DaptinCaldavBackend implements CalDAV storage using database Pattern: follows DaptinImapBackend (imap_backend.go:12-97)

func NewCaldavBackend added in v0.11.4

func NewCaldavBackend(cruds map[string]*DbResource, certManager *CertificateManager) *DaptinCaldavBackend

NewCaldavBackend creates a new CalDAV backend with database access Pattern: like NewImapServer (imap_backend.go:93-97)

func (*DaptinCaldavBackend) CreateFileSystemForUser added in v0.11.4

func (dcb *DaptinCaldavBackend) CreateFileSystemForUser(sessionUser *auth.SessionUser) webdav.FileSystem

CreateFileSystemForUser creates a per-user filesystem after authentication Pattern: like IMAP Login creating DaptinImapUser (imap_backend.go:48-91)

type DaptinCaldavFileSystem added in v0.11.4

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

DaptinCaldavFileSystem implements webdav.FileSystem using database Pattern: like DaptinImapUser (imap_user.go:15-24)

func (*DaptinCaldavFileSystem) Copy added in v0.11.4

func (dcfs *DaptinCaldavFileSystem) Copy(src, dst string, recursive, overwrite bool) (bool, error)

Copy copies a file

func (*DaptinCaldavFileSystem) Create added in v0.11.4

func (dcfs *DaptinCaldavFileSystem) Create(name string) (io.WriteCloser, error)

Create creates a new file and returns a writer

func (*DaptinCaldavFileSystem) Mkdir added in v0.11.4

func (dcfs *DaptinCaldavFileSystem) Mkdir(name string) error

Mkdir creates a directory (collection) Pattern: like IMAP CreateMailbox (imap_user.go:265-286)

func (*DaptinCaldavFileSystem) MoveAll added in v0.11.4

func (dcfs *DaptinCaldavFileSystem) MoveAll(src, dst string, overwrite bool) (bool, error)

MoveAll moves/renames a file

func (*DaptinCaldavFileSystem) Open added in v0.11.4

func (dcfs *DaptinCaldavFileSystem) Open(name string) (io.ReadCloser, error)

Open opens a file for reading Pattern: Direct SQL query - CalDAV stores raw iCalendar content, not file references Note: ForeignKeyData is configured on the column but CalDAV bypasses the JSON API file format

func (*DaptinCaldavFileSystem) Readdir added in v0.11.4

func (dcfs *DaptinCaldavFileSystem) Readdir(name string, recursive bool) ([]webdav.FileInfo, error)

Readdir lists directory contents Pattern: like IMAP ListMailboxes (imap_user.go:35-95)

func (*DaptinCaldavFileSystem) RemoveAll added in v0.11.4

func (dcfs *DaptinCaldavFileSystem) RemoveAll(name string) error

RemoveAll deletes a file or directory Pattern: uses SQL DELETE (dbresource.go:689-701)

func (*DaptinCaldavFileSystem) Stat added in v0.11.4

func (dcfs *DaptinCaldavFileSystem) Stat(name string) (*webdav.FileInfo, error)

Stat returns file/directory information

type DaptinError added in v0.5.7

type DaptinError struct {
	Message string
	Code    string
}

func NewDaptinError added in v0.5.7

func NewDaptinError(str string, code string) *DaptinError

func (*DaptinError) Error added in v0.6.9

func (de *DaptinError) Error() string

type DaptinImapBackend added in v0.9.0

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

func NewImapServer added in v0.9.0

func NewImapServer(cruds map[string]*DbResource) *DaptinImapBackend

func (*DaptinImapBackend) Login added in v0.9.0

func (be *DaptinImapBackend) Login(conn *imap.ConnInfo, username, password string) (backend.User, error)

func (*DaptinImapBackend) LoginMd5 added in v0.9.0

func (be *DaptinImapBackend) LoginMd5(conn *imap.ConnInfo, username, challenge string, response string) (backend.User, error)

type DaptinImapMailBox added in v0.9.0

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

func (*DaptinImapMailBox) Check added in v0.9.0

func (dimb *DaptinImapMailBox) Check() error

Check requests a checkpoint of the currently selected mailbox. A checkpoint refers to any implementation-dependent housekeeping associated with the mailbox (e.g., resolving the server's in-memory state of the mailbox with the state on its disk). A checkpoint MAY take a non-instantaneous amount of real time to complete. If a server implementation has no such housekeeping considerations, CHECK is equivalent to NOOP.

func (*DaptinImapMailBox) ConsumePollUpdate added in v0.11.4

func (dimb *DaptinImapMailBox) ConsumePollUpdate() *imap.MailboxStatus

ConsumePollUpdate returns the pending mailbox status if Poll() found new messages, and clears the pending state. Returns nil if no update is pending.

func (*DaptinImapMailBox) CopyMessages added in v0.9.0

func (dimb *DaptinImapMailBox) CopyMessages(uid bool, seqset *imap.SeqSet, dest string) error

CopyMessages copies the specified message(s) to the end of the specified destination mailbox. The flags and internal date of the message(s) SHOULD be preserved, and the Recent flag SHOULD be set, in the copy.

If the destination mailbox does not exist, a server SHOULD return an error. It SHOULD NOT automatically create the mailbox.

If the Backend implements Updater, it must notify the client immediately via a mailbox update.

func (*DaptinImapMailBox) CreateMessage added in v0.9.0

func (dimb *DaptinImapMailBox) CreateMessage(flags []string, date time.Time, body imap.Literal) error

CreateMessage appends a new message to this mailbox. The \Recent flag will be added no matter flags is empty or not. If date is nil, the current time will be used.

If the Backend implements Updater, it must notify the client immediately via a mailbox update.

func (*DaptinImapMailBox) Expunge added in v0.9.0

func (dimb *DaptinImapMailBox) Expunge() error

Expunge permanently removes all messages that have the \Deleted flag set from the currently selected mailbox.

If the Backend implements Updater, it must notify the client immediately via an expunge update.

func (*DaptinImapMailBox) Info added in v0.9.0

func (dimb *DaptinImapMailBox) Info() (*imap.MailboxInfo, error)

Info returns this mailbox info.

func (*DaptinImapMailBox) ListMessages added in v0.9.0

func (dimb *DaptinImapMailBox) ListMessages(uid bool, seqset *imap.SeqSet, items []imap.FetchItem, ch chan<- *imap.Message) error

ListMessages returns a list of messages. seqset must be interpreted as UIDs if uid is set to true and as message sequence numbers otherwise. See RFC 3501 section 6.4.5 for a list of items that can be requested.

Messages must be sent to ch. When the function returns, ch must be closed.

func (*DaptinImapMailBox) Name added in v0.9.0

func (dimb *DaptinImapMailBox) Name() string

Name returns this mailbox name.

func (*DaptinImapMailBox) Poll added in v0.11.4

func (dimb *DaptinImapMailBox) Poll() error

Poll implements backend.MailboxPoller. Called by go-imap on NOOP to check for new messages and send EXISTS updates to the client.

func (*DaptinImapMailBox) SearchMessages added in v0.9.0

func (dimb *DaptinImapMailBox) SearchMessages(uid bool, criteria *imap.SearchCriteria) ([]uint32, error)

SearchMessages searches messages. The returned list must contain UIDs if uid is set to true, or sequence numbers otherwise.

func (*DaptinImapMailBox) SetSubscribed added in v0.9.0

func (dimb *DaptinImapMailBox) SetSubscribed(subscribed bool) error

SetSubscribed adds or removes the mailbox to the server's set of "active" or "subscribed" mailboxes.

func (*DaptinImapMailBox) Status added in v0.9.0

func (dimb *DaptinImapMailBox) Status(items []imap.StatusItem) (*imap.MailboxStatus, error)

Status returns this mailbox status. The fields Name, Flags, PermanentFlags and UnseenSeqNum in the returned MailboxStatus must be always populated. This function does not affect the state of any messages in the mailbox. See RFC 3501 section 6.3.10 for a list of items that can be requested.

func (*DaptinImapMailBox) UpdateMessagesFlags added in v0.9.0

func (dimb *DaptinImapMailBox) UpdateMessagesFlags(uid bool, seqset *imap.SeqSet, operation imap.FlagsOp, flags []string) error

UpdateMessagesFlags alters flags for the specified message(s).

If the Backend implements Updater, it must notify the client immediately via a message update.

type DaptinImapUser added in v0.9.0

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

func (*DaptinImapUser) CreateMailbox added in v0.9.0

func (diu *DaptinImapUser) CreateMailbox(name string) error

CreateMailbox creates a new mailbox.

If the mailbox already exists, an error must be returned. If the mailbox name is suffixed with the server's hierarchy separator character, this is a declaration that the client intends to create mailbox names under this name in the hierarchy.

If the server's hierarchy separator character appears elsewhere in the name, the server SHOULD create any superior hierarchical names that are needed for the CREATE command to be successfully completed. In other words, an attempt to create "foo/bar/zap" on a server in which "/" is the hierarchy separator character SHOULD create foo/ and foo/bar/ if they do not already exist.

If a new mailbox is created with the same name as a mailbox which was deleted, its unique identifiers MUST be greater than any unique identifiers used in the previous incarnation of the mailbox UNLESS the new incarnation has a different unique identifier validity value.

func (*DaptinImapUser) CreateMailboxWithTransaction added in v0.9.10

func (diu *DaptinImapUser) CreateMailboxWithTransaction(name string, transaction *sqlx.Tx) error

CreateMailbox creates a new mailbox.

If the mailbox already exists, an error must be returned. If the mailbox name is suffixed with the server's hierarchy separator character, this is a declaration that the client intends to create mailbox names under this name in the hierarchy.

If the server's hierarchy separator character appears elsewhere in the name, the server SHOULD create any superior hierarchical names that are needed for the CREATE command to be successfully completed. In other words, an attempt to create "foo/bar/zap" on a server in which "/" is the hierarchy separator character SHOULD create foo/ and foo/bar/ if they do not already exist.

If a new mailbox is created with the same name as a mailbox which was deleted, its unique identifiers MUST be greater than any unique identifiers used in the previous incarnation of the mailbox UNLESS the new incarnation has a different unique identifier validity value.

func (*DaptinImapUser) DeleteMailbox added in v0.9.0

func (diu *DaptinImapUser) DeleteMailbox(name string) error

DeleteMailbox permanently remove the mailbox with the given name. It is an error to // attempt to delete INBOX or a mailbox name that does not exist.

The DELETE command MUST NOT remove inferior hierarchical names. For example, if a mailbox "foo" has an inferior "foo.bar" (assuming "." is the hierarchy delimiter character), removing "foo" MUST NOT remove "foo.bar".

The value of the highest-used unique identifier of the deleted mailbox MUST be preserved so that a new mailbox created with the same name will not reuse the identifiers of the former incarnation, UNLESS the new incarnation has a different unique identifier validity value.

func (*DaptinImapUser) GetMailbox added in v0.9.0

func (diu *DaptinImapUser) GetMailbox(name string) (backend.Mailbox, error)

GetMailbox returns a mailbox. If it doesn't exist, it returns ErrNoSuchMailbox.

func (*DaptinImapUser) GetMailboxWithTransaction added in v0.9.10

func (diu *DaptinImapUser) GetMailboxWithTransaction(name string, transaction *sqlx.Tx) (backend.Mailbox, error)

GetMailbox returns a mailbox. If it doesn't exist, it returns ErrNoSuchMailbox.

func (*DaptinImapUser) ListMailboxes added in v0.9.0

func (diu *DaptinImapUser) ListMailboxes(subscribed bool) ([]backend.Mailbox, error)

ListMailboxes returns a list of mailboxes belonging to this user. If subscribed is set to true, only returns subscribed mailboxes.

func (*DaptinImapUser) Logout added in v0.9.0

func (diu *DaptinImapUser) Logout() error

Logout is called when this User will no longer be used, likely because the client closed the connection.

func (*DaptinImapUser) RenameMailbox added in v0.9.0

func (diu *DaptinImapUser) RenameMailbox(existingName, newName string) error

RenameMailbox changes the name of a mailbox. It is an error to attempt to rename from a mailbox name that does not exist or to a mailbox name that already exists.

If the name has inferior hierarchical names, then the inferior hierarchical names MUST also be renamed. For example, a rename of "foo" to "zap" will rename "foo/bar" (assuming "/" is the hierarchy delimiter character) to "zap/bar".

If the server's hierarchy separator character appears in the name, the server SHOULD create any superior hierarchical names that are needed for the RENAME command to complete successfully. In other words, an attempt to rename "foo/bar/zap" to baz/rag/zowie on a server in which "/" is the hierarchy separator character SHOULD create baz/ and baz/rag/ if they do not already exist.

The value of the highest-used unique identifier of the old mailbox name MUST be preserved so that a new mailbox created with the same name will not reuse the identifiers of the former incarnation, UNLESS the new incarnation has a different unique identifier validity value.

Renaming INBOX is permitted, and has special behavior. It moves all messages in INBOX to a new mailbox with the given name, leaving INBOX empty. If the server implementation supports inferior hierarchical names of INBOX, these are unaffected by a rename of INBOX.

func (*DaptinImapUser) Username added in v0.9.0

func (diu *DaptinImapUser) Username() string

User represents a user in the mail storage system. A user operation always deals with mailboxes. Username returns this user's username.

type DataValidationMiddleware added in v0.2.1

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

func (*DataValidationMiddleware) InterceptAfter added in v0.2.1

func (dvm *DataValidationMiddleware) InterceptAfter(dr *DbResource, req *api2go.Request, results []map[string]interface{}, transaction *sqlx.Tx) ([]map[string]interface{}, error)

func (*DataValidationMiddleware) InterceptBefore added in v0.2.1

func (dvm *DataValidationMiddleware) InterceptBefore(dr *DbResource, req *api2go.Request, objects []map[string]interface{}, transaction *sqlx.Tx) ([]map[string]interface{}, error)

func (DataValidationMiddleware) String added in v0.2.1

func (dvm DataValidationMiddleware) String() string

type DatabaseRequestInterceptor

type DatabaseRequestInterceptor interface {
	InterceptBefore(*DbResource, *api2go.Request, []map[string]interface{}, *sqlx.Tx) ([]map[string]interface{}, error)
	InterceptAfter(*DbResource, *api2go.Request, []map[string]interface{}, *sqlx.Tx) ([]map[string]interface{}, error)
	fmt.Stringer
}

func NewCreateEventHandler

func NewCreateEventHandler(cruds *map[string]*DbResource, dtopicMap *map[string]*olric.PubSub) DatabaseRequestInterceptor

func NewDataValidationMiddleware added in v0.2.1

func NewDataValidationMiddleware(cmsConfig *CmsConfig, cruds *map[string]*DbResource) DatabaseRequestInterceptor

func NewDeleteEventHandler

func NewDeleteEventHandler(cruds *map[string]*DbResource, dtopicMap *map[string]*olric.PubSub) DatabaseRequestInterceptor

func NewExchangeMiddleware

func NewExchangeMiddleware(cmsConfig *CmsConfig, cruds *map[string]*DbResource) DatabaseRequestInterceptor

Creates a new exchange middleware which is responsible for calling external apis on data updates

func NewMeteringMiddleware added in v0.11.7

func NewMeteringMiddleware(cruds *map[string]*DbResource) DatabaseRequestInterceptor

func NewUpdateEventHandler

func NewUpdateEventHandler(cruds *map[string]*DbResource, dtopicMap *map[string]*olric.PubSub) DatabaseRequestInterceptor

func NewYJSHandlerMiddleware added in v0.9.9

func NewYJSHandlerMiddleware(store ydb.Store) DatabaseRequestInterceptor

type DbResource

type DbResource struct {
	Cruds map[string]*DbResource

	ActionHandlerMap map[string]actionresponse.ActionPerformerInterface
	ConfigStore      *ConfigStore
	EncryptionSecret []byte

	AdministratorGroupId daptinid.DaptinReferenceId

	OlricDb          *olric.EmbeddedClient
	PubSub           *olric.PubSub
	AssetFolderCache map[string]map[string]*assetcachepojo.AssetFolderCache

	MailSender func(e *mail.Envelope, task backends.SelectTask) (backends.Result, error)
	// contains filtered or unexported fields
}

func NewDbResource

func NewDbResource(model api2go.Api2GoModel, db database.DatabaseConnection,
	ms *MiddlewareSet, cruds map[string]*DbResource, configStore *ConfigStore,
	olricDb *olric.EmbeddedClient, tableInfo table_info.TableInfo) (*DbResource, error)

func (*DbResource) AllocateMailBoxUid added in v0.12.17

func (dbResource *DbResource) AllocateMailBoxUid(mailBoxId int64, transaction *sqlx.Tx) (uint32, error)

func (*DbResource) AppendSentMailForSender added in v0.12.29

func (dbResource *DbResource) AppendSentMailForSender(fromAddress string, messageBytes []byte, transaction *sqlx.Tx) (map[string]interface{}, error)

func (*DbResource) BecomeAdmin

func (dbResource *DbResource) BecomeAdmin(userId int64, transaction *sqlx.Tx) bool

BecomeAdmin make user the administrator and owner of everything Check CanBecomeAdmin before invoking this

func (*DbResource) CanBecomeAdmin

func (dbResource *DbResource) CanBecomeAdmin(transaction *sqlx.Tx) bool

CanBecomeAdmin Checks if the context user can invoke the become admin action checks if there is only 1 real user in the system No one can become admin once we have an adminstrator

func (*DbResource) ClearRecentFlags added in v0.11.4

func (dbResource *DbResource) ClearRecentFlags(mailBoxId int64, transaction *sqlx.Tx) error

func (*DbResource) ColumnMap added in v0.12.17

func (dbResource *DbResource) ColumnMap() map[string]api2go.ColumnInfo

func (*DbResource) Connection added in v0.9.9

func (dbResource *DbResource) Connection() database.DatabaseConnection

func (*DbResource) Create

func (dbResource *DbResource) Create(obj interface{}, req api2go.Request) (api2go.Responder, error)

func (*DbResource) CreateMailAccountBox added in v0.9.0

func (dbResource *DbResource) CreateMailAccountBox(mailAccountId string,
	sessionUser *auth.SessionUser, mailBoxName string, transaction *sqlx.Tx) (map[string]interface{}, error)

Returns the user mail account box row of a user

func (*DbResource) CreateWithTransaction added in v0.9.9

func (dbResource *DbResource) CreateWithTransaction(obj interface{}, req api2go.Request, transaction *sqlx.Tx) (api2go.Responder, error)

func (*DbResource) CreateWithoutFilter added in v0.6.5

func (dbResource *DbResource) CreateWithoutFilter(obj interface{}, req api2go.Request, createTransaction *sqlx.Tx) (map[string]interface{}, error)

func (*DbResource) DataStats added in v0.6.2

func (dbResource *DbResource) DataStats(req AggregationRequest, transaction *sqlx.Tx) (*AggregateData, error)

func (*DbResource) Delete

func (dbResource *DbResource) Delete(idString string, req api2go.Request) (api2go.Responder, error)

func (*DbResource) DeleteMailAccountBox added in v0.9.0

func (dbResource *DbResource) DeleteMailAccountBox(mailAccountId int64, mailBoxName string) error

Returns the user mail account box row of a user

func (*DbResource) DeleteWithTransaction added in v0.9.9

func (dbResource *DbResource) DeleteWithTransaction(id daptinid.DaptinReferenceId, req api2go.Request, transaction *sqlx.Tx) (api2go.Responder, error)

func (*DbResource) DeleteWithoutFilters added in v0.6.5

func (dbResource *DbResource) DeleteWithoutFilters(id daptinid.DaptinReferenceId, req api2go.Request, transaction *sqlx.Tx) error

func (*DbResource) DirectInsert added in v0.2.1

func (dbResource *DbResource) DirectInsert(typeName string, data map[string]interface{}, transaction *sqlx.Tx) error

Update the data and set the values using the data map without an validation or transformations Invoked by data import action

func (*DbResource) ExpungeMailBox added in v0.9.0

func (dbResource *DbResource) ExpungeMailBox(mailBoxId int64) (int64, error)

func (*DbResource) FindAll added in v0.9.0

func (dbResource *DbResource) FindAll(req api2go.Request) (response api2go.Responder, err error)

func (*DbResource) FindOne

func (dbResource *DbResource) FindOne(referenceIdString string, req api2go.Request) (api2go.Responder, error)

FindOne returns an object by its ID Possible Responder success status code 200

func (*DbResource) FindOneWithTransaction added in v0.9.9

func (dbResource *DbResource) FindOneWithTransaction(referenceId daptinid.DaptinReferenceId, req api2go.Request, transaction *sqlx.Tx) (api2go.Responder, error)

FindOne returns an object by its ID Possible Responder success status code 200

func (*DbResource) GetActionByName

func (dbResource *DbResource) GetActionByName(typeName string, actionName string, transaction *sqlx.Tx) (actionresponse.Action, error)

GetActionByName Gets an Action instance by `typeName` and `actionName` Check Action instance for usage

func (*DbResource) GetActionHandler added in v0.11.4

func (dbResource *DbResource) GetActionHandler(name string) actionresponse.ActionPerformerInterface

func (*DbResource) GetActionPermissionByName

func (dbResource *DbResource) GetActionPermissionByName(worldId int64, actionName string, transaction *sqlx.Tx) (permission.PermissionInstance, error)

GetActionPermissionByName Gets permission of an action by typeId and actionName Loads the owner, usergroup and guest permission of the action from the database Return a PermissionInstance Special utility function for actions, for other objects use GetObjectPermissionByReferenceId

func (*DbResource) GetActionsByType

func (dbResource *DbResource) GetActionsByType(typeName string, transaction *sqlx.Tx) ([]actionresponse.Action, error)

GetActionsByType Gets the list of all actions defined on type `typeName` Returns list of `Action`

func (*DbResource) GetActiveIntegrations added in v0.9.0

func (dbResource *DbResource) GetActiveIntegrations(transaction *sqlx.Tx) ([]Integration, error)

func (*DbResource) GetActiveLLMProviders added in v0.11.7

func (dbResource *DbResource) GetActiveLLMProviders(transaction *sqlx.Tx) ([]rootpojo.LLMProvider, error)

func (*DbResource) GetAdminEmailId added in v0.6.9

func (dbResource *DbResource) GetAdminEmailId(transaction *sqlx.Tx) string

func (*DbResource) GetAllObjects added in v0.2.1

func (dbResource *DbResource) GetAllObjects(typeName string, transaction *sqlx.Tx) ([]map[string]interface{}, error)

GetAllObjects Gets all rows from the table `typeName` Returns an array of Map object, each object has the column name to value mapping Utility method for loading all objects having low count Can be used by actions

func (*DbResource) GetAllObjectsWithWhereWithTransaction added in v0.9.9

func (dbResource *DbResource) GetAllObjectsWithWhereWithTransaction(typeName string, transaction *sqlx.Tx, where ...goqu.Ex) ([]map[string]interface{}, error)

GetAllObjectsWithWhere Get all rows from the table `typeName` Returns an array of Map object, each object has the column name to value mapping Utility method for loading all objects having low count Can be used by actions

func (*DbResource) GetAllRawObjects added in v0.2.1

func (dbResource *DbResource) GetAllRawObjects(typeName string) ([]map[string]interface{}, error)

GetAllRawObjects Get all rows from the table `typeName` without any processing of the response expect no "__type" column on the returned instances Returns an array of Map object, each object has the column name to value mapping Utility method for loading all objects having low count Can be used by actions

func (*DbResource) GetAllRawObjectsByRawQuery added in v0.11.0

func (dbResource *DbResource) GetAllRawObjectsByRawQuery(typeName string, query string, args []interface{}) ([]map[string]interface{}, error)

GetAllRawObjects Get all rows from the table `typeName` without any processing of the response expect no "__type" column on the returned instances Returns an array of Map object, each object has the column name to value mapping Utility method for loading all objects having low count Can be used by actions

func (*DbResource) GetAllRawObjectsWithPaginationAndTransaction added in v0.11.4

func (dbResource *DbResource) GetAllRawObjectsWithPaginationAndTransaction(
	typeName string,
	pageSize int,
	transaction *sqlx.Tx,
	callback PaginatedResultCallback, limit int) error

GetAllRawObjectsWithPaginationAndTransaction fetches objects in batches to avoid memory issues

func (*DbResource) GetAllRawObjectsWithTransaction added in v0.9.9

func (dbResource *DbResource) GetAllRawObjectsWithTransaction(typeName string, transaction *sqlx.Tx) ([]map[string]interface{}, error)

func (*DbResource) GetAllTasks added in v0.6.9

func (dbResource *DbResource) GetAllTasks() ([]task.Task, error)

func (*DbResource) GetCloudStoreByNameWithTransaction added in v0.9.9

func (dbResource *DbResource) GetCloudStoreByNameWithTransaction(name string, transaction *sqlx.Tx) (rootpojo.CloudStore, error)

func (*DbResource) GetCloudStoreByReferenceId added in v0.6.9

func (dbResource *DbResource) GetCloudStoreByReferenceId(referenceID daptinid.DaptinReferenceId, transaction *sqlx.Tx) (rootpojo.CloudStore, error)

func (*DbResource) GetContext

func (dbResource *DbResource) GetContext(key string) interface{}

func (*DbResource) GetCredentialByName added in v0.11.4

func (d *DbResource) GetCredentialByName(credentialName string, transaction *sqlx.Tx) (*dbresourceinterface.Credential, error)

func (*DbResource) GetCredentialByReferenceId added in v0.11.4

func (d *DbResource) GetCredentialByReferenceId(referenceId daptinid.DaptinReferenceId, transaction *sqlx.Tx) (*dbresourceinterface.Credential, error)

func (*DbResource) GetCredentialByReferenceIdForIntegrationExecution added in v0.12.3

func (d *DbResource) GetCredentialByReferenceIdForIntegrationExecution(referenceId daptinid.DaptinReferenceId, sessionUser *auth.SessionUser, transaction *sqlx.Tx) (*dbresourceinterface.Credential, error)

func (*DbResource) GetFileFromLocalCloudStore added in v0.9.0

func (dbResource *DbResource) GetFileFromLocalCloudStore(tableName string, columnName string, filesList []map[string]interface{}) (resp []map[string]interface{}, err error)

resolve a file column from data in column to actual file on a cloud store returns a map containing the metadata of the file and the file contents as base64 encoded can be sent to browser to invoke downloading js and data urls

func (*DbResource) GetFirstUnseenMailSequence added in v0.9.0

func (dbResource *DbResource) GetFirstUnseenMailSequence(mailBoxId int64, transaction *sqlx.Tx) uint32

func (*DbResource) GetIdByWhereClause

func (dbResource *DbResource) GetIdByWhereClause(typeName string, transaction *sqlx.Tx, queries ...goqu.Ex) ([]int64, error)

GetIdByWhereClause Loads rows from the database of `typeName` with a where clause to filter rows Converts the queries to sql and run query with where clause Returns list of internal database integer ids

func (*DbResource) GetIdListToReferenceIdList added in v0.9.9

func (dbResource *DbResource) GetIdListToReferenceIdList(typeName string, ids []int64, transaction *sqlx.Tx) (map[int64]string, error)

GetIdListToReferenceIdList Lookups an string internal integer id and return a reference id of an object of type `typeName`

func (*DbResource) GetIdToObject

func (dbResource *DbResource) GetIdToObject(typeName string, id int64, transaction *sqlx.Tx) (map[string]interface{}, error)

func (*DbResource) GetIdToObjectWithTransaction added in v0.9.9

func (dbResource *DbResource) GetIdToObjectWithTransaction(typeName string, id int64, transaction *sqlx.Tx) (map[string]interface{}, error)

func (*DbResource) GetIdToReferenceId

func (dbResource *DbResource) GetIdToReferenceId(typeName string, id int64, transaction *sqlx.Tx) (daptinid.DaptinReferenceId, error)

GetIdToReferenceId Looks up an integer id and return a string reference id of an object of type `typeName`

func (*DbResource) GetLLMProviderByNameWithTransaction added in v0.11.7

func (dbResource *DbResource) GetLLMProviderByNameWithTransaction(name string, transaction *sqlx.Tx) (rootpojo.LLMProvider, error)

func (*DbResource) GetMailAccountBox added in v0.9.0

func (dbResource *DbResource) GetMailAccountBox(mailAccountId int64, mailBoxName string, transaction *sqlx.Tx) (map[string]interface{}, error)

Returns the user mail account box row of a user

func (*DbResource) GetMailBoxKeywords added in v0.11.4

func (dbResource *DbResource) GetMailBoxKeywords(mailBoxId int64, transaction *sqlx.Tx) ([]string, error)

func (*DbResource) GetMailBoxMailsByOffset added in v0.9.0

func (dbResource *DbResource) GetMailBoxMailsByOffset(mailBoxId int64, start uint32, stop uint32, includedRelations map[string]bool, transaction *sqlx.Tx) ([]map[string]interface{}, error)

func (*DbResource) GetMailBoxMailsByUidSequence added in v0.9.0

func (dbResource *DbResource) GetMailBoxMailsByUidSequence(mailBoxId int64, start uint32, stop uint32, includedRelations map[string]bool, transaction *sqlx.Tx) ([]map[string]interface{}, error)

func (*DbResource) GetMailBoxStatus added in v0.9.0

func (dbResource *DbResource) GetMailBoxStatus(mailAccountId int64, mailBoxId int64, transaction *sqlx.Tx) (*imap.MailboxStatus, error)

func (*DbResource) GetMailboxNextUid added in v0.9.0

func (dbResource *DbResource) GetMailboxNextUid(mailBoxId int64, transaction *sqlx.Tx) (uint32, error)

func (*DbResource) GetOauthDescriptionByTokenId

func (dbResource *DbResource) GetOauthDescriptionByTokenId(id int64, transaction *sqlx.Tx) (*oauth2.Config, error)

func (*DbResource) GetOauthDescriptionByTokenReferenceId added in v0.2.1

func (dbResource *DbResource) GetOauthDescriptionByTokenReferenceId(referenceId daptinid.DaptinReferenceId, transaction *sqlx.Tx) (*oauth2.Config, error)

func (*DbResource) GetObjectByWhereClause added in v0.6.9

func (dbResource *DbResource) GetObjectByWhereClause(typeName string, column string, val interface{}, transaction *sqlx.Tx) (map[string]interface{}, error)

func (*DbResource) GetObjectByWhereClauseWithTransaction added in v0.9.9

func (dbResource *DbResource) GetObjectByWhereClauseWithTransaction(
	typeName string, column string, val interface{}, transaction *sqlx.Tx) (map[string]interface{}, error)

func (*DbResource) GetObjectGroupsByObjectId

func (dbResource *DbResource) GetObjectGroupsByObjectId(objType string, objectId int64, transaction *sqlx.Tx) auth.GroupPermissionList

func (*DbResource) GetObjectPermissionById added in v0.9.0

func (dbResource *DbResource) GetObjectPermissionById(objectType string, id int64, transaction *sqlx.Tx) permission.PermissionInstance

Get permission of an Object by typeName and string referenceId Loads the owner, usergroup and guest permission of the action from the database Return a PermissionInstance Return a NoPermissionToAnyone if no such object exist

func (*DbResource) GetObjectPermissionByIdWithTransaction added in v0.9.9

func (dbResource *DbResource) GetObjectPermissionByIdWithTransaction(objectType string, id int64, transaction *sqlx.Tx) permission.PermissionInstance

Get permission of an Object by typeName and string referenceId Loads the owner, usergroup and guest permission of the action from the database Return a PermissionInstance Return a NoPermissionToAnyone if no such object exist

func (*DbResource) GetObjectPermissionByReferenceId added in v0.9.0

func (dbResource *DbResource) GetObjectPermissionByReferenceId(objectType string, referenceId daptinid.DaptinReferenceId, transaction *sqlx.Tx) permission.PermissionInstance

GetObjectPermissionByReferenceId Gets permission of an Object by typeName and string referenceId Loads the owner, usergroup and guest permission of the action from the database Return a PermissionInstance Return a NoPermissionToAnyone if no such object exist

func (*DbResource) GetObjectPermissionByWhereClause

func (dbResource *DbResource) GetObjectPermissionByWhereClause(objectType string, colName string, colValue string, transaction *sqlx.Tx) permission.PermissionInstance

GetObjectPermissionByWhereClause Gets permission of an Object by typeName and string referenceId with a simple where clause colName = colValue Use carefully Loads the owner, usergroup and guest permission of the action from the database Return a PermissionInstance Return a NoPermissionToAnyone if no such object exist

func (*DbResource) GetObjectPermissionByWhereClauseWithTransaction added in v0.9.9

func (dbResource *DbResource) GetObjectPermissionByWhereClauseWithTransaction(objectType string, colName string, colValue string, transaction *sqlx.Tx) permission.PermissionInstance

func (*DbResource) GetObjectUserGroupsByWhereWithTransaction added in v0.9.9

func (dbResource *DbResource) GetObjectUserGroupsByWhereWithTransaction(objectType string, transaction *sqlx.Tx,
	colName string, colValue interface{}) auth.GroupPermissionList

GetObjectUserGroupsByWhere Get list of group permissions for objects of typeName where colName=colValue Utility method which makes a join query to load a lot of permissions quickly Used by GetRowPermission

func (*DbResource) GetRandomRow added in v0.9.9

func (dbResource *DbResource) GetRandomRow(typeName string, count uint, transaction *sqlx.Tx) ([]map[string]interface{}, error)

func (*DbResource) GetReferenceIdByWhereClause

func (dbResource *DbResource) GetReferenceIdByWhereClause(typeName string, queries ...goqu.Ex) ([]daptinid.DaptinReferenceId, error)

Load rows from the database of `typeName` with a where clause to filter rows Converts the queries to sql and run query with where clause Returns list of reference_ids

func (*DbResource) GetReferenceIdListToIdList added in v0.9.9

func (dbResource *DbResource) GetReferenceIdListToIdList(typeName string, referenceId []string) (map[string]int64, error)

Lookup an string reference id and return a internal integer id of an object of type `typeName`

func (*DbResource) GetReferenceIdToId

func (dbResource *DbResource) GetReferenceIdToId(typeName string, referenceId daptinid.DaptinReferenceId, transaction *sqlx.Tx) (int64, error)

GetReferenceIdToId Lookup an string reference id and return a internal integer id of an object of type `typeName`

func (*DbResource) GetReferenceIdToObjectColumnWithTransaction added in v0.9.9

func (dbResource *DbResource) GetReferenceIdToObjectColumnWithTransaction(typeName string, referenceId daptinid.DaptinReferenceId,
	columnToSelect string, transaction *sqlx.Tx) (interface{}, error)

GetReferenceIdToObjectColumn Loads an object of type `typeName` using a reference_id Used internally, can be used by actions

func (*DbResource) GetReferenceIdToObjectWithTransaction added in v0.9.9

func (dbResource *DbResource) GetReferenceIdToObjectWithTransaction(typeName string, referenceId daptinid.DaptinReferenceId, transaction *sqlx.Tx) (map[string]interface{}, error)

GetReferenceIdToObject Loads an object of type `typeName` using a reference_id Used internally, can be used by actions

func (*DbResource) GetRowPermission

func (dbResource *DbResource) GetRowPermission(row map[string]interface{}, transaction *sqlx.Tx) permission.PermissionInstance

func (*DbResource) GetRowPermissionWithTransaction added in v0.9.9

func (dbResource *DbResource) GetRowPermissionWithTransaction(row map[string]interface{}, transaction *sqlx.Tx) permission.PermissionInstance

func (*DbResource) GetRowsByWhereClause

func (dbResource *DbResource) GetRowsByWhereClause(typeName string, includedRelations map[string]bool, transaction *sqlx.Tx, where ...goqu.Ex) (
	[]map[string]interface{}, [][]map[string]interface{}, error)

func (*DbResource) GetRowsByWhereClauseWithTransaction added in v0.9.9

func (dbResource *DbResource) GetRowsByWhereClauseWithTransaction(typeName string,
	includedRelations map[string]bool, transaction *sqlx.Tx, where ...goqu.Ex) (
	[]map[string]interface{}, [][]map[string]interface{}, error)

func (*DbResource) GetSingleColumnValueByReferenceId

func (dbResource *DbResource) GetSingleColumnValueByReferenceId(
	typeName string, selectColumn []interface{}, matchColumn string, values []string) ([]interface{}, error)

GetSingleColumnValueByReferenceId select "column" from "typeName" where matchColumn in (values) returns list of values of the column

func (*DbResource) GetSingleRowById added in v0.9.0

func (dbResource *DbResource) GetSingleRowById(typeName string, id int64, includedRelations map[string]bool, transaction *sqlx.Tx) (map[string]interface{}, []map[string]interface{}, error)

func (*DbResource) GetSingleRowByReferenceIdWithTransaction added in v0.9.9

func (dbResource *DbResource) GetSingleRowByReferenceIdWithTransaction(typeName string, referenceId daptinid.DaptinReferenceId,
	includedRelations map[string]bool, transaction *sqlx.Tx) (map[string]interface{}, []map[string]interface{}, error)

func (*DbResource) GetTokenByTokenId added in v0.2.1

func (dbResource *DbResource) GetTokenByTokenId(id int64) (*oauth2.Token, error)

func (*DbResource) GetTokenByTokenName added in v0.6.5

func (dbResource *DbResource) GetTokenByTokenName(name string, transaction *sqlx.Tx) (*oauth2.Token, error)

func (*DbResource) GetTokenByTokenReferenceId added in v0.2.1

func (dbResource *DbResource) GetTokenByTokenReferenceId(referenceId daptinid.DaptinReferenceId, transaction *sqlx.Tx) (*oauth2.Token, *oauth2.Config, error)

func (*DbResource) GetTotalCount

func (dbResource *DbResource) GetTotalCount() uint64

func (*DbResource) GetTotalCountBySelectBuilder added in v0.6.0

func (dbResource *DbResource) GetTotalCountBySelectBuilder(builder *goqu.SelectDataset) uint64

func (*DbResource) GetUserAccountRowByEmail added in v0.9.0

func (dbResource *DbResource) GetUserAccountRowByEmail(email string, transaction *sqlx.Tx) (map[string]interface{}, error)

GetUserAccountRowByEmail Returns the user account row of a user by looking up on email

func (*DbResource) GetUserAccountRowByEmailWithTransaction added in v0.9.9

func (dbResource *DbResource) GetUserAccountRowByEmailWithTransaction(email string, transaction *sqlx.Tx) (map[string]interface{}, error)

GetUserAccountRowByEmail Returns the user account row of a user by looking up on email

func (*DbResource) GetUserById added in v0.9.9

func (dbResource *DbResource) GetUserById(userId int64, transaction *sqlx.Tx) (map[string]interface{}, error)

func (*DbResource) GetUserEmailByIdWithTransaction added in v0.11.4

func (dbResource *DbResource) GetUserEmailByIdWithTransaction(userId int64, transaction *sqlx.Tx) string

func (*DbResource) GetUserEmailIdByUsergroupId added in v0.6.9

func (dbResource *DbResource) GetUserEmailIdByUsergroupId(usergroupId int64, transaction *sqlx.Tx) string

func (*DbResource) GetUserMailAccountRowByEmail added in v0.9.0

func (dbResource *DbResource) GetUserMailAccountRowByEmail(username string, transaction *sqlx.Tx) (map[string]interface{}, error)

Returns the user account row of a user by looking up on email

func (*DbResource) GetUserMembersByGroupName added in v0.9.9

func (dbResource *DbResource) GetUserMembersByGroupName(groupName string, transaction *sqlx.Tx) []daptinid.DaptinReferenceId

func (*DbResource) GetUserPassword added in v0.6.5

func (dbResource *DbResource) GetUserPassword(email string, transaction *sqlx.Tx) (string, error)

func (*DbResource) HandleActionRequest added in v0.6.9

func (dbResource *DbResource) HandleActionRequest(actionRequest actionresponse.ActionRequest,
	req api2go.Request, transaction *sqlx.Tx) ([]actionresponse.ActionResponse, error)

func (*DbResource) InitializeObject added in v0.11.4

func (dbResource *DbResource) InitializeObject(value interface{})

func (*DbResource) IsUserActionAllowed

func (dbResource *DbResource) IsUserActionAllowed(
	userReferenceId daptinid.DaptinReferenceId, userGroups auth.GroupPermissionList, typeName string, actionName string, transaction *sqlx.Tx) bool

IsUserActionAllowed Checks if a user identified by userReferenceId and belonging to userGroups is allowed to invoke an action `actionName` on type `typeName` Called before invoking an action from the /action/** api Checks EXECUTE on both the type and action for this user The permissions can come from different groups

func (*DbResource) IsUserActionAllowedWithTransaction added in v0.9.9

func (dbResource *DbResource) IsUserActionAllowedWithTransaction(userReferenceId daptinid.DaptinReferenceId,
	userGroups auth.GroupPermissionList, typeName string, actionName string, transaction *sqlx.Tx) bool

func (*DbResource) LockMailAccountForMailboxCreation added in v0.12.17

func (dbResource *DbResource) LockMailAccountForMailboxCreation(mailAccountId int64, transaction *sqlx.Tx) error

func (*DbResource) MailColumnBytes added in v0.12.18

func (dbResource *DbResource) MailColumnBytes(tableName, columnName string, columnValue interface{}) ([]byte, error)

func (*DbResource) MailColumnValue added in v0.12.18

func (dbResource *DbResource) MailColumnValue(tableName, columnName string, messageBytes []byte, nameHint string) interface{}

func (*DbResource) NewActiveTaskInstance added in v0.6.9

func (dbResource *DbResource) NewActiveTaskInstance(task task.Task) *ActiveTaskInstance

func (*DbResource) PaginatedFindAll

func (dbResource *DbResource) PaginatedFindAll(req api2go.Request) (totalCount uint, response api2go.Responder, err error)

func (*DbResource) PaginatedFindAllWithTransaction added in v0.9.9

func (dbResource *DbResource) PaginatedFindAllWithTransaction(req api2go.Request, transaction *sqlx.Tx) (totalCount uint, response api2go.Responder, err error)

func (*DbResource) PaginatedFindAllWithoutFilters added in v0.6.5

func (dbResource *DbResource) PaginatedFindAllWithoutFilters(req api2go.Request, transaction *sqlx.Tx) (
	[]map[string]interface{}, [][]map[string]interface{}, *PaginationData, bool, error)

PaginatedFindAll(req Request) (totalCount uint, response Responder, err error)

func (*DbResource) PutContext

func (dbResource *DbResource) PutContext(key string, val interface{})

func (*DbResource) RenameMailAccountBox added in v0.9.0

func (dbResource *DbResource) RenameMailAccountBox(mailAccountId int64, oldBoxName string, newBoxName string) error

RenameMailAccountBox renames a mailbox. Per RFC 3strstrings, renaming INBOX moves all messages to the new mailbox and leaves INBOX empty.

func (*DbResource) ResolveLLMProviderByModel added in v0.11.7

func (dbResource *DbResource) ResolveLLMProviderByModel(modelName string, transaction *sqlx.Tx) (rootpojo.LLMProvider, error)

func (*DbResource) ResultToArrayOfMapRaw added in v0.2.1

func (dbResource *DbResource) ResultToArrayOfMapRaw(rows *sqlx.Rows, columnMap map[string]api2go.ColumnInfo) ([]map[string]interface{}, error)

convert the result of db.QueryRowx => rows to array of data can be used on any *sqlx.Rows and assign a typeName calls RowsToMap with the current model name

func (*DbResource) ResultToArrayOfMapWithTransaction added in v0.9.9

func (dbResource *DbResource) ResultToArrayOfMapWithTransaction(
	responseArray []map[string]interface{}, columnMap map[string]api2go.ColumnInfo,
	includedRelationMap map[string]bool, transaction *sqlx.Tx) ([]map[string]interface{}, [][]map[string]interface{}, error)

ResultToArrayOfMap converts the result of db.QueryRowx => rows to array of data fetches the related objects also expects columnMap to be fetched from rows check usage in exiting source for example includeRelationMap can be nil to include none or map[string]bool{"*": true} to include all relations can be used on any *sqlx.Rows

func (*DbResource) SetMailBoxSubscribed added in v0.9.0

func (dbResource *DbResource) SetMailBoxSubscribed(mailAccountId int64, mailBoxName string, subscribed bool, transaction *sqlx.Tx) error

Returns the user mail account box row of a user

func (*DbResource) SetSubsitesFolderCache added in v0.11.4

func (dbResource *DbResource) SetSubsitesFolderCache(cache map[daptinid.DaptinReferenceId]*assetcachepojo.AssetFolderCache)

func (*DbResource) StoreToken added in v0.6.5

func (dbResource *DbResource) StoreToken(token *oauth2.Token,
	token_type string, oauth_connect_reference_id daptinid.DaptinReferenceId,
	sessionUser *auth.SessionUser, transaction *sqlx.Tx) error

func (*DbResource) SubsiteFolderCache added in v0.9.0

func (dbResource *DbResource) SubsiteFolderCache(id daptinid.DaptinReferenceId) (*assetcachepojo.AssetFolderCache, bool)

func (*DbResource) SyncStorageToPath added in v0.6.9

func (dbResource *DbResource) SyncStorageToPath(cloudStore rootpojo.CloudStore, path string, tempDirectoryPath string, transaction *sqlx.Tx) error

func (*DbResource) TableInfo added in v0.9.0

func (dbResource *DbResource) TableInfo() *table_info.TableInfo

func (*DbResource) TruncateTable added in v0.2.1

func (dbResource *DbResource) TruncateTable(typeName string, skipRelations bool, transaction *sqlx.Tx) error

func (*DbResource) Update

func (dbResource *DbResource) Update(obj interface{}, req api2go.Request) (api2go.Responder, error)

func (*DbResource) UpdateAccessTokenByTokenId added in v0.2.1

func (dbResource *DbResource) UpdateAccessTokenByTokenId(id int64, accessToken string, expiresIn int64, transaction *sqlx.Tx) error

func (*DbResource) UpdateAccessTokenByTokenReferenceId added in v0.2.1

func (dbResource *DbResource) UpdateAccessTokenByTokenReferenceId(
	referenceId daptinid.DaptinReferenceId, accessToken string, refreshToken string, expiresIn int64, transaction *sqlx.Tx) error

func (*DbResource) UpdateAssetColumnStatus added in v0.11.4

func (dbResource *DbResource) UpdateAssetColumnStatus(resourceUuid daptinid.DaptinReferenceId, columnName,
	uploadId, status string, metadata map[string]interface{}, transaction *sqlx.Tx) error

func (*DbResource) UpdateAssetColumnWithFile added in v0.11.4

func (dbResource *DbResource) UpdateAssetColumnWithFile(columnName,
	fileName string, resourceUuid daptinid.DaptinReferenceId, fileSize int64, fileType string, transaction *sqlx.Tx) error

func (*DbResource) UpdateAssetColumnWithPendingUpload added in v0.11.4

func (dbResource *DbResource) UpdateAssetColumnWithPendingUpload(resourceUuid daptinid.DaptinReferenceId,
	columnName, fileName, uploadId string, fileSize int64, fileType string, transaction *sqlx.Tx) error

func (*DbResource) UpdateMailFlags added in v0.9.0

func (dbResource *DbResource) UpdateMailFlags(mailBoxId int64, mailId int64, newFlags []string, transaction *sqlx.Tx) error

func (*DbResource) UpdateWithTransaction added in v0.9.9

func (dbResource *DbResource) UpdateWithTransaction(obj interface{}, req api2go.Request, transaction *sqlx.Tx) (api2go.Responder, error)

func (*DbResource) UpdateWithoutFilters added in v0.6.5

func (dbResource *DbResource) UpdateWithoutFilters(obj interface{}, req api2go.Request, updateTransaction *sqlx.Tx) (map[string]interface{}, error)

Update an object Possible Responder status codes are: - 200 OK: Update successful, however some field(s) were changed, returns updates source - 202 Accepted: Processing is delayed, return nothing - 204 No Content: Update was successful, no fields were changed by the server, return nothing

func (*DbResource) UserGroupNameToId added in v0.6.5

func (dbResource *DbResource) UserGroupNameToId(groupName string) (uint64, error)

UserGroupNameToId Converts group name to the internal integer id

func (*DbResource) UserGroupNameToIdWithTransaction added in v0.9.9

func (dbResource *DbResource) UserGroupNameToIdWithTransaction(groupName string, transaction *sqlx.Tx) (uint64, error)

UserGroupNameToId Converts group name to the internal integer id

func (*DbResource) ValidateOAuthTokenForIntegrationExecution added in v0.12.3

func (dbResource *DbResource) ValidateOAuthTokenForIntegrationExecution(
	tokenReferenceId daptinid.DaptinReferenceId,
	userId int64,
	oauthConnectReferenceId daptinid.DaptinReferenceId,
	transaction *sqlx.Tx,
) error

type DefaultTaskScheduler added in v0.6.9

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

func (*DefaultTaskScheduler) AddTask added in v0.6.9

func (dts *DefaultTaskScheduler) AddTask(task task.Task) error

func (*DefaultTaskScheduler) StartTasks added in v0.6.9

func (dts *DefaultTaskScheduler) StartTasks()

func (*DefaultTaskScheduler) StopTasks added in v0.9.0

func (dts *DefaultTaskScheduler) StopTasks()

type EventJob added in v0.11.4

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

EventJob represents an event publishing job

type EventMetrics added in v0.11.4

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

EventMetrics tracks event publishing metrics

type EventWorkerPool added in v0.11.4

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

EventWorkerPool manages event publishing workers

func GetEventWorkerPool added in v0.11.4

func GetEventWorkerPool() *EventWorkerPool

GetEventWorkerPool returns the global event worker pool (singleton)

func (*EventWorkerPool) PublishEvent added in v0.11.4

func (p *EventWorkerPool) PublishEvent(topic *olric.PubSub, tableName string, message WsOutMessage)

PublishEvent queues an event for publishing

type ExchangeContract

type ExchangeContract struct {
	Name             string
	SourceAttributes map[string]interface{} `db:"source_attributes"`
	Attributes       map[string]interface{} `db:"attributes"`
	SourceType       string                 `db:"source_type"`
	TargetAttributes map[string]interface{} `db:"target_attributes"`
	TargetType       string                 `db:"target_type"`
	User             auth.SessionUser
	Options          map[string]interface{}
	ReferenceId      string `db:"reference_id"`
	AsUserId         int64
}

type ExchangeExecution

type ExchangeExecution struct {
	ExchangeContract ExchangeContract
	// contains filtered or unexported fields
}

func NewExchangeExecution

func NewExchangeExecution(exchange ExchangeContract, cruds *map[string]*DbResource) *ExchangeExecution

func (*ExchangeExecution) Execute

func (exchangeExecution *ExchangeExecution) Execute(data []map[string]interface{}, transaction *sqlx.Tx) (result map[string]interface{}, err error)

type ExchangeInterface

type ExchangeInterface interface {
	Update(target string, data []map[string]interface{}) error
}

type ExternalExchange

type ExternalExchange interface {
	ExecuteTarget(row map[string]interface{}, transaction *sqlx.Tx) (map[string]interface{}, error)
}

func NewActionExchangeHandler added in v0.9.9

func NewActionExchangeHandler(exchangeContract ExchangeContract, cruds map[string]*DbResource) ExternalExchange

func NewRestExchangeHandler

func NewRestExchangeHandler(exchangeContext ExchangeContract) (ExternalExchange, error)

type Faker added in v0.2.1

type Faker interface {
	Fake() string
}

type FuzzySearchOptions added in v0.11.4

type FuzzySearchOptions struct {
	Threshold    float64 `json:"threshold,omitempty"`     // Similarity threshold for PostgreSQL (0.0-1.0)
	MaxDistance  int     `json:"max_distance,omitempty"`  // Max Levenshtein distance
	SearchType   string  `json:"search_type,omitempty"`   // "trigram", "fulltext", "soundex", "partial"
	FallbackMode string  `json:"fallback_mode,omitempty"` // "strict", "partial", "soundex" for non-PostgreSQL
}

type Group added in v0.6.8

type Group struct {
	ColumnName string `json:"column"`
	Order      string `json:"order"`
}

type Integration added in v0.9.0

type Integration struct {
	Name                        string
	SpecificationLanguage       string
	SpecificationFormat         string
	Specification               string
	AuthenticationType          string
	AuthenticationSpecification string
	Enable                      bool
}

type MeteringContext added in v0.11.7

type MeteringContext struct {
	Request       *http.Request
	User          *auth.SessionUser
	Endpoint      string
	Method        string
	EntityType    string
	ActionName    string
	RequestType   string
	StatusCode    int
	LatencyMS     int
	RequestBytes  int
	ResponseBytes int
	Metering      *table_info.MeteringConfig
	Metadata      map[string]interface{}
	Response      map[string]interface{}
}

type MeteringDecision added in v0.11.7

type MeteringDecision struct {
	Enabled      bool
	Allowed      bool
	EnforceMode  string
	MeterType    string
	CostExpr     string
	PlanID       int64
	MemberID     int64
	QuotaID      int64
	Plan         map[string]interface{}
	Member       map[string]interface{}
	Quota        map[string]interface{}
	ErrorMessage string
}

type MeteringMiddleware added in v0.11.7

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

func (*MeteringMiddleware) InterceptAfter added in v0.11.7

func (m *MeteringMiddleware) InterceptAfter(dr *DbResource, req *api2go.Request, rows []map[string]interface{}, tx *sqlx.Tx) ([]map[string]interface{}, error)

func (*MeteringMiddleware) InterceptBefore added in v0.11.7

func (m *MeteringMiddleware) InterceptBefore(dr *DbResource, req *api2go.Request, rows []map[string]interface{}, tx *sqlx.Tx) ([]map[string]interface{}, error)

func (*MeteringMiddleware) String added in v0.11.7

func (m *MeteringMiddleware) String() string

type MeteringService added in v0.11.7

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

func NewMeteringService added in v0.11.7

func NewMeteringService(cruds *map[string]*DbResource) *MeteringService

func (*MeteringService) Preflight added in v0.11.7

func (m *MeteringService) Preflight(ctx MeteringContext, tx *sqlx.Tx) (*MeteringDecision, error)

func (*MeteringService) Record added in v0.11.7

func (m *MeteringService) Record(ctx MeteringContext, decision *MeteringDecision, tx *sqlx.Tx) error

type MiddlewareSet

type MiddlewareSet struct {
	BeforeCreate  []DatabaseRequestInterceptor
	BeforeFindAll []DatabaseRequestInterceptor
	BeforeFindOne []DatabaseRequestInterceptor
	BeforeUpdate  []DatabaseRequestInterceptor
	BeforeDelete  []DatabaseRequestInterceptor

	AfterCreate  []DatabaseRequestInterceptor
	AfterFindAll []DatabaseRequestInterceptor
	AfterFindOne []DatabaseRequestInterceptor
	AfterUpdate  []DatabaseRequestInterceptor
	AfterDelete  []DatabaseRequestInterceptor
}

type OAuthIssuedToken added in v0.11.6

type OAuthIssuedToken struct {
	AccessToken  string
	RefreshToken string
	ExpiresIn    int64
	Scope        string
}

type OAuthProvider added in v0.11.6

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

func NewOAuthProvider added in v0.11.6

func NewOAuthProvider(cruds map[string]*DbResource, configStore *ConfigStore) *OAuthProvider

func (*OAuthProvider) ActiveSigningKey added in v0.11.6

func (op *OAuthProvider) ActiveSigningKey(transaction *sqlx.Tx) (*OAuthSigningKey, error)

func (*OAuthProvider) AuthenticateClient added in v0.11.6

func (op *OAuthProvider) AuthenticateClient(clientID string, clientSecret string, transaction *sqlx.Tx) (map[string]interface{}, error)

func (*OAuthProvider) BeginTransaction added in v0.11.6

func (op *OAuthProvider) BeginTransaction() (*sqlx.Tx, error)

func (*OAuthProvider) CreateCode added in v0.11.6

func (op *OAuthProvider) CreateCode(sessionUser *auth.SessionUser, app map[string]interface{}, redirectURI string, scope string, codeChallenge string, codeChallengeMethod string, nonce string, transaction *sqlx.Tx) (string, error)

func (*OAuthProvider) ExchangeCode added in v0.11.6

func (op *OAuthProvider) ExchangeCode(app map[string]interface{}, code string, redirectURI string, codeVerifier string, transaction *sqlx.Tx) (*OAuthIssuedToken, map[string]interface{}, map[string]interface{}, error)

func (*OAuthProvider) GetAppByClientID added in v0.11.6

func (op *OAuthProvider) GetAppByClientID(clientID string, transaction *sqlx.Tx) (map[string]interface{}, error)

func (*OAuthProvider) HasGrant added in v0.11.6

func (op *OAuthProvider) HasGrant(app map[string]interface{}, grantType string) bool

func (*OAuthProvider) Issuer added in v0.11.6

func (op *OAuthProvider) Issuer(req *http.Request, transaction *sqlx.Tx) string

func (*OAuthProvider) JWKS added in v0.11.6

func (op *OAuthProvider) JWKS(transaction *sqlx.Tx) ([]map[string]interface{}, error)

func (*OAuthProvider) NormalizeScopes added in v0.11.6

func (op *OAuthProvider) NormalizeScopes(app map[string]interface{}, requested string) (string, error)

func (*OAuthProvider) Refresh added in v0.11.6

func (op *OAuthProvider) Refresh(app map[string]interface{}, refreshToken string, transaction *sqlx.Tx) (*OAuthIssuedToken, map[string]interface{}, error)

func (*OAuthProvider) RevokeToken added in v0.11.6

func (op *OAuthProvider) RevokeToken(token string, transaction *sqlx.Tx) error

func (*OAuthProvider) RowBelongsToApp added in v0.11.6

func (op *OAuthProvider) RowBelongsToApp(row map[string]interface{}, app map[string]interface{}) bool

func (*OAuthProvider) SignIDToken added in v0.11.6

func (op *OAuthProvider) SignIDToken(claims map[string]interface{}, transaction *sqlx.Tx) (string, error)

func (*OAuthProvider) ValidateAccessToken added in v0.11.6

func (op *OAuthProvider) ValidateAccessToken(token string, transaction *sqlx.Tx) (map[string]interface{}, map[string]interface{}, error)

func (*OAuthProvider) ValidateRedirectURI added in v0.11.6

func (op *OAuthProvider) ValidateRedirectURI(app map[string]interface{}, redirectURI string) bool

type OAuthSigningKey added in v0.11.6

type OAuthSigningKey struct {
	KeyID      string
	PrivateKey *rsa.PrivateKey
	JWK        map[string]interface{}
}

type ObjectAccessPermissionChecker added in v0.2.1

type ObjectAccessPermissionChecker struct {
}

func (*ObjectAccessPermissionChecker) InterceptAfter added in v0.2.1

func (pc *ObjectAccessPermissionChecker) InterceptAfter(dr *DbResource, req *api2go.Request, results []map[string]interface{}, transaction *sqlx.Tx) ([]map[string]interface{}, error)

func (*ObjectAccessPermissionChecker) InterceptBefore added in v0.2.1

func (pc *ObjectAccessPermissionChecker) InterceptBefore(dr *DbResource, req *api2go.Request, results []map[string]interface{}, transaction *sqlx.Tx) ([]map[string]interface{}, error)

func (*ObjectAccessPermissionChecker) String added in v0.2.1

type PaginatedResultCallback added in v0.11.4

type PaginatedResultCallback func([]map[string]interface{}) error

PaginatedResultCallback is a function that processes each batch of results

type PaginationData added in v0.6.5

type PaginationData struct {
	PageNumber uint64
	PageSize   uint64
	TotalCount uint64
}

type Query added in v0.6.8

type Query struct {
	ColumnName   string              `json:"column"`
	Operator     string              `json:"operator"`
	Value        interface{}         `json:"value"`
	LogicalGroup string              `json:"logical_group,omitempty"` // For OR operations within groups
	FuzzyOptions *FuzzySearchOptions `json:"fuzzy_options,omitempty"` // Configuration for fuzzy search
}

type ResolvedDefaultGroup added in v0.11.7

type ResolvedDefaultGroup struct {
	GroupId    int64
	Permission *auth.AuthPermission
}

func ResolveDefaultGroups added in v0.11.7

func ResolveDefaultGroups(db database.DatabaseConnection, groups table_info.DefaultGroupList, strict bool) ([]ResolvedDefaultGroup, error)

func ResolveDefaultGroupsWithTransaction added in v0.11.7

func ResolveDefaultGroupsWithTransaction(transaction *sqlx.Tx, groups table_info.DefaultGroupList, strict bool) ([]ResolvedDefaultGroup, error)

type RestExchange

type RestExchange struct {
	Name        string
	Method      string
	Url         string
	Headers     map[string]interface{}
	Body        map[string]interface{}
	QueryParams map[string]interface{}
}

type RestExternalExchange

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

func (*RestExternalExchange) ExecuteTarget

func (g *RestExternalExchange) ExecuteTarget(row map[string]interface{}, transaction *sqlx.Tx) (map[string]interface{}, error)

type StatusResponse

type StatusResponse struct {
	Message string
}

type StreamContract added in v0.4.0

type StreamContract struct {
	StreamName      string
	RootEntityName  string
	Columns         []api2go.ColumnInfo
	Relations       []api2go.TableRelation
	Transformations []Transformation
	QueryParams     map[string][]string
}

Stream contract defines column mappings and transformations. Also includes the query params which are to be used in the first place

type StreamProcessor added in v0.4.0

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

StreamProcess handles the Read operations, and applies transformations on the data the create a new view

func NewStreamProcessor added in v0.4.0

func NewStreamProcessor(stream StreamContract, cruds map[string]*DbResource) *StreamProcessor

Creates a new stream processor which will apply the given contract

func (*StreamProcessor) Create added in v0.4.0

func (dr *StreamProcessor) Create(obj interface{}, req api2go.Request) (api2go.Responder, error)

Create implementation in accordance with JSONAPI Create is not implemented for streams

func (*StreamProcessor) Delete added in v0.4.0

func (dr *StreamProcessor) Delete(id string, req api2go.Request) (api2go.Responder, error)

Delete implementation in accordance with JSONAPI Delete is not implemented for streams

func (*StreamProcessor) FindOne added in v0.4.0

func (dr *StreamProcessor) FindOne(ID string, req api2go.Request) (api2go.Responder, error)

FindOne implementation in accordance with JSONAPI FindOne is not implemented for streams

func (*StreamProcessor) GetContract added in v0.4.0

func (dr *StreamProcessor) GetContract() StreamContract

Get the contract

func (*StreamProcessor) GetName added in v0.9.0

func (dr *StreamProcessor) GetName() string

Get the contract

func (*StreamProcessor) PaginatedFindAll added in v0.4.0

func (dr *StreamProcessor) PaginatedFindAll(req api2go.Request) (totalCount uint, response api2go.Responder, err error)

FindAll implementation in accordance with JSONAPI FindAll does the initial query to the database and applites the transformation contract on the result rows

func (*StreamProcessor) Update added in v0.4.0

func (dr *StreamProcessor) Update(obj interface{}, req api2go.Request) (api2go.Responder, error)

Update implementation in accordance with JSONAPI Update is not implemented for streams

type StreamingExportWriter added in v0.11.4

type StreamingExportWriter interface {
	// Initialize prepares the writer for streaming
	Initialize(tableNames []string, includeHeaders bool, selectedColumns map[string][]string) error

	// WriteTable writes a table name header if needed
	WriteTable(tableName string) error

	// WriteHeaders writes column headers for a table
	WriteHeaders(tableName string, columns []string) error

	// WriteRows writes a batch of rows
	WriteRows(tableName string, rows []map[string]interface{}) error

	// Finalize completes the export and returns the final content
	Finalize() ([]byte, error)
}

StreamingExportWriter interface for different export format writers

type SubSiteInformation added in v0.2.1

type SubSiteInformation struct {
	SubSite    subsite.SubSite
	CloudStore rootpojo.CloudStore
	SourceRoot string
}

type TLSCertificate added in v0.11.4

type TLSCertificate struct {
	TLSConfig           *tls.Config
	CertPEM             []byte
	PrivatePEMDecrypted []byte
	PublicPEMDecrypted  []byte
	RootCert            []byte
}

type TableAccessPermissionChecker

type TableAccessPermissionChecker struct {
}

The TableAccessPermissionChecker middleware is resposible for entity level authorization check, before and after the changes

func (*TableAccessPermissionChecker) InterceptAfter

func (pc *TableAccessPermissionChecker) InterceptAfter(dr *DbResource, req *api2go.Request, results []map[string]interface{}, transaction *sqlx.Tx) ([]map[string]interface{}, error)

Intercept after check implements if the data should be returned after the data change is complete

func (*TableAccessPermissionChecker) InterceptBefore

func (pc *TableAccessPermissionChecker) InterceptBefore(dr *DbResource, req *api2go.Request,
	results []map[string]interface{}, transaction *sqlx.Tx) ([]map[string]interface{}, error)

Intercept before implemetation for entity level authentication check

func (*TableAccessPermissionChecker) String

func (pc *TableAccessPermissionChecker) String() string

type TimeStamp added in v0.6.2

type TimeStamp string

type Transformation added in v0.4.0

type Transformation struct {
	Operation  string
	Attributes map[string]interface{}
}

A Transformation is the representation of column data changing its values according to the attribute map

type WsOutMessage added in v0.11.4

type WsOutMessage struct {
	// Common
	Type string `json:"type"` // "response" | "event" | "session" | "pong"

	// Response fields (type == "response")
	Id     string `json:"id,omitempty"`     // echo of client request id
	Method string `json:"method,omitempty"` // echo of client method
	Ok     *bool  `json:"ok,omitempty"`     // success/failure
	Error  string `json:"error,omitempty"`  // error message when ok=false

	// Event fields (type == "event")
	Topic  string `json:"topic,omitempty"`  // topic name
	Event  string `json:"event,omitempty"`  // "create" | "update" | "delete" | "new-message"
	Source string `json:"source,omitempty"` // "database" or user ref id

	// Session fields (type == "session")
	Status string `json:"status,omitempty"` // "open"

	// Shared data payload — proper JSON object, not base64 bytes
	Data jsoniter.RawMessage `json:"data,omitempty"`
}

WsOutMessage is the single server→client message type on the WebSocket wire. The Type field distinguishes response/event/session messages.

func (WsOutMessage) MarshalBinary added in v0.11.4

func (e WsOutMessage) MarshalBinary() (data []byte, err error)

MarshalBinary encodes the struct into binary format for Olric PubSub transport.

func (*WsOutMessage) UnmarshalBinary added in v0.11.4

func (e *WsOutMessage) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the data from Olric PubSub binary transport.

Jump to

Keyboard shortcuts

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