UNPKG

zdata-client

Version:

TypeScript client library for zdata backend API with authentication and full CRUD operations

87 lines 4.52 kB
"use strict"; /** * @fileoverview zdata-client - TypeScript client library for zdata backend API * * A modern, type-safe client library providing authentication and full CRUD operations * for the zdata backend API with comprehensive error handling and developer experience. * * @version 1.0.0 * @author zdata-client * @license MIT */ Object.defineProperty(exports, "__esModule", { value: true }); exports.VERSION = exports.createApiClient = exports.isValidationError = exports.isInvalidCredentialsError = exports.isApiClientError = exports.ValidationError = exports.InvalidCredentialsError = exports.ApiClientError = exports.DataSourceClient = exports.BaseDataSourceClient = exports.ExternalApiClient = exports.ZDataClient = void 0; exports.createClient = createClient; // ============================================================================= // MAIN CLIENT EXPORT // ============================================================================= var client_js_1 = require("./client.js"); Object.defineProperty(exports, "ZDataClient", { enumerable: true, get: function () { return client_js_1.ZDataClient; } }); Object.defineProperty(exports, "ExternalApiClient", { enumerable: true, get: function () { return client_js_1.ExternalApiClient; } }); // ============================================================================= // BASE CLIENT EXPORTS // ============================================================================= var base_client_js_1 = require("./base-client.js"); Object.defineProperty(exports, "BaseDataSourceClient", { enumerable: true, get: function () { return base_client_js_1.BaseDataSourceClient; } }); Object.defineProperty(exports, "DataSourceClient", { enumerable: true, get: function () { return base_client_js_1.DataSourceClient; } }); // ============================================================================= // ERROR CLASS EXPORTS // ============================================================================= var types_js_1 = require("./types.js"); // Error classes Object.defineProperty(exports, "ApiClientError", { enumerable: true, get: function () { return types_js_1.ApiClientError; } }); Object.defineProperty(exports, "InvalidCredentialsError", { enumerable: true, get: function () { return types_js_1.InvalidCredentialsError; } }); Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return types_js_1.ValidationError; } }); // Type guards Object.defineProperty(exports, "isApiClientError", { enumerable: true, get: function () { return types_js_1.isApiClientError; } }); Object.defineProperty(exports, "isInvalidCredentialsError", { enumerable: true, get: function () { return types_js_1.isInvalidCredentialsError; } }); Object.defineProperty(exports, "isValidationError", { enumerable: true, get: function () { return types_js_1.isValidationError; } }); // ============================================================================= // CONVENIENCE FACTORY FUNCTION // ============================================================================= const client_js_2 = require("./client.js"); /** * Factory function to create a new zdata API client instance * * This is a convenience function that provides an alternative way to instantiate * the client without using the `new` keyword. * * @param config - Client configuration options * @returns A new ZDataClient instance * @throws {Error} When configuration is invalid * * @example * ```typescript * import { createClient } from 'zdata-client'; * * const client = createClient({ * baseUrl: 'https://api.example.com', * workspaceId: 'workspace-123' * }); * * await client.login({ email: 'user@example.com', password: 'password' }); * ``` */ function createClient(config) { return new client_js_2.ZDataClient(config); } /** * Legacy factory function name for backward compatibility * @deprecated Use createClient instead */ exports.createApiClient = createClient; // ============================================================================= // VERSION EXPORT // ============================================================================= /** * Current version of the zdata-client library */ exports.VERSION = "1.0.0"; // ============================================================================= // DEFAULT EXPORT // ============================================================================= /** * Default export - ZDataClient class */ exports.default = client_js_2.ZDataClient; //# sourceMappingURL=index.js.map