import type { DataHandler } from "@olenbetong/appframe-data"; import { type ProcedureBase } from "@olenbetong/appframe-data"; import { type NamespaceRecord, type TransactionFilter, type TransactionsRecord } from "@olenbetong/appframe-updater"; import type { Store } from "tough-cookie"; import { PersistentClient } from "./PersistentClient.js"; export declare class Server { private hostname; private username; private password; readonly client: PersistentClient; readonly dsBundles: DataHandler; readonly dsBundlesProjects: DataHandler; readonly dsDataResources: DataHandler; readonly dsNamespaces: DataHandler; readonly dsSiteScripts: DataHandler; readonly dsSiteStyles: DataHandler; readonly dsTemplates: DataHandler; readonly dsTransactions: DataHandler; readonly procCreateFirstBundleVersion: ProcedureBase; readonly procPublishBundle: ProcedureBase; readonly procPublishWebAsset: ProcedureBase; /** * Creates a server instance. If username or password is not provided, will attempt to look for * environment variables APPFRAME_LOGIN and APPFRAME_PWD. If username or password is still missing, * the login method will prompt the user if running in a TTY environment. * * @param {string} [hostname] Hostname of the server (default: dev.obet.no) * @param {string} [username] Appframe username * @param {string} [password] Appframe password */ constructor(hostname?: string, username?: string, password?: string, cookieStore?: Store); private getHostPrefix; logAsyncTask(task: Promise, runningMessage: string, completedMessage?: string | ((param: Awaited) => string | undefined)): Promise; logServerMessage(message: string): void; login(): Promise; addDataResource(id: string, name?: string): Promise; /** * Applies updates matching the namespace, or all updates if no namespace is given * * @param {string | number | undefined} namespace limit apply updates to a namespace (ID or name) */ apply(namespace?: string | number): Promise; /** * Checks that there are no transactions with a different name than `name` that matches `filter`. * Log transactions (type = 98) are not counted. If there are other transactions, an error is thrown. * * @param {string} filter - Filter to use on transactions * @param {string} name - Name of the expected transaction. * @param {string | number} namespace - Limit check to a single namespace */ assertOnlyOneTransaction(filter: string, name: string, namespace: string | number): Promise; deleteDataResource(id: string): Promise; /** * Deploys the selected namespace, or all namespaces if none is * provided. * @param {number | string} [namespace] ID of the namespace to deploy */ deploy(namespace?: string | number): Promise; /** * Check for updates to download */ checkForUpdates(): Promise<{ Namespace: string; Updates: any; }[]>; /** * Download updates for the given namespace * @param {string} namespace Name of the namespace to download */ download(namespace: string): Promise; /** * Generates transactions for the given namespace, or all namespaces if no ID is given. * * @param {number | string} [namespace] ID of the namespace to generate transactions in */ generate(namespace?: number | string): Promise; /** * Gets the bundle version for the given bundle with version 0 * * @param {string} bundleName Name of the bundle */ getBundle(bundleName: string): Promise; /** * * @param {string | number} namespace Name or ID of the namespace * @returns */ getNamespaces(options?: { forceRefresh?: boolean; }): Promise; getNamespace(namespace: string | number): Promise; /** * Get namespace argument from the command line, or let the user select from a list * if they didn't provide one. * * @param {string | undefined} namespace Namespace argument from the command line * @param {any} options Command options, potentially including an `all` property * @returns {Promise} Namespace name */ getNamespaceArgument(namespace?: string, options?: any): Promise; /** * Get resource name argument for commands. If a name is not provided by * the user, create a prompt with autocomplete to let them select it. * @param {string | undefined} resourceArg Resource argument from command line * @returns {Promise} Resource name */ getResourceArgument(resourceArg?: string): Promise; getResources(): Promise; /** * Get the definition of a data resource. * * @param {string} name Name of the data resource */ getResourceDefinition(name: string): Promise; /** * Returns a list of transactions matching the filter or type. If a namespace * is given, will also limit to that namespace. * * @param {string} filterOrType SQL filter or type (apply/deploy) to get * @param {string | number} [namespace] Name or ID of namespace to limit to * @returns List of transactions matching filter and namespace */ getTransactions(filterOrType?: TransactionFilter, namespace?: string | number): Promise<{ PrimKey: string; ID: number; Namespace: string; Name: string; CreatedBy: string; LocalCreatedBy: string; Status: number; LastError: string | null; }[]>; /** * Creates a bundle project * * @param {string} name Name of the bundle * @param {number} namespaceId ID of the namespace to add the bundle to */ createBundle(name: string, namespaceId: number): Promise; /** * Publishes a bundle * * @param {number} projectId Project ID for the bundle * @param {number} versionId ID for the project version to publish * @param {string} description Description to set on the new version */ publishBundle(projectId: number, versionId: number, description: string): Promise; /** * Publishes an article. If there is a mismatch between the latest transaction version * and the latest article version, the article will be published multiple times until * a transaction can be generated. * * @param {string} hostname Hostname of the article to publish * @param {string} articleId ID of the article to publish * @param {string} version Version comments to set as description */ /** * Publishes a site script * * @param {string} hostname Hostname where the site script is * @param {string} scriptId ID of the site script to publish * @param {string} version Version comments to set as description */ publishSiteScript(hostname: string, scriptId: string, version: string): Promise; /** * Publishes a site style * * @param {string} hostname Hostname where the site style is * @param {string} styleId ID of the site style to publish * @param {string} version Version comments to set as description */ publishSiteStyle(hostname: string, styleId: string, version: string): Promise; /** * Publish a web asset (template, script or style) * * @param {string} hostname Hostname where the asset is located * @param {string} name Name of the asset * @param {"Template" | "Script" | "Style"} type Type of asset to publish * @param {string} description Description of the update */ publishWebAsset(hostname: string, name: string, type: "Template" | "Script" | "Style", description: string): Promise; /** * Uploads a zip file to an AF bundle project * * @param {number} projectId ID for the bundle project * @param {number} versionId Version ID for version 0 of the bundle * @param {string} file Path to the zip file */ uploadBundle(projectId: string, versionId: number, file: string): Promise; /** * Uploads a template * * @param {string} hostname Hostname where the template is * @param {string} templateId ID of the template to upload * @param {string | undefined} content Content to upload for production use (undefined will not modify existing template) * @param {string | undefined} contentTest Content to upload for test mode use (undefined will not modify existing template) */ uploadTemplate(hostname: string, templateId: string, content?: string, contentTest?: string): Promise; /** * Uploads a site script * * @param {string} hostname Hostname where the site script is * @param {string} scriptId ID of the site script to upload * @param {string | undefined} content Content to upload for production use (undefined will not modify existing script) * @param {string | undefined} contentTest Content to upload for test mode use (undefined will not modify existing script) */ uploadSiteScript(hostname: string, scriptId: string, content?: string, contentTest?: string): Promise; /** * Uploads a site style * * @param {string} hostname Hostname where the site style is * @param {string} styleId ID of the site style to upload * @param {string | undefined} content Content to upload for production use (undefined will not modify existing stylesheet) * @param {string | undefined} contentTest Content to upload for test mode use (undefined will not modify existing stylesheet) */ uploadSiteStyle(hostname: string, styleId: string, content?: string, contentTest?: string): Promise; }