diff --git a/dist/index.cjs b/dist/index.cjs new file mode 100644 index 0000000..af878c3 --- /dev/null +++ b/dist/index.cjs @@ -0,0 +1,10825 @@ +'use strict'; + +var typebox = require('@sinclair/typebox'); +var value = require('@sinclair/typebox/value'); +var rxjs = require('rxjs'); +var ws = require('ws'); +var buffer = require('buffer'); + +var __defProp = Object.defineProperty; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __esm = (fn, res) => function __init() { + return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res; +}; +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); +}; + +// src/exceptions/command-error.ts +exports.CommandError = void 0; +var init_command_error = __esm({ + "src/exceptions/command-error.ts"() { + exports.CommandError = class extends Error { + constructor(commandName, message) { + super(`Command "${commandName}" failed with: ${message}`); + } + }; + } +}); + +// src/utils/local-cache.ts +var LocalCache; +var init_local_cache = __esm({ + "src/utils/local-cache.ts"() { + LocalCache = class { + constructor(defaultTtlMs) { + this.defaultTtlMs = defaultTtlMs; + } + defaultTtlMs; + cache = /* @__PURE__ */ new Map(); + timers = /* @__PURE__ */ new Map(); + get(key) { + return this.cache.get(key); + } + set(key, value, ttlMs) { + clearTimeout(this.timers.get(key)); + this.cache.set(key, value); + if (ttlMs ?? this.defaultTtlMs) { + const timer = setTimeout(() => this.cache.delete(key), ttlMs ?? this.defaultTtlMs); + this.timers.set(key, timer); + } + } + delete(key) { + clearTimeout(this.timers.get(key)); + this.cache.delete(key); + } + clear() { + for (const key of this.timers.keys()) { + clearTimeout(this.timers.get(key)); + } + this.cache.clear(); + this.timers.clear(); + } + }; + } +}); + +// src/common/tenant.cache.ts +var tenantCache; +var init_tenant_cache = __esm({ + "src/common/tenant.cache.ts"() { + init_local_cache(); + tenantCache = new LocalCache(60 * 1e3); + } +}); +var TenantSchema, TenantListItemSchema, TenantUserSchema, TenantPreviewSchema, TenantInstanceSchema; +var init_tenant = __esm({ + "src/contracts/tenant.ts"() { + TenantSchema = typebox.Type.Object({ + id: typebox.Type.String(), + name: typebox.Type.String(), + displayName: typebox.Type.String(), + description: typebox.Type.String(), + websiteUrl: typebox.Type.String(), + isDedicated: typebox.Type.Boolean(), + dedicated: typebox.Type.Union([ + typebox.Type.Null(), + typebox.Type.Object({ + status: typebox.Type.Union([ + typebox.Type.Literal("ready"), + typebox.Type.Literal("degraded"), + typebox.Type.Literal("offline") + ]), + configuration: typebox.Type.Object({ + domain: typebox.Type.String(), + configurationRepoUrl: typebox.Type.String(), + configurationRepoCredentials: typebox.Type.Union([typebox.Type.String(), typebox.Type.Null()]) + }) + }) + ]), + sensitiveDataEnabled: typebox.Type.Optional(typebox.Type.Boolean()) + }); + TenantListItemSchema = typebox.Type.Object({ + id: typebox.Type.String(), + name: typebox.Type.String(), + displayName: typebox.Type.String(), + description: typebox.Type.String(), + websiteUrl: typebox.Type.String(), + isDedicated: typebox.Type.Boolean(), + sensitiveDataEnabled: typebox.Type.Boolean(), + domain: typebox.Type.Union([typebox.Type.String(), typebox.Type.Null()]), + permissions: typebox.Type.Array(typebox.Type.String()) + }); + TenantUserSchema = typebox.Type.Object({ + id: typebox.Type.String(), + username: typebox.Type.String(), + email: typebox.Type.String(), + firstName: typebox.Type.Union([typebox.Type.String(), typebox.Type.Null()]), + lastName: typebox.Type.Union([typebox.Type.String(), typebox.Type.Null()]) + }); + TenantPreviewSchema = typebox.Type.Object({ + displayName: typebox.Type.String(), + websiteUrl: typebox.Type.String(), + description: typebox.Type.String() + }); + TenantInstanceSchema = typebox.Type.Object({ + isDedicated: typebox.Type.Boolean(), + instance: typebox.Type.Union([ + typebox.Type.Null(), + typebox.Type.Object({ + status: typebox.Type.String(), + domain: typebox.Type.String() + }) + ]) + }); + } +}); + +// src/exceptions/not-found.ts +exports.NotFoundException = void 0; +var init_not_found = __esm({ + "src/exceptions/not-found.ts"() { + exports.NotFoundException = class extends Error { + constructor(resource, filters) { + super(`${resource} not found: ${JSON.stringify(filters)}`); + } + }; + } +}); + +// src/exceptions/invalid-response.ts +exports.InvalidResponseException = void 0; +var init_invalid_response = __esm({ + "src/exceptions/invalid-response.ts"() { + exports.InvalidResponseException = class extends Error { + constructor(message, errors) { + const errorString = JSON.stringify(errors); + super(`${message}: ${errorString.slice(0, 1e3)}`); + this.errors = errors; + this.errors = errors; + } + errors; + }; + } +}); +exports.parseResponseHelper = void 0; +var init_parse_response_helper = __esm({ + "src/utils/parse-response-helper.ts"() { + init_invalid_response(); + exports.parseResponseHelper = (schema, response) => { + if (!value.Value.Check(schema, response)) { + const parseErrors = value.Value.Errors(schema, response); + const errors = {}; + for (const error of parseErrors) { + errors[error.path] = error.message; + } + throw new exports.InvalidResponseException("Invalid response", errors); + } + return response; + }; + } +}); + +// src/commands/tenant/tenant-instance.fetch.ts +var tenant_instance_fetch_exports = {}; +__export(tenant_instance_fetch_exports, { + TenantInstanceFetchCommand: () => exports.TenantInstanceFetchCommand +}); +exports.TenantInstanceFetchCommand = void 0; +var init_tenant_instance_fetch = __esm({ + "src/commands/tenant/tenant-instance.fetch.ts"() { + init_command(); + init_tenant(); + init_not_found(); + init_parse_response_helper(); + exports.TenantInstanceFetchCommand = class extends exports.Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + if ("tenantId" in this.input && this.input.tenantId) { + return `/api/v1/tenants/by-id/${this.input.tenantId}/instance`; + } + return `/api/v1/tenants/by-name/${this.input.tenant}/instance`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(TenantInstanceSchema, rawResponse); + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("Tenant", { + [this.input.tenantId ? "id" : "name"]: this.input.tenantId ?? this.input.tenant + }); + } + throw error; + } + }; + } +}); + +// src/common/command.ts +exports.Command = void 0; +var init_command = __esm({ + "src/common/command.ts"() { + init_command_error(); + init_tenant_cache(); + exports.Command = class { + /** + * Whether the command should retry on failure + */ + retryOnFailure = true; + /** + * The dedicated subdomain for the command + */ + dedicatedSubdomain; + /** + * The allowed modes for the command + */ + allowedModes = ["apiKey", "bearer"]; + /** + * The input for the command + */ + input; + /** + * The client auth options + */ + clientAuthOptions = {}; + constructor(input) { + this.input = input; + } + /** + * Set the client auth options - this is called by the FlowcoreClient + * before executing the command + */ + setClientAuthOptions(options) { + Object.assign(this.clientAuthOptions, options); + } + /** + * Get the dedicated base URL + */ + async getDedicatedBaseUrl(client) { + if (!this.dedicatedSubdomain) { + return null; + } + const inputTenant = typeof this.input === "object" && this.input !== null && "tenant" in this.input && typeof this.input.tenant === "string" && this.input.tenant; + if (!inputTenant) { + return null; + } + let tenant = tenantCache.get(inputTenant); + if (!tenant) { + const { TenantInstanceFetchCommand: TenantInstanceFetchCommand2 } = await Promise.resolve().then(() => (init_tenant_instance_fetch(), tenant_instance_fetch_exports)); + tenant = await client.execute(new TenantInstanceFetchCommand2({ tenant: inputTenant })); + tenantCache.set(inputTenant, tenant); + } + if (!tenant.isDedicated) { + return null; + } + if (!tenant.instance?.domain) { + throw new exports.CommandError(this.constructor.name, `Tenant ${inputTenant} does not have a dedicated domain configured`); + } + return `https://${this.dedicatedSubdomain}.${tenant.instance.domain}`; + } + /** + * Get the method for the request + */ + getMethod() { + return "POST"; + } + /** + * Get the path for the request + */ + getPath() { + return "/"; + } + /** + * Get the body for the request + */ + getBody() { + if (this.getMethod() === "GET") { + return void 0; + } + return this.input ?? void 0; + } + /** + * Get the headers for the request + */ + getHeaders() { + return typeof this.getBody() === "object" ? { + "Content-Type": "application/json" + } : {}; + } + /** + * Handle the client error + */ + handleClientError(error) { + throw error; + } + /** + * Get the request object + */ + async getRequest(client, direct) { + return { + allowedModes: this.allowedModes, + body: this.getBody(), + headers: this.getHeaders(), + baseUrl: direct ? this.getBaseUrl() : await this.getDedicatedBaseUrl(client) ?? this.getBaseUrl(), + path: this.getPath(), + method: this.getMethod(), + parseResponse: this.parseResponse.bind(this), + processResponse: this.processResponse.bind(this), + handleClientError: this.handleClientError.bind(this), + retryOnFailure: this.retryOnFailure + }; + } + /** + * Wait for the response + */ + async processResponse(_client, response) { + return response; + } + }; + } +}); + +// src/commands/ai-agent-coordinator/artifact-get.command.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var ArtifactSchema = typebox.Type.Object({ + artifactId: typebox.Type.String({ example: "artifact_code_123" }), + artifactType: typebox.Type.Union([ + typebox.Type.Literal("code"), + typebox.Type.Literal("markdown"), + typebox.Type.Literal("table"), + typebox.Type.Literal("visualization"), + typebox.Type.Literal("html"), + typebox.Type.Literal("mermaid") + ], { description: "Type of artifact" }), + title: typebox.Type.String({ example: "Example Code Snippet" }), + content: typebox.Type.Optional(typebox.Type.String({ description: "String content" })), + data: typebox.Type.Optional(typebox.Type.Unknown({ description: "JSON data" })), + url: typebox.Type.Optional(typebox.Type.String({ format: "uri", description: "URL content" })) +}); +var ArtifactGetCommand = class extends exports.Command { + getMethod() { + return "GET"; + } + getBaseUrl() { + return "https://ai-coordinator.api.flowcore.io"; + } + getPath() { + return `/api/v1/artifacts/${this.input.artifactId}`; + } + getHeaders() { + return { + "Accept": "application/json" + }; + } + parseResponse(rawResponse) { + const response = exports.parseResponseHelper(ArtifactSchema, rawResponse); + return response; + } + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("Artifact", { id: this.input.artifactId }); + } + throw error; + } +}; + +// src/commands/ai-agent-coordinator/context-add-item.command.ts +init_command(); +var service = "ai-coordinator"; +var baseUrl = `https://${service}.api.flowcore.io`; +var ContextAddItemCommand = class extends exports.Command { + getBaseUrl() { + return baseUrl; + } + getMethod() { + return "POST"; + } + getPath() { + return `/api/v1/conversations/${this.input.conversationId}/context/add`; + } + getBody() { + return { items: this.input.items }; + } + // Headers will be handled by base class based on getBody() + parseResponse(response) { + const data = response; + if (data?.context && Array.isArray(data.context)) { + return data; + } else { + throw new Error("Invalid response format for ContextAddItemCommand"); + } + } +}; + +// src/commands/ai-agent-coordinator/context-remove-item.command.ts +init_command(); +var service2 = "ai-coordinator"; +var baseUrl2 = `https://${service2}.api.flowcore.io`; +var ContextRemoveItemCommand = class extends exports.Command { + getBaseUrl() { + return baseUrl2; + } + getMethod() { + return "POST"; + } + getPath() { + return `/api/v1/conversations/${this.input.conversationId}/context/remove`; + } + getBody() { + return { itemId: this.input.itemId }; + } + parseResponse(response) { + const data = response; + if (data?.context && Array.isArray(data.context)) { + return data; + } else { + throw new Error("Invalid response format for ContextRemoveItemCommand"); + } + } +}; + +// src/commands/ai-agent-coordinator/conversation-delete.command.ts +init_command(); +var service3 = "ai-coordinator"; +var baseUrl3 = `https://${service3}.api.flowcore.io`; +var ConversationDeleteCommand = class extends exports.Command { + getBaseUrl() { + return baseUrl3; + } + getMethod() { + return "DELETE"; + } + getPath() { + return `/api/v1/conversations/${this.input.conversationId}`; + } + // No need to override getBody or getHeaders for DELETE with no body + parseResponse(response) { + const data = response; + if (data?.message) { + return data; + } else { + throw new Error("Invalid response format for ConversationDeleteCommand"); + } + } + // No specific error handling needed for DELETE beyond the base implementation (re-throw) +}; + +// src/commands/ai-agent-coordinator/conversation-get.command.ts +init_command(); + +// src/exceptions/client-error.ts +var ClientError = class extends Error { + constructor(message, status, command, body) { + super(`${command} failed with ${status}: ${body ? JSON.stringify(body) : message}`); + this.status = status; + this.command = command; + this.body = body; + } + status; + command; + body; +}; + +// src/exceptions/index.ts +init_invalid_response(); +init_not_found(); +init_command_error(); + +// src/commands/ai-agent-coordinator/conversation-get.command.ts +var service4 = "ai-coordinator"; +var baseUrl4 = `https://${service4}.api.flowcore.io`; +var ConversationGetCommand = class extends exports.Command { + getBaseUrl() { + return baseUrl4; + } + getMethod() { + return "GET"; + } + getPath() { + return `/api/v1/conversations/${this.input.conversationId}`; + } + parseResponse(response) { + const data = response; + if (data?.id) { + return data; + } else { + throw new Error("Invalid response format for ConversationGetCommand"); + } + } + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException( + "Conversation", + { conversationId: this.input.conversationId } + ); + } + throw error; + } +}; + +// src/commands/ai-agent-coordinator/conversation-list.command.ts +init_command(); +var service5 = "ai-coordinator"; +var baseUrl5 = `https://${service5}.api.flowcore.io`; +var ConversationListCommand = class extends exports.Command { + constructor() { + super({}); + } + getBaseUrl() { + return baseUrl5; + } + getMethod() { + return "GET"; + } + getPath() { + return `/api/v1/conversations`; + } + parseResponse(response) { + const data = response; + if (data && Array.isArray(data.conversations)) { + return data.conversations; + } else { + throw new Error("Invalid response format for ConversationListCommand"); + } + } +}; + +// src/commands/ai-agent-coordinator/conversation-stream.command.ts +var ConversationStreamCommand = class { + config; + constructor(config) { + if (!config.conversationId) { + throw new Error("conversationId is required in the config for ConversationStreamCommand"); + } + this.config = config; + } + /** Get the configuration object for the command. */ + getConfig() { + return this.config; + } + /** Get the base WebSocket URL. */ + getWebSocketBaseUrl() { + return "wss://ai-coordinator.api.flowcore.io"; + } + /** Get the WebSocket path segment. */ + getWebSocketPathSegment() { + return `api/v1/stream/${this.config.conversationId ? `${this.config.conversationId}` : ""}`; + } + /** Serializer function for outgoing payloads. */ + serializeSendPayload(payload) { + return JSON.stringify({ + type: "message", + // Example type, adjust as needed + payload + // Send the original payload nested + }); + } +}; + +// src/commands/tenant/tenant.disable-sensitive-data.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var responseSchema = typebox.Type.Object({ + sensitiveDataEnabled: typebox.Type.Boolean() +}); +var TenantDisableSensitiveDataCommand = class extends exports.Command { + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/tenants/${this.input.tenantId}/disable-sensitive-data`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = exports.parseResponseHelper(responseSchema, rawResponse); + return response; + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("Tenant", { + id: this.input.tenantId + }); + } + throw error; + } +}; + +// src/commands/tenant/tenant.enable-sensitive-data.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var responseSchema2 = typebox.Type.Object({ + sensitiveDataEnabled: typebox.Type.Boolean() +}); +var TenantEnableSensitiveDataCommand = class extends exports.Command { + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/tenants/${this.input.tenantId}/enable-sensitive-data`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = exports.parseResponseHelper(responseSchema2, rawResponse); + return response; + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("Tenant", { + id: this.input.tenantId + }); + } + throw error; + } +}; + +// src/commands/tenant/tenant.create.ts +init_command(); +init_tenant(); +init_parse_response_helper(); +var responseSchema3 = typebox.Type.Object({ + ...TenantSchema.properties, + dedicated: typebox.Type.Union([ + typebox.Type.Null(), + typebox.Type.Object({ + // parse as string to avoid SDK failures if new statuses are added + status: typebox.Type.String(), + configuration: typebox.Type.Object({ + domain: typebox.Type.String(), + configurationRepoUrl: typebox.Type.String(), + configurationRepoCredentials: typebox.Type.String() + }) + }) + ]), + configured: typebox.Type.Boolean(), + sensitiveDataEnabled: typebox.Type.Boolean() +}); +var TenantCreateCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/tenants`; + } + /** + * Get the body for the request + */ + getBody() { + const { tenantSlug, description, displayName } = this.input; + return { + tenant_slug: tenantSlug, + ...description !== void 0 && { description }, + ...displayName !== void 0 && { displayName } + }; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = exports.parseResponseHelper(responseSchema3, rawResponse); + return response; + } +}; + +// src/commands/tenant/tenant.fetch.ts +init_command(); +init_tenant(); +init_not_found(); +init_parse_response_helper(); +var responseSchema4 = typebox.Type.Object({ + ...TenantSchema.properties, + dedicated: typebox.Type.Union([ + typebox.Type.Null(), + typebox.Type.Object({ + // parse as string to prevent sdk to fail when new status are added + status: typebox.Type.String(), + configuration: typebox.Type.Object({ + domain: typebox.Type.String(), + configurationRepoUrl: typebox.Type.String(), + configurationRepoCredentials: typebox.Type.Union([typebox.Type.String(), typebox.Type.Null()]) + }) + }) + ]) +}); +var TenantFetchCommand = class extends exports.Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + if ("tenantId" in this.input) { + return `/api/v1/tenants/by-id/${this.input.tenantId}`; + } + return `/api/v1/tenants/by-name/${this.input.tenant}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = exports.parseResponseHelper(responseSchema4, rawResponse); + return response; + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("Tenant", { + [this.input.tenantId ? "id" : "name"]: this.input.tenantId ?? this.input.tenant + }); + } + throw error; + } +}; + +// src/commands/index.ts +init_tenant_instance_fetch(); + +// src/commands/tenant/tenant.list.ts +init_command(); +init_tenant(); +init_parse_response_helper(); +var TenantListCommand = class extends exports.Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + const query = new URLSearchParams(); + if (this.input.page !== void 0) { + query.set("page", this.input.page.toString()); + } + if (this.input.limit !== void 0) { + query.set("limit", this.input.limit.toString()); + } + if (this.input.ids !== void 0) { + const ids = Array.isArray(this.input.ids) ? this.input.ids.join(",") : this.input.ids; + query.set("ids", ids); + } + const qs = query.toString(); + return qs ? `/api/v1/tenants/list?${qs}` : `/api/v1/tenants/list`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = exports.parseResponseHelper(typebox.Type.Array(TenantListItemSchema), rawResponse); + return response; + } +}; + +// src/commands/tenant/tenant.update.ts +init_command(); +init_tenant(); +init_command_error(); +init_not_found(); +init_parse_response_helper(); +var responseSchema5 = typebox.Type.Object({ + ...TenantSchema.properties, + dedicated: typebox.Type.Union([ + typebox.Type.Null(), + typebox.Type.Object({ + // parse as string to prevent sdk to fail when new status are added + status: typebox.Type.String(), + configuration: typebox.Type.Object({ + domain: typebox.Type.String(), + configurationRepoUrl: typebox.Type.String(), + configurationRepoCredentials: typebox.Type.String() + }) + }) + ]), + configured: typebox.Type.Boolean(), + sensitiveDataEnabled: typebox.Type.Boolean() +}); +var TenantUpdateCommand = class extends exports.Command { + /** + * Get the method + */ + getMethod() { + return "PATCH"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/tenants/${this.input.tenantId}`; + } + /** + * Get the body for the request + */ + getBody() { + const { tenantId: _tenantId, ...payload } = this.input; + const updateFields = Object.fromEntries( + Object.entries(payload).filter(([_, value]) => value !== void 0) + ); + if (Object.keys(updateFields).length === 0) { + throw new exports.CommandError(this.constructor.name, "No fields to update"); + } + return updateFields; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = exports.parseResponseHelper(responseSchema5, rawResponse); + return response; + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("Tenant", { id: this.input.tenantId }); + } + throw error; + } +}; + +// src/commands/tenant/tenant.user-add.ts +init_command(); +init_parse_response_helper(); +var TenantUserAddCommand = class extends exports.Command { + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/tenants/${this.input.tenantId}/add-user`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = exports.parseResponseHelper( + typebox.Type.Object({ + success: typebox.Type.Boolean() + }), + rawResponse + ); + return response.success; + } +}; + +// src/commands/tenant/tenant.user-remove.ts +init_command(); +init_parse_response_helper(); +var TenantUserRemoveCommand = class extends exports.Command { + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/tenants/${this.input.tenantId}/remove-user`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = exports.parseResponseHelper( + typebox.Type.Object({ + success: typebox.Type.Boolean() + }), + rawResponse + ); + return response.success; + } +}; + +// src/common/command-custom.ts +init_command(); +var CustomCommand = class extends exports.Command { + /** + * Get the base URL for the request + */ + getBaseUrl() { + return "NONE"; + } + /** + * Get the request object + */ + async getRequest(client, direct) { + return { + ...await super.getRequest(client, direct), + customExecute: this.customExecute.bind(this) + }; + } + /** + * Parse the response + */ + parseResponse(response) { + return response; + } +}; + +// src/commands/iam/tenant/user-managed-roles.ts +init_command(); +init_parse_response_helper(); +var TenantUserManagedRolesSchema = typebox.Type.Record( + typebox.Type.String(), + typebox.Type.Array(typebox.Type.String()) +); +var TenantUserManagedRolesCommand = class extends exports.Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/tenants/${this.input.tenantId}/user-managed-roles`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = exports.parseResponseHelper(TenantUserManagedRolesSchema, rawResponse); + return response; + } +}; + +// src/commands/tenant/tenant.user-list-inner.ts +init_command(); +init_tenant(); +init_parse_response_helper(); +var TenantUserListInnerCommand = class extends exports.Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/tenants/${this.input.tenantId}/users`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = exports.parseResponseHelper(typebox.Type.Array(TenantUserSchema), rawResponse); + return response; + } +}; + +// src/commands/tenant/tenant.user-list.ts +var TenantUserListCommand = class extends CustomCommand { + /** + * Custom execute method + */ + async customExecute(client) { + const usersCommand = new TenantUserListInnerCommand({ + tenantId: this.input.tenantId + }); + const tenantUserManagedRolesCommand = new TenantUserManagedRolesCommand({ + tenantId: this.input.tenantId + }); + const [users, tenantUserManagedRoles] = await Promise.all([ + client.execute(usersCommand), + client.execute(tenantUserManagedRolesCommand) + ]); + return users.map((user) => ({ + ...user, + managedRoles: tenantUserManagedRoles[user.id] || [] + })); + } +}; + +// src/commands/tenant/tenant.translate-name-to-id.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var TenantTranslateNameToIdSchema = typebox.Type.Object({ + id: typebox.Type.String(), + name: typebox.Type.String() +}); +var TenantTranslateNameToIdCommand = class extends exports.Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/tenants/translate-name-to-id/${this.input.tenant}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = exports.parseResponseHelper(TenantTranslateNameToIdSchema, rawResponse); + return response; + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("Tenant", { + tenant: this.input.tenant + }); + } + throw error; + } +}; + +// src/commands/tenant/tenant.preview.ts +init_command(); +init_tenant(); +init_not_found(); +init_parse_response_helper(); +var TenantPreviewCommand = class extends exports.Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/tenants/preview/${this.input.name}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(TenantPreviewSchema, rawResponse); + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("Tenant", { name: this.input.name }); + } + throw error; + } +}; + +// src/commands/api-key/api-key.create.ts +init_command(); +init_parse_response_helper(); +var ApiKeySchema = typebox.Type.Object({ + id: typebox.Type.String(), + tenantId: typebox.Type.String(), + name: typebox.Type.String(), + description: typebox.Type.String(), + maskedApiKey: typebox.Type.String(), + createdAt: typebox.Type.String(), + lastUsedAt: typebox.Type.Union([typebox.Type.String(), typebox.Type.Null()]) +}); +var ApiKeyWithValueSchema = typebox.Type.Object({ + id: typebox.Type.String(), + tenantId: typebox.Type.String(), + name: typebox.Type.String(), + description: typebox.Type.String(), + maskedApiKey: typebox.Type.String(), + createdAt: typebox.Type.String(), + lastUsedAt: typebox.Type.Union([typebox.Type.String(), typebox.Type.Null()]), + apiKey: typebox.Type.String() +}); +var ApiKeyValidationSchema = typebox.Type.Object({ + valid: typebox.Type.Boolean(), + apiKeyId: typebox.Type.Optional(typebox.Type.String()), + tenantId: typebox.Type.Optional(typebox.Type.String()) +}); + +// src/commands/api-key/api-key.create.ts +var ApiKeyCreateCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant-store.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return "/api/v1/api-keys"; + } + /** + * The allowed modes for the command. Api-key mode requires tenant-store >= + * the release that accepts AuthType.ApiKey on the api-key management routes; + * authorization is still gated by IAM grants on frn:::tenant. + */ + allowedModes = ["apiKey", "bearer"]; + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(ApiKeyWithValueSchema, rawResponse); + } +}; + +// src/commands/api-key/api-key.fetch.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var ApiKeyFetchCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant-store.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/api-keys/${this.input.apiKeyId}`; + } + /** + * The allowed modes for the command. Api-key mode requires tenant-store >= + * the release that accepts AuthType.ApiKey on the api-key management routes; + * authorization is still gated by IAM grants on frn:::tenant. + */ + allowedModes = ["apiKey", "bearer"]; + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(ApiKeySchema, rawResponse); + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("ApiKey", { id: this.input.apiKeyId }); + } + throw error; + } +}; + +// src/commands/api-key/api-key.edit.ts +init_command(); +init_parse_response_helper(); +var ApiKeyEditCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "PATCH"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant-store.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/api-keys/${this.input.apiKeyId}`; + } + /** + * The allowed modes for the command. Api-key mode requires tenant-store >= + * the release that accepts AuthType.ApiKey on the api-key management routes; + * authorization is still gated by IAM grants on frn:::tenant. + */ + allowedModes = ["apiKey", "bearer"]; + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(ApiKeySchema, rawResponse); + } +}; + +// src/commands/api-key/api-key.delete.ts +init_command(); +var ApiKeyDeleteCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "DELETE"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant-store.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/api-keys/${this.input.apiKeyId}`; + } + /** + * The allowed modes for the command. Api-key mode requires tenant-store >= + * the release that accepts AuthType.ApiKey on the api-key management routes; + * authorization is still gated by IAM grants on frn:::tenant. + */ + allowedModes = ["apiKey", "bearer"]; + /** + * Parse the response + */ + parseResponse(_rawResponse) { + return true; + } +}; + +// src/commands/api-key/api-key.list.ts +init_command(); +init_parse_response_helper(); +var ApiKeyListCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant-store.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/api-keys?tenantId=${this.input.tenantId}`; + } + /** + * The allowed modes for the command. Api-key mode requires tenant-store >= + * the release that accepts AuthType.ApiKey on the api-key management routes; + * authorization is still gated by IAM grants on frn:::tenant. + */ + allowedModes = ["apiKey", "bearer"]; + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(typebox.Type.Array(ApiKeySchema), rawResponse); + } +}; + +// src/commands/api-key/api-key.validate.ts +init_command(); +init_parse_response_helper(); +var ApiKeyValidateCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant-store.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return "/api/v1/api-keys/validate"; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(ApiKeyValidationSchema, rawResponse); + } +}; + +// src/commands/api-key/api-key.validate-with-tenant-id.ts +init_command(); +init_parse_response_helper(); +var ApiKeyValidateWithTenantIdCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant-store.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return "/api/v1/api-keys/validate-with-tenant-id"; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(ApiKeyValidationSchema, rawResponse); + } +}; + +// src/commands/aws-marketplace/aws-marketplace-customer.resolve.ts +init_command(); +typebox.Type.Union([ + typebox.Type.Literal("managed"), + typebox.Type.Literal("self-hosted") +]); +typebox.Type.Record( + typebox.Type.String(), + typebox.Type.Optional(typebox.Type.String()) +); +var AwsMarketplaceProductModeSchema = typebox.Type.Union([ + typebox.Type.Literal("basic"), + typebox.Type.Literal("dedicated") +]); +var AwsMarketplaceCustomerSchema = typebox.Type.Object({ + customerId: typebox.Type.String(), + productCode: typebox.Type.String(), + accountId: typebox.Type.String(), + metadata: typebox.Type.String(), + productMode: AwsMarketplaceProductModeSchema +}); +var AwsMarketplaceLinkSchema = typebox.Type.Object({ + linkingId: typebox.Type.String(), + awsCustomerId: typebox.Type.String(), + awsProductCode: typebox.Type.String(), + awsAccountId: typebox.Type.String(), + tenant: typebox.Type.Union([typebox.Type.String(), typebox.Type.Null()]), + tenantId: typebox.Type.String(), + contactInfo: typebox.Type.Union([typebox.Type.String(), typebox.Type.Null()]), + productProperties: typebox.Type.Union([typebox.Type.Record(typebox.Type.String(), typebox.Type.String()), typebox.Type.Null()]), + linkedAt: typebox.Type.String() +}); +var AwsMarketplaceCustomerResolveSchema = typebox.Type.Object({ + success: typebox.Type.Boolean(), + customer: AwsMarketplaceCustomerSchema +}); +var AwsMarketplaceLinkCreateSchema = typebox.Type.Object({ + success: typebox.Type.Boolean(), + linkingId: typebox.Type.String(), + status: typebox.Type.Literal("linked") +}); +var AwsMarketplaceLinkListSchema = typebox.Type.Object({ + success: typebox.Type.Boolean(), + links: typebox.Type.Array(AwsMarketplaceLinkSchema) +}); +var AwsMarketplaceLinkFetchSchema = typebox.Type.Object({ + success: typebox.Type.Boolean(), + link: AwsMarketplaceLinkSchema +}); +var AwsMarketplaceLinkDeleteSchema = typebox.Type.Object({ + success: typebox.Type.Boolean(), + linkingId: typebox.Type.String(), + status: typebox.Type.Literal("unlinked") +}); + +// src/commands/aws-marketplace/aws-marketplace-customer.resolve.ts +init_parse_response_helper(); +var AwsMarketplaceCustomerResolveCommand = class extends exports.Command { + /** + * Whether the command should retry on failure. + */ + retryOnFailure = false; + /** + * Get the method. + */ + getMethod() { + return "POST"; + } + /** + * Get the base url. + */ + getBaseUrl() { + return "https://subscription-2.api.flowcore.io"; + } + /** + * Get the path. + */ + getPath() { + return "/api/v1/aws-marketplace/customers/resolve"; + } + /** + * Parse the response. + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(AwsMarketplaceCustomerResolveSchema, rawResponse); + } +}; + +// src/commands/aws-marketplace/aws-marketplace-link.create.ts +init_command(); +init_parse_response_helper(); +var AwsMarketplaceLinkCreateCommand = class extends exports.Command { + /** + * Whether the command should retry on failure. + */ + retryOnFailure = false; + /** + * The allowed modes for the command. + */ + allowedModes = ["bearer"]; + /** + * Get the method. + */ + getMethod() { + return "POST"; + } + /** + * Get the base url. + */ + getBaseUrl() { + return "https://subscription-2.api.flowcore.io"; + } + /** + * Get the path. + */ + getPath() { + return "/api/v1/aws-marketplace/links"; + } + /** + * Parse the response. + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(AwsMarketplaceLinkCreateSchema, rawResponse); + } +}; + +// src/commands/aws-marketplace/aws-marketplace-link.delete.ts +init_command(); +init_parse_response_helper(); +var AwsMarketplaceLinkDeleteCommand = class extends exports.Command { + /** + * Whether the command should retry on failure. + */ + retryOnFailure = false; + /** + * The allowed modes for the command. + */ + allowedModes = ["bearer"]; + /** + * Get the method. + */ + getMethod() { + return "DELETE"; + } + /** + * Get the base url. + */ + getBaseUrl() { + return "https://subscription-2.api.flowcore.io"; + } + /** + * Get the path. + */ + getPath() { + const queryParams = new URLSearchParams(); + if (this.input.reason) queryParams.set("reason", this.input.reason); + const query = queryParams.toString(); + return `/api/v1/aws-marketplace/links/${this.input.linkingId}${query ? `?${query}` : ""}`; + } + /** + * Get the body. + */ + getBody() { + return void 0; + } + /** + * Parse the response. + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(AwsMarketplaceLinkDeleteSchema, rawResponse); + } +}; + +// src/commands/aws-marketplace/aws-marketplace-link.fetch.ts +init_command(); +init_parse_response_helper(); +var AwsMarketplaceLinkFetchCommand = class extends exports.Command { + /** + * Whether the command should retry on failure. + */ + retryOnFailure = false; + /** + * The allowed modes for the command. + */ + allowedModes = ["bearer"]; + /** + * Get the method. + */ + getMethod() { + return "GET"; + } + /** + * Get the base url. + */ + getBaseUrl() { + return "https://subscription-2.api.flowcore.io"; + } + /** + * Get the path. + */ + getPath() { + return `/api/v1/aws-marketplace/links/${this.input.linkingId}`; + } + /** + * Parse the response. + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(AwsMarketplaceLinkFetchSchema, rawResponse); + } +}; + +// src/commands/aws-marketplace/aws-marketplace-link.list.ts +init_command(); +init_parse_response_helper(); +var AwsMarketplaceLinkListCommand = class extends exports.Command { + /** + * Whether the command should retry on failure. + */ + retryOnFailure = false; + /** + * The allowed modes for the command. + */ + allowedModes = ["bearer"]; + /** + * Get the method. + */ + getMethod() { + return "GET"; + } + /** + * Get the base url. + */ + getBaseUrl() { + return "https://subscription-2.api.flowcore.io"; + } + /** + * Get the path. + */ + getPath() { + const queryParams = new URLSearchParams(); + if (this.input.tenant) queryParams.set("tenant", this.input.tenant); + if (this.input.tenantId) queryParams.set("tenantId", this.input.tenantId); + if (this.input.awsCustomerId) queryParams.set("awsCustomerId", this.input.awsCustomerId); + if (this.input.awsProductCode) queryParams.set("awsProductCode", this.input.awsProductCode); + return `/api/v1/aws-marketplace/links?${queryParams.toString()}`; + } + /** + * Parse the response. + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(AwsMarketplaceLinkListSchema, rawResponse); + } +}; + +// src/commands/secret/secret.create.ts +init_command(); +init_parse_response_helper(); +var SecretSchema = typebox.Type.Object({ + tenantId: typebox.Type.String(), + key: typebox.Type.String(), + description: typebox.Type.String(), + createdAt: typebox.Type.String(), + updatedAt: typebox.Type.Union([typebox.Type.String(), typebox.Type.Null()]) +}); + +// src/commands/secret/secret.create.ts +var SecretCreateCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant-store.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/tenants/${this.input.tenantId}/secrets`; + } + /** + * The allowed modes for the command + */ + allowedModes = ["bearer"]; + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(SecretSchema, rawResponse); + } +}; + +// src/commands/secret/secret.delete.ts +init_command(); +var SecretDeleteCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "DELETE"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant-store.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/tenants/${this.input.tenantId}/secrets/${this.input.key}`; + } + /** + * The allowed modes for the command + */ + allowedModes = ["bearer"]; + /** + * Parse the response + */ + parseResponse(_rawResponse) { + return true; + } +}; + +// src/commands/secret/secret.edit.ts +init_command(); +init_parse_response_helper(); +var SecretEditCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "PATCH"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant-store.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/tenants/${this.input.tenantId}/secrets/${this.input.key}`; + } + /** + * The allowed modes for the command + */ + allowedModes = ["bearer"]; + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(SecretSchema, rawResponse); + } +}; + +// src/commands/secret/secret.fetch.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var SecretFetchCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant-store.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/tenants/${this.input.tenantId}/secrets/${this.input.key}`; + } + /** + * The allowed modes for the command + */ + allowedModes = ["bearer"]; + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(SecretSchema, rawResponse); + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("Secret", { tenantId: this.input.tenantId, key: this.input.key }); + } + throw error; + } +}; + +// src/commands/secret/secret.list.ts +init_command(); +init_parse_response_helper(); +var SecretListCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant-store.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/tenants/${this.input.tenantId}/secrets`; + } + /** + * The allowed modes for the command + */ + allowedModes = ["bearer"]; + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(typebox.Type.Array(SecretSchema), rawResponse); + } +}; + +// src/commands/service-account/service-account.create.ts +init_command(); +var ServiceAccountSchema = typebox.Type.Object({ + id: typebox.Type.String(), + tenantId: typebox.Type.String(), + name: typebox.Type.String(), + description: typebox.Type.String(), + linkedUserId: typebox.Type.String(), + clientId: typebox.Type.String(), + isAdmin: typebox.Type.Boolean(), + enabled: typebox.Type.Boolean(), + createdAt: typebox.Type.String(), + updatedAt: typebox.Type.Union([typebox.Type.String(), typebox.Type.Null()]), + lastRotatedAt: typebox.Type.Union([typebox.Type.String(), typebox.Type.Null()]) +}); +var ServiceAccountWithSecretSchema = typebox.Type.Object({ + id: typebox.Type.String(), + tenantId: typebox.Type.String(), + name: typebox.Type.String(), + description: typebox.Type.String(), + linkedUserId: typebox.Type.String(), + clientId: typebox.Type.String(), + isAdmin: typebox.Type.Boolean(), + enabled: typebox.Type.Boolean(), + createdAt: typebox.Type.String(), + updatedAt: typebox.Type.Union([typebox.Type.String(), typebox.Type.Null()]), + lastRotatedAt: typebox.Type.Union([typebox.Type.String(), typebox.Type.Null()]), + clientSecret: typebox.Type.String() +}); +var ServiceAccountSecretRotationSchema = typebox.Type.Object({ + id: typebox.Type.String(), + clientId: typebox.Type.String(), + clientSecret: typebox.Type.String() +}); + +// src/commands/service-account/service-account.create.ts +init_parse_response_helper(); +var ServiceAccountCreateCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant-store.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return "/api/v1/service-accounts"; + } + /** + * The allowed modes for the command + */ + allowedModes = ["bearer"]; + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(ServiceAccountWithSecretSchema, rawResponse); + } +}; + +// src/commands/service-account/service-account.delete.ts +init_command(); +var ServiceAccountDeleteCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "DELETE"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant-store.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/service-accounts/${this.input.serviceAccountId}`; + } + /** + * Get the body + */ + getBody() { + return void 0; + } + /** + * The allowed modes for the command + */ + allowedModes = ["bearer"]; + /** + * Parse the response + */ + parseResponse() { + return true; + } +}; + +// src/commands/service-account/service-account.edit.ts +init_command(); +init_parse_response_helper(); +var ServiceAccountEditCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "PATCH"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant-store.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/service-accounts/${this.input.serviceAccountId}`; + } + /** + * Get the body + */ + getBody() { + return { + ...this.input.description !== void 0 ? { description: this.input.description } : {}, + ...this.input.enabled !== void 0 ? { enabled: this.input.enabled } : {} + }; + } + /** + * The allowed modes for the command + */ + allowedModes = ["bearer"]; + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(ServiceAccountSchema, rawResponse); + } +}; + +// src/commands/service-account/service-account.fetch.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var ServiceAccountFetchCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant-store.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/service-accounts/${this.input.serviceAccountId}`; + } + /** + * The allowed modes for the command + */ + allowedModes = ["bearer"]; + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(ServiceAccountSchema, rawResponse); + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("ServiceAccount", { id: this.input.serviceAccountId }); + } + throw error; + } +}; + +// src/commands/service-account/service-account.list.ts +init_command(); +init_parse_response_helper(); +var ServiceAccountListCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant-store.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + const queryParams = new URLSearchParams({ + tenantId: this.input.tenantId + }); + return `/api/v1/service-accounts?${queryParams.toString()}`; + } + /** + * The allowed modes for the command + */ + allowedModes = ["bearer"]; + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(typebox.Type.Array(ServiceAccountSchema), rawResponse); + } +}; + +// src/commands/service-account/service-account.rotate-secret.ts +init_command(); +init_parse_response_helper(); +var ServiceAccountRotateSecretCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant-store.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/service-accounts/${this.input.serviceAccountId}/rotate-secret`; + } + /** + * Get the body + */ + getBody() { + return void 0; + } + /** + * The allowed modes for the command + */ + allowedModes = ["bearer"]; + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(ServiceAccountSecretRotationSchema, rawResponse); + } +}; + +// src/commands/variable/variable.create.ts +init_command(); +init_parse_response_helper(); +var VariableSchema = typebox.Type.Object({ + tenantId: typebox.Type.String(), + key: typebox.Type.String(), + description: typebox.Type.String(), + value: typebox.Type.String(), + createdAt: typebox.Type.String(), + updatedAt: typebox.Type.Union([typebox.Type.String(), typebox.Type.Null()]) +}); + +// src/commands/variable/variable.create.ts +var VariableCreateCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant-store.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/tenants/${this.input.tenantId}/variables`; + } + /** + * The allowed modes for the command + */ + allowedModes = ["bearer"]; + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(VariableSchema, rawResponse); + } +}; + +// src/commands/variable/variable.delete.ts +init_command(); +var VariableDeleteCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "DELETE"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant-store.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/tenants/${this.input.tenantId}/variables/${this.input.key}`; + } + /** + * The allowed modes for the command + */ + allowedModes = ["bearer"]; + /** + * Parse the response + */ + parseResponse() { + return true; + } +}; + +// src/commands/variable/variable.edit.ts +init_command(); +init_parse_response_helper(); +var VariableEditCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "PATCH"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant-store.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/tenants/${this.input.tenantId}/variables/${this.input.key}`; + } + /** + * The allowed modes for the command + */ + allowedModes = ["bearer"]; + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(VariableSchema, rawResponse); + } +}; + +// src/commands/variable/variable.fetch.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var VariableFetchCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant-store.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/tenants/${this.input.tenantId}/variables/${this.input.key}`; + } + /** + * The allowed modes for the command + */ + allowedModes = ["bearer"]; + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(VariableSchema, rawResponse); + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("Variable", { tenantId: this.input.tenantId, key: this.input.key }); + } + throw error; + } +}; + +// src/commands/variable/variable.list.ts +init_command(); +init_parse_response_helper(); +var VariableListCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant-store.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/tenants/${this.input.tenantId}/variables`; + } + /** + * The allowed modes for the command + */ + allowedModes = ["bearer"]; + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(typebox.Type.Array(VariableSchema), rawResponse); + } +}; + +// src/commands/data-core/data-core.create.ts +init_command(); +var DataCoreSchema = typebox.Type.Object({ + /** Unique identifier for the data core */ + id: typebox.Type.String(), + /** ID of the tenant that owns this data core */ + tenantId: typebox.Type.String(), + /** Name of the tenant that owns this data core */ + tenant: typebox.Type.String(), + /** Name of the data core */ + name: typebox.Type.String(), + /** Description of the data core's purpose and contents */ + description: typebox.Type.String(), + /** Access control setting - determines if the data core is public or private */ + accessControl: typebox.Type.Union([typebox.Type.Literal("public"), typebox.Type.Literal("private")]), + /** Protection against accidental deletion */ + deleteProtection: typebox.Type.Boolean(), + /** Indicates if the data core is currently being deleted */ + isDeleting: typebox.Type.Boolean(), + /** Indicates if the data core is managed by Flowcore platform */ + isFlowcoreManaged: typebox.Type.Boolean() +}); +var DataCoreWithAccessSchema = typebox.Type.Object({ + ...DataCoreSchema.properties, + access: typebox.Type.Array( + typebox.Type.Union([typebox.Type.Literal("read"), typebox.Type.Literal("write"), typebox.Type.Literal("fetch"), typebox.Type.Literal("ingest")]) + ) +}); + +// src/commands/data-core/data-core.create.ts +init_parse_response_helper(); +var DataCoreCreateCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://data-core-2.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/data-cores`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(DataCoreSchema, rawResponse); + } +}; + +// src/commands/data-core/data-core.exists.ts +init_command(); +init_parse_response_helper(); +var DataCoreExistsCommand = class extends exports.Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://data-core-2.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/data-cores/${this.input.dataCoreId}/exists`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = exports.parseResponseHelper(typebox.Type.Object({ exists: typebox.Type.Boolean() }), rawResponse); + return response; + } +}; + +// src/commands/data-core/data-core.fetch.ts +init_command(); +init_parse_response_helper(); +init_not_found(); +function isDataCoreFetchByIdInput(input) { + return "dataCoreId" in input; +} +function isDataCoreFetchByNameAndTenantIdInput(input) { + return "tenantId" in input; +} +function isDataCoreFetchByNameAndTenantInput(input) { + return "tenant" in input; +} +var DataCoreFetchCommand = class extends exports.Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://data-core-2.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + if (isDataCoreFetchByIdInput(this.input)) { + return `/api/v1/data-cores/${this.input.dataCoreId}`; + } + const queryParams = new URLSearchParams(); + if (isDataCoreFetchByNameAndTenantIdInput(this.input)) { + queryParams.set("tenantId", this.input.tenantId); + } + if (isDataCoreFetchByNameAndTenantInput(this.input)) { + queryParams.set("tenant", this.input.tenant); + } + queryParams.set("name", this.input.dataCore); + return `/api/v1/data-cores?${queryParams.toString()}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + if (isDataCoreFetchByIdInput(this.input)) { + const response2 = exports.parseResponseHelper(DataCoreSchema, rawResponse); + return response2; + } + const response = exports.parseResponseHelper(typebox.Type.Array(DataCoreSchema), rawResponse); + if (response.length === 0) { + if (isDataCoreFetchByNameAndTenantIdInput(this.input)) { + throw new exports.NotFoundException("DataCore", { name: this.input.dataCore, tenantId: this.input.tenantId }); + } else { + throw new exports.NotFoundException("DataCore", { name: this.input.dataCore, tenant: this.input.tenant }); + } + } + return response[0]; + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + if (isDataCoreFetchByIdInput(this.input)) { + throw new exports.NotFoundException("DataCore", { id: this.input.dataCoreId }); + } else if (isDataCoreFetchByNameAndTenantIdInput(this.input)) { + throw new exports.NotFoundException("DataCore", { name: this.input.dataCore, tenantId: this.input.tenantId }); + } else { + throw new exports.NotFoundException("DataCore", { name: this.input.dataCore, tenant: this.input.tenant }); + } + } + throw error; + } +}; + +// src/commands/data-core/data-core.list.ts +init_command(); +init_parse_response_helper(); +var responseSchema6 = typebox.Type.Object({ + ...DataCoreWithAccessSchema.properties, + access: typebox.Type.Array(typebox.Type.String()) +}); +var DataCoreListCommand = class extends exports.Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://data-core-2.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + const queryParams = new URLSearchParams(); + if (this.input.tenantId) { + queryParams.set("tenantId", this.input.tenantId); + } + if (this.input.tenant) { + queryParams.set("tenant", this.input.tenant); + } + if (this.input.name) { + queryParams.set("name", this.input.name); + } + if (this.input.page !== void 0) { + queryParams.set("page", this.input.page.toString()); + } + if (this.input.limit !== void 0) { + queryParams.set("limit", this.input.limit.toString()); + } + if (this.input.ids !== void 0) { + const ids = Array.isArray(this.input.ids) ? this.input.ids.join(",") : this.input.ids; + queryParams.set("ids", ids); + } + const qs = queryParams.toString(); + return qs ? `/api/v1/data-cores?${qs}` : "/api/v1/data-cores"; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(typebox.Type.Array(responseSchema6), rawResponse); + } +}; + +// src/commands/data-core/data-core.request-delete.ts +init_command(); +init_parse_response_helper(); +init_not_found(); +var DataCoreRequestDeleteCommand = class extends exports.Command { + /** + * The dedicated subdomain for the command + */ + dedicatedSubdomain = "delete-manager"; + /** + * Get the method + */ + getMethod() { + return "DELETE"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://delete-manager.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/data-cores/${this.input.dataCoreId}/request-delete`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = exports.parseResponseHelper( + typebox.Type.Object({ + success: typebox.Type.Boolean() + }), + rawResponse + ); + return response; + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("DataCore", { + "id": this.input.dataCoreId + }); + } + throw error; + } + /** + * Wait for the response (timeout: 25 seconds) + */ + async processResponse(client, response) { + if (!this.input.waitForDelete) { + return response; + } + const start = Date.now(); + while (Date.now() - start < 25e3) { + const response2 = await client.execute( + new DataCoreExistsCommand({ + dataCoreId: this.input.dataCoreId + }) + ); + if (!response2.exists) { + break; + } + await new Promise((resolve) => setTimeout(resolve, 100)); + } + return response; + } +}; + +// src/commands/data-core/data-core.update.ts +init_command(); +init_parse_response_helper(); +init_command_error(); +var DataCoreUpdateCommand = class extends exports.Command { + /** + * Get the method + */ + getMethod() { + return "PATCH"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://data-core-2.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/data-cores/${this.input.dataCoreId}`; + } + /** + * Get the body for the request + */ + getBody() { + const { dataCoreId: _dataCoreId, ...payload } = this.input; + if (Object.keys(payload).length === 0) { + throw new exports.CommandError(this.constructor.name, "No fields to update"); + } + return payload; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(DataCoreSchema, rawResponse); + } +}; + +// src/commands/flow-type/flow-type.create.ts +init_command(); +var FlowTypeSchema = typebox.Type.Object({ + id: typebox.Type.String(), + tenantId: typebox.Type.String(), + dataCoreId: typebox.Type.String(), + name: typebox.Type.String(), + description: typebox.Type.String(), + isDeleting: typebox.Type.Boolean() +}); + +// src/commands/flow-type/flow-type.create.ts +init_parse_response_helper(); +var FlowTypeCreateCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://flow-type-2.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/flow-types`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(FlowTypeSchema, rawResponse); + } +}; + +// src/commands/flow-type/flow-type.exists.ts +init_command(); +init_parse_response_helper(); +var FlowTypeExistsCommand = class extends exports.Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://flow-type-2.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/flow-types/${this.input.flowTypeId}/exists`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = exports.parseResponseHelper(typebox.Type.Object({ exists: typebox.Type.Boolean() }), rawResponse); + return response; + } +}; + +// src/commands/flow-type/flow-type.fetch.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var FlowTypeFetchCommand = class extends exports.Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://flow-type-2.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + if ("flowTypeId" in this.input) { + return `/api/v1/flow-types/${this.input.flowTypeId}`; + } + const queryParams = new URLSearchParams(); + queryParams.set("dataCoreId", this.input.dataCoreId); + queryParams.set("name", this.input.flowType); + return `/api/v1/flow-types?${queryParams.toString()}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + if ("flowTypeId" in this.input) { + const response2 = exports.parseResponseHelper(FlowTypeSchema, rawResponse); + return response2; + } + const response = exports.parseResponseHelper(typebox.Type.Array(FlowTypeSchema), rawResponse); + if (response.length === 0) { + throw new exports.NotFoundException("FlowType", { name: this.input.flowType }); + } + return response[0]; + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("FlowType", { + [this.input.flowTypeId ? "id" : "name"]: this.input.flowTypeId ?? this.input.flowType + }); + } + throw error; + } +}; + +// src/commands/flow-type/flow-type.list.ts +init_command(); +init_parse_response_helper(); +var FlowTypeListCommand = class extends exports.Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://flow-type-2.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + const queryParams = new URLSearchParams(); + queryParams.set("dataCoreId", this.input.dataCoreId); + return `/api/v1/flow-types?${queryParams.toString()}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = exports.parseResponseHelper(typebox.Type.Array(FlowTypeSchema), rawResponse); + return response; + } +}; + +// src/commands/flow-type/flow-type.request-delete.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var FlowTypeRequestDeleteCommand = class extends exports.Command { + /** + * The dedicated subdomain for the command + */ + dedicatedSubdomain = "delete-manager"; + /** + * Get the method + */ + getMethod() { + return "DELETE"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://delete-manager.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/flow-types/${this.input.flowTypeId}/request-delete`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = exports.parseResponseHelper( + typebox.Type.Object({ + success: typebox.Type.Boolean() + }), + rawResponse + ); + return response; + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("FlowType", { + "id": this.input.flowTypeId + }); + } + throw error; + } + /** + * Wait for the response (timeout: 25 seconds) + */ + async processResponse(client, response) { + if (!this.input.waitForDelete) { + return response; + } + const start = Date.now(); + while (Date.now() - start < 25e3) { + const response2 = await client.execute( + new FlowTypeExistsCommand({ + flowTypeId: this.input.flowTypeId + }) + ); + if (!response2.exists) { + break; + } + await new Promise((resolve) => setTimeout(resolve, 100)); + } + return response; + } +}; + +// src/commands/flow-type/flow-type.update.ts +init_command(); +init_parse_response_helper(); +var FlowTypeUpdateCommand = class extends exports.Command { + /** + * Get the method + */ + getMethod() { + return "PATCH"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://flow-type-2.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/flow-types/${this.input.flowTypeId}`; + } + /** + * Get the body for the request + */ + getBody() { + const { flowTypeId: _flowTypeId, ...payload } = this.input; + return payload; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(FlowTypeSchema, rawResponse); + } +}; + +// src/commands/event-type/event-type.create.ts +init_command(); +var DetailedSensitiveDataFieldSchema = typebox.Type.Object({ + type: typebox.Type.Union([ + typebox.Type.Literal("string"), + typebox.Type.Literal("number"), + typebox.Type.Literal("boolean"), + typebox.Type.Literal("object"), + typebox.Type.Literal("array") + ]), + faker: typebox.Type.Optional(typebox.Type.String()), + args: typebox.Type.Optional(typebox.Type.Array(typebox.Type.Unknown())), + length: typebox.Type.Optional(typebox.Type.Number()), + pattern: typebox.Type.Optional(typebox.Type.String()), + redact: typebox.Type.Optional( + typebox.Type.Object({ + char: typebox.Type.String({ minLength: 1, maxLength: 1 }), + length: typebox.Type.Number({ minimum: 1 }) + }) + ), + min: typebox.Type.Optional(typebox.Type.Number()), + max: typebox.Type.Optional(typebox.Type.Number()), + precision: typebox.Type.Optional(typebox.Type.Number()), + count: typebox.Type.Optional(typebox.Type.Number()), + items: typebox.Type.Optional(typebox.Type.Unknown()), + properties: typebox.Type.Optional( + typebox.Type.Record( + typebox.Type.String(), + typebox.Type.Unknown() + ) + ) +}); +var SensitiveDataDefinitionSchema = typebox.Type.Union([ + typebox.Type.Literal(true), + typebox.Type.Union([typebox.Type.Literal("string"), typebox.Type.Literal("number"), typebox.Type.Literal("boolean")]), + DetailedSensitiveDataFieldSchema, + typebox.Type.Record(typebox.Type.String(), typebox.Type.Unknown()) +]); +var EventTypeSensitiveDataMaskSchema = typebox.Type.Object({ + key: typebox.Type.String(), + schema: typebox.Type.Record(typebox.Type.String(), SensitiveDataDefinitionSchema) +}); +typebox.Type.Array( + typebox.Type.Object({ + path: typebox.Type.String(), + definition: typebox.Type.Object({ + type: typebox.Type.Union([ + typebox.Type.Literal("string"), + typebox.Type.Literal("number"), + typebox.Type.Literal("boolean"), + typebox.Type.Literal("object"), + typebox.Type.Literal("array") + ]), + faker: typebox.Type.Optional(typebox.Type.String()), + args: typebox.Type.Array(typebox.Type.Unknown()), + length: typebox.Type.Optional(typebox.Type.Number()), + pattern: typebox.Type.Optional(typebox.Type.String()), + min: typebox.Type.Optional(typebox.Type.Number()), + max: typebox.Type.Optional(typebox.Type.Number()), + precision: typebox.Type.Optional(typebox.Type.Number()), + count: typebox.Type.Optional(typebox.Type.Number()), + items: typebox.Type.Optional(typebox.Type.Unknown()), + properties: typebox.Type.Optional(typebox.Type.Record(typebox.Type.String(), typebox.Type.Unknown())), + redact: typebox.Type.Optional( + typebox.Type.Object({ + char: typebox.Type.String(), + length: typebox.Type.Number() + }) + ) + }) + }) +); +var EventTypeSchema = typebox.Type.Object({ + /** Unique identifier for the event type */ + id: typebox.Type.String(), + /** ID of the tenant that owns this event type */ + tenantId: typebox.Type.String(), + /** ID of the data core this event type belongs to */ + dataCoreId: typebox.Type.String(), + /** ID of the flow type this event type belongs to */ + flowTypeId: typebox.Type.String(), + /** Name of the event type */ + name: typebox.Type.String(), + /** Description of the event type */ + description: typebox.Type.String(), + /** Indicates if the event type is currently being truncated */ + isTruncating: typebox.Type.Boolean(), + /** Indicates if the event type is currently being deleted */ + isDeleting: typebox.Type.Boolean(), + /** Creation timestamp */ + createdAt: typebox.Type.String(), + /** Last update timestamp */ + updatedAt: typebox.Type.Union([typebox.Type.String(), typebox.Type.Null()]), + /** SensitiveData mask configuration */ + sensitiveDataMask: typebox.Type.Optional(typebox.Type.Union([EventTypeSensitiveDataMaskSchema, typebox.Type.Null()])), + /** Indicates if SensitiveData handling is enabled */ + sensitiveDataEnabled: typebox.Type.Optional(typebox.Type.Boolean()) +}); +typebox.Type.Object({ + id: typebox.Type.String(), + tenantId: typebox.Type.String(), + dataCoreId: typebox.Type.String(), + flowTypeId: typebox.Type.String(), + eventTypeId: typebox.Type.String(), + parentKey: typebox.Type.String(), + key: typebox.Type.String(), + type: typebox.Type.String(), + application: typebox.Type.String(), + createdAt: typebox.Type.String() +}); +var EventTypeRemoveSensitiveDataSchema = typebox.Type.Object({ + success: typebox.Type.Boolean(), + id: typebox.Type.String() +}); +var EventTypeListRemovedSensitiveDataItemSchema = typebox.Type.Object({ + id: typebox.Type.String(), + tenantId: typebox.Type.String(), + dataCoreId: typebox.Type.String(), + flowTypeId: typebox.Type.String(), + eventTypeId: typebox.Type.String(), + application: typebox.Type.String(), + parentKey: typebox.Type.String(), + key: typebox.Type.String(), + type: typebox.Type.String(), + createdAt: typebox.Type.String() +}); +var EventTypeListRemovedSensitiveDataResponseSchema = typebox.Type.Object({ + data: typebox.Type.Array(EventTypeListRemovedSensitiveDataItemSchema), + pagination: typebox.Type.Object({ + page: typebox.Type.Number(), + pageSize: typebox.Type.Number(), + hasNextPage: typebox.Type.Boolean(), + hasPreviousPage: typebox.Type.Boolean() + }) +}); + +// src/commands/event-type/event-type.create.ts +init_parse_response_helper(); +var EventTypeCreateCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://event-type-2.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/event-types`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(EventTypeSchema, rawResponse); + } +}; + +// src/commands/event-type/event-type.exists.ts +init_command(); +init_parse_response_helper(); +var EventTypeExistsCommand = class extends exports.Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://event-type-2.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/event-types/${this.input.eventTypeId}/exists`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = exports.parseResponseHelper(typebox.Type.Object({ exists: typebox.Type.Boolean() }), rawResponse); + return response; + } +}; + +// src/commands/event-type/event-type.fetch.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var EventTypeFetchCommand = class extends exports.Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://event-type-2.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + if ("eventTypeId" in this.input) { + return `/api/v1/event-types/${this.input.eventTypeId}`; + } + const queryParams = new URLSearchParams(); + queryParams.set("flowTypeId", this.input.flowTypeId); + queryParams.set("name", this.input.eventType); + return `/api/v1/event-types?${queryParams.toString()}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + if ("eventTypeId" in this.input) { + const response2 = exports.parseResponseHelper(EventTypeSchema, rawResponse); + return response2; + } + const response = exports.parseResponseHelper(typebox.Type.Array(EventTypeSchema), rawResponse); + if (response.length === 0) { + throw new exports.NotFoundException("EventType", { name: this.input.eventType }); + } + return response[0]; + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("EventType", { + [this.input.eventTypeId ? "id" : "name"]: this.input.eventTypeId ?? this.input.eventType + }); + } + throw error; + } +}; + +// src/commands/events/event.list.ts +init_command(); +init_parse_response_helper(); +var FlowcoreEventSchema = typebox.Type.Object({ + eventId: typebox.Type.String(), + timeBucket: typebox.Type.String(), + tenant: typebox.Type.String(), + dataCoreId: typebox.Type.String(), + flowType: typebox.Type.String(), + eventType: typebox.Type.String(), + metadata: typebox.Type.Record(typebox.Type.String(), typebox.Type.Unknown()), + payload: typebox.Type.Record(typebox.Type.String(), typebox.Type.Unknown()), + validTime: typebox.Type.String() +}); + +// src/commands/events/event.list.ts +var responseSchema7 = typebox.Type.Object({ + events: typebox.Type.Array(FlowcoreEventSchema), + nextCursor: typebox.Type.Optional(typebox.Type.String()) +}); +var EventListCommand = class extends exports.Command { + /** + * The dedicated subdomain for the command + */ + dedicatedSubdomain = "event-source"; + /** + * Get the method for the request + */ + getMethod() { + return "GET"; + } + /** + * Get the base url for the request + */ + getBaseUrl() { + return "https://event-source.api.flowcore.io"; + } + /** + * Get the path for the request + */ + getPath() { + const query = new URLSearchParams(); + const eventTypeIds = Array.isArray(this.input.eventTypeId) ? this.input.eventTypeId : [this.input.eventTypeId]; + for (const eventTypeId of eventTypeIds) { + query.append("eventTypeId", eventTypeId); + } + query.set("timeBucket", this.input.timeBucket); + this.input.cursor && query.set("cursor", this.input.cursor.toString()); + this.input.pageSize && query.set("pageSize", this.input.pageSize.toString()); + this.input.fromEventId && query.set("fromEventId", this.input.fromEventId); + this.input.afterEventId && query.set("afterEventId", this.input.afterEventId); + this.input.toEventId && query.set("toEventId", this.input.toEventId); + this.input.order && query.set("order", this.input.order); + this.input.includeSensitiveData && query.set("includeSensitiveData", this.input.includeSensitiveData.toString()); + return `/api/v1/events?${query.toString()}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = exports.parseResponseHelper(responseSchema7, rawResponse); + return response; + } +}; + +// src/commands/events/time-bucket.list.ts +init_command(); +init_parse_response_helper(); +var responseSchema8 = typebox.Type.Object({ + timeBuckets: typebox.Type.Array(typebox.Type.String()), + nextCursor: typebox.Type.Optional(typebox.Type.Number()) +}); +var TimeBucketListCommand = class extends exports.Command { + /** + * The dedicated subdomain for the command + */ + dedicatedSubdomain = "event-source"; + /** + * Get the method for the request + */ + getMethod() { + return "GET"; + } + /** + * Get the base url for the request + */ + getBaseUrl() { + return "https://event-source.api.flowcore.io"; + } + /** + * Get the path for the request + */ + getPath() { + const queryParams = new URLSearchParams(); + const eventTypeIds = Array.isArray(this.input.eventTypeId) ? this.input.eventTypeId : [this.input.eventTypeId]; + for (const eventTypeId of eventTypeIds) { + queryParams.append("eventTypeId", eventTypeId); + } + this.input.fromTimeBucket && queryParams.set("fromTimeBucket", this.input.fromTimeBucket); + this.input.toTimeBucket && queryParams.set("toTimeBucket", this.input.toTimeBucket); + this.input.order && queryParams.set("order", this.input.order); + this.input.pageSize && queryParams.set("pageSize", this.input.pageSize.toString()); + this.input.cursor && queryParams.set("cursor", this.input.cursor.toString()); + return `/api/v1/time-buckets?${queryParams.toString()}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = exports.parseResponseHelper(responseSchema8, rawResponse); + return response; + } +}; + +// src/commands/event-type/event-type.info.ts +var EventTypeInfoCommand = class extends CustomCommand { + /** + * Custom execute method + */ + async customExecute(client) { + const lastEventsLimit = this.input.limit ?? 5; + const firstTimeBucketCommand = new TimeBucketListCommand({ + tenant: this.input.tenant, + eventTypeId: this.input.eventTypeId, + order: "asc", + pageSize: 1 + }); + const lastTimeBucketCommand = new TimeBucketListCommand({ + tenant: this.input.tenant, + eventTypeId: this.input.eventTypeId, + order: "desc", + pageSize: Math.max(lastEventsLimit, 100) + }); + const [firstTimeBucketResponse, lastTimeBucketResponse] = await Promise.all([ + client.execute(firstTimeBucketCommand), + client.execute(lastTimeBucketCommand) + ]); + const firstTimeBucket = firstTimeBucketResponse.timeBuckets[0]; + const lastTimeBucket = lastTimeBucketResponse.timeBuckets[0]; + if (!firstTimeBucket || !lastTimeBucket) { + return { + firstTimeBucket: void 0, + lastTimeBucket: void 0, + lastEvents: [] + }; + } + const lastEvents = []; + const minLastEventLimit = Math.max(lastEventsLimit, lastEventsLimit * 3); + for (const timeBucket of lastTimeBucketResponse.timeBuckets) { + let cursor; + do { + const eventListResponse = await client.execute( + new EventListCommand({ + eventTypeId: this.input.eventTypeId, + timeBucket, + pageSize: minLastEventLimit - lastEvents.length, + order: "desc", + tenant: this.input.tenant, + ...cursor && { cursor }, + ...this.input.includeSensitiveData && { includeSensitiveData: true } + }) + ); + lastEvents.push(...eventListResponse.events); + cursor = eventListResponse.nextCursor; + } while (cursor && lastEvents.length < lastEventsLimit); + if (lastEvents.length >= lastEventsLimit) { + break; + } + } + if (lastEvents.length > lastEventsLimit) { + lastEvents.length = lastEventsLimit; + } + return { + firstTimeBucket, + lastTimeBucket, + lastEvents + }; + } +}; + +// src/commands/event-type/event-type.list-removed-sensitive-data.ts +init_command(); +init_parse_response_helper(); +var EventTypeListRemovedSensitiveDataCommand = class extends exports.Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://event-type-2.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + const queryParams = new URLSearchParams(); + this.input.dataCoreId && queryParams.set("dataCoreId", this.input.dataCoreId); + this.input.flowTypeId && queryParams.set("flowTypeId", this.input.flowTypeId); + this.input.eventTypeId && queryParams.set("eventTypeId", this.input.eventTypeId); + this.input.parentKey && queryParams.set("parentKey", this.input.parentKey); + this.input.application && queryParams.set("application", this.input.application); + this.input.page && queryParams.set("page", this.input.page.toString()); + this.input.pageSize && queryParams.set("pageSize", this.input.pageSize.toString()); + this.input.type && queryParams.set("type", this.input.type); + this.input.sort && queryParams.set("sort", this.input.sort); + this.input.createdAtFrom && queryParams.set("createdAtFrom", this.input.createdAtFrom); + this.input.createdAtTo && queryParams.set("createdAtTo", this.input.createdAtTo); + return `/api/v1/event-types/sensitive-data/${this.input.tenantId}?${queryParams.toString()}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(EventTypeListRemovedSensitiveDataResponseSchema, rawResponse); + } +}; + +// src/commands/event-type/event-type.list.ts +init_command(); +init_parse_response_helper(); +var EventTypeListCommand = class extends exports.Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://event-type-2.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + const queryParams = new URLSearchParams(); + queryParams.set("flowTypeId", this.input.flowTypeId); + return `/api/v1/event-types?${queryParams.toString()}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = exports.parseResponseHelper(typebox.Type.Array(EventTypeSchema), rawResponse); + return response; + } +}; + +// src/commands/event-type/event-type.remove-sensitive-data.ts +init_command(); +init_parse_response_helper(); +var EventTypeRemoveSensitiveDataCommand = class extends exports.Command { + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://event-type-2.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/event-types/sensitive-data/remove`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(EventTypeRemoveSensitiveDataSchema, rawResponse); + } +}; + +// src/commands/event-type/event-type.request-delete.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var EventTypeRequestDeleteCommand = class extends exports.Command { + /** + * The dedicated subdomain for the command + */ + dedicatedSubdomain = "delete-manager"; + /** + * Get the method + */ + getMethod() { + return "DELETE"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://delete-manager.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/event-types/${this.input.eventTypeId}/request-delete`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = exports.parseResponseHelper( + typebox.Type.Object({ + success: typebox.Type.Boolean() + }), + rawResponse + ); + return response; + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("EventType", { + [this.input.eventTypeId ? "id" : "name"]: this.input.eventTypeId ?? this.input.eventTypeId + }); + } + throw error; + } + /** + * Wait for the response (timeout: 25 seconds) + */ + async processResponse(client, response) { + if (!this.input.waitForDelete) { + return response; + } + const start = Date.now(); + while (Date.now() - start < 25e3) { + const response2 = await client.execute( + new EventTypeExistsCommand({ + eventTypeId: this.input.eventTypeId + }) + ); + if (!response2.exists) { + break; + } + await new Promise((resolve) => setTimeout(resolve, 100)); + } + return response; + } +}; + +// src/commands/event-type/event-type.request-truncate.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var EventTypeRequestTruncateCommand = class extends exports.Command { + /** + * The dedicated subdomain for the command + */ + dedicatedSubdomain = "delete-manager"; + /** + * Get the method + */ + getMethod() { + return "DELETE"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://delete-manager.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/event-types/${this.input.eventTypeId}/request-truncate`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = exports.parseResponseHelper( + typebox.Type.Object({ + success: typebox.Type.Boolean() + }), + rawResponse + ); + return response; + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("EventType", { + [this.input.eventTypeId ? "id" : "name"]: this.input.eventTypeId ?? this.input.eventTypeId + }); + } + throw error; + } + /** + * Wait for the response (timeout: 25 seconds) + */ + async processResponse(client, response) { + if (!this.input.waitForTruncate) { + return response; + } + await new Promise((resolve) => setTimeout(resolve, 1e3)); + const start = Date.now(); + while (Date.now() - start < 25e3) { + const response2 = await client.execute( + new EventTypeFetchCommand({ + eventTypeId: this.input.eventTypeId + }) + ); + if (response2.isTruncating) { + break; + } + await new Promise((resolve) => setTimeout(resolve, 100)); + } + return response; + } +}; + +// src/commands/event-type/event-type.update.ts +init_command(); +init_parse_response_helper(); +var EventTypeUpdateCommand = class extends exports.Command { + /** + * Get the method + */ + getMethod() { + return "PATCH"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://event-type-2.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/event-types/${this.input.eventTypeId}`; + } + /** + * Get the body for the request + */ + getBody() { + const { eventTypeId: _, ...payload } = this.input; + return payload; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(EventTypeSchema, rawResponse); + } +}; + +// src/commands/ingestion/ingest.batch.ts +init_command(); +init_parse_response_helper(); +var responseSchema9 = typebox.Type.Object({ + eventIds: typebox.Type.Array(typebox.Type.String()), + success: typebox.Type.Boolean() +}); +var IngestBatchCommand = class extends exports.Command { + /** + * The dedicated subdomain for the command + */ + dedicatedSubdomain = "webhook"; + allowedModes = ["apiKey"]; + getMethod() { + return "POST"; + } + /** + * Get the base url for the request + */ + getBaseUrl() { + if (this.input.tenantName === "flowcore") { + return "https://flowcore.webhook.flowcore.io"; + } + return "https://webhook.api.flowcore.io"; + } + getHeaders() { + const metadata = this.input.metadata && Object.keys(this.input.metadata).length > 0 ? this.input.metadata : void 0; + if (metadata && this.input.ttl) { + metadata["ttl-on/stored-event"] = "true"; + } + if (metadata && this.input.isEphemeral) { + metadata["do-not-archive-on/stored-event"] = "true"; + } + const authHeader = this.clientAuthOptions.apiKey || null; + return { + "Content-Type": "application/json", + ...this.input.flowcoreManaged && { "X-Flowcore-Managed": "true" }, + ...metadata && { "x-flowcore-metadata-json": btoa(JSON.stringify(metadata)) }, + ...this.input.eventTime && { "x-flowcore-event-time": this.input.eventTime }, + ...this.input.validTime && { "x-flowcore-valid-time": this.input.validTime }, + ...authHeader && { "Authorization": authHeader } + }; + } + /** + * Get the path for the request + */ + getPath() { + return `/events/${this.input.tenantName}/${this.input.dataCoreId}/${this.input.flowTypeName}/${this.input.eventTypeName}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = exports.parseResponseHelper(responseSchema9, rawResponse); + return response; + } + /** + * Get the body for the request + */ + getBody() { + return this.input.events; + } +}; + +// src/commands/ingestion/ingest.event.ts +init_command(); +init_parse_response_helper(); +var responseSchema10 = typebox.Type.Object({ + eventId: typebox.Type.String(), + success: typebox.Type.Boolean() +}); +var IngestEventCommand = class extends exports.Command { + /** + * The dedicated subdomain for the command + */ + dedicatedSubdomain = "webhook"; + allowedModes = ["apiKey"]; + getMethod() { + return "POST"; + } + /** + * Get the base url for the request + */ + getBaseUrl() { + if (this.input.tenantName === "flowcore") { + return "https://flowcore.webhook.flowcore.io"; + } + return "https://webhook.api.flowcore.io"; + } + getHeaders() { + const metadata = this.input.metadata && Object.keys(this.input.metadata).length > 0 ? this.input.metadata : void 0; + if (metadata && this.input.ttl) { + metadata["ttl-on/stored-event"] = "true"; + } + if (metadata && this.input.isEphemeral) { + metadata["do-not-archive-on/stored-event"] = "true"; + } + const authHeader = this.clientAuthOptions.apiKey || null; + return { + "Content-Type": "application/json", + ...this.input.flowcoreManaged && { "X-Flowcore-Managed": "true" }, + ...metadata && { "x-flowcore-metadata-json": btoa(JSON.stringify(metadata)) }, + ...this.input.eventTime && { "x-flowcore-event-time": this.input.eventTime }, + ...this.input.validTime && { "x-flowcore-valid-time": this.input.validTime }, + ...authHeader && { "Authorization": authHeader } + }; + } + /** + * Get the path for the request + */ + getPath() { + return `/event/${this.input.tenantName}/${this.input.dataCoreId}/${this.input.flowTypeName}/${this.input.eventTypeName}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = exports.parseResponseHelper(responseSchema10, rawResponse); + return response; + } + /** + * Get the body for the request + */ + getBody() { + return this.input.eventData; + } +}; + +// src/commands/events/events.fetch-time-buckets-by-names.ts +init_command(); +init_parse_response_helper(); +var responseSchema11 = typebox.Type.Object({ + timeBuckets: typebox.Type.Array(typebox.Type.String()), + nextCursor: typebox.Type.Optional(typebox.Type.Number()) +}); +var EventsFetchTimeBucketsByNamesCommand = class extends exports.Command { + /** + * The dedicated subdomain for the command + */ + dedicatedSubdomain = "event-source"; + /** + * Get the base url for the request + */ + getBaseUrl() { + return "https://event-source.api.flowcore.io"; + } + /** + * Get the path for the request + */ + getPath() { + return "/api/v1/time-buckets/by-names"; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = exports.parseResponseHelper(responseSchema11, rawResponse); + return response; + } + /** + * Get the body for the request + */ + getBody() { + const { ...rest } = this.input; + return rest; + } +}; + +// src/commands/events/events.fetch.ts +init_command(); +init_parse_response_helper(); +var responseSchema12 = typebox.Type.Object({ + events: typebox.Type.Array(FlowcoreEventSchema), + nextCursor: typebox.Type.Optional(typebox.Type.String()) +}); +var EventsFetchCommand = class extends exports.Command { + /** + * The dedicated subdomain for the command + */ + dedicatedSubdomain = "event-source"; + /** + * Get the base url for the request + */ + getBaseUrl() { + return "https://event-source.api.flowcore.io"; + } + /** + * Get the path for the request + */ + getPath() { + const query = { + ...this.input.cursor ? { cursor: this.input.cursor.toString() } : {}, + ...this.input.pageSize ? { pageSize: this.input.pageSize.toString() } : {}, + ...this.input.fromEventId ? { fromEventId: this.input.fromEventId } : {}, + ...this.input.afterEventId ? { afterEventId: this.input.afterEventId } : {}, + ...this.input.toEventId ? { toEventId: this.input.toEventId } : {}, + ...this.input.includeSensitiveData ? { includeSensitiveData: this.input.includeSensitiveData.toString() } : {} + }; + return `/api/v1/events?${new URLSearchParams(query).toString()}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = exports.parseResponseHelper(responseSchema12, rawResponse); + return response; + } + /** + * Get the body for the request + */ + getBody() { + return { + tenant: this.input.tenant, + dataCoreId: this.input.dataCoreId, + flowType: this.input.flowType, + eventTypes: this.input.eventTypes, + timeBucket: this.input.timeBucket + }; + } +}; + +// src/commands/container-registry/container-registry.create.ts +init_command(); +var ContainerRegistrySchema = typebox.Type.Object({ + tenantId: typebox.Type.String(), + name: typebox.Type.String(), + description: typebox.Type.Optional(typebox.Type.String()), + username: typebox.Type.Optional(typebox.Type.String()), + id: typebox.Type.String() +}); +var ContainerRegistryCreateSchema = typebox.Type.Object({ + id: typebox.Type.String() +}); +var ContainerRegistryDeleteSchema = typebox.Type.Object({ + status: typebox.Type.Number() +}); +var ContainerRegistryListSchema = typebox.Type.Array(ContainerRegistrySchema); + +// src/commands/container-registry/container-registry.create.ts +init_parse_response_helper(); +var ContainerRegistryCreateCommand = class extends exports.Command { + /** + * GET the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://registry.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/container`; + } + /** + * Parse the response + */ + parseResponse(response) { + return exports.parseResponseHelper(ContainerRegistryCreateSchema, response); + } +}; + +// src/commands/container-registry/container-registry.delete.ts +init_command(); +init_parse_response_helper(); +var ContainerRegistryDeleteCommand = class extends exports.Command { + getMethod() { + return "DELETE"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://registry.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/container/${this.input.containerId}`; + } + /** + * Parse the response + */ + parseResponse(response) { + return exports.parseResponseHelper(ContainerRegistryDeleteSchema, response); + } +}; + +// src/commands/container-registry/container-registry.fetch.ts +init_command(); +init_parse_response_helper(); +var ContainerRegistryFetchCommand = class extends exports.Command { + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://registry.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/container/${this.input.containerId}`; + } + /** + * Parse the response + */ + parseResponse(response) { + return exports.parseResponseHelper(ContainerRegistrySchema, response); + } +}; + +// src/commands/container-registry/container-registry.list.ts +init_command(); +init_parse_response_helper(); +var ContainerRegistListCommand = class extends exports.Command { + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://registry.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/container/tenants/${this.input.tenantId}`; + } + /** + * Parse the response + */ + parseResponse(response) { + return exports.parseResponseHelper(ContainerRegistryListSchema, response); + } +}; + +// src/commands/container-registry/container-registry.update.ts +init_command(); +init_parse_response_helper(); +var ContainerRegistryUpdateCommand = class extends exports.Command { + getMethod() { + return "PATCH"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://registry.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/container/${this.input.containerId}`; + } + /** + * Parse the response + */ + parseResponse(response) { + return exports.parseResponseHelper(ContainerRegistrySchema, response); + } +}; + +// src/commands/security/pat.create.ts +init_command(); +var PATSchema = typebox.Type.Object({ + id: typebox.Type.String(), + name: typebox.Type.String(), + description: typebox.Type.Optional(typebox.Type.String()), + token: typebox.Type.Optional(typebox.Type.String()), + createdAt: typebox.Type.String() +}); + +// src/commands/security/pat.create.ts +init_parse_response_helper(); +var SecurityCreatePATCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://security2.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/pat`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(PATSchema, rawResponse); + } +}; + +// src/commands/security/pat.delete.ts +init_command(); +init_parse_response_helper(); +var SecurityDeletePATCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "DELETE"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://security2.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/pat/${this.input.id}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper( + typebox.Type.Object({ + success: typebox.Type.Boolean() + }), + rawResponse + ); + } +}; + +// src/commands/security/pat.exchange.ts +init_command(); +init_parse_response_helper(); +var SecurityExchangePATCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://security2.api.flowcore.io"; + } + getHeaders() { + const headers = super.getHeaders(); + headers["x-flowcore-pat"] = this.input.pat; + return headers; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/pat/exchange/${this.input.username}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper( + typebox.Type.Object({ + accessToken: typebox.Type.String() + }), + rawResponse + ); + } +}; + +// src/commands/security/pat.get.ts +init_command(); +init_parse_response_helper(); +var SecurityGetPATCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://security2.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/pat/${this.input.id}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(PATSchema, rawResponse); + } +}; + +// src/commands/security/pat.list.ts +init_command(); +init_parse_response_helper(); +var SecurityListPATCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://security2.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/pat`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(typebox.Type.Array(PATSchema), rawResponse); + } +}; + +// src/commands/security/permissions.list.ts +init_command(); +init_parse_response_helper(); +var PermissionSchema = typebox.Type.Object({ + tenant: typebox.Type.String(), + type: typebox.Type.String(), + id: typebox.Type.String(), + action: typebox.Type.Array( + typebox.Type.Union([ + typebox.Type.Literal("read"), + typebox.Type.Literal("write"), + typebox.Type.Literal("ingest"), + typebox.Type.Literal("fetch"), + typebox.Type.Literal("sensitive-data-fetch"), + typebox.Type.String() + ]) + ) +}); + +// src/commands/security/permissions.list.ts +var responseSchema13 = typebox.Type.Object({ + ...PermissionSchema.properties, + // parse as string to prevent sdk to fail when new actions are added + action: typebox.Type.Array(typebox.Type.String()) +}); +var PermissionsListCommand = class extends exports.Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + const queryParams = new URLSearchParams(); + if (this.input.type) { + queryParams.set("type", this.input.type); + } + return `/api/v1/permissions?${queryParams.toString()}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = exports.parseResponseHelper(typebox.Type.Array(responseSchema13), rawResponse); + return response; + } +}; + +// src/commands/user/user.initialize-in-keycloak.ts +init_command(); +init_parse_response_helper(); +var responseSchema14 = typebox.Type.Object({ + id: typebox.Type.String(), + username: typebox.Type.String(), + email: typebox.Type.String(), + firstName: typebox.Type.String(), + lastName: typebox.Type.String() +}); +var UserInitializeInKeycloakCommand = class extends exports.Command { + /** + * The allowed modes for the command + */ + allowedModes = ["bearer"]; + /** + * Get the base URL for the request + */ + getBaseUrl() { + return "https://user-2.api.flowcore.io"; + } + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the path for the request + */ + getPath() { + return "/api/users"; + } + /** + * Get the body for the request (must be an empty JSON object) + */ + getBody() { + return { + // intentionally empty + }; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = exports.parseResponseHelper(responseSchema14, rawResponse); + return response; + } +}; + +// src/commands/user/user.delete.ts +init_command(); +init_parse_response_helper(); +var responseSchema15 = typebox.Type.Object({ + id: typebox.Type.String() +}); +var UserDeleteCommand = class extends exports.Command { + /** + * The allowed modes for the command + */ + allowedModes = ["bearer"]; + /** + * Get the base URL for the request + */ + getBaseUrl() { + return "https://user-2.api.flowcore.io"; + } + /** + * Get the method + */ + getMethod() { + return "DELETE"; + } + /** + * Get the path for the request + */ + getPath() { + return `/api/users`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = exports.parseResponseHelper(responseSchema15, rawResponse); + return response; + } +}; + +// src/commands/user/user.invite-to-tenant.ts +init_command(); +init_parse_response_helper(); +var responseSchema16 = typebox.Type.Object({ + success: typebox.Type.Boolean(), + tenantName: typebox.Type.String(), + invitedEmail: typebox.Type.String() +}); +var UserInviteToTenantCommand = class extends exports.Command { + /** + * The allowed modes for the command + */ + allowedModes = ["bearer"]; + /** + * Get the base URL for the request + */ + getBaseUrl() { + return "https://user-2.api.flowcore.io"; + } + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the path for the request + */ + getPath() { + return "/api/users/invitations"; + } + /** + * Get the body for the request + */ + getBody() { + return { + tenantName: this.input.tenantName, + userEmail: this.input.userEmail + }; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = exports.parseResponseHelper(responseSchema16, rawResponse); + return response; + } +}; + +// src/commands/data-pathways/assignment.complete.ts +init_command(); +var DataPathwayAssignmentCompleteCommand = class extends exports.Command { + retryOnFailure = false; + allowedModes = ["apiKey"]; + getMethod() { + return "POST"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/assignments/complete`; + } + parseResponse(_rawResponse) { + return null; + } +}; + +// src/commands/data-pathways/assignment.expire-leases.ts +init_command(); +var SizeClassEnum = typebox.Type.Union([typebox.Type.Literal("small"), typebox.Type.Literal("medium"), typebox.Type.Literal("high")]); +var EndpointConfigSchema = typebox.Type.Object({ + url: typebox.Type.String(), + authHeaders: typebox.Type.Optional(typebox.Type.Record(typebox.Type.String(), typebox.Type.String())) +}); +var BackoffConfigSchema = typebox.Type.Optional( + typebox.Type.Object({ + initialMs: typebox.Type.Optional(typebox.Type.Integer()), + maxMs: typebox.Type.Optional(typebox.Type.Integer()), + multiplier: typebox.Type.Optional(typebox.Type.Number()) + }) +); +var TimeoutConfigSchema = typebox.Type.Optional( + typebox.Type.Object({ + deliveryMs: typebox.Type.Optional(typebox.Type.Integer()), + fetchMs: typebox.Type.Optional(typebox.Type.Integer()) + }) +); +var SourceConfigSchema = typebox.Type.Object({ + id: typebox.Type.Optional(typebox.Type.String()), + name: typebox.Type.Optional(typebox.Type.String()), + flowType: typebox.Type.String(), + eventTypes: typebox.Type.Array(typebox.Type.String()), + endpoints: typebox.Type.Array(EndpointConfigSchema), + batchSize: typebox.Type.Optional(typebox.Type.Integer()), + maxInFlight: typebox.Type.Optional(typebox.Type.Integer()), + backoff: BackoffConfigSchema, + timeouts: TimeoutConfigSchema +}); +var DataSourceConfigSchema = typebox.Type.Object({ + tenant: typebox.Type.String(), + dataCore: typebox.Type.String() +}); +var AuthConfigSchema = typebox.Type.Object({ + apiKey: typebox.Type.String() +}); +var PathwayConfigSchema = typebox.Type.Object({ + sources: typebox.Type.Array(SourceConfigSchema) +}); +var PumpConfigSchema = typebox.Type.Object({ + sources: typebox.Type.Array(SourceConfigSchema), + dataSource: DataSourceConfigSchema, + auth: typebox.Type.Optional(AuthConfigSchema) +}); +var PathwayTypeSchema = typebox.Type.Optional(typebox.Type.Union([typebox.Type.Literal("managed"), typebox.Type.Literal("virtual")])); +var VirtualConfigSchema = typebox.Type.Object({ + flowTypes: typebox.Type.Optional(typebox.Type.Array(typebox.Type.String())) +}); +var DeliveryStateSchema = typebox.Type.Union([typebox.Type.Literal("active"), typebox.Type.Literal("paused")]); +var DataPathwaySchema = typebox.Type.Object({ + id: typebox.Type.String(), + tenant: typebox.Type.String(), + name: typebox.Type.Optional(typebox.Type.Union([typebox.Type.String(), typebox.Type.Null()])), + dataCore: typebox.Type.String(), + sizeClass: SizeClassEnum, + type: PathwayTypeSchema, + enabled: typebox.Type.Boolean(), + priority: typebox.Type.Integer(), + version: typebox.Type.Integer(), + labels: typebox.Type.Record(typebox.Type.String(), typebox.Type.String()), + config: typebox.Type.Optional(PathwayConfigSchema), + virtualConfig: typebox.Type.Optional(VirtualConfigSchema), + deliveryState: typebox.Type.Optional(DeliveryStateSchema), + deliveryPauseTargets: typebox.Type.Optional(typebox.Type.Union([typebox.Type.Array(typebox.Type.String()), typebox.Type.Null()])), + createdAt: typebox.Type.String(), + updatedAt: typebox.Type.String() +}); +var DataPathwayListSchema = typebox.Type.Object({ + pathways: typebox.Type.Array(DataPathwaySchema), + total: typebox.Type.Integer() +}); +var DataPathwayMutationResponseSchema = typebox.Type.Object({ + pathwayId: typebox.Type.String(), + status: typebox.Type.String(), + apiKey: typebox.Type.Optional(typebox.Type.String()) +}); +var DataPathwaySlotSchema = typebox.Type.Object({ + id: typebox.Type.String(), + podUnitId: typebox.Type.String(), + class: SizeClassEnum, + labels: typebox.Type.Record(typebox.Type.String(), typebox.Type.String()), + lastSeen: typebox.Type.String(), + createdAt: typebox.Type.String(), + updatedAt: typebox.Type.String() +}); +var DataPathwaySlotListSchema = typebox.Type.Object({ + slots: typebox.Type.Array(DataPathwaySlotSchema), + total: typebox.Type.Integer() +}); +var DataPathwaySlotMutationResponseSchema = typebox.Type.Object({ + slotId: typebox.Type.String(), + status: typebox.Type.String() +}); +var DataPathwayAssignmentSchema = typebox.Type.Object({ + id: typebox.Type.String(), + pathwayId: typebox.Type.String(), + slotId: typebox.Type.String(), + generation: typebox.Type.Integer(), + leaseTTL: typebox.Type.String(), + status: typebox.Type.String(), + config: PumpConfigSchema, + createdAt: typebox.Type.String(), + updatedAt: typebox.Type.String() +}); +var AssignmentNextInnerSchema = typebox.Type.Object({ + assignmentId: typebox.Type.String(), + pathwayId: typebox.Type.String(), + slotId: typebox.Type.String(), + generation: typebox.Type.Integer(), + config: PumpConfigSchema, + leaseTTL: typebox.Type.String(), + status: typebox.Type.String() +}); +var DataPathwayAssignmentNextSchema = typebox.Type.Object({ + assignment: typebox.Type.Union([AssignmentNextInnerSchema, typebox.Type.Null()]) +}); +var DataPathwayAssignmentListSchema = typebox.Type.Object({ + assignments: typebox.Type.Array(DataPathwayAssignmentSchema), + total: typebox.Type.Integer() +}); +var DataPathwayExpireLeasesResponseSchema = typebox.Type.Object({ + expired: typebox.Type.Integer() +}); +var DataPathwayCommandSchema = typebox.Type.Object({ + id: typebox.Type.String(), + restartRequestId: typebox.Type.Union([typebox.Type.String(), typebox.Type.Null()]), + assignmentId: typebox.Type.String(), + type: typebox.Type.String(), + generation: typebox.Type.Integer(), + position: typebox.Type.Union([typebox.Type.Record(typebox.Type.String(), typebox.Type.Unknown()), typebox.Type.Null()]), + stopAt: typebox.Type.Union([typebox.Type.String(), typebox.Type.Null()]), + timeoutMs: typebox.Type.Union([typebox.Type.Integer(), typebox.Type.Null()]), + phase: typebox.Type.String(), + reason: typebox.Type.Union([typebox.Type.String(), typebox.Type.Null()]), + createdAt: typebox.Type.String() +}); +var DataPathwayCommandListSchema = typebox.Type.Object({ + commands: typebox.Type.Array(DataPathwayCommandSchema) +}); +var DataPathwayCommandResponseSchema = typebox.Type.Object({ + commandId: typebox.Type.String(), + phase: typebox.Type.String() +}); +var DataPathwayCommandDetailSchema = typebox.Type.Object({ + id: typebox.Type.String(), + restartRequestId: typebox.Type.Union([typebox.Type.String(), typebox.Type.Null()]), + assignmentId: typebox.Type.Union([typebox.Type.String(), typebox.Type.Null()]), + pathwayId: typebox.Type.Union([typebox.Type.String(), typebox.Type.Null()]), + type: typebox.Type.String(), + generation: typebox.Type.Union([typebox.Type.Integer(), typebox.Type.Null()]), + position: typebox.Type.Union([typebox.Type.Record(typebox.Type.String(), typebox.Type.Unknown()), typebox.Type.Null()]), + stopAt: typebox.Type.Union([typebox.Type.String(), typebox.Type.Null()]), + timeoutMs: typebox.Type.Union([typebox.Type.Integer(), typebox.Type.Null()]), + phase: typebox.Type.String(), + reason: typebox.Type.Union([typebox.Type.String(), typebox.Type.Null()]), + details: typebox.Type.Union([typebox.Type.String(), typebox.Type.Null()]), + config: typebox.Type.Union([typebox.Type.Record(typebox.Type.String(), typebox.Type.Unknown()), typebox.Type.Null()]), + sourceFlowTypes: typebox.Type.Union([typebox.Type.Array(typebox.Type.String()), typebox.Type.Null()]), + createdAt: typebox.Type.String(), + updatedAt: typebox.Type.String() +}); +var DataPathwayRestartRequestResponseSchema = typebox.Type.Object({ + restartRequestId: typebox.Type.String(), + acceptedTargets: typebox.Type.Array(typebox.Type.String()), + skippedTargets: typebox.Type.Array(typebox.Type.String()) +}); +var DataPathwayRestartRequestSchema = typebox.Type.Object({ + id: typebox.Type.String(), + targets: typebox.Type.Record(typebox.Type.String(), typebox.Type.Unknown()), + mode: typebox.Type.String(), + position: typebox.Type.Record(typebox.Type.String(), typebox.Type.Unknown()), + status: typebox.Type.String(), + requestedBy: typebox.Type.String(), + reason: typebox.Type.Union([typebox.Type.String(), typebox.Type.Null()]), + createdAt: typebox.Type.String(), + updatedAt: typebox.Type.String() +}); +var SlotCountSchema = typebox.Type.Object({ + free: typebox.Type.Integer(), + used: typebox.Type.Integer() +}); +var ThreeClassIntegersSchema = typebox.Type.Object({ + small: typebox.Type.Integer(), + medium: typebox.Type.Integer(), + high: typebox.Type.Integer() +}); +var DataPathwayCapacitySchema = typebox.Type.Object({ + slots: typebox.Type.Object({ + small: SlotCountSchema, + medium: SlotCountSchema, + high: SlotCountSchema + }), + pendingAssignments: ThreeClassIntegersSchema +}); +var DataPathwayQuotaSchema = typebox.Type.Object({ + tenant: typebox.Type.String(), + maxSlots: ThreeClassIntegersSchema, + createdAt: typebox.Type.String(), + updatedAt: typebox.Type.String() +}); +var DataPathwayQuotaWithUsageSchema = typebox.Type.Object({ + tenant: typebox.Type.String(), + maxSlots: ThreeClassIntegersSchema, + used: ThreeClassIntegersSchema +}); +var DataPathwayQuotaListSchema = typebox.Type.Object({ + quotas: typebox.Type.Array(DataPathwayQuotaSchema), + total: typebox.Type.Integer() +}); +var DataPathwayQuotaSetResponseSchema = typebox.Type.Object({ + tenant: typebox.Type.String(), + status: typebox.Type.String() +}); +var PumpStateValueSchema = typebox.Type.Object({ + timeBucket: typebox.Type.String(), + eventId: typebox.Type.Optional(typebox.Type.String()) +}); +var DataPathwayPumpStateSchema = typebox.Type.Object({ + pathwayId: typebox.Type.String(), + flowType: typebox.Type.String(), + state: typebox.Type.Union([PumpStateValueSchema, typebox.Type.Null()]) +}); +var DataPathwayPumpStateBySourceSchema = typebox.Type.Object({ + pathwayId: typebox.Type.String(), + sourceId: typebox.Type.String(), + flowType: typebox.Type.Union([typebox.Type.String(), typebox.Type.Null()]), + state: typebox.Type.Union([PumpStateValueSchema, typebox.Type.Null()]) +}); +var DataPathwayPumpStateSaveResponseSchema = typebox.Type.Object({ + status: typebox.Type.String() +}); +var DataPathwayDeliveryLogEntrySchema = typebox.Type.Object({ + id: typebox.Type.String(), + pathwayId: typebox.Type.String(), + assignmentId: typebox.Type.String(), + endpointUrl: typebox.Type.String(), + httpStatus: typebox.Type.Union([typebox.Type.Integer(), typebox.Type.Null()]), + success: typebox.Type.Boolean(), + batchSize: typebox.Type.Union([typebox.Type.Integer(), typebox.Type.Null()]), + durationMs: typebox.Type.Union([typebox.Type.Integer(), typebox.Type.Null()]), + errorMessage: typebox.Type.Union([typebox.Type.String(), typebox.Type.Null()]), + responseBody: typebox.Type.Union([typebox.Type.String(), typebox.Type.Null()]), + flowType: typebox.Type.Union([typebox.Type.String(), typebox.Type.Null()]), + sourceId: typebox.Type.Union([typebox.Type.String(), typebox.Type.Null()]), + eventType: typebox.Type.Union([typebox.Type.String(), typebox.Type.Null()]), + createdAt: typebox.Type.String() +}); +var DataPathwayDeliveryLogListSchema = typebox.Type.Object({ + entries: typebox.Type.Array(DataPathwayDeliveryLogEntrySchema), + total: typebox.Type.Integer() +}); +typebox.Type.Object({ + pathwayId: typebox.Type.String(), + assignmentId: typebox.Type.String(), + endpointUrl: typebox.Type.String(), + flowType: typebox.Type.Optional(typebox.Type.String()), + sourceId: typebox.Type.Optional(typebox.Type.String()), + eventType: typebox.Type.Optional(typebox.Type.String()), + httpStatus: typebox.Type.Optional(typebox.Type.Integer()), + success: typebox.Type.Boolean(), + batchSize: typebox.Type.Optional(typebox.Type.Integer()), + durationMs: typebox.Type.Optional(typebox.Type.Integer()), + errorMessage: typebox.Type.Optional(typebox.Type.String()), + responseBody: typebox.Type.Optional(typebox.Type.String()) +}); +var DataPathwayDeliveryLogBatchResponseSchema = typebox.Type.Object({ + inserted: typebox.Type.Integer() +}); +var ThroughputRecentResultSchema = typebox.Type.Object({ + status: typebox.Type.Number(), + durationMs: typebox.Type.Number(), + success: typebox.Type.Boolean(), + ageMs: typebox.Type.Number() +}); +var ThroughputSourceSchema = typebox.Type.Object({ + flowType: typebox.Type.String(), + name: typebox.Type.Optional(typebox.Type.String()), + eventsPerSecond: typebox.Type.Number(), + successRate: typebox.Type.Number(), + avgDurationMs: typebox.Type.Number(), + totalDelivered: typebox.Type.Number(), + totalFailed: typebox.Type.Number(), + lastDeliveryAgeMs: typebox.Type.Union([typebox.Type.Number(), typebox.Type.Null()]), + healthy: typebox.Type.Boolean(), + recentResults: typebox.Type.Array(ThroughputRecentResultSchema) +}); +var ThroughputEndpointSchema = typebox.Type.Object({ + eventsPerSecond: typebox.Type.Number(), + successRate: typebox.Type.Number(), + totalDelivered: typebox.Type.Number(), + totalFailed: typebox.Type.Number(), + lastDeliveryAgeMs: typebox.Type.Union([typebox.Type.Number(), typebox.Type.Null()]), + healthy: typebox.Type.Boolean(), + sources: typebox.Type.Record(typebox.Type.String(), ThroughputSourceSchema) +}); +var ThroughputSnapshotSchema = typebox.Type.Object({ + global: typebox.Type.Object({ + eventsPerSecond: typebox.Type.Number(), + totalRecorded: typebox.Type.Number(), + windowSeconds: typebox.Type.Number() + }), + endpoints: typebox.Type.Record(typebox.Type.String(), ThroughputEndpointSchema) +}); +var MetricsAssignmentEntrySchema = typebox.Type.Object({ + assignmentId: typebox.Type.String(), + status: typebox.Type.String(), + throughput: typebox.Type.Union([ThroughputSnapshotSchema, typebox.Type.Null()]), + updatedAt: typebox.Type.String() +}); +var DataPathwayMetricsSchema = typebox.Type.Object({ + pathwayId: typebox.Type.String(), + assignments: typebox.Type.Array(MetricsAssignmentEntrySchema) +}); +var DataPathwayHealthSchema = typebox.Type.Object({ + status: typebox.Type.Union([typebox.Type.Literal("healthy"), typebox.Type.Literal("unhealthy")]), + checks: typebox.Type.Object({ db: typebox.Type.Union([typebox.Type.Literal("ok"), typebox.Type.Literal("error")]) }), + uptime: typebox.Type.Number() +}); +var DataPathwayPumpPulseResponseSchema = typebox.Type.Object({ + status: typebox.Type.String() +}); +var PumpPulseEntrySchema = typebox.Type.Object({ + flowType: typebox.Type.String(), + timeBucket: typebox.Type.String(), + eventId: typebox.Type.Union([typebox.Type.String(), typebox.Type.Null()]), + isLive: typebox.Type.Boolean(), + buffer: typebox.Type.Object({ + depth: typebox.Type.Number(), + reserved: typebox.Type.Number(), + sizeBytes: typebox.Type.Number() + }), + counters: typebox.Type.Object({ + acknowledged: typebox.Type.Number(), + failed: typebox.Type.Number(), + pulled: typebox.Type.Number() + }), + uptimeMs: typebox.Type.Number(), + lastPulseAgeMs: typebox.Type.Number(), + healthy: typebox.Type.Boolean() +}); +var PumpStatusAssignmentSchema = typebox.Type.Object({ + id: typebox.Type.String(), + status: typebox.Type.String(), + leaseRemainingMs: typebox.Type.Number(), + lastHeartbeatAgeMs: typebox.Type.Number(), + metrics: typebox.Type.Unknown() +}); +var DataPathwayPumpStatusSchema = typebox.Type.Object({ + pathwayId: typebox.Type.String(), + pulses: typebox.Type.Array(PumpPulseEntrySchema), + assignment: typebox.Type.Union([PumpStatusAssignmentSchema, typebox.Type.Null()]) +}); + +// src/commands/data-pathways/assignment.expire-leases.ts +init_parse_response_helper(); +var DataPathwayAssignmentExpireLeasesCommand = class extends exports.Command { + retryOnFailure = false; + allowedModes = ["apiKey"]; + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/assignments/expire-leases`; + } + getBody() { + return void 0; + } + parseResponse(rawResponse) { + return exports.parseResponseHelper(DataPathwayExpireLeasesResponseSchema, rawResponse); + } +}; + +// src/commands/data-pathways/assignment.fetch.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var DataPathwayAssignmentFetchCommand = class extends exports.Command { + allowedModes = ["bearer"]; + getMethod() { + return "GET"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/assignments/${this.input.id}`; + } + parseResponse(rawResponse) { + return exports.parseResponseHelper(DataPathwayAssignmentSchema, rawResponse); + } + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("DataPathwayAssignment", { id: this.input.id }); + } + throw error; + } +}; + +// src/commands/data-pathways/assignment.heartbeat.ts +init_command(); +var DataPathwayAssignmentHeartbeatCommand = class extends exports.Command { + retryOnFailure = false; + allowedModes = ["apiKey"]; + getMethod() { + return "POST"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/assignments/heartbeat`; + } + parseResponse(_rawResponse) { + return null; + } +}; + +// src/commands/data-pathways/assignment.list.ts +init_command(); +init_parse_response_helper(); +var DataPathwayAssignmentListCommand = class extends exports.Command { + allowedModes = ["bearer"]; + getMethod() { + return "GET"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + const queryParams = new URLSearchParams(); + if (this.input.status) queryParams.set("status", this.input.status); + if (this.input.slotId) queryParams.set("slotId", this.input.slotId); + if (this.input.pathwayId) queryParams.set("pathwayId", this.input.pathwayId); + if (this.input.limit !== void 0) queryParams.set("limit", String(this.input.limit)); + if (this.input.offset !== void 0) queryParams.set("offset", String(this.input.offset)); + if (this.input.sort) queryParams.set("sort", this.input.sort); + const qs = queryParams.toString(); + return `/api/v1/assignments${qs ? `?${qs}` : ""}`; + } + parseResponse(rawResponse) { + return exports.parseResponseHelper(DataPathwayAssignmentListSchema, rawResponse); + } +}; + +// src/commands/data-pathways/assignment.next.ts +init_command(); +init_parse_response_helper(); +var DataPathwayAssignmentNextCommand = class extends exports.Command { + retryOnFailure = false; + allowedModes = ["apiKey"]; + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/assignments/next`; + } + parseResponse(rawResponse) { + return exports.parseResponseHelper(DataPathwayAssignmentNextSchema, rawResponse); + } +}; + +// src/commands/data-pathways/capacity.fetch.ts +init_command(); +init_parse_response_helper(); +var DataPathwayCapacityFetchCommand = class extends exports.Command { + allowedModes = ["bearer"]; + getMethod() { + return "GET"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/capacity`; + } + parseResponse(rawResponse) { + return exports.parseResponseHelper(DataPathwayCapacitySchema, rawResponse); + } +}; + +// src/commands/data-pathways/command.dispatch-config-update.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var DataPathwayCommandDispatchConfigUpdateCommand = class extends exports.Command { + retryOnFailure = false; + allowedModes = ["bearer"]; + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/assignments/${this.input.assignmentId}/commands/config-update`; + } + getBody() { + const { assignmentId: _assignmentId, ...payload } = this.input; + return payload; + } + parseResponse(rawResponse) { + return exports.parseResponseHelper(DataPathwayCommandResponseSchema, rawResponse); + } + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("DataPathwayAssignment", { id: this.input.assignmentId }); + } + throw error; + } +}; + +// src/commands/data-pathways/command.dispatch-restart.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var DataPathwayCommandDispatchRestartCommand = class extends exports.Command { + retryOnFailure = false; + allowedModes = ["bearer"]; + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/assignments/${this.input.assignmentId}/commands/datapump-restart`; + } + getBody() { + const { assignmentId: _assignmentId, ...payload } = this.input; + return payload; + } + parseResponse(rawResponse) { + return exports.parseResponseHelper(DataPathwayCommandResponseSchema, rawResponse); + } + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("DataPathwayAssignment", { id: this.input.assignmentId }); + } + throw error; + } +}; + +// src/commands/data-pathways/command.dispatch-stop.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var DataPathwayCommandDispatchStopCommand = class extends exports.Command { + retryOnFailure = false; + allowedModes = ["bearer"]; + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/assignments/${this.input.assignmentId}/commands/stop`; + } + getBody() { + const { assignmentId: _assignmentId, ...payload } = this.input; + return payload; + } + parseResponse(rawResponse) { + return exports.parseResponseHelper(DataPathwayCommandResponseSchema, rawResponse); + } + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("DataPathwayAssignment", { id: this.input.assignmentId }); + } + throw error; + } +}; + +// src/commands/data-pathways/command.fetch.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var DataPathwayCommandFetchCommand = class extends exports.Command { + allowedModes = ["bearer", "apiKey"]; + getMethod() { + return "GET"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/commands/${this.input.commandId}`; + } + parseResponse(rawResponse) { + return exports.parseResponseHelper(DataPathwayCommandDetailSchema, rawResponse); + } + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("DataPathwayCommand", { commandId: this.input.commandId }); + } + throw error; + } +}; + +// src/commands/data-pathways/command.pending.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var DataPathwayCommandPendingCommand = class extends exports.Command { + allowedModes = ["apiKey"]; + getMethod() { + return "GET"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/assignments/${this.input.assignmentId}/commands/pending`; + } + parseResponse(rawResponse) { + return exports.parseResponseHelper(DataPathwayCommandListSchema, rawResponse); + } + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("DataPathwayAssignment", { id: this.input.assignmentId }); + } + throw error; + } +}; + +// src/commands/data-pathways/command.update-status.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var DataPathwayCommandUpdateStatusCommand = class extends exports.Command { + retryOnFailure = false; + allowedModes = ["apiKey"]; + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/assignments/${this.input.assignmentId}/commands/${this.input.commandId}/status`; + } + getBody() { + const { assignmentId: _assignmentId, commandId: _commandId, ...payload } = this.input; + return payload; + } + parseResponse(rawResponse) { + return exports.parseResponseHelper(DataPathwayCommandResponseSchema, rawResponse); + } + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("DataPathwayCommand", { + assignmentId: this.input.assignmentId, + commandId: this.input.commandId + }); + } + throw error; + } +}; + +// src/commands/data-pathways/delivery-log.batch.ts +init_command(); +init_parse_response_helper(); +var DataPathwayDeliveryLogBatchCommand = class extends exports.Command { + retryOnFailure = false; + allowedModes = ["apiKey"]; + getMethod() { + return "POST"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return "/api/v1/delivery-log/batch"; + } + getBody() { + return { entries: this.input.entries }; + } + parseResponse(rawResponse) { + return exports.parseResponseHelper(DataPathwayDeliveryLogBatchResponseSchema, rawResponse); + } +}; + +// src/commands/data-pathways/delivery-log.list.ts +init_command(); +init_parse_response_helper(); +var DataPathwayDeliveryLogListCommand = class extends exports.Command { + allowedModes = ["bearer"]; + getMethod() { + return "GET"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + const queryParams = new URLSearchParams(); + queryParams.set("pathwayId", this.input.pathwayId); + if (this.input.success !== void 0) queryParams.set("success", String(this.input.success)); + if (this.input.limit !== void 0) queryParams.set("limit", String(this.input.limit)); + if (this.input.offset !== void 0) queryParams.set("offset", String(this.input.offset)); + if (this.input.sort) queryParams.set("sort", this.input.sort); + return `/api/v1/delivery-log?${queryParams}`; + } + parseResponse(rawResponse) { + return exports.parseResponseHelper(DataPathwayDeliveryLogListSchema, rawResponse); + } +}; + +// src/commands/data-pathways/health.check.ts +init_command(); +init_parse_response_helper(); +var DataPathwayHealthCheckCommand = class extends exports.Command { + retryOnFailure = false; + allowedModes = ["bearer"]; + getMethod() { + return "GET"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return "/api/v1/health"; + } + parseResponse(rawResponse) { + return exports.parseResponseHelper(DataPathwayHealthSchema, rawResponse); + } +}; + +// src/commands/data-pathways/pathway.create.ts +init_command(); +init_parse_response_helper(); +var DataPathwayCreateCommand = class extends exports.Command { + retryOnFailure = false; + allowedModes = ["bearer"]; + getMethod() { + return "PUT"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/pathways/${this.input.id}`; + } + getBody() { + const { id: _id, ...payload } = this.input; + return payload; + } + parseResponse(rawResponse) { + return exports.parseResponseHelper(DataPathwayMutationResponseSchema, rawResponse); + } +}; + +// src/commands/data-pathways/pathway.delete.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var DataPathwayDeleteCommand = class extends exports.Command { + retryOnFailure = false; + allowedModes = ["bearer"]; + getMethod() { + return "DELETE"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/pathways/${this.input.id}`; + } + getBody() { + const { id: _id, ...payload } = this.input; + return payload; + } + parseResponse(rawResponse) { + return exports.parseResponseHelper(DataPathwayMutationResponseSchema, rawResponse); + } + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("DataPathway", { id: this.input.id }); + } + throw error; + } +}; + +// src/commands/data-pathways/pathway.disable.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var DataPathwayDisableCommand = class extends exports.Command { + retryOnFailure = false; + allowedModes = ["bearer"]; + getMethod() { + return "POST"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/pathways/${this.input.id}/disable`; + } + getBody() { + const { id: _id, ...payload } = this.input; + return payload; + } + parseResponse(rawResponse) { + return exports.parseResponseHelper(DataPathwayMutationResponseSchema, rawResponse); + } + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("DataPathway", { id: this.input.id }); + } + throw error; + } +}; + +// src/commands/data-pathways/pathway.fetch.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var DataPathwayFetchCommand = class extends exports.Command { + allowedModes = ["bearer"]; + getMethod() { + return "GET"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/pathways/${this.input.id}`; + } + parseResponse(rawResponse) { + return exports.parseResponseHelper(DataPathwaySchema, rawResponse); + } + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("DataPathway", { id: this.input.id }); + } + throw error; + } +}; + +// src/commands/data-pathways/pathway.fetch-by-name.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var DataPathwayFetchByNameCommand = class extends exports.Command { + allowedModes = ["apiKey"]; + getMethod() { + return "GET"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + const qs = new URLSearchParams({ tenant: this.input.tenant }).toString(); + return `/api/v1/pathways/by-name/${encodeURIComponent(this.input.name)}?${qs}`; + } + parseResponse(rawResponse) { + return exports.parseResponseHelper(DataPathwaySchema, rawResponse); + } + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("DataPathway", { name: this.input.name, tenant: this.input.tenant }); + } + throw error; + } +}; + +// src/commands/data-pathways/pathway.list.ts +init_command(); +init_parse_response_helper(); +var DataPathwayListCommand = class extends exports.Command { + allowedModes = ["bearer"]; + getMethod() { + return "GET"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + const queryParams = new URLSearchParams(); + if (this.input.tenant) queryParams.set("tenant", this.input.tenant); + if (this.input.sizeClass) queryParams.set("sizeClass", this.input.sizeClass); + if (this.input.type) queryParams.set("type", this.input.type); + if (this.input.enabled !== void 0) queryParams.set("enabled", String(this.input.enabled)); + if (this.input.priority !== void 0) queryParams.set("priority", String(this.input.priority)); + if (this.input.limit !== void 0) queryParams.set("limit", String(this.input.limit)); + if (this.input.offset !== void 0) queryParams.set("offset", String(this.input.offset)); + if (this.input.page !== void 0) queryParams.set("page", String(this.input.page)); + if (this.input.ids !== void 0) { + const ids = Array.isArray(this.input.ids) ? this.input.ids.join(",") : this.input.ids; + queryParams.set("ids", ids); + } + if (this.input.sort) queryParams.set("sort", this.input.sort); + const qs = queryParams.toString(); + return `/api/v1/pathways${qs ? `?${qs}` : ""}`; + } + parseResponse(rawResponse) { + return exports.parseResponseHelper(DataPathwayListSchema, rawResponse); + } +}; + +// src/commands/data-pathways/pathway.metrics.fetch.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var DataPathwayMetricsFetchCommand = class extends exports.Command { + allowedModes = ["bearer"]; + getMethod() { + return "GET"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/pathways/${this.input.id}/metrics`; + } + parseResponse(rawResponse) { + return exports.parseResponseHelper(DataPathwayMetricsSchema, rawResponse); + } + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("DataPathway", { id: this.input.id }); + } + throw error; + } +}; + +// src/commands/data-pathways/pathway.upsert-by-name.ts +init_command(); +init_parse_response_helper(); +var DataPathwayUpsertByNameResponseSchema = typebox.Type.Object({ + pathwayId: typebox.Type.String(), + status: typebox.Type.Union([typebox.Type.Literal("created"), typebox.Type.Literal("updated")]) +}); +var DataPathwayUpsertByNameCommand = class extends exports.Command { + retryOnFailure = false; + allowedModes = ["apiKey"]; + getMethod() { + return "PUT"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/pathways/by-name/${encodeURIComponent(this.input.name)}`; + } + getBody() { + const { name: _name, ...payload } = this.input; + return payload; + } + parseResponse(rawResponse) { + return exports.parseResponseHelper(DataPathwayUpsertByNameResponseSchema, rawResponse); + } +}; + +// src/commands/data-pathways/pathway-command.dispatch-pause.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var DataPathwayCommandDispatchPauseCommand = class extends exports.Command { + retryOnFailure = false; + allowedModes = ["bearer"]; + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/pathways/${this.input.pathwayId}/commands/pause`; + } + getBody() { + const { pathwayId: _pathwayId, ...payload } = this.input; + return payload; + } + parseResponse(rawResponse) { + return exports.parseResponseHelper(DataPathwayCommandResponseSchema, rawResponse); + } + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("DataPathway", { id: this.input.pathwayId }); + } + } +}; + +// src/commands/data-pathways/pathway-command.dispatch-resume.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var DataPathwayCommandDispatchResumeCommand = class extends exports.Command { + retryOnFailure = false; + allowedModes = ["bearer"]; + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/pathways/${this.input.pathwayId}/commands/resume`; + } + getBody() { + const { pathwayId: _pathwayId, ...payload } = this.input; + return payload; + } + parseResponse(rawResponse) { + return exports.parseResponseHelper(DataPathwayCommandResponseSchema, rawResponse); + } + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("DataPathway", { id: this.input.pathwayId }); + } + } +}; + +// src/commands/data-pathways/pathway-command.pending.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var DataPathwayCommandPendingByPathwayCommand = class extends exports.Command { + allowedModes = ["bearer", "apiKey"]; + getMethod() { + return "GET"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/pathways/${this.input.pathwayId}/commands/pending`; + } + parseResponse(rawResponse) { + return exports.parseResponseHelper(DataPathwayCommandListSchema, rawResponse); + } + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("DataPathway", { id: this.input.pathwayId }); + } + throw error; + } +}; + +// src/commands/data-pathways/pathway-command.update-status.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var DataPathwayCommandUpdateStatusByPathwayCommand = class extends exports.Command { + retryOnFailure = false; + allowedModes = ["bearer", "apiKey"]; + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/pathways/${this.input.pathwayId}/commands/${this.input.commandId}/status`; + } + getBody() { + const { pathwayId: _pathwayId, commandId: _commandId, ...payload } = this.input; + return payload; + } + parseResponse(rawResponse) { + return exports.parseResponseHelper(DataPathwayCommandResponseSchema, rawResponse); + } + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("DataPathwayCommand", { + pathwayId: this.input.pathwayId, + commandId: this.input.commandId + }); + } + throw error; + } +}; + +// src/commands/data-pathways/pump-pulse.send.ts +init_command(); +init_parse_response_helper(); +var SendPumpPulseCommand = class extends exports.Command { + retryOnFailure = false; + allowedModes = ["apiKey"]; + getMethod() { + return "POST"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/pump-pulse`; + } + parseResponse(rawResponse) { + return exports.parseResponseHelper(DataPathwayPumpPulseResponseSchema, rawResponse); + } +}; + +// src/commands/data-pathways/pump-state.fetch.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var DataPathwayPumpStateFetchCommand = class extends exports.Command { + allowedModes = ["apiKey"]; + getMethod() { + return "GET"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/pump-states/${this.input.pathwayId}/${encodeURIComponent(this.input.flowType)}`; + } + parseResponse(rawResponse) { + return exports.parseResponseHelper(DataPathwayPumpStateSchema, rawResponse); + } + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("DataPathwayPumpState", { + pathwayId: this.input.pathwayId, + flowType: this.input.flowType + }); + } + throw error; + } +}; + +// src/commands/data-pathways/pump-state.fetch-by-source.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var DataPathwayPumpStateFetchBySourceCommand = class extends exports.Command { + allowedModes = ["apiKey"]; + getMethod() { + return "GET"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/pump-states/${this.input.pathwayId}/sources/${this.input.sourceId}`; + } + parseResponse(rawResponse) { + return exports.parseResponseHelper(DataPathwayPumpStateBySourceSchema, rawResponse); + } + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("DataPathwayPumpState", { + pathwayId: this.input.pathwayId, + sourceId: this.input.sourceId + }); + } + throw error; + } +}; + +// src/commands/data-pathways/pump-state.save.ts +init_command(); +init_parse_response_helper(); +var DataPathwayPumpStateSaveCommand = class extends exports.Command { + retryOnFailure = false; + allowedModes = ["apiKey"]; + getMethod() { + return "POST"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/pump-states/${this.input.pathwayId}/${encodeURIComponent(this.input.flowType)}`; + } + getBody() { + return { state: this.input.state }; + } + parseResponse(rawResponse) { + return exports.parseResponseHelper(DataPathwayPumpStateSaveResponseSchema, rawResponse); + } +}; + +// src/commands/data-pathways/pump-state.save-by-source.ts +init_command(); +init_parse_response_helper(); +var DataPathwayPumpStateSaveBySourceCommand = class extends exports.Command { + retryOnFailure = false; + allowedModes = ["apiKey"]; + getMethod() { + return "PUT"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/pump-states/${this.input.pathwayId}/sources/${this.input.sourceId}`; + } + getBody() { + return { state: this.input.state }; + } + parseResponse(rawResponse) { + return exports.parseResponseHelper(DataPathwayPumpStateSaveResponseSchema, rawResponse); + } +}; + +// src/commands/data-pathways/pump-status.fetch.ts +init_command(); +init_parse_response_helper(); +init_not_found(); +var FetchPumpStatusCommand = class extends exports.Command { + retryOnFailure = true; + allowedModes = ["bearer", "apiKey"]; + getMethod() { + return "GET"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/pathways/${this.input.pathwayId}/pump-status`; + } + getBody() { + return void 0; + } + parseResponse(rawResponse) { + return exports.parseResponseHelper(DataPathwayPumpStatusSchema, rawResponse); + } + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("Pathway", { pathwayId: this.input.pathwayId }); + } + throw error; + } +}; + +// src/commands/data-pathways/quota.fetch.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var DataPathwayQuotaFetchCommand = class extends exports.Command { + allowedModes = ["bearer"]; + getMethod() { + return "GET"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/quotas/${this.input.tenant}`; + } + parseResponse(rawResponse) { + return exports.parseResponseHelper(DataPathwayQuotaWithUsageSchema, rawResponse); + } + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("DataPathwayQuota", { tenant: this.input.tenant }); + } + throw error; + } +}; + +// src/commands/data-pathways/quota.list.ts +init_command(); +init_parse_response_helper(); +var DataPathwayQuotaListCommand = class extends exports.Command { + allowedModes = ["bearer"]; + getMethod() { + return "GET"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/quotas`; + } + parseResponse(rawResponse) { + return exports.parseResponseHelper(DataPathwayQuotaListSchema, rawResponse); + } +}; + +// src/commands/data-pathways/quota.set.ts +init_command(); +init_parse_response_helper(); +var DataPathwayQuotaSetCommand = class extends exports.Command { + retryOnFailure = false; + allowedModes = ["bearer"]; + getMethod() { + return "PUT"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/quotas/${this.input.tenant}`; + } + getBody() { + const { tenant: _tenant, ...payload } = this.input; + return payload; + } + parseResponse(rawResponse) { + return exports.parseResponseHelper(DataPathwayQuotaSetResponseSchema, rawResponse); + } +}; + +// src/commands/data-pathways/restart.fetch.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var DataPathwayRestartFetchCommand = class extends exports.Command { + allowedModes = ["bearer"]; + getMethod() { + return "GET"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/restarts/${this.input.id}`; + } + parseResponse(rawResponse) { + return exports.parseResponseHelper(DataPathwayRestartRequestSchema, rawResponse); + } + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("DataPathwayRestartRequest", { id: this.input.id }); + } + throw error; + } +}; + +// src/commands/data-pathways/restart.request.ts +init_command(); +init_parse_response_helper(); +var DataPathwayRestartRequestCommand = class extends exports.Command { + retryOnFailure = false; + allowedModes = ["bearer"]; + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/restarts/request`; + } + parseResponse(rawResponse) { + return exports.parseResponseHelper(DataPathwayRestartRequestResponseSchema, rawResponse); + } +}; + +// src/commands/data-pathways/slot.deregister.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var DataPathwaySlotDeregisterCommand = class extends exports.Command { + retryOnFailure = false; + allowedModes = ["apiKey"]; + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/slots/${this.input.id}/deregister`; + } + getBody() { + const { id: _id, ...payload } = this.input; + return payload; + } + parseResponse(rawResponse) { + return exports.parseResponseHelper(DataPathwaySlotMutationResponseSchema, rawResponse); + } + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("DataPathwaySlot", { id: this.input.id }); + } + throw error; + } +}; + +// src/commands/data-pathways/slot.fetch.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var DataPathwaySlotFetchCommand = class extends exports.Command { + allowedModes = ["apiKey"]; + getMethod() { + return "GET"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/slots/${this.input.id}`; + } + parseResponse(rawResponse) { + return exports.parseResponseHelper(DataPathwaySlotSchema, rawResponse); + } + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("DataPathwaySlot", { id: this.input.id }); + } + throw error; + } +}; + +// src/commands/data-pathways/slot.heartbeat.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var DataPathwaySlotHeartbeatCommand = class extends exports.Command { + retryOnFailure = false; + allowedModes = ["apiKey"]; + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/slots/${this.input.id}/heartbeat`; + } + getBody() { + return {}; + } + parseResponse(rawResponse) { + return exports.parseResponseHelper(DataPathwaySlotMutationResponseSchema, rawResponse); + } + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("DataPathwaySlot", { id: this.input.id }); + } + throw error; + } +}; + +// src/commands/data-pathways/slot.list.ts +init_command(); +init_parse_response_helper(); +var DataPathwaySlotListCommand = class extends exports.Command { + allowedModes = ["apiKey"]; + getMethod() { + return "GET"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + const queryParams = new URLSearchParams(); + if (this.input.class) queryParams.set("class", this.input.class); + if (this.input.limit !== void 0) queryParams.set("limit", String(this.input.limit)); + if (this.input.offset !== void 0) queryParams.set("offset", String(this.input.offset)); + if (this.input.sort) queryParams.set("sort", this.input.sort); + const qs = queryParams.toString(); + return `/api/v1/slots${qs ? `?${qs}` : ""}`; + } + parseResponse(rawResponse) { + return exports.parseResponseHelper(DataPathwaySlotListSchema, rawResponse); + } +}; + +// src/commands/data-pathways/slot.register.ts +init_command(); +init_parse_response_helper(); +var DataPathwaySlotRegisterCommand = class extends exports.Command { + retryOnFailure = false; + allowedModes = ["apiKey"]; + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/slots/register`; + } + parseResponse(rawResponse) { + return exports.parseResponseHelper(DataPathwaySlotMutationResponseSchema, rawResponse); + } +}; + +// src/commands/iam/permissions/get-user-permissions.ts +init_command(); +init_parse_response_helper(); +var UserPermissionSchema = typebox.Type.Object({ + tenant: typebox.Type.String(), + type: typebox.Type.String(), + id: typebox.Type.String(), + action: typebox.Type.Array(typebox.Type.String()) +}); +var UserPermissionsCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = true; + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return "/api/v1/permissions/"; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(typebox.Type.Array(UserPermissionSchema), rawResponse); + } +}; + +// src/commands/iam/policies/create-policy.ts +init_command(); +init_parse_response_helper(); +var PolicyFilterValueSchema = typebox.Type.Union([ + typebox.Type.String({ maxLength: 512 }), + typebox.Type.Number(), + typebox.Type.Boolean(), + typebox.Type.Null() +]); +var PolicyFilterPathSchema = typebox.Type.String({ + minLength: 1, + maxLength: 256, + pattern: "^[A-Za-z0-9_-]+(?:\\.[A-Za-z0-9_-]+){0,7}$" +}); +var PolicyFilterSchema = typebox.Type.Union([ + typebox.Type.Object({ path: PolicyFilterPathSchema, operator: typebox.Type.Literal("equals"), value: PolicyFilterValueSchema }, { additionalProperties: false }), + typebox.Type.Object({ path: PolicyFilterPathSchema, operator: typebox.Type.Literal("oneOf"), values: typebox.Type.Array(PolicyFilterValueSchema, { minItems: 1, maxItems: 20 }) }, { additionalProperties: false }), + typebox.Type.Object({ path: PolicyFilterPathSchema, operator: typebox.Type.Literal("exists"), value: typebox.Type.Boolean() }, { additionalProperties: false }) +]); +var RESERVED_PATH_SEGMENTS = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]); +function ownPath(payload, path) { + let current = payload; + for (const segment of path.split(".")) { + if (RESERVED_PATH_SEGMENTS.has(segment) || typeof current !== "object" || current === null || Array.isArray(current)) { + return { exists: false }; + } + if (!Object.hasOwn(current, segment)) return { exists: false }; + current = current[segment]; + } + return { exists: true, value: current }; +} +function isEncryptedPayload(payload) { + if (typeof payload !== "object" || payload === null || Array.isArray(payload)) return false; + if (!Object.hasOwn(payload, "encryptedPayload")) return false; + const keys = Object.keys(payload); + const value = payload.encryptedPayload; + return keys.length === 1 && typeof value === "string" && value.split(".").length === 3; +} +function matchesPolicyFilters(filters, payload) { + if (isEncryptedPayload(payload)) return false; + return filters.every((filter) => { + const resolved = ownPath(payload, filter.path); + if (filter.operator === "exists") return resolved.exists === filter.value; + if (!resolved.exists) return false; + if (filter.operator === "equals") return resolved.value === filter.value; + return filter.values.some((value) => resolved.value === value); + }); +} +function permitsPayload(grants, payload) { + return grants.some((grant) => grant.filters === void 0 || matchesPolicyFilters(grant.filters, payload)); +} + +// src/commands/iam/policies/create-policy.ts +var PolicyStatementSchema = typebox.Type.Object({ + statementId: typebox.Type.Optional(typebox.Type.String()), + resource: typebox.Type.String(), + action: typebox.Type.Union([typebox.Type.String(), typebox.Type.Array(typebox.Type.String())]), + filters: typebox.Type.Optional(typebox.Type.Array(PolicyFilterSchema, { minItems: 1, maxItems: 10 })) +}); +var PolicySchema = typebox.Type.Object({ + id: typebox.Type.String(), + organizationId: typebox.Type.String(), + name: typebox.Type.String(), + version: typebox.Type.String(), + policyDocuments: typebox.Type.Array(PolicyStatementSchema), + description: typebox.Type.Optional(typebox.Type.String()), + principal: typebox.Type.Optional(typebox.Type.String()), + flowcoreManaged: typebox.Type.Boolean(), + archived: typebox.Type.Optional(typebox.Type.Boolean()), + frn: typebox.Type.String() +}); +var PolicyCreateCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return "/api/v1/policies/"; + } + /** + * Get the body + */ + getBody() { + return { + ...this.input, + flowcoreManaged: this.input.flowcoreManaged ?? false + }; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(PolicySchema, rawResponse); + } +}; + +// src/commands/iam/policies/get-policy.ts +init_command(); +init_parse_response_helper(); +var PolicyListCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = true; + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return "/api/v1/policies/"; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(typebox.Type.Array(PolicySchema), rawResponse); + } +}; + +// src/commands/iam/policies/validate-policy.ts +init_command(); +init_parse_response_helper(); +var PolicyValidateResponseSchema = typebox.Type.Object({ + valid: typebox.Type.Literal(true) +}); +var PolicyValidateCommand = class extends exports.Command { + /** + * Whether the command should retry on failure. + * + * Disabled because a 422 here indicates an invalid payload — retrying + * would just re-submit the same bad data. + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return "/api/v1/policies/validate"; + } + /** + * Get the body + */ + getBody() { + return { + ...this.input + }; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(PolicyValidateResponseSchema, rawResponse); + } +}; + +// src/commands/iam/policies/id/archive-policy.ts +init_command(); +init_parse_response_helper(); +var ArchivePolicyResponseSchema = typebox.Type.Object({ + message: typebox.Type.String() +}); +var PolicyArchiveCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "DELETE"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/policies/${this.input.policyId}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(ArchivePolicyResponseSchema, rawResponse); + } +}; + +// src/commands/iam/policies/id/get-policy.ts +init_command(); +init_parse_response_helper(); +var PolicyGetCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = true; + constructor(inputOrPolicyId) { + const input = typeof inputOrPolicyId === "string" ? { policyId: inputOrPolicyId } : inputOrPolicyId; + super(input); + } + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/policies/${this.input.policyId}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(PolicySchema, rawResponse); + } +}; + +// src/commands/iam/policies/id/update-policy.ts +init_command(); +init_parse_response_helper(); +var PolicyUpdateCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "PATCH"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/policies/${this.input.policyId}`; + } + /** + * Get the body + */ + getBody() { + const { ...rest } = this.input; + return { + ...rest, + flowcoreManaged: rest.flowcoreManaged ?? false + }; + } + getHeaders() { + return { ...super.getHeaders(), "x-flowcore-policy-conditions": "1" }; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(PolicySchema, rawResponse); + } +}; + +// src/commands/iam/policy-associations/get-key-policies.ts +init_command(); +init_parse_response_helper(); +var parseKeyPoliciesResponse = (rawResponse) => { + if (!rawResponse) { + return []; + } + if (!Array.isArray(rawResponse)) { + if (typeof rawResponse === "object" && "data" in rawResponse) { + return parseKeyPoliciesResponse(rawResponse.data); + } + if (typeof rawResponse === "object" && "policies" in rawResponse) { + return parseKeyPoliciesResponse( + rawResponse.policies + ); + } + return []; + } + try { + return exports.parseResponseHelper(typebox.Type.Array(PolicySchema), rawResponse); + } catch (error) { + if (error instanceof Error && error.message.includes("flowcoreManaged") && Array.isArray(rawResponse)) { + const sanitizedPolicies = rawResponse.map((policy) => ({ + ...policy, + // Convert to boolean using double negation + flowcoreManaged: policy.flowcoreManaged === true || !!policy.flowcoreManaged + })); + return exports.parseResponseHelper(typebox.Type.Array(PolicySchema), sanitizedPolicies); + } + throw error; + } +}; +var KeyPoliciesCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = true; + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/policy-associations/key/${this.input.keyId}/`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseKeyPoliciesResponse(rawResponse); + } +}; + +// src/commands/iam/policy-associations/get-organization-policies.ts +init_command(); +init_parse_response_helper(); +var OrganizationPoliciesCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = true; + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/policy-associations/organization/${this.input.organizationId}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + if (!rawResponse) { + return []; + } + if (Array.isArray(rawResponse)) { + return rawResponse.map((item) => { + try { + return exports.parseResponseHelper(PolicySchema, item); + } catch (_error) { + const policy = item; + const id = typeof policy.id === "string" ? policy.id : "unknown"; + return { + id, + name: typeof policy.name === "string" ? policy.name : "Unknown Policy", + version: typeof policy.version === "string" ? policy.version : "1.0", + description: typeof policy.description === "string" ? policy.description : "", + flowcoreManaged: Boolean(policy.flowcoreManaged), + policyDocuments: Array.isArray(policy.policyDocuments) ? policy.policyDocuments : [], + organizationId: this.input.organizationId, + frn: typeof policy.frn === "string" ? policy.frn : `frn::${this.input.organizationId}:policy/${id}`, + archived: policy.archived === void 0 ? false : Boolean(policy.archived) + }; + } + }); + } + return exports.parseResponseHelper(typebox.Type.Array(PolicySchema), rawResponse); + } +}; + +// src/commands/iam/policy-associations/get-policy-associations.ts +init_command(); +init_parse_response_helper(); +var PolicyKeyAssociationSchema = typebox.Type.Object({ + policyId: typebox.Type.String(), + organizationId: typebox.Type.String(), + keyId: typebox.Type.String() +}); +var PolicyUserAssociationSchema = typebox.Type.Object({ + policyId: typebox.Type.String(), + organizationId: typebox.Type.String(), + userId: typebox.Type.String() +}); +var PolicyRoleAssociationSchema = typebox.Type.Object({ + policyId: typebox.Type.String(), + organizationId: typebox.Type.String(), + roleId: typebox.Type.String() +}); +var PolicyAssociationsSchema = typebox.Type.Object({ + keys: typebox.Type.Array(PolicyKeyAssociationSchema), + users: typebox.Type.Array(PolicyUserAssociationSchema), + roles: typebox.Type.Array(PolicyRoleAssociationSchema) +}); +var parsePolicyAssociationsResponse = (rawResponse) => { + try { + return exports.parseResponseHelper(PolicyAssociationsSchema, rawResponse); + } catch (_error) { + if (!rawResponse || typeof rawResponse !== "object") { + return { keys: [], users: [], roles: [] }; + } + const rawData = rawResponse; + let keys = Array.isArray(rawData.keys) ? rawData.keys : []; + let users = Array.isArray(rawData.users) ? rawData.users : []; + let roles = Array.isArray(rawData.roles) ? rawData.roles : []; + try { + keys = exports.parseResponseHelper(typebox.Type.Array(PolicyKeyAssociationSchema), keys); + } catch (_error2) { + keys = []; + } + try { + users = exports.parseResponseHelper( + typebox.Type.Array(PolicyUserAssociationSchema), + users + ); + } catch (_error2) { + users = []; + } + try { + roles = exports.parseResponseHelper( + typebox.Type.Array(PolicyRoleAssociationSchema), + roles + ); + } catch (_error2) { + roles = []; + } + return { keys, users, roles }; + } +}; +var PolicyAssociationsCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = true; + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/policy-associations/${this.input.policyId}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parsePolicyAssociationsResponse(rawResponse); + } +}; + +// src/commands/iam/policy-associations/get-role-policies.ts +init_command(); +init_parse_response_helper(); +var parseRolePoliciesResponse = (rawResponse) => { + try { + return exports.parseResponseHelper(typebox.Type.Array(PolicySchema), rawResponse); + } catch (error) { + if (error instanceof Error && error.message.includes("flowcoreManaged") && Array.isArray(rawResponse)) { + const sanitizedPolicies = rawResponse.map((policy) => ({ + ...policy, + // Convert to boolean with explicit type-safe conversion + flowcoreManaged: policy.flowcoreManaged === true || policy.flowcoreManaged === "true" || typeof policy.flowcoreManaged === "boolean" && policy.flowcoreManaged + })); + return exports.parseResponseHelper(typebox.Type.Array(PolicySchema), sanitizedPolicies); + } + throw error; + } +}; +var RolePoliciesCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = true; + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/policy-associations/role/${this.input.roleId}/`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseRolePoliciesResponse(rawResponse); + } +}; + +// src/commands/iam/policy-associations/get-user-policies.ts +init_command(); +init_parse_response_helper(); +var UserPoliciesCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = true; + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/policy-associations/user/${this.input.userId}/`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(typebox.Type.Array(PolicySchema), rawResponse); + } +}; + +// src/commands/iam/policy-associations/link-key-policy.ts +init_command(); +init_parse_response_helper(); +var KeyPolicyLinkSchema = typebox.Type.Object({ + policyId: typebox.Type.String(), + organizationId: typebox.Type.String(), + keyId: typebox.Type.String() +}); +var LinkKeyPolicyCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/policy-associations/key/${this.input.keyId}/`; + } + /** + * Get the body + */ + getBody() { + return { + policyId: this.input.policyId + }; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(KeyPolicyLinkSchema, rawResponse); + } +}; + +// src/commands/iam/policy-associations/link-role-policy.ts +init_command(); +init_parse_response_helper(); +var RolePolicyLinkSchema = typebox.Type.Object({ + policyId: typebox.Type.String(), + organizationId: typebox.Type.String(), + roleId: typebox.Type.String() +}); +var LinkRolePolicyCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/policy-associations/role/${this.input.roleId}/`; + } + /** + * Get the body + */ + getBody() { + return { + policyId: this.input.policyId + }; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(RolePolicyLinkSchema, rawResponse); + } +}; + +// src/commands/iam/policy-associations/link-user-policy.ts +init_command(); +init_parse_response_helper(); +var UserPolicyLinkSchema = typebox.Type.Object({ + policyId: typebox.Type.String(), + organizationId: typebox.Type.String(), + userId: typebox.Type.String() +}); +var LinkUserPolicyCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/policy-associations/user/${this.input.userId}/`; + } + /** + * Get the body + */ + getBody() { + return { + policyId: this.input.policyId + }; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(UserPolicyLinkSchema, rawResponse); + } +}; + +// src/commands/iam/policy-associations/unlink-key-policy.ts +init_command(); +init_parse_response_helper(); +var UnlinkKeyPolicyCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "DELETE"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/policy-associations/key/${this.input.keyId}/`; + } + /** + * Get the body + */ + getBody() { + return { + policyId: this.input.policyId + }; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(KeyPolicyLinkSchema, rawResponse); + } +}; + +// src/commands/iam/policy-associations/unlink-role-policy.ts +init_command(); +init_parse_response_helper(); +var UnlinkRolePolicyCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "DELETE"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/policy-associations/role/${this.input.roleId}/`; + } + /** + * Get the body + */ + getBody() { + return { + policyId: this.input.policyId + }; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(RolePolicyLinkSchema, rawResponse); + } +}; + +// src/commands/iam/policy-associations/unlink-user-policy.ts +init_command(); +init_parse_response_helper(); +var UnlinkUserPolicyCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "DELETE"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/policy-associations/user/${this.input.userId}/`; + } + /** + * Get the body + */ + getBody() { + return { + policyId: this.input.policyId + }; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(UserPolicyLinkSchema, rawResponse); + } +}; + +// src/commands/iam/role-associations/get-key-roles.ts +init_command(); +init_parse_response_helper(); + +// src/commands/iam/roles/create-role.ts +init_command(); +init_parse_response_helper(); +var RoleSchema = typebox.Type.Object({ + id: typebox.Type.String(), + organizationId: typebox.Type.String(), + name: typebox.Type.String(), + description: typebox.Type.Optional(typebox.Type.String()), + flowcoreManaged: typebox.Type.Optional(typebox.Type.Boolean({ default: false })), + archived: typebox.Type.Optional(typebox.Type.Boolean()) +}); +var RoleCreateCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return "/api/v1/roles/"; + } + /** + * Get the body + */ + getBody() { + return { + ...this.input, + flowcoreManaged: this.input.flowcoreManaged ?? false + }; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(RoleSchema, rawResponse); + } +}; + +// src/commands/iam/role-associations/get-key-roles.ts +var KeyRolesCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = true; + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/role-associations/key/${this.input.keyId}/`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(typebox.Type.Array(RoleSchema), rawResponse); + } +}; + +// src/commands/iam/role-associations/get-organization-roles.ts +init_command(); +init_parse_response_helper(); +var FlexibleRoleSchema = typebox.Type.Object({ + id: typebox.Type.String(), + organizationId: typebox.Type.String(), + name: typebox.Type.String(), + description: typebox.Type.Optional(typebox.Type.String()), + flowcoreManaged: typebox.Type.Boolean(), + archived: typebox.Type.Optional(typebox.Type.Boolean()), + frn: typebox.Type.String(), + createdAt: typebox.Type.Optional(typebox.Type.String()), + updatedAt: typebox.Type.Optional(typebox.Type.String()) +}); +var OrganizationRolesCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = true; + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/role-associations/organization/${this.input.organizationId}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const flexibleRoles = exports.parseResponseHelper( + typebox.Type.Array(FlexibleRoleSchema), + rawResponse + ); + return flexibleRoles.map((role) => ({ + ...role, + archived: role.archived !== void 0 ? role.archived : false + })); + } +}; + +// src/commands/iam/role-associations/get-role-associations.ts +init_command(); +init_parse_response_helper(); +var RoleKeyAssociationSchema = typebox.Type.Object({ + roleId: typebox.Type.String(), + organizationId: typebox.Type.String(), + keyId: typebox.Type.String() +}); +var RoleUserAssociationSchema = typebox.Type.Object({ + roleId: typebox.Type.String(), + organizationId: typebox.Type.String(), + userId: typebox.Type.String() +}); +var RoleAssociationsSchema = typebox.Type.Object({ + keys: typebox.Type.Array(RoleKeyAssociationSchema), + users: typebox.Type.Array(RoleUserAssociationSchema) +}); +var RoleAssociationsCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = true; + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/role-associations/${this.input.roleId}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(RoleAssociationsSchema, rawResponse); + } +}; + +// src/commands/iam/role-associations/get-user-roles.ts +init_command(); +init_parse_response_helper(); +var UserRolesCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = true; + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + const basePath = `/api/v1/role-associations/user/${this.input.userId}/`; + if (this.input.organizationId) { + return `${basePath}?organizationId=${this.input.organizationId}`; + } + return basePath; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(typebox.Type.Array(RoleSchema), rawResponse); + } +}; + +// src/commands/iam/role-associations/link-key-role.ts +init_command(); +init_parse_response_helper(); +var KeyRoleLinkSchema = typebox.Type.Object({ + roleId: typebox.Type.String(), + organizationId: typebox.Type.String(), + keyId: typebox.Type.String() +}); +var LinkKeyRoleCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/role-associations/key/${this.input.keyId}/`; + } + /** + * Get the body + */ + getBody() { + return { + roleId: this.input.roleId + }; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(KeyRoleLinkSchema, rawResponse); + } +}; + +// src/commands/iam/role-associations/link-user-role.ts +init_command(); +init_parse_response_helper(); +var UserRoleLinkSchema = typebox.Type.Object({ + roleId: typebox.Type.String(), + organizationId: typebox.Type.String(), + userId: typebox.Type.String() +}); +var LinkUserRoleCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/role-associations/user/${this.input.userId}/`; + } + /** + * Get the body + */ + getBody() { + return { + roleId: this.input.roleId + }; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(UserRoleLinkSchema, rawResponse); + } +}; + +// src/commands/iam/role-associations/unlink-key-role.ts +init_command(); +init_parse_response_helper(); +var UnlinkKeyRoleCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "DELETE"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/role-associations/key/${this.input.keyId}/`; + } + /** + * Get the body + */ + getBody() { + return { + roleId: this.input.roleId + }; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(KeyRoleLinkSchema, rawResponse); + } +}; + +// src/commands/iam/role-associations/unlink-user-role.ts +init_command(); +init_parse_response_helper(); +var UnlinkUserRoleCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "DELETE"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/role-associations/user/${this.input.userId}/`; + } + /** + * Get the body + */ + getBody() { + return { + roleId: this.input.roleId + }; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(UserRoleLinkSchema, rawResponse); + } +}; + +// src/commands/iam/roles/get-roles.ts +init_command(); +init_parse_response_helper(); +var RoleListCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = true; + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return "/api/v1/roles/"; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(typebox.Type.Array(RoleSchema), rawResponse); + } +}; + +// src/commands/iam/roles/id/archive-role.ts +init_command(); +init_parse_response_helper(); +var ArchiveRoleResponseSchema = typebox.Type.Object({ + message: typebox.Type.String() +}); +var RoleArchiveCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "DELETE"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/roles/${this.input.roleId}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(ArchiveRoleResponseSchema, rawResponse); + } +}; + +// src/commands/iam/roles/id/get-role.ts +init_command(); +init_parse_response_helper(); +var RoleGetCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = true; + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/roles/${this.input.roleId}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(RoleSchema, rawResponse); + } +}; + +// src/commands/iam/roles/id/update-role.ts +init_command(); +init_parse_response_helper(); +var RoleUpdateCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "PATCH"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/roles/${this.input.roleId}`; + } + /** + * Get the body + */ + getBody() { + const { roleId, ...rest } = this.input; + return { + id: roleId, + ...rest, + flowcoreManaged: rest.flowcoreManaged ?? false + }; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(RoleSchema, rawResponse); + } +}; + +// src/commands/iam/tenant-iam-audit/get-audit-for-tenant.ts +init_command(); +init_parse_response_helper(); +var AuditLogEntrySchema = typebox.Type.Object({ + id: typebox.Type.String(), + event: typebox.Type.String(), + resourceName: typebox.Type.String(), + performedBy: typebox.Type.Union([ + typebox.Type.String(), + typebox.Type.Object({}), + // Allow performedBy to be any object + typebox.Type.Null() + // Or null + ]), + timestamp: typebox.Type.String(), + status: typebox.Type.String() +}); +var PaginationSchema = typebox.Type.Object({ + page: typebox.Type.Number(), + pageSize: typebox.Type.Number(), + totalItems: typebox.Type.Number(), + totalPages: typebox.Type.Number() +}); +var AuditLogResponseSchema = typebox.Type.Object({ + logs: typebox.Type.Array(AuditLogEntrySchema), + pagination: PaginationSchema +}); +var TenantAuditLogsCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = true; + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + let path = `/api/v1/tenant-iam-audit/${this.input.tenantId}`; + const queryParams = []; + if (this.input.page !== void 0) { + queryParams.push( + `page=${encodeURIComponent(this.input.page.toString())}` + ); + } + if (this.input.pageSize !== void 0) { + queryParams.push( + `pageSize=${encodeURIComponent(this.input.pageSize.toString())}` + ); + } + if (this.input.resourceType) { + queryParams.push( + `resourceType=${encodeURIComponent(this.input.resourceType)}` + ); + } + if (this.input.performedBy) { + queryParams.push( + `performedBy=${encodeURIComponent(this.input.performedBy)}` + ); + } + if (this.input.status) { + queryParams.push(`status=${encodeURIComponent(this.input.status)}`); + } + if (this.input.startDate) { + queryParams.push(`startDate=${encodeURIComponent(this.input.startDate)}`); + } + if (this.input.endDate) { + queryParams.push(`endDate=${encodeURIComponent(this.input.endDate)}`); + } + if (queryParams.length > 0) { + path += `?${queryParams.join("&")}`; + } + return path; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + if (!rawResponse) { + return { + logs: [], + pagination: { page: 1, pageSize: 20, totalItems: 0, totalPages: 0 } + }; + } + return exports.parseResponseHelper(AuditLogResponseSchema, rawResponse); + } +}; + +// src/commands/iam/validate/validate-key.ts +init_command(); +init_parse_response_helper(); + +// src/commands/iam/validate/validate-user.ts +init_command(); +init_parse_response_helper(); +var ValidPolicySchema = typebox.Type.Object({ + policyFrn: typebox.Type.String(), + statementId: typebox.Type.String() +}); +var ValidationResponseSchema = typebox.Type.Object({ + valid: typebox.Type.Boolean(), + checksum: typebox.Type.String(), + validPolicies: typebox.Type.Array(ValidPolicySchema) +}); +var ValidateUserCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = true; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/validate/users/${this.input.userId}`; + } + /** + * Get the body + */ + getBody() { + const { ...rest } = this.input; + return rest; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(ValidationResponseSchema, rawResponse); + } +}; + +// src/commands/iam/validate/validate-key.ts +var ValidateKeyCommand = class extends exports.Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = true; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/validate/keys/${this.input.keyId}`; + } + /** + * Get the body + */ + getBody() { + const { ...rest } = this.input; + return rest; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(ValidationResponseSchema, rawResponse); + } +}; + +// src/commands/iam/entitlements/resolve-user-entitlements.ts +init_command(); +init_parse_response_helper(); +var EntitlementResponseSchema = typebox.Type.Object({ + valid: typebox.Type.Literal(true), + requestChecksum: typebox.Type.String(), + entitlementChecksum: typebox.Type.String(), + cacheTtlSeconds: typebox.Type.Number(), + entitlements: typebox.Type.Array( + typebox.Type.Object({ + requestIndex: typebox.Type.Number(), + grants: typebox.Type.Array( + typebox.Type.Object({ + policyFrn: typebox.Type.String(), + statementId: typebox.Type.String(), + resource: typebox.Type.String(), + filters: typebox.Type.Optional(typebox.Type.Array(PolicyFilterSchema)) + }) + ) + }) + ) +}); +function parseEntitlementResponse(rawResponse) { + return exports.parseResponseHelper(EntitlementResponseSchema, rawResponse); +} +var ResolveUserEntitlementsCommand = class extends exports.Command { + retryOnFailure = true; + getMethod() { + return "POST"; + } + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + getPath() { + return `/api/v1/entitlements/users/${this.input.userId}`; + } + getBody() { + return { mode: this.input.mode, requestedAccess: this.input.requestedAccess }; + } + parseResponse(rawResponse) { + return parseEntitlementResponse(rawResponse); + } +}; + +// src/commands/iam/entitlements/resolve-key-entitlements.ts +init_command(); +init_parse_response_helper(); +var ResolveKeyEntitlementsCommand = class extends exports.Command { + retryOnFailure = true; + getMethod() { + return "POST"; + } + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + getPath() { + return `/api/v1/entitlements/keys/${this.input.keyId}`; + } + getBody() { + return { mode: this.input.mode, requestedAccess: this.input.requestedAccess }; + } + parseResponse(rawResponse) { + return exports.parseResponseHelper(EntitlementResponseSchema, rawResponse); + } +}; + +// src/commands/compute/compute-domain.attach.ts +init_command(); +var ComputeNoContentSchema = typebox.Type.Object({ + /** The HTTP status the service answered with (always 204) */ + status: typebox.Type.Number() +}); +var ComputeWorkloadStatusSchema = typebox.Type.Union([ + typebox.Type.Literal("pending"), + typebox.Type.Literal("running"), + typebox.Type.Literal("stopped"), + typebox.Type.Literal("failed"), + typebox.Type.Literal("archived") +]); +var ComputeWorkloadKindSchema = typebox.Type.Union([ + typebox.Type.Literal("service"), + typebox.Type.Literal("job") +]); +var ComputeSlotTierSchema = typebox.Type.Union([ + typebox.Type.Literal("nano"), + typebox.Type.Literal("micro"), + typebox.Type.Literal("small"), + typebox.Type.Literal("medium"), + typebox.Type.Literal("large") +]); +var ComputeProbeHttpGetSchema = typebox.Type.Object({ + /** Request path (defaults to `/` server-side) */ + path: typebox.Type.Optional(typebox.Type.String()), + /** Container port to probe */ + port: typebox.Type.Number(), + /** Extra request headers */ + headers: typebox.Type.Optional(typebox.Type.Record(typebox.Type.String(), typebox.Type.String())) +}); +var ComputeProbeTcpSocketSchema = typebox.Type.Object({ + /** Container port to dial */ + port: typebox.Type.Number() +}); +var ComputeProbeExecSchema = typebox.Type.Object({ + /** Command and arguments to run inside the container */ + command: typebox.Type.Array(typebox.Type.String()) +}); +var ComputeProbeSchema = typebox.Type.Object({ + /** HTTP GET handler */ + httpGet: typebox.Type.Optional(ComputeProbeHttpGetSchema), + /** TCP socket handler */ + tcpSocket: typebox.Type.Optional(ComputeProbeTcpSocketSchema), + /** Exec handler */ + exec: typebox.Type.Optional(ComputeProbeExecSchema), + /** Delay before the first probe */ + initialDelaySeconds: typebox.Type.Optional(typebox.Type.Number()), + /** Seconds between probes */ + periodSeconds: typebox.Type.Optional(typebox.Type.Number()), + /** Per-probe timeout in seconds */ + timeoutSeconds: typebox.Type.Optional(typebox.Type.Number()), + /** Consecutive failures before the probe is considered failed */ + failureThreshold: typebox.Type.Optional(typebox.Type.Number()) +}); +var ComputeWorkloadProbesSchema = typebox.Type.Object({ + /** Startup probe */ + startup: typebox.Type.Optional(ComputeProbeSchema), + /** Readiness probe */ + readiness: typebox.Type.Optional(ComputeProbeSchema), + /** Liveness probe */ + liveness: typebox.Type.Optional(ComputeProbeSchema) +}); +var ComputePreSyncSpecSchema = typebox.Type.Object({ + /** Label reported as `progress.preSync.name` (defaults to `pre-sync`) */ + name: typebox.Type.Optional(typebox.Type.String()), + /** Image the hook runs */ + image: typebox.Type.String(), + /** Command and arguments the hook runs */ + command: typebox.Type.Array(typebox.Type.String()), + /** Deadline for the hook (defaults to 300 server-side) */ + timeoutSeconds: typebox.Type.Optional(typebox.Type.Number()) +}); +var ComputeWorkloadScalingModeSchema = typebox.Type.Union([ + typebox.Type.Literal("manual"), + typebox.Type.Literal("hpa") +]); +var ComputeWorkloadScalingSchema = typebox.Type.Object({ + /** `manual` (default) or `hpa` */ + mode: typebox.Type.Optional(ComputeWorkloadScalingModeSchema), + /** The autoscaler's floor, 1..50. Also the count a create and a resume start at under `hpa` */ + minReplicas: typebox.Type.Optional(typebox.Type.Number()), + /** The autoscaler's ceiling, 1..50 — the number the tenant quota pre-flight measures */ + maxReplicas: typebox.Type.Optional(typebox.Type.Number()), + /** Target average CPU utilization, 1..100 percent of the slot's request */ + targetCpuPercent: typebox.Type.Optional(typebox.Type.Number()), + /** Target average memory utilization, 1..100 percent of the slot's request */ + targetMemoryPercent: typebox.Type.Optional(typebox.Type.Number()) +}); +var ComputeWorkloadEnvVarSchema = typebox.Type.Object({ + /** Variable name, e.g. `GREETING` */ + name: typebox.Type.String(), + /** Variable value, stored and replayed as-is */ + value: typebox.Type.String() +}); +var ComputeWorkloadSecretRefSchema = typebox.Type.Object({ + /** Variable name as the container sees it, e.g. `TOKEN` */ + name: typebox.Type.String(), + /** The key in the tenant's organization secrets that supplies the value */ + secretKey: typebox.Type.String() +}); +var ComputeWorkloadVolumeSchema = typebox.Type.Object({ + /** Lowercase DNS label, max 20 chars — embedded in the claim's object name */ + name: typebox.Type.String(), + /** Provisioned size in Gi, 1..1024 — growth-only after create */ + sizeGi: typebox.Type.Number(), + /** Absolute mount path inside the container (never `/`) */ + mountPath: typebox.Type.String() +}); +var ComputeWorkloadDefinitionSchema = typebox.Type.Object({ + /** Container image reference */ + image: typebox.Type.String(), + /** Compute slot tier */ + slotTier: ComputeSlotTierSchema, + /** Service or run-to-completion job (defaults to `service`) */ + kind: typebox.Type.Optional(ComputeWorkloadKindSchema), + /** Fixed replica count under `scaling.mode: "manual"` (defaults to 1) */ + replicas: typebox.Type.Optional(typebox.Type.Number()), + /** The container's listening port (defaults to 8080) */ + port: typebox.Type.Optional(typebox.Type.Number()), + /** Startup, readiness and liveness probes */ + probes: typebox.Type.Optional(ComputeWorkloadProbesSchema), + /** The pre-sync hook that gates every apply of this definition */ + preSync: typebox.Type.Optional(ComputePreSyncSpecSchema), + /** How the replica count is decided (defaults to `{ mode: "manual" }`) */ + scaling: typebox.Type.Optional(ComputeWorkloadScalingSchema), + /** Plain environment variables (defaults to an empty list) */ + env: typebox.Type.Optional(typebox.Type.Array(ComputeWorkloadEnvVarSchema)), + /** Organization-secret bindings, by key reference (defaults to an empty list) */ + secrets: typebox.Type.Optional(typebox.Type.Array(ComputeWorkloadSecretRefSchema)), + /** Persistent volumes, max 4 (defaults to an empty list). See ComputeWorkloadVolumeSchema */ + volumes: typebox.Type.Optional(typebox.Type.Array(ComputeWorkloadVolumeSchema)) +}); +var ComputeWorkloadSchema = typebox.Type.Object({ + /** The workload id (full UUID) */ + id: typebox.Type.String(), + /** The owning tenant id (full UUID) */ + tenantId: typebox.Type.String(), + /** Human name of the workload */ + name: typebox.Type.String(), + /** Lifecycle state */ + status: ComputeWorkloadStatusSchema, + /** Observed ready replica count, as reported by the reconciler */ + readyReplicas: typebox.Type.Number(), + /** Explanation of the latest non-healthy transition */ + reason: typebox.Type.Optional(typebox.Type.String()), + /** The definition of the ACTIVE revision */ + definition: typebox.Type.Optional(ComputeWorkloadDefinitionSchema), + /** Ordinal of the revision the platform has accepted as current */ + activeRevision: typebox.Type.Optional(typebox.Type.Number()), + /** When the active revision came from a rollback, the ordinal it was taken from */ + rolledBackFrom: typebox.Type.Optional(typebox.Type.Number()), + /** Whether the workload was deliberately paused (scaled to zero) */ + paused: typebox.Type.Optional(typebox.Type.Boolean()), + /** ISO-8601 creation timestamp */ + createdAt: typebox.Type.String(), + /** ISO-8601 last-update timestamp */ + updatedAt: typebox.Type.String() +}); +var ComputeWorkloadRunKindSchema = typebox.Type.Union([ + typebox.Type.Literal("batch"), + typebox.Type.Literal("pre_sync") +]); +var ComputeWorkloadRunStatusSchema = typebox.Type.Union([ + typebox.Type.Literal("running"), + typebox.Type.Literal("succeeded"), + typebox.Type.Literal("failed") +]); +var ComputeWorkloadRunSchema = typebox.Type.Object({ + /** The run id (full UUID) */ + id: typebox.Type.String(), + /** The workload the run belongs to (full UUID) */ + workloadId: typebox.Type.String(), + /** The owning tenant id (full UUID) */ + tenantId: typebox.Type.String(), + /** `batch` for an on-demand run, `pre_sync` for a deploy hook */ + kind: ComputeWorkloadRunKindSchema, + /** The Kubernetes Job object name (`run-` or `pre-sync--r`) */ + name: typebox.Type.String(), + /** Run state */ + status: ComputeWorkloadRunStatusSchema, + /** Explanation of a failure */ + reason: typebox.Type.Optional(typebox.Type.String()), + /** The operation the run is tracked under (full UUID) */ + operationId: typebox.Type.Optional(typebox.Type.String()), + /** ISO-8601 start timestamp */ + startedAt: typebox.Type.String(), + /** ISO-8601 completion timestamp, absent while the run is in flight */ + completedAt: typebox.Type.Optional(typebox.Type.String()) +}); +var ComputeWorkloadRunListSchema = typebox.Type.Object({ + /** One page of runs, newest first */ + runs: typebox.Type.Array(ComputeWorkloadRunSchema), + /** Opaque cursor for the next page; absent on the last page */ + nextCursor: typebox.Type.Optional(typebox.Type.String()) +}); +var ComputeWorkloadListResponseSchema = typebox.Type.Object({ + success: typebox.Type.Literal(true), + workloads: typebox.Type.Array(ComputeWorkloadSchema) +}); +var ComputeWorkloadResponseSchema = typebox.Type.Object({ + success: typebox.Type.Literal(true), + workload: ComputeWorkloadSchema +}); +var ComputeWorkloadCreateResponseSchema = typebox.Type.Object({ + success: typebox.Type.Literal(true), + workload: ComputeWorkloadSchema, + /** Poll `GET /api/v1/operations/{operationId}` for cluster convergence */ + operationId: typebox.Type.String() +}); +var ComputeWorkloadMutationResponseSchema = typebox.Type.Object({ + success: typebox.Type.Literal(true), + workload: ComputeWorkloadSchema, + /** Poll `GET /api/v1/operations/{operationId}` for cluster convergence */ + operationId: typebox.Type.String() +}); +var ComputeWorkloadDeleteResponseSchema = typebox.Type.Object({ + success: typebox.Type.Literal(true), + /** Poll `GET /api/v1/operations/{operationId}` for the teardown */ + operationId: typebox.Type.String() +}); +var ComputeWorkloadRunResponseSchema = typebox.Type.Object({ + success: typebox.Type.Literal(true), + /** The run row, already listed by `GET /runs` */ + run: ComputeWorkloadRunSchema, + /** The run id (full UUID) — also the Kubernetes Job name suffix */ + runId: typebox.Type.String(), + /** Poll `GET /api/v1/operations/{operationId}` for the run */ + operationId: typebox.Type.String() +}); +var ComputeLogStreamNameSchema = typebox.Type.Union([ + typebox.Type.Literal("stdout"), + typebox.Type.Literal("stderr") +]); +var ComputeLogEntrySchema = typebox.Type.Object({ + /** ISO-8601 timestamp of the line */ + timestamp: typebox.Type.String(), + /** The pod that emitted it */ + podName: typebox.Type.String(), + /** The container that emitted it */ + container: typebox.Type.String(), + /** Parsed log level */ + level: typebox.Type.String(), + /** The line itself */ + message: typebox.Type.String(), + /** `stdout` or `stderr` */ + stream: ComputeLogStreamNameSchema +}); +var ComputeWorkloadLogsSchema = typebox.Type.Object({ + /** The workload the lines belong to (full UUID) */ + workloadId: typebox.Type.String(), + /** Echo of the requested container filter; `null` when the query was not container-scoped */ + container: typebox.Type.Union([typebox.Type.String(), typebox.Type.Null()]), + /** How many lines matched upstream */ + totalMatches: typebox.Type.Number(), + /** The matching lines, newest-first as indexed upstream */ + logs: typebox.Type.Array(ComputeLogEntrySchema) +}); +var ComputeLogStreamEventSchema = typebox.Type.Object({ + /** ISO-8601 timestamp of the line, from the Kubernetes `timestamps=true` prefix */ + timestamp: typebox.Type.String(), + /** The pod that emitted it */ + pod: typebox.Type.String(), + /** The container that emitted it */ + container: typebox.Type.String(), + /** The line itself, passed through byte-for-byte */ + line: typebox.Type.String() +}); +var ComputeDomainStatusSchema = typebox.Type.Union([ + typebox.Type.Literal("pending_verification"), + typebox.Type.Literal("ready"), + typebox.Type.Literal("failed"), + typebox.Type.Literal("detached") +]); +var ComputeDomainVerificationTypeSchema = typebox.Type.Union([ + typebox.Type.Literal("cname"), + typebox.Type.Literal("platform_wildcard") +]); +var ComputeDomainVerificationSchema = typebox.Type.Object({ + /** `cname` for a custom hostname, `platform_wildcard` when the platform owns the zone */ + type: ComputeDomainVerificationTypeSchema, + /** The DNS record the caller must create */ + expectedTarget: typebox.Type.String(), + /** Whether the expected record was observed */ + verified: typebox.Type.Boolean() +}); +var ComputeDomainTlsStatusSchema = typebox.Type.Union([ + typebox.Type.Literal("pending_issuance"), + typebox.Type.Literal("issued"), + typebox.Type.Literal("failed") +]); +var ComputeDomainTlsSchema = typebox.Type.Object({ + /** Issuance state */ + status: ComputeDomainTlsStatusSchema, + /** The in-cluster Secret the certificate lands in */ + secretName: typebox.Type.String(), + /** The issuing CA, once observed */ + issuer: typebox.Type.Optional(typebox.Type.String()), + /** ISO-8601 expiry, once observed */ + expiresAt: typebox.Type.Optional(typebox.Type.String()) +}); +var ComputeDomainSchema = typebox.Type.Object({ + /** The domain binding id (full UUID) */ + domainId: typebox.Type.String(), + /** The workload the hostname routes to (full UUID) */ + workloadId: typebox.Type.String(), + /** The bound hostname */ + hostname: typebox.Type.String(), + /** The container port the ingress routes to */ + targetPort: typebox.Type.Number(), + /** Lifecycle state of the binding */ + status: ComputeDomainStatusSchema, + /** DNS ownership state */ + verification: ComputeDomainVerificationSchema, + /** Certificate state */ + tls: ComputeDomainTlsSchema, + /** ISO-8601 creation timestamp */ + createdAt: typebox.Type.String() +}); +var ComputeDomainListResponseSchema = typebox.Type.Object({ + success: typebox.Type.Literal(true), + domains: typebox.Type.Array(ComputeDomainSchema) +}); +var ComputeDomainVerifyResponseSchema = typebox.Type.Object({ + /** The domain binding id (full UUID) */ + domainId: typebox.Type.String(), + /** The bound hostname */ + hostname: typebox.Type.String(), + /** Lifecycle state after the observation */ + status: ComputeDomainStatusSchema, + /** What the DNS lookup saw */ + verification: ComputeDomainVerificationSchema, + /** What the read-only Certificate GET saw */ + tls: ComputeDomainTlsSchema +}); +var ComputeOperationTypeSchema = typebox.Type.Union([ + typebox.Type.Literal("workload.deploy"), + typebox.Type.Literal("workload.update"), + typebox.Type.Literal("workload.rollback"), + typebox.Type.Literal("workload.archive"), + typebox.Type.Literal("workload.pause"), + typebox.Type.Literal("workload.resume"), + typebox.Type.Literal("workload.run") +]); +var ComputeOperationStatusSchema = typebox.Type.Union([ + typebox.Type.Literal("pending"), + typebox.Type.Literal("in_progress"), + typebox.Type.Literal("succeeded"), + typebox.Type.Literal("failed") +]); +var ComputeOperationPhaseSchema = typebox.Type.Union([ + typebox.Type.Literal("queued"), + typebox.Type.Literal("pre_sync_running"), + typebox.Type.Literal("pre_sync_failed"), + typebox.Type.Literal("deploying"), + typebox.Type.Literal("rolling_out"), + typebox.Type.Literal("tearing_down"), + typebox.Type.Literal("pausing"), + typebox.Type.Literal("resuming"), + typebox.Type.Literal("running"), + typebox.Type.Literal("completed"), + typebox.Type.Literal("failed") +]); +var ComputeOperationStepStatusSchema = typebox.Type.Union([ + typebox.Type.Literal("pending"), + typebox.Type.Literal("running"), + typebox.Type.Literal("succeeded"), + typebox.Type.Literal("failed") +]); +var ComputeOperationPreSyncProgressSchema = typebox.Type.Object({ + /** The hook's label */ + name: typebox.Type.String(), + /** Step state */ + status: ComputeOperationStepStatusSchema, + /** ISO-8601 start timestamp */ + startedAt: typebox.Type.Optional(typebox.Type.String()), + /** ISO-8601 completion timestamp */ + completedAt: typebox.Type.Optional(typebox.Type.String()) +}); +var ComputeOperationDeploymentProgressSchema = typebox.Type.Object({ + /** Replicas the Deployment wants */ + desiredReplicas: typebox.Type.Number(), + /** Replicas already on the new template */ + updatedReplicas: typebox.Type.Number(), + /** Replicas reporting ready */ + readyReplicas: typebox.Type.Number() +}); +var ComputeOperationProgressSchema = typebox.Type.Object({ + /** The pre-sync hook, when the mutation gated on one */ + preSync: typebox.Type.Optional(ComputeOperationPreSyncProgressSchema), + /** The rollout, once it started */ + deployment: typebox.Type.Optional(ComputeOperationDeploymentProgressSchema) +}); +var ComputeOperationSchema = typebox.Type.Object({ + /** The operation id (full UUID) */ + operationId: typebox.Type.String(), + /** The workload the operation mutates (full UUID) */ + workloadId: typebox.Type.String(), + /** What kind of mutation this is */ + type: ComputeOperationTypeSchema, + /** Overall state */ + status: ComputeOperationStatusSchema, + /** Where the reconciler currently is */ + phase: ComputeOperationPhaseSchema, + /** Progress detail */ + progress: ComputeOperationProgressSchema, + /** Explanation of a non-succeeded outcome */ + reason: typebox.Type.Optional(typebox.Type.String()), + /** ISO-8601 creation timestamp */ + createdAt: typebox.Type.String(), + /** ISO-8601 last-update timestamp */ + updatedAt: typebox.Type.String() +}); +var ComputeWorkloadRevisionCauseSchema = typebox.Type.Union([ + typebox.Type.Literal("created"), + typebox.Type.Literal("update"), + typebox.Type.Literal("rollback") +]); +var ComputeWorkloadRevisionSchema = typebox.Type.Object({ + /** The revision ordinal, 1-based and monotonic per workload */ + revision: typebox.Type.Number(), + /** The container image this revision was recorded with */ + image: typebox.Type.String(), + /** The slot tier, absent on a row recorded before the field existed */ + slotTier: typebox.Type.Optional(ComputeSlotTierSchema), + /** Why the revision exists — `created`, `update` or `rollback` */ + cause: ComputeWorkloadRevisionCauseSchema, + /** At most one revision per workload is active */ + isActive: typebox.Type.Boolean(), + /** The ordinal a rollback restored from; present only on a rollback revision */ + rolledBackFrom: typebox.Type.Optional(typebox.Type.Number()), + /** The operation carrying this revision to the cluster (full UUID), when there is one */ + operationId: typebox.Type.Optional(typebox.Type.String()), + /** The operation's verdict; ABSENT when the revision names no operation */ + outcome: typebox.Type.Optional(ComputeOperationStatusSchema), + /** The operation's explanation of a non-succeeded outcome */ + outcomeReason: typebox.Type.Optional(typebox.Type.String()), + /** ISO-8601 creation timestamp */ + createdAt: typebox.Type.String() +}); +var ComputeWorkloadRevisionListSchema = typebox.Type.Object({ + /** One page of revisions, newest ordinal first */ + revisions: typebox.Type.Array(ComputeWorkloadRevisionSchema), + /** Opaque cursor for the next page; absent on the last page */ + nextCursor: typebox.Type.Optional(typebox.Type.String()) +}); +var ComputeDeploymentEventObjectSchema = typebox.Type.Object({ + /** The Kubernetes kind */ + kind: typebox.Type.String(), + /** The object's name */ + name: typebox.Type.String() +}); +var ComputeDeploymentEventSchema = typebox.Type.Object({ + /** The event object's own name, stable for the life of the event */ + name: typebox.Type.String(), + /** `Normal` or `Warning` in practice, but free-form on the wire */ + type: typebox.Type.String(), + /** The machine-readable reason, e.g. `Scheduled`, `BackOff` */ + reason: typebox.Type.String(), + /** The human-readable message; may be empty */ + message: typebox.Type.String(), + /** How many times the event has recurred; 1 for a single occurrence */ + count: typebox.Type.Number(), + /** The object the event is about */ + object: ComputeDeploymentEventObjectSchema, + /** The controller that reported it — kubelet, deployment-controller, … */ + source: typebox.Type.Optional(typebox.Type.String()), + /** ISO-8601 timestamp of the first occurrence */ + firstSeen: typebox.Type.Optional(typebox.Type.String()), + /** ISO-8601 timestamp of the most recent occurrence */ + lastSeen: typebox.Type.Optional(typebox.Type.String()) +}); +var ComputeWorkloadDeploymentEventsSchema = typebox.Type.Object({ + /** The workload the events belong to (full UUID) */ + workloadId: typebox.Type.String(), + /** The cluster's recent events, most recently seen first; possibly empty */ + events: typebox.Type.Array(ComputeDeploymentEventSchema) +}); +var ComputeRegistrySchema = typebox.Type.Object({ + /** The registry id (full UUID) */ + registryId: typebox.Type.String(), + /** Human label */ + name: typebox.Type.String(), + /** Registry host as a container runtime addresses it, e.g. `ghcr.io` */ + serverUrl: typebox.Type.String(), + /** The robot account the pull credential belongs to */ + username: typebox.Type.String(), + /** Whether this is the tenant's default registry */ + isDefault: typebox.Type.Boolean(), + /** ISO-8601 creation timestamp */ + createdAt: typebox.Type.String(), + /** ISO-8601 last-update timestamp — the rotation timestamp after a rotate */ + updatedAt: typebox.Type.String() +}); +var ComputeRegistrySynthesisStateSchema = typebox.Type.Union([ + typebox.Type.Literal("pending"), + typebox.Type.Literal("synthesized"), + typebox.Type.Literal("failed") +]); +var ComputeRegistryDetailSchema = typebox.Type.Object({ + ...ComputeRegistrySchema.properties, + /** Whether the reconciler turned the credential into a pull Secret */ + synthesisStatus: ComputeRegistrySynthesisStateSchema, + /** The reconciler's explanation of a failed synthesis — never credential material */ + synthesisReason: typebox.Type.Optional(typebox.Type.String()), + /** ISO-8601 timestamp of the synthesis report */ + synthesisAt: typebox.Type.Optional(typebox.Type.String()) +}); +var ComputeRegistryListResponseSchema = typebox.Type.Object({ + success: typebox.Type.Literal(true), + registries: typebox.Type.Array(ComputeRegistrySchema) +}); +var ComputeRegistryDetailResponseSchema = typebox.Type.Object({ + success: typebox.Type.Literal(true), + registry: ComputeRegistryDetailSchema +}); + +// src/commands/compute/compute-domain.attach.ts +init_not_found(); +init_parse_response_helper(); +var ComputeDomainAttachCommand = class extends exports.Command { + /** + * Whether the command should retry on failure. + * + * FALSE: an attach mints a domain id, and a second attach of the same + * hostname answers 409 — a retry of an already-recorded request would + * surface that conflict as the caller's answer. + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://compute.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/workloads/${this.input.workloadId}/domains`; + } + /** + * Get the body for the request. + * + * OVERRIDDEN BECAUSE BOTH BRANCHES OF THE UPSTREAM BODY ARE `.strict()` — + * that is exactly what makes the union a real XOR. The base implementation + * would send `workloadId` (a path parameter) inside the JSON, which matches + * NEITHER branch, so every call would be 422. + */ + getBody() { + const { workloadId: _workloadId, ...payload } = this.input; + return payload; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(ComputeDomainSchema, rawResponse); + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("Workload", { + workloadId: this.input.workloadId + }); + } + throw error; + } +}; + +// src/commands/compute/compute-domain.detach.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var ComputeDomainDetachCommand = class extends exports.Command { + /** + * Get the method + */ + getMethod() { + return "DELETE"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://compute.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/workloads/${this.input.workloadId}/domains/${this.input.domainId}`; + } + /** + * Get the body for the request. The route takes NO body. + */ + getBody() { + return void 0; + } + /** + * Parse the response. + * + * The endpoint answers 204 with an EMPTY body, which `FlowcoreClient` turns + * into `{ status: 204 }` before it reaches here — so this schema describes + * that synthetic object, not anything the service serialized. + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(ComputeNoContentSchema, rawResponse); + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("Domain", { + workloadId: this.input.workloadId, + domainId: this.input.domainId + }); + } + throw error; + } +}; + +// src/commands/compute/compute-domain.list.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var ComputeDomainListCommand = class extends exports.Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://compute.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/workloads/${this.input.workloadId}/domains`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(ComputeDomainListResponseSchema, rawResponse).domains; + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("Workload", { + workloadId: this.input.workloadId + }); + } + throw error; + } +}; + +// src/commands/compute/compute-domain.verify.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var ComputeDomainVerifyCommand = class extends exports.Command { + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://compute.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/workloads/${this.input.workloadId}/domains/${this.input.domainId}/verify`; + } + /** + * Get the body for the request. The route takes NO body. + */ + getBody() { + return void 0; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(ComputeDomainVerifyResponseSchema, rawResponse); + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("Domain", { + workloadId: this.input.workloadId, + domainId: this.input.domainId + }); + } + throw error; + } +}; + +// src/commands/compute/compute-operation.fetch.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var ComputeOperationFetchCommand = class extends exports.Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://compute.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/operations/${this.input.operationId}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(ComputeOperationSchema, rawResponse); + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("Operation", { + operationId: this.input.operationId + }); + } + throw error; + } +}; + +// src/commands/compute/compute-registry.fetch.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var ComputeRegistryFetchCommand = class extends exports.Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://compute.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/registries/${this.input.registryId}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(ComputeRegistryDetailResponseSchema, rawResponse).registry; + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("Registry", { + registryId: this.input.registryId + }); + } + throw error; + } +}; + +// src/commands/compute/compute-registry.list.ts +init_command(); +init_parse_response_helper(); +var ComputeRegistryListCommand = class extends exports.Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://compute.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + const queryParams = new URLSearchParams(); + queryParams.set("tenantId", this.input.tenantId); + return `/api/v1/registries?${queryParams.toString()}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(ComputeRegistryListResponseSchema, rawResponse).registries; + } +}; + +// src/commands/compute/compute-registry.register.ts +init_command(); +init_parse_response_helper(); +var ComputeRegistryRegisterCommand = class extends exports.Command { + /** + * Whether the command should retry on failure. + * + * FALSE: a registration mints a registry id, and a second registration of + * the same `serverUrl` answers 409 — a retry of an already-recorded request + * would surface that conflict as the caller's answer. + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://compute.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return "/api/v1/registries"; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(ComputeRegistrySchema, rawResponse); + } +}; + +// src/commands/compute/compute-registry.remove.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var ComputeRegistryRemoveCommand = class extends exports.Command { + /** + * Get the method + */ + getMethod() { + return "DELETE"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://compute.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/registries/${this.input.registryId}`; + } + /** + * Get the body for the request. The route takes NO body. + */ + getBody() { + return void 0; + } + /** + * Parse the response. + * + * The endpoint answers 204 with an EMPTY body, which `FlowcoreClient` turns + * into `{ status: 204 }` before it reaches here. + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(ComputeNoContentSchema, rawResponse); + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("Registry", { + registryId: this.input.registryId + }); + } + throw error; + } +}; + +// src/commands/compute/compute-registry.rotate.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var ComputeRegistryRotateCommand = class extends exports.Command { + /** + * Get the method + */ + getMethod() { + return "PATCH"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://compute.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/registries/${this.input.registryId}`; + } + /** + * Get the body for the request. + * + * OVERRIDDEN BECAUSE THE UPSTREAM BODY IS `.strict()` AND DELIBERATELY + * NARROW — `{ secret }` and nothing else, so that an attempt to smuggle a + * `serverUrl` or `isDefault` change through the rotation path is a 422. The + * base implementation would send `registryId`, a path parameter, inside the + * JSON and every call would be refused. + */ + getBody() { + const { registryId: _registryId, ...payload } = this.input; + return payload; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(ComputeRegistrySchema, rawResponse); + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("Registry", { + registryId: this.input.registryId + }); + } + throw error; + } +}; + +// src/commands/compute/compute-workload-events.list.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var ComputeWorkloadEventsListCommand = class extends exports.Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://compute.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/workloads/${this.input.workloadId}/events`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(ComputeWorkloadDeploymentEventsSchema, rawResponse); + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("Workload", { + workloadId: this.input.workloadId + }); + } + throw error; + } +}; + +// src/commands/compute/compute-workload-logs.fetch.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var ComputeWorkloadLogsFetchCommand = class extends exports.Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://compute.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + const queryParams = new URLSearchParams(); + if (this.input.since !== void 0) { + queryParams.set("since", this.input.since); + } + if (this.input.until !== void 0) { + queryParams.set("until", this.input.until); + } + if (this.input.search !== void 0) { + queryParams.set("search", this.input.search); + } + if (this.input.limit !== void 0) { + queryParams.set("limit", this.input.limit.toString()); + } + if (this.input.container !== void 0) { + queryParams.set("container", this.input.container); + } + const qs = queryParams.toString(); + const path = `/api/v1/workloads/${this.input.workloadId}/logs`; + return qs ? `${path}?${qs}` : path; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(ComputeWorkloadLogsSchema, rawResponse); + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("Workload", { + workloadId: this.input.workloadId + }); + } + throw error; + } +}; +init_not_found(); +init_parse_response_helper(); +function createSseParser(onFrame) { + let buffer = ""; + let eventName = ""; + let dataLines = []; + let sawField = false; + const dispatch = () => { + if (!sawField) { + return; + } + const frame = { event: eventName || "message", data: dataLines.join("\n") }; + eventName = ""; + dataLines = []; + sawField = false; + onFrame(frame); + }; + return (chunk) => { + buffer += chunk.replace(/\r\n/g, "\n").replace(/\r/g, "\n"); + const lines = buffer.split("\n"); + buffer = lines.pop() ?? ""; + for (const line of lines) { + if (line === "") { + dispatch(); + continue; + } + if (line.startsWith(":")) { + continue; + } + const separator = line.indexOf(":"); + const field = separator === -1 ? line : line.slice(0, separator); + let value = separator === -1 ? "" : line.slice(separator + 1); + if (value.startsWith(" ")) { + value = value.slice(1); + } + if (field === "event") { + eventName = value; + sawField = true; + } else if (field === "data") { + dataLines.push(value); + sawField = true; + } + } + }; +} +function errorFrameMessage(data) { + try { + const parsed = JSON.parse(data); + if (typeof parsed === "object" && parsed !== null && "message" in parsed) { + const { message } = parsed; + if (typeof message === "string" && message.length > 0) { + return message; + } + } + } catch { + } + return data || "The log stream failed after it had started"; +} +var ComputeWorkloadLogStreamCommand = class extends CustomCommand { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://compute.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + const queryParams = new URLSearchParams(); + if (this.input.container !== void 0) { + queryParams.set("container", this.input.container); + } + if (this.input.tailLines !== void 0) { + queryParams.set("tailLines", this.input.tailLines.toString()); + } + const qs = queryParams.toString(); + const path = `/api/v1/workloads/${this.input.workloadId}/logs/stream`; + return qs ? `${path}?${qs}` : path; + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("Workload", { + workloadId: this.input.workloadId + }); + } + throw error; + } + /** + * Custom execute method — opens the SSE connection and returns the stream + */ + async customExecute(client) { + const authHeader = await client.getAuthHeader(); + const abortController = new AbortController(); + const response = await fetch(`${this.getBaseUrl()}${this.getPath()}`, { + method: "GET", + headers: { + Accept: "text/event-stream", + ...authHeader ? { Authorization: authHeader } : {} + }, + signal: abortController.signal + }); + if (!response.ok) { + const body = await response.json().catch(() => void 0); + const error = new ClientError( + `${this.constructor.name} failed with ${response.status}: ${response.statusText}`, + response.status, + this.constructor.name, + body + ); + this.handleClientError(error); + throw error; + } + if (!response.body) { + throw new ClientError("Log stream response had no body", 0, this.constructor.name, { + workloadId: this.input.workloadId + }); + } + const subject = new rxjs.Subject(); + const reader = response.body.getReader(); + const decoder = new TextDecoder(); + const push = createSseParser((frame) => { + if (frame.event === "error") { + subject.error( + // The message goes in the BODY as well as the message slot: + // ClientError renders `body` in preference to `message`, so text + // passed only as the message would never reach the reader. + new ClientError(errorFrameMessage(frame.data), 0, this.constructor.name, { + workloadId: this.input.workloadId, + message: errorFrameMessage(frame.data) + }) + ); + return; + } + if (frame.event !== "log") { + return; + } + subject.next(exports.parseResponseHelper(ComputeLogStreamEventSchema, JSON.parse(frame.data))); + }); + const pump = async () => { + try { + for (; ; ) { + const { done, value } = await reader.read(); + if (done) { + break; + } + push(decoder.decode(value, { stream: true })); + } + } catch (error) { + if (!abortController.signal.aborted) { + subject.error(error instanceof Error ? error : new Error(String(error))); + return; + } + } + subject.complete(); + }; + let started = false; + const output$ = new rxjs.Observable((subscriber) => { + const subscription = subject.subscribe(subscriber); + if (!started) { + started = true; + void pump(); + } + return subscription; + }); + return { + output$, + disconnect: () => { + if (abortController.signal.aborted) { + return; + } + abortController.abort(); + void reader.cancel().catch(() => { + }); + subject.complete(); + } + }; + } +}; + +// src/commands/compute/compute-workload-revisions.list.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var ComputeWorkloadRevisionsListCommand = class extends exports.Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://compute.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + const queryParams = new URLSearchParams(); + if (this.input.limit !== void 0) { + queryParams.set("limit", this.input.limit.toString()); + } + if (this.input.cursor !== void 0) { + queryParams.set("cursor", this.input.cursor); + } + const qs = queryParams.toString(); + const path = `/api/v1/workloads/${this.input.workloadId}/revisions`; + return qs ? `${path}?${qs}` : path; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(ComputeWorkloadRevisionListSchema, rawResponse); + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("Workload", { + workloadId: this.input.workloadId + }); + } + throw error; + } +}; + +// src/commands/compute/compute-workload-runs.list.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var ComputeWorkloadRunsListCommand = class extends exports.Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://compute.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + const queryParams = new URLSearchParams(); + if (this.input.limit !== void 0) { + queryParams.set("limit", this.input.limit.toString()); + } + if (this.input.cursor !== void 0) { + queryParams.set("cursor", this.input.cursor); + } + const qs = queryParams.toString(); + const path = `/api/v1/workloads/${this.input.workloadId}/runs`; + return qs ? `${path}?${qs}` : path; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(ComputeWorkloadRunListSchema, rawResponse); + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("Workload", { + workloadId: this.input.workloadId + }); + } + throw error; + } +}; + +// src/commands/compute/compute-workload.create.ts +init_command(); +init_parse_response_helper(); +var ComputeWorkloadCreateCommand = class extends exports.Command { + /** + * Whether the command should retry on failure. + * + * FALSE: a create mints a workload id server-side, so a retried 502 would + * deploy the same workload twice. + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://compute.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return "/api/v1/workloads"; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(ComputeWorkloadResponseSchema, rawResponse).workload; + } +}; + +// src/commands/compute/compute-workload.create-tracked.ts +init_command(); +init_parse_response_helper(); +var ComputeWorkloadCreateTrackedCommand = class extends exports.Command { + retryOnFailure = false; + getMethod() { + return "POST"; + } + getBaseUrl() { + return "https://compute.api.flowcore.io"; + } + getPath() { + return "/api/v1/workloads"; + } + parseResponse(rawResponse) { + return exports.parseResponseHelper(ComputeWorkloadCreateResponseSchema, rawResponse); + } +}; + +// src/commands/compute/compute-workload.delete.ts +init_command(); +init_not_found(); +init_parse_response_helper(); + +// src/commands/compute/wait-for-operation.ts +init_command_error(); +init_not_found(); +var DEFAULT_COMPUTE_OPERATION_TIMEOUT_MS = 6e5; +var DEFAULT_COMPUTE_OPERATION_POLL_INTERVAL_MS = 1e3; +async function waitForComputeOperation(client, commandName, operationId, options) { + const timeoutMs = options.operationTimeoutMs ?? DEFAULT_COMPUTE_OPERATION_TIMEOUT_MS; + const pollIntervalMs = options.operationPollIntervalMs ?? DEFAULT_COMPUTE_OPERATION_POLL_INTERVAL_MS; + const start = Date.now(); + let lastSeen; + while (Date.now() - start < timeoutMs) { + try { + const operation = await client.execute(new ComputeOperationFetchCommand({ operationId })); + lastSeen = operation; + if (operation.status === "succeeded" || operation.status === "failed") { + return operation; + } + } catch (error) { + if (!(error instanceof exports.NotFoundException)) { + throw error; + } + } + await new Promise((resolve) => setTimeout(resolve, pollIntervalMs)); + } + throw new exports.CommandError( + commandName, + lastSeen ? `Operation ${operationId} did not reach a terminal state within ${timeoutMs}ms (last observed status "${lastSeen.status}", phase "${lastSeen.phase}")` : `Operation ${operationId} did not appear within ${timeoutMs}ms \u2014 the reconciler filed no progress report` + ); +} + +// src/commands/compute/compute-workload.delete.ts +var ComputeWorkloadDeleteCommand = class extends exports.Command { + /** + * Get the method + */ + getMethod() { + return "DELETE"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://compute.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/workloads/${this.input.workloadId}`; + } + /** + * Get the body for the request. + * + * The route takes NO body. Left to the base implementation it would send + * the whole input — the path parameter and the client-side wait knobs — as + * JSON on a DELETE. + */ + getBody() { + return void 0; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(ComputeWorkloadDeleteResponseSchema, rawResponse); + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("Workload", { + workloadId: this.input.workloadId + }); + } + throw error; + } + /** + * Optionally wait for the teardown to finish + */ + async processResponse(client, response) { + if (!this.input.waitForOperation) { + return response; + } + const operation = await waitForComputeOperation(client, this.constructor.name, response.operationId, this.input); + return { ...response, operation }; + } +}; + +// src/commands/compute/compute-workload.fetch.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var ComputeWorkloadFetchCommand = class extends exports.Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://compute.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/workloads/${this.input.workloadId}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(ComputeWorkloadResponseSchema, rawResponse).workload; + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("Workload", { + workloadId: this.input.workloadId + }); + } + throw error; + } +}; + +// src/commands/compute/compute-workload.list.ts +init_command(); +init_parse_response_helper(); +var ComputeWorkloadListCommand = class extends exports.Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://compute.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + const queryParams = new URLSearchParams(); + queryParams.set("tenantId", this.input.tenantId); + return `/api/v1/workloads?${queryParams.toString()}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(ComputeWorkloadListResponseSchema, rawResponse).workloads; + } +}; + +// src/commands/compute/compute-workload.pause.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var ComputeWorkloadPauseCommand = class extends exports.Command { + /** + * Whether the command should retry on failure. + * + * FALSE: a pause mints an operation id, and the service answers 409 to a + * second pause — a retry of an already-recorded request would surface that + * conflict as the caller's answer. + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://compute.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/workloads/${this.input.workloadId}/pause`; + } + /** + * Get the body for the request. The route takes NO body. + */ + getBody() { + return void 0; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(ComputeWorkloadMutationResponseSchema, rawResponse); + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("Workload", { + workloadId: this.input.workloadId + }); + } + throw error; + } + /** + * Optionally wait for the scale-down to finish + */ + async processResponse(client, response) { + if (!this.input.waitForOperation) { + return response; + } + const operation = await waitForComputeOperation(client, this.constructor.name, response.operationId, this.input); + return { ...response, operation }; + } +}; + +// src/commands/compute/compute-workload.resume.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var ComputeWorkloadResumeCommand = class extends exports.Command { + /** + * Whether the command should retry on failure. + * + * FALSE: a resume mints an operation id, and the service answers 409 to a + * second resume — a retry of an already-recorded request would surface that + * conflict as the caller's answer. + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://compute.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/workloads/${this.input.workloadId}/resume`; + } + /** + * Get the body for the request. The route takes NO body. + */ + getBody() { + return void 0; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(ComputeWorkloadMutationResponseSchema, rawResponse); + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("Workload", { + workloadId: this.input.workloadId + }); + } + throw error; + } + /** + * Optionally wait for the scale-up to finish + */ + async processResponse(client, response) { + if (!this.input.waitForOperation) { + return response; + } + const operation = await waitForComputeOperation(client, this.constructor.name, response.operationId, this.input); + return { ...response, operation }; + } +}; + +// src/commands/compute/compute-workload.rollback.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var ComputeWorkloadRollbackCommand = class extends exports.Command { + /** + * Whether the command should retry on failure. + * + * FALSE: a rollback mints a revision and an operation id, and re-runs the + * target revision's pre-sync hook. + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://compute.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/workloads/${this.input.workloadId}/rollback`; + } + /** + * Get the body for the request. + * + * The route takes NO body — the target revision is derived server-side. + */ + getBody() { + return void 0; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(ComputeWorkloadMutationResponseSchema, rawResponse); + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("Workload", { + workloadId: this.input.workloadId + }); + } + throw error; + } + /** + * Optionally wait for the cluster to converge + */ + async processResponse(client, response) { + if (!this.input.waitForOperation) { + return response; + } + const operation = await waitForComputeOperation(client, this.constructor.name, response.operationId, this.input); + return { ...response, operation }; + } +}; + +// src/commands/compute/compute-workload.run.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var ComputeWorkloadRunCommand = class extends exports.Command { + /** + * Whether the command should retry on failure. + * + * FALSE: a run mints a run id and spends the tenant's compute quota, so a + * retried 502 would start the job twice. + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://compute.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/workloads/${this.input.workloadId}/run`; + } + /** + * Get the body for the request. The route takes NO body. + */ + getBody() { + return void 0; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(ComputeWorkloadRunResponseSchema, rawResponse); + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("Workload", { + workloadId: this.input.workloadId + }); + } + throw error; + } + /** + * Optionally wait for the run to reach a terminal state + */ + async processResponse(client, response) { + if (!this.input.waitForOperation) { + return response; + } + const operation = await waitForComputeOperation(client, this.constructor.name, response.operationId, this.input); + return { ...response, operation }; + } +}; + +// src/commands/compute/compute-workload.update.ts +init_command(); +init_command_error(); +init_not_found(); +init_parse_response_helper(); +var ComputeWorkloadUpdateCommand = class extends exports.Command { + /** + * Whether the command should retry on failure. + * + * FALSE. A PATCH looks idempotent and is not: each call MINTS A REVISION + * and an operation id server-side, and re-applying a revision re-runs the + * workload's pre-sync hook. A retried 502 whose original request had + * already been recorded would append a second identical revision and run + * the migration hook twice. + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "PATCH"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://compute.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/workloads/${this.input.workloadId}`; + } + /** + * Get the body for the request. + * + * OVERRIDDEN BECAUSE THE UPSTREAM BODY IS `.strict()`. The base + * implementation sends the WHOLE input, which would put `workloadId` (a + * path parameter) and the client-side `waitForOperation` / + * `operationTimeoutMs` / `operationPollIntervalMs` knobs into the JSON — + * and every one of them is a key `UpdateWorkloadRequestSchema` does not + * list, so the service would answer 422 on the very first call. + */ + getBody() { + const { + workloadId: _workloadId, + waitForOperation: _waitForOperation, + operationTimeoutMs: _operationTimeoutMs, + operationPollIntervalMs: _operationPollIntervalMs, + ...payload + } = this.input; + if (Object.keys(payload).length === 0) { + throw new exports.CommandError(this.constructor.name, "No fields to update"); + } + return payload; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return exports.parseResponseHelper(ComputeWorkloadMutationResponseSchema, rawResponse); + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new exports.NotFoundException("Workload", { + workloadId: this.input.workloadId + }); + } + throw error; + } + /** + * Optionally wait for the cluster to converge + */ + async processResponse(client, response) { + if (!this.input.waitForOperation) { + return response; + } + const operation = await waitForComputeOperation(client, this.constructor.name, response.operationId, this.input); + return { ...response, operation }; + } +}; + +// src/mod.ts +init_command(); + +// src/common/flowcore-client.ts +init_command_error(); + +// src/utils/try-catch.ts +async function tryCatch(promise) { + try { + const data = await promise; + return { data, error: null }; + } catch (error) { + return { data: null, error }; + } +} + +// src/common/flowcore-client.ts +init_tenant_cache(); +var RETRYABLE_ERROR_CODES = [408, 429, 500, 502, 503, 504]; +function isClientOptionsBearer(options) { + return "getBearerToken" in options; +} +function isClientOptionsApiKey(options) { + return "apiKey" in options; +} +var FlowcoreClient = class { + constructor(options) { + this.options = options; + if (isClientOptionsBearer(this.options)) { + this.mode = "bearer"; + } else if (isClientOptionsApiKey(this.options)) { + if (!this.options.apiKeyId) { + const parts = this.options.apiKey.split("_"); + if (parts.length !== 3 || parts[0] !== "fc") { + throw new Error("Invalid api key"); + } + this.options.apiKeyId = parts[1]; + } + this.mode = "apiKey"; + } else { + throw new Error("Invalid client options"); + } + if (this.options.retry === void 0) { + this.options.retry = { + delay: 250, + maxRetries: 3 + }; + } + } + options; + mode; + baseUrl; + /** + * Get the auth header + * + * Public so that a `CustomCommand` which owns its own transport — a + * streaming request whose body must NOT be consumed by `innerExecute`'s + * unconditional `response.json()` — can authenticate its own fetch with + * exactly the header every other command sends. Read-only: it derives the + * header from the client options and mutates nothing. + */ + async getAuthHeader() { + if (this.options.getBearerToken) { + const bearerToken = await this.options.getBearerToken(); + if (!bearerToken) { + return null; + } + return `Bearer ${bearerToken}`; + } + if (this.options.apiKeyId && this.options.apiKey) { + return `ApiKey ${this.options.apiKeyId}:${this.options.apiKey}`; + } + return null; + } + /** + * Execute a command (inner method) + */ + async innerExecute(command, retryCount = 0, direct) { + if (typeof command.setClientAuthOptions === "function") { + if (this.options.getBearerToken) { + const bearerToken = await this.options.getBearerToken(); + command.setClientAuthOptions({ token: bearerToken || void 0 }); + } else if (this.options.apiKeyId && this.options.apiKey) { + command.setClientAuthOptions({ + apiKeyId: this.options.apiKeyId, + apiKey: this.options.apiKey + }); + } + } + const request = await command.getRequest(this, direct); + if (request.customExecute) { + return request.customExecute(this); + } + if (!request.allowedModes.includes(this.mode)) { + throw new exports.CommandError(command.constructor.name, `Not allowed in "${this.mode}" mode`); + } + const { data: authHeader, error: authHeaderError } = await tryCatch(this.getAuthHeader()); + if (authHeaderError) { + throw new ClientError("Failed to get auth header", 0, command.constructor.name, { + command: command.constructor.name, + error: authHeaderError + }); + } + const headers = { + ...authHeader ? { Authorization: authHeader } : {}, + ...request.headers + }; + let response; + const url = this.baseUrl ? this.baseUrl + request.path : request.baseUrl + request.path; + let body; + if (typeof request.body === "object") { + body = JSON.stringify(request.body); + } + try { + response = await fetch(url, { + method: request.method, + headers, + body + }); + } catch (error) { + if (request.retryOnFailure && this.options.retry && retryCount < this.options.retry.maxRetries) { + const delay = this.options.retry.delay; + await new Promise((resolve) => setTimeout(resolve, delay)); + return this.innerExecute(command, retryCount + 1, direct); + } + const message = error instanceof Error ? error.message : "Unknown error"; + throw new ClientError(`Failed to execute command: ${message}`, 0, command.constructor.name, { + command: command.constructor.name, + error + }); + } + if (!response.ok) { + if (request.retryOnFailure && this.options.retry && RETRYABLE_ERROR_CODES.includes(response.status) && retryCount < this.options.retry.maxRetries) { + const delay = this.options.retry.delay; + await new Promise((resolve) => setTimeout(resolve, delay)); + return this.innerExecute(command, retryCount + 1, direct); + } + const body2 = await response.json().catch(() => void 0); + const commandName = command.constructor.name; + const error = new ClientError( + `${commandName} failed with ${response.status}: ${response.statusText}`, + response.status, + command.constructor.name, + body2 + ); + request.handleClientError(error); + } + const responseBody = response.status === 204 ? { status: response.status } : await response.json(); + const parsedBody = await request.parseResponse(responseBody); + return request.processResponse(this, parsedBody); + } + /** + * Override the base URL for all commands + */ + setBaseUrl(baseUrl6) { + this.baseUrl = baseUrl6; + } + /** + * Execute a command + */ + execute(command, direct) { + return this.innerExecute(command, 0, direct); + } + /** + * Close the client and clean up resources + * This should be called when the client is no longer needed to prevent memory leaks + */ + close() { + tenantCache.clear(); + } + /** + * Dispose the client + */ + [Symbol.dispose]() { + this.close(); + } +}; + +// src/utils/logger.ts +var defaultLogger = { + debug: (message, meta) => { + console.debug(message, meta); + }, + info: (message, meta) => { + console.info(message, meta); + }, + warn: (message, meta) => { + console.warn(message, meta); + }, + error: (message, meta) => { + console.error(message, meta); + } +}; +var WebSocketConstructor = globalThis.WebSocket ?? ws.WebSocket; +var MAX_RECONNECT_INTERVAL = 3e4; +var NotificationClient = class { + /** + * Creates a new NotificationClient instance + * @param observer - RxJS Subject for emitting notification events + * @param authOptions - Auth options for the client + * @param subscriptionSpec - Specification for what notifications to subscribe to + * @param options - Configuration options for the client + */ + constructor(observer, authOptions, subscriptionSpec, options) { + this.observer = observer; + this.authOptions = authOptions; + this.subscriptionSpec = subscriptionSpec; + this.options = { + reconnectInterval: 1e3, + ...options + }; + this.logger = options?.logger ?? defaultLogger; + this.reconnectInterval = options?.reconnectInterval ?? 1e3; + } + observer; + authOptions; + subscriptionSpec; + url = "wss://tenant.api.flowcore.io/notifications"; + webSocket; + options; + logger; + eventCount = 0; + reconnectInterval; + reconnectAttempts = 0; + _isOpen = false; + _isConnecting = false; + /** + * Which handshake carries the credential. + * + * `subprotocol` is tried first and is the one that does NOT put the + * credential in the URL. `query` is the legacy transport, kept only so this + * client still works against a server that has not shipped subprotocol + * support yet. + */ + authTransport = "subprotocol"; + /** True once a handshake has settled, so the fallback is probed at most once. */ + transportSettled = false; + /** + * Is the websocket connection open + */ + get isOpen() { + return this._isOpen; + } + /** + * Is the websocket connection currently connecting + */ + get isConnecting() { + return this._isConnecting; + } + /** + * Establishes WebSocket connection and sets up event handlers + */ + async connect() { + if (this._isConnecting || this._isOpen) { + this.logger.debug("Is already connecting or open"); + return; + } + this._isConnecting = true; + let flowcoreClient = null; + const urlParams = new URLSearchParams(); + let credential; + if ("oidcClient" in this.authOptions) { + const oidcClient = this.authOptions.oidcClient; + flowcoreClient = new FlowcoreClient({ + getBearerToken: async () => (await oidcClient.getToken()).accessToken + }); + credential = { kind: "bearer", token: (await oidcClient.getToken()).accessToken }; + } else { + flowcoreClient = new FlowcoreClient({ + apiKey: this.authOptions.apiKey, + ...this.authOptions.apiKeyId ? { apiKeyId: this.authOptions.apiKeyId } : {} + }); + credential = { + kind: "apiKey", + apiKey: this.authOptions.apiKey, + ...this.authOptions.apiKeyId ? { apiKeyId: this.authOptions.apiKeyId } : {} + }; + } + const handshake = this.buildCredentialHandshake(credential); + for (const [key, value] of handshake.query) { + urlParams.set(key, value); + } + const credentialProtocols = handshake.protocols; + const dataCore = await flowcoreClient.execute( + new DataCoreFetchCommand({ + tenant: this.subscriptionSpec.tenant, + dataCore: this.subscriptionSpec.dataCore + }) + ); + let flowType; + let eventType; + if (this.subscriptionSpec.flowType) { + flowType = await flowcoreClient.execute( + new FlowTypeFetchCommand({ + dataCoreId: dataCore.id, + flowType: this.subscriptionSpec.flowType + }) + ); + if (this.subscriptionSpec.eventType) { + eventType = await flowcoreClient.execute( + new EventTypeFetchCommand({ + flowTypeId: flowType?.id, + eventType: this.subscriptionSpec.eventType + }) + ); + } + } + const query = urlParams.toString(); + this.webSocket = new WebSocketConstructor( + query ? `${this.url}?${query}` : this.url, + credentialProtocols.length > 0 ? credentialProtocols : void 0 + ); + this.webSocket.onopen = () => { + this._isOpen = true; + this._isConnecting = false; + this.transportSettled = true; + this.logger.debug("WebSocket connection opened."); + this.reconnectInterval = this.options.reconnectInterval; + this.reconnectAttempts = 0; + this.webSocket.send( + JSON.stringify({ + tenant: this.subscriptionSpec.tenant, + dataCoreId: dataCore.id, + flowTypeId: flowType?.id, + eventTypeId: eventType?.id + }) + ); + }; + this.webSocket.onmessage = (event) => { + let parsedData; + if (event.data instanceof ArrayBuffer) { + parsedData = new TextDecoder().decode(event.data); + } else if (buffer.Buffer.isBuffer(event.data)) { + parsedData = event.data.toString(); + } else if (Array.isArray(event.data)) { + parsedData = buffer.Buffer.concat(event.data).toString(); + } else { + parsedData = event.data; + } + this.handleMessage(parsedData); + }; + this.webSocket.onclose = (event) => { + this._isOpen = false; + this.logger.debug(`Connection closed: Code [${event.code}], Reason: ${event.reason}`); + if (this.shouldFallBackToQueryTransport()) { + this.fallBackToQueryTransport(); + return; + } + if (![1e3].includes(event.code)) { + this.attemptReconnect(); + return; + } + this._isConnecting = false; + this.observer.complete(); + }; + this.webSocket.onerror = (error) => { + if (this.shouldFallBackToQueryTransport()) { + this.logger.debug("Subprotocol handshake refused; retrying on the legacy query transport"); + this.webSocket.close(); + return; + } + this.logger.error(`WebSocket encountered error: ${error}`); + this.observer.error(error); + this.webSocket.close(); + }; + } + /** + * Decides WHERE the credential travels, for the transport currently selected. + * + * This is the whole security property of this client, isolated so it can be + * asserted directly: on the `subprotocol` transport the returned query is + * EMPTY. An ingress access log records the request line, so a credential in + * the query string is written to disk in plaintext and is readable by + * everyone with log access — for a long-lived `fc_` key that is a full + * tenant compromise sitting in a log index. + */ + buildCredentialHandshake(credential) { + const query = new URLSearchParams(); + const protocols = []; + if (this.authTransport === "query") { + if (credential.kind === "bearer") { + query.set("token", credential.token); + } else { + query.set("api_key", credential.apiKey); + if (credential.apiKeyId) { + query.set("api_key_id", credential.apiKeyId); + } + } + return { query, protocols }; + } + if (credential.kind === "bearer") { + protocols.push("flowcore-bearer", credential.token); + } else { + protocols.push("flowcore-api-key", credential.apiKey); + if (credential.apiKeyId) { + protocols.push(credential.apiKeyId); + } + } + return { query, protocols }; + } + /** + * True when the subprotocol handshake has just failed for the first time. + * + * The fallback is probed at most ONCE per client. After it settles, a later + * failure is a real failure and goes through normal reconnect handling. + */ + shouldFallBackToQueryTransport() { + return this.authTransport === "subprotocol" && !this.transportSettled && !this._isOpen; + } + /** + * Switches to the legacy query-string transport and reconnects immediately. + * + * This does NOT count as a reconnect attempt: no backoff is consumed and the + * caller sees one continuous connection attempt. + */ + fallBackToQueryTransport() { + this.transportSettled = true; + this.authTransport = "query"; + this._isConnecting = false; + this.logger.debug("Falling back to the legacy query-string credential transport"); + void this.connect(); + } + /** + * Parses and dispatches a single raw notification frame. + * + * Runs inside the WebSocket `onmessage` callback, where any thrown error is + * uncaught and crashes the host process. Notification frames can occasionally + * be malformed (non-JSON, empty/absent `message`, truncated payloads, or + * non-event control frames), so every parse is guarded — a bad frame is logged + * and skipped instead of taking down the whole connection/process. + */ + handleMessage(rawData) { + let data; + try { + data = JSON.parse(rawData); + } catch (error) { + this.logger.warn( + `Discarding notification frame: outer payload is not valid JSON (${error instanceof Error ? error.message : String(error)})` + ); + return; + } + if (data.type === "validation") { + this.logger.error(`Bad request: ${data.summary} - ${data.message} - ${data.found} - ${data.errors}`); + return; + } + let parsed; + try { + parsed = JSON.parse(data.message); + } catch (error) { + this.logger.warn( + `Discarding notification frame: 'message' is not valid JSON (type ${typeof data.message}): ${error instanceof Error ? error.message : String(error)}` + ); + return; + } + if (!parsed || typeof parsed !== "object" || !parsed.data) { + this.logger.warn("Discarding notification frame: parsed payload is missing a 'data' field"); + return; + } + this.logger.debug(`Received event: ${parsed.pattern}`); + this.observer.next({ + pattern: parsed.pattern, + data: { + tenant: parsed.data.tenantId, + eventId: parsed.data.eventId, + dataCoreId: parsed.data.dataCore, + flowType: parsed.data.aggregator, + eventType: parsed.data.eventType, + validTime: parsed.data.validTime + } + }); + this.eventCount++; + if (this.options.maxEvents && this.options.maxEvents <= this.eventCount) { + this.observer.complete(); + this.eventCount = 0; + this.webSocket.close(1e3, "Max events received"); + } + } + /** + * Attempts to reconnect to the WebSocket server using exponential backoff + */ + attemptReconnect() { + if (this.options.maxReconnects && this.reconnectAttempts >= this.options.maxReconnects) { + this.logger.error( + `Max reconnect attempts ${this.reconnectAttempts}/${this.options.maxReconnects} reached. Giving up.` + ); + return; + } + this.reconnectAttempts++; + this._isConnecting = true; + this.logger.info( + `Attempting reconnection ${this.reconnectAttempts}${this.options.maxReconnects ? `/${this.options.maxReconnects}` : ""} in ${this.reconnectInterval} ms...` + ); + setTimeout(() => { + this.connect(); + }, this.reconnectInterval); + this.reconnectInterval = Math.min(MAX_RECONNECT_INTERVAL, this.reconnectInterval * 2); + } + /** + * Closes the WebSocket connection + */ + disconnect() { + if (this.webSocket) { + this.webSocket.close(1e3, "Disconnected by user"); + } + } + /** + * Overrides the base WebSocket URL for testing or different environments + * @param url - The new base URL to use + */ + overrideBaseUrl(url) { + this.url = url; + } +}; +var MAX_RECONNECT_INTERVAL2 = 3e4; +var WEBSOCKET_CLOSING = 2; +var WEBSOCKET_CLOSED = 3; +var WebSocketConstructor2 = globalThis.WebSocket ?? ws.WebSocket; +var WebSocketClient = class { + /** + * Creates a new WebSocketClient instance. + * @param authOptions - Authentication options (Bearer token via OIDC client or API Key). + * @param options - Configuration options for the client. + * @param webSocketFactory - Optional WebSocket factory for testing. + */ + constructor(authOptions, options, webSocketFactory) { + this.authOptions = authOptions; + this.options = { reconnectInterval: 1e3, ...options }; + this.logger = options?.logger ?? defaultLogger; + this.reconnectInterval = this.options.reconnectInterval; + this.webSocketFactory = webSocketFactory ?? ((url) => new WebSocketConstructor2(url)); + this.overrideBaseUrl = void 0; + if ("getBearerToken" in authOptions === false && "apiKey" in authOptions === false) { + throw new Error("Invalid authOptions: Must provide either getBearerToken or apiKey/apiKeyId"); + } + } + authOptions; + overrideBaseUrl; + // Field to store the override URL + webSocket; + options; + logger; + reconnectInterval; + reconnectAttempts = 0; + _isOpen = false; + _isConnecting = false; + webSocketFactory; + // Internal subject to push received data + internalSubject = new rxjs.Subject(); + // Store the current command and config for reconnects and sending + currentCommand = null; + currentConfig = null; + /** + * Override the base URL provided by commands. + * @param baseUrl - The new base URL to use (e.g., "wss://staging-server.api.flowcore.io"). + */ + setBaseUrl(baseUrl6) { + this.logger.info(`WebSocket base URL overridden to: ${baseUrl6}`); + this.overrideBaseUrl = baseUrl6; + } + /** + * Returns true if the WebSocket connection is currently open. + */ + get isOpen() { + return this._isOpen; + } + /** + * Returns true if the client is currently attempting to establish a WebSocket connection. + */ + get isConnecting() { + return this._isConnecting; + } + /** + * Establishes WebSocket connection based on the provided command. + * Disconnects any existing connection before starting the new one. + * @param command - The command defining the stream connection details. + * @returns An interface to interact with the active stream. + */ + // Using generic types for the command + async connect(command) { + if (this._isConnecting || this._isOpen) { + this.logger.debug("Disconnecting existing stream before starting new one."); + this.disconnect(); + await new Promise((resolve) => setTimeout(resolve, 50)); + } + this.currentCommand = command; + const config = command.getConfig(); + this.currentConfig = config; + this._isConnecting = true; + const baseUrl6 = this.overrideBaseUrl ?? command.getWebSocketBaseUrl(); + const pathSegment = command.getWebSocketPathSegment(config); + this.logger.debug(`Attempting to connect stream: ${baseUrl6}${pathSegment}`); + try { + const urlParams = new URLSearchParams(); + if ("getBearerToken" in this.authOptions && this.authOptions.getBearerToken) { + const token = await this.authOptions.getBearerToken(); + if (!token) throw new Error("Failed to get bearer token"); + urlParams.set("token", token); + } else if ("apiKey" in this.authOptions && this.authOptions.apiKey && this.authOptions.apiKeyId) { + urlParams.set("api_key", this.authOptions.apiKey); + urlParams.set("api_key_id", this.authOptions.apiKeyId); + } else { + throw new Error("Invalid authentication configuration."); + } + const cleanedBaseUrl = baseUrl6.endsWith("/") ? baseUrl6.slice(0, -1) : baseUrl6; + const cleanedPathSegment = pathSegment.startsWith("/") ? pathSegment.slice(1) : pathSegment; + const streamUrl = `${cleanedBaseUrl}/${cleanedPathSegment}?${urlParams.toString()}`; + this.logger.debug(`Connecting to WebSocket URL: ${streamUrl}`); + this.webSocket = this.webSocketFactory(streamUrl); + this.setupEventHandlers(); + return { + output$: this.internalSubject.asObservable(), + send: (payload) => this.sendMessage(payload), + disconnect: () => this.disconnect() + }; + } catch (error) { + this.logger.error(`Failed to initiate connection: ${error}`); + this._isConnecting = false; + this.currentCommand = null; + this.currentConfig = null; + throw error; + } + } + /** + * Sets up the WebSocket event handlers (onopen, onmessage, onclose, onerror). + */ + setupEventHandlers() { + this.webSocket.onopen = () => { + this._isOpen = true; + this._isConnecting = false; + const baseUrl6 = this.overrideBaseUrl ?? this.currentCommand?.getWebSocketBaseUrl(); + const pathSegment = this.currentCommand?.getWebSocketPathSegment(this.currentConfig); + const logUrl = baseUrl6 && pathSegment ? `${baseUrl6.replace(/\/?$/, "/")}${pathSegment.replace(/^\/?/, "")}` : "(unknown URL)"; + this.logger.debug(`WebSocket connection opened: ${logUrl}`); + this.reconnectInterval = this.options.reconnectInterval; + this.reconnectAttempts = 0; + }; + this.webSocket.onmessage = (event) => { + try { + let parsedData; + if (event.data instanceof ArrayBuffer) { + parsedData = new TextDecoder().decode(event.data); + } else if (buffer.Buffer.isBuffer(event.data)) { + parsedData = event.data.toString(); + } else { + parsedData = event.data; + } + const chunk = JSON.parse(parsedData); + if (typeof chunk !== "object" || chunk === null || typeof chunk.type !== "string") { + this.logger.warn(`Received invalid chunk format: ${parsedData}`); + return; + } + this.logger.debug(`Received chunk: ${chunk.type}`); + this.internalSubject.next(chunk); + } catch (error) { + this.logger.error(`Error processing received message: ${error}`); + } + }; + this.webSocket.onclose = (event) => { + const wasOpen = this._isOpen; + this._isOpen = false; + this._isConnecting = false; + const baseUrl6 = this.overrideBaseUrl ?? this.currentCommand?.getWebSocketBaseUrl(); + const pathSegment = this.currentCommand?.getWebSocketPathSegment(this.currentConfig); + const logUrl = baseUrl6 && pathSegment ? `${baseUrl6.replace(/\/?$/, "/")}${pathSegment.replace(/^\/?/, "")}` : "(unknown URL)"; + this.logger.debug( + `WebSocket connection closed: ${logUrl} Code [${event.code}], Reason: ${event.reason || "No reason given"} +. Was open: ${wasOpen}` + ); + if (wasOpen && event.code !== 1e3 && this.currentCommand) { + this.attemptReconnect(); + } else { + this.logger.debug(`Completing internal subject due to close event.`); + this.internalSubject.complete(); + this.currentCommand = null; + this.currentConfig = null; + } + }; + this.webSocket.onerror = () => { + const baseUrl6 = this.overrideBaseUrl ?? this.currentCommand?.getWebSocketBaseUrl(); + const pathSegment = this.currentCommand?.getWebSocketPathSegment(this.currentConfig); + const logUrl = baseUrl6 && pathSegment ? `${baseUrl6.replace(/\/?$/, "/")}${pathSegment.replace(/^\/?/, "")}` : "(unknown URL)"; + this.logger.error(`WebSocket encountered an error for stream: ${logUrl}.`); + if (this.webSocket.readyState !== WEBSOCKET_CLOSED && this.webSocket.readyState !== WEBSOCKET_CLOSING) { + this.webSocket.close(1011, "WebSocket error"); + } + this.internalSubject.error(new Error("WebSocket encountered an error")); + }; + } + /** + * Attempts to reconnect to the WebSocket server using exponential backoff. + * Requires `currentConfig` to be set. + */ + attemptReconnect() { + if (!this.currentCommand || !this.currentConfig) { + this.logger.error("Cannot reconnect without current command/config."); + if (!this.internalSubject.closed) this.internalSubject.complete(); + return; + } + if (this._isConnecting) { + this.logger.debug("Reconnect attempt already in progress."); + return; + } + const baseUrl6 = this.overrideBaseUrl ?? this.currentCommand.getWebSocketBaseUrl(); + const pathSegment = this.currentCommand.getWebSocketPathSegment(this.currentConfig); + const logUrl = baseUrl6 && pathSegment ? `${baseUrl6.replace(/\/?$/, "/")}${pathSegment.replace(/^\/?/, "")}` : "(unknown URL)"; + if (this.options.maxReconnects && this.reconnectAttempts >= this.options.maxReconnects) { + this.logger.error( + `Max reconnect attempts (${this.reconnectAttempts}/${this.options.maxReconnects}) reached. Giving up: ${logUrl}` + ); + if (!this.internalSubject.closed) this.internalSubject.complete(); + this.currentCommand = null; + this.currentConfig = null; + return; + } + this.reconnectAttempts++; + this._isConnecting = true; + this.logger.info( + `Attempting reconnection ${this.reconnectAttempts}${this.options.maxReconnects ? `/${this.options.maxReconnects}` : ""} + for ${logUrl} in ${this.reconnectInterval} ms...` + ); + setTimeout(async () => { + if (!this.currentCommand || !this.currentConfig) { + this.logger.debug("Reconnect cancelled as disconnect was called."); + this._isConnecting = false; + if (!this.internalSubject.closed) this.internalSubject.complete(); + return; + } + try { + const urlParams = new URLSearchParams(); + if ("getBearerToken" in this.authOptions && this.authOptions.getBearerToken) { + const token = await this.authOptions.getBearerToken(); + if (!token) throw new Error("Reconnect failed: Could not get bearer token"); + urlParams.set("token", token); + } else if ("apiKey" in this.authOptions && this.authOptions.apiKey && this.authOptions.apiKeyId) { + urlParams.set("api_key", this.authOptions.apiKey); + urlParams.set("api_key_id", this.authOptions.apiKeyId); + } else { + throw new Error("Reconnect failed: Invalid authentication configuration."); + } + const streamUrl = `${baseUrl6}${pathSegment}?${urlParams.toString()}`; + this.logger.debug(`Reconnecting to WebSocket URL: ${streamUrl}`); + this.webSocket = this.webSocketFactory(streamUrl); + this.setupEventHandlers(); + } catch (error) { + this.logger.error(`Reconnect attempt connection failed: ${error}`); + this._isConnecting = false; + this.reconnectInterval = Math.min(MAX_RECONNECT_INTERVAL2, this.reconnectInterval * 2); + this.attemptReconnect(); + } + }, this.reconnectInterval); + this.reconnectInterval = Math.min(MAX_RECONNECT_INTERVAL2, this.reconnectInterval * 2); + } + /** + * Sends a message to the currently connected WebSocket. + * @param message - The message object to send (e.g., { content: "user input" }). + */ + sendMessage(payload) { + const openState = 1; + if (!this._isOpen || this.webSocket.readyState !== openState || !this.currentCommand) { + this.logger.warn("Cannot send message: WebSocket is not open or command not set."); + return false; + } + try { + const serializer = this.currentCommand.serializeSendPayload ?? JSON.stringify; + const dataToSend = serializer(payload); + this.webSocket.send(dataToSend); + this.logger.debug(`Sent message: ${dataToSend}`); + return true; + } catch (error) { + this.logger.error(`Failed to send message: ${error}`); + return false; + } + } + /** + * Closes the WebSocket connection gracefully. + */ + disconnect() { + this.logger.debug("Disconnect called by user."); + const commandToClear = this.currentCommand; + this.currentCommand = null; + this.currentConfig = null; + if (this.webSocket) { + if (this._isOpen || this._isConnecting) { + this.webSocket.close(1e3, "Disconnected by user"); + } else { + this.logger.debug("WebSocket already closed or closing."); + } + } else { + this.logger.debug("No WebSocket instance to disconnect."); + } + this._isOpen = false; + this._isConnecting = false; + if (commandToClear && !this.internalSubject.closed) { + this.logger.debug("Completing internal subject due to disconnect call."); + this.internalSubject.complete(); + } + } + /** + * Implements the Disposable interface for clean resource management. + */ + [Symbol.dispose]() { + this.disconnect(); + } +}; + +// src/mod.ts +init_parse_response_helper(); + +exports.ApiKeyCreateCommand = ApiKeyCreateCommand; +exports.ApiKeyDeleteCommand = ApiKeyDeleteCommand; +exports.ApiKeyEditCommand = ApiKeyEditCommand; +exports.ApiKeyFetchCommand = ApiKeyFetchCommand; +exports.ApiKeyListCommand = ApiKeyListCommand; +exports.ApiKeyValidateCommand = ApiKeyValidateCommand; +exports.ApiKeyValidateWithTenantIdCommand = ApiKeyValidateWithTenantIdCommand; +exports.ArchivePolicyResponseSchema = ArchivePolicyResponseSchema; +exports.ArchiveRoleResponseSchema = ArchiveRoleResponseSchema; +exports.ArtifactGetCommand = ArtifactGetCommand; +exports.AuditLogEntrySchema = AuditLogEntrySchema; +exports.AuditLogResponseSchema = AuditLogResponseSchema; +exports.AwsMarketplaceCustomerResolveCommand = AwsMarketplaceCustomerResolveCommand; +exports.AwsMarketplaceLinkCreateCommand = AwsMarketplaceLinkCreateCommand; +exports.AwsMarketplaceLinkDeleteCommand = AwsMarketplaceLinkDeleteCommand; +exports.AwsMarketplaceLinkFetchCommand = AwsMarketplaceLinkFetchCommand; +exports.AwsMarketplaceLinkListCommand = AwsMarketplaceLinkListCommand; +exports.ClientError = ClientError; +exports.ComputeDeploymentEventObjectSchema = ComputeDeploymentEventObjectSchema; +exports.ComputeDeploymentEventSchema = ComputeDeploymentEventSchema; +exports.ComputeDomainAttachCommand = ComputeDomainAttachCommand; +exports.ComputeDomainDetachCommand = ComputeDomainDetachCommand; +exports.ComputeDomainListCommand = ComputeDomainListCommand; +exports.ComputeDomainListResponseSchema = ComputeDomainListResponseSchema; +exports.ComputeDomainSchema = ComputeDomainSchema; +exports.ComputeDomainStatusSchema = ComputeDomainStatusSchema; +exports.ComputeDomainTlsSchema = ComputeDomainTlsSchema; +exports.ComputeDomainTlsStatusSchema = ComputeDomainTlsStatusSchema; +exports.ComputeDomainVerificationSchema = ComputeDomainVerificationSchema; +exports.ComputeDomainVerificationTypeSchema = ComputeDomainVerificationTypeSchema; +exports.ComputeDomainVerifyCommand = ComputeDomainVerifyCommand; +exports.ComputeDomainVerifyResponseSchema = ComputeDomainVerifyResponseSchema; +exports.ComputeLogEntrySchema = ComputeLogEntrySchema; +exports.ComputeLogStreamEventSchema = ComputeLogStreamEventSchema; +exports.ComputeLogStreamNameSchema = ComputeLogStreamNameSchema; +exports.ComputeNoContentSchema = ComputeNoContentSchema; +exports.ComputeOperationDeploymentProgressSchema = ComputeOperationDeploymentProgressSchema; +exports.ComputeOperationFetchCommand = ComputeOperationFetchCommand; +exports.ComputeOperationPhaseSchema = ComputeOperationPhaseSchema; +exports.ComputeOperationPreSyncProgressSchema = ComputeOperationPreSyncProgressSchema; +exports.ComputeOperationProgressSchema = ComputeOperationProgressSchema; +exports.ComputeOperationSchema = ComputeOperationSchema; +exports.ComputeOperationStatusSchema = ComputeOperationStatusSchema; +exports.ComputeOperationStepStatusSchema = ComputeOperationStepStatusSchema; +exports.ComputeOperationTypeSchema = ComputeOperationTypeSchema; +exports.ComputePreSyncSpecSchema = ComputePreSyncSpecSchema; +exports.ComputeProbeExecSchema = ComputeProbeExecSchema; +exports.ComputeProbeHttpGetSchema = ComputeProbeHttpGetSchema; +exports.ComputeProbeSchema = ComputeProbeSchema; +exports.ComputeProbeTcpSocketSchema = ComputeProbeTcpSocketSchema; +exports.ComputeRegistryDetailResponseSchema = ComputeRegistryDetailResponseSchema; +exports.ComputeRegistryDetailSchema = ComputeRegistryDetailSchema; +exports.ComputeRegistryFetchCommand = ComputeRegistryFetchCommand; +exports.ComputeRegistryListCommand = ComputeRegistryListCommand; +exports.ComputeRegistryListResponseSchema = ComputeRegistryListResponseSchema; +exports.ComputeRegistryRegisterCommand = ComputeRegistryRegisterCommand; +exports.ComputeRegistryRemoveCommand = ComputeRegistryRemoveCommand; +exports.ComputeRegistryRotateCommand = ComputeRegistryRotateCommand; +exports.ComputeRegistrySchema = ComputeRegistrySchema; +exports.ComputeRegistrySynthesisStateSchema = ComputeRegistrySynthesisStateSchema; +exports.ComputeSlotTierSchema = ComputeSlotTierSchema; +exports.ComputeWorkloadCreateCommand = ComputeWorkloadCreateCommand; +exports.ComputeWorkloadCreateResponseSchema = ComputeWorkloadCreateResponseSchema; +exports.ComputeWorkloadCreateTrackedCommand = ComputeWorkloadCreateTrackedCommand; +exports.ComputeWorkloadDefinitionSchema = ComputeWorkloadDefinitionSchema; +exports.ComputeWorkloadDeleteCommand = ComputeWorkloadDeleteCommand; +exports.ComputeWorkloadDeleteResponseSchema = ComputeWorkloadDeleteResponseSchema; +exports.ComputeWorkloadDeploymentEventsSchema = ComputeWorkloadDeploymentEventsSchema; +exports.ComputeWorkloadEnvVarSchema = ComputeWorkloadEnvVarSchema; +exports.ComputeWorkloadEventsListCommand = ComputeWorkloadEventsListCommand; +exports.ComputeWorkloadFetchCommand = ComputeWorkloadFetchCommand; +exports.ComputeWorkloadKindSchema = ComputeWorkloadKindSchema; +exports.ComputeWorkloadListCommand = ComputeWorkloadListCommand; +exports.ComputeWorkloadListResponseSchema = ComputeWorkloadListResponseSchema; +exports.ComputeWorkloadLogStreamCommand = ComputeWorkloadLogStreamCommand; +exports.ComputeWorkloadLogsFetchCommand = ComputeWorkloadLogsFetchCommand; +exports.ComputeWorkloadLogsSchema = ComputeWorkloadLogsSchema; +exports.ComputeWorkloadMutationResponseSchema = ComputeWorkloadMutationResponseSchema; +exports.ComputeWorkloadPauseCommand = ComputeWorkloadPauseCommand; +exports.ComputeWorkloadProbesSchema = ComputeWorkloadProbesSchema; +exports.ComputeWorkloadResponseSchema = ComputeWorkloadResponseSchema; +exports.ComputeWorkloadResumeCommand = ComputeWorkloadResumeCommand; +exports.ComputeWorkloadRevisionCauseSchema = ComputeWorkloadRevisionCauseSchema; +exports.ComputeWorkloadRevisionListSchema = ComputeWorkloadRevisionListSchema; +exports.ComputeWorkloadRevisionSchema = ComputeWorkloadRevisionSchema; +exports.ComputeWorkloadRevisionsListCommand = ComputeWorkloadRevisionsListCommand; +exports.ComputeWorkloadRollbackCommand = ComputeWorkloadRollbackCommand; +exports.ComputeWorkloadRunCommand = ComputeWorkloadRunCommand; +exports.ComputeWorkloadRunKindSchema = ComputeWorkloadRunKindSchema; +exports.ComputeWorkloadRunListSchema = ComputeWorkloadRunListSchema; +exports.ComputeWorkloadRunResponseSchema = ComputeWorkloadRunResponseSchema; +exports.ComputeWorkloadRunSchema = ComputeWorkloadRunSchema; +exports.ComputeWorkloadRunStatusSchema = ComputeWorkloadRunStatusSchema; +exports.ComputeWorkloadRunsListCommand = ComputeWorkloadRunsListCommand; +exports.ComputeWorkloadScalingModeSchema = ComputeWorkloadScalingModeSchema; +exports.ComputeWorkloadScalingSchema = ComputeWorkloadScalingSchema; +exports.ComputeWorkloadSchema = ComputeWorkloadSchema; +exports.ComputeWorkloadSecretRefSchema = ComputeWorkloadSecretRefSchema; +exports.ComputeWorkloadStatusSchema = ComputeWorkloadStatusSchema; +exports.ComputeWorkloadUpdateCommand = ComputeWorkloadUpdateCommand; +exports.ComputeWorkloadVolumeSchema = ComputeWorkloadVolumeSchema; +exports.ContainerRegistListCommand = ContainerRegistListCommand; +exports.ContainerRegistryCreateCommand = ContainerRegistryCreateCommand; +exports.ContainerRegistryDeleteCommand = ContainerRegistryDeleteCommand; +exports.ContainerRegistryFetchCommand = ContainerRegistryFetchCommand; +exports.ContainerRegistryUpdateCommand = ContainerRegistryUpdateCommand; +exports.ContextAddItemCommand = ContextAddItemCommand; +exports.ContextRemoveItemCommand = ContextRemoveItemCommand; +exports.ConversationDeleteCommand = ConversationDeleteCommand; +exports.ConversationGetCommand = ConversationGetCommand; +exports.ConversationListCommand = ConversationListCommand; +exports.ConversationStreamCommand = ConversationStreamCommand; +exports.CustomCommand = CustomCommand; +exports.DEFAULT_COMPUTE_OPERATION_POLL_INTERVAL_MS = DEFAULT_COMPUTE_OPERATION_POLL_INTERVAL_MS; +exports.DEFAULT_COMPUTE_OPERATION_TIMEOUT_MS = DEFAULT_COMPUTE_OPERATION_TIMEOUT_MS; +exports.DataCoreCreateCommand = DataCoreCreateCommand; +exports.DataCoreExistsCommand = DataCoreExistsCommand; +exports.DataCoreFetchCommand = DataCoreFetchCommand; +exports.DataCoreListCommand = DataCoreListCommand; +exports.DataCoreRequestDeleteCommand = DataCoreRequestDeleteCommand; +exports.DataCoreUpdateCommand = DataCoreUpdateCommand; +exports.DataPathwayAssignmentCompleteCommand = DataPathwayAssignmentCompleteCommand; +exports.DataPathwayAssignmentExpireLeasesCommand = DataPathwayAssignmentExpireLeasesCommand; +exports.DataPathwayAssignmentFetchCommand = DataPathwayAssignmentFetchCommand; +exports.DataPathwayAssignmentHeartbeatCommand = DataPathwayAssignmentHeartbeatCommand; +exports.DataPathwayAssignmentListCommand = DataPathwayAssignmentListCommand; +exports.DataPathwayAssignmentNextCommand = DataPathwayAssignmentNextCommand; +exports.DataPathwayCapacityFetchCommand = DataPathwayCapacityFetchCommand; +exports.DataPathwayCommandDispatchConfigUpdateCommand = DataPathwayCommandDispatchConfigUpdateCommand; +exports.DataPathwayCommandDispatchPauseCommand = DataPathwayCommandDispatchPauseCommand; +exports.DataPathwayCommandDispatchRestartCommand = DataPathwayCommandDispatchRestartCommand; +exports.DataPathwayCommandDispatchResumeCommand = DataPathwayCommandDispatchResumeCommand; +exports.DataPathwayCommandDispatchStopCommand = DataPathwayCommandDispatchStopCommand; +exports.DataPathwayCommandFetchCommand = DataPathwayCommandFetchCommand; +exports.DataPathwayCommandPendingByPathwayCommand = DataPathwayCommandPendingByPathwayCommand; +exports.DataPathwayCommandPendingCommand = DataPathwayCommandPendingCommand; +exports.DataPathwayCommandUpdateStatusByPathwayCommand = DataPathwayCommandUpdateStatusByPathwayCommand; +exports.DataPathwayCommandUpdateStatusCommand = DataPathwayCommandUpdateStatusCommand; +exports.DataPathwayCreateCommand = DataPathwayCreateCommand; +exports.DataPathwayDeleteCommand = DataPathwayDeleteCommand; +exports.DataPathwayDeliveryLogBatchCommand = DataPathwayDeliveryLogBatchCommand; +exports.DataPathwayDeliveryLogListCommand = DataPathwayDeliveryLogListCommand; +exports.DataPathwayDisableCommand = DataPathwayDisableCommand; +exports.DataPathwayFetchByNameCommand = DataPathwayFetchByNameCommand; +exports.DataPathwayFetchCommand = DataPathwayFetchCommand; +exports.DataPathwayHealthCheckCommand = DataPathwayHealthCheckCommand; +exports.DataPathwayListCommand = DataPathwayListCommand; +exports.DataPathwayMetricsFetchCommand = DataPathwayMetricsFetchCommand; +exports.DataPathwayPumpStateFetchBySourceCommand = DataPathwayPumpStateFetchBySourceCommand; +exports.DataPathwayPumpStateFetchCommand = DataPathwayPumpStateFetchCommand; +exports.DataPathwayPumpStateSaveBySourceCommand = DataPathwayPumpStateSaveBySourceCommand; +exports.DataPathwayPumpStateSaveCommand = DataPathwayPumpStateSaveCommand; +exports.DataPathwayQuotaFetchCommand = DataPathwayQuotaFetchCommand; +exports.DataPathwayQuotaListCommand = DataPathwayQuotaListCommand; +exports.DataPathwayQuotaSetCommand = DataPathwayQuotaSetCommand; +exports.DataPathwayRestartFetchCommand = DataPathwayRestartFetchCommand; +exports.DataPathwayRestartRequestCommand = DataPathwayRestartRequestCommand; +exports.DataPathwaySlotDeregisterCommand = DataPathwaySlotDeregisterCommand; +exports.DataPathwaySlotFetchCommand = DataPathwaySlotFetchCommand; +exports.DataPathwaySlotHeartbeatCommand = DataPathwaySlotHeartbeatCommand; +exports.DataPathwaySlotListCommand = DataPathwaySlotListCommand; +exports.DataPathwaySlotRegisterCommand = DataPathwaySlotRegisterCommand; +exports.DataPathwayUpsertByNameCommand = DataPathwayUpsertByNameCommand; +exports.DataPathwayUpsertByNameResponseSchema = DataPathwayUpsertByNameResponseSchema; +exports.EntitlementResponseSchema = EntitlementResponseSchema; +exports.EventListCommand = EventListCommand; +exports.EventTypeCreateCommand = EventTypeCreateCommand; +exports.EventTypeExistsCommand = EventTypeExistsCommand; +exports.EventTypeFetchCommand = EventTypeFetchCommand; +exports.EventTypeInfoCommand = EventTypeInfoCommand; +exports.EventTypeListCommand = EventTypeListCommand; +exports.EventTypeListRemovedSensitiveDataCommand = EventTypeListRemovedSensitiveDataCommand; +exports.EventTypeRemoveSensitiveDataCommand = EventTypeRemoveSensitiveDataCommand; +exports.EventTypeRequestDeleteCommand = EventTypeRequestDeleteCommand; +exports.EventTypeRequestTruncateCommand = EventTypeRequestTruncateCommand; +exports.EventTypeUpdateCommand = EventTypeUpdateCommand; +exports.EventsFetchCommand = EventsFetchCommand; +exports.EventsFetchTimeBucketsByNamesCommand = EventsFetchTimeBucketsByNamesCommand; +exports.FetchPumpStatusCommand = FetchPumpStatusCommand; +exports.FlowTypeCreateCommand = FlowTypeCreateCommand; +exports.FlowTypeExistsCommand = FlowTypeExistsCommand; +exports.FlowTypeFetchCommand = FlowTypeFetchCommand; +exports.FlowTypeListCommand = FlowTypeListCommand; +exports.FlowTypeRequestDeleteCommand = FlowTypeRequestDeleteCommand; +exports.FlowTypeUpdateCommand = FlowTypeUpdateCommand; +exports.FlowcoreClient = FlowcoreClient; +exports.IngestBatchCommand = IngestBatchCommand; +exports.IngestEventCommand = IngestEventCommand; +exports.KeyPoliciesCommand = KeyPoliciesCommand; +exports.KeyPolicyLinkSchema = KeyPolicyLinkSchema; +exports.KeyRoleLinkSchema = KeyRoleLinkSchema; +exports.KeyRolesCommand = KeyRolesCommand; +exports.LinkKeyPolicyCommand = LinkKeyPolicyCommand; +exports.LinkKeyRoleCommand = LinkKeyRoleCommand; +exports.LinkRolePolicyCommand = LinkRolePolicyCommand; +exports.LinkUserPolicyCommand = LinkUserPolicyCommand; +exports.LinkUserRoleCommand = LinkUserRoleCommand; +exports.NotificationClient = NotificationClient; +exports.OrganizationPoliciesCommand = OrganizationPoliciesCommand; +exports.OrganizationRolesCommand = OrganizationRolesCommand; +exports.PaginationSchema = PaginationSchema; +exports.PermissionsListCommand = PermissionsListCommand; +exports.PolicyArchiveCommand = PolicyArchiveCommand; +exports.PolicyAssociationsCommand = PolicyAssociationsCommand; +exports.PolicyAssociationsSchema = PolicyAssociationsSchema; +exports.PolicyCreateCommand = PolicyCreateCommand; +exports.PolicyFilterSchema = PolicyFilterSchema; +exports.PolicyFilterValueSchema = PolicyFilterValueSchema; +exports.PolicyGetCommand = PolicyGetCommand; +exports.PolicyKeyAssociationSchema = PolicyKeyAssociationSchema; +exports.PolicyListCommand = PolicyListCommand; +exports.PolicyRoleAssociationSchema = PolicyRoleAssociationSchema; +exports.PolicySchema = PolicySchema; +exports.PolicyStatementSchema = PolicyStatementSchema; +exports.PolicyUpdateCommand = PolicyUpdateCommand; +exports.PolicyUserAssociationSchema = PolicyUserAssociationSchema; +exports.PolicyValidateCommand = PolicyValidateCommand; +exports.PolicyValidateResponseSchema = PolicyValidateResponseSchema; +exports.ResolveKeyEntitlementsCommand = ResolveKeyEntitlementsCommand; +exports.ResolveUserEntitlementsCommand = ResolveUserEntitlementsCommand; +exports.RoleArchiveCommand = RoleArchiveCommand; +exports.RoleAssociationsCommand = RoleAssociationsCommand; +exports.RoleAssociationsSchema = RoleAssociationsSchema; +exports.RoleCreateCommand = RoleCreateCommand; +exports.RoleGetCommand = RoleGetCommand; +exports.RoleKeyAssociationSchema = RoleKeyAssociationSchema; +exports.RoleListCommand = RoleListCommand; +exports.RolePoliciesCommand = RolePoliciesCommand; +exports.RolePolicyLinkSchema = RolePolicyLinkSchema; +exports.RoleSchema = RoleSchema; +exports.RoleUpdateCommand = RoleUpdateCommand; +exports.RoleUserAssociationSchema = RoleUserAssociationSchema; +exports.SecretCreateCommand = SecretCreateCommand; +exports.SecretDeleteCommand = SecretDeleteCommand; +exports.SecretEditCommand = SecretEditCommand; +exports.SecretFetchCommand = SecretFetchCommand; +exports.SecretListCommand = SecretListCommand; +exports.SecurityCreatePATCommand = SecurityCreatePATCommand; +exports.SecurityDeletePATCommand = SecurityDeletePATCommand; +exports.SecurityExchangePATCommand = SecurityExchangePATCommand; +exports.SecurityGetPATCommand = SecurityGetPATCommand; +exports.SecurityListPATCommand = SecurityListPATCommand; +exports.SendPumpPulseCommand = SendPumpPulseCommand; +exports.ServiceAccountCreateCommand = ServiceAccountCreateCommand; +exports.ServiceAccountDeleteCommand = ServiceAccountDeleteCommand; +exports.ServiceAccountEditCommand = ServiceAccountEditCommand; +exports.ServiceAccountFetchCommand = ServiceAccountFetchCommand; +exports.ServiceAccountListCommand = ServiceAccountListCommand; +exports.ServiceAccountRotateSecretCommand = ServiceAccountRotateSecretCommand; +exports.TenantAuditLogsCommand = TenantAuditLogsCommand; +exports.TenantCreateCommand = TenantCreateCommand; +exports.TenantDisableSensitiveDataCommand = TenantDisableSensitiveDataCommand; +exports.TenantEnableSensitiveDataCommand = TenantEnableSensitiveDataCommand; +exports.TenantFetchCommand = TenantFetchCommand; +exports.TenantListCommand = TenantListCommand; +exports.TenantPreviewCommand = TenantPreviewCommand; +exports.TenantTranslateNameToIdCommand = TenantTranslateNameToIdCommand; +exports.TenantTranslateNameToIdSchema = TenantTranslateNameToIdSchema; +exports.TenantUpdateCommand = TenantUpdateCommand; +exports.TenantUserAddCommand = TenantUserAddCommand; +exports.TenantUserListCommand = TenantUserListCommand; +exports.TenantUserRemoveCommand = TenantUserRemoveCommand; +exports.TimeBucketListCommand = TimeBucketListCommand; +exports.UnlinkKeyPolicyCommand = UnlinkKeyPolicyCommand; +exports.UnlinkKeyRoleCommand = UnlinkKeyRoleCommand; +exports.UnlinkRolePolicyCommand = UnlinkRolePolicyCommand; +exports.UnlinkUserPolicyCommand = UnlinkUserPolicyCommand; +exports.UnlinkUserRoleCommand = UnlinkUserRoleCommand; +exports.UserDeleteCommand = UserDeleteCommand; +exports.UserInitializeInKeycloakCommand = UserInitializeInKeycloakCommand; +exports.UserInviteToTenantCommand = UserInviteToTenantCommand; +exports.UserPermissionSchema = UserPermissionSchema; +exports.UserPermissionsCommand = UserPermissionsCommand; +exports.UserPoliciesCommand = UserPoliciesCommand; +exports.UserPolicyLinkSchema = UserPolicyLinkSchema; +exports.UserRoleLinkSchema = UserRoleLinkSchema; +exports.UserRolesCommand = UserRolesCommand; +exports.ValidPolicySchema = ValidPolicySchema; +exports.ValidateKeyCommand = ValidateKeyCommand; +exports.ValidateUserCommand = ValidateUserCommand; +exports.ValidationResponseSchema = ValidationResponseSchema; +exports.VariableCreateCommand = VariableCreateCommand; +exports.VariableDeleteCommand = VariableDeleteCommand; +exports.VariableEditCommand = VariableEditCommand; +exports.VariableFetchCommand = VariableFetchCommand; +exports.VariableListCommand = VariableListCommand; +exports.WebSocketClient = WebSocketClient; +exports.isEncryptedPayload = isEncryptedPayload; +exports.matchesPolicyFilters = matchesPolicyFilters; +exports.parseEntitlementResponse = parseEntitlementResponse; +exports.permitsPayload = permitsPayload; +exports.waitForComputeOperation = waitForComputeOperation; +//# sourceMappingURL=index.cjs.map +//# sourceMappingURL=index.cjs.map \ No newline at end of file diff --git a/dist/index.d.cts b/dist/index.d.cts new file mode 100644 index 0000000..ff6c96d --- /dev/null +++ b/dist/index.d.cts @@ -0,0 +1,9738 @@ +import * as _sinclair_typebox from '@sinclair/typebox'; +import { TObject, Static, TString, TBoolean, TUnion, TNull, TLiteral, TOptional, TArray, TRecord, TUnknown, TNumber, TInteger, TProperties, TSchema } from '@sinclair/typebox'; +import { Observable, Subject } from 'rxjs'; +import { Buffer } from 'node:buffer'; + +/** + * An error thrown when the client request fails + */ +declare class ClientError extends Error { + readonly status: number; + readonly command: string; + readonly body?: unknown | undefined; + constructor(message: string, status: number, command: string, body?: unknown | undefined); +} + +/** + * The options for the bearer token + */ +interface ClientOptionsBearer { + getBearerToken: () => Promise | string | null; + /** + * The ID of the API key. + * @deprecated Use apiKey only instead (apiKeyId is only used for old api keys). + */ + apiKeyId?: never; + apiKey?: never; + retry?: { + delay: number; + maxRetries: number; + } | null; +} +/** + * The options for the api key + */ +interface ClientOptionsApiKey { + /** + * The ID of the API key. + * @deprecated Use apiKey only instead (apiKeyId is only used for old api keys). + */ + apiKeyId?: string; + apiKey: string; + getBearerToken?: never; + retry?: { + delay: number; + maxRetries: number; + } | null; +} +/** + * The options for the client + */ +type ClientOptions = ClientOptionsBearer | ClientOptionsApiKey; +/** + * A base client for executing commands + */ +declare class FlowcoreClient { + private readonly options; + private mode; + private baseUrl; + constructor(options: ClientOptions); + /** + * Get the auth header + * + * Public so that a `CustomCommand` which owns its own transport — a + * streaming request whose body must NOT be consumed by `innerExecute`'s + * unconditional `response.json()` — can authenticate its own fetch with + * exactly the header every other command sends. Read-only: it derives the + * header from the client options and mutates nothing. + */ + getAuthHeader(): Promise; + /** + * Execute a command (inner method) + */ + private innerExecute; + /** + * Override the base URL for all commands + */ + setBaseUrl(baseUrl: string): void; + /** + * Execute a command + */ + execute(command: Command, direct?: boolean): Promise; + /** + * Close the client and clean up resources + * This should be called when the client is no longer needed to prevent memory leaks + */ + close(): void; + /** + * Dispose the client + */ + [Symbol.dispose](): void; +} + +/** + * Abstract command for executing requests + */ +declare abstract class Command { + /** + * Whether the command should retry on failure + */ + protected readonly retryOnFailure: boolean; + /** + * The dedicated subdomain for the command + */ + protected readonly dedicatedSubdomain?: string; + /** + * The allowed modes for the command + */ + protected readonly allowedModes: ("apiKey" | "bearer")[]; + /** + * The input for the command + */ + protected readonly input: Input; + /** + * The client auth options + */ + protected readonly clientAuthOptions: { + token?: string; + apiKeyId?: string; + apiKey?: string; + }; + constructor(input: Input); + /** + * Set the client auth options - this is called by the FlowcoreClient + * before executing the command + */ + setClientAuthOptions(options: { + token?: string; + apiKeyId?: string; + apiKey?: string; + }): void; + /** + * Get the dedicated base URL + */ + protected getDedicatedBaseUrl(client: FlowcoreClient): Promise; + /** + * Get the base URL for the request + */ + protected abstract getBaseUrl(): string; + /** + * Get the method for the request + */ + protected getMethod(): string; + /** + * Get the path for the request + */ + protected getPath(): string; + /** + * Get the body for the request + */ + protected getBody(): Record | Array | undefined; + /** + * Get the headers for the request + */ + protected getHeaders(): Record; + /** + * Parse the response + */ + protected abstract parseResponse(response: unknown): Output; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; + /** + * Get the request object + */ + getRequest(client: FlowcoreClient, direct?: boolean): Promise<{ + allowedModes: ("apiKey" | "bearer")[]; + body: string | Record | Array | undefined; + headers: Record; + baseUrl: string; + path: string; + method: string; + parseResponse: (response: unknown) => Output | Promise; + processResponse: (client: FlowcoreClient, response: Output) => Promise; + handleClientError: (error: ClientError) => void; + retryOnFailure: boolean; + customExecute?: (client: FlowcoreClient) => Promise; + }>; + /** + * Wait for the response + */ + protected processResponse(_client: FlowcoreClient, response: Output): Promise; +} + +interface ArtifactGetCommandInput { + artifactId: string; +} +/** + * Represents the structure of the artifact returned by the API. + * Based on the Swagger spec example. + */ +declare const ArtifactSchema: TObject; +type Artifact = typeof ArtifactSchema.static; +declare class ArtifactGetCommand extends Command { + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected getHeaders(): Record; + protected parseResponse(rawResponse: unknown): Artifact; + protected handleClientError(error: ClientError): void; +} + +interface ContextItem { + type: "tenant" | "dataCore" | "flowType" | "eventType" | string; + id: string; + name: string; + description: string; +} +interface Message { + id: string; + role: "system" | "user" | "assistant"; + content: string; + timestamp: string; +} +interface ConversationMetadata { + id: string; + title: string; + lastUpdated: string; +} +interface Conversation extends ConversationMetadata { + context: ContextItem[]; + messages: Message[]; +} +interface ConversationListResponse { + conversations: ConversationMetadata[]; +} +interface ConversationDeleteResponse { + message: string; +} +interface ContextUpdateResponse { + context: ContextItem[]; +} +interface AddContextItem { + type: string; + id: string; +} +interface AddContextItemsRequest { + items: AddContextItem[]; +} +interface RemoveContextItemRequest { + itemId: string; +} + +/** + * Input for adding items to a conversation's context. + */ +type ContextAddItemCommandInput = { + /** The ID of the conversation to modify. */ + conversationId: string; + /** An array of context items (type and ID) to add. */ + items: AddContextItem[]; +}; +/** + * Output containing the updated context array after adding items. + */ +type ContextAddItemCommandOutput = ContextUpdateResponse; +/** + * Command to add one or more items to the context of a specific conversation. + */ +declare class ContextAddItemCommand extends Command { + protected getBaseUrl(): string; + protected getMethod(): string; + protected getPath(): string; + protected getBody(): Record; + protected parseResponse(response: unknown): ContextAddItemCommandOutput; +} + +/** + * Input for removing an item from a conversation's context. + */ +type ContextRemoveItemCommandInput = { + /** The ID of the conversation to modify. */ + conversationId: string; + /** The unique ID of the context item instance to remove. */ + itemId: string; +}; +/** + * Output containing the updated context array after removing the item. + */ +type ContextRemoveItemCommandOutput = ContextUpdateResponse; +/** + * Command to remove a specific item from the context of a conversation. + */ +declare class ContextRemoveItemCommand extends Command { + protected getBaseUrl(): string; + protected getMethod(): string; + protected getPath(): string; + protected getBody(): Record; + protected parseResponse(response: unknown): ContextRemoveItemCommandOutput; +} + +/** + * Input for deleting a specific conversation. + */ +type ConversationDeleteCommandInput = { + /** The unique ID of the conversation to delete. */ + conversationId: string; +}; +/** + * Output confirming the deletion of the conversation. + */ +type ConversationDeleteCommandOutput = ConversationDeleteResponse; +/** + * Command to delete a specific conversation by its ID. + */ +declare class ConversationDeleteCommand extends Command { + protected getBaseUrl(): string; + protected getMethod(): string; + protected getPath(): string; + protected parseResponse(response: unknown): ConversationDeleteCommandOutput; +} + +/** + * Input for fetching a specific conversation. + */ +type ConversationGetCommandInput = { + /** The unique ID of the conversation to fetch. */ + conversationId: string; +}; +/** + * Output containing the full details of the fetched conversation. + */ +type ConversationGetCommandOutput = Conversation; +/** + * Command to fetch the details of a specific conversation by its ID. + */ +declare class ConversationGetCommand extends Command { + protected getBaseUrl(): string; + protected getMethod(): string; + protected getPath(): string; + protected parseResponse(response: unknown): ConversationGetCommandOutput; + protected handleClientError(error: ClientError): void; +} + +/** + * Input for listing conversations. + * Currently empty as no filters are supported. + */ +type ConversationListCommandInput = Record; +/** + * Output containing a list of conversation metadata. + */ +type ConversationListCommandOutput = ConversationMetadata[]; +/** + * Command to list all conversations accessible by the user. + */ +declare class ConversationListCommand extends Command { + constructor(); + protected getBaseUrl(): string; + protected getMethod(): string; + protected getPath(): string; + protected parseResponse(response: unknown): ConversationListCommandOutput; +} + +/** + * Configuration for initiating an AI Agent Coordinator stream. + */ +interface AiStreamConfig { + /** The ID of the conversation to stream. */ + conversationId: string; +} +interface MarkdownDeltaChunk { + type: "markdown_delta"; + /** The chunk of markdown text. */ + content: string; +} +interface InfoChunk { + type: "info"; + /** An informational message. */ + message: string; +} +interface ErrorChunk { + type: "error"; + /** An error message. */ + message: string; +} +interface ToolStartChunk { + type: "tool_start"; + /** The name of the tool being executed. */ + tool_name: string; +} +interface ToolInputChunk { + type: "tool_input"; + /** The input provided to the tool (can be any JSON structure). */ + content: unknown; +} +interface ToolOutputChunk { + type: "tool_output"; + /** The output received from the tool (can be any JSON structure). */ + content: unknown; +} +interface ToolErrorChunk { + type: "tool_error"; + content: { + /** A summary error message. */ + error_message: string; + /** Optional additional details about the error. */ + details?: string | unknown; + }; +} +interface ContextAddItemChunk { + type: "context_add_item"; + /** The full context item that was added. */ + item: ContextItem; +} +interface TitleUpdateChunk { + type: "title_update"; + /** The new suggested title for the conversation. */ + title: string; +} +interface ArtifactStartChunk { + type: "artifact_start"; + artifactId: string; + artifactType: string; + title: string; +} +interface ArtifactContentDeltaChunk { + type: "artifact_content_delta"; + artifactId: string; + /** The chunk of artifact text content. */ + content: string; +} +interface ArtifactContentChunk { + type: "artifact_content"; + artifactId: string; + /** The complete artifact text content. */ + content: string; +} +interface ArtifactDataChunk { + type: "artifact_data"; + artifactId: string; + /** The complete JSON data for the artifact. */ + data: unknown; +} +interface ArtifactUrlChunk { + type: "artifact_url"; + artifactId: string; + /** The URL pointing to the artifact content. */ + url: string; +} +interface ArtifactEndChunk { + type: "artifact_end"; + artifactId: string; +} +interface ConversationCreatedChunk { + type: "conversation_created"; + /** The ID of the newly created conversation. */ + conversationId: string; +} +/** + * A discriminated union of all possible chunk types streamed from the backend. + */ +type StreamChunk = MarkdownDeltaChunk | InfoChunk | ErrorChunk | ToolStartChunk | ToolInputChunk | ToolOutputChunk | ToolErrorChunk | ContextAddItemChunk | TitleUpdateChunk | ArtifactStartChunk | ArtifactContentDeltaChunk | ArtifactContentChunk | ArtifactDataChunk | ArtifactUrlChunk | ArtifactEndChunk | ConversationCreatedChunk; + +/** + * Interface for a command that configures a WebSocket stream connection. + * @template Config - The type of the configuration data needed to initiate the stream. + * @template SendPayload - The type of data that can be sent *to* the stream after connection. + */ +interface WebSocketCommand { + /** + * Gets the configuration data needed to establish the connection. + */ + getConfig(): Config; + /** + * Gets the base WebSocket URL (e.g., wss://server.api.flowcore.io). + * @returns The base WebSocket URL string. + */ + getWebSocketBaseUrl(): string; + /** + * Gets the specific path segment for the WebSocket URL based on the config + * (e.g., /api/v1/stream/entity/{id}). + * @param config - The configuration object. + * @returns The path segment string. + */ + getWebSocketPathSegment(config: Config): string; + /** + * Serializes the payload to be sent over the WebSocket. + * Default implementation might be JSON.stringify. + * @param payload - The payload object to send. + * @returns The serialized string representation. + */ + serializeSendPayload?(payload: SendPayload): string; +} +/** + * Interface representing an active WebSocket stream connection. + * @template SendPayload - The type of data that can be sent to the stream. + */ +interface ActiveStreamInterface { + /** + * An Observable emitting the raw data chunks received from the WebSocket. + * Consumers should filter/map this observable based on the specific stream protocol. + */ + output$: Observable; + /** + * Sends a payload to the WebSocket stream. + * @param payload - The data to send, conforming to the SendPayload type. + * @returns True if the message was queued to be sent, false otherwise (e.g., socket not open). + */ + send(payload: SendPayload): boolean; + /** + * Disconnects the WebSocket stream gracefully. + */ + disconnect(): void; +} + +/** + * Configuration for the Conversation Stream. + * Only requires the conversationId. + */ +interface ConversationStreamConfig { + conversationId?: string; +} +/** + * Payload type for messages sent *to* the Conversation Stream. + */ +interface ConversationStreamSendPayload { + content: string; +} +/** + * Command to stream conversation events for a specific agent. + */ +declare class ConversationStreamCommand implements WebSocketCommand { + private config; + constructor(config: ConversationStreamConfig); + /** Get the configuration object for the command. */ + getConfig(): ConversationStreamConfig; + /** Get the base WebSocket URL. */ + getWebSocketBaseUrl(): string; + /** Get the WebSocket path segment. */ + getWebSocketPathSegment(): string; + /** Serializer function for outgoing payloads. */ + serializeSendPayload(payload: ConversationStreamSendPayload): string; +} + +/** + * The input for the tenant disable sensitive data command + */ +interface TenantDisableSensitiveDataInput { + /** The id of the tenant */ + tenantId: string; +} +interface TenantDisableSensitiveDataResponse { + sensitiveDataEnabled: boolean; +} +/** + * Disable Sensitive Data Feature for a tenant + */ +declare class TenantDisableSensitiveDataCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): TenantDisableSensitiveDataResponse; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The input for the tenant enable sensitive data command + */ +interface TenantEnableSensitiveDataInput { + /** The id of the tenant */ + tenantId: string; +} +interface TenantEnableSensitiveDataResponse { + sensitiveDataEnabled: boolean; +} +/** + * Enable Sensitive Data Feature for a tenant + */ +declare class TenantEnableSensitiveDataCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): TenantEnableSensitiveDataResponse; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The schema for a tenant + */ +declare const TenantSchema: TObject<{ + id: TString; + name: TString; + displayName: TString; + description: TString; + websiteUrl: TString; + isDedicated: TBoolean; + dedicated: TUnion<[ + TNull, + TObject<{ + status: TUnion<[ + TLiteral<"ready">, + TLiteral<"degraded">, + TLiteral<"offline"> + ]>; + configuration: TObject<{ + domain: TString; + configurationRepoUrl: TString; + configurationRepoCredentials: TUnion<[TString, TNull]>; + }>; + }> + ]>; + sensitiveDataEnabled: TOptional; +}>; +/** + * The type for a tenant + */ +type Tenant = Static; +/** + * The schema for a tenant list item + */ +declare const TenantListItemSchema: TObject<{ + id: TString; + name: TString; + displayName: TString; + description: TString; + websiteUrl: TString; + isDedicated: TBoolean; + sensitiveDataEnabled: TBoolean; + domain: TUnion<[TString, TNull]>; + permissions: TArray; +}>; +/** + * The type for a tenant list item + */ +type TenantListItem = Static; +/** + * The schema for a tenant user. + */ +declare const TenantUserSchema: TObject<{ + id: TString; + username: TString; + email: TString; + firstName: TUnion<[TString, TNull]>; + lastName: TUnion<[TString, TNull]>; +}>; +/** + * The type for a tenant user + */ +type TenantUser = Static; +/** + * The schema for a public tenant preview + */ +declare const TenantPreviewSchema: TObject; +/** + * The type for a public tenant preview + */ +type TenantPreview = Static; +/** + * The schema for a tenant instance + */ +declare const TenantInstanceSchema: TObject<{ + isDedicated: TBoolean; + instance: TUnion<[ + TNull, + TObject<{ + status: TString; + domain: TString; + }> + ]>; +}>; +/** + * The type for a tenant instance + */ +type TenantInstance = Static; + +/** + * The input for the tenant create command + */ +interface TenantCreateInput { + /** The tenant slug (already normalized, lowercase, URL-safe) */ + tenantSlug: string; + /** The description of the tenant */ + description?: string; + /** The display name of the tenant */ + displayName?: string; +} +/** + * Create a tenant + */ +declare class TenantCreateCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body for the request + */ + protected getBody(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Tenant; +} + +/** + * The input for the tenant fetch by id command + */ +interface TenantFetchByIdInput { + /** The id of the tenant */ + tenantId: string; + /** The name of the tenant */ + tenant?: never; +} +/** + * The input for the tenant fetch by name command + */ +interface TenantFetchByNameInput { + /** The name of the tenant */ + tenant: string; + /** The id of the tenant */ + tenantId?: never; +} +/** + * The input for the tenant fetch command + */ +type TenantFetchInput = TenantFetchByIdInput | TenantFetchByNameInput; +/** + * Fetch a tenant + */ +declare class TenantFetchCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Tenant; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The input for the tenant instance fetch by id command + */ +interface TenantInstanceFetchByIdInput { + /** The id of the tenant */ + tenantId: string; + /** The name of the tenant */ + tenant?: never; +} +/** + * The input for the tenant instance fetch by name command + */ +interface TenantInstanceFetchByNameInput { + /** The name of the tenant */ + tenant: string; + /** The id of the tenant */ + tenantId?: never; +} +/** + * The input for the tenant instance fetch command + */ +type TenantInstanceFetchInput = TenantInstanceFetchByIdInput | TenantInstanceFetchByNameInput; +/** + * Fetch a tenant instance + */ +declare class TenantInstanceFetchCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): TenantInstance; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The input for the tenant list command + */ +interface TenantListInput { + /** Page number (1-based) */ + page?: number; + /** Number of tenants per page */ + limit?: number; + /** Tenant ids to pin to the front of the list (comma-separated string or array) */ + ids?: string | string[]; +} +/** + * List tenants + */ +declare class TenantListCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): TenantListItem[]; +} + +/** + * The input for the tenant update command + */ +interface TenantUpdateInput { + /** The id of the tenant to update */ + tenantId: string; + /** The description of the tenant */ + description?: string; + /** The display name of the tenant */ + displayName?: string; + /** The website URL of the tenant */ + website?: string; +} +/** + * Update a tenant + */ +declare class TenantUpdateCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body for the request + */ + protected getBody(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Tenant; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The input for the tenant user add command + */ +interface TenantUserAddInput { + tenantId: string; + userId: string; +} +/** + * Add a user to a tenant + */ +declare class TenantUserAddCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): boolean; +} + +/** + * The input for the tenant user remove command + */ +interface TenantUserRemoveInput { + tenantId: string; + userId: string; +} +/** + * Remove a user from a tenant + */ +declare class TenantUserRemoveCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): boolean; +} + +/** + * Abstract command for executing custom requests + */ +declare abstract class CustomCommand extends Command { + /** + * Get the base URL for the request + */ + protected getBaseUrl(): string; + /** + * Custom execute method + */ + protected abstract customExecute(client: FlowcoreClient): Promise; + /** + * Get the request object + */ + getRequest(client: FlowcoreClient, direct?: boolean): Promise<{ + allowedModes: ("apiKey" | "bearer")[]; + body: string | Record | Array | undefined; + headers: Record; + baseUrl: string; + path: string; + method: string; + parseResponse: (response: unknown) => Output | Promise; + processResponse: (client: FlowcoreClient, response: Output) => Promise; + handleClientError: (error: ClientError) => void; + retryOnFailure: boolean; + customExecute: (client: FlowcoreClient) => Promise; + }>; + /** + * Parse the response + */ + protected parseResponse(response: unknown): Output; +} + +/** + * The input for the tenant users command + */ +interface TenantUserListInput { + /** the tenant id */ + tenantId: string; +} +/** + * The output for the tenant user list command + */ +interface TenantUserListOutput extends TenantUser { + managedRoles: string[]; +} +/** + * List tenants users + */ +declare class TenantUserListCommand extends CustomCommand { + /** + * Custom execute method + */ + protected customExecute(client: FlowcoreClient): Promise; +} + +/** + * The input for the tenant translate name to id command + */ +interface TenantTranslateNameToIdInput { + /** The name of the tenant */ + tenant: string; +} +/** + * The schema for the tenant translate name to id command + */ +declare const TenantTranslateNameToIdSchema: TObject<{ + id: TString; + name: TString; +}>; +type TenantTranslateNameToId = Static; +/** + * Translate a tenant name to an tenant id + */ +declare class TenantTranslateNameToIdCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): TenantTranslateNameToId; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The input for the tenant preview command + */ +interface TenantPreviewInput { + /** The name of the tenant to preview */ + name: string; +} +/** + * Retrieve a public tenant preview + */ +declare class TenantPreviewCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): TenantPreview; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The schema for an api key + */ +declare const ApiKeySchema: TObject<{ + id: TString; + tenantId: TString; + name: TString; + description: TString; + maskedApiKey: TString; + createdAt: TString; + lastUsedAt: TUnion<[TString, TNull]>; +}>; +/** + * The type for an api key + */ +type ApiKey = Static; +/** + * The schema for an api key with value + */ +declare const ApiKeyWithValueSchema: TObject<{ + id: TString; + tenantId: TString; + name: TString; + description: TString; + maskedApiKey: TString; + createdAt: TString; + lastUsedAt: TUnion<[TString, TNull]>; + apiKey: TString; +}>; +/** + * The type for an api key with value + */ +type ApiKeyWithValue = Static; +/** + * The schema for an api key validation response + */ +declare const ApiKeyValidationSchema: TObject<{ + valid: TBoolean; + apiKeyId: TOptional; + tenantId: TOptional; +}>; +/** + * The type for an api key validation response + */ +type ApiKeyValidation = Static; + +/** + * The input for the api key create command + */ +interface ApiKeyCreateInput { + /** The tenant id */ + tenantId: string; + /** The name of the api key */ + name: string; + /** The description of the api key */ + description?: string; +} +/** + * Create an api key + */ +declare class ApiKeyCreateCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * The allowed modes for the command. Api-key mode requires tenant-store >= + * the release that accepts AuthType.ApiKey on the api-key management routes; + * authorization is still gated by IAM grants on frn:::tenant. + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ApiKeyWithValue; +} + +/** + * The input for the api key fetch command + */ +interface ApiKeyFetchInput { + /** The api key id */ + apiKeyId: string; +} +/** + * Fetch an api key + */ +declare class ApiKeyFetchCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * The allowed modes for the command. Api-key mode requires tenant-store >= + * the release that accepts AuthType.ApiKey on the api-key management routes; + * authorization is still gated by IAM grants on frn:::tenant. + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ApiKey; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The input for the api key edit command + */ +interface ApiKeyEditInput { + /** The api key id */ + apiKeyId: string; + /** The description of the api key */ + description: string; +} +/** + * Edit an api key + */ +declare class ApiKeyEditCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * The allowed modes for the command. Api-key mode requires tenant-store >= + * the release that accepts AuthType.ApiKey on the api-key management routes; + * authorization is still gated by IAM grants on frn:::tenant. + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ApiKey; +} + +/** + * The input for the api key delete command + */ +interface ApiKeyDeleteInput { + /** The api key id */ + apiKeyId: string; +} +/** + * Delete an api key + */ +declare class ApiKeyDeleteCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * The allowed modes for the command. Api-key mode requires tenant-store >= + * the release that accepts AuthType.ApiKey on the api-key management routes; + * authorization is still gated by IAM grants on frn:::tenant. + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Parse the response + */ + protected parseResponse(_rawResponse: unknown): boolean; +} + +/** + * The input for the api key list command + */ +interface ApiKeyListInput { + /** The tenant id */ + tenantId: string; +} +/** + * List api keys + */ +declare class ApiKeyListCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * The allowed modes for the command. Api-key mode requires tenant-store >= + * the release that accepts AuthType.ApiKey on the api-key management routes; + * authorization is still gated by IAM grants on frn:::tenant. + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ApiKey[]; +} + +/** + * The input for the api key validate command + */ +interface ApiKeyValidateInput { + /** The api key to validate */ + apiKey: string; +} +/** + * Validate an api key + */ +declare class ApiKeyValidateCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ApiKeyValidation; +} + +/** + * The input for the api key validate with tenant id command + */ +interface ApiKeyValidateWithTenantIdInput { + /** The api key to validate */ + apiKey: string; + /** The tenant id */ + tenantId: string; +} +/** + * Validate an api key with tenant id + */ +declare class ApiKeyValidateWithTenantIdCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ApiKeyValidation; +} + +/** + * The schema for AWS Marketplace dedicated cluster types. + */ +declare const AwsMarketplaceDedicatedClusterTypeSchema: TUnion<[TLiteral<"managed">, TLiteral<"self-hosted">]>; +/** + * The type for AWS Marketplace dedicated cluster types. + */ +type AwsMarketplaceDedicatedClusterType = Static; +/** + * The schema for AWS Marketplace product properties. + */ +declare const AwsMarketplaceProductPropertiesSchema: TRecord>; +/** + * The type for AWS Marketplace product properties. + */ +type AwsMarketplaceProductProperties = Static; +/** + * The schema for AWS Marketplace customer product modes. + */ +declare const AwsMarketplaceProductModeSchema: TUnion<[TLiteral<"basic">, TLiteral<"dedicated">]>; +/** + * The type for AWS Marketplace customer product modes. + */ +type AwsMarketplaceProductMode = Static; +/** + * The schema for an AWS Marketplace customer. + */ +declare const AwsMarketplaceCustomerSchema: TObject<{ + customerId: TString; + productCode: TString; + accountId: TString; + metadata: TString; + productMode: typeof AwsMarketplaceProductModeSchema; +}>; +/** + * The type for an AWS Marketplace customer. + */ +type AwsMarketplaceCustomer = Static; +/** + * The schema for an AWS Marketplace link. + */ +declare const AwsMarketplaceLinkSchema: TObject<{ + linkingId: TString; + awsCustomerId: TString; + awsProductCode: TString; + awsAccountId: TString; + tenant: TUnion<[TString, TNull]>; + tenantId: TString; + contactInfo: TUnion<[TString, TNull]>; + productProperties: TUnion<[TRecord, TNull]>; + linkedAt: TString; +}>; +/** + * The type for an AWS Marketplace link. + */ +type AwsMarketplaceLink = Static; +/** + * The schema for the AWS Marketplace customer resolve response. + */ +declare const AwsMarketplaceCustomerResolveSchema: TObject<{ + success: TBoolean; + customer: typeof AwsMarketplaceCustomerSchema; +}>; +/** + * The type for the AWS Marketplace customer resolve response. + */ +type AwsMarketplaceCustomerResolve = Static; +/** + * The schema for the AWS Marketplace link create response. + */ +declare const AwsMarketplaceLinkCreateSchema: TObject<{ + success: TBoolean; + linkingId: TString; + status: TLiteral<"linked">; +}>; +/** + * The type for the AWS Marketplace link create response. + */ +type AwsMarketplaceLinkCreate = Static; +/** + * The schema for the AWS Marketplace link list response. + */ +declare const AwsMarketplaceLinkListSchema: TObject<{ + success: TBoolean; + links: TArray; +}>; +/** + * The type for the AWS Marketplace link list response. + */ +type AwsMarketplaceLinkList = Static; +/** + * The schema for the AWS Marketplace link fetch response. + */ +declare const AwsMarketplaceLinkFetchSchema: TObject<{ + success: TBoolean; + link: typeof AwsMarketplaceLinkSchema; +}>; +/** + * The type for the AWS Marketplace link fetch response. + */ +type AwsMarketplaceLinkFetch = Static; +/** + * The schema for the AWS Marketplace link delete response. + */ +declare const AwsMarketplaceLinkDeleteSchema: TObject<{ + success: TBoolean; + linkingId: TString; + status: TLiteral<"unlinked">; +}>; +/** + * The type for the AWS Marketplace link delete response. + */ +type AwsMarketplaceLinkDelete = Static; + +/** + * The input for the AWS Marketplace customer resolve command. + */ +interface AwsMarketplaceCustomerResolveInput { + /** The AWS Marketplace registration token */ + registrationToken: string; +} +/** + * Resolve an AWS Marketplace registration token. + */ +declare class AwsMarketplaceCustomerResolveCommand extends Command { + /** + * Whether the command should retry on failure. + */ + protected retryOnFailure: boolean; + /** + * Get the method. + */ + protected getMethod(): string; + /** + * Get the base url. + */ + protected getBaseUrl(): string; + /** + * Get the path. + */ + protected getPath(): string; + /** + * Parse the response. + */ + protected parseResponse(rawResponse: unknown): AwsMarketplaceCustomerResolve; +} + +/** + * The input for the AWS Marketplace link create command. + */ +interface AwsMarketplaceLinkCreateInput { + /** The AWS Marketplace registration token */ + registrationToken: string; + /** The tenant slug */ + tenant: string; + /** The tenant id */ + tenantId: string; + /** Product-specific properties */ + productProperties?: AwsMarketplaceProductProperties & { + /** The dedicated cluster type for dedicated products */ + dedicatedClusterType?: AwsMarketplaceDedicatedClusterType; + }; + /** Optional license key */ + licenseKey?: string; +} +/** + * Create an AWS Marketplace link for a tenant. + */ +declare class AwsMarketplaceLinkCreateCommand extends Command { + /** + * Whether the command should retry on failure. + */ + protected retryOnFailure: boolean; + /** + * The allowed modes for the command. + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Get the method. + */ + protected getMethod(): string; + /** + * Get the base url. + */ + protected getBaseUrl(): string; + /** + * Get the path. + */ + protected getPath(): string; + /** + * Parse the response. + */ + protected parseResponse(rawResponse: unknown): AwsMarketplaceLinkCreate; +} + +/** + * The input for the AWS Marketplace link delete command. + */ +interface AwsMarketplaceLinkDeleteInput { + /** The AWS Marketplace linking id */ + linkingId: string; + /** Optional unlink reason */ + reason?: string; +} +/** + * Delete an AWS Marketplace link. + */ +declare class AwsMarketplaceLinkDeleteCommand extends Command { + /** + * Whether the command should retry on failure. + */ + protected retryOnFailure: boolean; + /** + * The allowed modes for the command. + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Get the method. + */ + protected getMethod(): string; + /** + * Get the base url. + */ + protected getBaseUrl(): string; + /** + * Get the path. + */ + protected getPath(): string; + /** + * Get the body. + */ + protected getBody(): undefined; + /** + * Parse the response. + */ + protected parseResponse(rawResponse: unknown): AwsMarketplaceLinkDelete; +} + +/** + * The input for the AWS Marketplace link fetch command. + */ +interface AwsMarketplaceLinkFetchInput { + /** The AWS Marketplace linking id */ + linkingId: string; +} +/** + * Fetch an AWS Marketplace link. + */ +declare class AwsMarketplaceLinkFetchCommand extends Command { + /** + * Whether the command should retry on failure. + */ + protected retryOnFailure: boolean; + /** + * The allowed modes for the command. + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Get the method. + */ + protected getMethod(): string; + /** + * Get the base url. + */ + protected getBaseUrl(): string; + /** + * Get the path. + */ + protected getPath(): string; + /** + * Parse the response. + */ + protected parseResponse(rawResponse: unknown): AwsMarketplaceLinkFetch; +} + +/** + * The input for the AWS Marketplace link list command. + */ +interface AwsMarketplaceLinkListInput { + /** The tenant slug */ + tenant?: string; + /** The tenant id */ + tenantId?: string; + /** The AWS Marketplace customer id */ + awsCustomerId?: string; + /** The AWS Marketplace product code */ + awsProductCode?: string; +} +/** + * List AWS Marketplace links. + */ +declare class AwsMarketplaceLinkListCommand extends Command { + /** + * Whether the command should retry on failure. + */ + protected retryOnFailure: boolean; + /** + * The allowed modes for the command. + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Get the method. + */ + protected getMethod(): string; + /** + * Get the base url. + */ + protected getBaseUrl(): string; + /** + * Get the path. + */ + protected getPath(): string; + /** + * Parse the response. + */ + protected parseResponse(rawResponse: unknown): AwsMarketplaceLinkList; +} + +/** + * The schema for a secret + */ +declare const SecretSchema: TObject<{ + tenantId: TString; + key: TString; + description: TString; + createdAt: TString; + updatedAt: TUnion<[TString, TNull]>; +}>; +/** + * The type for a secret + */ +type Secret = Static; + +/** + * The input for the secret create command + */ +interface SecretCreateInput { + /** The tenant id */ + tenantId: string; + /** The key of the secret */ + key: string; + /** The value of the secret */ + value: string; + /** The description of the secret */ + description?: string; +} +/** + * Create a secret + */ +declare class SecretCreateCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * The allowed modes for the command + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Secret; +} + +/** + * The input for the secret delete command + */ +interface SecretDeleteInput { + /** The tenant id */ + tenantId: string; + /** The key of the secret */ + key: string; +} +/** + * Delete a secret + */ +declare class SecretDeleteCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * The allowed modes for the command + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Parse the response + */ + protected parseResponse(_rawResponse: unknown): boolean; +} + +/** + * The input for the secret edit command + */ +interface SecretEditInput { + /** The tenant id */ + tenantId: string; + /** The key of the secret */ + key: string; + /** The value of the secret */ + value?: string; + /** The description of the secret */ + description?: string; +} +/** + * Edit a secret + */ +declare class SecretEditCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * The allowed modes for the command + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Secret; +} + +/** + * The input for the secret fetch command + */ +interface SecretFetchInput { + /** The tenant id */ + tenantId: string; + /** The secret key */ + key: string; +} +/** + * Fetch a secret + */ +declare class SecretFetchCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * The allowed modes for the command + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Secret; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The input for the secret list command + */ +interface SecretListInput { + /** The tenant id */ + tenantId: string; +} +/** + * List secrets + */ +declare class SecretListCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * The allowed modes for the command + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Secret[]; +} + +/** + * The schema for a service account + */ +declare const ServiceAccountSchema: TObject<{ + id: TString; + tenantId: TString; + name: TString; + description: TString; + linkedUserId: TString; + clientId: TString; + isAdmin: TBoolean; + enabled: TBoolean; + createdAt: TString; + updatedAt: TUnion<[TString, TNull]>; + lastRotatedAt: TUnion<[TString, TNull]>; +}>; +/** + * The type for a service account + */ +type ServiceAccount = Static; +/** + * The schema for a service account response with client secret + */ +declare const ServiceAccountWithSecretSchema: TObject<{ + id: TString; + tenantId: TString; + name: TString; + description: TString; + linkedUserId: TString; + clientId: TString; + isAdmin: TBoolean; + enabled: TBoolean; + createdAt: TString; + updatedAt: TUnion<[TString, TNull]>; + lastRotatedAt: TUnion<[TString, TNull]>; + clientSecret: TString; +}>; +/** + * The type for a service account response with client secret + */ +type ServiceAccountWithSecret = Static; +/** + * The schema for a rotated service account secret response + */ +declare const ServiceAccountSecretRotationSchema: TObject<{ + id: TString; + clientId: TString; + clientSecret: TString; +}>; +/** + * The type for a rotated service account secret response + */ +type ServiceAccountSecretRotation = Static; + +/** + * The input for the service account create command + */ +interface ServiceAccountCreateInput { + /** The tenant id */ + tenantId: string; + /** The name of the service account */ + name: string; + /** The description of the service account */ + description?: string; + /** Whether the service account should be admin */ + isAdmin?: boolean; +} +/** + * Create a service account + */ +declare class ServiceAccountCreateCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * The allowed modes for the command + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ServiceAccountWithSecret; +} + +/** + * The input for the service account delete command + */ +interface ServiceAccountDeleteInput { + /** The service account id */ + serviceAccountId: string; +} +/** + * Delete a service account + */ +declare class ServiceAccountDeleteCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body + */ + protected getBody(): undefined; + /** + * The allowed modes for the command + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Parse the response + */ + protected parseResponse(): boolean; +} + +/** + * The input for the service account edit command + */ +interface ServiceAccountEditInput { + /** The service account id */ + serviceAccountId: string; + /** The description of the service account */ + description?: string; + /** Whether the service account is enabled */ + enabled?: boolean; +} +/** + * Edit a service account + */ +declare class ServiceAccountEditCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body + */ + protected getBody(): Record; + /** + * The allowed modes for the command + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ServiceAccount; +} + +/** + * The input for the service account fetch command + */ +interface ServiceAccountFetchInput { + /** The service account id */ + serviceAccountId: string; +} +/** + * Fetch a service account + */ +declare class ServiceAccountFetchCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * The allowed modes for the command + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ServiceAccount; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The input for the service account list command + */ +interface ServiceAccountListInput { + /** The tenant id */ + tenantId: string; +} +/** + * List service accounts + */ +declare class ServiceAccountListCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * The allowed modes for the command + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ServiceAccount[]; +} + +/** + * The input for the service account rotate secret command + */ +interface ServiceAccountRotateSecretInput { + /** The service account id */ + serviceAccountId: string; +} +/** + * Rotate a service account secret + */ +declare class ServiceAccountRotateSecretCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body + */ + protected getBody(): undefined; + /** + * The allowed modes for the command + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ServiceAccountSecretRotation; +} + +/** + * The schema for a variable + */ +declare const VariableSchema: TObject<{ + tenantId: TString; + key: TString; + description: TString; + value: TString; + createdAt: TString; + updatedAt: TUnion<[TString, TNull]>; +}>; +/** + * The type for a variable + */ +type Variable = Static; + +/** + * The input for the variable create command + */ +interface VariableCreateInput { + /** The tenant id */ + tenantId: string; + /** The key of the variable */ + key: string; + /** The value of the variable */ + value: string; + /** The description of the variable */ + description?: string; +} +/** + * Create a variable + */ +declare class VariableCreateCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * The allowed modes for the command + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Variable; +} + +/** + * The input for the variable delete command + */ +interface VariableDeleteInput { + /** The tenant id */ + tenantId: string; + /** The key of the variable */ + key: string; +} +/** + * Delete a variable + */ +declare class VariableDeleteCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * The allowed modes for the command + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Parse the response + */ + protected parseResponse(): boolean; +} + +/** + * The input for the variable edit command + */ +interface VariableEditInput { + /** The tenant id */ + tenantId: string; + /** The key of the variable */ + key: string; + /** The value of the variable */ + value?: string; + /** The description of the variable */ + description?: string; +} +/** + * Edit a variable + */ +declare class VariableEditCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * The allowed modes for the command + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Variable; +} + +/** + * The input for the variable fetch command + */ +interface VariableFetchInput { + /** The tenant id */ + tenantId: string; + /** The variable key */ + key: string; +} +/** + * Fetch a variable + */ +declare class VariableFetchCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * The allowed modes for the command + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Variable; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The input for the variable list command + */ +interface VariableListInput { + /** The tenant id */ + tenantId: string; +} +/** + * List variables + */ +declare class VariableListCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * The allowed modes for the command + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Variable[]; +} + +/** + * The schema for a data core + */ +declare const DataCoreSchema: TObject<{ + id: TString; + tenantId: TString; + tenant: TString; + name: TString; + description: TString; + accessControl: TUnion<[TLiteral<"public">, TLiteral<"private">]>; + deleteProtection: TBoolean; + isDeleting: TBoolean; + isFlowcoreManaged: TBoolean; +}>; +/** + * The schema for a data core with access + */ +declare const DataCoreWithAccessSchema: TObject<{ + id: TString; + tenantId: TString; + tenant: TString; + name: TString; + description: TString; + accessControl: TUnion<[TLiteral<"public">, TLiteral<"private">]>; + deleteProtection: TBoolean; + isDeleting: TBoolean; + isFlowcoreManaged: TBoolean; + access: TArray, TLiteral<"write">, TLiteral<"fetch">, TLiteral<"ingest">]>>; +}>; +/** + * The type for a data core + */ +type DataCore = Static; +/** + * The type for a data core with access + */ +type DataCoreWithAccess = Static; + +/** + * The input for the data core create command + */ +interface DataCoreCreateInput { + /** The tenant id */ + tenantId: string; + /** The name of the data core */ + name: string; + /** The description of the data core */ + description: string; + /** The access control of the data core */ + accessControl: "public" | "private"; + /** Whether the data core is delete protected */ + deleteProtection: boolean; + /** Whether the data core is managed by Flowcore */ + isFlowcoreManaged?: boolean; +} +/** + * Create a data core + */ +declare class DataCoreCreateCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): DataCore; +} + +/** + * The input for the data core fetch by id command + */ +interface DataCoreExistsInput { + /** The id of the data core */ + dataCoreId: string; +} +/** + * The output for the data core exists command + */ +interface DataCoreExistsOutput { + /** Whether the data core exists */ + exists: boolean; +} +/** + * Fetch a data core + */ +declare class DataCoreExistsCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): DataCoreExistsOutput; +} + +/** + * The input for the data core fetch by id command + */ +interface DataCoreFetchByIdInput { + /** The id of the data core */ + dataCoreId: string; + /** The tenant id */ + tenantId?: never; + /** The tenant */ + tenant?: never; + /** The name of the data core */ + dataCore?: never; +} +/** + * The input for the data core fetch by name and tenant id command + */ +interface DataCoreFetchByNameAndTenantIdInput { + /** The tenant id */ + tenantId: string; + /** The tenant */ + tenant?: never; + /** The name of the data core */ + dataCore: string; + /** The id of the data core */ + dataCoreId?: never; +} +/** + * The input for the data core fetch by name and tenant command + */ +interface DataCoreFetchByNameAndTenantInput { + /** The tenant id */ + tenantId?: never; + /** The tenant */ + tenant: string; + /** The name of the data core */ + dataCore: string; + /** The id of the data core */ + dataCoreId?: never; +} +/** + * The input for the data core fetch command + */ +type DataCoreFetchInput = DataCoreFetchByIdInput | DataCoreFetchByNameAndTenantIdInput | DataCoreFetchByNameAndTenantInput; +/** + * Fetch a data core + */ +declare class DataCoreFetchCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): DataCore; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The input for the data core list command + */ +interface DataCoreListInput { + /** The tenant id */ + tenantId?: string; + /** The tenant name */ + tenant?: string; + /** The data core name */ + name?: string; + /** Page number (1-based). Used with limit. Defaults to 1 when limit is provided. */ + page?: number; + /** Maximum number of data cores to return (max 100). Omit to return all data cores. */ + limit?: number; + /** Data core ids to pin to the front of the list (comma-separated string or array) */ + ids?: string | string[]; +} +/** + * Fetch all data cores for a tenant + */ +declare class DataCoreListCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): DataCoreWithAccess[]; +} + +/** + * The input for the data core request delete command + */ +interface DataCoreRequestDeleteInput { + /** The tenant */ + tenant: string; + /** The id of the data core */ + dataCoreId: string; + /** Wait for the data core to be deleted (default: false) */ + waitForDelete?: boolean; +} +/** + * The output for the data core request delete command + */ +interface DataCoreRequestDeleteOutput { + /** The success of the data core delete request */ + success: boolean; +} +/** + * Request to delete a data core + */ +declare class DataCoreRequestDeleteCommand extends Command { + /** + * The dedicated subdomain for the command + */ + protected dedicatedSubdomain: string; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): DataCoreRequestDeleteOutput; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; + /** + * Wait for the response (timeout: 25 seconds) + */ + protected processResponse(client: FlowcoreClient, response: DataCoreRequestDeleteOutput): Promise; +} + +/** + * The input for the data core update command + */ +interface DataCoreUpdateInput { + /** The id of the data core */ + dataCoreId: string; + /** The description of the data core */ + description?: string; + /** The access control of the data core */ + accessControl?: "public" | "private"; + /** Whether the data core is delete protected */ + deleteProtection?: boolean; +} +/** + * Update a data core + */ +declare class DataCoreUpdateCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body for the request + */ + protected getBody(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): DataCore; +} + +/** + * The schema for a flow type + */ +declare const FlowTypeSchema: TObject<{ + id: TString; + tenantId: TString; + dataCoreId: TString; + name: TString; + description: TString; + isDeleting: TBoolean; +}>; +/** + * The type for a flow type + */ +type FlowType = Static; + +/** + * The input for the data core create command + */ +interface FlowTypeCreateInput { + /** The id of the data core */ + dataCoreId: string; + /** The name of the flow type */ + name: string; + /** The description of the flow type */ + description: string; +} +/** + * Create a flow type + */ +declare class FlowTypeCreateCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): FlowType; +} + +/** + * The input for the flow type fetch by name command + */ +interface FlowTypeExistsInput { + /** The id of the flow type */ + flowTypeId: string; + /** Wait for the flow type to be deleted */ + waitForDelete?: boolean; +} +/** + * The output for the flow type exists command + */ +interface FlowTypeExistsOutput { + /** Whether the flow type exists */ + exists: boolean; +} +/** + * Fetch a flow type + */ +declare class FlowTypeExistsCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): FlowTypeExistsOutput; +} + +/** + * The input for the flow type fetch by name command + */ +interface FlowTypeFetchByNameInput { + /** The id of the data core */ + dataCoreId: string; + /** The name of the flow type */ + flowType: string; + /** The id of the flow type */ + flowTypeId?: never; +} +/** + * The input for the flow type fetch by id command + */ +interface FlowTypeFetchByIdInput { + /** The id of the flow type */ + flowTypeId: string; + /** The id of the data core */ + dataCoreId?: never; + /** The name of the flow type */ + flowType?: never; +} +/** + * The input for the flow type fetch command + */ +type FlowTypeFetchInput = FlowTypeFetchByIdInput | FlowTypeFetchByNameInput; +/** + * Fetch a flow type + */ +declare class FlowTypeFetchCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): FlowType; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The input for the flow type list command + */ +interface FlowTypeListInput { + /** the data core id */ + dataCoreId: string; +} +/** + * Fetch all flow types for a data core + */ +declare class FlowTypeListCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): FlowType[]; +} + +/** + * The input for the flow type request delete command + */ +interface FlowTypeRequestDeleteInput { + /** The tenant */ + tenant: string; + /** The id of the flow type */ + flowTypeId: string; + /** Wait for the flow type to be deleted (default: false) */ + waitForDelete?: boolean; +} +/** + * The output for the flow type request delete command + */ +interface FlowTypeRequestDeleteOutput { + success: boolean; +} +/** + * Request to delete a flow type + */ +declare class FlowTypeRequestDeleteCommand extends Command { + /** + * The dedicated subdomain for the command + */ + protected dedicatedSubdomain: string; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): FlowTypeRequestDeleteOutput; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; + /** + * Wait for the response (timeout: 25 seconds) + */ + protected processResponse(client: FlowcoreClient, response: FlowTypeRequestDeleteOutput): Promise; +} + +/** + * The input for the flow type update command + */ +interface FlowTypeUpdateInput { + /** The id of the data core */ + flowTypeId: string; + /** The description of the flow type */ + description?: string; +} +/** + * Update a flow type + */ +declare class FlowTypeUpdateCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body for the request + */ + protected getBody(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): FlowType; +} + +type SimpleSensitiveDataType = boolean | "string" | "number" | "boolean"; +type DetailedSensitiveDataField = { + type: "string" | "number" | "boolean" | "object" | "array"; + faker?: string; + args?: unknown[]; + length?: number; + pattern?: string; + redact?: { + char: string; + length: number; + }; + min?: number; + max?: number; + precision?: number; + count?: number; + items?: SimpleSensitiveDataType | DetailedSensitiveDataField | Record; + properties?: Record>; +}; +type SensitiveDataDefinition = SimpleSensitiveDataType | DetailedSensitiveDataField | Record>; +/** + * The schema for a detailed SensitiveData field + */ +declare const DetailedSensitiveDataFieldSchema: TObject<{ + type: TUnion<[TLiteral<"string">, TLiteral<"number">, TLiteral<"boolean">, TLiteral<"object">, TLiteral<"array">]>; + faker: TOptional; + args: TOptional>; + length: TOptional; + pattern: TOptional; + redact: TOptional>; + min: TOptional; + max: TOptional; + precision: TOptional; + count: TOptional; + items: TOptional; + properties: TOptional>; +}>; +/** + * The schema for a SensitiveData definition + */ +declare const SensitiveDataDefinitionSchema: TUnion<[ + TLiteral, + TUnion<[TLiteral<"string">, TLiteral<"number">, TLiteral<"boolean">]>, + typeof DetailedSensitiveDataFieldSchema, + TRecord +]>; +/** + * The schema for an event type SensitiveData mask + */ +declare const EventTypeSensitiveDataMaskSchema: TObject<{ + key: TString; + schema: TRecord; +}>; +/** + * The schema for an event type SensitiveData mask parsed + */ +declare const EventTypeSensitiveDataMaskParsedSchema: TArray, TLiteral<"number">, TLiteral<"boolean">, TLiteral<"object">, TLiteral<"array">]>; + faker: TOptional; + args: TArray; + length: TOptional; + pattern: TOptional; + min: TOptional; + max: TOptional; + precision: TOptional; + count: TOptional; + items: TOptional; + properties: TOptional>; + redact: TOptional>; + }>; +}>>; +/** + * The schema for an event type + */ +declare const EventTypeSchema: TObject<{ + id: TString; + tenantId: TString; + dataCoreId: TString; + flowTypeId: TString; + name: TString; + description: TString; + isTruncating: TBoolean; + isDeleting: TBoolean; + createdAt: TString; + updatedAt: TUnion<[TString, TNull]>; + sensitiveDataMask: TOptional>; + sensitiveDataEnabled: TOptional; +}>; +/** + * The schema for an event type remove sensitive data + */ +declare const EventTypeRemoveSensitiveDataSchema: TObject<{ + success: TBoolean; + id: TString; +}>; +/** + * The schema for an event type list removed sensitive data item + */ +declare const EventTypeListRemovedSensitiveDataItemSchema: TObject<{ + id: TString; + tenantId: TString; + dataCoreId: TString; + flowTypeId: TString; + eventTypeId: TString; + application: TString; + parentKey: TString; + key: TString; + type: TString; + createdAt: TString; +}>; +/** + * The schema for an event type list removed sensitive data response + */ +declare const EventTypeListRemovedSensitiveDataResponseSchema: TObject<{ + data: TArray; + pagination: TObject<{ + page: TNumber; + pageSize: TNumber; + hasNextPage: TBoolean; + hasPreviousPage: TBoolean; + }>; +}>; +/** + * The type for an event type + */ +type EventType = Static; +/** + * Type for SensitiveData mask + */ +type EventTypeSensitiveDataMask = Static; +/** + * Type for parsed SensitiveData mask + */ +type EventTypeSensitiveDataMaskParsed = Static; +/** + * Type for an event type list removed sensitive data response + */ +type EventTypeListRemovedSensitiveDataResponse = Static; +/** + * Type for an event type remove sensitive data + */ +type EventTypeRemoveSensitiveData = Static; + +/** + * The input for the event type create command + */ +interface EventTypeCreateInput { + /** The id of the flow type */ + flowTypeId: string; + /** The name of the event type */ + name: string; + /** The description of the event type */ + description: string; + /** The sensitive data mask of the event type */ + sensitiveDataMask?: { + /** The json path to the key where the entity id for the sensitive data mask is located */ + key: string; + /** Schema defining the fields that should be masked and how they should be masked */ + schema: Record; + }; + /** Whether sensitive data masking is enabled for this event type */ + sensitiveDataEnabled?: boolean; +} +/** + * Create an event type + */ +declare class EventTypeCreateCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): EventType; +} + +/** + * The input for the event type exists command + */ +interface EventTypeExistsInput { + /** The id of the event type */ + eventTypeId: string; +} +/** + * The output for the event type exists command + */ +interface EventTypeExistsOutput { + /** Whether the event type exists */ + exists: boolean; +} +/** + * Check if an event type exists + */ +declare class EventTypeExistsCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): EventTypeExistsOutput; +} + +interface EventTypeFetchByIdInput { + /** The id of the event type */ + eventTypeId: string; + /** The id of the flow type */ + flowTypeId?: never; + /** The name of the event type */ + eventType?: never; +} +interface EventTypeFetchByNameInput { + /** The id of the flow type */ + flowTypeId: string; + /** The name of the event type */ + eventType: string; + /** The id of the event type */ + eventTypeId?: never; +} +/** + * The input for the event type fetch command + */ +type EventTypeFetchInput = EventTypeFetchByIdInput | EventTypeFetchByNameInput; +/** + * Fetch an event type + */ +declare class EventTypeFetchCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): EventType; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The schema for an event + */ +declare const FlowcoreEventSchema: TObject<{ + eventId: TString; + timeBucket: TString; + tenant: TString; + dataCoreId: TString; + flowType: TString; + eventType: TString; + metadata: TRecord; + payload: TRecord; + validTime: TString; +}>; +/** + * The type for an event + */ +type FlowcoreEvent = Static; +/** + * The input for the ingest event command + */ +interface IngestEventInput { + /** the tenant name */ + tenantName: string; + /** the data core id */ + dataCoreId: string; + /** the flow type name */ + flowTypeName: string; + /** the event type name */ + eventTypeName: string; + /** the event data */ + eventData: T; + /** the event id */ + metadata?: Record; + /** ttl (This accepts d, h, m, s. The maximum value is 7 days, this can be increased for higher subscription levels.) */ + ttl?: string; + /** indicate if this event is emphemral (default false) */ + isEphemeral?: boolean; + /** valid time of the event */ + validTime?: string; + /** event time of the event, overrides what time bucket this event is stored in */ + eventTime?: string; + /** flowcore managed event */ + flowcoreManaged?: boolean; +} + +/** + * The input for the events fetch info command + */ +interface EventTypeInfoInput { + /** the tenant */ + tenant: string; + /** the event type id or ids */ + eventTypeId: [string, ...string[]] | string; + /** the limit for the number of last events to fetch (default is 5) */ + limit?: number; + /** include sensitive data */ + includeSensitiveData?: boolean; +} +/** + * The output for the events fetch info command + */ +interface EventTypeInfoOutput { + /** the first time bucket */ + firstTimeBucket?: string; + /** the last time bucket */ + lastTimeBucket?: string; + /** the last events */ + lastEvents: FlowcoreEvent[]; +} +/** + * Fetch information about an event type + * + * contains the first and last time bucket and the last {limit} events + */ +declare class EventTypeInfoCommand extends CustomCommand { + /** + * Custom execute method + */ + protected customExecute(client: FlowcoreClient): Promise; +} + +/** + * The input for the event type list removed sensitive data command + */ +interface EventTypeListRemovedSensitiveDataInput { + /** The id of the tenant */ + tenantId: string; + /** The id of the data core */ + dataCoreId?: string; + /** The id of the flow type */ + flowTypeId?: string; + /** The id of the event type */ + eventTypeId?: string; + /** The identifier of the application that is trying to remove sensitive data (iLike operation) */ + application?: string; + /** The parent key of the event type (iLike operation) */ + parentKey?: string; + /** The page to fetch (minimum: 1, default: 1) */ + page?: number; + /** The page size (minimum: 1, maximum: 5000, default: 20) */ + pageSize?: number; + /** The type of removal */ + type?: string; + /** The sort order */ + sort?: string; + /** Filter by creation date from (format: date-time) */ + createdAtFrom?: string; + /** Filter by creation date to (format: date-time) */ + createdAtTo?: string; +} +/** + * Fetch an event type + */ +declare class EventTypeListRemovedSensitiveDataCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): EventTypeListRemovedSensitiveDataResponse; +} + +/** + * The input for the event type list command + */ +interface EventTypeListInput { + /** The flow type id */ + flowTypeId: string; +} +/** + * Fetch all event types for a flow type + */ +declare class EventTypeListCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): EventType[]; +} + +/** + * The input for the event type list removed sensitive data command + */ +interface EventTypeRemoveSensitiveDataInput { + /** The id of the event type */ + eventTypeId: string; + /** The identifier of the application that is trying to remove sensitive data */ + application: string; + /** The parent key of sensitive data point */ + parentKey: string; + /** The key of sensitive data point */ + key: string; + /** The removal type of sensitive data point */ + type: "remove" | "scramble"; +} +/** + * Fetch an event type + */ +declare class EventTypeRemoveSensitiveDataCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): EventTypeRemoveSensitiveData; +} + +/** + * The input for the event type request delete command + */ +interface EventTypeRequestDeleteInput { + /** The tenant */ + tenant: string; + /** The id of the event type */ + eventTypeId: string; + /** Wait for the event type to be deleted (default: false) */ + waitForDelete?: boolean; +} +/** + * The output for the event type request delete command + */ +interface EventTypeRequestDeleteOutput { + success: boolean; +} +/** + * Request to delete an event type + */ +declare class EventTypeRequestDeleteCommand extends Command { + /** + * The dedicated subdomain for the command + */ + protected dedicatedSubdomain: string; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): EventTypeRequestDeleteOutput; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; + /** + * Wait for the response (timeout: 25 seconds) + */ + protected processResponse(client: FlowcoreClient, response: EventTypeRequestDeleteOutput): Promise; +} + +/** + * The input for the event type request truncate command + */ +interface EventTypeRequestTruncateInput { + /** The tenant */ + tenant: string; + /** The id of the event type */ + eventTypeId: string; + /** Wait for the event type to be truncated (default: false) */ + waitForTruncate?: boolean; +} +/** + * The output for the event type request truncate command + */ +interface EventTypeRequestTruncateOutput { + success: boolean; +} +/** + * Request to truncate an event type + */ +declare class EventTypeRequestTruncateCommand extends Command { + /** + * The dedicated subdomain for the command + */ + protected dedicatedSubdomain: string; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): EventTypeRequestTruncateOutput; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; + /** + * Wait for the response (timeout: 25 seconds) + */ + protected processResponse(client: FlowcoreClient, response: EventTypeRequestTruncateOutput): Promise; +} + +/** + * The input for the event type update command + */ +type EventTypeUpdateInput = { + /** The id of the event type */ + eventTypeId: string; + /** The description of the event type */ + description?: string; + /** The sensitive data mask of the event type */ + sensitiveDataMask?: { + /** The json path to the key where the entity id for the sensitive data mask is located */ + key: string; + /** Schema defining the fields that should be masked and how they should be masked */ + schema: Record; + }; + /** Whether sensitive data masking is enabled for this event type */ + sensitiveDataEnabled?: boolean; +}; +/** + * Update an event type + */ +declare class EventTypeUpdateCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body for the request + */ + protected getBody(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): EventType; +} + +interface IngestBatchInput extends Omit, "eventData"> { + events: IngestEventInput["eventData"][]; +} +/** + * The output for the batch ingestion command + */ +interface IngestBatchOutput { + /** the events */ + eventIds: string[]; + /** success status */ + success: boolean; +} +/** + * Ingest a batch of events + */ +declare class IngestBatchCommand extends Command, IngestBatchOutput> { + /** + * The dedicated subdomain for the command + */ + protected dedicatedSubdomain: string; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + /** + * Get the base url for the request + */ + protected getBaseUrl(): string; + protected getHeaders(): Record; + /** + * Get the path for the request + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): IngestBatchOutput; + /** + * Get the body for the request + */ + protected getBody(): unknown[]; +} + +/** + * The output for the ingest event command + */ +interface IngestEventOutput { + /** the events */ + eventId: string; + /** success status */ + success: boolean; +} +/** + * Ingest an event + */ +declare class IngestEventCommand extends Command, IngestEventOutput> { + /** + * The dedicated subdomain for the command + */ + protected dedicatedSubdomain: string; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + /** + * Get the base url for the request + */ + protected getBaseUrl(): string; + protected getHeaders(): Record; + /** + * Get the path for the request + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): IngestEventOutput; + /** + * Get the body for the request + */ + protected getBody(): Record; +} + +/** + * The input for the events fetch indexes command + */ +interface EventListInput { + /** The tenant */ + tenant: string; + /** the event type id or ids */ + eventTypeId: [string, ...string[]] | string; + /** the time bucket */ + timeBucket: string; + /** the paging cursor */ + cursor?: string; + /** the page size (default is 10.000) */ + pageSize?: number; + /** start from this event id */ + fromEventId?: string; + /** + * after this event id + * + * ⚠️ Not applicable if `fromEventId` is also defined + */ + afterEventId?: string; + /** end at this event id */ + toEventId?: string; + /** + * the order (default is asc) + * + * ⚠️ When using `desc` order, pagination and filters are not possible. + */ + order?: "asc" | "desc"; + /** include sensitive data */ + includeSensitiveData?: boolean; +} +/** + * The output for the events fetch indexes command + */ +interface EventListOutput { + /** the events */ + events: FlowcoreEvent[]; + /** the next page cursor */ + nextCursor?: string; +} +/** + * Fetch time buckets for an event type + */ +declare class EventListCommand extends Command { + /** + * The dedicated subdomain for the command + */ + protected dedicatedSubdomain: string; + /** + * Get the method for the request + */ + protected getMethod(): string; + /** + * Get the base url for the request + */ + protected getBaseUrl(): string; + /** + * Get the path for the request + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): EventListOutput; +} + +/** + * The input for the events fetch indexes command + */ +interface EventsFetchTimeBucketsByNamesInput { + /** the tenant name */ + tenant: string; + /** the data core id */ + dataCoreId: string; + /** the flow type name */ + flowType: string; + /** the event type names */ + eventTypes: string[]; + /** the paging cursor */ + cursor?: number; + /** the page size (default is 10.000) */ + pageSize?: number; + /** start from this time bucket */ + fromTimeBucket?: string; + /** end at this time bucket */ + toTimeBucket?: string; +} +/** + * The output for the events fetch indexes command + */ +interface EventsFetchTimeBucketsByNamesOutput { + /** the time buckets */ + timeBuckets: string[]; + /** the next page cursor */ + nextCursor?: number; +} +/** + * Fetch time buckets for an event type + */ +declare class EventsFetchTimeBucketsByNamesCommand extends Command { + /** + * The dedicated subdomain for the command + */ + protected dedicatedSubdomain: string; + /** + * Get the base url for the request + */ + protected getBaseUrl(): string; + /** + * Get the path for the request + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): EventsFetchTimeBucketsByNamesOutput; + /** + * Get the body for the request + */ + protected getBody(): Record; +} + +/** + * The input for the events fetch indexes command + */ +interface EventsFetchEventsInput { + /** the tenant */ + tenant: string; + /** the data core id */ + dataCoreId: string; + /** the flow type name */ + flowType: string; + /** the event type names */ + eventTypes: string[]; + /** the time bucket */ + timeBucket: string; + /** the paging cursor */ + cursor?: string; + /** the page size (default is 10.000) */ + pageSize?: number; + /** start from this event id */ + fromEventId?: string; + /** after this event id */ + afterEventId?: string; + /** end at this event id */ + toEventId?: string; + /** include sensitive data */ + includeSensitiveData?: boolean; +} +/** + * The output for the events fetch indexes command + */ +interface EventsFetchEventsOutput { + /** the events */ + events: FlowcoreEvent[]; + /** the next page cursor */ + nextCursor?: string; +} +/** + * Fetch time buckets for an event type + */ +declare class EventsFetchCommand extends Command { + /** + * The dedicated subdomain for the command + */ + protected dedicatedSubdomain: string; + /** + * Get the base url for the request + */ + protected getBaseUrl(): string; + /** + * Get the path for the request + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): EventsFetchEventsOutput; + /** + * Get the body for the request + */ + protected getBody(): Record; +} + +/** + * The input for the events fetch indexes command + */ +interface TimeBucketListInput { + /** the tenant */ + tenant: string; + /** the event type ids */ + eventTypeId: [string, ...string[]] | string; + /** the start time */ + fromTimeBucket?: string; + /** the end time */ + toTimeBucket?: string; + /** the page size */ + pageSize?: number; + /** the cursor */ + cursor?: number; + /** the order */ + order?: "asc" | "desc"; +} +/** + * The output for the events fetch indexes command + */ +interface TimeBucketListOutput { + /** the time buckets */ + timeBuckets: string[]; + /** the next cursor */ + nextCursor?: number; +} +/** + * Fetch time buckets for an event type + */ +declare class TimeBucketListCommand extends Command { + /** + * The dedicated subdomain for the command + */ + protected dedicatedSubdomain: string; + /** + * Get the method for the request + */ + protected getMethod(): string; + /** + * Get the base url for the request + */ + protected getBaseUrl(): string; + /** + * Get the path for the request + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): TimeBucketListOutput; +} + +/** + * the schema for a container + */ +declare const ContainerRegistrySchema: TObject<{ + tenantId: TString; + name: TString; + description: TOptional; + username: TOptional; + id: TString; +}>; +declare const ContainerRegistryCreateSchema: TObject<{ + id: TString; +}>; +declare const ContainerRegistryDeleteSchema: TObject<{ + status: TNumber; +}>; +declare const ContainerRegistryListSchema: TArray; +type ContainerRegistry = Static; +type ContainerRegistryList = Static; +type ContainerRegistryCreate = Static; +type ContainerRegistryDelete = Static; + +interface ContainerRegistryCreateInput { + /** The tenant id to add the container registry to*/ + tenantId: string; + /** The name of the container registry */ + name: string; + /**A description of the container registry */ + description?: string; + /** The URL of the container registry */ + registryUrl: string; + /** The username to authenticate with the container registry */ + username?: string; + /** The password to authenticate with the container registry */ + password?: string; +} +interface ContainerRegistryCreateOutput { + /** The id of the new container-registry */ + id: string; +} +declare class ContainerRegistryCreateCommand extends Command { + /** + * GET the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(response: unknown): ContainerRegistryCreate; +} + +interface ContainerRegistryDeleteInput { + /** The id of the new container-registry */ + containerId: string; +} +declare class ContainerRegistryDeleteCommand extends Command { + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(response: unknown): ContainerRegistryDelete; +} + +interface ContainerRegistryFetchInput { + /** The id of container */ + containerId: string; +} +declare class ContainerRegistryFetchCommand extends Command { + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(response: unknown): ContainerRegistry; +} + +interface ContainerRegistryFetchTenantInput { + /** The tenant id */ + tenantId: string; +} +declare class ContainerRegistListCommand extends Command { + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(response: unknown): ContainerRegistryList; +} + +interface ContainerRegustryUpdateInput { + /** The id of the container-registry */ + containerId: string; + /** The name of the container-registry */ + name?: string; + /** The description */ + description?: string; + /** The registry url for the container */ + registryUrl?: string; + /** The username for authentication */ + username?: string; + /** The password for authentication */ + password?: string; +} +declare class ContainerRegistryUpdateCommand extends Command { + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(response: unknown): ContainerRegistry; +} + +/** + * The schema for a PAT (Personal Access Token) + */ +declare const PATSchema: TObject<{ + id: TString; + name: TString; + description: TOptional; + token: TOptional; + createdAt: TString; +}>; +/** + * The type for a PAT + */ +type PAT = Static; + +/** + * The input for the PAT create command + */ +interface SecurityCreatePAT { + /** The name of the PAT */ + name: string; + /** The description of the PAT */ + description?: string; +} +/** + * Create a Personal Access Token (PAT) + */ +declare class SecurityCreatePATCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): PAT; +} + +/** + * The input for the PAT delete command + */ +interface SecurityDeletePAT { + /** The id of the PAT */ + id: string; +} +interface SecurityDeletePATResponse { + success: boolean; +} +/** + * Delete a Personal Access Token (PAT) + */ +declare class SecurityDeletePATCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): SecurityDeletePATResponse; +} + +/** + * The input for the PAT create command + */ +interface SecurityExchangePAT { + /** The username of the user */ + username: string; + /** The Personal Access Token */ + pat: string; +} +interface SecurityExchangePATResponse { + /** The token of the PAT */ + accessToken: string; +} +/** + * Exchange a Personal Access Token (PAT) for an access token + */ +declare class SecurityExchangePATCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + protected getHeaders(): Record; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): SecurityExchangePATResponse; +} + +/** + * The input for the PAT get command + */ +interface SecurityGetPAT { + /** The id of the PAT */ + id: string; +} +/** + * Get a Personal Access Token (PAT) + */ +declare class SecurityGetPATCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): PAT; +} + +/** + * List all your Personal Access Token (PAT) + */ +declare class SecurityListPATCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): PAT[]; +} + +/** + * The schema for a permission + */ +declare const PermissionSchema: TObject<{ + tenant: TString; + type: TString; + id: TString; + action: TArray, + TLiteral<"write">, + TLiteral<"ingest">, + TLiteral<"fetch">, + TLiteral<"sensitive-data-fetch">, + TString + ]>>; +}>; +/** + * The type for a permission + */ +type Permission = Static; + +/** + * The input for the permissions list command + */ +interface PermissionsListInput { + /** Filter by the type of the frn */ + type?: string; +} +/** + * Fetch an event type + */ +declare class PermissionsListCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Permission[]; +} + +/** + * The input for initializing user in Keycloak + * No input parameters needed - checks current authenticated user + */ +type UserInitializeInKeycloakInput = Record; +/** + * The output for initializing user in Keycloak + * (matches the REST API response) + */ +type UserInitializeInKeycloakOutput = Static; +declare const responseSchema$2: TObject<{ + id: TString; + username: TString; + email: TString; + firstName: TString; + lastName: TString; +}>; +/** + * Finalize user initialization by setting Flowcore User ID in Keycloak. + * + * Calls `POST /api/users` on the user service with an empty JSON body. + * Requires a bearer token. + */ +declare class UserInitializeInKeycloakCommand extends Command { + /** + * The allowed modes for the command + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Get the base URL for the request + */ + protected getBaseUrl(): string; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the path for the request + */ + protected getPath(): string; + /** + * Get the body for the request (must be an empty JSON object) + */ + protected getBody(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): UserInitializeInKeycloakOutput; +} + +/** + * The input for deleting the current authenticated user + * No input parameters needed - checks current authenticated user + */ +type UserDeleteInput = Record; +/** + * The output for deleting the current authenticated user + */ +type UserDeleteOutput = Static; +declare const responseSchema$1: TObject<{ + id: TString; +}>; +/** + * Delete current authenticated user + */ +declare class UserDeleteCommand extends Command { + /** + * The allowed modes for the command + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Get the base URL for the request + */ + protected getBaseUrl(): string; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the path for the request + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): UserDeleteOutput; +} + +/** + * The input for inviting an existing user to a tenant + */ +interface UserInviteToTenantInput { + tenantName: string; + userEmail: string; +} +/** + * The output for inviting an existing user to a tenant + */ +type UserInviteToTenantOutput = Static; +declare const responseSchema: TObject<{ + success: TBoolean; + tenantName: TString; + invitedEmail: TString; +}>; +/** + * Invite an existing user (by email) to a tenant + */ +declare class UserInviteToTenantCommand extends Command { + /** + * The allowed modes for the command + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Get the base URL for the request + */ + protected getBaseUrl(): string; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the path for the request + */ + protected getPath(): string; + /** + * Get the body for the request + */ + protected getBody(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): UserInviteToTenantOutput; +} + +interface DataPathwayAssignmentCompleteInput { + slotId: string; + assignmentId: string; + pathwayId: string; + outcome: "completed" | "failed" | "revoked"; +} +declare class DataPathwayAssignmentCompleteCommand extends Command { + protected retryOnFailure: boolean; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected parseResponse(_rawResponse: unknown): null; +} + +type TSizeClass = TUnion<[TLiteral<"small">, TLiteral<"medium">, TLiteral<"high">]>; +type TStringRecord$1 = TRecord; +type TUnknownRecord = TRecord; +type TNullableString = TUnion<[TString, TNull]>; +type TEndpointConfig = TObject<{ + url: TString; + authHeaders: TOptional; +}>; +type TBackoffConfig = TOptional; + maxMs: TOptional; + multiplier: TOptional; +}>>; +type TTimeoutConfig = TOptional; + fetchMs: TOptional; +}>>; +type TSourceConfig = TObject<{ + id: TOptional; + name: TOptional; + flowType: TString; + eventTypes: TArray; + endpoints: TArray; + batchSize: TOptional; + maxInFlight: TOptional; + backoff: TBackoffConfig; + timeouts: TTimeoutConfig; +}>; +type TDataSourceConfig = TObject<{ + tenant: TString; + dataCore: TString; +}>; +type TAuthConfig = TObject<{ + apiKey: TString; +}>; +type TPathwayConfig = TObject<{ + sources: TArray; +}>; +type TPumpConfig = TObject<{ + sources: TArray; + dataSource: TDataSourceConfig; + auth: TOptional; +}>; +/** User-facing pathway config — what the API accepts on create/update */ +declare const PathwayConfigSchema: TPathwayConfig; +type PathwayConfig = Static; +/** Rendered pump config — what the worker receives (CP injects dataSource + auth) */ +declare const PumpConfigSchema: TPumpConfig; +type PumpConfig = Static; +type TPathwayType = TOptional, TLiteral<"virtual">]>>; +type TVirtualConfig = TObject<{ + flowTypes: TOptional>; +}>; +/** + * What a virtual pathway consumes, and therefore what a command may target. + * + * Entries are either a bare flow type (`"orders.0"`, every pump group on it) or a + * composite `"orders.0::hot"` naming one pump group. A pump group belongs to exactly one + * flow type, so the pair is the identity and one array carries both levels of precision. + */ +declare const VirtualConfigSchema: TVirtualConfig; +type VirtualConfig = Static; +/** + * Desired delivery state of a virtual pathway. + * + * `paused` means the control plane has told the consumer to stop delivering to its + * handlers. The pump keeps running, keeps its buffer and keeps its cursor. A consumer + * reads this at boot so a redeploy comes back paused rather than silently resuming. + * + * Optional: a control plane older than the pause feature omits it. + */ +type TDeliveryState = TUnion<[TLiteral<"active">, TLiteral<"paused">]>; +type TNullableStringArray = TUnion<[TArray, TNull]>; +declare const DataPathwaySchema: TObject<{ + id: TString; + tenant: TString; + name: TOptional; + dataCore: TString; + sizeClass: TSizeClass; + type: TPathwayType; + enabled: TBoolean; + priority: TInteger; + version: TInteger; + labels: TStringRecord$1; + config: TOptional; + virtualConfig: TOptional; + deliveryState: TOptional; + deliveryPauseTargets: TOptional; + createdAt: TString; + updatedAt: TString; +}>; +type DataPathway = Static; +declare const DataPathwayListSchema: TObject<{ + pathways: TArray; + total: TInteger; +}>; +type DataPathwayList = Static; +declare const DataPathwayMutationResponseSchema: TObject<{ + pathwayId: TString; + status: TString; + apiKey: TOptional; +}>; +type DataPathwayMutationResponse = Static; +declare const DataPathwaySlotSchema: TObject<{ + id: TString; + podUnitId: TString; + class: TSizeClass; + labels: TStringRecord$1; + lastSeen: TString; + createdAt: TString; + updatedAt: TString; +}>; +type DataPathwaySlot = Static; +declare const DataPathwaySlotListSchema: TObject<{ + slots: TArray; + total: TInteger; +}>; +type DataPathwaySlotList = Static; +declare const DataPathwaySlotMutationResponseSchema: TObject<{ + slotId: TString; + status: TString; +}>; +type DataPathwaySlotMutationResponse = Static; +declare const DataPathwayAssignmentSchema: TObject<{ + id: TString; + pathwayId: TString; + slotId: TString; + generation: TInteger; + leaseTTL: TString; + status: TString; + config: TPumpConfig; + createdAt: TString; + updatedAt: TString; +}>; +type DataPathwayAssignment = Static; +type TAssignmentNextInner = TObject<{ + assignmentId: TString; + pathwayId: TString; + slotId: TString; + generation: TInteger; + config: TPumpConfig; + leaseTTL: TString; + status: TString; +}>; +declare const DataPathwayAssignmentNextSchema: TObject<{ + assignment: TUnion<[TAssignmentNextInner, TNull]>; +}>; +type DataPathwayAssignmentNext = Static; +declare const DataPathwayAssignmentListSchema: TObject<{ + assignments: TArray; + total: TInteger; +}>; +type DataPathwayAssignmentList = Static; +declare const DataPathwayExpireLeasesResponseSchema: TObject<{ + expired: TInteger; +}>; +type DataPathwayExpireLeasesResponse = Static; +declare const DataPathwayCommandSchema: TObject<{ + id: TString; + restartRequestId: TNullableString; + assignmentId: TString; + type: TString; + generation: TInteger; + position: TUnion<[TUnknownRecord, TNull]>; + stopAt: TNullableString; + timeoutMs: TUnion<[TInteger, TNull]>; + phase: TString; + reason: TNullableString; + createdAt: TString; +}>; +type DataPathwayCommand = Static; +declare const DataPathwayCommandListSchema: TObject<{ + commands: TArray; +}>; +type DataPathwayCommandList = Static; +declare const DataPathwayCommandResponseSchema: TObject<{ + commandId: TString; + phase: TString; +}>; +type DataPathwayCommandResponse = Static; +declare const DataPathwayCommandDetailSchema: TObject<{ + id: TString; + restartRequestId: TNullableString; + assignmentId: TNullableString; + pathwayId: TNullableString; + type: TString; + generation: TUnion<[TInteger, TNull]>; + position: TUnion<[TUnknownRecord, TNull]>; + stopAt: TNullableString; + timeoutMs: TUnion<[TInteger, TNull]>; + phase: TString; + reason: TNullableString; + details: TNullableString; + config: TUnion<[TUnknownRecord, TNull]>; + sourceFlowTypes: TUnion<[TArray, TNull]>; + createdAt: TString; + updatedAt: TString; +}>; +type DataPathwayCommandDetail = Static; +declare const DataPathwayRestartRequestResponseSchema: TObject<{ + restartRequestId: TString; + acceptedTargets: TArray; + skippedTargets: TArray; +}>; +type DataPathwayRestartRequestResponse = Static; +declare const DataPathwayRestartRequestSchema: TObject<{ + id: TString; + targets: TUnknownRecord; + mode: TString; + position: TUnknownRecord; + status: TString; + requestedBy: TString; + reason: TNullableString; + createdAt: TString; + updatedAt: TString; +}>; +type DataPathwayRestartRequest = Static; +type TSlotCount = TObject<{ + free: TInteger; + used: TInteger; +}>; +type TThreeClassIntegers = TObject<{ + small: TInteger; + medium: TInteger; + high: TInteger; +}>; +declare const DataPathwayCapacitySchema: TObject<{ + slots: TObject<{ + small: TSlotCount; + medium: TSlotCount; + high: TSlotCount; + }>; + pendingAssignments: TThreeClassIntegers; +}>; +type DataPathwayCapacity = Static; +declare const DataPathwayQuotaSchema: TObject<{ + tenant: TString; + maxSlots: TThreeClassIntegers; + createdAt: TString; + updatedAt: TString; +}>; +type DataPathwayQuota = Static; +declare const DataPathwayQuotaWithUsageSchema: TObject<{ + tenant: TString; + maxSlots: TThreeClassIntegers; + used: TThreeClassIntegers; +}>; +type DataPathwayQuotaWithUsage = Static; +declare const DataPathwayQuotaListSchema: TObject<{ + quotas: TArray; + total: TInteger; +}>; +type DataPathwayQuotaList = Static; +declare const DataPathwayQuotaSetResponseSchema: TObject<{ + tenant: TString; + status: TString; +}>; +type DataPathwayQuotaSetResponse = Static; +type TPumpStateValue = TObject<{ + timeBucket: TString; + eventId: TOptional; +}>; +declare const DataPathwayPumpStateSchema: TObject<{ + pathwayId: TString; + flowType: TString; + state: TUnion<[TPumpStateValue, TNull]>; +}>; +type DataPathwayPumpState = Static; +declare const DataPathwayPumpStateBySourceSchema: TObject<{ + pathwayId: TString; + sourceId: TString; + flowType: TUnion<[TString, TNull]>; + state: TUnion<[TPumpStateValue, TNull]>; +}>; +type DataPathwayPumpStateBySource = Static; +declare const DataPathwayPumpStateSaveResponseSchema: TObject<{ + status: TString; +}>; +type DataPathwayPumpStateSaveResponse = Static; +declare const DataPathwayDeliveryLogEntrySchema: TObject<{ + id: TString; + pathwayId: TString; + assignmentId: TString; + endpointUrl: TString; + httpStatus: TUnion<[TInteger, TNull]>; + success: TBoolean; + batchSize: TUnion<[TInteger, TNull]>; + durationMs: TUnion<[TInteger, TNull]>; + errorMessage: TUnion<[TString, TNull]>; + responseBody: TUnion<[TString, TNull]>; + flowType: TUnion<[TString, TNull]>; + sourceId: TUnion<[TString, TNull]>; + eventType: TUnion<[TString, TNull]>; + createdAt: TString; +}>; +declare const DataPathwayDeliveryLogListSchema: TObject<{ + entries: TArray; + total: TInteger; +}>; +type DataPathwayDeliveryLogList = Static; +declare const DataPathwayDeliveryLogBatchEntrySchema: TObject<{ + pathwayId: TString; + assignmentId: TString; + endpointUrl: TString; + flowType: TOptional; + sourceId: TOptional; + eventType: TOptional; + httpStatus: TOptional; + success: TBoolean; + batchSize: TOptional; + durationMs: TOptional; + errorMessage: TOptional; + responseBody: TOptional; +}>; +type DataPathwayDeliveryLogBatchEntry = Static; +declare const DataPathwayDeliveryLogBatchResponseSchema: TObject<{ + inserted: TInteger; +}>; +type DataPathwayDeliveryLogBatchResponse = Static; +type TThroughputRecentResult = TObject<{ + status: TNumber; + durationMs: TNumber; + success: TBoolean; + ageMs: TNumber; +}>; +type TNullableNumber = TUnion<[TNumber, TNull]>; +type TThroughputSource = TObject<{ + flowType: TString; + name: TOptional; + eventsPerSecond: TNumber; + successRate: TNumber; + avgDurationMs: TNumber; + totalDelivered: TNumber; + totalFailed: TNumber; + lastDeliveryAgeMs: TNullableNumber; + healthy: TBoolean; + recentResults: TArray; +}>; +type TThroughputEndpoint = TObject<{ + eventsPerSecond: TNumber; + successRate: TNumber; + totalDelivered: TNumber; + totalFailed: TNumber; + lastDeliveryAgeMs: TNullableNumber; + healthy: TBoolean; + sources: TRecord; +}>; +type TThroughputGlobal = TObject<{ + eventsPerSecond: TNumber; + totalRecorded: TNumber; + windowSeconds: TNumber; +}>; +type TThroughputSnapshot = TObject<{ + global: TThroughputGlobal; + endpoints: TRecord; +}>; +type TMetricsAssignmentEntry = TObject<{ + assignmentId: TString; + status: TString; + throughput: TUnion<[TThroughputSnapshot, TNull]>; + updatedAt: TString; +}>; +declare const DataPathwayMetricsSchema: TObject<{ + pathwayId: TString; + assignments: TArray; +}>; +type DataPathwayMetrics = Static; +declare const DataPathwayHealthSchema: TObject<{ + status: TUnion<[TLiteral<"healthy">, TLiteral<"unhealthy">]>; + checks: TObject<{ + db: TUnion<[TLiteral<"ok">, TLiteral<"error">]>; + }>; + uptime: TNumber; +}>; +type DataPathwayHealth = Static; +declare const DataPathwayPumpPulseResponseSchema: TObject<{ + status: TString; +}>; +type DataPathwayPumpPulseResponse = Static; +declare const DataPathwayPumpStatusSchema: TObject; +type DataPathwayPumpStatus = Static; + +type DataPathwayAssignmentExpireLeasesInput = Record; +declare class DataPathwayAssignmentExpireLeasesCommand extends Command { + protected retryOnFailure: boolean; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getBaseUrl(): string; + protected getPath(): string; + protected getBody(): Record | undefined; + protected parseResponse(rawResponse: unknown): DataPathwayExpireLeasesResponse; +} + +interface DataPathwayAssignmentFetchInput { + id: string; +} +declare class DataPathwayAssignmentFetchCommand extends Command { + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected parseResponse(rawResponse: unknown): DataPathwayAssignment; + protected handleClientError(error: ClientError): void; +} + +interface DataPathwayAssignmentHeartbeatInput { + slotId: string; + assignmentId: string; + pathwayId: string; + metrics: { + eventsFetchedTotal?: number; + eventsDeliveredTotal?: number; + deliveryErrorsTotal?: number; + bufferDepth?: number; + lagSeconds?: number; + throughput?: { + global: { + eventsPerSecond: number; + totalRecorded: number; + windowSeconds: number; + }; + endpoints: Record; + }>; + }>; + }; + }; +} +declare class DataPathwayAssignmentHeartbeatCommand extends Command { + protected retryOnFailure: boolean; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected parseResponse(_rawResponse: unknown): null; +} + +interface DataPathwayAssignmentListInput { + status?: "active" | "completed" | "failed" | "revoked" | "expired"; + slotId?: string; + pathwayId?: string; + limit?: number; + offset?: number; + sort?: "asc" | "desc"; +} +declare class DataPathwayAssignmentListCommand extends Command { + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected parseResponse(rawResponse: unknown): DataPathwayAssignmentList; +} + +interface DataPathwayAssignmentNextInput { + slotId: string; + class: "small" | "medium" | "high"; +} +declare class DataPathwayAssignmentNextCommand extends Command { + protected retryOnFailure: boolean; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getBaseUrl(): string; + protected getPath(): string; + protected parseResponse(rawResponse: unknown): DataPathwayAssignmentNext; +} + +type DataPathwayCapacityFetchInput = Record; +declare class DataPathwayCapacityFetchCommand extends Command { + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected parseResponse(rawResponse: unknown): DataPathwayCapacity; +} + +interface DataPathwayCommandDispatchConfigUpdateInput { + assignmentId: string; + generation: number; + config: Record; +} +declare class DataPathwayCommandDispatchConfigUpdateCommand extends Command { + protected retryOnFailure: boolean; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getBaseUrl(): string; + protected getPath(): string; + protected getBody(): Record; + protected parseResponse(rawResponse: unknown): DataPathwayCommandResponse; + protected handleClientError(error: ClientError): void; +} + +interface DataPathwayCommandDispatchRestartInput { + assignmentId: string; + restartRequestId?: string; + generation: number; + position?: { + timeBucket?: string; + eventId?: string; + }; + stopAt?: string | null; + timeoutMs?: number; +} +declare class DataPathwayCommandDispatchRestartCommand extends Command { + protected retryOnFailure: boolean; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getBaseUrl(): string; + protected getPath(): string; + protected getBody(): Record; + protected parseResponse(rawResponse: unknown): DataPathwayCommandResponse; + protected handleClientError(error: ClientError): void; +} + +interface DataPathwayCommandDispatchStopInput { + assignmentId: string; + restartRequestId?: string; + generation: number; + reason?: string; + timeoutMs?: number; +} +declare class DataPathwayCommandDispatchStopCommand extends Command { + protected retryOnFailure: boolean; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getBaseUrl(): string; + protected getPath(): string; + protected getBody(): Record; + protected parseResponse(rawResponse: unknown): DataPathwayCommandResponse; + protected handleClientError(error: ClientError): void; +} + +interface DataPathwayCommandFetchInput { + commandId: string; +} +declare class DataPathwayCommandFetchCommand extends Command { + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected parseResponse(rawResponse: unknown): DataPathwayCommandDetail; + protected handleClientError(error: ClientError): void; +} + +interface DataPathwayCommandPendingInput { + assignmentId: string; +} +declare class DataPathwayCommandPendingCommand extends Command { + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected parseResponse(rawResponse: unknown): DataPathwayCommandList; + protected handleClientError(error: ClientError): void; +} + +interface DataPathwayCommandUpdateStatusInput { + assignmentId: string; + commandId: string; + phase: "acknowledged" | "restarting" | "running" | "failed" | "timedOut"; + details?: string; +} +declare class DataPathwayCommandUpdateStatusCommand extends Command { + protected retryOnFailure: boolean; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getBaseUrl(): string; + protected getPath(): string; + protected getBody(): Record; + protected parseResponse(rawResponse: unknown): DataPathwayCommandResponse; + protected handleClientError(error: ClientError): void; +} + +interface DataPathwayDeliveryLogBatchInput { + entries: DataPathwayDeliveryLogBatchEntry[]; +} +declare class DataPathwayDeliveryLogBatchCommand extends Command { + protected retryOnFailure: boolean; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected getBody(): Record; + protected parseResponse(rawResponse: unknown): DataPathwayDeliveryLogBatchResponse; +} + +interface DataPathwayDeliveryLogListInput { + pathwayId: string; + success?: boolean; + limit?: number; + offset?: number; + sort?: "asc" | "desc"; +} +declare class DataPathwayDeliveryLogListCommand extends Command { + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected parseResponse(rawResponse: unknown): DataPathwayDeliveryLogList; +} + +type DataPathwayHealthCheckInput = Record; +declare class DataPathwayHealthCheckCommand extends Command { + protected retryOnFailure: boolean; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected parseResponse(rawResponse: unknown): DataPathwayHealth; +} + +interface DataPathwayCreateInput { + id: string; + tenant: string; + dataCore: string; + sizeClass: "small" | "medium" | "high"; + enabled?: boolean; + priority?: number; + version?: number; + labels?: Record; + config?: PathwayConfig; + type?: "managed" | "virtual"; + virtualConfig?: VirtualConfig; +} +declare class DataPathwayCreateCommand extends Command { + protected retryOnFailure: boolean; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected getBody(): Record; + protected parseResponse(rawResponse: unknown): DataPathwayMutationResponse; +} + +interface DataPathwayDeleteInput { + id: string; + reason?: string; +} +declare class DataPathwayDeleteCommand extends Command { + protected retryOnFailure: boolean; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected getBody(): Record; + protected parseResponse(rawResponse: unknown): DataPathwayMutationResponse; + protected handleClientError(error: ClientError): void; +} + +interface DataPathwayDisableInput { + id: string; + reason?: string; +} +declare class DataPathwayDisableCommand extends Command { + protected retryOnFailure: boolean; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected getBody(): Record; + protected parseResponse(rawResponse: unknown): DataPathwayMutationResponse; + protected handleClientError(error: ClientError): void; +} + +interface DataPathwayFetchInput { + id: string; +} +declare class DataPathwayFetchCommand extends Command { + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected parseResponse(rawResponse: unknown): DataPathway; + protected handleClientError(error: ClientError): void; +} + +interface DataPathwayFetchByNameInput { + name: string; + tenant: string; +} +declare class DataPathwayFetchByNameCommand extends Command { + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected parseResponse(rawResponse: unknown): DataPathway; + protected handleClientError(error: ClientError): void; +} + +interface DataPathwayListInput { + tenant?: string; + sizeClass?: "small" | "medium" | "high"; + type?: "managed" | "virtual"; + enabled?: boolean; + priority?: number; + limit?: number; + offset?: number; + /** Page number (1-based). When set, offset is derived as (page - 1) * limit. */ + page?: number; + /** Pathway ids to pin to the front of the list (comma-separated string or array) */ + ids?: string | string[]; + sort?: "asc" | "desc"; +} +declare class DataPathwayListCommand extends Command { + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected parseResponse(rawResponse: unknown): DataPathwayList; +} + +interface DataPathwayMetricsFetchInput { + id: string; +} +declare class DataPathwayMetricsFetchCommand extends Command { + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected parseResponse(rawResponse: unknown): DataPathwayMetrics; + protected handleClientError(error: ClientError): void; +} + +type TUpsertResponse = TObject<{ + pathwayId: TString; + status: TUnion<[TLiteral<"created">, TLiteral<"updated">]>; +}>; +declare const DataPathwayUpsertByNameResponseSchema: TUpsertResponse; +type DataPathwayUpsertByNameResponse = Static; +interface DataPathwayUpsertByNameInput { + name: string; + tenant: string; + dataCore: string; + sizeClass?: "small" | "medium" | "high"; + enabled?: boolean; + labels?: Record; + type?: "managed" | "virtual"; + config?: PathwayConfig; + virtualConfig?: VirtualConfig; +} +declare class DataPathwayUpsertByNameCommand extends Command { + protected retryOnFailure: boolean; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected getBody(): Record; + protected parseResponse(rawResponse: unknown): DataPathwayUpsertByNameResponse; +} + +interface DataPathwayCommandDispatchPauseInput { + pathwayId: string; + /** + * What to pause. Each entry is either a bare flow type (`"orders.0"`, every pump group + * on it) or a composite `"orders.0::hot"` naming exactly one pump. Omit to pause every + * pump. + * + * A composite target is rejected with 409 unless the pathway advertised composite + * entries in `virtualConfig.flowTypes`. An older consumer compares targets against flow + * type names only, so it would match nothing and pause nothing. + */ + targets?: string[]; + reason?: string; + requestedBy?: string; + timeoutMs?: number; +} +/** + * Pause delivery on a virtual pathway. + * + * Delivery to the consumer's handlers stops while its pump keeps fetching, keeps its + * buffer and keeps its cursor. The desired state is recorded on the pathway, so a + * consumer that restarts comes back paused at the same position. + * + * This is NOT `disable`. Disabling a virtual pathway deletes its API key, and a later + * enable resets the cursor to latest. + */ +declare class DataPathwayCommandDispatchPauseCommand extends Command { + protected retryOnFailure: boolean; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getBaseUrl(): string; + protected getPath(): string; + protected getBody(): Record; + protected parseResponse(rawResponse: unknown): DataPathwayCommandResponse; + protected handleClientError(error: ClientError): void; +} + +interface DataPathwayCommandDispatchResumeInput { + pathwayId: string; + /** + * What to resume. Same shape as the pause targets: a bare flow type, or a composite + * `"orders.0::hot"`. Omit to resume every pump. + */ + targets?: string[]; + reason?: string; + requestedBy?: string; + timeoutMs?: number; +} +/** + * Resume delivery on a virtual pathway, continuing from the exact position where + * {@link DataPathwayCommandDispatchPauseCommand} stopped it. + */ +declare class DataPathwayCommandDispatchResumeCommand extends Command { + protected retryOnFailure: boolean; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getBaseUrl(): string; + protected getPath(): string; + protected getBody(): Record; + protected parseResponse(rawResponse: unknown): DataPathwayCommandResponse; + protected handleClientError(error: ClientError): void; +} + +interface DataPathwayCommandPendingByPathwayInput { + pathwayId: string; +} +/** + * Fetch pending commands for a virtual pathway. Mirrors the assignment-scoped + * `command.pending` endpoint but for virtual pathways that poll by pathwayId. + */ +declare class DataPathwayCommandPendingByPathwayCommand extends Command { + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected parseResponse(rawResponse: unknown): DataPathwayCommandList; + protected handleClientError(error: ClientError): void; +} + +interface DataPathwayCommandUpdateStatusByPathwayInput { + pathwayId: string; + commandId: string; + phase: "acknowledged" | "restarting" | "running" | "failed" | "timedOut"; + details?: string; +} +/** + * Update command status for a virtual pathway callback. Mirrors the + * assignment-scoped `command.update-status` endpoint but for virtual pathways + * that report completion by pathwayId. + */ +declare class DataPathwayCommandUpdateStatusByPathwayCommand extends Command { + protected retryOnFailure: boolean; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getBaseUrl(): string; + protected getPath(): string; + protected getBody(): Record; + protected parseResponse(rawResponse: unknown): DataPathwayCommandResponse; + protected handleClientError(error: ClientError): void; +} + +interface SendPumpPulseInput { + pathwayId: string; + sourceId?: string; + flowType: string; + timeBucket: string; + eventId: string | null; + isLive: boolean; + buffer: { + depth: number; + reserved: number; + sizeBytes: number; + }; + counters: { + acknowledged: number; + failed: number; + pulled: number; + }; + uptimeMs: number; +} +declare class SendPumpPulseCommand extends Command { + protected retryOnFailure: boolean; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected parseResponse(rawResponse: unknown): DataPathwayPumpPulseResponse; +} + +interface DataPathwayPumpStateFetchInput { + pathwayId: string; + flowType: string; +} +declare class DataPathwayPumpStateFetchCommand extends Command { + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected parseResponse(rawResponse: unknown): DataPathwayPumpState; + protected handleClientError(error: ClientError): void; +} + +interface DataPathwayPumpStateFetchBySourceInput { + pathwayId: string; + sourceId: string; +} +declare class DataPathwayPumpStateFetchBySourceCommand extends Command { + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected parseResponse(rawResponse: unknown): DataPathwayPumpStateBySource; + protected handleClientError(error: ClientError): void; +} + +interface DataPathwayPumpStateSaveInput { + pathwayId: string; + flowType: string; + state: { + timeBucket: string; + eventId?: string; + }; +} +declare class DataPathwayPumpStateSaveCommand extends Command { + protected retryOnFailure: boolean; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected getBody(): Record; + protected parseResponse(rawResponse: unknown): DataPathwayPumpStateSaveResponse; +} + +interface DataPathwayPumpStateSaveBySourceInput { + pathwayId: string; + sourceId: string; + state: { + timeBucket: string; + eventId?: string; + }; +} +declare class DataPathwayPumpStateSaveBySourceCommand extends Command { + protected retryOnFailure: boolean; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected getBody(): Record; + protected parseResponse(rawResponse: unknown): DataPathwayPumpStateSaveResponse; +} + +interface FetchPumpStatusInput { + pathwayId: string; +} +declare class FetchPumpStatusCommand extends Command { + protected retryOnFailure: boolean; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected getBody(): Record | undefined; + protected parseResponse(rawResponse: unknown): DataPathwayPumpStatus; + protected handleClientError(error: ClientError): void; +} + +interface DataPathwayQuotaFetchInput { + tenant: string; +} +declare class DataPathwayQuotaFetchCommand extends Command { + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected parseResponse(rawResponse: unknown): DataPathwayQuotaWithUsage; + protected handleClientError(error: ClientError): void; +} + +type DataPathwayQuotaListInput = Record; +declare class DataPathwayQuotaListCommand extends Command { + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected parseResponse(rawResponse: unknown): DataPathwayQuotaList; +} + +interface DataPathwayQuotaSetInput { + tenant: string; + maxSlots: { + small: number; + medium: number; + high: number; + }; +} +declare class DataPathwayQuotaSetCommand extends Command { + protected retryOnFailure: boolean; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected getBody(): Record; + protected parseResponse(rawResponse: unknown): DataPathwayQuotaSetResponse; +} + +interface DataPathwayRestartFetchInput { + id: string; +} +declare class DataPathwayRestartFetchCommand extends Command { + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected parseResponse(rawResponse: unknown): DataPathwayRestartRequest; + protected handleClientError(error: ClientError): void; +} + +interface DataPathwayRestartRequestInput { + targets: { + flowTypes?: string[]; + pathwayIds?: string[]; + selector?: { + tenant?: string; + labels?: Record; + }; + }; + mode?: "datapumpRestart" | "hardReset"; + position: { + timeBucket?: string; + eventId?: string; + }; + stopAt?: string | null; + timeoutMs?: number; + requestedBy: string; + reason?: string; +} +declare class DataPathwayRestartRequestCommand extends Command { + protected retryOnFailure: boolean; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getBaseUrl(): string; + protected getPath(): string; + protected parseResponse(rawResponse: unknown): DataPathwayRestartRequestResponse; +} + +interface DataPathwaySlotDeregisterInput { + id: string; + reason?: string; +} +declare class DataPathwaySlotDeregisterCommand extends Command { + protected retryOnFailure: boolean; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getBaseUrl(): string; + protected getPath(): string; + protected getBody(): Record; + protected parseResponse(rawResponse: unknown): DataPathwaySlotMutationResponse; + protected handleClientError(error: ClientError): void; +} + +interface DataPathwaySlotFetchInput { + id: string; +} +declare class DataPathwaySlotFetchCommand extends Command { + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected parseResponse(rawResponse: unknown): DataPathwaySlot; + protected handleClientError(error: ClientError): void; +} + +interface DataPathwaySlotHeartbeatInput { + id: string; +} +declare class DataPathwaySlotHeartbeatCommand extends Command { + protected retryOnFailure: boolean; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getBaseUrl(): string; + protected getPath(): string; + protected getBody(): Record; + protected parseResponse(rawResponse: unknown): DataPathwaySlotMutationResponse; + protected handleClientError(error: ClientError): void; +} + +interface DataPathwaySlotListInput { + class?: "small" | "medium" | "high"; + limit?: number; + offset?: number; + sort?: "asc" | "desc"; +} +declare class DataPathwaySlotListCommand extends Command { + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected parseResponse(rawResponse: unknown): DataPathwaySlotList; +} + +interface DataPathwaySlotRegisterInput { + slotId: string; + podUnitId: string; + class: "small" | "medium" | "high"; + version: string; + labels?: Record; +} +declare class DataPathwaySlotRegisterCommand extends Command { + protected retryOnFailure: boolean; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getBaseUrl(): string; + protected getPath(): string; + protected parseResponse(rawResponse: unknown): DataPathwaySlotMutationResponse; +} + +/** + * The schema for a permission + */ +declare const UserPermissionSchema: TObject<{ + tenant: TString; + type: TString; + id: TString; + action: TArray; +}>; +/** + * The permission type + */ +type UserPermission = Static; +/** + * The input for the user permissions command + */ +interface UserPermissionsInput { + /** The optional permission type */ + type?: string; +} +/** + * Get all permissions for the current user + */ +declare class UserPermissionsCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): UserPermission[]; +} + +declare const PolicyFilterValueSchema: _sinclair_typebox.TUnion<[_sinclair_typebox.TString, _sinclair_typebox.TNumber, _sinclair_typebox.TBoolean, _sinclair_typebox.TNull]>; +declare const PolicyFilterSchema: _sinclair_typebox.TUnion<[_sinclair_typebox.TObject<{ + path: _sinclair_typebox.TString; + operator: _sinclair_typebox.TLiteral<"equals">; + value: _sinclair_typebox.TUnion<[_sinclair_typebox.TString, _sinclair_typebox.TNumber, _sinclair_typebox.TBoolean, _sinclair_typebox.TNull]>; +}>, _sinclair_typebox.TObject<{ + path: _sinclair_typebox.TString; + operator: _sinclair_typebox.TLiteral<"oneOf">; + values: _sinclair_typebox.TArray<_sinclair_typebox.TUnion<[_sinclair_typebox.TString, _sinclair_typebox.TNumber, _sinclair_typebox.TBoolean, _sinclair_typebox.TNull]>>; +}>, _sinclair_typebox.TObject<{ + path: _sinclair_typebox.TString; + operator: _sinclair_typebox.TLiteral<"exists">; + value: _sinclair_typebox.TBoolean; +}>]>; +type PolicyFilterValue = Static; +type PolicyFilter = Static; +declare function isEncryptedPayload(payload: unknown): boolean; +declare function matchesPolicyFilters(filters: readonly PolicyFilter[], payload: unknown): boolean; +type EntitlementGrant = { + policyFrn: string; + statementId: string; + resource: string; + filters?: PolicyFilter[]; +}; +declare function permitsPayload(grants: readonly EntitlementGrant[], payload: unknown): boolean; + +/** + * The schema for a policy statement document + */ +declare const PolicyStatementSchema: TObject<{ + statementId: TOptional; + resource: TString; + action: TUnion<[TString, TArray]>; + filters: TOptional>; +}>; +/** + * The schema for a policy + */ +declare const PolicySchema: TObject<{ + id: TString; + organizationId: TString; + name: TString; + version: TString; + policyDocuments: TArray; + description: TOptional; + principal: TOptional; + flowcoreManaged: TBoolean; + archived: TOptional; + frn: TString; +}>; +/** + * The Policy type + */ +type Policy = Static; +/** + * The Policy Statement type + */ +type PolicyStatement = Static; +/** + * The input for the policy create command + */ +interface PolicyCreateInput { + /** The organization id */ + organizationId: string; + /** The name of the policy */ + name: string; + /** The version of the policy */ + version: string; + /** The policy documents */ + policyDocuments: Array<{ + /** The optional statement id */ + statementId?: string; + /** The resource for this statement */ + resource: string; + /** The actions for this statement */ + action: string | string[]; + /** Optional plaintext event payload filters. */ + filters?: PolicyFilter[]; + }>; + /** The description of the policy */ + description?: string; + /** The principal role that can access the resource */ + principal?: string; + /** Whether the policy is managed by Flowcore */ + flowcoreManaged?: boolean; +} +/** + * Create a policy + */ +declare class PolicyCreateCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body + */ + protected getBody(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Policy; +} + +/** + * The input for the policy list command + */ +interface PolicyListInput { + /** The organization id */ + organizationId?: string; +} +/** + * List policies + */ +declare class PolicyListCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Policy[]; +} + +/** + * The schema for a successful policy validation response. + * + * Returned by `POST /api/v1/policies/validate` when the submitted policy + * payload passes every rule the create and patch paths enforce. Invalid + * payloads are surfaced as 4xx errors (422 for format / tenant boundary / + * UUID violations, 404 when the organization is not found) and are not + * represented in this schema. + */ +declare const PolicyValidateResponseSchema: TObject<{ + valid: TLiteral; +}>; +/** + * The Policy Validate response type + */ +type PolicyValidateResponse = Static; +/** + * The input for the policy validate command. + * + * Mirrors the service's `validatePolicyBody` DTO: only the fields that are + * actually validated are required. The command is a dry-run of the same + * helpers used by `PolicyCreateCommand` and `PolicyUpdateCommand`, so a + * successful response guarantees the payload would also be accepted by + * those commands. + */ +interface PolicyValidateInput { + /** The organization that would own the policy — used to enforce the tenant boundary on policyDocuments resources */ + organizationId: string; + /** The policy documents to validate */ + policyDocuments: Array<{ + /** The optional statement id */ + statementId?: string; + /** The resource for this statement */ + resource: string; + /** The actions for this statement */ + action: string | string[]; + /** Optional plaintext event payload filters. */ + filters?: PolicyFilter[]; + }>; + /** The optional principal role FRN (cross-tenant is intentionally permitted here) */ + principal?: string; +} +/** + * Dry-run validate a prospective policy payload. + * + * Calls `POST /api/v1/policies/validate`, which runs the same + * validation helpers as `POST /api/v1/policies/` and + * `PATCH /api/v1/policies/:id`. A successful response means the same + * payload would be accepted by the create/update commands. Useful for + * giving immediate feedback in UIs, CLIs, and SDK consumers before any + * write actually happens. + */ +declare class PolicyValidateCommand extends Command { + /** + * Whether the command should retry on failure. + * + * Disabled because a 422 here indicates an invalid payload — retrying + * would just re-submit the same bad data. + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body + */ + protected getBody(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): PolicyValidateResponse; +} + +/** + * The input for the policy archive command + */ +interface PolicyArchiveInput { + /** The policy id */ + policyId: string; +} +/** + * The schema for the archive policy response + */ +declare const ArchivePolicyResponseSchema: TObject<{ + message: TString; +}>; +/** + * The archive policy response type + */ +type ArchivePolicyResponse = Static; +/** + * Archive a policy by ID + */ +declare class PolicyArchiveCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ArchivePolicyResponse; +} + +/** + * The input for the policy get command + */ +interface PolicyGetInput { + /** The policy id */ + policyId: string; +} +/** + * Get a policy by ID + */ +declare class PolicyGetCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Create a new instance of the command + * @param policyId - The ID of the policy to get + */ + constructor(policyId: string); + /** + * Create a new instance of the command + * @param input - The input for the command + */ + constructor(input: PolicyGetInput); + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Policy; +} + +/** + * The input for the policy update command + */ +interface PolicyUpdateInput { + /** The policy id */ + policyId: string; + /** The organization id */ + organizationId: string; + /** The name of the policy */ + name: string; + /** The version of the policy */ + version: string; + /** The policy documents */ + policyDocuments: PolicyStatement[]; + /** The description of the policy */ + description?: string; + /** The principal role that can access the resource */ + principal?: string; + /** Whether the policy is managed by Flowcore */ + flowcoreManaged?: boolean; +} +/** + * Update a policy by ID + */ +declare class PolicyUpdateCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body + */ + protected getBody(): Record; + protected getHeaders(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Policy; +} + +/** + * The input for the key policies command + */ +interface KeyPoliciesInput { + /** The key id */ + keyId: string; +} +/** + * Fetch policies for a key + */ +declare class KeyPoliciesCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Policy[]; +} + +/** + * The input for the organization policies command + */ +interface OrganizationPoliciesInput { + /** The organization id */ + organizationId: string; +} +/** + * Fetch policies for an organization + */ +declare class OrganizationPoliciesCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Policy[]; +} + +/** + * The schema for a policy-key association + */ +declare const PolicyKeyAssociationSchema: TObject<{ + policyId: TString; + organizationId: TString; + keyId: TString; +}>; +/** + * The schema for a policy-user association + */ +declare const PolicyUserAssociationSchema: TObject<{ + policyId: TString; + organizationId: TString; + userId: TString; +}>; +/** + * The schema for a policy-role association + */ +declare const PolicyRoleAssociationSchema: TObject<{ + policyId: TString; + organizationId: TString; + roleId: TString; +}>; +/** + * The schema for policy associations + */ +declare const PolicyAssociationsSchema: TObject<{ + keys: TArray; + users: TArray; + roles: TArray; +}>; +/** + * The policy-key association type + */ +type PolicyKeyAssociation = Static; +/** + * The policy-user association type + */ +type PolicyUserAssociation = Static; +/** + * The policy-role association type + */ +type PolicyRoleAssociation = Static; +/** + * The policy associations type + */ +type PolicyAssociations = Static; +/** + * The input for the policy associations command + */ +interface PolicyAssociationsInput { + /** The policy id */ + policyId: string; +} +/** + * Fetch associations for a policy + */ +declare class PolicyAssociationsCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): PolicyAssociations; +} + +/** + * The input for the role policies command + */ +interface RolePoliciesInput { + /** The role id */ + roleId: string; +} +/** + * Fetch policies for a role + */ +declare class RolePoliciesCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Policy[]; +} + +/** + * The input for the user policies command + */ +interface UserPoliciesInput { + /** The user id */ + userId: string; + /** The optional organization id */ + organizationId?: string; +} +/** + * Fetch policies for a user + */ +declare class UserPoliciesCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Policy[]; +} + +/** + * The schema for a key policy link response + */ +declare const KeyPolicyLinkSchema: TObject<{ + policyId: TString; + organizationId: TString; + keyId: TString; +}>; +/** + * The key policy link response type + */ +type KeyPolicyLink = Static; +/** + * The input for the link key policy command + */ +interface LinkKeyPolicyInput { + /** The key id */ + keyId: string; + /** The policy id */ + policyId: string; +} +/** + * Link a policy to a key + */ +declare class LinkKeyPolicyCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body + */ + protected getBody(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): KeyPolicyLink; +} + +/** + * The schema for a role policy link response + */ +declare const RolePolicyLinkSchema: TObject<{ + policyId: TString; + organizationId: TString; + roleId: TString; +}>; +/** + * The role policy link response type + */ +type RolePolicyLink = Static; +/** + * The input for the link role policy command + */ +interface LinkRolePolicyInput { + /** The role id */ + roleId: string; + /** The policy id */ + policyId: string; +} +/** + * Link a policy to a role + */ +declare class LinkRolePolicyCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body + */ + protected getBody(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): RolePolicyLink; +} + +/** + * The schema for a user policy link response + */ +declare const UserPolicyLinkSchema: TObject<{ + policyId: TString; + organizationId: TString; + userId: TString; +}>; +/** + * The user policy link response type + */ +type UserPolicyLink = Static; +/** + * The input for the link user policy command + */ +interface LinkUserPolicyInput { + /** The user id */ + userId: string; + /** The policy id */ + policyId: string; +} +/** + * Link a policy to a user + */ +declare class LinkUserPolicyCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body + */ + protected getBody(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): UserPolicyLink; +} + +/** + * The input for the unlink key policy command + */ +interface UnlinkKeyPolicyInput { + /** The key id */ + keyId: string; + /** The policy id */ + policyId: string; +} +/** + * Unlink a policy from a key + */ +declare class UnlinkKeyPolicyCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body + */ + protected getBody(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): KeyPolicyLink; +} + +/** + * The input for the unlink role policy command + */ +interface UnlinkRolePolicyInput { + /** The role id */ + roleId: string; + /** The policy id */ + policyId: string; +} +/** + * Unlink a policy from a role + */ +declare class UnlinkRolePolicyCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body + */ + protected getBody(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): RolePolicyLink; +} + +/** + * The input for the unlink user policy command + */ +interface UnlinkUserPolicyInput { + /** The user id */ + userId: string; + /** The policy id */ + policyId: string; +} +/** + * Unlink a policy from a user + */ +declare class UnlinkUserPolicyCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body + */ + protected getBody(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): UserPolicyLink; +} + +/** + * The schema for a role + */ +declare const RoleSchema: TObject<{ + id: TString; + organizationId: TString; + name: TString; + description: TOptional; + flowcoreManaged: TOptional; + archived: TOptional; +}>; +/** + * The Role type + */ +type Role = Static; +/** + * The input for the role create command + */ +interface RoleCreateInput { + /** The organization id */ + organizationId: string; + /** The name of the role */ + name: string; + /** The description of the role */ + description?: string; + /** Whether the role is managed by Flowcore */ + flowcoreManaged?: boolean; +} +/** + * Create a role + */ +declare class RoleCreateCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body + */ + protected getBody(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Role; +} + +/** + * The input for the key roles command + */ +interface KeyRolesInput { + /** The key id */ + keyId: string; +} +/** + * Fetch roles for a key + */ +declare class KeyRolesCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Role[]; +} + +/** + * The input for the organization roles command + */ +interface OrganizationRolesInput { + /** The organization id */ + organizationId: string; +} +/** + * Fetch roles for an organization + */ +declare class OrganizationRolesCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Role[]; +} + +/** + * The schema for a role-key association + */ +declare const RoleKeyAssociationSchema: TObject<{ + roleId: TString; + organizationId: TString; + keyId: TString; +}>; +/** + * The schema for a role-user association + */ +declare const RoleUserAssociationSchema: TObject<{ + roleId: TString; + organizationId: TString; + userId: TString; +}>; +/** + * The schema for role associations + */ +declare const RoleAssociationsSchema: TObject<{ + keys: TArray; + users: TArray; +}>; +/** + * The role-key association type + */ +type RoleKeyAssociation = Static; +/** + * The role-user association type + */ +type RoleUserAssociation = Static; +/** + * The role associations type + */ +type RoleAssociations = Static; +/** + * The input for the role associations command + */ +interface RoleAssociationsInput { + /** The role id */ + roleId: string; +} +/** + * Fetch associations for a role + */ +declare class RoleAssociationsCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): RoleAssociations; +} + +/** + * The input for the user roles command + */ +interface UserRolesInput { + /** The user id */ + userId: string; + /** The optional organization id */ + organizationId?: string; +} +/** + * Fetch roles for a user + */ +declare class UserRolesCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Role[]; +} + +/** + * The schema for a key role link response + */ +declare const KeyRoleLinkSchema: TObject<{ + roleId: TString; + organizationId: TString; + keyId: TString; +}>; +/** + * The key role link response type + */ +type KeyRoleLink = Static; +/** + * The input for the link key role command + */ +interface LinkKeyRoleInput { + /** The key id */ + keyId: string; + /** The role id */ + roleId: string; +} +/** + * Link a role to a key + */ +declare class LinkKeyRoleCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body + */ + protected getBody(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): KeyRoleLink; +} + +/** + * The schema for a user role link response + */ +declare const UserRoleLinkSchema: TObject<{ + roleId: TString; + organizationId: TString; + userId: TString; +}>; +/** + * The user role link response type + */ +type UserRoleLink = Static; +/** + * The input for the link user role command + */ +interface LinkUserRoleInput { + /** The user id */ + userId: string; + /** The role id */ + roleId: string; +} +/** + * Link a role to a user + */ +declare class LinkUserRoleCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body + */ + protected getBody(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): UserRoleLink; +} + +/** + * The input for the unlink key role command + */ +interface UnlinkKeyRoleInput { + /** The key id */ + keyId: string; + /** The role id */ + roleId: string; +} +/** + * Unlink a role from a key + */ +declare class UnlinkKeyRoleCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body + */ + protected getBody(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): KeyRoleLink; +} + +/** + * The input for the unlink user role command + */ +interface UnlinkUserRoleInput { + /** The user id */ + userId: string; + /** The role id */ + roleId: string; +} +/** + * Unlink a role from a user + */ +declare class UnlinkUserRoleCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body + */ + protected getBody(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): UserRoleLink; +} + +/** + * The input for the role list command + */ +interface RoleListInput { + /** Optional organization id to filter by */ + organizationId?: string; +} +/** + * List roles for the current user + */ +declare class RoleListCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Role[]; +} + +/** + * The input for the role archive command + */ +interface RoleArchiveInput { + /** The role id */ + roleId: string; +} +/** + * The schema for the archive role response + */ +declare const ArchiveRoleResponseSchema: TObject<{ + message: TString; +}>; +/** + * The archive role response type + */ +type ArchiveRoleResponse = Static; +/** + * Archive a role by ID + */ +declare class RoleArchiveCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ArchiveRoleResponse; +} + +/** + * The input for the role get command + */ +interface RoleGetInput { + /** The role id */ + roleId: string; +} +/** + * Get a role by ID + */ +declare class RoleGetCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Role; +} + +/** + * The input for the role update command + */ +interface RoleUpdateInput { + /** The role id */ + roleId: string; + /** The organization id */ + organizationId: string; + /** The name of the role */ + name: string; + /** The description of the role */ + description?: string; + /** Whether the role is managed by Flowcore */ + flowcoreManaged?: boolean; +} +/** + * Update a role by ID + */ +declare class RoleUpdateCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body + */ + protected getBody(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Role; +} + +/** + * Audit log entry type + */ +declare const AuditLogEntrySchema: TObject<{ + id: TString; + event: TString; + resourceName: TString; + performedBy: TUnion<[TString, TObject, TNull]>; + timestamp: TString; + status: TString; +}>; +/** + * Pagination information + */ +declare const PaginationSchema: TObject<{ + page: TNumber; + pageSize: TNumber; + totalItems: TNumber; + totalPages: TNumber; +}>; +/** + * Audit log response schema + */ +declare const AuditLogResponseSchema: TObject<{ + logs: TArray; + pagination: typeof PaginationSchema; +}>; +/** + * Audit log entry type + */ +type AuditLogEntry = Static; +/** + * Pagination information + */ +type Pagination = Static; +/** + * Audit log response type + */ +type AuditLogResponse = Static; +/** + * The input for the tenant audit logs command + */ +interface TenantAuditLogsInput { + /** The tenant id */ + tenantId: string; + /** Page number (1-based) */ + page?: number; + /** Page size */ + pageSize?: number; + /** Filter by resource type */ + resourceType?: string; + /** Filter by user who performed the action */ + performedBy?: string; + /** Filter by status (success or failure) */ + status?: "success" | "failure"; + /** Filter by start date */ + startDate?: string; + /** Filter by end date */ + endDate?: string; +} +/** + * Fetch audit logs for a tenant + */ +declare class TenantAuditLogsCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): AuditLogResponse; +} + +/** + * The mode of validation + */ +type ValidationMode = "tenant" | "organization"; +/** + * The validation request access item + */ +interface ValidationRequestAccessItem { + action: string; + resource: string[]; +} +/** + * The schema for a valid policy + */ +declare const ValidPolicySchema: TObject<{ + policyFrn: TString; + statementId: TString; +}>; +/** + * The schema for a validation response + */ +declare const ValidationResponseSchema: TObject<{ + valid: TBoolean; + checksum: TString; + validPolicies: TArray; +}>; +/** + * The valid policy type + */ +type ValidPolicy = Static; +/** + * The validation response type + */ +type ValidationResponse = Static; +/** + * The input for the user validation command + */ +interface ValidateUserInput { + /** The user id */ + userId: string; + /** The mode of validation */ + mode: ValidationMode; + /** The requested access */ + requestedAccess: ValidationRequestAccessItem[]; +} +/** + * Validate if a user can perform actions + */ +declare class ValidateUserCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body + */ + protected getBody(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ValidationResponse; +} + +/** + * The input for the key validation command + */ +interface ValidateKeyInput { + /** The key id */ + keyId: string; + /** The mode of validation */ + mode: ValidationMode; + /** The requested access */ + requestedAccess: ValidationRequestAccessItem[]; +} +/** + * Validate if a key can perform actions + */ +declare class ValidateKeyCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body + */ + protected getBody(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ValidationResponse; +} + +interface EntitlementRequestAccessItem { + action: string | string[]; + resource: string[]; +} +declare const EntitlementResponseSchema: _sinclair_typebox.TObject<{ + valid: _sinclair_typebox.TLiteral; + requestChecksum: _sinclair_typebox.TString; + entitlementChecksum: _sinclair_typebox.TString; + cacheTtlSeconds: _sinclair_typebox.TNumber; + entitlements: _sinclair_typebox.TArray<_sinclair_typebox.TObject<{ + requestIndex: _sinclair_typebox.TNumber; + grants: _sinclair_typebox.TArray<_sinclair_typebox.TObject<{ + policyFrn: _sinclair_typebox.TString; + statementId: _sinclair_typebox.TString; + resource: _sinclair_typebox.TString; + filters: _sinclair_typebox.TOptional<_sinclair_typebox.TArray<_sinclair_typebox.TUnion<[_sinclair_typebox.TObject<{ + path: _sinclair_typebox.TString; + operator: _sinclair_typebox.TLiteral<"equals">; + value: _sinclair_typebox.TUnion<[_sinclair_typebox.TString, _sinclair_typebox.TNumber, _sinclair_typebox.TBoolean, _sinclair_typebox.TNull]>; + }>, _sinclair_typebox.TObject<{ + path: _sinclair_typebox.TString; + operator: _sinclair_typebox.TLiteral<"oneOf">; + values: _sinclair_typebox.TArray<_sinclair_typebox.TUnion<[_sinclair_typebox.TString, _sinclair_typebox.TNumber, _sinclair_typebox.TBoolean, _sinclair_typebox.TNull]>>; + }>, _sinclair_typebox.TObject<{ + path: _sinclair_typebox.TString; + operator: _sinclair_typebox.TLiteral<"exists">; + value: _sinclair_typebox.TBoolean; + }>]>>>; + }>>; + }>>; +}>; +type EntitlementResponse = Static; +declare function parseEntitlementResponse(rawResponse: unknown): EntitlementResponse; +interface ResolveUserEntitlementsInput { + userId: string; + mode: "tenant" | "organization"; + requestedAccess: EntitlementRequestAccessItem[]; +} +declare class ResolveUserEntitlementsCommand extends Command { + protected retryOnFailure: boolean; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected getBody(): Record; + protected parseResponse(rawResponse: unknown): EntitlementResponse; +} + +interface ResolveKeyEntitlementsInput { + keyId: string; + mode: "tenant" | "organization"; + requestedAccess: EntitlementRequestAccessItem[]; +} +declare class ResolveKeyEntitlementsCommand extends Command { + protected retryOnFailure: boolean; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected getBody(): Record; + protected parseResponse(rawResponse: unknown): EntitlementResponse; +} + +/** + * Contracts for the Flowcore compute (container) service — + * `https://compute.api.flowcore.io`. + * + * UPSTREAM SOURCE: transcribed BY HAND from the zod contracts in + * `packages/contracts/src/compute/` of the `flowcore-io/flowcore-container-service` + * repository, together with the `c.json(...)` calls in the route handlers + * under `apps/compute-api/src/api/`, at `main` commit `d223298` + * ("feat(registries): registry detail with synthesis status, and deletion + * with in-cluster revocation (#39)"). + * + * The revision-history and deployment-event types below were transcribed + * later, from `compute/revisions.ts` and `compute/deployment-events.ts` plus + * `workload-revisions.list.ts` and `workload-events.list.ts`, at `main` commit + * `5c3858b` — the endpoints shipped in compute-api 1.11.0, after SDK 4.7.0 + * was cut. + * + * THERE IS NO GENERATOR AND NO DRIFT GUARD. Nothing in this repository fails + * when the service changes its contracts, so a change upstream has to be + * re-read into this file by hand against those two directories. + * + * TOLERANCE RULE, applied deliberately and uniformly: a field the upstream + * zod schema declares with `.default(...)` is `Type.Optional` here, even + * though the running service materializes it on every response (its + * projections are `.parse()`d before they are serialized). `parseResponseHelper` + * THROWS on an unexpected shape, so declaring such a field required would + * turn every call against a deployment that predates the field into an + * exception. Optional costs a consumer one `??`; required costs them an + * outage. Fields the upstream schema declares required without a default are + * required here. + * + * NO CREDENTIAL IS REPRESENTABLE IN ANY RESPONSE TYPE BELOW. The upstream + * `RegistrySchema` deliberately has no `secret`, no `encryptedAuthToken` and + * no `dockerconfigjson`; that omission is reproduced here on purpose and must + * not be "fixed". + */ +type TStringRecord = TRecord; +/** + * The body of a compute endpoint that answers `204 No Content` + * (domain detach, registry remove). + * + * `FlowcoreClient` substitutes `{ status: 204 }` for an empty body, so that + * synthetic object — not `undefined` — is what reaches `parseResponse`. + */ +type TComputeNoContent = TObject<{ + status: TNumber; +}>; +declare const ComputeNoContentSchema: TComputeNoContent; +type ComputeNoContent = Static; +/** Lifecycle state of a workload. A paused workload reports `stopped`. */ +type TComputeWorkloadStatus = TUnion<[ + TLiteral<"pending">, + TLiteral<"running">, + TLiteral<"stopped">, + TLiteral<"failed">, + TLiteral<"archived"> +]>; +declare const ComputeWorkloadStatusSchema: TComputeWorkloadStatus; +type ComputeWorkloadStatus = Static; +/** What a workload IS — a long-running service, or a run-to-completion task. Immutable after create. */ +type TComputeWorkloadKind = TUnion<[TLiteral<"service">, TLiteral<"job">]>; +declare const ComputeWorkloadKindSchema: TComputeWorkloadKind; +type ComputeWorkloadKind = Static; +/** Standardized compute slot tiers. */ +type TComputeSlotTier = TUnion<[ + TLiteral<"nano">, + TLiteral<"micro">, + TLiteral<"small">, + TLiteral<"medium">, + TLiteral<"large"> +]>; +declare const ComputeSlotTierSchema: TComputeSlotTier; +type ComputeSlotTier = Static; +/** Probe handler: HTTP GET. */ +type TComputeProbeHttpGet = TObject<{ + path: TOptional; + port: TNumber; + headers: TOptional; +}>; +declare const ComputeProbeHttpGetSchema: TComputeProbeHttpGet; +type ComputeProbeHttpGet = Static; +/** Probe handler: TCP socket — the safe default handler. */ +type TComputeProbeTcpSocket = TObject<{ + port: TNumber; +}>; +declare const ComputeProbeTcpSocketSchema: TComputeProbeTcpSocket; +type ComputeProbeTcpSocket = Static; +/** Probe handler: exec. */ +type TComputeProbeExec = TObject<{ + command: TArray; +}>; +declare const ComputeProbeExecSchema: TComputeProbeExec; +type ComputeProbeExec = Static; +/** + * One probe. Handler resolution order server-side is `httpGet`, then `exec`, + * then `tcpSocket`; with none given the fallback is a TCP dial of the + * workload's container port. + */ +type TComputeProbe = TObject<{ + httpGet: TOptional; + tcpSocket: TOptional; + exec: TOptional; + initialDelaySeconds: TOptional; + periodSeconds: TOptional; + timeoutSeconds: TOptional; + failureThreshold: TOptional; +}>; +declare const ComputeProbeSchema: TComputeProbe; +type ComputeProbe = Static; +/** The tri-probe specification of a workload. */ +type TComputeWorkloadProbes = TObject<{ + startup: TOptional; + readiness: TOptional; + liveness: TOptional; +}>; +declare const ComputeWorkloadProbesSchema: TComputeWorkloadProbes; +type ComputeWorkloadProbes = Static; +/** The pre-sync hook — a Job that must exit 0 before any pod is created. */ +type TComputePreSyncSpec = TObject<{ + name: TOptional; + image: TString; + command: TArray; + timeoutSeconds: TOptional; +}>; +declare const ComputePreSyncSpecSchema: TComputePreSyncSpec; +type ComputePreSyncSpec = Static; +/** + * How the replica count is decided. `manual` — the definition's `replicas` is + * the count. `hpa` — a HorizontalPodAutoscaler owns it between + * `minReplicas` and `maxReplicas`. + */ +type TComputeWorkloadScalingMode = TUnion<[TLiteral<"manual">, TLiteral<"hpa">]>; +declare const ComputeWorkloadScalingModeSchema: TComputeWorkloadScalingMode; +type ComputeWorkloadScalingMode = Static; +/** + * The scaling block of a workload definition. + * + * Every bound is optional at the schema level and required by mode instead: + * `minReplicas`/`maxReplicas` are meaningless under `manual` and mandatory + * under `hpa`. The service enforces the mode-dependent rules and answers 422. + */ +type TComputeWorkloadScaling = TObject<{ + mode: TOptional; + minReplicas: TOptional; + maxReplicas: TOptional; + targetCpuPercent: TOptional; + targetMemoryPercent: TOptional; +}>; +declare const ComputeWorkloadScalingSchema: TComputeWorkloadScaling; +type ComputeWorkloadScaling = Static; +/** One plain environment variable on a workload's container. */ +type TComputeWorkloadEnvVar = TObject<{ + name: TString; + value: TString; +}>; +declare const ComputeWorkloadEnvVarSchema: TComputeWorkloadEnvVar; +type ComputeWorkloadEnvVar = Static; +/** + * One environment variable bound to a key in the tenant's ORGANIZATION + * SECRETS. + * + * There is no value field, deliberately. The compute API cannot read an + * organization secret and never receives one: only the key name travels, and + * the value is bound inside the cluster from the organization secret store. + */ +type TComputeWorkloadSecretRef = TObject<{ + name: TString; + secretKey: TString; +}>; +declare const ComputeWorkloadSecretRefSchema: TComputeWorkloadSecretRef; +type ComputeWorkloadSecretRef = Static; +/** + * One persistent volume of a workload definition. + * + * The claim is ReadWriteOnce on the cluster's DEFAULT StorageClass — there + * is deliberately no class field, and provisioned `sizeGi` is the only + * billing dimension. A workload with volumes must run at most one replica + * under `scaling.mode: "manual"` (the service answers 422 otherwise), and + * `sizeGi` only ever GROWS: an update or rollback that would shrink a + * volume is refused, and volumes cannot be added, removed, renamed or + * remounted after create. Workload DELETE destroys the claims and their + * data. + */ +type TComputeWorkloadVolume = TObject<{ + name: TString; + sizeGi: TNumber; + mountPath: TString; +}>; +declare const ComputeWorkloadVolumeSchema: TComputeWorkloadVolume; +type ComputeWorkloadVolume = Static; +/** Everything the reconciler needs to build a Deployment, a Service and a pre-sync Job. */ +type TComputeWorkloadDefinition = TObject<{ + image: TString; + slotTier: TComputeSlotTier; + kind: TOptional; + replicas: TOptional; + port: TOptional; + probes: TOptional; + preSync: TOptional; + scaling: TOptional; + env: TOptional>; + secrets: TOptional>; + volumes: TOptional>; +}>; +declare const ComputeWorkloadDefinitionSchema: TComputeWorkloadDefinition; +type ComputeWorkloadDefinition = Static; +/** + * A container workload, as served by the API. + * + * `definition` is optional: a row written before the definition columns + * existed carries none of them. `activeRevision` advances only when the + * reconciler reports the mutation's operation succeeded — never at request + * time — so a failed pre-sync leaves it pointing at what is still serving. + */ +type TComputeWorkload = TObject<{ + id: TString; + tenantId: TString; + name: TString; + status: TComputeWorkloadStatus; + readyReplicas: TNumber; + reason: TOptional; + definition: TOptional; + activeRevision: TOptional; + rolledBackFrom: TOptional; + paused: TOptional; + createdAt: TString; + updatedAt: TString; +}>; +declare const ComputeWorkloadSchema: TComputeWorkload; +type ComputeWorkload = Static; +/** What produced one recorded execution. */ +type TComputeWorkloadRunKind = TUnion<[TLiteral<"batch">, TLiteral<"pre_sync">]>; +declare const ComputeWorkloadRunKindSchema: TComputeWorkloadRunKind; +type ComputeWorkloadRunKind = Static; +/** The lifecycle of one execution. A run whose poll window closes is `failed`. */ +type TComputeWorkloadRunStatus = TUnion<[TLiteral<"running">, TLiteral<"succeeded">, TLiteral<"failed">]>; +declare const ComputeWorkloadRunStatusSchema: TComputeWorkloadRunStatus; +type ComputeWorkloadRunStatus = Static; +/** One recorded execution — an on-demand batch run, or a pre-sync hook. */ +type TComputeWorkloadRun = TObject<{ + id: TString; + workloadId: TString; + tenantId: TString; + kind: TComputeWorkloadRunKind; + name: TString; + status: TComputeWorkloadRunStatus; + reason: TOptional; + operationId: TOptional; + startedAt: TString; + completedAt: TOptional; +}>; +declare const ComputeWorkloadRunSchema: TComputeWorkloadRun; +type ComputeWorkloadRun = Static; +/** + * A page of run history, newest first. BARE — this endpoint does not use the + * `{ success: true, ... }` envelope. + */ +type TComputeWorkloadRunList = TObject<{ + runs: TArray; + nextCursor: TOptional; +}>; +declare const ComputeWorkloadRunListSchema: TComputeWorkloadRunList; +type ComputeWorkloadRunList = Static; +/** `GET /api/v1/workloads` */ +type TComputeWorkloadListResponse = TObject<{ + success: TLiteral; + workloads: TArray; +}>; +declare const ComputeWorkloadListResponseSchema: TComputeWorkloadListResponse; +type ComputeWorkloadListResponse = Static; +/** `GET /api/v1/workloads/{workloadId}` and the legacy create command. */ +type TComputeWorkloadResponse = TObject<{ + success: TLiteral; + workload: TComputeWorkload; +}>; +declare const ComputeWorkloadResponseSchema: TComputeWorkloadResponse; +type ComputeWorkloadResponse = Static; +/** `POST /api/v1/workloads`, including the cluster-convergence operation. */ +type TComputeWorkloadCreateResponse = TObject<{ + success: TLiteral; + workload: TComputeWorkload; + operationId: TString; +}>; +declare const ComputeWorkloadCreateResponseSchema: TComputeWorkloadCreateResponse; +type ComputeWorkloadCreateResponse = Static; +/** The 202 of PATCH, rollback, pause and resume. */ +type TComputeWorkloadMutationResponse = TObject<{ + success: TLiteral; + workload: TComputeWorkload; + operationId: TString; +}>; +declare const ComputeWorkloadMutationResponseSchema: TComputeWorkloadMutationResponse; +type ComputeWorkloadMutationResponse = Static; +/** The 202 of `DELETE /api/v1/workloads/{workloadId}` — no workload body. */ +type TComputeWorkloadDeleteResponse = TObject<{ + success: TLiteral; + operationId: TString; +}>; +declare const ComputeWorkloadDeleteResponseSchema: TComputeWorkloadDeleteResponse; +type ComputeWorkloadDeleteResponse = Static; +/** The 202 of `POST /api/v1/workloads/{workloadId}/run`. */ +type TComputeWorkloadRunResponse = TObject<{ + success: TLiteral; + run: TComputeWorkloadRun; + runId: TString; + operationId: TString; +}>; +declare const ComputeWorkloadRunResponseSchema: TComputeWorkloadRunResponse; +type ComputeWorkloadRunResponse = Static; +/** Which pipe the line came out of. */ +type TComputeLogStreamName = TUnion<[TLiteral<"stdout">, TLiteral<"stderr">]>; +declare const ComputeLogStreamNameSchema: TComputeLogStreamName; +type ComputeLogStreamName = Static; +/** One indexed log line. */ +type TComputeLogEntry = TObject<{ + timestamp: TString; + podName: TString; + container: TString; + level: TString; + message: TString; + stream: TComputeLogStreamName; +}>; +declare const ComputeLogEntrySchema: TComputeLogEntry; +type ComputeLogEntry = Static; +/** Historical log response. BARE — no `{ success: true }` envelope. */ +type TComputeWorkloadLogs = TObject<{ + workloadId: TString; + container: TUnion<[TString, TNull]>; + totalMatches: TNumber; + logs: TArray; +}>; +declare const ComputeWorkloadLogsSchema: TComputeWorkloadLogs; +type ComputeWorkloadLogs = Static; +/** + * The `data:` payload of one `event: log` frame on the LIVE SSE stream + * (`GET /api/v1/workloads/{workloadId}/logs/stream`). + * + * Deliberately NOT unified with `ComputeLogEntry`: the service names the + * fields differently on the two surfaces (`pod`/`line` here, `podName`/ + * `message` on the indexed one), and collapsing them would rename a + * documented wire field. Heartbeat frames (`event: heartbeat`) carry a bare + * ISO-8601 string, not this shape, and are never surfaced as log events. + */ +type TComputeLogStreamEvent = TObject<{ + timestamp: TString; + pod: TString; + container: TString; + line: TString; +}>; +declare const ComputeLogStreamEventSchema: TComputeLogStreamEvent; +type ComputeLogStreamEvent = Static; +/** Lifecycle state of a domain binding. */ +type TComputeDomainStatus = TUnion<[ + TLiteral<"pending_verification">, + TLiteral<"ready">, + TLiteral<"failed">, + TLiteral<"detached"> +]>; +declare const ComputeDomainStatusSchema: TComputeDomainStatus; +type ComputeDomainStatus = Static; +/** How ownership of the hostname is established. */ +type TComputeDomainVerificationType = TUnion<[TLiteral<"cname">, TLiteral<"platform_wildcard">]>; +declare const ComputeDomainVerificationTypeSchema: TComputeDomainVerificationType; +type ComputeDomainVerificationType = Static; +/** DNS ownership block. */ +type TComputeDomainVerification = TObject<{ + type: TComputeDomainVerificationType; + expectedTarget: TString; + verified: TBoolean; +}>; +declare const ComputeDomainVerificationSchema: TComputeDomainVerification; +type ComputeDomainVerification = Static; +/** Certificate state, as OBSERVED from cert-manager. Never a request to issue. */ +type TComputeDomainTlsStatus = TUnion<[TLiteral<"pending_issuance">, TLiteral<"issued">, TLiteral<"failed">]>; +declare const ComputeDomainTlsStatusSchema: TComputeDomainTlsStatus; +type ComputeDomainTlsStatus = Static; +/** TLS block. `issuer` and `expiresAt` are omitted until cert-manager reports them. */ +type TComputeDomainTls = TObject<{ + status: TComputeDomainTlsStatus; + secretName: TString; + issuer: TOptional; + expiresAt: TOptional; +}>; +declare const ComputeDomainTlsSchema: TComputeDomainTls; +type ComputeDomainTls = Static; +/** A domain binding, as served by attach and list. */ +type TComputeDomain = TObject<{ + domainId: TString; + workloadId: TString; + hostname: TString; + targetPort: TNumber; + status: TComputeDomainStatus; + verification: TComputeDomainVerification; + tls: TComputeDomainTls; + createdAt: TString; +}>; +declare const ComputeDomainSchema: TComputeDomain; +type ComputeDomain = Static; +/** `GET /api/v1/workloads/{workloadId}/domains` — live bindings, oldest first. */ +type TComputeDomainListResponse = TObject<{ + success: TLiteral; + domains: TArray; +}>; +declare const ComputeDomainListResponseSchema: TComputeDomainListResponse; +type ComputeDomainListResponse = Static; +/** + * The verify response — deliberately NARROWER than `ComputeDomainSchema`: + * verify reports what was just observed, it does not restate the binding. + * BARE — no `{ success: true }` envelope. + */ +type TComputeDomainVerifyResponse = TObject<{ + domainId: TString; + hostname: TString; + status: TComputeDomainStatus; + verification: TComputeDomainVerification; + tls: TComputeDomainTls; +}>; +declare const ComputeDomainVerifyResponseSchema: TComputeDomainVerifyResponse; +type ComputeDomainVerifyResponse = Static; +/** What kind of asynchronous mutation an operation tracks. */ +type TComputeOperationType = TUnion<[ + TLiteral<"workload.deploy">, + TLiteral<"workload.update">, + TLiteral<"workload.rollback">, + TLiteral<"workload.archive">, + TLiteral<"workload.pause">, + TLiteral<"workload.resume">, + TLiteral<"workload.run"> +]>; +declare const ComputeOperationTypeSchema: TComputeOperationType; +type ComputeOperationType = Static; +/** Terminal states are `succeeded` and `failed`. */ +type TComputeOperationStatus = TUnion<[ + TLiteral<"pending">, + TLiteral<"in_progress">, + TLiteral<"succeeded">, + TLiteral<"failed"> +]>; +declare const ComputeOperationStatusSchema: TComputeOperationStatus; +type ComputeOperationStatus = Static; +/** Where in the mutation the reconciler currently is. */ +type TComputeOperationPhase = TUnion<[ + TLiteral<"queued">, + TLiteral<"pre_sync_running">, + TLiteral<"pre_sync_failed">, + TLiteral<"deploying">, + TLiteral<"rolling_out">, + TLiteral<"tearing_down">, + TLiteral<"pausing">, + TLiteral<"resuming">, + TLiteral<"running">, + TLiteral<"completed">, + TLiteral<"failed"> +]>; +declare const ComputeOperationPhaseSchema: TComputeOperationPhase; +type ComputeOperationPhase = Static; +/** The state of one step of an operation. */ +type TComputeOperationStepStatus = TUnion<[ + TLiteral<"pending">, + TLiteral<"running">, + TLiteral<"succeeded">, + TLiteral<"failed"> +]>; +declare const ComputeOperationStepStatusSchema: TComputeOperationStepStatus; +type ComputeOperationStepStatus = Static; +/** The pre-sync job attached to a deploy. */ +type TComputeOperationPreSyncProgress = TObject<{ + name: TString; + status: TComputeOperationStepStatus; + startedAt: TOptional; + completedAt: TOptional; +}>; +declare const ComputeOperationPreSyncProgressSchema: TComputeOperationPreSyncProgress; +type ComputeOperationPreSyncProgress = Static; +/** Rolling-deployment replica counters. */ +type TComputeOperationDeploymentProgress = TObject<{ + desiredReplicas: TNumber; + updatedReplicas: TNumber; + readyReplicas: TNumber; +}>; +declare const ComputeOperationDeploymentProgressSchema: TComputeOperationDeploymentProgress; +type ComputeOperationDeploymentProgress = Static; +/** Progress detail of an operation. */ +type TComputeOperationProgress = TObject<{ + preSync: TOptional; + deployment: TOptional; +}>; +declare const ComputeOperationProgressSchema: TComputeOperationProgress; +type ComputeOperationProgress = Static; +/** An operation, as served by `GET /api/v1/operations/{operationId}`. BARE — no envelope. */ +type TComputeOperation = TObject<{ + operationId: TString; + workloadId: TString; + type: TComputeOperationType; + status: TComputeOperationStatus; + phase: TComputeOperationPhase; + progress: TComputeOperationProgress; + reason: TOptional; + createdAt: TString; + updatedAt: TString; +}>; +declare const ComputeOperationSchema: TComputeOperation; +type ComputeOperation = Static; +/** Why a revision exists. */ +type TComputeWorkloadRevisionCause = TUnion<[TLiteral<"created">, TLiteral<"update">, TLiteral<"rollback">]>; +declare const ComputeWorkloadRevisionCauseSchema: TComputeWorkloadRevisionCause; +type ComputeWorkloadRevisionCause = Static; +/** + * One recorded revision of a workload's definition. + * + * `outcome` IS OPTIONAL, AND THAT IS THE CONTRACT — not a tolerance. Upstream + * reports it at three levels of knowledge: + * + * - the joined operation's status, when there is an operation row; + * - `pending`, when the revision names an operation whose row has not + * arrived yet; + * - ABSENT, when the revision names no operation at all. + * + * The third case covers historical `created` revisions written before create + * operations were API-minted. Declaring `outcome` required here would make + * `parseResponseHelper` throw while reading those replayed rows. + * + * `slotTier` is absent on a row recorded before slot tiers were part of the + * definition contract — omitted rather than invented, upstream and here. + */ +type TComputeWorkloadRevision = TObject<{ + revision: TNumber; + image: TString; + slotTier: TOptional; + cause: TComputeWorkloadRevisionCause; + isActive: TBoolean; + rolledBackFrom: TOptional; + operationId: TOptional; + outcome: TOptional; + outcomeReason: TOptional; + createdAt: TString; +}>; +declare const ComputeWorkloadRevisionSchema: TComputeWorkloadRevision; +type ComputeWorkloadRevision = Static; +/** + * A page of revision history, NEWEST ORDINAL FIRST. BARE — this endpoint does + * not use the `{ success: true, ... }` envelope. + */ +type TComputeWorkloadRevisionList = TObject<{ + revisions: TArray; + nextCursor: TOptional; +}>; +declare const ComputeWorkloadRevisionListSchema: TComputeWorkloadRevisionList; +type ComputeWorkloadRevisionList = Static; +/** The object an event is about — a Deployment, ReplicaSet, Pod, Service, HPA or Job. */ +type TComputeDeploymentEventObject = TObject<{ + kind: TString; + name: TString; +}>; +declare const ComputeDeploymentEventObjectSchema: TComputeDeploymentEventObject; +type ComputeDeploymentEventObject = Static; +/** + * One cluster event, normalized across BOTH Kubernetes API groups. + * + * `type` is a plain string and NOT an enum: Kubernetes documents `Normal` and + * `Warning`, but the field is free-form on the wire and a narrower contract + * here would reject a value the cluster is entitled to send. + * + * `firstSeen` and `lastSeen` are optional because an event is entitled to + * carry neither — the modern group's series fields are absent on a + * single-occurrence event. + */ +type TComputeDeploymentEvent = TObject<{ + name: TString; + type: TString; + reason: TString; + message: TString; + count: TNumber; + object: TComputeDeploymentEventObject; + source: TOptional; + firstSeen: TOptional; + lastSeen: TOptional; +}>; +declare const ComputeDeploymentEventSchema: TComputeDeploymentEvent; +type ComputeDeploymentEvent = Static; +/** + * The workload's recent cluster events, most recently seen first. BARE — no + * `{ success: true, ... }` envelope, and UNPAGINATED by construction. + * + * AN EMPTY ARRAY IS A LEGITIMATE ANSWER, never an error: a workload the + * cluster has had nothing to say about — or nothing within the TTL — answers + * 200 with `events: []`. + */ +type TComputeWorkloadDeploymentEvents = TObject<{ + workloadId: TString; + events: TArray; +}>; +declare const ComputeWorkloadDeploymentEventsSchema: TComputeWorkloadDeploymentEvents; +type ComputeWorkloadDeploymentEvents = Static; +/** + * A registry, sanitized. + * + * THERE IS NO `secret` FIELD AND THERE MUST NEVER BE ONE. The upstream + * contract has no credential-bearing field of any kind — plaintext, + * ciphertext or encoded — and the service's routes cannot return one. A + * credential is write-only and rotation-only. + */ +type TComputeRegistry = TObject<{ + registryId: TString; + name: TString; + serverUrl: TString; + username: TString; + isDefault: TBoolean; + createdAt: TString; + updatedAt: TString; +}>; +declare const ComputeRegistrySchema: TComputeRegistry; +type ComputeRegistry = Static; +/** + * Whether the credential became a working in-cluster pull Secret. + * + * Three values where the EVENT enum has two: `pending` is the projection's + * NULL — no report from the reconciler has arrived yet. + */ +type TComputeRegistrySynthesisState = TUnion<[TLiteral<"pending">, TLiteral<"synthesized">, TLiteral<"failed">]>; +declare const ComputeRegistrySynthesisStateSchema: TComputeRegistrySynthesisState; +type ComputeRegistrySynthesisState = Static; +/** The single-registry read: the sanitized registry plus its synthesis state. */ +type TComputeRegistryDetail = TObject<{ + registryId: TString; + name: TString; + serverUrl: TString; + username: TString; + isDefault: TBoolean; + createdAt: TString; + updatedAt: TString; + synthesisStatus: TComputeRegistrySynthesisState; + synthesisReason: TOptional; + synthesisAt: TOptional; +}>; +declare const ComputeRegistryDetailSchema: TComputeRegistryDetail; +type ComputeRegistryDetail = Static; +/** `GET /api/v1/registries` */ +type TComputeRegistryListResponse = TObject<{ + success: TLiteral; + registries: TArray; +}>; +declare const ComputeRegistryListResponseSchema: TComputeRegistryListResponse; +type ComputeRegistryListResponse = Static; +/** `GET /api/v1/registries/{registryId}` */ +type TComputeRegistryDetailResponse = TObject<{ + success: TLiteral; + registry: TComputeRegistryDetail; +}>; +declare const ComputeRegistryDetailResponseSchema: TComputeRegistryDetailResponse; +type ComputeRegistryDetailResponse = Static; + +/** + * The TLS request block on an attach for a custom hostname. + */ +interface ComputeDomainAttachTls { + /** Only ACME/Let's Encrypt via cert-manager exists */ + mode: "letsencrypt"; + /** The cert-manager ClusterIssuer (defaults to `letsencrypt-prod` server-side) */ + clusterIssuer?: string; +} +/** + * Attach a hostname the TENANT owns, proved with a CNAME. + */ +interface ComputeDomainAttachCustomInput { + /** The workload id (full UUID) */ + workloadId: string; + /** A lowercase fully qualified hostname, e.g. `api.acme.org`. Uppercase is REJECTED, not folded */ + hostname: string; + /** The container port the ingress routes to */ + targetPort: number; + /** Certificate issuance options */ + tls?: ComputeDomainAttachTls; + /** Never set alongside `hostname` — the two branches are an XOR */ + subdomain?: never; +} +/** + * Attach a single label under the PLATFORM's wildcard zone. + * + * TENANT-SCOPED MINT: the served hostname is + * `-.` — the platform resolves the tenant's + * slug at attach time and suffixes it, so two tenants asking for the same + * subdomain never clash. The service answers 422 for a reserved subdomain + * (`www`, `flowcore`, `usable`), for a scoped label over 63 bytes and for + * an unresolvable tenant slug, and 409 when the tenant's active wildcard + * cap is reached. Bindings minted before scoping keep their stored + * hostnames. + */ +interface ComputeDomainAttachWildcardInput { + /** The workload id (full UUID) */ + workloadId: string; + /** A single lowercase DNS label — no dots, which would reach outside the platform zone */ + subdomain: string; + /** The container port the ingress routes to */ + targetPort: number; + /** Never set alongside `subdomain` — the two branches are an XOR */ + hostname?: never; + /** Never set for a wildcard subdomain — the platform's wildcard certificate already exists */ + tls?: never; +} +/** + * The input for the compute domain attach command — custom hostname XOR + * platform wildcard subdomain. + */ +type ComputeDomainAttachInput = ComputeDomainAttachCustomInput | ComputeDomainAttachWildcardInput; +/** + * Attach a custom domain or a platform wildcard subdomain to a workload. + * + * TWO SUCCESS CODES, both from an awaited write and both carrying the same + * BARE domain object (no `{ success: true }` envelope): + * - 201 for a wildcard subdomain — the platform owns the zone and the + * wildcard certificate already exists, so the binding is ready on return; + * - 202 for a custom hostname — the caller still has to publish the CNAME and + * cert-manager still has to issue. + * + * THERE IS NO `operationId` HERE, so this command has no `waitForOperation`. + * A custom hostname is followed up with `ComputeDomainVerifyCommand`, which is + * the surface that performs the live DNS and certificate check. + * + * Answers 409 when the hostname is already on a live binding, or when the + * workload is of kind `job` and has no Service to route to. + */ +declare class ComputeDomainAttachCommand extends Command { + /** + * Whether the command should retry on failure. + * + * FALSE: an attach mints a domain id, and a second attach of the same + * hostname answers 409 — a retry of an already-recorded request would + * surface that conflict as the caller's answer. + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body for the request. + * + * OVERRIDDEN BECAUSE BOTH BRANCHES OF THE UPSTREAM BODY ARE `.strict()` — + * that is exactly what makes the union a real XOR. The base implementation + * would send `workloadId` (a path parameter) inside the JSON, which matches + * NEITHER branch, so every call would be 422. + */ + protected getBody(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ComputeDomain; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The input for the compute domain detach command + */ +interface ComputeDomainDetachInput { + /** The workload id (full UUID) */ + workloadId: string; + /** The domain binding id (full UUID) */ + domainId: string; +} +/** + * Detach a domain from a workload. + * + * Answers `204 No Content`. The service awaits its own write before + * responding, so on return the hostname is already attachable again; the + * in-cluster reconciler removes the Ingress rule and Certificate + * asynchronously. The projection row is MARKED detached, never deleted. + * + * `FlowcoreClient` substitutes `{ status: 204 }` for the empty body, and that + * synthetic object is what this command returns. + */ +declare class ComputeDomainDetachCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body for the request. The route takes NO body. + */ + protected getBody(): undefined; + /** + * Parse the response. + * + * The endpoint answers 204 with an EMPTY body, which `FlowcoreClient` turns + * into `{ status: 204 }` before it reaches here — so this schema describes + * that synthetic object, not anything the service serialized. + */ + protected parseResponse(rawResponse: unknown): ComputeNoContent; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The input for the compute domain list command + */ +interface ComputeDomainListInput { + /** The workload id (full UUID) */ + workloadId: string; +} +/** + * List the domains attached to a workload, oldest first. + * + * LIVE bindings only — a detached binding leaves the list rather than being + * hidden behind a flag — and served entirely from the projection: this + * endpoint performs no DNS lookup and reads no cluster state. Use + * `ComputeDomainVerifyCommand` for a fresh observation. A workload with no + * domains answers 200 with an empty array. + * + * Response envelope: `{ success: true, domains: [...] }`, unwrapped here. + */ +declare class ComputeDomainListCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ComputeDomain[]; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The input for the compute domain verify command + */ +interface ComputeDomainVerifyInput { + /** The workload id (full UUID) */ + workloadId: string; + /** The domain binding id (full UUID) */ + domainId: string; +} +/** + * Verify DNS ownership and read the TLS certificate state. + * + * Resolves the domain's CNAME and reads the cert-manager Certificate + * READ-ONLY. This endpoint never issues a certificate and never mutates any + * Kubernetes resource. + * + * EVERY OBSERVED OUTCOME IS A 200, including the unhappy ones: a missing or + * mismatched CNAME is `verification.verified: false`, a certificate that is + * not ready yet is `tls.status: "pending_issuance"`, a failed issuance is + * `tls.status: "failed"`. Only a broken upstream changes the status code — + * 503 when DNS or the Kubernetes API is unreachable, 502 when either answers + * badly. + * + * The response is a BARE object, deliberately NARROWER than the domain object + * that attach and list return: verify reports what was just observed, it does + * not restate the binding. + */ +declare class ComputeDomainVerifyCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body for the request. The route takes NO body. + */ + protected getBody(): undefined; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ComputeDomainVerifyResponse; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The input for the compute operation fetch command + */ +interface ComputeOperationFetchInput { + /** The operation id (full UUID) */ + operationId: string; +} +/** + * Inspect an asynchronous workload mutation operation. + * + * The compute service answers 404 until the in-cluster reconciler files its + * FIRST progress report for the operation — the API mints the id and emits + * the event, but it holds no Kubernetes credentials and never seeds an + * operation row. A 404 shortly after a 202 therefore means "not yet", not + * "gone"; see `waitForComputeOperation`, which treats it that way. + * + * The response is a BARE operation object — this endpoint uses no + * `{ success: true, ... }` envelope. + */ +declare class ComputeOperationFetchCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ComputeOperation; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The input for the compute registry fetch command + */ +interface ComputeRegistryFetchInput { + /** The registry id (full UUID) */ + registryId: string; +} +/** + * Inspect a single registry, with whether its credential really reached the + * tenant's namespace. + * + * `synthesisStatus` is what the RECONCILER reported and nothing else: this + * route never probes the registry, never opens a credential and makes no + * outbound call. `pending` means no report has arrived yet. + * + * A REMOVED registry answers 404, not 410 — indistinguishable from an unknown + * one, which is the same non-disclosure property the 404-on-denial collapse + * gives. + * + * Response envelope: `{ success: true, registry: {...} }`, unwrapped here — + * note that register and rotate return the registry BARE instead. + */ +declare class ComputeRegistryFetchCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ComputeRegistryDetail; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The input for the compute registry list command + */ +interface ComputeRegistryListInput { + /** The tenant id (full UUID) */ + tenantId: string; +} +/** + * List a tenant's configured container image registries, sanitized. + * + * NO CREDENTIAL IS RETURNED, and none can be: the registry type has no + * `secret`, no encrypted token and no `dockerconfigjson` field. Credentials + * are write-only and rotation-only. A tenant with no registries answers 200 + * with an empty array. + * + * Response envelope: `{ success: true, registries: [...] }`, unwrapped here. + */ +declare class ComputeRegistryListCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ComputeRegistry[]; +} + +/** + * The input for the compute registry register command + */ +interface ComputeRegistryRegisterInput { + /** The tenant id (full UUID) — carried in the BODY, not the path */ + tenantId: string; + /** Human label for the registry entry */ + name: string; + /** + * The registry host as a container runtime addresses it, e.g. `ghcr.io` or + * `registry.internal:5000`. A SCHEME IS REJECTED rather than stripped, and + * so is uppercase — normalization is the caller's decision to make. + */ + serverUrl: string; + /** The robot account the pull credential belongs to */ + username: string; + /** + * The pull secret — a PAT, registry password or service principal secret, + * 8..4096 characters. + * + * WRITE-ONLY. It is sealed before it reaches the event payload and no + * endpoint on the service can read it back; rotation replaces it. It never + * appears in any response type in this SDK. + */ + secret: string; + /** Make this the tenant's default registry (defaults to false) */ + isDefault?: boolean; +} +/** + * Register container image registry credentials. + * + * Answers 201 with the registry READ BACK from the projection — SANITIZED, + * with no credential field of any kind. The service contacts no registry and + * creates no Kubernetes Secret; the in-cluster reconciler synthesizes the pull + * Secret asynchronously, and `ComputeRegistryFetchCommand` reports whether it + * succeeded. + * + * Answers 409 when a registry for the same `serverUrl` is already configured + * for the tenant. + * + * The body is `.strict()` upstream, but NO `getBody()` override is needed + * here: this route carries its tenancy in the body, so the command's input + * and the request body are the same object — there is no path parameter to + * strip. + * + * The response body is BARE, with no `{ success: true }` envelope — unlike + * the registry LIST and the registry DETAIL reads, which both use one. + */ +declare class ComputeRegistryRegisterCommand extends Command { + /** + * Whether the command should retry on failure. + * + * FALSE: a registration mints a registry id, and a second registration of + * the same `serverUrl` answers 409 — a retry of an already-recorded request + * would surface that conflict as the caller's answer. + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ComputeRegistry; +} + +/** + * The input for the compute registry remove command + */ +interface ComputeRegistryRemoveInput { + /** The registry id (full UUID) */ + registryId: string; +} +/** + * Remove a registry. + * + * Answers `204 No Content`. The service awaits its own write before + * responding, so on return the `serverUrl` is registrable again and a second + * DELETE answers 404. The row is TOMBSTONED, never deleted — the registration + * and every rotation stay readable for support. + * + * REMOVAL IS UNCONDITIONAL: no workload reference is checked and no new + * default is elected. Running pods are unaffected; a pull from that host fails + * only when the kubelet next pulls. The in-cluster credential is revoked by + * the reconciler asynchronously. + * + * `FlowcoreClient` substitutes `{ status: 204 }` for the empty body, and that + * synthetic object is what this command returns. + */ +declare class ComputeRegistryRemoveCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body for the request. The route takes NO body. + */ + protected getBody(): undefined; + /** + * Parse the response. + * + * The endpoint answers 204 with an EMPTY body, which `FlowcoreClient` turns + * into `{ status: 204 }` before it reaches here. + */ + protected parseResponse(rawResponse: unknown): ComputeNoContent; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The input for the compute registry rotate command + */ +interface ComputeRegistryRotateInput { + /** The registry id (full UUID) */ + registryId: string; + /** + * The NEW pull secret, 8..4096 characters. + * + * Rotation replaces the credential; it does not re-describe the registry. + * The previous secret is never returned and never becomes readable. + */ + secret: string; +} +/** + * Rotate a registry's credentials. + * + * Answers 200 with the sanitized registry read back from the projection, so + * `updatedAt` is the REAL rotation timestamp rather than a wall-clock guess. + * The in-cluster pull Secret is patched by the reconciler; no pod rolls. + * + * The response body is BARE, with no `{ success: true }` envelope. + */ +declare class ComputeRegistryRotateCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body for the request. + * + * OVERRIDDEN BECAUSE THE UPSTREAM BODY IS `.strict()` AND DELIBERATELY + * NARROW — `{ secret }` and nothing else, so that an attempt to smuggle a + * `serverUrl` or `isDefault` change through the rotation path is a 422. The + * base implementation would send `registryId`, a path parameter, inside the + * JSON and every call would be refused. + */ + protected getBody(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ComputeRegistry; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The input for the compute workload events list command + */ +interface ComputeWorkloadEventsListInput { + /** The workload id (full UUID) */ + workloadId: string; +} +/** + * List a workload's recent KUBERNETES deployment events, most recently seen + * first. + * + * These are cluster events, not Flowcore events: the workload's Deployment, + * Service and autoscaler, its ReplicaSets, its pods and its pre-sync and run + * Jobs, read live across both Kubernetes API groups, merged and deduplicated. + * The namespace and every object name are derived SERVER-SIDE from the + * workload projection, so there is deliberately no namespace or selector + * parameter here. + * + * NO PAGINATION, and none is needed: THE WINDOW IS THE CLUSTER'S. Kubernetes + * reaps events on its own TTL — roughly an hour on this platform — and nothing + * older survives; the service persists nothing to widen it. + * + * AN EMPTY `events` ARRAY IS A NORMAL ANSWER, not an error: a workload the + * cluster has had nothing to say about within the TTL answers 200 with an + * empty list. The response is a BARE object, with no `{ success: true }` + * envelope. + */ +declare class ComputeWorkloadEventsListCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ComputeWorkloadDeploymentEvents; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The input for the compute workload logs fetch command + */ +interface ComputeWorkloadLogsFetchInput { + /** The workload id (full UUID) */ + workloadId: string; + /** ISO-8601 lower bound */ + since?: string; + /** ISO-8601 upper bound */ + until?: string; + /** Free-text search over the message */ + search?: string; + /** Maximum number of lines, 1..1000 (defaults to 100 server-side) */ + limit?: number; + /** Restrict to one container by name */ + container?: string; +} +/** + * Query indexed historical container logs for a workload. + * + * The tenant namespace and the `flowcore.io/workload-id` pod label are derived + * SERVER-SIDE from the workload projection and cannot be widened by the + * caller, so there is deliberately no namespace or label parameter here. + * + * This is the HISTORICAL, indexed surface. The live SSE stream + * (`GET /api/v1/workloads/{workloadId}/logs/stream`) is NOT covered by this + * SDK — it needs a streaming transport this client does not have. + * + * The response is a BARE object, with no `{ success: true }` envelope. + */ +declare class ComputeWorkloadLogsFetchCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ComputeWorkloadLogs; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The input for the compute workload log stream command + */ +interface ComputeWorkloadLogStreamInput { + /** The workload id (full UUID) */ + workloadId: string; + /** Restrict to one container by name; defaults server-side to the pod's first container */ + container?: string; + /** How much history to replay before following, 0..1000 (defaults to 100 server-side) */ + tailLines?: number; +} +/** + * An active live log stream. + * + * Mirrors `ActiveStreamInterface` from `websocket-command.ts` — the SDK's + * existing streaming shape — minus `send`, because SSE is one-directional. + */ +interface ComputeWorkloadLogStream { + /** + * An Observable emitting one value per `event: log` frame, in wire order. + * + * Reading only STARTS on the first subscription, so no frame is dropped + * between the connection opening and the caller subscribing. From then on it + * is hot and shared: a second, later subscriber joins mid-stream and sees + * only what arrives after it. + * + * Completes when the server closes the stream or `disconnect()` is called, + * and errors if the stream breaks mid-flight. `event: heartbeat` frames keep + * the connection alive and are deliberately NOT emitted here. + */ + output$: Observable; + /** + * Closes the stream. Aborts the underlying fetch — the server sees the + * disconnect and tears down its upstream Kubernetes followers — and + * completes `output$`. Idempotent. + */ + disconnect(): void; +} +declare class ComputeWorkloadLogStreamCommand extends CustomCommand { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; + /** + * Custom execute method — opens the SSE connection and returns the stream + */ + protected customExecute(client: FlowcoreClient): Promise; +} + +/** + * The input for the compute workload revisions list command + */ +interface ComputeWorkloadRevisionsListInput { + /** The workload id (full UUID) */ + workloadId: string; + /** Page size (defaults to the service's own page size) */ + limit?: number; + /** Opaque cursor from a previous page's `nextCursor` */ + cursor?: string; +} +/** + * List a workload's revision history, newest ordinal first. + * + * Every definition the workload has ever been recorded with: the revision + * seeded at creation (`cause: "created"`), one per update and one per + * rollback. A rollback is a NEW revision carrying the ordinal it restored + * from — history is never edited. + * + * `outcome` is read from the operation that carried the revision to the + * cluster, so a revision recorded but never promoted (a failed pre-sync hook, + * say) is distinguishable from one merely superseded. IT IS ABSENT on a + * `created` revision, which mints no operation at all — check for it before + * reading it. + * + * PAGINATED, like `ComputeWorkloadRunsListCommand`: revision history is + * unbounded by construction and nothing ever removes a row. Feed `nextCursor` + * back as `cursor`; it is absent on the last page. The response is a BARE + * object, with no `{ success: true }` envelope. + */ +declare class ComputeWorkloadRevisionsListCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ComputeWorkloadRevisionList; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The input for the compute workload runs list command + */ +interface ComputeWorkloadRunsListInput { + /** The workload id (full UUID) */ + workloadId: string; + /** Page size, 1..200 (defaults to 50 server-side) */ + limit?: number; + /** Opaque cursor from a previous page's `nextCursor` */ + cursor?: string; +} +/** + * List a workload's run history, newest first. + * + * Every execution the platform has run for the workload: on-demand batch runs + * (`kind: "batch"`) AND the pre-sync hooks its creates, updates and rollbacks + * gated on (`kind: "pre_sync"`). + * + * PAGINATED, unlike `ComputeWorkloadListCommand` — run history is unbounded by + * construction and nothing ever removes a row. Feed `nextCursor` back as + * `cursor`; it is absent on the last page. The response is a BARE object, with + * no `{ success: true }` envelope. + */ +declare class ComputeWorkloadRunsListCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ComputeWorkloadRunList; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The input for the compute workload create command + */ +interface ComputeWorkloadCreateInput { + /** The tenant id (full UUID) */ + tenantId: string; + /** The name of the workload */ + name: string; + /** + * The full definition. `image` and `slotTier` are required — they have no + * safe default, so a request without them is 422. + */ + definition: ComputeWorkloadDefinition; +} +/** + * Create a workload. + * + * Answers 201 with the workload READ BACK from the projection, not a + * `{ status: "processing" }` stub: the service awaits its own + * `workload.created.0` write before responding. Revision 1 is active from + * birth. The cluster rollout that follows is observable through + * `ComputeWorkloadFetchCommand`. + * + * Response envelope: `{ success: true, workload: {...} }`, unwrapped here. + */ +declare class ComputeWorkloadCreateCommand extends Command { + /** + * Whether the command should retry on failure. + * + * FALSE: a create mints a workload id server-side, so a retried 502 would + * deploy the same workload twice. + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ComputeWorkload; +} + +/** + * Create a workload and retain the operation that carries it to the cluster. + * + * The original create command keeps returning only the workload for backward + * compatibility. New integrations should use this command so they can poll + * cluster convergence from the API-minted `operationId`. + */ +declare class ComputeWorkloadCreateTrackedCommand extends Command { + protected retryOnFailure: boolean; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected parseResponse(rawResponse: unknown): ComputeWorkloadCreateResponse; +} + +/** + * The default poll budget, in milliseconds (10 minutes). + * + * DELIBERATELY MUCH LONGER than the 25 seconds `DataCoreRequestDeleteCommand` + * allows itself. A compute mutation is a pre-sync hook (whose own timeout + * defaults to 300 seconds and may be set as high as 3600) followed by a + * rolling update, so 25 seconds would time out on a perfectly healthy deploy. + */ +declare const DEFAULT_COMPUTE_OPERATION_TIMEOUT_MS = 600000; +/** The default gap between polls, in milliseconds. */ +declare const DEFAULT_COMPUTE_OPERATION_POLL_INTERVAL_MS = 1000; +/** + * The wait options every 202-returning compute command accepts. + */ +interface ComputeOperationWaitOptions { + /** + * Poll `GET /api/v1/operations/{operationId}` until the operation reaches a + * terminal state before resolving (default: false) + */ + waitForOperation?: boolean; + /** + * How long to keep polling, in milliseconds + * (default: {@link DEFAULT_COMPUTE_OPERATION_TIMEOUT_MS}, 10 minutes) + */ + operationTimeoutMs?: number; + /** + * How long to sleep between polls, in milliseconds + * (default: {@link DEFAULT_COMPUTE_OPERATION_POLL_INTERVAL_MS}, 1 second) + */ + operationPollIntervalMs?: number; +} +/** + * The 202 body of PATCH, rollback, pause and resume, plus the terminal + * operation when `waitForOperation` was set. + */ +interface ComputeWorkloadMutationOutput { + /** Always true */ + success: true; + /** The workload as it stands NOW — the new revision is promoted by the cluster's verdict */ + workload: ComputeWorkload; + /** The operation the cluster convergence is tracked under (full UUID) */ + operationId: string; + /** The terminal operation. Present ONLY when `waitForOperation` was set */ + operation?: ComputeOperation; +} +/** + * The 202 body of `DELETE /api/v1/workloads/{workloadId}`, plus the terminal + * operation when `waitForOperation` was set. + */ +interface ComputeWorkloadDeleteOutput { + /** Always true */ + success: true; + /** The operation the teardown is tracked under (full UUID) */ + operationId: string; + /** The terminal operation. Present ONLY when `waitForOperation` was set */ + operation?: ComputeOperation; +} +/** + * The 202 body of `POST /api/v1/workloads/{workloadId}/run`, plus the + * terminal operation when `waitForOperation` was set. + */ +interface ComputeWorkloadRunOutput { + /** Always true */ + success: true; + /** The run row, already listed by `GET /runs` */ + run: ComputeWorkloadRun; + /** The run id (full UUID) */ + runId: string; + /** The operation the run is tracked under (full UUID) */ + operationId: string; + /** The terminal operation. Present ONLY when `waitForOperation` was set */ + operation?: ComputeOperation; +} +/** + * Poll a compute operation until it reaches a terminal state. + * + * Modelled on the `processResponse` loop of `DataCoreRequestDeleteCommand`, + * with TWO deliberate deviations from that template: + * + * 1. AN EARLY 404 IS "NOT YET", NOT "GONE". The compute API mints the + * operation id and emits the event, but the operation ROW is written by + * the `compute-operation.0/operation.updated.0` handler only once the + * in-cluster reconciler files its first progress report. Between the 202 + * and that report the endpoint answers 404, and treating that as a + * terminal answer would make every wait fail on a healthy deploy. So a + * `NotFoundException` is swallowed and the poll continues. + * + * 2. THE BUDGET IS LONGER AND CONFIGURABLE, AND EXHAUSTING IT THROWS. The + * delete template gives itself a hardcoded 25 seconds and then returns the + * original response as if nothing happened. A rolling update gated on a + * pre-sync hook routinely runs longer than that, and silently returning + * "done" for an operation still in flight is worse here than it is there: + * the caller's next action is usually to treat the new revision as live. + * So the budget defaults to 10 minutes, is overridable per call, and a + * timeout raises a {@link CommandError} naming the last state observed. + * + * A FAILED operation is RETURNED, not thrown: `failed` is a terminal answer + * to the question that was asked, and `reason` explains it. Only the absence + * of an answer within the budget is an error. + */ +declare function waitForComputeOperation(client: FlowcoreClient, commandName: string, operationId: string, options: ComputeOperationWaitOptions): Promise; + +/** + * The input for the compute workload delete command + */ +interface ComputeWorkloadDeleteInput extends ComputeOperationWaitOptions { + /** The workload id (full UUID) */ + workloadId: string; +} +/** + * Delete a workload and cascade its domain bindings. + * + * Answers 202 with the teardown's operation id and NO workload body. Every + * live domain binding is released first, then the workload leaves + * `GET /api/v1/workloads` immediately; the in-cluster reconciler removes the + * Deployment, the Service, the autoscaler and the Jobs asynchronously. + * + * `GET /api/v1/workloads/{workloadId}` keeps resolving the workload while the + * teardown runs, reporting it `archived`. + */ +declare class ComputeWorkloadDeleteCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body for the request. + * + * The route takes NO body. Left to the base implementation it would send + * the whole input — the path parameter and the client-side wait knobs — as + * JSON on a DELETE. + */ + protected getBody(): undefined; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ComputeWorkloadDeleteOutput; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; + /** + * Optionally wait for the teardown to finish + */ + protected processResponse(client: FlowcoreClient, response: ComputeWorkloadDeleteOutput): Promise; +} + +/** + * The input for the compute workload fetch command + */ +interface ComputeWorkloadFetchInput { + /** The workload id (full UUID) */ + workloadId: string; +} +/** + * Fetch a single workload. + * + * A DELETED workload is deliberately still served, reporting `archived`, so + * that a client holding the 202 of a delete can keep resolving it while the + * teardown runs. + * + * Response envelope: `{ success: true, workload: {...} }`, unwrapped here. + */ +declare class ComputeWorkloadFetchCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ComputeWorkload; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The input for the compute workload list command + */ +interface ComputeWorkloadListInput { + /** The tenant id (full UUID) */ + tenantId: string; +} +/** + * List a tenant's workloads, newest first. + * + * Deleted workloads are excluded server-side. The response is wrapped in the + * `{ success: true, workloads: [...] }` envelope; this command unwraps it. + */ +declare class ComputeWorkloadListCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ComputeWorkload[]; +} + +/** + * The input for the compute workload pause command + */ +interface ComputeWorkloadPauseInput extends ComputeOperationWaitOptions { + /** The workload id (full UUID) */ + workloadId: string; +} +/** + * Pause a workload, keeping its configuration. + * + * The reconciler patches ONLY the Deployment's `spec.replicas` to 0 — nothing + * is deleted and no definition field changes, so the workload reports status + * `stopped` with `paused: true` while its full configuration stays visible. + * A pause mints no revision, so it never appears in the rollback history. + * + * Answers 409 for a job-kind workload (it has no Deployment) and for a + * workload that is already paused. + */ +declare class ComputeWorkloadPauseCommand extends Command { + /** + * Whether the command should retry on failure. + * + * FALSE: a pause mints an operation id, and the service answers 409 to a + * second pause — a retry of an already-recorded request would surface that + * conflict as the caller's answer. + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body for the request. The route takes NO body. + */ + protected getBody(): undefined; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ComputeWorkloadMutationOutput; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; + /** + * Optionally wait for the scale-down to finish + */ + protected processResponse(client: FlowcoreClient, response: ComputeWorkloadMutationOutput): Promise; +} + +/** + * The input for the compute workload resume command + */ +interface ComputeWorkloadResumeInput extends ComputeOperationWaitOptions { + /** The workload id (full UUID) */ + workloadId: string; +} +/** + * Resume a paused workload unchanged. + * + * The reconciler runs the SAME tenant quota pre-flight a create runs before + * scaling the Deployment back: pausing frees the tenant's quota mechanically, + * so the headroom a resume needs may have been taken while it was paused. A + * REFUSED RESUME IS NOT AN ERROR ON THIS CALL — it still answers 202, and the + * operation then fails with the quota reason while the workload stays paused. + * Pass `waitForOperation: true` (or poll the operation) to see that outcome. + * + * Answers 409 for a job-kind workload and for a workload that is not paused. + */ +declare class ComputeWorkloadResumeCommand extends Command { + /** + * Whether the command should retry on failure. + * + * FALSE: a resume mints an operation id, and the service answers 409 to a + * second resume — a retry of an already-recorded request would surface that + * conflict as the caller's answer. + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body for the request. The route takes NO body. + */ + protected getBody(): undefined; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ComputeWorkloadMutationOutput; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; + /** + * Optionally wait for the scale-up to finish + */ + protected processResponse(client: FlowcoreClient, response: ComputeWorkloadMutationOutput): Promise; +} + +/** + * The input for the compute workload rollback command + */ +interface ComputeWorkloadRollbackInput extends ComputeOperationWaitOptions { + /** The workload id (full UUID) */ + workloadId: string; +} +/** + * Roll a workload back to its previous revision. + * + * History is append-only, so this APPENDS a revision rather than rewinding + * the counter: rolling back to revision 1 from revision 2 makes revision 3 + * active with revision 1's definition, and the workload then reports + * `activeRevision: 3, rolledBackFrom: 1`. + * + * Answers 409 when there is no earlier revision to restore. + */ +declare class ComputeWorkloadRollbackCommand extends Command { + /** + * Whether the command should retry on failure. + * + * FALSE: a rollback mints a revision and an operation id, and re-runs the + * target revision's pre-sync hook. + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body for the request. + * + * The route takes NO body — the target revision is derived server-side. + */ + protected getBody(): undefined; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ComputeWorkloadMutationOutput; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; + /** + * Optionally wait for the cluster to converge + */ + protected processResponse(client: FlowcoreClient, response: ComputeWorkloadMutationOutput): Promise; +} + +/** + * The input for the compute workload run command + */ +interface ComputeWorkloadRunInput extends ComputeOperationWaitOptions { + /** The workload id (full UUID) — must be a workload of kind `job` */ + workloadId: string; +} +/** + * Run a batch job workload on demand. + * + * The API mints BOTH the run id (which names the Kubernetes Job, `run-`) + * and the operation id, and awaits its own write, so the 202 names a run that + * `ComputeWorkloadRunsListCommand` already lists. The reconciler then runs the + * tenant's quota pre-flight, creates the Job and polls it to completion. + * + * Answers 409 for a service-kind workload. + */ +declare class ComputeWorkloadRunCommand extends Command { + /** + * Whether the command should retry on failure. + * + * FALSE: a run mints a run id and spends the tenant's compute quota, so a + * retried 502 would start the job twice. + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body for the request. The route takes NO body. + */ + protected getBody(): undefined; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ComputeWorkloadRunOutput; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; + /** + * Optionally wait for the run to reach a terminal state + */ + protected processResponse(client: FlowcoreClient, response: ComputeWorkloadRunOutput): Promise; +} + +/** + * The input for the compute workload update command + */ +interface ComputeWorkloadUpdateInput extends ComputeOperationWaitOptions { + /** The workload id (full UUID) */ + workloadId: string; + /** New container image */ + image?: string; + /** New compute slot tier */ + slotTier?: ComputeSlotTier; + /** New replica count, 1..50. Zero is not accepted here — that is what pause is for */ + replicas?: number; + /** New container port */ + port?: number; + /** Replaces the probe block */ + probes?: ComputeWorkloadProbes; + /** Replaces the pre-sync hook */ + preSync?: ComputePreSyncSpec; + /** Replaces the scaling block WHOLESALE — it is not merged into the stored one */ + scaling?: ComputeWorkloadScaling; + /** + * Replaces the environment variables WHOLESALE, like `scaling` above. + * Sending `[]` CLEARS every variable the previous revision set — that is + * how a variable is removed, as there is no per-key patch. + */ + env?: ComputeWorkloadEnvVar[]; + /** Replaces the organization-secret bindings wholesale, same rule as `env` */ + secrets?: ComputeWorkloadSecretRef[]; + /** + * The volume list, GROWTH-ONLY: the same set of volumes (same names, same + * mount paths) with each `sizeGi` equal or larger. The service answers 422 + * to an add, a remove, a rename, a mountPath move or a shrink — volumes + * are declared at create and destroyed only by workload DELETE. + */ + volumes?: ComputeWorkloadVolume[]; +} +/** + * Update a workload's definition. + * + * Answers 202: the change is RECORDED as a new revision and the returned + * workload is the one still serving. The revision is promoted only when the + * reconciler reports the returned operation `succeeded`, so a workload whose + * pre-sync hook fails keeps reporting the previous image — poll the operation + * (or pass `waitForOperation: true`) before treating the new definition as + * live. + * + * Switching `scaling.mode` from `hpa` to `manual` additionally requires + * `replicas` in the same call; the service answers 422 without it. + */ +declare class ComputeWorkloadUpdateCommand extends Command { + /** + * Whether the command should retry on failure. + * + * FALSE. A PATCH looks idempotent and is not: each call MINTS A REVISION + * and an operation id server-side, and re-applying a revision re-runs the + * workload's pre-sync hook. A retried 502 whose original request had + * already been recorded would append a second identical revision and run + * the migration hook twice. + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body for the request. + * + * OVERRIDDEN BECAUSE THE UPSTREAM BODY IS `.strict()`. The base + * implementation sends the WHOLE input, which would put `workloadId` (a + * path parameter) and the client-side `waitForOperation` / + * `operationTimeoutMs` / `operationPollIntervalMs` knobs into the JSON — + * and every one of them is a key `UpdateWorkloadRequestSchema` does not + * list, so the service would answer 422 on the very first call. + */ + protected getBody(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ComputeWorkloadMutationOutput; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; + /** + * Optionally wait for the cluster to converge + */ + protected processResponse(client: FlowcoreClient, response: ComputeWorkloadMutationOutput): Promise; +} + +type Logger = { + debug: (message: string, meta?: Record) => void; + info: (message: string, meta?: Record) => void; + warn: (message: string, meta?: Record) => void; + error: (message: string | Error, meta?: Record) => void; +}; + +/** + * Represents an event notification from the Flowcore system + */ +type NotificationEvent = { + pattern: string; + data: { + tenant: string; + eventId: string; + dataCoreId: string; + flowType: string; + eventType: string; + validTime: string; + }; +}; +/** + * Interface for OIDC authentication client + */ +type OidcClient$1 = { + getToken: () => Promise<{ + accessToken: string; + }>; +}; +/** + * Configuration options for the NotificationClient + */ +type NotificationClientOptions = { + reconnectInterval: number; + maxReconnects?: number; + maxEvents?: number; + logger?: Logger; +}; +interface NotificationClientAuthOptionsBearer { + oidcClient: OidcClient$1; +} +interface NotificationClientAuthOptionsApiKey { + apiKey: string; + apiKeyId?: string; +} +type NotificationClientAuthOptions = NotificationClientAuthOptionsBearer | NotificationClientAuthOptionsApiKey; +/** + * Client for handling WebSocket connections to the Flowcore notification system. + * Manages connection lifecycle, authentication, and event handling. + */ +declare class NotificationClient { + private readonly observer; + private readonly authOptions; + private readonly subscriptionSpec; + private url; + private webSocket; + private options; + private logger; + private eventCount; + private reconnectInterval; + private reconnectAttempts; + private _isOpen; + private _isConnecting; + /** + * Which handshake carries the credential. + * + * `subprotocol` is tried first and is the one that does NOT put the + * credential in the URL. `query` is the legacy transport, kept only so this + * client still works against a server that has not shipped subprotocol + * support yet. + */ + private authTransport; + /** True once a handshake has settled, so the fallback is probed at most once. */ + private transportSettled; + /** + * Creates a new NotificationClient instance + * @param observer - RxJS Subject for emitting notification events + * @param authOptions - Auth options for the client + * @param subscriptionSpec - Specification for what notifications to subscribe to + * @param options - Configuration options for the client + */ + constructor(observer: Subject, authOptions: NotificationClientAuthOptions, subscriptionSpec: { + tenant: string; + dataCore: string; + flowType?: string; + eventType?: string; + }, options?: Partial); + /** + * Is the websocket connection open + */ + get isOpen(): boolean; + /** + * Is the websocket connection currently connecting + */ + get isConnecting(): boolean; + /** + * Establishes WebSocket connection and sets up event handlers + */ + connect(): Promise; + /** + * Decides WHERE the credential travels, for the transport currently selected. + * + * This is the whole security property of this client, isolated so it can be + * asserted directly: on the `subprotocol` transport the returned query is + * EMPTY. An ingress access log records the request line, so a credential in + * the query string is written to disk in plaintext and is readable by + * everyone with log access — for a long-lived `fc_` key that is a full + * tenant compromise sitting in a log index. + */ + private buildCredentialHandshake; + /** + * True when the subprotocol handshake has just failed for the first time. + * + * The fallback is probed at most ONCE per client. After it settles, a later + * failure is a real failure and goes through normal reconnect handling. + */ + private shouldFallBackToQueryTransport; + /** + * Switches to the legacy query-string transport and reconnects immediately. + * + * This does NOT count as a reconnect attempt: no backoff is consumed and the + * caller sees one continuous connection attempt. + */ + private fallBackToQueryTransport; + /** + * Parses and dispatches a single raw notification frame. + * + * Runs inside the WebSocket `onmessage` callback, where any thrown error is + * uncaught and crashes the host process. Notification frames can occasionally + * be malformed (non-JSON, empty/absent `message`, truncated payloads, or + * non-event control frames), so every parse is guarded — a bad frame is logged + * and skipped instead of taking down the whole connection/process. + */ + private handleMessage; + /** + * Attempts to reconnect to the WebSocket server using exponential backoff + */ + private attemptReconnect; + /** + * Closes the WebSocket connection + */ + disconnect(): void; + /** + * Overrides the base WebSocket URL for testing or different environments + * @param url - The new base URL to use + */ + overrideBaseUrl(url: string): void; +} + +/** + * Interface for OIDC authentication client (reused from NotificationClient context) + */ +type OidcClient = { + getToken: () => Promise<{ + accessToken: string; + }>; +}; +/** + * Configuration options for the WebSocketClient + */ +type WebSocketClientOptions = { + /** Interval between reconnect attempts (ms). Defaults to 1000. */ + reconnectInterval?: number; + /** Maximum number of reconnect attempts. Defaults to undefined (infinite). */ + maxReconnects?: number; + /** Optional logger instance. */ + logger?: Logger; +}; +interface MinimalWebSocket { + readyState: number; + onopen: (() => void) | null; + onmessage: ((event: { + data: string | ArrayBuffer | Buffer; + }) => void) | null; + onclose: ((event: { + code: number; + reason: string; + wasClean: boolean; + }) => void) | null; + onerror: ((event: Event) => void) | null; + send(data: string): void; + close(code?: number, reason?: string): void; +} +type WebSocketFactory = (url: string) => MinimalWebSocket; +/** + * Generic client for managing a single, persistent WebSocket connection based on a command. + * Handles connection lifecycle, authentication, reconnection, and message sending/receiving. + */ +declare class WebSocketClient { + private readonly authOptions; + private overrideBaseUrl; + private webSocket; + private options; + private logger; + private reconnectInterval; + private reconnectAttempts; + private _isOpen; + private _isConnecting; + private webSocketFactory; + private internalSubject; + private currentCommand; + private currentConfig; + /** + * Creates a new WebSocketClient instance. + * @param authOptions - Authentication options (Bearer token via OIDC client or API Key). + * @param options - Configuration options for the client. + * @param webSocketFactory - Optional WebSocket factory for testing. + */ + constructor(authOptions: ClientOptions, options?: WebSocketClientOptions, webSocketFactory?: WebSocketFactory); + /** + * Override the base URL provided by commands. + * @param baseUrl - The new base URL to use (e.g., "wss://staging-server.api.flowcore.io"). + */ + setBaseUrl(baseUrl: string): void; + /** + * Returns true if the WebSocket connection is currently open. + */ + get isOpen(): boolean; + /** + * Returns true if the client is currently attempting to establish a WebSocket connection. + */ + get isConnecting(): boolean; + /** + * Establishes WebSocket connection based on the provided command. + * Disconnects any existing connection before starting the new one. + * @param command - The command defining the stream connection details. + * @returns An interface to interact with the active stream. + */ + connect(command: WebSocketCommand): Promise>; + /** + * Sets up the WebSocket event handlers (onopen, onmessage, onclose, onerror). + */ + private setupEventHandlers; + /** + * Attempts to reconnect to the WebSocket server using exponential backoff. + * Requires `currentConfig` to be set. + */ + private attemptReconnect; + /** + * Sends a message to the currently connected WebSocket. + * @param message - The message object to send (e.g., { content: "user input" }). + */ + private sendMessage; + /** + * Closes the WebSocket connection gracefully. + */ + disconnect(): void; + /** + * Implements the Disposable interface for clean resource management. + */ + [Symbol.dispose](): void; +} + +/** + * An error thrown when the response from the server is invalid + */ +declare class InvalidResponseException extends Error { + readonly errors: Record; + constructor(message: string, errors: Record); +} + +/** + * An error thrown when a resource is not found + */ +declare class NotFoundException extends Error { + constructor(resource: string, filters: Record); +} + +/** + * An error thrown when the command fails + */ +declare class CommandError extends Error { + constructor(commandName: string, message: string); +} + +/** + * Helper method for parsing the response + */ +declare const parseResponseHelper: (schema: T, response: unknown) => Static; + +export { type ActiveStreamInterface, type AddContextItem, type AddContextItemsRequest, type AiStreamConfig, type ApiKey, ApiKeyCreateCommand, type ApiKeyCreateInput, ApiKeyDeleteCommand, type ApiKeyDeleteInput, ApiKeyEditCommand, type ApiKeyEditInput, ApiKeyFetchCommand, type ApiKeyFetchInput, ApiKeyListCommand, type ApiKeyListInput, ApiKeyValidateCommand, type ApiKeyValidateInput, ApiKeyValidateWithTenantIdCommand, type ApiKeyValidateWithTenantIdInput, type ApiKeyValidation, type ApiKeyWithValue, type ArchivePolicyResponse, ArchivePolicyResponseSchema, type ArchiveRoleResponse, ArchiveRoleResponseSchema, type Artifact, type ArtifactContentChunk, type ArtifactContentDeltaChunk, type ArtifactDataChunk, type ArtifactEndChunk, ArtifactGetCommand, type ArtifactGetCommandInput, type ArtifactStartChunk, type ArtifactUrlChunk, type AuditLogEntry, AuditLogEntrySchema, type AuditLogResponse, AuditLogResponseSchema, type AwsMarketplaceCustomer, type AwsMarketplaceCustomerResolve, AwsMarketplaceCustomerResolveCommand, type AwsMarketplaceCustomerResolveInput, type AwsMarketplaceDedicatedClusterType, type AwsMarketplaceLink, type AwsMarketplaceLinkCreate, AwsMarketplaceLinkCreateCommand, type AwsMarketplaceLinkCreateInput, type AwsMarketplaceLinkDelete, AwsMarketplaceLinkDeleteCommand, type AwsMarketplaceLinkDeleteInput, type AwsMarketplaceLinkFetch, AwsMarketplaceLinkFetchCommand, type AwsMarketplaceLinkFetchInput, type AwsMarketplaceLinkList, AwsMarketplaceLinkListCommand, type AwsMarketplaceLinkListInput, type AwsMarketplaceProductMode, type AwsMarketplaceProductProperties, ClientError, type ClientOptions, Command, CommandError, type ComputeDeploymentEvent, type ComputeDeploymentEventObject, ComputeDeploymentEventObjectSchema, ComputeDeploymentEventSchema, type ComputeDomain, ComputeDomainAttachCommand, type ComputeDomainAttachCustomInput, type ComputeDomainAttachInput, type ComputeDomainAttachTls, type ComputeDomainAttachWildcardInput, ComputeDomainDetachCommand, type ComputeDomainDetachInput, ComputeDomainListCommand, type ComputeDomainListInput, type ComputeDomainListResponse, ComputeDomainListResponseSchema, ComputeDomainSchema, type ComputeDomainStatus, ComputeDomainStatusSchema, type ComputeDomainTls, ComputeDomainTlsSchema, type ComputeDomainTlsStatus, ComputeDomainTlsStatusSchema, type ComputeDomainVerification, ComputeDomainVerificationSchema, type ComputeDomainVerificationType, ComputeDomainVerificationTypeSchema, ComputeDomainVerifyCommand, type ComputeDomainVerifyInput, type ComputeDomainVerifyResponse, ComputeDomainVerifyResponseSchema, type ComputeLogEntry, ComputeLogEntrySchema, type ComputeLogStreamEvent, ComputeLogStreamEventSchema, type ComputeLogStreamName, ComputeLogStreamNameSchema, type ComputeNoContent, ComputeNoContentSchema, type ComputeOperation, type ComputeOperationDeploymentProgress, ComputeOperationDeploymentProgressSchema, ComputeOperationFetchCommand, type ComputeOperationFetchInput, type ComputeOperationPhase, ComputeOperationPhaseSchema, type ComputeOperationPreSyncProgress, ComputeOperationPreSyncProgressSchema, type ComputeOperationProgress, ComputeOperationProgressSchema, ComputeOperationSchema, type ComputeOperationStatus, ComputeOperationStatusSchema, type ComputeOperationStepStatus, ComputeOperationStepStatusSchema, type ComputeOperationType, ComputeOperationTypeSchema, type ComputeOperationWaitOptions, type ComputePreSyncSpec, ComputePreSyncSpecSchema, type ComputeProbe, type ComputeProbeExec, ComputeProbeExecSchema, type ComputeProbeHttpGet, ComputeProbeHttpGetSchema, ComputeProbeSchema, type ComputeProbeTcpSocket, ComputeProbeTcpSocketSchema, type ComputeRegistry, type ComputeRegistryDetail, type ComputeRegistryDetailResponse, ComputeRegistryDetailResponseSchema, ComputeRegistryDetailSchema, ComputeRegistryFetchCommand, type ComputeRegistryFetchInput, ComputeRegistryListCommand, type ComputeRegistryListInput, type ComputeRegistryListResponse, ComputeRegistryListResponseSchema, ComputeRegistryRegisterCommand, type ComputeRegistryRegisterInput, ComputeRegistryRemoveCommand, type ComputeRegistryRemoveInput, ComputeRegistryRotateCommand, type ComputeRegistryRotateInput, ComputeRegistrySchema, type ComputeRegistrySynthesisState, ComputeRegistrySynthesisStateSchema, type ComputeSlotTier, ComputeSlotTierSchema, type ComputeWorkload, ComputeWorkloadCreateCommand, type ComputeWorkloadCreateInput, type ComputeWorkloadCreateResponse, ComputeWorkloadCreateResponseSchema, ComputeWorkloadCreateTrackedCommand, type ComputeWorkloadDefinition, ComputeWorkloadDefinitionSchema, ComputeWorkloadDeleteCommand, type ComputeWorkloadDeleteInput, type ComputeWorkloadDeleteOutput, type ComputeWorkloadDeleteResponse, ComputeWorkloadDeleteResponseSchema, type ComputeWorkloadDeploymentEvents, ComputeWorkloadDeploymentEventsSchema, type ComputeWorkloadEnvVar, ComputeWorkloadEnvVarSchema, ComputeWorkloadEventsListCommand, type ComputeWorkloadEventsListInput, ComputeWorkloadFetchCommand, type ComputeWorkloadFetchInput, type ComputeWorkloadKind, ComputeWorkloadKindSchema, ComputeWorkloadListCommand, type ComputeWorkloadListInput, type ComputeWorkloadListResponse, ComputeWorkloadListResponseSchema, type ComputeWorkloadLogStream, ComputeWorkloadLogStreamCommand, type ComputeWorkloadLogStreamInput, type ComputeWorkloadLogs, ComputeWorkloadLogsFetchCommand, type ComputeWorkloadLogsFetchInput, ComputeWorkloadLogsSchema, type ComputeWorkloadMutationOutput, type ComputeWorkloadMutationResponse, ComputeWorkloadMutationResponseSchema, ComputeWorkloadPauseCommand, type ComputeWorkloadPauseInput, type ComputeWorkloadProbes, ComputeWorkloadProbesSchema, type ComputeWorkloadResponse, ComputeWorkloadResponseSchema, ComputeWorkloadResumeCommand, type ComputeWorkloadResumeInput, type ComputeWorkloadRevision, type ComputeWorkloadRevisionCause, ComputeWorkloadRevisionCauseSchema, type ComputeWorkloadRevisionList, ComputeWorkloadRevisionListSchema, ComputeWorkloadRevisionSchema, ComputeWorkloadRevisionsListCommand, type ComputeWorkloadRevisionsListInput, ComputeWorkloadRollbackCommand, type ComputeWorkloadRollbackInput, type ComputeWorkloadRun, ComputeWorkloadRunCommand, type ComputeWorkloadRunInput, type ComputeWorkloadRunKind, ComputeWorkloadRunKindSchema, type ComputeWorkloadRunList, ComputeWorkloadRunListSchema, type ComputeWorkloadRunOutput, type ComputeWorkloadRunResponse, ComputeWorkloadRunResponseSchema, ComputeWorkloadRunSchema, type ComputeWorkloadRunStatus, ComputeWorkloadRunStatusSchema, ComputeWorkloadRunsListCommand, type ComputeWorkloadRunsListInput, type ComputeWorkloadScaling, type ComputeWorkloadScalingMode, ComputeWorkloadScalingModeSchema, ComputeWorkloadScalingSchema, ComputeWorkloadSchema, type ComputeWorkloadSecretRef, ComputeWorkloadSecretRefSchema, type ComputeWorkloadStatus, ComputeWorkloadStatusSchema, ComputeWorkloadUpdateCommand, type ComputeWorkloadUpdateInput, type ComputeWorkloadVolume, ComputeWorkloadVolumeSchema, ContainerRegistListCommand, ContainerRegistryCreateCommand, type ContainerRegistryCreateInput, type ContainerRegistryCreateOutput, ContainerRegistryDeleteCommand, type ContainerRegistryDeleteInput, ContainerRegistryFetchCommand, type ContainerRegistryFetchInput, type ContainerRegistryFetchTenantInput, ContainerRegistryUpdateCommand, type ContextAddItemChunk, ContextAddItemCommand, type ContextAddItemCommandInput, type ContextAddItemCommandOutput, type ContextItem, ContextRemoveItemCommand, type ContextRemoveItemCommandInput, type ContextRemoveItemCommandOutput, type ContextUpdateResponse, type Conversation, type ConversationCreatedChunk, ConversationDeleteCommand, type ConversationDeleteCommandInput, type ConversationDeleteCommandOutput, type ConversationDeleteResponse, ConversationGetCommand, type ConversationGetCommandInput, type ConversationGetCommandOutput, ConversationListCommand, type ConversationListCommandInput, type ConversationListCommandOutput, type ConversationListResponse, type ConversationMetadata, ConversationStreamCommand, type ConversationStreamConfig, type ConversationStreamSendPayload, CustomCommand, DEFAULT_COMPUTE_OPERATION_POLL_INTERVAL_MS, DEFAULT_COMPUTE_OPERATION_TIMEOUT_MS, type DataCore, DataCoreCreateCommand, type DataCoreCreateInput, DataCoreExistsCommand, type DataCoreExistsInput, type DataCoreExistsOutput, type DataCoreFetchByIdInput, type DataCoreFetchByNameAndTenantIdInput, type DataCoreFetchByNameAndTenantInput, DataCoreFetchCommand, type DataCoreFetchInput, DataCoreListCommand, type DataCoreListInput, DataCoreRequestDeleteCommand, type DataCoreRequestDeleteInput, type DataCoreRequestDeleteOutput, DataCoreUpdateCommand, type DataCoreUpdateInput, type DataPathway, type DataPathwayAssignment, DataPathwayAssignmentCompleteCommand, type DataPathwayAssignmentCompleteInput, DataPathwayAssignmentExpireLeasesCommand, type DataPathwayAssignmentExpireLeasesInput, DataPathwayAssignmentFetchCommand, type DataPathwayAssignmentFetchInput, DataPathwayAssignmentHeartbeatCommand, type DataPathwayAssignmentHeartbeatInput, type DataPathwayAssignmentList, DataPathwayAssignmentListCommand, type DataPathwayAssignmentListInput, type DataPathwayAssignmentNext, DataPathwayAssignmentNextCommand, type DataPathwayAssignmentNextInput, type DataPathwayCapacity, DataPathwayCapacityFetchCommand, type DataPathwayCapacityFetchInput, type DataPathwayCommand, DataPathwayCommandDispatchConfigUpdateCommand, type DataPathwayCommandDispatchConfigUpdateInput, DataPathwayCommandDispatchPauseCommand, type DataPathwayCommandDispatchPauseInput, DataPathwayCommandDispatchRestartCommand, type DataPathwayCommandDispatchRestartInput, DataPathwayCommandDispatchResumeCommand, type DataPathwayCommandDispatchResumeInput, DataPathwayCommandDispatchStopCommand, type DataPathwayCommandDispatchStopInput, DataPathwayCommandFetchCommand, type DataPathwayCommandFetchInput, type DataPathwayCommandList, DataPathwayCommandPendingByPathwayCommand, type DataPathwayCommandPendingByPathwayInput, DataPathwayCommandPendingCommand, type DataPathwayCommandPendingInput, type DataPathwayCommandResponse, DataPathwayCommandUpdateStatusByPathwayCommand, type DataPathwayCommandUpdateStatusByPathwayInput, DataPathwayCommandUpdateStatusCommand, type DataPathwayCommandUpdateStatusInput, DataPathwayCreateCommand, type DataPathwayCreateInput, DataPathwayDeleteCommand, type DataPathwayDeleteInput, DataPathwayDeliveryLogBatchCommand, type DataPathwayDeliveryLogBatchInput, DataPathwayDeliveryLogListCommand, type DataPathwayDeliveryLogListInput, DataPathwayDisableCommand, type DataPathwayDisableInput, type DataPathwayExpireLeasesResponse, DataPathwayFetchByNameCommand, type DataPathwayFetchByNameInput, DataPathwayFetchCommand, type DataPathwayFetchInput, DataPathwayHealthCheckCommand, type DataPathwayHealthCheckInput, type DataPathwayList, DataPathwayListCommand, type DataPathwayListInput, DataPathwayMetricsFetchCommand, type DataPathwayMetricsFetchInput, type DataPathwayMutationResponse, type DataPathwayPumpState, DataPathwayPumpStateFetchBySourceCommand, type DataPathwayPumpStateFetchBySourceInput, DataPathwayPumpStateFetchCommand, type DataPathwayPumpStateFetchInput, DataPathwayPumpStateSaveBySourceCommand, type DataPathwayPumpStateSaveBySourceInput, DataPathwayPumpStateSaveCommand, type DataPathwayPumpStateSaveInput, type DataPathwayPumpStateSaveResponse, type DataPathwayQuota, DataPathwayQuotaFetchCommand, type DataPathwayQuotaFetchInput, type DataPathwayQuotaList, DataPathwayQuotaListCommand, type DataPathwayQuotaListInput, DataPathwayQuotaSetCommand, type DataPathwayQuotaSetInput, type DataPathwayQuotaSetResponse, type DataPathwayQuotaWithUsage, DataPathwayRestartFetchCommand, type DataPathwayRestartFetchInput, type DataPathwayRestartRequest, DataPathwayRestartRequestCommand, type DataPathwayRestartRequestInput, type DataPathwayRestartRequestResponse, type DataPathwaySlot, DataPathwaySlotDeregisterCommand, type DataPathwaySlotDeregisterInput, DataPathwaySlotFetchCommand, type DataPathwaySlotFetchInput, DataPathwaySlotHeartbeatCommand, type DataPathwaySlotHeartbeatInput, type DataPathwaySlotList, DataPathwaySlotListCommand, type DataPathwaySlotListInput, type DataPathwaySlotMutationResponse, DataPathwaySlotRegisterCommand, type DataPathwaySlotRegisterInput, DataPathwayUpsertByNameCommand, type DataPathwayUpsertByNameInput, type DataPathwayUpsertByNameResponse, DataPathwayUpsertByNameResponseSchema, type EntitlementGrant, type EntitlementRequestAccessItem, type EntitlementResponse, EntitlementResponseSchema, type ErrorChunk, EventListCommand, type EventListInput, type EventListOutput, type EventType, EventTypeCreateCommand, type EventTypeCreateInput, EventTypeExistsCommand, type EventTypeExistsInput, type EventTypeExistsOutput, type EventTypeFetchByIdInput, type EventTypeFetchByNameInput, EventTypeFetchCommand, type EventTypeFetchInput, EventTypeInfoCommand, type EventTypeInfoInput, type EventTypeInfoOutput, EventTypeListCommand, type EventTypeListInput, EventTypeListRemovedSensitiveDataCommand, type EventTypeListRemovedSensitiveDataInput, EventTypeRemoveSensitiveDataCommand, type EventTypeRemoveSensitiveDataInput, EventTypeRequestDeleteCommand, type EventTypeRequestDeleteInput, type EventTypeRequestDeleteOutput, EventTypeRequestTruncateCommand, type EventTypeRequestTruncateInput, type EventTypeRequestTruncateOutput, EventTypeSchema, type EventTypeSensitiveDataMask, type EventTypeSensitiveDataMaskParsed, EventTypeSensitiveDataMaskParsedSchema, EventTypeSensitiveDataMaskSchema, EventTypeUpdateCommand, type EventTypeUpdateInput, EventsFetchCommand, type EventsFetchEventsInput, type EventsFetchEventsOutput, EventsFetchTimeBucketsByNamesCommand, type EventsFetchTimeBucketsByNamesInput, type EventsFetchTimeBucketsByNamesOutput, FetchPumpStatusCommand, type FetchPumpStatusInput, type FlowType, FlowTypeCreateCommand, type FlowTypeCreateInput, FlowTypeExistsCommand, type FlowTypeExistsInput, type FlowTypeExistsOutput, type FlowTypeFetchByIdInput, type FlowTypeFetchByNameInput, FlowTypeFetchCommand, type FlowTypeFetchInput, FlowTypeListCommand, type FlowTypeListInput, FlowTypeRequestDeleteCommand, type FlowTypeRequestDeleteInput, type FlowTypeRequestDeleteOutput, FlowTypeUpdateCommand, type FlowTypeUpdateInput, FlowcoreClient, type FlowcoreEvent, type InfoChunk, IngestBatchCommand, type IngestBatchInput, type IngestBatchOutput, IngestEventCommand, type IngestEventInput, type IngestEventOutput, InvalidResponseException, KeyPoliciesCommand, type KeyPoliciesInput, type KeyPolicyLink, KeyPolicyLinkSchema, type KeyRoleLink, KeyRoleLinkSchema, KeyRolesCommand, type KeyRolesInput, LinkKeyPolicyCommand, type LinkKeyPolicyInput, LinkKeyRoleCommand, type LinkKeyRoleInput, LinkRolePolicyCommand, type LinkRolePolicyInput, LinkUserPolicyCommand, type LinkUserPolicyInput, LinkUserRoleCommand, type LinkUserRoleInput, type MarkdownDeltaChunk, type Message, NotFoundException, NotificationClient, type NotificationClientOptions, type NotificationEvent, type OidcClient, OrganizationPoliciesCommand, type OrganizationPoliciesInput, OrganizationRolesCommand, type OrganizationRolesInput, type Pagination, PaginationSchema, type PathwayConfig, type Permission, PermissionsListCommand, type PermissionsListInput, type Policy, PolicyArchiveCommand, type PolicyArchiveInput, type PolicyAssociations, PolicyAssociationsCommand, type PolicyAssociationsInput, PolicyAssociationsSchema, PolicyCreateCommand, type PolicyCreateInput, type PolicyFilter, PolicyFilterSchema, type PolicyFilterValue, PolicyFilterValueSchema, PolicyGetCommand, type PolicyGetInput, type PolicyKeyAssociation, PolicyKeyAssociationSchema, PolicyListCommand, type PolicyListInput, type PolicyRoleAssociation, PolicyRoleAssociationSchema, PolicySchema, type PolicyStatement, PolicyStatementSchema, PolicyUpdateCommand, type PolicyUpdateInput, type PolicyUserAssociation, PolicyUserAssociationSchema, PolicyValidateCommand, type PolicyValidateInput, type PolicyValidateResponse, PolicyValidateResponseSchema, type PumpConfig, type RemoveContextItemRequest, ResolveKeyEntitlementsCommand, type ResolveKeyEntitlementsInput, ResolveUserEntitlementsCommand, type ResolveUserEntitlementsInput, type Role, RoleArchiveCommand, type RoleArchiveInput, type RoleAssociations, RoleAssociationsCommand, type RoleAssociationsInput, RoleAssociationsSchema, RoleCreateCommand, type RoleCreateInput, RoleGetCommand, type RoleGetInput, type RoleKeyAssociation, RoleKeyAssociationSchema, RoleListCommand, type RoleListInput, RolePoliciesCommand, type RolePoliciesInput, type RolePolicyLink, RolePolicyLinkSchema, RoleSchema, RoleUpdateCommand, type RoleUpdateInput, type RoleUserAssociation, RoleUserAssociationSchema, type Secret, SecretCreateCommand, type SecretCreateInput, SecretDeleteCommand, type SecretDeleteInput, SecretEditCommand, type SecretEditInput, SecretFetchCommand, type SecretFetchInput, SecretListCommand, type SecretListInput, type SecurityCreatePAT, SecurityCreatePATCommand, type SecurityDeletePAT, SecurityDeletePATCommand, type SecurityDeletePATResponse, type SecurityExchangePAT, SecurityExchangePATCommand, type SecurityExchangePATResponse, type SecurityGetPAT, SecurityGetPATCommand, SecurityListPATCommand, SendPumpPulseCommand, type SendPumpPulseInput, type SensitiveDataDefinition, SensitiveDataDefinitionSchema, type ServiceAccount, ServiceAccountCreateCommand, type ServiceAccountCreateInput, ServiceAccountDeleteCommand, type ServiceAccountDeleteInput, ServiceAccountEditCommand, type ServiceAccountEditInput, ServiceAccountFetchCommand, type ServiceAccountFetchInput, ServiceAccountListCommand, type ServiceAccountListInput, ServiceAccountRotateSecretCommand, type ServiceAccountRotateSecretInput, type ServiceAccountSecretRotation, type ServiceAccountWithSecret, type StreamChunk, type TComputeDeploymentEvent, type TComputeDeploymentEventObject, type TComputeDomain, type TComputeDomainListResponse, type TComputeDomainStatus, type TComputeDomainTls, type TComputeDomainTlsStatus, type TComputeDomainVerification, type TComputeDomainVerificationType, type TComputeDomainVerifyResponse, type TComputeLogEntry, type TComputeLogStreamEvent, type TComputeLogStreamName, type TComputeNoContent, type TComputeOperation, type TComputeOperationDeploymentProgress, type TComputeOperationPhase, type TComputeOperationPreSyncProgress, type TComputeOperationProgress, type TComputeOperationStatus, type TComputeOperationStepStatus, type TComputeOperationType, type TComputePreSyncSpec, type TComputeProbe, type TComputeProbeExec, type TComputeProbeHttpGet, type TComputeProbeTcpSocket, type TComputeRegistry, type TComputeRegistryDetail, type TComputeRegistryDetailResponse, type TComputeRegistryListResponse, type TComputeRegistrySynthesisState, type TComputeSlotTier, type TComputeWorkload, type TComputeWorkloadCreateResponse, type TComputeWorkloadDefinition, type TComputeWorkloadDeleteResponse, type TComputeWorkloadDeploymentEvents, type TComputeWorkloadEnvVar, type TComputeWorkloadKind, type TComputeWorkloadListResponse, type TComputeWorkloadLogs, type TComputeWorkloadMutationResponse, type TComputeWorkloadProbes, type TComputeWorkloadResponse, type TComputeWorkloadRevision, type TComputeWorkloadRevisionCause, type TComputeWorkloadRevisionList, type TComputeWorkloadRun, type TComputeWorkloadRunKind, type TComputeWorkloadRunList, type TComputeWorkloadRunResponse, type TComputeWorkloadRunStatus, type TComputeWorkloadScaling, type TComputeWorkloadScalingMode, type TComputeWorkloadSecretRef, type TComputeWorkloadStatus, type TComputeWorkloadVolume, type Tenant, TenantAuditLogsCommand, type TenantAuditLogsInput, TenantCreateCommand, type TenantCreateInput, TenantDisableSensitiveDataCommand, type TenantDisableSensitiveDataInput, type TenantDisableSensitiveDataResponse, TenantEnableSensitiveDataCommand, type TenantEnableSensitiveDataInput, type TenantEnableSensitiveDataResponse, type TenantFetchByIdInput, type TenantFetchByNameInput, TenantFetchCommand, type TenantFetchInput, type TenantInstance, type TenantInstanceFetchByIdInput, type TenantInstanceFetchByNameInput, TenantInstanceFetchCommand, type TenantInstanceFetchInput, TenantListCommand, type TenantListInput, type TenantPreview, TenantPreviewCommand, type TenantPreviewInput, type TenantTranslateNameToId, TenantTranslateNameToIdCommand, type TenantTranslateNameToIdInput, TenantTranslateNameToIdSchema, TenantUpdateCommand, type TenantUpdateInput, TenantUserAddCommand, type TenantUserAddInput, TenantUserListCommand, type TenantUserListInput, type TenantUserListOutput, TenantUserRemoveCommand, type TenantUserRemoveInput, TimeBucketListCommand, type TimeBucketListInput, type TimeBucketListOutput, type TitleUpdateChunk, type ToolErrorChunk, type ToolInputChunk, type ToolOutputChunk, type ToolStartChunk, UnlinkKeyPolicyCommand, type UnlinkKeyPolicyInput, UnlinkKeyRoleCommand, type UnlinkKeyRoleInput, UnlinkRolePolicyCommand, type UnlinkRolePolicyInput, UnlinkUserPolicyCommand, type UnlinkUserPolicyInput, UnlinkUserRoleCommand, type UnlinkUserRoleInput, UserDeleteCommand, type UserDeleteInput, type UserDeleteOutput, UserInitializeInKeycloakCommand, type UserInitializeInKeycloakInput, type UserInitializeInKeycloakOutput, UserInviteToTenantCommand, type UserInviteToTenantInput, type UserInviteToTenantOutput, type UserPermission, UserPermissionSchema, UserPermissionsCommand, type UserPermissionsInput, UserPoliciesCommand, type UserPoliciesInput, type UserPolicyLink, UserPolicyLinkSchema, type UserRoleLink, UserRoleLinkSchema, UserRolesCommand, type UserRolesInput, type ValidPolicy, ValidPolicySchema, ValidateKeyCommand, type ValidateKeyInput, ValidateUserCommand, type ValidateUserInput, type ValidationMode, type ValidationRequestAccessItem, type ValidationResponse, ValidationResponseSchema, type Variable, VariableCreateCommand, type VariableCreateInput, VariableDeleteCommand, type VariableDeleteInput, VariableEditCommand, type VariableEditInput, VariableFetchCommand, type VariableFetchInput, VariableListCommand, type VariableListInput, type VirtualConfig, WebSocketClient, type WebSocketClientOptions, type WebSocketCommand, isEncryptedPayload, matchesPolicyFilters, parseEntitlementResponse, parseResponseHelper, permitsPayload, waitForComputeOperation }; diff --git a/dist/index.d.ts b/dist/index.d.ts new file mode 100644 index 0000000..ff6c96d --- /dev/null +++ b/dist/index.d.ts @@ -0,0 +1,9738 @@ +import * as _sinclair_typebox from '@sinclair/typebox'; +import { TObject, Static, TString, TBoolean, TUnion, TNull, TLiteral, TOptional, TArray, TRecord, TUnknown, TNumber, TInteger, TProperties, TSchema } from '@sinclair/typebox'; +import { Observable, Subject } from 'rxjs'; +import { Buffer } from 'node:buffer'; + +/** + * An error thrown when the client request fails + */ +declare class ClientError extends Error { + readonly status: number; + readonly command: string; + readonly body?: unknown | undefined; + constructor(message: string, status: number, command: string, body?: unknown | undefined); +} + +/** + * The options for the bearer token + */ +interface ClientOptionsBearer { + getBearerToken: () => Promise | string | null; + /** + * The ID of the API key. + * @deprecated Use apiKey only instead (apiKeyId is only used for old api keys). + */ + apiKeyId?: never; + apiKey?: never; + retry?: { + delay: number; + maxRetries: number; + } | null; +} +/** + * The options for the api key + */ +interface ClientOptionsApiKey { + /** + * The ID of the API key. + * @deprecated Use apiKey only instead (apiKeyId is only used for old api keys). + */ + apiKeyId?: string; + apiKey: string; + getBearerToken?: never; + retry?: { + delay: number; + maxRetries: number; + } | null; +} +/** + * The options for the client + */ +type ClientOptions = ClientOptionsBearer | ClientOptionsApiKey; +/** + * A base client for executing commands + */ +declare class FlowcoreClient { + private readonly options; + private mode; + private baseUrl; + constructor(options: ClientOptions); + /** + * Get the auth header + * + * Public so that a `CustomCommand` which owns its own transport — a + * streaming request whose body must NOT be consumed by `innerExecute`'s + * unconditional `response.json()` — can authenticate its own fetch with + * exactly the header every other command sends. Read-only: it derives the + * header from the client options and mutates nothing. + */ + getAuthHeader(): Promise; + /** + * Execute a command (inner method) + */ + private innerExecute; + /** + * Override the base URL for all commands + */ + setBaseUrl(baseUrl: string): void; + /** + * Execute a command + */ + execute(command: Command, direct?: boolean): Promise; + /** + * Close the client and clean up resources + * This should be called when the client is no longer needed to prevent memory leaks + */ + close(): void; + /** + * Dispose the client + */ + [Symbol.dispose](): void; +} + +/** + * Abstract command for executing requests + */ +declare abstract class Command { + /** + * Whether the command should retry on failure + */ + protected readonly retryOnFailure: boolean; + /** + * The dedicated subdomain for the command + */ + protected readonly dedicatedSubdomain?: string; + /** + * The allowed modes for the command + */ + protected readonly allowedModes: ("apiKey" | "bearer")[]; + /** + * The input for the command + */ + protected readonly input: Input; + /** + * The client auth options + */ + protected readonly clientAuthOptions: { + token?: string; + apiKeyId?: string; + apiKey?: string; + }; + constructor(input: Input); + /** + * Set the client auth options - this is called by the FlowcoreClient + * before executing the command + */ + setClientAuthOptions(options: { + token?: string; + apiKeyId?: string; + apiKey?: string; + }): void; + /** + * Get the dedicated base URL + */ + protected getDedicatedBaseUrl(client: FlowcoreClient): Promise; + /** + * Get the base URL for the request + */ + protected abstract getBaseUrl(): string; + /** + * Get the method for the request + */ + protected getMethod(): string; + /** + * Get the path for the request + */ + protected getPath(): string; + /** + * Get the body for the request + */ + protected getBody(): Record | Array | undefined; + /** + * Get the headers for the request + */ + protected getHeaders(): Record; + /** + * Parse the response + */ + protected abstract parseResponse(response: unknown): Output; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; + /** + * Get the request object + */ + getRequest(client: FlowcoreClient, direct?: boolean): Promise<{ + allowedModes: ("apiKey" | "bearer")[]; + body: string | Record | Array | undefined; + headers: Record; + baseUrl: string; + path: string; + method: string; + parseResponse: (response: unknown) => Output | Promise; + processResponse: (client: FlowcoreClient, response: Output) => Promise; + handleClientError: (error: ClientError) => void; + retryOnFailure: boolean; + customExecute?: (client: FlowcoreClient) => Promise; + }>; + /** + * Wait for the response + */ + protected processResponse(_client: FlowcoreClient, response: Output): Promise; +} + +interface ArtifactGetCommandInput { + artifactId: string; +} +/** + * Represents the structure of the artifact returned by the API. + * Based on the Swagger spec example. + */ +declare const ArtifactSchema: TObject; +type Artifact = typeof ArtifactSchema.static; +declare class ArtifactGetCommand extends Command { + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected getHeaders(): Record; + protected parseResponse(rawResponse: unknown): Artifact; + protected handleClientError(error: ClientError): void; +} + +interface ContextItem { + type: "tenant" | "dataCore" | "flowType" | "eventType" | string; + id: string; + name: string; + description: string; +} +interface Message { + id: string; + role: "system" | "user" | "assistant"; + content: string; + timestamp: string; +} +interface ConversationMetadata { + id: string; + title: string; + lastUpdated: string; +} +interface Conversation extends ConversationMetadata { + context: ContextItem[]; + messages: Message[]; +} +interface ConversationListResponse { + conversations: ConversationMetadata[]; +} +interface ConversationDeleteResponse { + message: string; +} +interface ContextUpdateResponse { + context: ContextItem[]; +} +interface AddContextItem { + type: string; + id: string; +} +interface AddContextItemsRequest { + items: AddContextItem[]; +} +interface RemoveContextItemRequest { + itemId: string; +} + +/** + * Input for adding items to a conversation's context. + */ +type ContextAddItemCommandInput = { + /** The ID of the conversation to modify. */ + conversationId: string; + /** An array of context items (type and ID) to add. */ + items: AddContextItem[]; +}; +/** + * Output containing the updated context array after adding items. + */ +type ContextAddItemCommandOutput = ContextUpdateResponse; +/** + * Command to add one or more items to the context of a specific conversation. + */ +declare class ContextAddItemCommand extends Command { + protected getBaseUrl(): string; + protected getMethod(): string; + protected getPath(): string; + protected getBody(): Record; + protected parseResponse(response: unknown): ContextAddItemCommandOutput; +} + +/** + * Input for removing an item from a conversation's context. + */ +type ContextRemoveItemCommandInput = { + /** The ID of the conversation to modify. */ + conversationId: string; + /** The unique ID of the context item instance to remove. */ + itemId: string; +}; +/** + * Output containing the updated context array after removing the item. + */ +type ContextRemoveItemCommandOutput = ContextUpdateResponse; +/** + * Command to remove a specific item from the context of a conversation. + */ +declare class ContextRemoveItemCommand extends Command { + protected getBaseUrl(): string; + protected getMethod(): string; + protected getPath(): string; + protected getBody(): Record; + protected parseResponse(response: unknown): ContextRemoveItemCommandOutput; +} + +/** + * Input for deleting a specific conversation. + */ +type ConversationDeleteCommandInput = { + /** The unique ID of the conversation to delete. */ + conversationId: string; +}; +/** + * Output confirming the deletion of the conversation. + */ +type ConversationDeleteCommandOutput = ConversationDeleteResponse; +/** + * Command to delete a specific conversation by its ID. + */ +declare class ConversationDeleteCommand extends Command { + protected getBaseUrl(): string; + protected getMethod(): string; + protected getPath(): string; + protected parseResponse(response: unknown): ConversationDeleteCommandOutput; +} + +/** + * Input for fetching a specific conversation. + */ +type ConversationGetCommandInput = { + /** The unique ID of the conversation to fetch. */ + conversationId: string; +}; +/** + * Output containing the full details of the fetched conversation. + */ +type ConversationGetCommandOutput = Conversation; +/** + * Command to fetch the details of a specific conversation by its ID. + */ +declare class ConversationGetCommand extends Command { + protected getBaseUrl(): string; + protected getMethod(): string; + protected getPath(): string; + protected parseResponse(response: unknown): ConversationGetCommandOutput; + protected handleClientError(error: ClientError): void; +} + +/** + * Input for listing conversations. + * Currently empty as no filters are supported. + */ +type ConversationListCommandInput = Record; +/** + * Output containing a list of conversation metadata. + */ +type ConversationListCommandOutput = ConversationMetadata[]; +/** + * Command to list all conversations accessible by the user. + */ +declare class ConversationListCommand extends Command { + constructor(); + protected getBaseUrl(): string; + protected getMethod(): string; + protected getPath(): string; + protected parseResponse(response: unknown): ConversationListCommandOutput; +} + +/** + * Configuration for initiating an AI Agent Coordinator stream. + */ +interface AiStreamConfig { + /** The ID of the conversation to stream. */ + conversationId: string; +} +interface MarkdownDeltaChunk { + type: "markdown_delta"; + /** The chunk of markdown text. */ + content: string; +} +interface InfoChunk { + type: "info"; + /** An informational message. */ + message: string; +} +interface ErrorChunk { + type: "error"; + /** An error message. */ + message: string; +} +interface ToolStartChunk { + type: "tool_start"; + /** The name of the tool being executed. */ + tool_name: string; +} +interface ToolInputChunk { + type: "tool_input"; + /** The input provided to the tool (can be any JSON structure). */ + content: unknown; +} +interface ToolOutputChunk { + type: "tool_output"; + /** The output received from the tool (can be any JSON structure). */ + content: unknown; +} +interface ToolErrorChunk { + type: "tool_error"; + content: { + /** A summary error message. */ + error_message: string; + /** Optional additional details about the error. */ + details?: string | unknown; + }; +} +interface ContextAddItemChunk { + type: "context_add_item"; + /** The full context item that was added. */ + item: ContextItem; +} +interface TitleUpdateChunk { + type: "title_update"; + /** The new suggested title for the conversation. */ + title: string; +} +interface ArtifactStartChunk { + type: "artifact_start"; + artifactId: string; + artifactType: string; + title: string; +} +interface ArtifactContentDeltaChunk { + type: "artifact_content_delta"; + artifactId: string; + /** The chunk of artifact text content. */ + content: string; +} +interface ArtifactContentChunk { + type: "artifact_content"; + artifactId: string; + /** The complete artifact text content. */ + content: string; +} +interface ArtifactDataChunk { + type: "artifact_data"; + artifactId: string; + /** The complete JSON data for the artifact. */ + data: unknown; +} +interface ArtifactUrlChunk { + type: "artifact_url"; + artifactId: string; + /** The URL pointing to the artifact content. */ + url: string; +} +interface ArtifactEndChunk { + type: "artifact_end"; + artifactId: string; +} +interface ConversationCreatedChunk { + type: "conversation_created"; + /** The ID of the newly created conversation. */ + conversationId: string; +} +/** + * A discriminated union of all possible chunk types streamed from the backend. + */ +type StreamChunk = MarkdownDeltaChunk | InfoChunk | ErrorChunk | ToolStartChunk | ToolInputChunk | ToolOutputChunk | ToolErrorChunk | ContextAddItemChunk | TitleUpdateChunk | ArtifactStartChunk | ArtifactContentDeltaChunk | ArtifactContentChunk | ArtifactDataChunk | ArtifactUrlChunk | ArtifactEndChunk | ConversationCreatedChunk; + +/** + * Interface for a command that configures a WebSocket stream connection. + * @template Config - The type of the configuration data needed to initiate the stream. + * @template SendPayload - The type of data that can be sent *to* the stream after connection. + */ +interface WebSocketCommand { + /** + * Gets the configuration data needed to establish the connection. + */ + getConfig(): Config; + /** + * Gets the base WebSocket URL (e.g., wss://server.api.flowcore.io). + * @returns The base WebSocket URL string. + */ + getWebSocketBaseUrl(): string; + /** + * Gets the specific path segment for the WebSocket URL based on the config + * (e.g., /api/v1/stream/entity/{id}). + * @param config - The configuration object. + * @returns The path segment string. + */ + getWebSocketPathSegment(config: Config): string; + /** + * Serializes the payload to be sent over the WebSocket. + * Default implementation might be JSON.stringify. + * @param payload - The payload object to send. + * @returns The serialized string representation. + */ + serializeSendPayload?(payload: SendPayload): string; +} +/** + * Interface representing an active WebSocket stream connection. + * @template SendPayload - The type of data that can be sent to the stream. + */ +interface ActiveStreamInterface { + /** + * An Observable emitting the raw data chunks received from the WebSocket. + * Consumers should filter/map this observable based on the specific stream protocol. + */ + output$: Observable; + /** + * Sends a payload to the WebSocket stream. + * @param payload - The data to send, conforming to the SendPayload type. + * @returns True if the message was queued to be sent, false otherwise (e.g., socket not open). + */ + send(payload: SendPayload): boolean; + /** + * Disconnects the WebSocket stream gracefully. + */ + disconnect(): void; +} + +/** + * Configuration for the Conversation Stream. + * Only requires the conversationId. + */ +interface ConversationStreamConfig { + conversationId?: string; +} +/** + * Payload type for messages sent *to* the Conversation Stream. + */ +interface ConversationStreamSendPayload { + content: string; +} +/** + * Command to stream conversation events for a specific agent. + */ +declare class ConversationStreamCommand implements WebSocketCommand { + private config; + constructor(config: ConversationStreamConfig); + /** Get the configuration object for the command. */ + getConfig(): ConversationStreamConfig; + /** Get the base WebSocket URL. */ + getWebSocketBaseUrl(): string; + /** Get the WebSocket path segment. */ + getWebSocketPathSegment(): string; + /** Serializer function for outgoing payloads. */ + serializeSendPayload(payload: ConversationStreamSendPayload): string; +} + +/** + * The input for the tenant disable sensitive data command + */ +interface TenantDisableSensitiveDataInput { + /** The id of the tenant */ + tenantId: string; +} +interface TenantDisableSensitiveDataResponse { + sensitiveDataEnabled: boolean; +} +/** + * Disable Sensitive Data Feature for a tenant + */ +declare class TenantDisableSensitiveDataCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): TenantDisableSensitiveDataResponse; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The input for the tenant enable sensitive data command + */ +interface TenantEnableSensitiveDataInput { + /** The id of the tenant */ + tenantId: string; +} +interface TenantEnableSensitiveDataResponse { + sensitiveDataEnabled: boolean; +} +/** + * Enable Sensitive Data Feature for a tenant + */ +declare class TenantEnableSensitiveDataCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): TenantEnableSensitiveDataResponse; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The schema for a tenant + */ +declare const TenantSchema: TObject<{ + id: TString; + name: TString; + displayName: TString; + description: TString; + websiteUrl: TString; + isDedicated: TBoolean; + dedicated: TUnion<[ + TNull, + TObject<{ + status: TUnion<[ + TLiteral<"ready">, + TLiteral<"degraded">, + TLiteral<"offline"> + ]>; + configuration: TObject<{ + domain: TString; + configurationRepoUrl: TString; + configurationRepoCredentials: TUnion<[TString, TNull]>; + }>; + }> + ]>; + sensitiveDataEnabled: TOptional; +}>; +/** + * The type for a tenant + */ +type Tenant = Static; +/** + * The schema for a tenant list item + */ +declare const TenantListItemSchema: TObject<{ + id: TString; + name: TString; + displayName: TString; + description: TString; + websiteUrl: TString; + isDedicated: TBoolean; + sensitiveDataEnabled: TBoolean; + domain: TUnion<[TString, TNull]>; + permissions: TArray; +}>; +/** + * The type for a tenant list item + */ +type TenantListItem = Static; +/** + * The schema for a tenant user. + */ +declare const TenantUserSchema: TObject<{ + id: TString; + username: TString; + email: TString; + firstName: TUnion<[TString, TNull]>; + lastName: TUnion<[TString, TNull]>; +}>; +/** + * The type for a tenant user + */ +type TenantUser = Static; +/** + * The schema for a public tenant preview + */ +declare const TenantPreviewSchema: TObject; +/** + * The type for a public tenant preview + */ +type TenantPreview = Static; +/** + * The schema for a tenant instance + */ +declare const TenantInstanceSchema: TObject<{ + isDedicated: TBoolean; + instance: TUnion<[ + TNull, + TObject<{ + status: TString; + domain: TString; + }> + ]>; +}>; +/** + * The type for a tenant instance + */ +type TenantInstance = Static; + +/** + * The input for the tenant create command + */ +interface TenantCreateInput { + /** The tenant slug (already normalized, lowercase, URL-safe) */ + tenantSlug: string; + /** The description of the tenant */ + description?: string; + /** The display name of the tenant */ + displayName?: string; +} +/** + * Create a tenant + */ +declare class TenantCreateCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body for the request + */ + protected getBody(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Tenant; +} + +/** + * The input for the tenant fetch by id command + */ +interface TenantFetchByIdInput { + /** The id of the tenant */ + tenantId: string; + /** The name of the tenant */ + tenant?: never; +} +/** + * The input for the tenant fetch by name command + */ +interface TenantFetchByNameInput { + /** The name of the tenant */ + tenant: string; + /** The id of the tenant */ + tenantId?: never; +} +/** + * The input for the tenant fetch command + */ +type TenantFetchInput = TenantFetchByIdInput | TenantFetchByNameInput; +/** + * Fetch a tenant + */ +declare class TenantFetchCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Tenant; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The input for the tenant instance fetch by id command + */ +interface TenantInstanceFetchByIdInput { + /** The id of the tenant */ + tenantId: string; + /** The name of the tenant */ + tenant?: never; +} +/** + * The input for the tenant instance fetch by name command + */ +interface TenantInstanceFetchByNameInput { + /** The name of the tenant */ + tenant: string; + /** The id of the tenant */ + tenantId?: never; +} +/** + * The input for the tenant instance fetch command + */ +type TenantInstanceFetchInput = TenantInstanceFetchByIdInput | TenantInstanceFetchByNameInput; +/** + * Fetch a tenant instance + */ +declare class TenantInstanceFetchCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): TenantInstance; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The input for the tenant list command + */ +interface TenantListInput { + /** Page number (1-based) */ + page?: number; + /** Number of tenants per page */ + limit?: number; + /** Tenant ids to pin to the front of the list (comma-separated string or array) */ + ids?: string | string[]; +} +/** + * List tenants + */ +declare class TenantListCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): TenantListItem[]; +} + +/** + * The input for the tenant update command + */ +interface TenantUpdateInput { + /** The id of the tenant to update */ + tenantId: string; + /** The description of the tenant */ + description?: string; + /** The display name of the tenant */ + displayName?: string; + /** The website URL of the tenant */ + website?: string; +} +/** + * Update a tenant + */ +declare class TenantUpdateCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body for the request + */ + protected getBody(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Tenant; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The input for the tenant user add command + */ +interface TenantUserAddInput { + tenantId: string; + userId: string; +} +/** + * Add a user to a tenant + */ +declare class TenantUserAddCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): boolean; +} + +/** + * The input for the tenant user remove command + */ +interface TenantUserRemoveInput { + tenantId: string; + userId: string; +} +/** + * Remove a user from a tenant + */ +declare class TenantUserRemoveCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): boolean; +} + +/** + * Abstract command for executing custom requests + */ +declare abstract class CustomCommand extends Command { + /** + * Get the base URL for the request + */ + protected getBaseUrl(): string; + /** + * Custom execute method + */ + protected abstract customExecute(client: FlowcoreClient): Promise; + /** + * Get the request object + */ + getRequest(client: FlowcoreClient, direct?: boolean): Promise<{ + allowedModes: ("apiKey" | "bearer")[]; + body: string | Record | Array | undefined; + headers: Record; + baseUrl: string; + path: string; + method: string; + parseResponse: (response: unknown) => Output | Promise; + processResponse: (client: FlowcoreClient, response: Output) => Promise; + handleClientError: (error: ClientError) => void; + retryOnFailure: boolean; + customExecute: (client: FlowcoreClient) => Promise; + }>; + /** + * Parse the response + */ + protected parseResponse(response: unknown): Output; +} + +/** + * The input for the tenant users command + */ +interface TenantUserListInput { + /** the tenant id */ + tenantId: string; +} +/** + * The output for the tenant user list command + */ +interface TenantUserListOutput extends TenantUser { + managedRoles: string[]; +} +/** + * List tenants users + */ +declare class TenantUserListCommand extends CustomCommand { + /** + * Custom execute method + */ + protected customExecute(client: FlowcoreClient): Promise; +} + +/** + * The input for the tenant translate name to id command + */ +interface TenantTranslateNameToIdInput { + /** The name of the tenant */ + tenant: string; +} +/** + * The schema for the tenant translate name to id command + */ +declare const TenantTranslateNameToIdSchema: TObject<{ + id: TString; + name: TString; +}>; +type TenantTranslateNameToId = Static; +/** + * Translate a tenant name to an tenant id + */ +declare class TenantTranslateNameToIdCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): TenantTranslateNameToId; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The input for the tenant preview command + */ +interface TenantPreviewInput { + /** The name of the tenant to preview */ + name: string; +} +/** + * Retrieve a public tenant preview + */ +declare class TenantPreviewCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): TenantPreview; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The schema for an api key + */ +declare const ApiKeySchema: TObject<{ + id: TString; + tenantId: TString; + name: TString; + description: TString; + maskedApiKey: TString; + createdAt: TString; + lastUsedAt: TUnion<[TString, TNull]>; +}>; +/** + * The type for an api key + */ +type ApiKey = Static; +/** + * The schema for an api key with value + */ +declare const ApiKeyWithValueSchema: TObject<{ + id: TString; + tenantId: TString; + name: TString; + description: TString; + maskedApiKey: TString; + createdAt: TString; + lastUsedAt: TUnion<[TString, TNull]>; + apiKey: TString; +}>; +/** + * The type for an api key with value + */ +type ApiKeyWithValue = Static; +/** + * The schema for an api key validation response + */ +declare const ApiKeyValidationSchema: TObject<{ + valid: TBoolean; + apiKeyId: TOptional; + tenantId: TOptional; +}>; +/** + * The type for an api key validation response + */ +type ApiKeyValidation = Static; + +/** + * The input for the api key create command + */ +interface ApiKeyCreateInput { + /** The tenant id */ + tenantId: string; + /** The name of the api key */ + name: string; + /** The description of the api key */ + description?: string; +} +/** + * Create an api key + */ +declare class ApiKeyCreateCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * The allowed modes for the command. Api-key mode requires tenant-store >= + * the release that accepts AuthType.ApiKey on the api-key management routes; + * authorization is still gated by IAM grants on frn:::tenant. + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ApiKeyWithValue; +} + +/** + * The input for the api key fetch command + */ +interface ApiKeyFetchInput { + /** The api key id */ + apiKeyId: string; +} +/** + * Fetch an api key + */ +declare class ApiKeyFetchCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * The allowed modes for the command. Api-key mode requires tenant-store >= + * the release that accepts AuthType.ApiKey on the api-key management routes; + * authorization is still gated by IAM grants on frn:::tenant. + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ApiKey; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The input for the api key edit command + */ +interface ApiKeyEditInput { + /** The api key id */ + apiKeyId: string; + /** The description of the api key */ + description: string; +} +/** + * Edit an api key + */ +declare class ApiKeyEditCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * The allowed modes for the command. Api-key mode requires tenant-store >= + * the release that accepts AuthType.ApiKey on the api-key management routes; + * authorization is still gated by IAM grants on frn:::tenant. + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ApiKey; +} + +/** + * The input for the api key delete command + */ +interface ApiKeyDeleteInput { + /** The api key id */ + apiKeyId: string; +} +/** + * Delete an api key + */ +declare class ApiKeyDeleteCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * The allowed modes for the command. Api-key mode requires tenant-store >= + * the release that accepts AuthType.ApiKey on the api-key management routes; + * authorization is still gated by IAM grants on frn:::tenant. + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Parse the response + */ + protected parseResponse(_rawResponse: unknown): boolean; +} + +/** + * The input for the api key list command + */ +interface ApiKeyListInput { + /** The tenant id */ + tenantId: string; +} +/** + * List api keys + */ +declare class ApiKeyListCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * The allowed modes for the command. Api-key mode requires tenant-store >= + * the release that accepts AuthType.ApiKey on the api-key management routes; + * authorization is still gated by IAM grants on frn:::tenant. + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ApiKey[]; +} + +/** + * The input for the api key validate command + */ +interface ApiKeyValidateInput { + /** The api key to validate */ + apiKey: string; +} +/** + * Validate an api key + */ +declare class ApiKeyValidateCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ApiKeyValidation; +} + +/** + * The input for the api key validate with tenant id command + */ +interface ApiKeyValidateWithTenantIdInput { + /** The api key to validate */ + apiKey: string; + /** The tenant id */ + tenantId: string; +} +/** + * Validate an api key with tenant id + */ +declare class ApiKeyValidateWithTenantIdCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ApiKeyValidation; +} + +/** + * The schema for AWS Marketplace dedicated cluster types. + */ +declare const AwsMarketplaceDedicatedClusterTypeSchema: TUnion<[TLiteral<"managed">, TLiteral<"self-hosted">]>; +/** + * The type for AWS Marketplace dedicated cluster types. + */ +type AwsMarketplaceDedicatedClusterType = Static; +/** + * The schema for AWS Marketplace product properties. + */ +declare const AwsMarketplaceProductPropertiesSchema: TRecord>; +/** + * The type for AWS Marketplace product properties. + */ +type AwsMarketplaceProductProperties = Static; +/** + * The schema for AWS Marketplace customer product modes. + */ +declare const AwsMarketplaceProductModeSchema: TUnion<[TLiteral<"basic">, TLiteral<"dedicated">]>; +/** + * The type for AWS Marketplace customer product modes. + */ +type AwsMarketplaceProductMode = Static; +/** + * The schema for an AWS Marketplace customer. + */ +declare const AwsMarketplaceCustomerSchema: TObject<{ + customerId: TString; + productCode: TString; + accountId: TString; + metadata: TString; + productMode: typeof AwsMarketplaceProductModeSchema; +}>; +/** + * The type for an AWS Marketplace customer. + */ +type AwsMarketplaceCustomer = Static; +/** + * The schema for an AWS Marketplace link. + */ +declare const AwsMarketplaceLinkSchema: TObject<{ + linkingId: TString; + awsCustomerId: TString; + awsProductCode: TString; + awsAccountId: TString; + tenant: TUnion<[TString, TNull]>; + tenantId: TString; + contactInfo: TUnion<[TString, TNull]>; + productProperties: TUnion<[TRecord, TNull]>; + linkedAt: TString; +}>; +/** + * The type for an AWS Marketplace link. + */ +type AwsMarketplaceLink = Static; +/** + * The schema for the AWS Marketplace customer resolve response. + */ +declare const AwsMarketplaceCustomerResolveSchema: TObject<{ + success: TBoolean; + customer: typeof AwsMarketplaceCustomerSchema; +}>; +/** + * The type for the AWS Marketplace customer resolve response. + */ +type AwsMarketplaceCustomerResolve = Static; +/** + * The schema for the AWS Marketplace link create response. + */ +declare const AwsMarketplaceLinkCreateSchema: TObject<{ + success: TBoolean; + linkingId: TString; + status: TLiteral<"linked">; +}>; +/** + * The type for the AWS Marketplace link create response. + */ +type AwsMarketplaceLinkCreate = Static; +/** + * The schema for the AWS Marketplace link list response. + */ +declare const AwsMarketplaceLinkListSchema: TObject<{ + success: TBoolean; + links: TArray; +}>; +/** + * The type for the AWS Marketplace link list response. + */ +type AwsMarketplaceLinkList = Static; +/** + * The schema for the AWS Marketplace link fetch response. + */ +declare const AwsMarketplaceLinkFetchSchema: TObject<{ + success: TBoolean; + link: typeof AwsMarketplaceLinkSchema; +}>; +/** + * The type for the AWS Marketplace link fetch response. + */ +type AwsMarketplaceLinkFetch = Static; +/** + * The schema for the AWS Marketplace link delete response. + */ +declare const AwsMarketplaceLinkDeleteSchema: TObject<{ + success: TBoolean; + linkingId: TString; + status: TLiteral<"unlinked">; +}>; +/** + * The type for the AWS Marketplace link delete response. + */ +type AwsMarketplaceLinkDelete = Static; + +/** + * The input for the AWS Marketplace customer resolve command. + */ +interface AwsMarketplaceCustomerResolveInput { + /** The AWS Marketplace registration token */ + registrationToken: string; +} +/** + * Resolve an AWS Marketplace registration token. + */ +declare class AwsMarketplaceCustomerResolveCommand extends Command { + /** + * Whether the command should retry on failure. + */ + protected retryOnFailure: boolean; + /** + * Get the method. + */ + protected getMethod(): string; + /** + * Get the base url. + */ + protected getBaseUrl(): string; + /** + * Get the path. + */ + protected getPath(): string; + /** + * Parse the response. + */ + protected parseResponse(rawResponse: unknown): AwsMarketplaceCustomerResolve; +} + +/** + * The input for the AWS Marketplace link create command. + */ +interface AwsMarketplaceLinkCreateInput { + /** The AWS Marketplace registration token */ + registrationToken: string; + /** The tenant slug */ + tenant: string; + /** The tenant id */ + tenantId: string; + /** Product-specific properties */ + productProperties?: AwsMarketplaceProductProperties & { + /** The dedicated cluster type for dedicated products */ + dedicatedClusterType?: AwsMarketplaceDedicatedClusterType; + }; + /** Optional license key */ + licenseKey?: string; +} +/** + * Create an AWS Marketplace link for a tenant. + */ +declare class AwsMarketplaceLinkCreateCommand extends Command { + /** + * Whether the command should retry on failure. + */ + protected retryOnFailure: boolean; + /** + * The allowed modes for the command. + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Get the method. + */ + protected getMethod(): string; + /** + * Get the base url. + */ + protected getBaseUrl(): string; + /** + * Get the path. + */ + protected getPath(): string; + /** + * Parse the response. + */ + protected parseResponse(rawResponse: unknown): AwsMarketplaceLinkCreate; +} + +/** + * The input for the AWS Marketplace link delete command. + */ +interface AwsMarketplaceLinkDeleteInput { + /** The AWS Marketplace linking id */ + linkingId: string; + /** Optional unlink reason */ + reason?: string; +} +/** + * Delete an AWS Marketplace link. + */ +declare class AwsMarketplaceLinkDeleteCommand extends Command { + /** + * Whether the command should retry on failure. + */ + protected retryOnFailure: boolean; + /** + * The allowed modes for the command. + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Get the method. + */ + protected getMethod(): string; + /** + * Get the base url. + */ + protected getBaseUrl(): string; + /** + * Get the path. + */ + protected getPath(): string; + /** + * Get the body. + */ + protected getBody(): undefined; + /** + * Parse the response. + */ + protected parseResponse(rawResponse: unknown): AwsMarketplaceLinkDelete; +} + +/** + * The input for the AWS Marketplace link fetch command. + */ +interface AwsMarketplaceLinkFetchInput { + /** The AWS Marketplace linking id */ + linkingId: string; +} +/** + * Fetch an AWS Marketplace link. + */ +declare class AwsMarketplaceLinkFetchCommand extends Command { + /** + * Whether the command should retry on failure. + */ + protected retryOnFailure: boolean; + /** + * The allowed modes for the command. + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Get the method. + */ + protected getMethod(): string; + /** + * Get the base url. + */ + protected getBaseUrl(): string; + /** + * Get the path. + */ + protected getPath(): string; + /** + * Parse the response. + */ + protected parseResponse(rawResponse: unknown): AwsMarketplaceLinkFetch; +} + +/** + * The input for the AWS Marketplace link list command. + */ +interface AwsMarketplaceLinkListInput { + /** The tenant slug */ + tenant?: string; + /** The tenant id */ + tenantId?: string; + /** The AWS Marketplace customer id */ + awsCustomerId?: string; + /** The AWS Marketplace product code */ + awsProductCode?: string; +} +/** + * List AWS Marketplace links. + */ +declare class AwsMarketplaceLinkListCommand extends Command { + /** + * Whether the command should retry on failure. + */ + protected retryOnFailure: boolean; + /** + * The allowed modes for the command. + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Get the method. + */ + protected getMethod(): string; + /** + * Get the base url. + */ + protected getBaseUrl(): string; + /** + * Get the path. + */ + protected getPath(): string; + /** + * Parse the response. + */ + protected parseResponse(rawResponse: unknown): AwsMarketplaceLinkList; +} + +/** + * The schema for a secret + */ +declare const SecretSchema: TObject<{ + tenantId: TString; + key: TString; + description: TString; + createdAt: TString; + updatedAt: TUnion<[TString, TNull]>; +}>; +/** + * The type for a secret + */ +type Secret = Static; + +/** + * The input for the secret create command + */ +interface SecretCreateInput { + /** The tenant id */ + tenantId: string; + /** The key of the secret */ + key: string; + /** The value of the secret */ + value: string; + /** The description of the secret */ + description?: string; +} +/** + * Create a secret + */ +declare class SecretCreateCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * The allowed modes for the command + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Secret; +} + +/** + * The input for the secret delete command + */ +interface SecretDeleteInput { + /** The tenant id */ + tenantId: string; + /** The key of the secret */ + key: string; +} +/** + * Delete a secret + */ +declare class SecretDeleteCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * The allowed modes for the command + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Parse the response + */ + protected parseResponse(_rawResponse: unknown): boolean; +} + +/** + * The input for the secret edit command + */ +interface SecretEditInput { + /** The tenant id */ + tenantId: string; + /** The key of the secret */ + key: string; + /** The value of the secret */ + value?: string; + /** The description of the secret */ + description?: string; +} +/** + * Edit a secret + */ +declare class SecretEditCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * The allowed modes for the command + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Secret; +} + +/** + * The input for the secret fetch command + */ +interface SecretFetchInput { + /** The tenant id */ + tenantId: string; + /** The secret key */ + key: string; +} +/** + * Fetch a secret + */ +declare class SecretFetchCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * The allowed modes for the command + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Secret; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The input for the secret list command + */ +interface SecretListInput { + /** The tenant id */ + tenantId: string; +} +/** + * List secrets + */ +declare class SecretListCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * The allowed modes for the command + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Secret[]; +} + +/** + * The schema for a service account + */ +declare const ServiceAccountSchema: TObject<{ + id: TString; + tenantId: TString; + name: TString; + description: TString; + linkedUserId: TString; + clientId: TString; + isAdmin: TBoolean; + enabled: TBoolean; + createdAt: TString; + updatedAt: TUnion<[TString, TNull]>; + lastRotatedAt: TUnion<[TString, TNull]>; +}>; +/** + * The type for a service account + */ +type ServiceAccount = Static; +/** + * The schema for a service account response with client secret + */ +declare const ServiceAccountWithSecretSchema: TObject<{ + id: TString; + tenantId: TString; + name: TString; + description: TString; + linkedUserId: TString; + clientId: TString; + isAdmin: TBoolean; + enabled: TBoolean; + createdAt: TString; + updatedAt: TUnion<[TString, TNull]>; + lastRotatedAt: TUnion<[TString, TNull]>; + clientSecret: TString; +}>; +/** + * The type for a service account response with client secret + */ +type ServiceAccountWithSecret = Static; +/** + * The schema for a rotated service account secret response + */ +declare const ServiceAccountSecretRotationSchema: TObject<{ + id: TString; + clientId: TString; + clientSecret: TString; +}>; +/** + * The type for a rotated service account secret response + */ +type ServiceAccountSecretRotation = Static; + +/** + * The input for the service account create command + */ +interface ServiceAccountCreateInput { + /** The tenant id */ + tenantId: string; + /** The name of the service account */ + name: string; + /** The description of the service account */ + description?: string; + /** Whether the service account should be admin */ + isAdmin?: boolean; +} +/** + * Create a service account + */ +declare class ServiceAccountCreateCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * The allowed modes for the command + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ServiceAccountWithSecret; +} + +/** + * The input for the service account delete command + */ +interface ServiceAccountDeleteInput { + /** The service account id */ + serviceAccountId: string; +} +/** + * Delete a service account + */ +declare class ServiceAccountDeleteCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body + */ + protected getBody(): undefined; + /** + * The allowed modes for the command + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Parse the response + */ + protected parseResponse(): boolean; +} + +/** + * The input for the service account edit command + */ +interface ServiceAccountEditInput { + /** The service account id */ + serviceAccountId: string; + /** The description of the service account */ + description?: string; + /** Whether the service account is enabled */ + enabled?: boolean; +} +/** + * Edit a service account + */ +declare class ServiceAccountEditCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body + */ + protected getBody(): Record; + /** + * The allowed modes for the command + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ServiceAccount; +} + +/** + * The input for the service account fetch command + */ +interface ServiceAccountFetchInput { + /** The service account id */ + serviceAccountId: string; +} +/** + * Fetch a service account + */ +declare class ServiceAccountFetchCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * The allowed modes for the command + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ServiceAccount; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The input for the service account list command + */ +interface ServiceAccountListInput { + /** The tenant id */ + tenantId: string; +} +/** + * List service accounts + */ +declare class ServiceAccountListCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * The allowed modes for the command + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ServiceAccount[]; +} + +/** + * The input for the service account rotate secret command + */ +interface ServiceAccountRotateSecretInput { + /** The service account id */ + serviceAccountId: string; +} +/** + * Rotate a service account secret + */ +declare class ServiceAccountRotateSecretCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body + */ + protected getBody(): undefined; + /** + * The allowed modes for the command + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ServiceAccountSecretRotation; +} + +/** + * The schema for a variable + */ +declare const VariableSchema: TObject<{ + tenantId: TString; + key: TString; + description: TString; + value: TString; + createdAt: TString; + updatedAt: TUnion<[TString, TNull]>; +}>; +/** + * The type for a variable + */ +type Variable = Static; + +/** + * The input for the variable create command + */ +interface VariableCreateInput { + /** The tenant id */ + tenantId: string; + /** The key of the variable */ + key: string; + /** The value of the variable */ + value: string; + /** The description of the variable */ + description?: string; +} +/** + * Create a variable + */ +declare class VariableCreateCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * The allowed modes for the command + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Variable; +} + +/** + * The input for the variable delete command + */ +interface VariableDeleteInput { + /** The tenant id */ + tenantId: string; + /** The key of the variable */ + key: string; +} +/** + * Delete a variable + */ +declare class VariableDeleteCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * The allowed modes for the command + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Parse the response + */ + protected parseResponse(): boolean; +} + +/** + * The input for the variable edit command + */ +interface VariableEditInput { + /** The tenant id */ + tenantId: string; + /** The key of the variable */ + key: string; + /** The value of the variable */ + value?: string; + /** The description of the variable */ + description?: string; +} +/** + * Edit a variable + */ +declare class VariableEditCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * The allowed modes for the command + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Variable; +} + +/** + * The input for the variable fetch command + */ +interface VariableFetchInput { + /** The tenant id */ + tenantId: string; + /** The variable key */ + key: string; +} +/** + * Fetch a variable + */ +declare class VariableFetchCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * The allowed modes for the command + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Variable; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The input for the variable list command + */ +interface VariableListInput { + /** The tenant id */ + tenantId: string; +} +/** + * List variables + */ +declare class VariableListCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * The allowed modes for the command + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Variable[]; +} + +/** + * The schema for a data core + */ +declare const DataCoreSchema: TObject<{ + id: TString; + tenantId: TString; + tenant: TString; + name: TString; + description: TString; + accessControl: TUnion<[TLiteral<"public">, TLiteral<"private">]>; + deleteProtection: TBoolean; + isDeleting: TBoolean; + isFlowcoreManaged: TBoolean; +}>; +/** + * The schema for a data core with access + */ +declare const DataCoreWithAccessSchema: TObject<{ + id: TString; + tenantId: TString; + tenant: TString; + name: TString; + description: TString; + accessControl: TUnion<[TLiteral<"public">, TLiteral<"private">]>; + deleteProtection: TBoolean; + isDeleting: TBoolean; + isFlowcoreManaged: TBoolean; + access: TArray, TLiteral<"write">, TLiteral<"fetch">, TLiteral<"ingest">]>>; +}>; +/** + * The type for a data core + */ +type DataCore = Static; +/** + * The type for a data core with access + */ +type DataCoreWithAccess = Static; + +/** + * The input for the data core create command + */ +interface DataCoreCreateInput { + /** The tenant id */ + tenantId: string; + /** The name of the data core */ + name: string; + /** The description of the data core */ + description: string; + /** The access control of the data core */ + accessControl: "public" | "private"; + /** Whether the data core is delete protected */ + deleteProtection: boolean; + /** Whether the data core is managed by Flowcore */ + isFlowcoreManaged?: boolean; +} +/** + * Create a data core + */ +declare class DataCoreCreateCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): DataCore; +} + +/** + * The input for the data core fetch by id command + */ +interface DataCoreExistsInput { + /** The id of the data core */ + dataCoreId: string; +} +/** + * The output for the data core exists command + */ +interface DataCoreExistsOutput { + /** Whether the data core exists */ + exists: boolean; +} +/** + * Fetch a data core + */ +declare class DataCoreExistsCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): DataCoreExistsOutput; +} + +/** + * The input for the data core fetch by id command + */ +interface DataCoreFetchByIdInput { + /** The id of the data core */ + dataCoreId: string; + /** The tenant id */ + tenantId?: never; + /** The tenant */ + tenant?: never; + /** The name of the data core */ + dataCore?: never; +} +/** + * The input for the data core fetch by name and tenant id command + */ +interface DataCoreFetchByNameAndTenantIdInput { + /** The tenant id */ + tenantId: string; + /** The tenant */ + tenant?: never; + /** The name of the data core */ + dataCore: string; + /** The id of the data core */ + dataCoreId?: never; +} +/** + * The input for the data core fetch by name and tenant command + */ +interface DataCoreFetchByNameAndTenantInput { + /** The tenant id */ + tenantId?: never; + /** The tenant */ + tenant: string; + /** The name of the data core */ + dataCore: string; + /** The id of the data core */ + dataCoreId?: never; +} +/** + * The input for the data core fetch command + */ +type DataCoreFetchInput = DataCoreFetchByIdInput | DataCoreFetchByNameAndTenantIdInput | DataCoreFetchByNameAndTenantInput; +/** + * Fetch a data core + */ +declare class DataCoreFetchCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): DataCore; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The input for the data core list command + */ +interface DataCoreListInput { + /** The tenant id */ + tenantId?: string; + /** The tenant name */ + tenant?: string; + /** The data core name */ + name?: string; + /** Page number (1-based). Used with limit. Defaults to 1 when limit is provided. */ + page?: number; + /** Maximum number of data cores to return (max 100). Omit to return all data cores. */ + limit?: number; + /** Data core ids to pin to the front of the list (comma-separated string or array) */ + ids?: string | string[]; +} +/** + * Fetch all data cores for a tenant + */ +declare class DataCoreListCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): DataCoreWithAccess[]; +} + +/** + * The input for the data core request delete command + */ +interface DataCoreRequestDeleteInput { + /** The tenant */ + tenant: string; + /** The id of the data core */ + dataCoreId: string; + /** Wait for the data core to be deleted (default: false) */ + waitForDelete?: boolean; +} +/** + * The output for the data core request delete command + */ +interface DataCoreRequestDeleteOutput { + /** The success of the data core delete request */ + success: boolean; +} +/** + * Request to delete a data core + */ +declare class DataCoreRequestDeleteCommand extends Command { + /** + * The dedicated subdomain for the command + */ + protected dedicatedSubdomain: string; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): DataCoreRequestDeleteOutput; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; + /** + * Wait for the response (timeout: 25 seconds) + */ + protected processResponse(client: FlowcoreClient, response: DataCoreRequestDeleteOutput): Promise; +} + +/** + * The input for the data core update command + */ +interface DataCoreUpdateInput { + /** The id of the data core */ + dataCoreId: string; + /** The description of the data core */ + description?: string; + /** The access control of the data core */ + accessControl?: "public" | "private"; + /** Whether the data core is delete protected */ + deleteProtection?: boolean; +} +/** + * Update a data core + */ +declare class DataCoreUpdateCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body for the request + */ + protected getBody(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): DataCore; +} + +/** + * The schema for a flow type + */ +declare const FlowTypeSchema: TObject<{ + id: TString; + tenantId: TString; + dataCoreId: TString; + name: TString; + description: TString; + isDeleting: TBoolean; +}>; +/** + * The type for a flow type + */ +type FlowType = Static; + +/** + * The input for the data core create command + */ +interface FlowTypeCreateInput { + /** The id of the data core */ + dataCoreId: string; + /** The name of the flow type */ + name: string; + /** The description of the flow type */ + description: string; +} +/** + * Create a flow type + */ +declare class FlowTypeCreateCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): FlowType; +} + +/** + * The input for the flow type fetch by name command + */ +interface FlowTypeExistsInput { + /** The id of the flow type */ + flowTypeId: string; + /** Wait for the flow type to be deleted */ + waitForDelete?: boolean; +} +/** + * The output for the flow type exists command + */ +interface FlowTypeExistsOutput { + /** Whether the flow type exists */ + exists: boolean; +} +/** + * Fetch a flow type + */ +declare class FlowTypeExistsCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): FlowTypeExistsOutput; +} + +/** + * The input for the flow type fetch by name command + */ +interface FlowTypeFetchByNameInput { + /** The id of the data core */ + dataCoreId: string; + /** The name of the flow type */ + flowType: string; + /** The id of the flow type */ + flowTypeId?: never; +} +/** + * The input for the flow type fetch by id command + */ +interface FlowTypeFetchByIdInput { + /** The id of the flow type */ + flowTypeId: string; + /** The id of the data core */ + dataCoreId?: never; + /** The name of the flow type */ + flowType?: never; +} +/** + * The input for the flow type fetch command + */ +type FlowTypeFetchInput = FlowTypeFetchByIdInput | FlowTypeFetchByNameInput; +/** + * Fetch a flow type + */ +declare class FlowTypeFetchCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): FlowType; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The input for the flow type list command + */ +interface FlowTypeListInput { + /** the data core id */ + dataCoreId: string; +} +/** + * Fetch all flow types for a data core + */ +declare class FlowTypeListCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): FlowType[]; +} + +/** + * The input for the flow type request delete command + */ +interface FlowTypeRequestDeleteInput { + /** The tenant */ + tenant: string; + /** The id of the flow type */ + flowTypeId: string; + /** Wait for the flow type to be deleted (default: false) */ + waitForDelete?: boolean; +} +/** + * The output for the flow type request delete command + */ +interface FlowTypeRequestDeleteOutput { + success: boolean; +} +/** + * Request to delete a flow type + */ +declare class FlowTypeRequestDeleteCommand extends Command { + /** + * The dedicated subdomain for the command + */ + protected dedicatedSubdomain: string; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): FlowTypeRequestDeleteOutput; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; + /** + * Wait for the response (timeout: 25 seconds) + */ + protected processResponse(client: FlowcoreClient, response: FlowTypeRequestDeleteOutput): Promise; +} + +/** + * The input for the flow type update command + */ +interface FlowTypeUpdateInput { + /** The id of the data core */ + flowTypeId: string; + /** The description of the flow type */ + description?: string; +} +/** + * Update a flow type + */ +declare class FlowTypeUpdateCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body for the request + */ + protected getBody(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): FlowType; +} + +type SimpleSensitiveDataType = boolean | "string" | "number" | "boolean"; +type DetailedSensitiveDataField = { + type: "string" | "number" | "boolean" | "object" | "array"; + faker?: string; + args?: unknown[]; + length?: number; + pattern?: string; + redact?: { + char: string; + length: number; + }; + min?: number; + max?: number; + precision?: number; + count?: number; + items?: SimpleSensitiveDataType | DetailedSensitiveDataField | Record; + properties?: Record>; +}; +type SensitiveDataDefinition = SimpleSensitiveDataType | DetailedSensitiveDataField | Record>; +/** + * The schema for a detailed SensitiveData field + */ +declare const DetailedSensitiveDataFieldSchema: TObject<{ + type: TUnion<[TLiteral<"string">, TLiteral<"number">, TLiteral<"boolean">, TLiteral<"object">, TLiteral<"array">]>; + faker: TOptional; + args: TOptional>; + length: TOptional; + pattern: TOptional; + redact: TOptional>; + min: TOptional; + max: TOptional; + precision: TOptional; + count: TOptional; + items: TOptional; + properties: TOptional>; +}>; +/** + * The schema for a SensitiveData definition + */ +declare const SensitiveDataDefinitionSchema: TUnion<[ + TLiteral, + TUnion<[TLiteral<"string">, TLiteral<"number">, TLiteral<"boolean">]>, + typeof DetailedSensitiveDataFieldSchema, + TRecord +]>; +/** + * The schema for an event type SensitiveData mask + */ +declare const EventTypeSensitiveDataMaskSchema: TObject<{ + key: TString; + schema: TRecord; +}>; +/** + * The schema for an event type SensitiveData mask parsed + */ +declare const EventTypeSensitiveDataMaskParsedSchema: TArray, TLiteral<"number">, TLiteral<"boolean">, TLiteral<"object">, TLiteral<"array">]>; + faker: TOptional; + args: TArray; + length: TOptional; + pattern: TOptional; + min: TOptional; + max: TOptional; + precision: TOptional; + count: TOptional; + items: TOptional; + properties: TOptional>; + redact: TOptional>; + }>; +}>>; +/** + * The schema for an event type + */ +declare const EventTypeSchema: TObject<{ + id: TString; + tenantId: TString; + dataCoreId: TString; + flowTypeId: TString; + name: TString; + description: TString; + isTruncating: TBoolean; + isDeleting: TBoolean; + createdAt: TString; + updatedAt: TUnion<[TString, TNull]>; + sensitiveDataMask: TOptional>; + sensitiveDataEnabled: TOptional; +}>; +/** + * The schema for an event type remove sensitive data + */ +declare const EventTypeRemoveSensitiveDataSchema: TObject<{ + success: TBoolean; + id: TString; +}>; +/** + * The schema for an event type list removed sensitive data item + */ +declare const EventTypeListRemovedSensitiveDataItemSchema: TObject<{ + id: TString; + tenantId: TString; + dataCoreId: TString; + flowTypeId: TString; + eventTypeId: TString; + application: TString; + parentKey: TString; + key: TString; + type: TString; + createdAt: TString; +}>; +/** + * The schema for an event type list removed sensitive data response + */ +declare const EventTypeListRemovedSensitiveDataResponseSchema: TObject<{ + data: TArray; + pagination: TObject<{ + page: TNumber; + pageSize: TNumber; + hasNextPage: TBoolean; + hasPreviousPage: TBoolean; + }>; +}>; +/** + * The type for an event type + */ +type EventType = Static; +/** + * Type for SensitiveData mask + */ +type EventTypeSensitiveDataMask = Static; +/** + * Type for parsed SensitiveData mask + */ +type EventTypeSensitiveDataMaskParsed = Static; +/** + * Type for an event type list removed sensitive data response + */ +type EventTypeListRemovedSensitiveDataResponse = Static; +/** + * Type for an event type remove sensitive data + */ +type EventTypeRemoveSensitiveData = Static; + +/** + * The input for the event type create command + */ +interface EventTypeCreateInput { + /** The id of the flow type */ + flowTypeId: string; + /** The name of the event type */ + name: string; + /** The description of the event type */ + description: string; + /** The sensitive data mask of the event type */ + sensitiveDataMask?: { + /** The json path to the key where the entity id for the sensitive data mask is located */ + key: string; + /** Schema defining the fields that should be masked and how they should be masked */ + schema: Record; + }; + /** Whether sensitive data masking is enabled for this event type */ + sensitiveDataEnabled?: boolean; +} +/** + * Create an event type + */ +declare class EventTypeCreateCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): EventType; +} + +/** + * The input for the event type exists command + */ +interface EventTypeExistsInput { + /** The id of the event type */ + eventTypeId: string; +} +/** + * The output for the event type exists command + */ +interface EventTypeExistsOutput { + /** Whether the event type exists */ + exists: boolean; +} +/** + * Check if an event type exists + */ +declare class EventTypeExistsCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): EventTypeExistsOutput; +} + +interface EventTypeFetchByIdInput { + /** The id of the event type */ + eventTypeId: string; + /** The id of the flow type */ + flowTypeId?: never; + /** The name of the event type */ + eventType?: never; +} +interface EventTypeFetchByNameInput { + /** The id of the flow type */ + flowTypeId: string; + /** The name of the event type */ + eventType: string; + /** The id of the event type */ + eventTypeId?: never; +} +/** + * The input for the event type fetch command + */ +type EventTypeFetchInput = EventTypeFetchByIdInput | EventTypeFetchByNameInput; +/** + * Fetch an event type + */ +declare class EventTypeFetchCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): EventType; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The schema for an event + */ +declare const FlowcoreEventSchema: TObject<{ + eventId: TString; + timeBucket: TString; + tenant: TString; + dataCoreId: TString; + flowType: TString; + eventType: TString; + metadata: TRecord; + payload: TRecord; + validTime: TString; +}>; +/** + * The type for an event + */ +type FlowcoreEvent = Static; +/** + * The input for the ingest event command + */ +interface IngestEventInput { + /** the tenant name */ + tenantName: string; + /** the data core id */ + dataCoreId: string; + /** the flow type name */ + flowTypeName: string; + /** the event type name */ + eventTypeName: string; + /** the event data */ + eventData: T; + /** the event id */ + metadata?: Record; + /** ttl (This accepts d, h, m, s. The maximum value is 7 days, this can be increased for higher subscription levels.) */ + ttl?: string; + /** indicate if this event is emphemral (default false) */ + isEphemeral?: boolean; + /** valid time of the event */ + validTime?: string; + /** event time of the event, overrides what time bucket this event is stored in */ + eventTime?: string; + /** flowcore managed event */ + flowcoreManaged?: boolean; +} + +/** + * The input for the events fetch info command + */ +interface EventTypeInfoInput { + /** the tenant */ + tenant: string; + /** the event type id or ids */ + eventTypeId: [string, ...string[]] | string; + /** the limit for the number of last events to fetch (default is 5) */ + limit?: number; + /** include sensitive data */ + includeSensitiveData?: boolean; +} +/** + * The output for the events fetch info command + */ +interface EventTypeInfoOutput { + /** the first time bucket */ + firstTimeBucket?: string; + /** the last time bucket */ + lastTimeBucket?: string; + /** the last events */ + lastEvents: FlowcoreEvent[]; +} +/** + * Fetch information about an event type + * + * contains the first and last time bucket and the last {limit} events + */ +declare class EventTypeInfoCommand extends CustomCommand { + /** + * Custom execute method + */ + protected customExecute(client: FlowcoreClient): Promise; +} + +/** + * The input for the event type list removed sensitive data command + */ +interface EventTypeListRemovedSensitiveDataInput { + /** The id of the tenant */ + tenantId: string; + /** The id of the data core */ + dataCoreId?: string; + /** The id of the flow type */ + flowTypeId?: string; + /** The id of the event type */ + eventTypeId?: string; + /** The identifier of the application that is trying to remove sensitive data (iLike operation) */ + application?: string; + /** The parent key of the event type (iLike operation) */ + parentKey?: string; + /** The page to fetch (minimum: 1, default: 1) */ + page?: number; + /** The page size (minimum: 1, maximum: 5000, default: 20) */ + pageSize?: number; + /** The type of removal */ + type?: string; + /** The sort order */ + sort?: string; + /** Filter by creation date from (format: date-time) */ + createdAtFrom?: string; + /** Filter by creation date to (format: date-time) */ + createdAtTo?: string; +} +/** + * Fetch an event type + */ +declare class EventTypeListRemovedSensitiveDataCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): EventTypeListRemovedSensitiveDataResponse; +} + +/** + * The input for the event type list command + */ +interface EventTypeListInput { + /** The flow type id */ + flowTypeId: string; +} +/** + * Fetch all event types for a flow type + */ +declare class EventTypeListCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): EventType[]; +} + +/** + * The input for the event type list removed sensitive data command + */ +interface EventTypeRemoveSensitiveDataInput { + /** The id of the event type */ + eventTypeId: string; + /** The identifier of the application that is trying to remove sensitive data */ + application: string; + /** The parent key of sensitive data point */ + parentKey: string; + /** The key of sensitive data point */ + key: string; + /** The removal type of sensitive data point */ + type: "remove" | "scramble"; +} +/** + * Fetch an event type + */ +declare class EventTypeRemoveSensitiveDataCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): EventTypeRemoveSensitiveData; +} + +/** + * The input for the event type request delete command + */ +interface EventTypeRequestDeleteInput { + /** The tenant */ + tenant: string; + /** The id of the event type */ + eventTypeId: string; + /** Wait for the event type to be deleted (default: false) */ + waitForDelete?: boolean; +} +/** + * The output for the event type request delete command + */ +interface EventTypeRequestDeleteOutput { + success: boolean; +} +/** + * Request to delete an event type + */ +declare class EventTypeRequestDeleteCommand extends Command { + /** + * The dedicated subdomain for the command + */ + protected dedicatedSubdomain: string; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): EventTypeRequestDeleteOutput; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; + /** + * Wait for the response (timeout: 25 seconds) + */ + protected processResponse(client: FlowcoreClient, response: EventTypeRequestDeleteOutput): Promise; +} + +/** + * The input for the event type request truncate command + */ +interface EventTypeRequestTruncateInput { + /** The tenant */ + tenant: string; + /** The id of the event type */ + eventTypeId: string; + /** Wait for the event type to be truncated (default: false) */ + waitForTruncate?: boolean; +} +/** + * The output for the event type request truncate command + */ +interface EventTypeRequestTruncateOutput { + success: boolean; +} +/** + * Request to truncate an event type + */ +declare class EventTypeRequestTruncateCommand extends Command { + /** + * The dedicated subdomain for the command + */ + protected dedicatedSubdomain: string; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): EventTypeRequestTruncateOutput; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; + /** + * Wait for the response (timeout: 25 seconds) + */ + protected processResponse(client: FlowcoreClient, response: EventTypeRequestTruncateOutput): Promise; +} + +/** + * The input for the event type update command + */ +type EventTypeUpdateInput = { + /** The id of the event type */ + eventTypeId: string; + /** The description of the event type */ + description?: string; + /** The sensitive data mask of the event type */ + sensitiveDataMask?: { + /** The json path to the key where the entity id for the sensitive data mask is located */ + key: string; + /** Schema defining the fields that should be masked and how they should be masked */ + schema: Record; + }; + /** Whether sensitive data masking is enabled for this event type */ + sensitiveDataEnabled?: boolean; +}; +/** + * Update an event type + */ +declare class EventTypeUpdateCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body for the request + */ + protected getBody(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): EventType; +} + +interface IngestBatchInput extends Omit, "eventData"> { + events: IngestEventInput["eventData"][]; +} +/** + * The output for the batch ingestion command + */ +interface IngestBatchOutput { + /** the events */ + eventIds: string[]; + /** success status */ + success: boolean; +} +/** + * Ingest a batch of events + */ +declare class IngestBatchCommand extends Command, IngestBatchOutput> { + /** + * The dedicated subdomain for the command + */ + protected dedicatedSubdomain: string; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + /** + * Get the base url for the request + */ + protected getBaseUrl(): string; + protected getHeaders(): Record; + /** + * Get the path for the request + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): IngestBatchOutput; + /** + * Get the body for the request + */ + protected getBody(): unknown[]; +} + +/** + * The output for the ingest event command + */ +interface IngestEventOutput { + /** the events */ + eventId: string; + /** success status */ + success: boolean; +} +/** + * Ingest an event + */ +declare class IngestEventCommand extends Command, IngestEventOutput> { + /** + * The dedicated subdomain for the command + */ + protected dedicatedSubdomain: string; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + /** + * Get the base url for the request + */ + protected getBaseUrl(): string; + protected getHeaders(): Record; + /** + * Get the path for the request + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): IngestEventOutput; + /** + * Get the body for the request + */ + protected getBody(): Record; +} + +/** + * The input for the events fetch indexes command + */ +interface EventListInput { + /** The tenant */ + tenant: string; + /** the event type id or ids */ + eventTypeId: [string, ...string[]] | string; + /** the time bucket */ + timeBucket: string; + /** the paging cursor */ + cursor?: string; + /** the page size (default is 10.000) */ + pageSize?: number; + /** start from this event id */ + fromEventId?: string; + /** + * after this event id + * + * ⚠️ Not applicable if `fromEventId` is also defined + */ + afterEventId?: string; + /** end at this event id */ + toEventId?: string; + /** + * the order (default is asc) + * + * ⚠️ When using `desc` order, pagination and filters are not possible. + */ + order?: "asc" | "desc"; + /** include sensitive data */ + includeSensitiveData?: boolean; +} +/** + * The output for the events fetch indexes command + */ +interface EventListOutput { + /** the events */ + events: FlowcoreEvent[]; + /** the next page cursor */ + nextCursor?: string; +} +/** + * Fetch time buckets for an event type + */ +declare class EventListCommand extends Command { + /** + * The dedicated subdomain for the command + */ + protected dedicatedSubdomain: string; + /** + * Get the method for the request + */ + protected getMethod(): string; + /** + * Get the base url for the request + */ + protected getBaseUrl(): string; + /** + * Get the path for the request + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): EventListOutput; +} + +/** + * The input for the events fetch indexes command + */ +interface EventsFetchTimeBucketsByNamesInput { + /** the tenant name */ + tenant: string; + /** the data core id */ + dataCoreId: string; + /** the flow type name */ + flowType: string; + /** the event type names */ + eventTypes: string[]; + /** the paging cursor */ + cursor?: number; + /** the page size (default is 10.000) */ + pageSize?: number; + /** start from this time bucket */ + fromTimeBucket?: string; + /** end at this time bucket */ + toTimeBucket?: string; +} +/** + * The output for the events fetch indexes command + */ +interface EventsFetchTimeBucketsByNamesOutput { + /** the time buckets */ + timeBuckets: string[]; + /** the next page cursor */ + nextCursor?: number; +} +/** + * Fetch time buckets for an event type + */ +declare class EventsFetchTimeBucketsByNamesCommand extends Command { + /** + * The dedicated subdomain for the command + */ + protected dedicatedSubdomain: string; + /** + * Get the base url for the request + */ + protected getBaseUrl(): string; + /** + * Get the path for the request + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): EventsFetchTimeBucketsByNamesOutput; + /** + * Get the body for the request + */ + protected getBody(): Record; +} + +/** + * The input for the events fetch indexes command + */ +interface EventsFetchEventsInput { + /** the tenant */ + tenant: string; + /** the data core id */ + dataCoreId: string; + /** the flow type name */ + flowType: string; + /** the event type names */ + eventTypes: string[]; + /** the time bucket */ + timeBucket: string; + /** the paging cursor */ + cursor?: string; + /** the page size (default is 10.000) */ + pageSize?: number; + /** start from this event id */ + fromEventId?: string; + /** after this event id */ + afterEventId?: string; + /** end at this event id */ + toEventId?: string; + /** include sensitive data */ + includeSensitiveData?: boolean; +} +/** + * The output for the events fetch indexes command + */ +interface EventsFetchEventsOutput { + /** the events */ + events: FlowcoreEvent[]; + /** the next page cursor */ + nextCursor?: string; +} +/** + * Fetch time buckets for an event type + */ +declare class EventsFetchCommand extends Command { + /** + * The dedicated subdomain for the command + */ + protected dedicatedSubdomain: string; + /** + * Get the base url for the request + */ + protected getBaseUrl(): string; + /** + * Get the path for the request + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): EventsFetchEventsOutput; + /** + * Get the body for the request + */ + protected getBody(): Record; +} + +/** + * The input for the events fetch indexes command + */ +interface TimeBucketListInput { + /** the tenant */ + tenant: string; + /** the event type ids */ + eventTypeId: [string, ...string[]] | string; + /** the start time */ + fromTimeBucket?: string; + /** the end time */ + toTimeBucket?: string; + /** the page size */ + pageSize?: number; + /** the cursor */ + cursor?: number; + /** the order */ + order?: "asc" | "desc"; +} +/** + * The output for the events fetch indexes command + */ +interface TimeBucketListOutput { + /** the time buckets */ + timeBuckets: string[]; + /** the next cursor */ + nextCursor?: number; +} +/** + * Fetch time buckets for an event type + */ +declare class TimeBucketListCommand extends Command { + /** + * The dedicated subdomain for the command + */ + protected dedicatedSubdomain: string; + /** + * Get the method for the request + */ + protected getMethod(): string; + /** + * Get the base url for the request + */ + protected getBaseUrl(): string; + /** + * Get the path for the request + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): TimeBucketListOutput; +} + +/** + * the schema for a container + */ +declare const ContainerRegistrySchema: TObject<{ + tenantId: TString; + name: TString; + description: TOptional; + username: TOptional; + id: TString; +}>; +declare const ContainerRegistryCreateSchema: TObject<{ + id: TString; +}>; +declare const ContainerRegistryDeleteSchema: TObject<{ + status: TNumber; +}>; +declare const ContainerRegistryListSchema: TArray; +type ContainerRegistry = Static; +type ContainerRegistryList = Static; +type ContainerRegistryCreate = Static; +type ContainerRegistryDelete = Static; + +interface ContainerRegistryCreateInput { + /** The tenant id to add the container registry to*/ + tenantId: string; + /** The name of the container registry */ + name: string; + /**A description of the container registry */ + description?: string; + /** The URL of the container registry */ + registryUrl: string; + /** The username to authenticate with the container registry */ + username?: string; + /** The password to authenticate with the container registry */ + password?: string; +} +interface ContainerRegistryCreateOutput { + /** The id of the new container-registry */ + id: string; +} +declare class ContainerRegistryCreateCommand extends Command { + /** + * GET the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(response: unknown): ContainerRegistryCreate; +} + +interface ContainerRegistryDeleteInput { + /** The id of the new container-registry */ + containerId: string; +} +declare class ContainerRegistryDeleteCommand extends Command { + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(response: unknown): ContainerRegistryDelete; +} + +interface ContainerRegistryFetchInput { + /** The id of container */ + containerId: string; +} +declare class ContainerRegistryFetchCommand extends Command { + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(response: unknown): ContainerRegistry; +} + +interface ContainerRegistryFetchTenantInput { + /** The tenant id */ + tenantId: string; +} +declare class ContainerRegistListCommand extends Command { + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(response: unknown): ContainerRegistryList; +} + +interface ContainerRegustryUpdateInput { + /** The id of the container-registry */ + containerId: string; + /** The name of the container-registry */ + name?: string; + /** The description */ + description?: string; + /** The registry url for the container */ + registryUrl?: string; + /** The username for authentication */ + username?: string; + /** The password for authentication */ + password?: string; +} +declare class ContainerRegistryUpdateCommand extends Command { + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(response: unknown): ContainerRegistry; +} + +/** + * The schema for a PAT (Personal Access Token) + */ +declare const PATSchema: TObject<{ + id: TString; + name: TString; + description: TOptional; + token: TOptional; + createdAt: TString; +}>; +/** + * The type for a PAT + */ +type PAT = Static; + +/** + * The input for the PAT create command + */ +interface SecurityCreatePAT { + /** The name of the PAT */ + name: string; + /** The description of the PAT */ + description?: string; +} +/** + * Create a Personal Access Token (PAT) + */ +declare class SecurityCreatePATCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): PAT; +} + +/** + * The input for the PAT delete command + */ +interface SecurityDeletePAT { + /** The id of the PAT */ + id: string; +} +interface SecurityDeletePATResponse { + success: boolean; +} +/** + * Delete a Personal Access Token (PAT) + */ +declare class SecurityDeletePATCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): SecurityDeletePATResponse; +} + +/** + * The input for the PAT create command + */ +interface SecurityExchangePAT { + /** The username of the user */ + username: string; + /** The Personal Access Token */ + pat: string; +} +interface SecurityExchangePATResponse { + /** The token of the PAT */ + accessToken: string; +} +/** + * Exchange a Personal Access Token (PAT) for an access token + */ +declare class SecurityExchangePATCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + protected getHeaders(): Record; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): SecurityExchangePATResponse; +} + +/** + * The input for the PAT get command + */ +interface SecurityGetPAT { + /** The id of the PAT */ + id: string; +} +/** + * Get a Personal Access Token (PAT) + */ +declare class SecurityGetPATCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): PAT; +} + +/** + * List all your Personal Access Token (PAT) + */ +declare class SecurityListPATCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): PAT[]; +} + +/** + * The schema for a permission + */ +declare const PermissionSchema: TObject<{ + tenant: TString; + type: TString; + id: TString; + action: TArray, + TLiteral<"write">, + TLiteral<"ingest">, + TLiteral<"fetch">, + TLiteral<"sensitive-data-fetch">, + TString + ]>>; +}>; +/** + * The type for a permission + */ +type Permission = Static; + +/** + * The input for the permissions list command + */ +interface PermissionsListInput { + /** Filter by the type of the frn */ + type?: string; +} +/** + * Fetch an event type + */ +declare class PermissionsListCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Permission[]; +} + +/** + * The input for initializing user in Keycloak + * No input parameters needed - checks current authenticated user + */ +type UserInitializeInKeycloakInput = Record; +/** + * The output for initializing user in Keycloak + * (matches the REST API response) + */ +type UserInitializeInKeycloakOutput = Static; +declare const responseSchema$2: TObject<{ + id: TString; + username: TString; + email: TString; + firstName: TString; + lastName: TString; +}>; +/** + * Finalize user initialization by setting Flowcore User ID in Keycloak. + * + * Calls `POST /api/users` on the user service with an empty JSON body. + * Requires a bearer token. + */ +declare class UserInitializeInKeycloakCommand extends Command { + /** + * The allowed modes for the command + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Get the base URL for the request + */ + protected getBaseUrl(): string; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the path for the request + */ + protected getPath(): string; + /** + * Get the body for the request (must be an empty JSON object) + */ + protected getBody(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): UserInitializeInKeycloakOutput; +} + +/** + * The input for deleting the current authenticated user + * No input parameters needed - checks current authenticated user + */ +type UserDeleteInput = Record; +/** + * The output for deleting the current authenticated user + */ +type UserDeleteOutput = Static; +declare const responseSchema$1: TObject<{ + id: TString; +}>; +/** + * Delete current authenticated user + */ +declare class UserDeleteCommand extends Command { + /** + * The allowed modes for the command + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Get the base URL for the request + */ + protected getBaseUrl(): string; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the path for the request + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): UserDeleteOutput; +} + +/** + * The input for inviting an existing user to a tenant + */ +interface UserInviteToTenantInput { + tenantName: string; + userEmail: string; +} +/** + * The output for inviting an existing user to a tenant + */ +type UserInviteToTenantOutput = Static; +declare const responseSchema: TObject<{ + success: TBoolean; + tenantName: TString; + invitedEmail: TString; +}>; +/** + * Invite an existing user (by email) to a tenant + */ +declare class UserInviteToTenantCommand extends Command { + /** + * The allowed modes for the command + */ + protected allowedModes: ("apiKey" | "bearer")[]; + /** + * Get the base URL for the request + */ + protected getBaseUrl(): string; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the path for the request + */ + protected getPath(): string; + /** + * Get the body for the request + */ + protected getBody(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): UserInviteToTenantOutput; +} + +interface DataPathwayAssignmentCompleteInput { + slotId: string; + assignmentId: string; + pathwayId: string; + outcome: "completed" | "failed" | "revoked"; +} +declare class DataPathwayAssignmentCompleteCommand extends Command { + protected retryOnFailure: boolean; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected parseResponse(_rawResponse: unknown): null; +} + +type TSizeClass = TUnion<[TLiteral<"small">, TLiteral<"medium">, TLiteral<"high">]>; +type TStringRecord$1 = TRecord; +type TUnknownRecord = TRecord; +type TNullableString = TUnion<[TString, TNull]>; +type TEndpointConfig = TObject<{ + url: TString; + authHeaders: TOptional; +}>; +type TBackoffConfig = TOptional; + maxMs: TOptional; + multiplier: TOptional; +}>>; +type TTimeoutConfig = TOptional; + fetchMs: TOptional; +}>>; +type TSourceConfig = TObject<{ + id: TOptional; + name: TOptional; + flowType: TString; + eventTypes: TArray; + endpoints: TArray; + batchSize: TOptional; + maxInFlight: TOptional; + backoff: TBackoffConfig; + timeouts: TTimeoutConfig; +}>; +type TDataSourceConfig = TObject<{ + tenant: TString; + dataCore: TString; +}>; +type TAuthConfig = TObject<{ + apiKey: TString; +}>; +type TPathwayConfig = TObject<{ + sources: TArray; +}>; +type TPumpConfig = TObject<{ + sources: TArray; + dataSource: TDataSourceConfig; + auth: TOptional; +}>; +/** User-facing pathway config — what the API accepts on create/update */ +declare const PathwayConfigSchema: TPathwayConfig; +type PathwayConfig = Static; +/** Rendered pump config — what the worker receives (CP injects dataSource + auth) */ +declare const PumpConfigSchema: TPumpConfig; +type PumpConfig = Static; +type TPathwayType = TOptional, TLiteral<"virtual">]>>; +type TVirtualConfig = TObject<{ + flowTypes: TOptional>; +}>; +/** + * What a virtual pathway consumes, and therefore what a command may target. + * + * Entries are either a bare flow type (`"orders.0"`, every pump group on it) or a + * composite `"orders.0::hot"` naming one pump group. A pump group belongs to exactly one + * flow type, so the pair is the identity and one array carries both levels of precision. + */ +declare const VirtualConfigSchema: TVirtualConfig; +type VirtualConfig = Static; +/** + * Desired delivery state of a virtual pathway. + * + * `paused` means the control plane has told the consumer to stop delivering to its + * handlers. The pump keeps running, keeps its buffer and keeps its cursor. A consumer + * reads this at boot so a redeploy comes back paused rather than silently resuming. + * + * Optional: a control plane older than the pause feature omits it. + */ +type TDeliveryState = TUnion<[TLiteral<"active">, TLiteral<"paused">]>; +type TNullableStringArray = TUnion<[TArray, TNull]>; +declare const DataPathwaySchema: TObject<{ + id: TString; + tenant: TString; + name: TOptional; + dataCore: TString; + sizeClass: TSizeClass; + type: TPathwayType; + enabled: TBoolean; + priority: TInteger; + version: TInteger; + labels: TStringRecord$1; + config: TOptional; + virtualConfig: TOptional; + deliveryState: TOptional; + deliveryPauseTargets: TOptional; + createdAt: TString; + updatedAt: TString; +}>; +type DataPathway = Static; +declare const DataPathwayListSchema: TObject<{ + pathways: TArray; + total: TInteger; +}>; +type DataPathwayList = Static; +declare const DataPathwayMutationResponseSchema: TObject<{ + pathwayId: TString; + status: TString; + apiKey: TOptional; +}>; +type DataPathwayMutationResponse = Static; +declare const DataPathwaySlotSchema: TObject<{ + id: TString; + podUnitId: TString; + class: TSizeClass; + labels: TStringRecord$1; + lastSeen: TString; + createdAt: TString; + updatedAt: TString; +}>; +type DataPathwaySlot = Static; +declare const DataPathwaySlotListSchema: TObject<{ + slots: TArray; + total: TInteger; +}>; +type DataPathwaySlotList = Static; +declare const DataPathwaySlotMutationResponseSchema: TObject<{ + slotId: TString; + status: TString; +}>; +type DataPathwaySlotMutationResponse = Static; +declare const DataPathwayAssignmentSchema: TObject<{ + id: TString; + pathwayId: TString; + slotId: TString; + generation: TInteger; + leaseTTL: TString; + status: TString; + config: TPumpConfig; + createdAt: TString; + updatedAt: TString; +}>; +type DataPathwayAssignment = Static; +type TAssignmentNextInner = TObject<{ + assignmentId: TString; + pathwayId: TString; + slotId: TString; + generation: TInteger; + config: TPumpConfig; + leaseTTL: TString; + status: TString; +}>; +declare const DataPathwayAssignmentNextSchema: TObject<{ + assignment: TUnion<[TAssignmentNextInner, TNull]>; +}>; +type DataPathwayAssignmentNext = Static; +declare const DataPathwayAssignmentListSchema: TObject<{ + assignments: TArray; + total: TInteger; +}>; +type DataPathwayAssignmentList = Static; +declare const DataPathwayExpireLeasesResponseSchema: TObject<{ + expired: TInteger; +}>; +type DataPathwayExpireLeasesResponse = Static; +declare const DataPathwayCommandSchema: TObject<{ + id: TString; + restartRequestId: TNullableString; + assignmentId: TString; + type: TString; + generation: TInteger; + position: TUnion<[TUnknownRecord, TNull]>; + stopAt: TNullableString; + timeoutMs: TUnion<[TInteger, TNull]>; + phase: TString; + reason: TNullableString; + createdAt: TString; +}>; +type DataPathwayCommand = Static; +declare const DataPathwayCommandListSchema: TObject<{ + commands: TArray; +}>; +type DataPathwayCommandList = Static; +declare const DataPathwayCommandResponseSchema: TObject<{ + commandId: TString; + phase: TString; +}>; +type DataPathwayCommandResponse = Static; +declare const DataPathwayCommandDetailSchema: TObject<{ + id: TString; + restartRequestId: TNullableString; + assignmentId: TNullableString; + pathwayId: TNullableString; + type: TString; + generation: TUnion<[TInteger, TNull]>; + position: TUnion<[TUnknownRecord, TNull]>; + stopAt: TNullableString; + timeoutMs: TUnion<[TInteger, TNull]>; + phase: TString; + reason: TNullableString; + details: TNullableString; + config: TUnion<[TUnknownRecord, TNull]>; + sourceFlowTypes: TUnion<[TArray, TNull]>; + createdAt: TString; + updatedAt: TString; +}>; +type DataPathwayCommandDetail = Static; +declare const DataPathwayRestartRequestResponseSchema: TObject<{ + restartRequestId: TString; + acceptedTargets: TArray; + skippedTargets: TArray; +}>; +type DataPathwayRestartRequestResponse = Static; +declare const DataPathwayRestartRequestSchema: TObject<{ + id: TString; + targets: TUnknownRecord; + mode: TString; + position: TUnknownRecord; + status: TString; + requestedBy: TString; + reason: TNullableString; + createdAt: TString; + updatedAt: TString; +}>; +type DataPathwayRestartRequest = Static; +type TSlotCount = TObject<{ + free: TInteger; + used: TInteger; +}>; +type TThreeClassIntegers = TObject<{ + small: TInteger; + medium: TInteger; + high: TInteger; +}>; +declare const DataPathwayCapacitySchema: TObject<{ + slots: TObject<{ + small: TSlotCount; + medium: TSlotCount; + high: TSlotCount; + }>; + pendingAssignments: TThreeClassIntegers; +}>; +type DataPathwayCapacity = Static; +declare const DataPathwayQuotaSchema: TObject<{ + tenant: TString; + maxSlots: TThreeClassIntegers; + createdAt: TString; + updatedAt: TString; +}>; +type DataPathwayQuota = Static; +declare const DataPathwayQuotaWithUsageSchema: TObject<{ + tenant: TString; + maxSlots: TThreeClassIntegers; + used: TThreeClassIntegers; +}>; +type DataPathwayQuotaWithUsage = Static; +declare const DataPathwayQuotaListSchema: TObject<{ + quotas: TArray; + total: TInteger; +}>; +type DataPathwayQuotaList = Static; +declare const DataPathwayQuotaSetResponseSchema: TObject<{ + tenant: TString; + status: TString; +}>; +type DataPathwayQuotaSetResponse = Static; +type TPumpStateValue = TObject<{ + timeBucket: TString; + eventId: TOptional; +}>; +declare const DataPathwayPumpStateSchema: TObject<{ + pathwayId: TString; + flowType: TString; + state: TUnion<[TPumpStateValue, TNull]>; +}>; +type DataPathwayPumpState = Static; +declare const DataPathwayPumpStateBySourceSchema: TObject<{ + pathwayId: TString; + sourceId: TString; + flowType: TUnion<[TString, TNull]>; + state: TUnion<[TPumpStateValue, TNull]>; +}>; +type DataPathwayPumpStateBySource = Static; +declare const DataPathwayPumpStateSaveResponseSchema: TObject<{ + status: TString; +}>; +type DataPathwayPumpStateSaveResponse = Static; +declare const DataPathwayDeliveryLogEntrySchema: TObject<{ + id: TString; + pathwayId: TString; + assignmentId: TString; + endpointUrl: TString; + httpStatus: TUnion<[TInteger, TNull]>; + success: TBoolean; + batchSize: TUnion<[TInteger, TNull]>; + durationMs: TUnion<[TInteger, TNull]>; + errorMessage: TUnion<[TString, TNull]>; + responseBody: TUnion<[TString, TNull]>; + flowType: TUnion<[TString, TNull]>; + sourceId: TUnion<[TString, TNull]>; + eventType: TUnion<[TString, TNull]>; + createdAt: TString; +}>; +declare const DataPathwayDeliveryLogListSchema: TObject<{ + entries: TArray; + total: TInteger; +}>; +type DataPathwayDeliveryLogList = Static; +declare const DataPathwayDeliveryLogBatchEntrySchema: TObject<{ + pathwayId: TString; + assignmentId: TString; + endpointUrl: TString; + flowType: TOptional; + sourceId: TOptional; + eventType: TOptional; + httpStatus: TOptional; + success: TBoolean; + batchSize: TOptional; + durationMs: TOptional; + errorMessage: TOptional; + responseBody: TOptional; +}>; +type DataPathwayDeliveryLogBatchEntry = Static; +declare const DataPathwayDeliveryLogBatchResponseSchema: TObject<{ + inserted: TInteger; +}>; +type DataPathwayDeliveryLogBatchResponse = Static; +type TThroughputRecentResult = TObject<{ + status: TNumber; + durationMs: TNumber; + success: TBoolean; + ageMs: TNumber; +}>; +type TNullableNumber = TUnion<[TNumber, TNull]>; +type TThroughputSource = TObject<{ + flowType: TString; + name: TOptional; + eventsPerSecond: TNumber; + successRate: TNumber; + avgDurationMs: TNumber; + totalDelivered: TNumber; + totalFailed: TNumber; + lastDeliveryAgeMs: TNullableNumber; + healthy: TBoolean; + recentResults: TArray; +}>; +type TThroughputEndpoint = TObject<{ + eventsPerSecond: TNumber; + successRate: TNumber; + totalDelivered: TNumber; + totalFailed: TNumber; + lastDeliveryAgeMs: TNullableNumber; + healthy: TBoolean; + sources: TRecord; +}>; +type TThroughputGlobal = TObject<{ + eventsPerSecond: TNumber; + totalRecorded: TNumber; + windowSeconds: TNumber; +}>; +type TThroughputSnapshot = TObject<{ + global: TThroughputGlobal; + endpoints: TRecord; +}>; +type TMetricsAssignmentEntry = TObject<{ + assignmentId: TString; + status: TString; + throughput: TUnion<[TThroughputSnapshot, TNull]>; + updatedAt: TString; +}>; +declare const DataPathwayMetricsSchema: TObject<{ + pathwayId: TString; + assignments: TArray; +}>; +type DataPathwayMetrics = Static; +declare const DataPathwayHealthSchema: TObject<{ + status: TUnion<[TLiteral<"healthy">, TLiteral<"unhealthy">]>; + checks: TObject<{ + db: TUnion<[TLiteral<"ok">, TLiteral<"error">]>; + }>; + uptime: TNumber; +}>; +type DataPathwayHealth = Static; +declare const DataPathwayPumpPulseResponseSchema: TObject<{ + status: TString; +}>; +type DataPathwayPumpPulseResponse = Static; +declare const DataPathwayPumpStatusSchema: TObject; +type DataPathwayPumpStatus = Static; + +type DataPathwayAssignmentExpireLeasesInput = Record; +declare class DataPathwayAssignmentExpireLeasesCommand extends Command { + protected retryOnFailure: boolean; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getBaseUrl(): string; + protected getPath(): string; + protected getBody(): Record | undefined; + protected parseResponse(rawResponse: unknown): DataPathwayExpireLeasesResponse; +} + +interface DataPathwayAssignmentFetchInput { + id: string; +} +declare class DataPathwayAssignmentFetchCommand extends Command { + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected parseResponse(rawResponse: unknown): DataPathwayAssignment; + protected handleClientError(error: ClientError): void; +} + +interface DataPathwayAssignmentHeartbeatInput { + slotId: string; + assignmentId: string; + pathwayId: string; + metrics: { + eventsFetchedTotal?: number; + eventsDeliveredTotal?: number; + deliveryErrorsTotal?: number; + bufferDepth?: number; + lagSeconds?: number; + throughput?: { + global: { + eventsPerSecond: number; + totalRecorded: number; + windowSeconds: number; + }; + endpoints: Record; + }>; + }>; + }; + }; +} +declare class DataPathwayAssignmentHeartbeatCommand extends Command { + protected retryOnFailure: boolean; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected parseResponse(_rawResponse: unknown): null; +} + +interface DataPathwayAssignmentListInput { + status?: "active" | "completed" | "failed" | "revoked" | "expired"; + slotId?: string; + pathwayId?: string; + limit?: number; + offset?: number; + sort?: "asc" | "desc"; +} +declare class DataPathwayAssignmentListCommand extends Command { + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected parseResponse(rawResponse: unknown): DataPathwayAssignmentList; +} + +interface DataPathwayAssignmentNextInput { + slotId: string; + class: "small" | "medium" | "high"; +} +declare class DataPathwayAssignmentNextCommand extends Command { + protected retryOnFailure: boolean; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getBaseUrl(): string; + protected getPath(): string; + protected parseResponse(rawResponse: unknown): DataPathwayAssignmentNext; +} + +type DataPathwayCapacityFetchInput = Record; +declare class DataPathwayCapacityFetchCommand extends Command { + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected parseResponse(rawResponse: unknown): DataPathwayCapacity; +} + +interface DataPathwayCommandDispatchConfigUpdateInput { + assignmentId: string; + generation: number; + config: Record; +} +declare class DataPathwayCommandDispatchConfigUpdateCommand extends Command { + protected retryOnFailure: boolean; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getBaseUrl(): string; + protected getPath(): string; + protected getBody(): Record; + protected parseResponse(rawResponse: unknown): DataPathwayCommandResponse; + protected handleClientError(error: ClientError): void; +} + +interface DataPathwayCommandDispatchRestartInput { + assignmentId: string; + restartRequestId?: string; + generation: number; + position?: { + timeBucket?: string; + eventId?: string; + }; + stopAt?: string | null; + timeoutMs?: number; +} +declare class DataPathwayCommandDispatchRestartCommand extends Command { + protected retryOnFailure: boolean; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getBaseUrl(): string; + protected getPath(): string; + protected getBody(): Record; + protected parseResponse(rawResponse: unknown): DataPathwayCommandResponse; + protected handleClientError(error: ClientError): void; +} + +interface DataPathwayCommandDispatchStopInput { + assignmentId: string; + restartRequestId?: string; + generation: number; + reason?: string; + timeoutMs?: number; +} +declare class DataPathwayCommandDispatchStopCommand extends Command { + protected retryOnFailure: boolean; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getBaseUrl(): string; + protected getPath(): string; + protected getBody(): Record; + protected parseResponse(rawResponse: unknown): DataPathwayCommandResponse; + protected handleClientError(error: ClientError): void; +} + +interface DataPathwayCommandFetchInput { + commandId: string; +} +declare class DataPathwayCommandFetchCommand extends Command { + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected parseResponse(rawResponse: unknown): DataPathwayCommandDetail; + protected handleClientError(error: ClientError): void; +} + +interface DataPathwayCommandPendingInput { + assignmentId: string; +} +declare class DataPathwayCommandPendingCommand extends Command { + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected parseResponse(rawResponse: unknown): DataPathwayCommandList; + protected handleClientError(error: ClientError): void; +} + +interface DataPathwayCommandUpdateStatusInput { + assignmentId: string; + commandId: string; + phase: "acknowledged" | "restarting" | "running" | "failed" | "timedOut"; + details?: string; +} +declare class DataPathwayCommandUpdateStatusCommand extends Command { + protected retryOnFailure: boolean; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getBaseUrl(): string; + protected getPath(): string; + protected getBody(): Record; + protected parseResponse(rawResponse: unknown): DataPathwayCommandResponse; + protected handleClientError(error: ClientError): void; +} + +interface DataPathwayDeliveryLogBatchInput { + entries: DataPathwayDeliveryLogBatchEntry[]; +} +declare class DataPathwayDeliveryLogBatchCommand extends Command { + protected retryOnFailure: boolean; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected getBody(): Record; + protected parseResponse(rawResponse: unknown): DataPathwayDeliveryLogBatchResponse; +} + +interface DataPathwayDeliveryLogListInput { + pathwayId: string; + success?: boolean; + limit?: number; + offset?: number; + sort?: "asc" | "desc"; +} +declare class DataPathwayDeliveryLogListCommand extends Command { + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected parseResponse(rawResponse: unknown): DataPathwayDeliveryLogList; +} + +type DataPathwayHealthCheckInput = Record; +declare class DataPathwayHealthCheckCommand extends Command { + protected retryOnFailure: boolean; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected parseResponse(rawResponse: unknown): DataPathwayHealth; +} + +interface DataPathwayCreateInput { + id: string; + tenant: string; + dataCore: string; + sizeClass: "small" | "medium" | "high"; + enabled?: boolean; + priority?: number; + version?: number; + labels?: Record; + config?: PathwayConfig; + type?: "managed" | "virtual"; + virtualConfig?: VirtualConfig; +} +declare class DataPathwayCreateCommand extends Command { + protected retryOnFailure: boolean; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected getBody(): Record; + protected parseResponse(rawResponse: unknown): DataPathwayMutationResponse; +} + +interface DataPathwayDeleteInput { + id: string; + reason?: string; +} +declare class DataPathwayDeleteCommand extends Command { + protected retryOnFailure: boolean; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected getBody(): Record; + protected parseResponse(rawResponse: unknown): DataPathwayMutationResponse; + protected handleClientError(error: ClientError): void; +} + +interface DataPathwayDisableInput { + id: string; + reason?: string; +} +declare class DataPathwayDisableCommand extends Command { + protected retryOnFailure: boolean; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected getBody(): Record; + protected parseResponse(rawResponse: unknown): DataPathwayMutationResponse; + protected handleClientError(error: ClientError): void; +} + +interface DataPathwayFetchInput { + id: string; +} +declare class DataPathwayFetchCommand extends Command { + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected parseResponse(rawResponse: unknown): DataPathway; + protected handleClientError(error: ClientError): void; +} + +interface DataPathwayFetchByNameInput { + name: string; + tenant: string; +} +declare class DataPathwayFetchByNameCommand extends Command { + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected parseResponse(rawResponse: unknown): DataPathway; + protected handleClientError(error: ClientError): void; +} + +interface DataPathwayListInput { + tenant?: string; + sizeClass?: "small" | "medium" | "high"; + type?: "managed" | "virtual"; + enabled?: boolean; + priority?: number; + limit?: number; + offset?: number; + /** Page number (1-based). When set, offset is derived as (page - 1) * limit. */ + page?: number; + /** Pathway ids to pin to the front of the list (comma-separated string or array) */ + ids?: string | string[]; + sort?: "asc" | "desc"; +} +declare class DataPathwayListCommand extends Command { + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected parseResponse(rawResponse: unknown): DataPathwayList; +} + +interface DataPathwayMetricsFetchInput { + id: string; +} +declare class DataPathwayMetricsFetchCommand extends Command { + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected parseResponse(rawResponse: unknown): DataPathwayMetrics; + protected handleClientError(error: ClientError): void; +} + +type TUpsertResponse = TObject<{ + pathwayId: TString; + status: TUnion<[TLiteral<"created">, TLiteral<"updated">]>; +}>; +declare const DataPathwayUpsertByNameResponseSchema: TUpsertResponse; +type DataPathwayUpsertByNameResponse = Static; +interface DataPathwayUpsertByNameInput { + name: string; + tenant: string; + dataCore: string; + sizeClass?: "small" | "medium" | "high"; + enabled?: boolean; + labels?: Record; + type?: "managed" | "virtual"; + config?: PathwayConfig; + virtualConfig?: VirtualConfig; +} +declare class DataPathwayUpsertByNameCommand extends Command { + protected retryOnFailure: boolean; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected getBody(): Record; + protected parseResponse(rawResponse: unknown): DataPathwayUpsertByNameResponse; +} + +interface DataPathwayCommandDispatchPauseInput { + pathwayId: string; + /** + * What to pause. Each entry is either a bare flow type (`"orders.0"`, every pump group + * on it) or a composite `"orders.0::hot"` naming exactly one pump. Omit to pause every + * pump. + * + * A composite target is rejected with 409 unless the pathway advertised composite + * entries in `virtualConfig.flowTypes`. An older consumer compares targets against flow + * type names only, so it would match nothing and pause nothing. + */ + targets?: string[]; + reason?: string; + requestedBy?: string; + timeoutMs?: number; +} +/** + * Pause delivery on a virtual pathway. + * + * Delivery to the consumer's handlers stops while its pump keeps fetching, keeps its + * buffer and keeps its cursor. The desired state is recorded on the pathway, so a + * consumer that restarts comes back paused at the same position. + * + * This is NOT `disable`. Disabling a virtual pathway deletes its API key, and a later + * enable resets the cursor to latest. + */ +declare class DataPathwayCommandDispatchPauseCommand extends Command { + protected retryOnFailure: boolean; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getBaseUrl(): string; + protected getPath(): string; + protected getBody(): Record; + protected parseResponse(rawResponse: unknown): DataPathwayCommandResponse; + protected handleClientError(error: ClientError): void; +} + +interface DataPathwayCommandDispatchResumeInput { + pathwayId: string; + /** + * What to resume. Same shape as the pause targets: a bare flow type, or a composite + * `"orders.0::hot"`. Omit to resume every pump. + */ + targets?: string[]; + reason?: string; + requestedBy?: string; + timeoutMs?: number; +} +/** + * Resume delivery on a virtual pathway, continuing from the exact position where + * {@link DataPathwayCommandDispatchPauseCommand} stopped it. + */ +declare class DataPathwayCommandDispatchResumeCommand extends Command { + protected retryOnFailure: boolean; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getBaseUrl(): string; + protected getPath(): string; + protected getBody(): Record; + protected parseResponse(rawResponse: unknown): DataPathwayCommandResponse; + protected handleClientError(error: ClientError): void; +} + +interface DataPathwayCommandPendingByPathwayInput { + pathwayId: string; +} +/** + * Fetch pending commands for a virtual pathway. Mirrors the assignment-scoped + * `command.pending` endpoint but for virtual pathways that poll by pathwayId. + */ +declare class DataPathwayCommandPendingByPathwayCommand extends Command { + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected parseResponse(rawResponse: unknown): DataPathwayCommandList; + protected handleClientError(error: ClientError): void; +} + +interface DataPathwayCommandUpdateStatusByPathwayInput { + pathwayId: string; + commandId: string; + phase: "acknowledged" | "restarting" | "running" | "failed" | "timedOut"; + details?: string; +} +/** + * Update command status for a virtual pathway callback. Mirrors the + * assignment-scoped `command.update-status` endpoint but for virtual pathways + * that report completion by pathwayId. + */ +declare class DataPathwayCommandUpdateStatusByPathwayCommand extends Command { + protected retryOnFailure: boolean; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getBaseUrl(): string; + protected getPath(): string; + protected getBody(): Record; + protected parseResponse(rawResponse: unknown): DataPathwayCommandResponse; + protected handleClientError(error: ClientError): void; +} + +interface SendPumpPulseInput { + pathwayId: string; + sourceId?: string; + flowType: string; + timeBucket: string; + eventId: string | null; + isLive: boolean; + buffer: { + depth: number; + reserved: number; + sizeBytes: number; + }; + counters: { + acknowledged: number; + failed: number; + pulled: number; + }; + uptimeMs: number; +} +declare class SendPumpPulseCommand extends Command { + protected retryOnFailure: boolean; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected parseResponse(rawResponse: unknown): DataPathwayPumpPulseResponse; +} + +interface DataPathwayPumpStateFetchInput { + pathwayId: string; + flowType: string; +} +declare class DataPathwayPumpStateFetchCommand extends Command { + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected parseResponse(rawResponse: unknown): DataPathwayPumpState; + protected handleClientError(error: ClientError): void; +} + +interface DataPathwayPumpStateFetchBySourceInput { + pathwayId: string; + sourceId: string; +} +declare class DataPathwayPumpStateFetchBySourceCommand extends Command { + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected parseResponse(rawResponse: unknown): DataPathwayPumpStateBySource; + protected handleClientError(error: ClientError): void; +} + +interface DataPathwayPumpStateSaveInput { + pathwayId: string; + flowType: string; + state: { + timeBucket: string; + eventId?: string; + }; +} +declare class DataPathwayPumpStateSaveCommand extends Command { + protected retryOnFailure: boolean; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected getBody(): Record; + protected parseResponse(rawResponse: unknown): DataPathwayPumpStateSaveResponse; +} + +interface DataPathwayPumpStateSaveBySourceInput { + pathwayId: string; + sourceId: string; + state: { + timeBucket: string; + eventId?: string; + }; +} +declare class DataPathwayPumpStateSaveBySourceCommand extends Command { + protected retryOnFailure: boolean; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected getBody(): Record; + protected parseResponse(rawResponse: unknown): DataPathwayPumpStateSaveResponse; +} + +interface FetchPumpStatusInput { + pathwayId: string; +} +declare class FetchPumpStatusCommand extends Command { + protected retryOnFailure: boolean; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected getBody(): Record | undefined; + protected parseResponse(rawResponse: unknown): DataPathwayPumpStatus; + protected handleClientError(error: ClientError): void; +} + +interface DataPathwayQuotaFetchInput { + tenant: string; +} +declare class DataPathwayQuotaFetchCommand extends Command { + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected parseResponse(rawResponse: unknown): DataPathwayQuotaWithUsage; + protected handleClientError(error: ClientError): void; +} + +type DataPathwayQuotaListInput = Record; +declare class DataPathwayQuotaListCommand extends Command { + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected parseResponse(rawResponse: unknown): DataPathwayQuotaList; +} + +interface DataPathwayQuotaSetInput { + tenant: string; + maxSlots: { + small: number; + medium: number; + high: number; + }; +} +declare class DataPathwayQuotaSetCommand extends Command { + protected retryOnFailure: boolean; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected getBody(): Record; + protected parseResponse(rawResponse: unknown): DataPathwayQuotaSetResponse; +} + +interface DataPathwayRestartFetchInput { + id: string; +} +declare class DataPathwayRestartFetchCommand extends Command { + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected parseResponse(rawResponse: unknown): DataPathwayRestartRequest; + protected handleClientError(error: ClientError): void; +} + +interface DataPathwayRestartRequestInput { + targets: { + flowTypes?: string[]; + pathwayIds?: string[]; + selector?: { + tenant?: string; + labels?: Record; + }; + }; + mode?: "datapumpRestart" | "hardReset"; + position: { + timeBucket?: string; + eventId?: string; + }; + stopAt?: string | null; + timeoutMs?: number; + requestedBy: string; + reason?: string; +} +declare class DataPathwayRestartRequestCommand extends Command { + protected retryOnFailure: boolean; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getBaseUrl(): string; + protected getPath(): string; + protected parseResponse(rawResponse: unknown): DataPathwayRestartRequestResponse; +} + +interface DataPathwaySlotDeregisterInput { + id: string; + reason?: string; +} +declare class DataPathwaySlotDeregisterCommand extends Command { + protected retryOnFailure: boolean; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getBaseUrl(): string; + protected getPath(): string; + protected getBody(): Record; + protected parseResponse(rawResponse: unknown): DataPathwaySlotMutationResponse; + protected handleClientError(error: ClientError): void; +} + +interface DataPathwaySlotFetchInput { + id: string; +} +declare class DataPathwaySlotFetchCommand extends Command { + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected parseResponse(rawResponse: unknown): DataPathwaySlot; + protected handleClientError(error: ClientError): void; +} + +interface DataPathwaySlotHeartbeatInput { + id: string; +} +declare class DataPathwaySlotHeartbeatCommand extends Command { + protected retryOnFailure: boolean; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getBaseUrl(): string; + protected getPath(): string; + protected getBody(): Record; + protected parseResponse(rawResponse: unknown): DataPathwaySlotMutationResponse; + protected handleClientError(error: ClientError): void; +} + +interface DataPathwaySlotListInput { + class?: "small" | "medium" | "high"; + limit?: number; + offset?: number; + sort?: "asc" | "desc"; +} +declare class DataPathwaySlotListCommand extends Command { + protected allowedModes: ("apiKey" | "bearer")[]; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected parseResponse(rawResponse: unknown): DataPathwaySlotList; +} + +interface DataPathwaySlotRegisterInput { + slotId: string; + podUnitId: string; + class: "small" | "medium" | "high"; + version: string; + labels?: Record; +} +declare class DataPathwaySlotRegisterCommand extends Command { + protected retryOnFailure: boolean; + protected allowedModes: ("apiKey" | "bearer")[]; + protected getBaseUrl(): string; + protected getPath(): string; + protected parseResponse(rawResponse: unknown): DataPathwaySlotMutationResponse; +} + +/** + * The schema for a permission + */ +declare const UserPermissionSchema: TObject<{ + tenant: TString; + type: TString; + id: TString; + action: TArray; +}>; +/** + * The permission type + */ +type UserPermission = Static; +/** + * The input for the user permissions command + */ +interface UserPermissionsInput { + /** The optional permission type */ + type?: string; +} +/** + * Get all permissions for the current user + */ +declare class UserPermissionsCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): UserPermission[]; +} + +declare const PolicyFilterValueSchema: _sinclair_typebox.TUnion<[_sinclair_typebox.TString, _sinclair_typebox.TNumber, _sinclair_typebox.TBoolean, _sinclair_typebox.TNull]>; +declare const PolicyFilterSchema: _sinclair_typebox.TUnion<[_sinclair_typebox.TObject<{ + path: _sinclair_typebox.TString; + operator: _sinclair_typebox.TLiteral<"equals">; + value: _sinclair_typebox.TUnion<[_sinclair_typebox.TString, _sinclair_typebox.TNumber, _sinclair_typebox.TBoolean, _sinclair_typebox.TNull]>; +}>, _sinclair_typebox.TObject<{ + path: _sinclair_typebox.TString; + operator: _sinclair_typebox.TLiteral<"oneOf">; + values: _sinclair_typebox.TArray<_sinclair_typebox.TUnion<[_sinclair_typebox.TString, _sinclair_typebox.TNumber, _sinclair_typebox.TBoolean, _sinclair_typebox.TNull]>>; +}>, _sinclair_typebox.TObject<{ + path: _sinclair_typebox.TString; + operator: _sinclair_typebox.TLiteral<"exists">; + value: _sinclair_typebox.TBoolean; +}>]>; +type PolicyFilterValue = Static; +type PolicyFilter = Static; +declare function isEncryptedPayload(payload: unknown): boolean; +declare function matchesPolicyFilters(filters: readonly PolicyFilter[], payload: unknown): boolean; +type EntitlementGrant = { + policyFrn: string; + statementId: string; + resource: string; + filters?: PolicyFilter[]; +}; +declare function permitsPayload(grants: readonly EntitlementGrant[], payload: unknown): boolean; + +/** + * The schema for a policy statement document + */ +declare const PolicyStatementSchema: TObject<{ + statementId: TOptional; + resource: TString; + action: TUnion<[TString, TArray]>; + filters: TOptional>; +}>; +/** + * The schema for a policy + */ +declare const PolicySchema: TObject<{ + id: TString; + organizationId: TString; + name: TString; + version: TString; + policyDocuments: TArray; + description: TOptional; + principal: TOptional; + flowcoreManaged: TBoolean; + archived: TOptional; + frn: TString; +}>; +/** + * The Policy type + */ +type Policy = Static; +/** + * The Policy Statement type + */ +type PolicyStatement = Static; +/** + * The input for the policy create command + */ +interface PolicyCreateInput { + /** The organization id */ + organizationId: string; + /** The name of the policy */ + name: string; + /** The version of the policy */ + version: string; + /** The policy documents */ + policyDocuments: Array<{ + /** The optional statement id */ + statementId?: string; + /** The resource for this statement */ + resource: string; + /** The actions for this statement */ + action: string | string[]; + /** Optional plaintext event payload filters. */ + filters?: PolicyFilter[]; + }>; + /** The description of the policy */ + description?: string; + /** The principal role that can access the resource */ + principal?: string; + /** Whether the policy is managed by Flowcore */ + flowcoreManaged?: boolean; +} +/** + * Create a policy + */ +declare class PolicyCreateCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body + */ + protected getBody(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Policy; +} + +/** + * The input for the policy list command + */ +interface PolicyListInput { + /** The organization id */ + organizationId?: string; +} +/** + * List policies + */ +declare class PolicyListCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Policy[]; +} + +/** + * The schema for a successful policy validation response. + * + * Returned by `POST /api/v1/policies/validate` when the submitted policy + * payload passes every rule the create and patch paths enforce. Invalid + * payloads are surfaced as 4xx errors (422 for format / tenant boundary / + * UUID violations, 404 when the organization is not found) and are not + * represented in this schema. + */ +declare const PolicyValidateResponseSchema: TObject<{ + valid: TLiteral; +}>; +/** + * The Policy Validate response type + */ +type PolicyValidateResponse = Static; +/** + * The input for the policy validate command. + * + * Mirrors the service's `validatePolicyBody` DTO: only the fields that are + * actually validated are required. The command is a dry-run of the same + * helpers used by `PolicyCreateCommand` and `PolicyUpdateCommand`, so a + * successful response guarantees the payload would also be accepted by + * those commands. + */ +interface PolicyValidateInput { + /** The organization that would own the policy — used to enforce the tenant boundary on policyDocuments resources */ + organizationId: string; + /** The policy documents to validate */ + policyDocuments: Array<{ + /** The optional statement id */ + statementId?: string; + /** The resource for this statement */ + resource: string; + /** The actions for this statement */ + action: string | string[]; + /** Optional plaintext event payload filters. */ + filters?: PolicyFilter[]; + }>; + /** The optional principal role FRN (cross-tenant is intentionally permitted here) */ + principal?: string; +} +/** + * Dry-run validate a prospective policy payload. + * + * Calls `POST /api/v1/policies/validate`, which runs the same + * validation helpers as `POST /api/v1/policies/` and + * `PATCH /api/v1/policies/:id`. A successful response means the same + * payload would be accepted by the create/update commands. Useful for + * giving immediate feedback in UIs, CLIs, and SDK consumers before any + * write actually happens. + */ +declare class PolicyValidateCommand extends Command { + /** + * Whether the command should retry on failure. + * + * Disabled because a 422 here indicates an invalid payload — retrying + * would just re-submit the same bad data. + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body + */ + protected getBody(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): PolicyValidateResponse; +} + +/** + * The input for the policy archive command + */ +interface PolicyArchiveInput { + /** The policy id */ + policyId: string; +} +/** + * The schema for the archive policy response + */ +declare const ArchivePolicyResponseSchema: TObject<{ + message: TString; +}>; +/** + * The archive policy response type + */ +type ArchivePolicyResponse = Static; +/** + * Archive a policy by ID + */ +declare class PolicyArchiveCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ArchivePolicyResponse; +} + +/** + * The input for the policy get command + */ +interface PolicyGetInput { + /** The policy id */ + policyId: string; +} +/** + * Get a policy by ID + */ +declare class PolicyGetCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Create a new instance of the command + * @param policyId - The ID of the policy to get + */ + constructor(policyId: string); + /** + * Create a new instance of the command + * @param input - The input for the command + */ + constructor(input: PolicyGetInput); + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Policy; +} + +/** + * The input for the policy update command + */ +interface PolicyUpdateInput { + /** The policy id */ + policyId: string; + /** The organization id */ + organizationId: string; + /** The name of the policy */ + name: string; + /** The version of the policy */ + version: string; + /** The policy documents */ + policyDocuments: PolicyStatement[]; + /** The description of the policy */ + description?: string; + /** The principal role that can access the resource */ + principal?: string; + /** Whether the policy is managed by Flowcore */ + flowcoreManaged?: boolean; +} +/** + * Update a policy by ID + */ +declare class PolicyUpdateCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body + */ + protected getBody(): Record; + protected getHeaders(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Policy; +} + +/** + * The input for the key policies command + */ +interface KeyPoliciesInput { + /** The key id */ + keyId: string; +} +/** + * Fetch policies for a key + */ +declare class KeyPoliciesCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Policy[]; +} + +/** + * The input for the organization policies command + */ +interface OrganizationPoliciesInput { + /** The organization id */ + organizationId: string; +} +/** + * Fetch policies for an organization + */ +declare class OrganizationPoliciesCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Policy[]; +} + +/** + * The schema for a policy-key association + */ +declare const PolicyKeyAssociationSchema: TObject<{ + policyId: TString; + organizationId: TString; + keyId: TString; +}>; +/** + * The schema for a policy-user association + */ +declare const PolicyUserAssociationSchema: TObject<{ + policyId: TString; + organizationId: TString; + userId: TString; +}>; +/** + * The schema for a policy-role association + */ +declare const PolicyRoleAssociationSchema: TObject<{ + policyId: TString; + organizationId: TString; + roleId: TString; +}>; +/** + * The schema for policy associations + */ +declare const PolicyAssociationsSchema: TObject<{ + keys: TArray; + users: TArray; + roles: TArray; +}>; +/** + * The policy-key association type + */ +type PolicyKeyAssociation = Static; +/** + * The policy-user association type + */ +type PolicyUserAssociation = Static; +/** + * The policy-role association type + */ +type PolicyRoleAssociation = Static; +/** + * The policy associations type + */ +type PolicyAssociations = Static; +/** + * The input for the policy associations command + */ +interface PolicyAssociationsInput { + /** The policy id */ + policyId: string; +} +/** + * Fetch associations for a policy + */ +declare class PolicyAssociationsCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): PolicyAssociations; +} + +/** + * The input for the role policies command + */ +interface RolePoliciesInput { + /** The role id */ + roleId: string; +} +/** + * Fetch policies for a role + */ +declare class RolePoliciesCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Policy[]; +} + +/** + * The input for the user policies command + */ +interface UserPoliciesInput { + /** The user id */ + userId: string; + /** The optional organization id */ + organizationId?: string; +} +/** + * Fetch policies for a user + */ +declare class UserPoliciesCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Policy[]; +} + +/** + * The schema for a key policy link response + */ +declare const KeyPolicyLinkSchema: TObject<{ + policyId: TString; + organizationId: TString; + keyId: TString; +}>; +/** + * The key policy link response type + */ +type KeyPolicyLink = Static; +/** + * The input for the link key policy command + */ +interface LinkKeyPolicyInput { + /** The key id */ + keyId: string; + /** The policy id */ + policyId: string; +} +/** + * Link a policy to a key + */ +declare class LinkKeyPolicyCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body + */ + protected getBody(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): KeyPolicyLink; +} + +/** + * The schema for a role policy link response + */ +declare const RolePolicyLinkSchema: TObject<{ + policyId: TString; + organizationId: TString; + roleId: TString; +}>; +/** + * The role policy link response type + */ +type RolePolicyLink = Static; +/** + * The input for the link role policy command + */ +interface LinkRolePolicyInput { + /** The role id */ + roleId: string; + /** The policy id */ + policyId: string; +} +/** + * Link a policy to a role + */ +declare class LinkRolePolicyCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body + */ + protected getBody(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): RolePolicyLink; +} + +/** + * The schema for a user policy link response + */ +declare const UserPolicyLinkSchema: TObject<{ + policyId: TString; + organizationId: TString; + userId: TString; +}>; +/** + * The user policy link response type + */ +type UserPolicyLink = Static; +/** + * The input for the link user policy command + */ +interface LinkUserPolicyInput { + /** The user id */ + userId: string; + /** The policy id */ + policyId: string; +} +/** + * Link a policy to a user + */ +declare class LinkUserPolicyCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body + */ + protected getBody(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): UserPolicyLink; +} + +/** + * The input for the unlink key policy command + */ +interface UnlinkKeyPolicyInput { + /** The key id */ + keyId: string; + /** The policy id */ + policyId: string; +} +/** + * Unlink a policy from a key + */ +declare class UnlinkKeyPolicyCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body + */ + protected getBody(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): KeyPolicyLink; +} + +/** + * The input for the unlink role policy command + */ +interface UnlinkRolePolicyInput { + /** The role id */ + roleId: string; + /** The policy id */ + policyId: string; +} +/** + * Unlink a policy from a role + */ +declare class UnlinkRolePolicyCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body + */ + protected getBody(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): RolePolicyLink; +} + +/** + * The input for the unlink user policy command + */ +interface UnlinkUserPolicyInput { + /** The user id */ + userId: string; + /** The policy id */ + policyId: string; +} +/** + * Unlink a policy from a user + */ +declare class UnlinkUserPolicyCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body + */ + protected getBody(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): UserPolicyLink; +} + +/** + * The schema for a role + */ +declare const RoleSchema: TObject<{ + id: TString; + organizationId: TString; + name: TString; + description: TOptional; + flowcoreManaged: TOptional; + archived: TOptional; +}>; +/** + * The Role type + */ +type Role = Static; +/** + * The input for the role create command + */ +interface RoleCreateInput { + /** The organization id */ + organizationId: string; + /** The name of the role */ + name: string; + /** The description of the role */ + description?: string; + /** Whether the role is managed by Flowcore */ + flowcoreManaged?: boolean; +} +/** + * Create a role + */ +declare class RoleCreateCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body + */ + protected getBody(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Role; +} + +/** + * The input for the key roles command + */ +interface KeyRolesInput { + /** The key id */ + keyId: string; +} +/** + * Fetch roles for a key + */ +declare class KeyRolesCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Role[]; +} + +/** + * The input for the organization roles command + */ +interface OrganizationRolesInput { + /** The organization id */ + organizationId: string; +} +/** + * Fetch roles for an organization + */ +declare class OrganizationRolesCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Role[]; +} + +/** + * The schema for a role-key association + */ +declare const RoleKeyAssociationSchema: TObject<{ + roleId: TString; + organizationId: TString; + keyId: TString; +}>; +/** + * The schema for a role-user association + */ +declare const RoleUserAssociationSchema: TObject<{ + roleId: TString; + organizationId: TString; + userId: TString; +}>; +/** + * The schema for role associations + */ +declare const RoleAssociationsSchema: TObject<{ + keys: TArray; + users: TArray; +}>; +/** + * The role-key association type + */ +type RoleKeyAssociation = Static; +/** + * The role-user association type + */ +type RoleUserAssociation = Static; +/** + * The role associations type + */ +type RoleAssociations = Static; +/** + * The input for the role associations command + */ +interface RoleAssociationsInput { + /** The role id */ + roleId: string; +} +/** + * Fetch associations for a role + */ +declare class RoleAssociationsCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): RoleAssociations; +} + +/** + * The input for the user roles command + */ +interface UserRolesInput { + /** The user id */ + userId: string; + /** The optional organization id */ + organizationId?: string; +} +/** + * Fetch roles for a user + */ +declare class UserRolesCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Role[]; +} + +/** + * The schema for a key role link response + */ +declare const KeyRoleLinkSchema: TObject<{ + roleId: TString; + organizationId: TString; + keyId: TString; +}>; +/** + * The key role link response type + */ +type KeyRoleLink = Static; +/** + * The input for the link key role command + */ +interface LinkKeyRoleInput { + /** The key id */ + keyId: string; + /** The role id */ + roleId: string; +} +/** + * Link a role to a key + */ +declare class LinkKeyRoleCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body + */ + protected getBody(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): KeyRoleLink; +} + +/** + * The schema for a user role link response + */ +declare const UserRoleLinkSchema: TObject<{ + roleId: TString; + organizationId: TString; + userId: TString; +}>; +/** + * The user role link response type + */ +type UserRoleLink = Static; +/** + * The input for the link user role command + */ +interface LinkUserRoleInput { + /** The user id */ + userId: string; + /** The role id */ + roleId: string; +} +/** + * Link a role to a user + */ +declare class LinkUserRoleCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body + */ + protected getBody(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): UserRoleLink; +} + +/** + * The input for the unlink key role command + */ +interface UnlinkKeyRoleInput { + /** The key id */ + keyId: string; + /** The role id */ + roleId: string; +} +/** + * Unlink a role from a key + */ +declare class UnlinkKeyRoleCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body + */ + protected getBody(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): KeyRoleLink; +} + +/** + * The input for the unlink user role command + */ +interface UnlinkUserRoleInput { + /** The user id */ + userId: string; + /** The role id */ + roleId: string; +} +/** + * Unlink a role from a user + */ +declare class UnlinkUserRoleCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body + */ + protected getBody(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): UserRoleLink; +} + +/** + * The input for the role list command + */ +interface RoleListInput { + /** Optional organization id to filter by */ + organizationId?: string; +} +/** + * List roles for the current user + */ +declare class RoleListCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Role[]; +} + +/** + * The input for the role archive command + */ +interface RoleArchiveInput { + /** The role id */ + roleId: string; +} +/** + * The schema for the archive role response + */ +declare const ArchiveRoleResponseSchema: TObject<{ + message: TString; +}>; +/** + * The archive role response type + */ +type ArchiveRoleResponse = Static; +/** + * Archive a role by ID + */ +declare class RoleArchiveCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ArchiveRoleResponse; +} + +/** + * The input for the role get command + */ +interface RoleGetInput { + /** The role id */ + roleId: string; +} +/** + * Get a role by ID + */ +declare class RoleGetCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Role; +} + +/** + * The input for the role update command + */ +interface RoleUpdateInput { + /** The role id */ + roleId: string; + /** The organization id */ + organizationId: string; + /** The name of the role */ + name: string; + /** The description of the role */ + description?: string; + /** Whether the role is managed by Flowcore */ + flowcoreManaged?: boolean; +} +/** + * Update a role by ID + */ +declare class RoleUpdateCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body + */ + protected getBody(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): Role; +} + +/** + * Audit log entry type + */ +declare const AuditLogEntrySchema: TObject<{ + id: TString; + event: TString; + resourceName: TString; + performedBy: TUnion<[TString, TObject, TNull]>; + timestamp: TString; + status: TString; +}>; +/** + * Pagination information + */ +declare const PaginationSchema: TObject<{ + page: TNumber; + pageSize: TNumber; + totalItems: TNumber; + totalPages: TNumber; +}>; +/** + * Audit log response schema + */ +declare const AuditLogResponseSchema: TObject<{ + logs: TArray; + pagination: typeof PaginationSchema; +}>; +/** + * Audit log entry type + */ +type AuditLogEntry = Static; +/** + * Pagination information + */ +type Pagination = Static; +/** + * Audit log response type + */ +type AuditLogResponse = Static; +/** + * The input for the tenant audit logs command + */ +interface TenantAuditLogsInput { + /** The tenant id */ + tenantId: string; + /** Page number (1-based) */ + page?: number; + /** Page size */ + pageSize?: number; + /** Filter by resource type */ + resourceType?: string; + /** Filter by user who performed the action */ + performedBy?: string; + /** Filter by status (success or failure) */ + status?: "success" | "failure"; + /** Filter by start date */ + startDate?: string; + /** Filter by end date */ + endDate?: string; +} +/** + * Fetch audit logs for a tenant + */ +declare class TenantAuditLogsCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): AuditLogResponse; +} + +/** + * The mode of validation + */ +type ValidationMode = "tenant" | "organization"; +/** + * The validation request access item + */ +interface ValidationRequestAccessItem { + action: string; + resource: string[]; +} +/** + * The schema for a valid policy + */ +declare const ValidPolicySchema: TObject<{ + policyFrn: TString; + statementId: TString; +}>; +/** + * The schema for a validation response + */ +declare const ValidationResponseSchema: TObject<{ + valid: TBoolean; + checksum: TString; + validPolicies: TArray; +}>; +/** + * The valid policy type + */ +type ValidPolicy = Static; +/** + * The validation response type + */ +type ValidationResponse = Static; +/** + * The input for the user validation command + */ +interface ValidateUserInput { + /** The user id */ + userId: string; + /** The mode of validation */ + mode: ValidationMode; + /** The requested access */ + requestedAccess: ValidationRequestAccessItem[]; +} +/** + * Validate if a user can perform actions + */ +declare class ValidateUserCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body + */ + protected getBody(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ValidationResponse; +} + +/** + * The input for the key validation command + */ +interface ValidateKeyInput { + /** The key id */ + keyId: string; + /** The mode of validation */ + mode: ValidationMode; + /** The requested access */ + requestedAccess: ValidationRequestAccessItem[]; +} +/** + * Validate if a key can perform actions + */ +declare class ValidateKeyCommand extends Command { + /** + * Whether the command should retry on failure + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body + */ + protected getBody(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ValidationResponse; +} + +interface EntitlementRequestAccessItem { + action: string | string[]; + resource: string[]; +} +declare const EntitlementResponseSchema: _sinclair_typebox.TObject<{ + valid: _sinclair_typebox.TLiteral; + requestChecksum: _sinclair_typebox.TString; + entitlementChecksum: _sinclair_typebox.TString; + cacheTtlSeconds: _sinclair_typebox.TNumber; + entitlements: _sinclair_typebox.TArray<_sinclair_typebox.TObject<{ + requestIndex: _sinclair_typebox.TNumber; + grants: _sinclair_typebox.TArray<_sinclair_typebox.TObject<{ + policyFrn: _sinclair_typebox.TString; + statementId: _sinclair_typebox.TString; + resource: _sinclair_typebox.TString; + filters: _sinclair_typebox.TOptional<_sinclair_typebox.TArray<_sinclair_typebox.TUnion<[_sinclair_typebox.TObject<{ + path: _sinclair_typebox.TString; + operator: _sinclair_typebox.TLiteral<"equals">; + value: _sinclair_typebox.TUnion<[_sinclair_typebox.TString, _sinclair_typebox.TNumber, _sinclair_typebox.TBoolean, _sinclair_typebox.TNull]>; + }>, _sinclair_typebox.TObject<{ + path: _sinclair_typebox.TString; + operator: _sinclair_typebox.TLiteral<"oneOf">; + values: _sinclair_typebox.TArray<_sinclair_typebox.TUnion<[_sinclair_typebox.TString, _sinclair_typebox.TNumber, _sinclair_typebox.TBoolean, _sinclair_typebox.TNull]>>; + }>, _sinclair_typebox.TObject<{ + path: _sinclair_typebox.TString; + operator: _sinclair_typebox.TLiteral<"exists">; + value: _sinclair_typebox.TBoolean; + }>]>>>; + }>>; + }>>; +}>; +type EntitlementResponse = Static; +declare function parseEntitlementResponse(rawResponse: unknown): EntitlementResponse; +interface ResolveUserEntitlementsInput { + userId: string; + mode: "tenant" | "organization"; + requestedAccess: EntitlementRequestAccessItem[]; +} +declare class ResolveUserEntitlementsCommand extends Command { + protected retryOnFailure: boolean; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected getBody(): Record; + protected parseResponse(rawResponse: unknown): EntitlementResponse; +} + +interface ResolveKeyEntitlementsInput { + keyId: string; + mode: "tenant" | "organization"; + requestedAccess: EntitlementRequestAccessItem[]; +} +declare class ResolveKeyEntitlementsCommand extends Command { + protected retryOnFailure: boolean; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected getBody(): Record; + protected parseResponse(rawResponse: unknown): EntitlementResponse; +} + +/** + * Contracts for the Flowcore compute (container) service — + * `https://compute.api.flowcore.io`. + * + * UPSTREAM SOURCE: transcribed BY HAND from the zod contracts in + * `packages/contracts/src/compute/` of the `flowcore-io/flowcore-container-service` + * repository, together with the `c.json(...)` calls in the route handlers + * under `apps/compute-api/src/api/`, at `main` commit `d223298` + * ("feat(registries): registry detail with synthesis status, and deletion + * with in-cluster revocation (#39)"). + * + * The revision-history and deployment-event types below were transcribed + * later, from `compute/revisions.ts` and `compute/deployment-events.ts` plus + * `workload-revisions.list.ts` and `workload-events.list.ts`, at `main` commit + * `5c3858b` — the endpoints shipped in compute-api 1.11.0, after SDK 4.7.0 + * was cut. + * + * THERE IS NO GENERATOR AND NO DRIFT GUARD. Nothing in this repository fails + * when the service changes its contracts, so a change upstream has to be + * re-read into this file by hand against those two directories. + * + * TOLERANCE RULE, applied deliberately and uniformly: a field the upstream + * zod schema declares with `.default(...)` is `Type.Optional` here, even + * though the running service materializes it on every response (its + * projections are `.parse()`d before they are serialized). `parseResponseHelper` + * THROWS on an unexpected shape, so declaring such a field required would + * turn every call against a deployment that predates the field into an + * exception. Optional costs a consumer one `??`; required costs them an + * outage. Fields the upstream schema declares required without a default are + * required here. + * + * NO CREDENTIAL IS REPRESENTABLE IN ANY RESPONSE TYPE BELOW. The upstream + * `RegistrySchema` deliberately has no `secret`, no `encryptedAuthToken` and + * no `dockerconfigjson`; that omission is reproduced here on purpose and must + * not be "fixed". + */ +type TStringRecord = TRecord; +/** + * The body of a compute endpoint that answers `204 No Content` + * (domain detach, registry remove). + * + * `FlowcoreClient` substitutes `{ status: 204 }` for an empty body, so that + * synthetic object — not `undefined` — is what reaches `parseResponse`. + */ +type TComputeNoContent = TObject<{ + status: TNumber; +}>; +declare const ComputeNoContentSchema: TComputeNoContent; +type ComputeNoContent = Static; +/** Lifecycle state of a workload. A paused workload reports `stopped`. */ +type TComputeWorkloadStatus = TUnion<[ + TLiteral<"pending">, + TLiteral<"running">, + TLiteral<"stopped">, + TLiteral<"failed">, + TLiteral<"archived"> +]>; +declare const ComputeWorkloadStatusSchema: TComputeWorkloadStatus; +type ComputeWorkloadStatus = Static; +/** What a workload IS — a long-running service, or a run-to-completion task. Immutable after create. */ +type TComputeWorkloadKind = TUnion<[TLiteral<"service">, TLiteral<"job">]>; +declare const ComputeWorkloadKindSchema: TComputeWorkloadKind; +type ComputeWorkloadKind = Static; +/** Standardized compute slot tiers. */ +type TComputeSlotTier = TUnion<[ + TLiteral<"nano">, + TLiteral<"micro">, + TLiteral<"small">, + TLiteral<"medium">, + TLiteral<"large"> +]>; +declare const ComputeSlotTierSchema: TComputeSlotTier; +type ComputeSlotTier = Static; +/** Probe handler: HTTP GET. */ +type TComputeProbeHttpGet = TObject<{ + path: TOptional; + port: TNumber; + headers: TOptional; +}>; +declare const ComputeProbeHttpGetSchema: TComputeProbeHttpGet; +type ComputeProbeHttpGet = Static; +/** Probe handler: TCP socket — the safe default handler. */ +type TComputeProbeTcpSocket = TObject<{ + port: TNumber; +}>; +declare const ComputeProbeTcpSocketSchema: TComputeProbeTcpSocket; +type ComputeProbeTcpSocket = Static; +/** Probe handler: exec. */ +type TComputeProbeExec = TObject<{ + command: TArray; +}>; +declare const ComputeProbeExecSchema: TComputeProbeExec; +type ComputeProbeExec = Static; +/** + * One probe. Handler resolution order server-side is `httpGet`, then `exec`, + * then `tcpSocket`; with none given the fallback is a TCP dial of the + * workload's container port. + */ +type TComputeProbe = TObject<{ + httpGet: TOptional; + tcpSocket: TOptional; + exec: TOptional; + initialDelaySeconds: TOptional; + periodSeconds: TOptional; + timeoutSeconds: TOptional; + failureThreshold: TOptional; +}>; +declare const ComputeProbeSchema: TComputeProbe; +type ComputeProbe = Static; +/** The tri-probe specification of a workload. */ +type TComputeWorkloadProbes = TObject<{ + startup: TOptional; + readiness: TOptional; + liveness: TOptional; +}>; +declare const ComputeWorkloadProbesSchema: TComputeWorkloadProbes; +type ComputeWorkloadProbes = Static; +/** The pre-sync hook — a Job that must exit 0 before any pod is created. */ +type TComputePreSyncSpec = TObject<{ + name: TOptional; + image: TString; + command: TArray; + timeoutSeconds: TOptional; +}>; +declare const ComputePreSyncSpecSchema: TComputePreSyncSpec; +type ComputePreSyncSpec = Static; +/** + * How the replica count is decided. `manual` — the definition's `replicas` is + * the count. `hpa` — a HorizontalPodAutoscaler owns it between + * `minReplicas` and `maxReplicas`. + */ +type TComputeWorkloadScalingMode = TUnion<[TLiteral<"manual">, TLiteral<"hpa">]>; +declare const ComputeWorkloadScalingModeSchema: TComputeWorkloadScalingMode; +type ComputeWorkloadScalingMode = Static; +/** + * The scaling block of a workload definition. + * + * Every bound is optional at the schema level and required by mode instead: + * `minReplicas`/`maxReplicas` are meaningless under `manual` and mandatory + * under `hpa`. The service enforces the mode-dependent rules and answers 422. + */ +type TComputeWorkloadScaling = TObject<{ + mode: TOptional; + minReplicas: TOptional; + maxReplicas: TOptional; + targetCpuPercent: TOptional; + targetMemoryPercent: TOptional; +}>; +declare const ComputeWorkloadScalingSchema: TComputeWorkloadScaling; +type ComputeWorkloadScaling = Static; +/** One plain environment variable on a workload's container. */ +type TComputeWorkloadEnvVar = TObject<{ + name: TString; + value: TString; +}>; +declare const ComputeWorkloadEnvVarSchema: TComputeWorkloadEnvVar; +type ComputeWorkloadEnvVar = Static; +/** + * One environment variable bound to a key in the tenant's ORGANIZATION + * SECRETS. + * + * There is no value field, deliberately. The compute API cannot read an + * organization secret and never receives one: only the key name travels, and + * the value is bound inside the cluster from the organization secret store. + */ +type TComputeWorkloadSecretRef = TObject<{ + name: TString; + secretKey: TString; +}>; +declare const ComputeWorkloadSecretRefSchema: TComputeWorkloadSecretRef; +type ComputeWorkloadSecretRef = Static; +/** + * One persistent volume of a workload definition. + * + * The claim is ReadWriteOnce on the cluster's DEFAULT StorageClass — there + * is deliberately no class field, and provisioned `sizeGi` is the only + * billing dimension. A workload with volumes must run at most one replica + * under `scaling.mode: "manual"` (the service answers 422 otherwise), and + * `sizeGi` only ever GROWS: an update or rollback that would shrink a + * volume is refused, and volumes cannot be added, removed, renamed or + * remounted after create. Workload DELETE destroys the claims and their + * data. + */ +type TComputeWorkloadVolume = TObject<{ + name: TString; + sizeGi: TNumber; + mountPath: TString; +}>; +declare const ComputeWorkloadVolumeSchema: TComputeWorkloadVolume; +type ComputeWorkloadVolume = Static; +/** Everything the reconciler needs to build a Deployment, a Service and a pre-sync Job. */ +type TComputeWorkloadDefinition = TObject<{ + image: TString; + slotTier: TComputeSlotTier; + kind: TOptional; + replicas: TOptional; + port: TOptional; + probes: TOptional; + preSync: TOptional; + scaling: TOptional; + env: TOptional>; + secrets: TOptional>; + volumes: TOptional>; +}>; +declare const ComputeWorkloadDefinitionSchema: TComputeWorkloadDefinition; +type ComputeWorkloadDefinition = Static; +/** + * A container workload, as served by the API. + * + * `definition` is optional: a row written before the definition columns + * existed carries none of them. `activeRevision` advances only when the + * reconciler reports the mutation's operation succeeded — never at request + * time — so a failed pre-sync leaves it pointing at what is still serving. + */ +type TComputeWorkload = TObject<{ + id: TString; + tenantId: TString; + name: TString; + status: TComputeWorkloadStatus; + readyReplicas: TNumber; + reason: TOptional; + definition: TOptional; + activeRevision: TOptional; + rolledBackFrom: TOptional; + paused: TOptional; + createdAt: TString; + updatedAt: TString; +}>; +declare const ComputeWorkloadSchema: TComputeWorkload; +type ComputeWorkload = Static; +/** What produced one recorded execution. */ +type TComputeWorkloadRunKind = TUnion<[TLiteral<"batch">, TLiteral<"pre_sync">]>; +declare const ComputeWorkloadRunKindSchema: TComputeWorkloadRunKind; +type ComputeWorkloadRunKind = Static; +/** The lifecycle of one execution. A run whose poll window closes is `failed`. */ +type TComputeWorkloadRunStatus = TUnion<[TLiteral<"running">, TLiteral<"succeeded">, TLiteral<"failed">]>; +declare const ComputeWorkloadRunStatusSchema: TComputeWorkloadRunStatus; +type ComputeWorkloadRunStatus = Static; +/** One recorded execution — an on-demand batch run, or a pre-sync hook. */ +type TComputeWorkloadRun = TObject<{ + id: TString; + workloadId: TString; + tenantId: TString; + kind: TComputeWorkloadRunKind; + name: TString; + status: TComputeWorkloadRunStatus; + reason: TOptional; + operationId: TOptional; + startedAt: TString; + completedAt: TOptional; +}>; +declare const ComputeWorkloadRunSchema: TComputeWorkloadRun; +type ComputeWorkloadRun = Static; +/** + * A page of run history, newest first. BARE — this endpoint does not use the + * `{ success: true, ... }` envelope. + */ +type TComputeWorkloadRunList = TObject<{ + runs: TArray; + nextCursor: TOptional; +}>; +declare const ComputeWorkloadRunListSchema: TComputeWorkloadRunList; +type ComputeWorkloadRunList = Static; +/** `GET /api/v1/workloads` */ +type TComputeWorkloadListResponse = TObject<{ + success: TLiteral; + workloads: TArray; +}>; +declare const ComputeWorkloadListResponseSchema: TComputeWorkloadListResponse; +type ComputeWorkloadListResponse = Static; +/** `GET /api/v1/workloads/{workloadId}` and the legacy create command. */ +type TComputeWorkloadResponse = TObject<{ + success: TLiteral; + workload: TComputeWorkload; +}>; +declare const ComputeWorkloadResponseSchema: TComputeWorkloadResponse; +type ComputeWorkloadResponse = Static; +/** `POST /api/v1/workloads`, including the cluster-convergence operation. */ +type TComputeWorkloadCreateResponse = TObject<{ + success: TLiteral; + workload: TComputeWorkload; + operationId: TString; +}>; +declare const ComputeWorkloadCreateResponseSchema: TComputeWorkloadCreateResponse; +type ComputeWorkloadCreateResponse = Static; +/** The 202 of PATCH, rollback, pause and resume. */ +type TComputeWorkloadMutationResponse = TObject<{ + success: TLiteral; + workload: TComputeWorkload; + operationId: TString; +}>; +declare const ComputeWorkloadMutationResponseSchema: TComputeWorkloadMutationResponse; +type ComputeWorkloadMutationResponse = Static; +/** The 202 of `DELETE /api/v1/workloads/{workloadId}` — no workload body. */ +type TComputeWorkloadDeleteResponse = TObject<{ + success: TLiteral; + operationId: TString; +}>; +declare const ComputeWorkloadDeleteResponseSchema: TComputeWorkloadDeleteResponse; +type ComputeWorkloadDeleteResponse = Static; +/** The 202 of `POST /api/v1/workloads/{workloadId}/run`. */ +type TComputeWorkloadRunResponse = TObject<{ + success: TLiteral; + run: TComputeWorkloadRun; + runId: TString; + operationId: TString; +}>; +declare const ComputeWorkloadRunResponseSchema: TComputeWorkloadRunResponse; +type ComputeWorkloadRunResponse = Static; +/** Which pipe the line came out of. */ +type TComputeLogStreamName = TUnion<[TLiteral<"stdout">, TLiteral<"stderr">]>; +declare const ComputeLogStreamNameSchema: TComputeLogStreamName; +type ComputeLogStreamName = Static; +/** One indexed log line. */ +type TComputeLogEntry = TObject<{ + timestamp: TString; + podName: TString; + container: TString; + level: TString; + message: TString; + stream: TComputeLogStreamName; +}>; +declare const ComputeLogEntrySchema: TComputeLogEntry; +type ComputeLogEntry = Static; +/** Historical log response. BARE — no `{ success: true }` envelope. */ +type TComputeWorkloadLogs = TObject<{ + workloadId: TString; + container: TUnion<[TString, TNull]>; + totalMatches: TNumber; + logs: TArray; +}>; +declare const ComputeWorkloadLogsSchema: TComputeWorkloadLogs; +type ComputeWorkloadLogs = Static; +/** + * The `data:` payload of one `event: log` frame on the LIVE SSE stream + * (`GET /api/v1/workloads/{workloadId}/logs/stream`). + * + * Deliberately NOT unified with `ComputeLogEntry`: the service names the + * fields differently on the two surfaces (`pod`/`line` here, `podName`/ + * `message` on the indexed one), and collapsing them would rename a + * documented wire field. Heartbeat frames (`event: heartbeat`) carry a bare + * ISO-8601 string, not this shape, and are never surfaced as log events. + */ +type TComputeLogStreamEvent = TObject<{ + timestamp: TString; + pod: TString; + container: TString; + line: TString; +}>; +declare const ComputeLogStreamEventSchema: TComputeLogStreamEvent; +type ComputeLogStreamEvent = Static; +/** Lifecycle state of a domain binding. */ +type TComputeDomainStatus = TUnion<[ + TLiteral<"pending_verification">, + TLiteral<"ready">, + TLiteral<"failed">, + TLiteral<"detached"> +]>; +declare const ComputeDomainStatusSchema: TComputeDomainStatus; +type ComputeDomainStatus = Static; +/** How ownership of the hostname is established. */ +type TComputeDomainVerificationType = TUnion<[TLiteral<"cname">, TLiteral<"platform_wildcard">]>; +declare const ComputeDomainVerificationTypeSchema: TComputeDomainVerificationType; +type ComputeDomainVerificationType = Static; +/** DNS ownership block. */ +type TComputeDomainVerification = TObject<{ + type: TComputeDomainVerificationType; + expectedTarget: TString; + verified: TBoolean; +}>; +declare const ComputeDomainVerificationSchema: TComputeDomainVerification; +type ComputeDomainVerification = Static; +/** Certificate state, as OBSERVED from cert-manager. Never a request to issue. */ +type TComputeDomainTlsStatus = TUnion<[TLiteral<"pending_issuance">, TLiteral<"issued">, TLiteral<"failed">]>; +declare const ComputeDomainTlsStatusSchema: TComputeDomainTlsStatus; +type ComputeDomainTlsStatus = Static; +/** TLS block. `issuer` and `expiresAt` are omitted until cert-manager reports them. */ +type TComputeDomainTls = TObject<{ + status: TComputeDomainTlsStatus; + secretName: TString; + issuer: TOptional; + expiresAt: TOptional; +}>; +declare const ComputeDomainTlsSchema: TComputeDomainTls; +type ComputeDomainTls = Static; +/** A domain binding, as served by attach and list. */ +type TComputeDomain = TObject<{ + domainId: TString; + workloadId: TString; + hostname: TString; + targetPort: TNumber; + status: TComputeDomainStatus; + verification: TComputeDomainVerification; + tls: TComputeDomainTls; + createdAt: TString; +}>; +declare const ComputeDomainSchema: TComputeDomain; +type ComputeDomain = Static; +/** `GET /api/v1/workloads/{workloadId}/domains` — live bindings, oldest first. */ +type TComputeDomainListResponse = TObject<{ + success: TLiteral; + domains: TArray; +}>; +declare const ComputeDomainListResponseSchema: TComputeDomainListResponse; +type ComputeDomainListResponse = Static; +/** + * The verify response — deliberately NARROWER than `ComputeDomainSchema`: + * verify reports what was just observed, it does not restate the binding. + * BARE — no `{ success: true }` envelope. + */ +type TComputeDomainVerifyResponse = TObject<{ + domainId: TString; + hostname: TString; + status: TComputeDomainStatus; + verification: TComputeDomainVerification; + tls: TComputeDomainTls; +}>; +declare const ComputeDomainVerifyResponseSchema: TComputeDomainVerifyResponse; +type ComputeDomainVerifyResponse = Static; +/** What kind of asynchronous mutation an operation tracks. */ +type TComputeOperationType = TUnion<[ + TLiteral<"workload.deploy">, + TLiteral<"workload.update">, + TLiteral<"workload.rollback">, + TLiteral<"workload.archive">, + TLiteral<"workload.pause">, + TLiteral<"workload.resume">, + TLiteral<"workload.run"> +]>; +declare const ComputeOperationTypeSchema: TComputeOperationType; +type ComputeOperationType = Static; +/** Terminal states are `succeeded` and `failed`. */ +type TComputeOperationStatus = TUnion<[ + TLiteral<"pending">, + TLiteral<"in_progress">, + TLiteral<"succeeded">, + TLiteral<"failed"> +]>; +declare const ComputeOperationStatusSchema: TComputeOperationStatus; +type ComputeOperationStatus = Static; +/** Where in the mutation the reconciler currently is. */ +type TComputeOperationPhase = TUnion<[ + TLiteral<"queued">, + TLiteral<"pre_sync_running">, + TLiteral<"pre_sync_failed">, + TLiteral<"deploying">, + TLiteral<"rolling_out">, + TLiteral<"tearing_down">, + TLiteral<"pausing">, + TLiteral<"resuming">, + TLiteral<"running">, + TLiteral<"completed">, + TLiteral<"failed"> +]>; +declare const ComputeOperationPhaseSchema: TComputeOperationPhase; +type ComputeOperationPhase = Static; +/** The state of one step of an operation. */ +type TComputeOperationStepStatus = TUnion<[ + TLiteral<"pending">, + TLiteral<"running">, + TLiteral<"succeeded">, + TLiteral<"failed"> +]>; +declare const ComputeOperationStepStatusSchema: TComputeOperationStepStatus; +type ComputeOperationStepStatus = Static; +/** The pre-sync job attached to a deploy. */ +type TComputeOperationPreSyncProgress = TObject<{ + name: TString; + status: TComputeOperationStepStatus; + startedAt: TOptional; + completedAt: TOptional; +}>; +declare const ComputeOperationPreSyncProgressSchema: TComputeOperationPreSyncProgress; +type ComputeOperationPreSyncProgress = Static; +/** Rolling-deployment replica counters. */ +type TComputeOperationDeploymentProgress = TObject<{ + desiredReplicas: TNumber; + updatedReplicas: TNumber; + readyReplicas: TNumber; +}>; +declare const ComputeOperationDeploymentProgressSchema: TComputeOperationDeploymentProgress; +type ComputeOperationDeploymentProgress = Static; +/** Progress detail of an operation. */ +type TComputeOperationProgress = TObject<{ + preSync: TOptional; + deployment: TOptional; +}>; +declare const ComputeOperationProgressSchema: TComputeOperationProgress; +type ComputeOperationProgress = Static; +/** An operation, as served by `GET /api/v1/operations/{operationId}`. BARE — no envelope. */ +type TComputeOperation = TObject<{ + operationId: TString; + workloadId: TString; + type: TComputeOperationType; + status: TComputeOperationStatus; + phase: TComputeOperationPhase; + progress: TComputeOperationProgress; + reason: TOptional; + createdAt: TString; + updatedAt: TString; +}>; +declare const ComputeOperationSchema: TComputeOperation; +type ComputeOperation = Static; +/** Why a revision exists. */ +type TComputeWorkloadRevisionCause = TUnion<[TLiteral<"created">, TLiteral<"update">, TLiteral<"rollback">]>; +declare const ComputeWorkloadRevisionCauseSchema: TComputeWorkloadRevisionCause; +type ComputeWorkloadRevisionCause = Static; +/** + * One recorded revision of a workload's definition. + * + * `outcome` IS OPTIONAL, AND THAT IS THE CONTRACT — not a tolerance. Upstream + * reports it at three levels of knowledge: + * + * - the joined operation's status, when there is an operation row; + * - `pending`, when the revision names an operation whose row has not + * arrived yet; + * - ABSENT, when the revision names no operation at all. + * + * The third case covers historical `created` revisions written before create + * operations were API-minted. Declaring `outcome` required here would make + * `parseResponseHelper` throw while reading those replayed rows. + * + * `slotTier` is absent on a row recorded before slot tiers were part of the + * definition contract — omitted rather than invented, upstream and here. + */ +type TComputeWorkloadRevision = TObject<{ + revision: TNumber; + image: TString; + slotTier: TOptional; + cause: TComputeWorkloadRevisionCause; + isActive: TBoolean; + rolledBackFrom: TOptional; + operationId: TOptional; + outcome: TOptional; + outcomeReason: TOptional; + createdAt: TString; +}>; +declare const ComputeWorkloadRevisionSchema: TComputeWorkloadRevision; +type ComputeWorkloadRevision = Static; +/** + * A page of revision history, NEWEST ORDINAL FIRST. BARE — this endpoint does + * not use the `{ success: true, ... }` envelope. + */ +type TComputeWorkloadRevisionList = TObject<{ + revisions: TArray; + nextCursor: TOptional; +}>; +declare const ComputeWorkloadRevisionListSchema: TComputeWorkloadRevisionList; +type ComputeWorkloadRevisionList = Static; +/** The object an event is about — a Deployment, ReplicaSet, Pod, Service, HPA or Job. */ +type TComputeDeploymentEventObject = TObject<{ + kind: TString; + name: TString; +}>; +declare const ComputeDeploymentEventObjectSchema: TComputeDeploymentEventObject; +type ComputeDeploymentEventObject = Static; +/** + * One cluster event, normalized across BOTH Kubernetes API groups. + * + * `type` is a plain string and NOT an enum: Kubernetes documents `Normal` and + * `Warning`, but the field is free-form on the wire and a narrower contract + * here would reject a value the cluster is entitled to send. + * + * `firstSeen` and `lastSeen` are optional because an event is entitled to + * carry neither — the modern group's series fields are absent on a + * single-occurrence event. + */ +type TComputeDeploymentEvent = TObject<{ + name: TString; + type: TString; + reason: TString; + message: TString; + count: TNumber; + object: TComputeDeploymentEventObject; + source: TOptional; + firstSeen: TOptional; + lastSeen: TOptional; +}>; +declare const ComputeDeploymentEventSchema: TComputeDeploymentEvent; +type ComputeDeploymentEvent = Static; +/** + * The workload's recent cluster events, most recently seen first. BARE — no + * `{ success: true, ... }` envelope, and UNPAGINATED by construction. + * + * AN EMPTY ARRAY IS A LEGITIMATE ANSWER, never an error: a workload the + * cluster has had nothing to say about — or nothing within the TTL — answers + * 200 with `events: []`. + */ +type TComputeWorkloadDeploymentEvents = TObject<{ + workloadId: TString; + events: TArray; +}>; +declare const ComputeWorkloadDeploymentEventsSchema: TComputeWorkloadDeploymentEvents; +type ComputeWorkloadDeploymentEvents = Static; +/** + * A registry, sanitized. + * + * THERE IS NO `secret` FIELD AND THERE MUST NEVER BE ONE. The upstream + * contract has no credential-bearing field of any kind — plaintext, + * ciphertext or encoded — and the service's routes cannot return one. A + * credential is write-only and rotation-only. + */ +type TComputeRegistry = TObject<{ + registryId: TString; + name: TString; + serverUrl: TString; + username: TString; + isDefault: TBoolean; + createdAt: TString; + updatedAt: TString; +}>; +declare const ComputeRegistrySchema: TComputeRegistry; +type ComputeRegistry = Static; +/** + * Whether the credential became a working in-cluster pull Secret. + * + * Three values where the EVENT enum has two: `pending` is the projection's + * NULL — no report from the reconciler has arrived yet. + */ +type TComputeRegistrySynthesisState = TUnion<[TLiteral<"pending">, TLiteral<"synthesized">, TLiteral<"failed">]>; +declare const ComputeRegistrySynthesisStateSchema: TComputeRegistrySynthesisState; +type ComputeRegistrySynthesisState = Static; +/** The single-registry read: the sanitized registry plus its synthesis state. */ +type TComputeRegistryDetail = TObject<{ + registryId: TString; + name: TString; + serverUrl: TString; + username: TString; + isDefault: TBoolean; + createdAt: TString; + updatedAt: TString; + synthesisStatus: TComputeRegistrySynthesisState; + synthesisReason: TOptional; + synthesisAt: TOptional; +}>; +declare const ComputeRegistryDetailSchema: TComputeRegistryDetail; +type ComputeRegistryDetail = Static; +/** `GET /api/v1/registries` */ +type TComputeRegistryListResponse = TObject<{ + success: TLiteral; + registries: TArray; +}>; +declare const ComputeRegistryListResponseSchema: TComputeRegistryListResponse; +type ComputeRegistryListResponse = Static; +/** `GET /api/v1/registries/{registryId}` */ +type TComputeRegistryDetailResponse = TObject<{ + success: TLiteral; + registry: TComputeRegistryDetail; +}>; +declare const ComputeRegistryDetailResponseSchema: TComputeRegistryDetailResponse; +type ComputeRegistryDetailResponse = Static; + +/** + * The TLS request block on an attach for a custom hostname. + */ +interface ComputeDomainAttachTls { + /** Only ACME/Let's Encrypt via cert-manager exists */ + mode: "letsencrypt"; + /** The cert-manager ClusterIssuer (defaults to `letsencrypt-prod` server-side) */ + clusterIssuer?: string; +} +/** + * Attach a hostname the TENANT owns, proved with a CNAME. + */ +interface ComputeDomainAttachCustomInput { + /** The workload id (full UUID) */ + workloadId: string; + /** A lowercase fully qualified hostname, e.g. `api.acme.org`. Uppercase is REJECTED, not folded */ + hostname: string; + /** The container port the ingress routes to */ + targetPort: number; + /** Certificate issuance options */ + tls?: ComputeDomainAttachTls; + /** Never set alongside `hostname` — the two branches are an XOR */ + subdomain?: never; +} +/** + * Attach a single label under the PLATFORM's wildcard zone. + * + * TENANT-SCOPED MINT: the served hostname is + * `-.` — the platform resolves the tenant's + * slug at attach time and suffixes it, so two tenants asking for the same + * subdomain never clash. The service answers 422 for a reserved subdomain + * (`www`, `flowcore`, `usable`), for a scoped label over 63 bytes and for + * an unresolvable tenant slug, and 409 when the tenant's active wildcard + * cap is reached. Bindings minted before scoping keep their stored + * hostnames. + */ +interface ComputeDomainAttachWildcardInput { + /** The workload id (full UUID) */ + workloadId: string; + /** A single lowercase DNS label — no dots, which would reach outside the platform zone */ + subdomain: string; + /** The container port the ingress routes to */ + targetPort: number; + /** Never set alongside `subdomain` — the two branches are an XOR */ + hostname?: never; + /** Never set for a wildcard subdomain — the platform's wildcard certificate already exists */ + tls?: never; +} +/** + * The input for the compute domain attach command — custom hostname XOR + * platform wildcard subdomain. + */ +type ComputeDomainAttachInput = ComputeDomainAttachCustomInput | ComputeDomainAttachWildcardInput; +/** + * Attach a custom domain or a platform wildcard subdomain to a workload. + * + * TWO SUCCESS CODES, both from an awaited write and both carrying the same + * BARE domain object (no `{ success: true }` envelope): + * - 201 for a wildcard subdomain — the platform owns the zone and the + * wildcard certificate already exists, so the binding is ready on return; + * - 202 for a custom hostname — the caller still has to publish the CNAME and + * cert-manager still has to issue. + * + * THERE IS NO `operationId` HERE, so this command has no `waitForOperation`. + * A custom hostname is followed up with `ComputeDomainVerifyCommand`, which is + * the surface that performs the live DNS and certificate check. + * + * Answers 409 when the hostname is already on a live binding, or when the + * workload is of kind `job` and has no Service to route to. + */ +declare class ComputeDomainAttachCommand extends Command { + /** + * Whether the command should retry on failure. + * + * FALSE: an attach mints a domain id, and a second attach of the same + * hostname answers 409 — a retry of an already-recorded request would + * surface that conflict as the caller's answer. + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body for the request. + * + * OVERRIDDEN BECAUSE BOTH BRANCHES OF THE UPSTREAM BODY ARE `.strict()` — + * that is exactly what makes the union a real XOR. The base implementation + * would send `workloadId` (a path parameter) inside the JSON, which matches + * NEITHER branch, so every call would be 422. + */ + protected getBody(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ComputeDomain; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The input for the compute domain detach command + */ +interface ComputeDomainDetachInput { + /** The workload id (full UUID) */ + workloadId: string; + /** The domain binding id (full UUID) */ + domainId: string; +} +/** + * Detach a domain from a workload. + * + * Answers `204 No Content`. The service awaits its own write before + * responding, so on return the hostname is already attachable again; the + * in-cluster reconciler removes the Ingress rule and Certificate + * asynchronously. The projection row is MARKED detached, never deleted. + * + * `FlowcoreClient` substitutes `{ status: 204 }` for the empty body, and that + * synthetic object is what this command returns. + */ +declare class ComputeDomainDetachCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body for the request. The route takes NO body. + */ + protected getBody(): undefined; + /** + * Parse the response. + * + * The endpoint answers 204 with an EMPTY body, which `FlowcoreClient` turns + * into `{ status: 204 }` before it reaches here — so this schema describes + * that synthetic object, not anything the service serialized. + */ + protected parseResponse(rawResponse: unknown): ComputeNoContent; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The input for the compute domain list command + */ +interface ComputeDomainListInput { + /** The workload id (full UUID) */ + workloadId: string; +} +/** + * List the domains attached to a workload, oldest first. + * + * LIVE bindings only — a detached binding leaves the list rather than being + * hidden behind a flag — and served entirely from the projection: this + * endpoint performs no DNS lookup and reads no cluster state. Use + * `ComputeDomainVerifyCommand` for a fresh observation. A workload with no + * domains answers 200 with an empty array. + * + * Response envelope: `{ success: true, domains: [...] }`, unwrapped here. + */ +declare class ComputeDomainListCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ComputeDomain[]; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The input for the compute domain verify command + */ +interface ComputeDomainVerifyInput { + /** The workload id (full UUID) */ + workloadId: string; + /** The domain binding id (full UUID) */ + domainId: string; +} +/** + * Verify DNS ownership and read the TLS certificate state. + * + * Resolves the domain's CNAME and reads the cert-manager Certificate + * READ-ONLY. This endpoint never issues a certificate and never mutates any + * Kubernetes resource. + * + * EVERY OBSERVED OUTCOME IS A 200, including the unhappy ones: a missing or + * mismatched CNAME is `verification.verified: false`, a certificate that is + * not ready yet is `tls.status: "pending_issuance"`, a failed issuance is + * `tls.status: "failed"`. Only a broken upstream changes the status code — + * 503 when DNS or the Kubernetes API is unreachable, 502 when either answers + * badly. + * + * The response is a BARE object, deliberately NARROWER than the domain object + * that attach and list return: verify reports what was just observed, it does + * not restate the binding. + */ +declare class ComputeDomainVerifyCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body for the request. The route takes NO body. + */ + protected getBody(): undefined; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ComputeDomainVerifyResponse; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The input for the compute operation fetch command + */ +interface ComputeOperationFetchInput { + /** The operation id (full UUID) */ + operationId: string; +} +/** + * Inspect an asynchronous workload mutation operation. + * + * The compute service answers 404 until the in-cluster reconciler files its + * FIRST progress report for the operation — the API mints the id and emits + * the event, but it holds no Kubernetes credentials and never seeds an + * operation row. A 404 shortly after a 202 therefore means "not yet", not + * "gone"; see `waitForComputeOperation`, which treats it that way. + * + * The response is a BARE operation object — this endpoint uses no + * `{ success: true, ... }` envelope. + */ +declare class ComputeOperationFetchCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ComputeOperation; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The input for the compute registry fetch command + */ +interface ComputeRegistryFetchInput { + /** The registry id (full UUID) */ + registryId: string; +} +/** + * Inspect a single registry, with whether its credential really reached the + * tenant's namespace. + * + * `synthesisStatus` is what the RECONCILER reported and nothing else: this + * route never probes the registry, never opens a credential and makes no + * outbound call. `pending` means no report has arrived yet. + * + * A REMOVED registry answers 404, not 410 — indistinguishable from an unknown + * one, which is the same non-disclosure property the 404-on-denial collapse + * gives. + * + * Response envelope: `{ success: true, registry: {...} }`, unwrapped here — + * note that register and rotate return the registry BARE instead. + */ +declare class ComputeRegistryFetchCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ComputeRegistryDetail; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The input for the compute registry list command + */ +interface ComputeRegistryListInput { + /** The tenant id (full UUID) */ + tenantId: string; +} +/** + * List a tenant's configured container image registries, sanitized. + * + * NO CREDENTIAL IS RETURNED, and none can be: the registry type has no + * `secret`, no encrypted token and no `dockerconfigjson` field. Credentials + * are write-only and rotation-only. A tenant with no registries answers 200 + * with an empty array. + * + * Response envelope: `{ success: true, registries: [...] }`, unwrapped here. + */ +declare class ComputeRegistryListCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ComputeRegistry[]; +} + +/** + * The input for the compute registry register command + */ +interface ComputeRegistryRegisterInput { + /** The tenant id (full UUID) — carried in the BODY, not the path */ + tenantId: string; + /** Human label for the registry entry */ + name: string; + /** + * The registry host as a container runtime addresses it, e.g. `ghcr.io` or + * `registry.internal:5000`. A SCHEME IS REJECTED rather than stripped, and + * so is uppercase — normalization is the caller's decision to make. + */ + serverUrl: string; + /** The robot account the pull credential belongs to */ + username: string; + /** + * The pull secret — a PAT, registry password or service principal secret, + * 8..4096 characters. + * + * WRITE-ONLY. It is sealed before it reaches the event payload and no + * endpoint on the service can read it back; rotation replaces it. It never + * appears in any response type in this SDK. + */ + secret: string; + /** Make this the tenant's default registry (defaults to false) */ + isDefault?: boolean; +} +/** + * Register container image registry credentials. + * + * Answers 201 with the registry READ BACK from the projection — SANITIZED, + * with no credential field of any kind. The service contacts no registry and + * creates no Kubernetes Secret; the in-cluster reconciler synthesizes the pull + * Secret asynchronously, and `ComputeRegistryFetchCommand` reports whether it + * succeeded. + * + * Answers 409 when a registry for the same `serverUrl` is already configured + * for the tenant. + * + * The body is `.strict()` upstream, but NO `getBody()` override is needed + * here: this route carries its tenancy in the body, so the command's input + * and the request body are the same object — there is no path parameter to + * strip. + * + * The response body is BARE, with no `{ success: true }` envelope — unlike + * the registry LIST and the registry DETAIL reads, which both use one. + */ +declare class ComputeRegistryRegisterCommand extends Command { + /** + * Whether the command should retry on failure. + * + * FALSE: a registration mints a registry id, and a second registration of + * the same `serverUrl` answers 409 — a retry of an already-recorded request + * would surface that conflict as the caller's answer. + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ComputeRegistry; +} + +/** + * The input for the compute registry remove command + */ +interface ComputeRegistryRemoveInput { + /** The registry id (full UUID) */ + registryId: string; +} +/** + * Remove a registry. + * + * Answers `204 No Content`. The service awaits its own write before + * responding, so on return the `serverUrl` is registrable again and a second + * DELETE answers 404. The row is TOMBSTONED, never deleted — the registration + * and every rotation stay readable for support. + * + * REMOVAL IS UNCONDITIONAL: no workload reference is checked and no new + * default is elected. Running pods are unaffected; a pull from that host fails + * only when the kubelet next pulls. The in-cluster credential is revoked by + * the reconciler asynchronously. + * + * `FlowcoreClient` substitutes `{ status: 204 }` for the empty body, and that + * synthetic object is what this command returns. + */ +declare class ComputeRegistryRemoveCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body for the request. The route takes NO body. + */ + protected getBody(): undefined; + /** + * Parse the response. + * + * The endpoint answers 204 with an EMPTY body, which `FlowcoreClient` turns + * into `{ status: 204 }` before it reaches here. + */ + protected parseResponse(rawResponse: unknown): ComputeNoContent; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The input for the compute registry rotate command + */ +interface ComputeRegistryRotateInput { + /** The registry id (full UUID) */ + registryId: string; + /** + * The NEW pull secret, 8..4096 characters. + * + * Rotation replaces the credential; it does not re-describe the registry. + * The previous secret is never returned and never becomes readable. + */ + secret: string; +} +/** + * Rotate a registry's credentials. + * + * Answers 200 with the sanitized registry read back from the projection, so + * `updatedAt` is the REAL rotation timestamp rather than a wall-clock guess. + * The in-cluster pull Secret is patched by the reconciler; no pod rolls. + * + * The response body is BARE, with no `{ success: true }` envelope. + */ +declare class ComputeRegistryRotateCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body for the request. + * + * OVERRIDDEN BECAUSE THE UPSTREAM BODY IS `.strict()` AND DELIBERATELY + * NARROW — `{ secret }` and nothing else, so that an attempt to smuggle a + * `serverUrl` or `isDefault` change through the rotation path is a 422. The + * base implementation would send `registryId`, a path parameter, inside the + * JSON and every call would be refused. + */ + protected getBody(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ComputeRegistry; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The input for the compute workload events list command + */ +interface ComputeWorkloadEventsListInput { + /** The workload id (full UUID) */ + workloadId: string; +} +/** + * List a workload's recent KUBERNETES deployment events, most recently seen + * first. + * + * These are cluster events, not Flowcore events: the workload's Deployment, + * Service and autoscaler, its ReplicaSets, its pods and its pre-sync and run + * Jobs, read live across both Kubernetes API groups, merged and deduplicated. + * The namespace and every object name are derived SERVER-SIDE from the + * workload projection, so there is deliberately no namespace or selector + * parameter here. + * + * NO PAGINATION, and none is needed: THE WINDOW IS THE CLUSTER'S. Kubernetes + * reaps events on its own TTL — roughly an hour on this platform — and nothing + * older survives; the service persists nothing to widen it. + * + * AN EMPTY `events` ARRAY IS A NORMAL ANSWER, not an error: a workload the + * cluster has had nothing to say about within the TTL answers 200 with an + * empty list. The response is a BARE object, with no `{ success: true }` + * envelope. + */ +declare class ComputeWorkloadEventsListCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ComputeWorkloadDeploymentEvents; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The input for the compute workload logs fetch command + */ +interface ComputeWorkloadLogsFetchInput { + /** The workload id (full UUID) */ + workloadId: string; + /** ISO-8601 lower bound */ + since?: string; + /** ISO-8601 upper bound */ + until?: string; + /** Free-text search over the message */ + search?: string; + /** Maximum number of lines, 1..1000 (defaults to 100 server-side) */ + limit?: number; + /** Restrict to one container by name */ + container?: string; +} +/** + * Query indexed historical container logs for a workload. + * + * The tenant namespace and the `flowcore.io/workload-id` pod label are derived + * SERVER-SIDE from the workload projection and cannot be widened by the + * caller, so there is deliberately no namespace or label parameter here. + * + * This is the HISTORICAL, indexed surface. The live SSE stream + * (`GET /api/v1/workloads/{workloadId}/logs/stream`) is NOT covered by this + * SDK — it needs a streaming transport this client does not have. + * + * The response is a BARE object, with no `{ success: true }` envelope. + */ +declare class ComputeWorkloadLogsFetchCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ComputeWorkloadLogs; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The input for the compute workload log stream command + */ +interface ComputeWorkloadLogStreamInput { + /** The workload id (full UUID) */ + workloadId: string; + /** Restrict to one container by name; defaults server-side to the pod's first container */ + container?: string; + /** How much history to replay before following, 0..1000 (defaults to 100 server-side) */ + tailLines?: number; +} +/** + * An active live log stream. + * + * Mirrors `ActiveStreamInterface` from `websocket-command.ts` — the SDK's + * existing streaming shape — minus `send`, because SSE is one-directional. + */ +interface ComputeWorkloadLogStream { + /** + * An Observable emitting one value per `event: log` frame, in wire order. + * + * Reading only STARTS on the first subscription, so no frame is dropped + * between the connection opening and the caller subscribing. From then on it + * is hot and shared: a second, later subscriber joins mid-stream and sees + * only what arrives after it. + * + * Completes when the server closes the stream or `disconnect()` is called, + * and errors if the stream breaks mid-flight. `event: heartbeat` frames keep + * the connection alive and are deliberately NOT emitted here. + */ + output$: Observable; + /** + * Closes the stream. Aborts the underlying fetch — the server sees the + * disconnect and tears down its upstream Kubernetes followers — and + * completes `output$`. Idempotent. + */ + disconnect(): void; +} +declare class ComputeWorkloadLogStreamCommand extends CustomCommand { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; + /** + * Custom execute method — opens the SSE connection and returns the stream + */ + protected customExecute(client: FlowcoreClient): Promise; +} + +/** + * The input for the compute workload revisions list command + */ +interface ComputeWorkloadRevisionsListInput { + /** The workload id (full UUID) */ + workloadId: string; + /** Page size (defaults to the service's own page size) */ + limit?: number; + /** Opaque cursor from a previous page's `nextCursor` */ + cursor?: string; +} +/** + * List a workload's revision history, newest ordinal first. + * + * Every definition the workload has ever been recorded with: the revision + * seeded at creation (`cause: "created"`), one per update and one per + * rollback. A rollback is a NEW revision carrying the ordinal it restored + * from — history is never edited. + * + * `outcome` is read from the operation that carried the revision to the + * cluster, so a revision recorded but never promoted (a failed pre-sync hook, + * say) is distinguishable from one merely superseded. IT IS ABSENT on a + * `created` revision, which mints no operation at all — check for it before + * reading it. + * + * PAGINATED, like `ComputeWorkloadRunsListCommand`: revision history is + * unbounded by construction and nothing ever removes a row. Feed `nextCursor` + * back as `cursor`; it is absent on the last page. The response is a BARE + * object, with no `{ success: true }` envelope. + */ +declare class ComputeWorkloadRevisionsListCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ComputeWorkloadRevisionList; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The input for the compute workload runs list command + */ +interface ComputeWorkloadRunsListInput { + /** The workload id (full UUID) */ + workloadId: string; + /** Page size, 1..200 (defaults to 50 server-side) */ + limit?: number; + /** Opaque cursor from a previous page's `nextCursor` */ + cursor?: string; +} +/** + * List a workload's run history, newest first. + * + * Every execution the platform has run for the workload: on-demand batch runs + * (`kind: "batch"`) AND the pre-sync hooks its creates, updates and rollbacks + * gated on (`kind: "pre_sync"`). + * + * PAGINATED, unlike `ComputeWorkloadListCommand` — run history is unbounded by + * construction and nothing ever removes a row. Feed `nextCursor` back as + * `cursor`; it is absent on the last page. The response is a BARE object, with + * no `{ success: true }` envelope. + */ +declare class ComputeWorkloadRunsListCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ComputeWorkloadRunList; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The input for the compute workload create command + */ +interface ComputeWorkloadCreateInput { + /** The tenant id (full UUID) */ + tenantId: string; + /** The name of the workload */ + name: string; + /** + * The full definition. `image` and `slotTier` are required — they have no + * safe default, so a request without them is 422. + */ + definition: ComputeWorkloadDefinition; +} +/** + * Create a workload. + * + * Answers 201 with the workload READ BACK from the projection, not a + * `{ status: "processing" }` stub: the service awaits its own + * `workload.created.0` write before responding. Revision 1 is active from + * birth. The cluster rollout that follows is observable through + * `ComputeWorkloadFetchCommand`. + * + * Response envelope: `{ success: true, workload: {...} }`, unwrapped here. + */ +declare class ComputeWorkloadCreateCommand extends Command { + /** + * Whether the command should retry on failure. + * + * FALSE: a create mints a workload id server-side, so a retried 502 would + * deploy the same workload twice. + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ComputeWorkload; +} + +/** + * Create a workload and retain the operation that carries it to the cluster. + * + * The original create command keeps returning only the workload for backward + * compatibility. New integrations should use this command so they can poll + * cluster convergence from the API-minted `operationId`. + */ +declare class ComputeWorkloadCreateTrackedCommand extends Command { + protected retryOnFailure: boolean; + protected getMethod(): string; + protected getBaseUrl(): string; + protected getPath(): string; + protected parseResponse(rawResponse: unknown): ComputeWorkloadCreateResponse; +} + +/** + * The default poll budget, in milliseconds (10 minutes). + * + * DELIBERATELY MUCH LONGER than the 25 seconds `DataCoreRequestDeleteCommand` + * allows itself. A compute mutation is a pre-sync hook (whose own timeout + * defaults to 300 seconds and may be set as high as 3600) followed by a + * rolling update, so 25 seconds would time out on a perfectly healthy deploy. + */ +declare const DEFAULT_COMPUTE_OPERATION_TIMEOUT_MS = 600000; +/** The default gap between polls, in milliseconds. */ +declare const DEFAULT_COMPUTE_OPERATION_POLL_INTERVAL_MS = 1000; +/** + * The wait options every 202-returning compute command accepts. + */ +interface ComputeOperationWaitOptions { + /** + * Poll `GET /api/v1/operations/{operationId}` until the operation reaches a + * terminal state before resolving (default: false) + */ + waitForOperation?: boolean; + /** + * How long to keep polling, in milliseconds + * (default: {@link DEFAULT_COMPUTE_OPERATION_TIMEOUT_MS}, 10 minutes) + */ + operationTimeoutMs?: number; + /** + * How long to sleep between polls, in milliseconds + * (default: {@link DEFAULT_COMPUTE_OPERATION_POLL_INTERVAL_MS}, 1 second) + */ + operationPollIntervalMs?: number; +} +/** + * The 202 body of PATCH, rollback, pause and resume, plus the terminal + * operation when `waitForOperation` was set. + */ +interface ComputeWorkloadMutationOutput { + /** Always true */ + success: true; + /** The workload as it stands NOW — the new revision is promoted by the cluster's verdict */ + workload: ComputeWorkload; + /** The operation the cluster convergence is tracked under (full UUID) */ + operationId: string; + /** The terminal operation. Present ONLY when `waitForOperation` was set */ + operation?: ComputeOperation; +} +/** + * The 202 body of `DELETE /api/v1/workloads/{workloadId}`, plus the terminal + * operation when `waitForOperation` was set. + */ +interface ComputeWorkloadDeleteOutput { + /** Always true */ + success: true; + /** The operation the teardown is tracked under (full UUID) */ + operationId: string; + /** The terminal operation. Present ONLY when `waitForOperation` was set */ + operation?: ComputeOperation; +} +/** + * The 202 body of `POST /api/v1/workloads/{workloadId}/run`, plus the + * terminal operation when `waitForOperation` was set. + */ +interface ComputeWorkloadRunOutput { + /** Always true */ + success: true; + /** The run row, already listed by `GET /runs` */ + run: ComputeWorkloadRun; + /** The run id (full UUID) */ + runId: string; + /** The operation the run is tracked under (full UUID) */ + operationId: string; + /** The terminal operation. Present ONLY when `waitForOperation` was set */ + operation?: ComputeOperation; +} +/** + * Poll a compute operation until it reaches a terminal state. + * + * Modelled on the `processResponse` loop of `DataCoreRequestDeleteCommand`, + * with TWO deliberate deviations from that template: + * + * 1. AN EARLY 404 IS "NOT YET", NOT "GONE". The compute API mints the + * operation id and emits the event, but the operation ROW is written by + * the `compute-operation.0/operation.updated.0` handler only once the + * in-cluster reconciler files its first progress report. Between the 202 + * and that report the endpoint answers 404, and treating that as a + * terminal answer would make every wait fail on a healthy deploy. So a + * `NotFoundException` is swallowed and the poll continues. + * + * 2. THE BUDGET IS LONGER AND CONFIGURABLE, AND EXHAUSTING IT THROWS. The + * delete template gives itself a hardcoded 25 seconds and then returns the + * original response as if nothing happened. A rolling update gated on a + * pre-sync hook routinely runs longer than that, and silently returning + * "done" for an operation still in flight is worse here than it is there: + * the caller's next action is usually to treat the new revision as live. + * So the budget defaults to 10 minutes, is overridable per call, and a + * timeout raises a {@link CommandError} naming the last state observed. + * + * A FAILED operation is RETURNED, not thrown: `failed` is a terminal answer + * to the question that was asked, and `reason` explains it. Only the absence + * of an answer within the budget is an error. + */ +declare function waitForComputeOperation(client: FlowcoreClient, commandName: string, operationId: string, options: ComputeOperationWaitOptions): Promise; + +/** + * The input for the compute workload delete command + */ +interface ComputeWorkloadDeleteInput extends ComputeOperationWaitOptions { + /** The workload id (full UUID) */ + workloadId: string; +} +/** + * Delete a workload and cascade its domain bindings. + * + * Answers 202 with the teardown's operation id and NO workload body. Every + * live domain binding is released first, then the workload leaves + * `GET /api/v1/workloads` immediately; the in-cluster reconciler removes the + * Deployment, the Service, the autoscaler and the Jobs asynchronously. + * + * `GET /api/v1/workloads/{workloadId}` keeps resolving the workload while the + * teardown runs, reporting it `archived`. + */ +declare class ComputeWorkloadDeleteCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body for the request. + * + * The route takes NO body. Left to the base implementation it would send + * the whole input — the path parameter and the client-side wait knobs — as + * JSON on a DELETE. + */ + protected getBody(): undefined; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ComputeWorkloadDeleteOutput; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; + /** + * Optionally wait for the teardown to finish + */ + protected processResponse(client: FlowcoreClient, response: ComputeWorkloadDeleteOutput): Promise; +} + +/** + * The input for the compute workload fetch command + */ +interface ComputeWorkloadFetchInput { + /** The workload id (full UUID) */ + workloadId: string; +} +/** + * Fetch a single workload. + * + * A DELETED workload is deliberately still served, reporting `archived`, so + * that a client holding the 202 of a delete can keep resolving it while the + * teardown runs. + * + * Response envelope: `{ success: true, workload: {...} }`, unwrapped here. + */ +declare class ComputeWorkloadFetchCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ComputeWorkload; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; +} + +/** + * The input for the compute workload list command + */ +interface ComputeWorkloadListInput { + /** The tenant id (full UUID) */ + tenantId: string; +} +/** + * List a tenant's workloads, newest first. + * + * Deleted workloads are excluded server-side. The response is wrapped in the + * `{ success: true, workloads: [...] }` envelope; this command unwraps it. + */ +declare class ComputeWorkloadListCommand extends Command { + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ComputeWorkload[]; +} + +/** + * The input for the compute workload pause command + */ +interface ComputeWorkloadPauseInput extends ComputeOperationWaitOptions { + /** The workload id (full UUID) */ + workloadId: string; +} +/** + * Pause a workload, keeping its configuration. + * + * The reconciler patches ONLY the Deployment's `spec.replicas` to 0 — nothing + * is deleted and no definition field changes, so the workload reports status + * `stopped` with `paused: true` while its full configuration stays visible. + * A pause mints no revision, so it never appears in the rollback history. + * + * Answers 409 for a job-kind workload (it has no Deployment) and for a + * workload that is already paused. + */ +declare class ComputeWorkloadPauseCommand extends Command { + /** + * Whether the command should retry on failure. + * + * FALSE: a pause mints an operation id, and the service answers 409 to a + * second pause — a retry of an already-recorded request would surface that + * conflict as the caller's answer. + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body for the request. The route takes NO body. + */ + protected getBody(): undefined; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ComputeWorkloadMutationOutput; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; + /** + * Optionally wait for the scale-down to finish + */ + protected processResponse(client: FlowcoreClient, response: ComputeWorkloadMutationOutput): Promise; +} + +/** + * The input for the compute workload resume command + */ +interface ComputeWorkloadResumeInput extends ComputeOperationWaitOptions { + /** The workload id (full UUID) */ + workloadId: string; +} +/** + * Resume a paused workload unchanged. + * + * The reconciler runs the SAME tenant quota pre-flight a create runs before + * scaling the Deployment back: pausing frees the tenant's quota mechanically, + * so the headroom a resume needs may have been taken while it was paused. A + * REFUSED RESUME IS NOT AN ERROR ON THIS CALL — it still answers 202, and the + * operation then fails with the quota reason while the workload stays paused. + * Pass `waitForOperation: true` (or poll the operation) to see that outcome. + * + * Answers 409 for a job-kind workload and for a workload that is not paused. + */ +declare class ComputeWorkloadResumeCommand extends Command { + /** + * Whether the command should retry on failure. + * + * FALSE: a resume mints an operation id, and the service answers 409 to a + * second resume — a retry of an already-recorded request would surface that + * conflict as the caller's answer. + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body for the request. The route takes NO body. + */ + protected getBody(): undefined; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ComputeWorkloadMutationOutput; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; + /** + * Optionally wait for the scale-up to finish + */ + protected processResponse(client: FlowcoreClient, response: ComputeWorkloadMutationOutput): Promise; +} + +/** + * The input for the compute workload rollback command + */ +interface ComputeWorkloadRollbackInput extends ComputeOperationWaitOptions { + /** The workload id (full UUID) */ + workloadId: string; +} +/** + * Roll a workload back to its previous revision. + * + * History is append-only, so this APPENDS a revision rather than rewinding + * the counter: rolling back to revision 1 from revision 2 makes revision 3 + * active with revision 1's definition, and the workload then reports + * `activeRevision: 3, rolledBackFrom: 1`. + * + * Answers 409 when there is no earlier revision to restore. + */ +declare class ComputeWorkloadRollbackCommand extends Command { + /** + * Whether the command should retry on failure. + * + * FALSE: a rollback mints a revision and an operation id, and re-runs the + * target revision's pre-sync hook. + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body for the request. + * + * The route takes NO body — the target revision is derived server-side. + */ + protected getBody(): undefined; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ComputeWorkloadMutationOutput; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; + /** + * Optionally wait for the cluster to converge + */ + protected processResponse(client: FlowcoreClient, response: ComputeWorkloadMutationOutput): Promise; +} + +/** + * The input for the compute workload run command + */ +interface ComputeWorkloadRunInput extends ComputeOperationWaitOptions { + /** The workload id (full UUID) — must be a workload of kind `job` */ + workloadId: string; +} +/** + * Run a batch job workload on demand. + * + * The API mints BOTH the run id (which names the Kubernetes Job, `run-`) + * and the operation id, and awaits its own write, so the 202 names a run that + * `ComputeWorkloadRunsListCommand` already lists. The reconciler then runs the + * tenant's quota pre-flight, creates the Job and polls it to completion. + * + * Answers 409 for a service-kind workload. + */ +declare class ComputeWorkloadRunCommand extends Command { + /** + * Whether the command should retry on failure. + * + * FALSE: a run mints a run id and spends the tenant's compute quota, so a + * retried 502 would start the job twice. + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body for the request. The route takes NO body. + */ + protected getBody(): undefined; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ComputeWorkloadRunOutput; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; + /** + * Optionally wait for the run to reach a terminal state + */ + protected processResponse(client: FlowcoreClient, response: ComputeWorkloadRunOutput): Promise; +} + +/** + * The input for the compute workload update command + */ +interface ComputeWorkloadUpdateInput extends ComputeOperationWaitOptions { + /** The workload id (full UUID) */ + workloadId: string; + /** New container image */ + image?: string; + /** New compute slot tier */ + slotTier?: ComputeSlotTier; + /** New replica count, 1..50. Zero is not accepted here — that is what pause is for */ + replicas?: number; + /** New container port */ + port?: number; + /** Replaces the probe block */ + probes?: ComputeWorkloadProbes; + /** Replaces the pre-sync hook */ + preSync?: ComputePreSyncSpec; + /** Replaces the scaling block WHOLESALE — it is not merged into the stored one */ + scaling?: ComputeWorkloadScaling; + /** + * Replaces the environment variables WHOLESALE, like `scaling` above. + * Sending `[]` CLEARS every variable the previous revision set — that is + * how a variable is removed, as there is no per-key patch. + */ + env?: ComputeWorkloadEnvVar[]; + /** Replaces the organization-secret bindings wholesale, same rule as `env` */ + secrets?: ComputeWorkloadSecretRef[]; + /** + * The volume list, GROWTH-ONLY: the same set of volumes (same names, same + * mount paths) with each `sizeGi` equal or larger. The service answers 422 + * to an add, a remove, a rename, a mountPath move or a shrink — volumes + * are declared at create and destroyed only by workload DELETE. + */ + volumes?: ComputeWorkloadVolume[]; +} +/** + * Update a workload's definition. + * + * Answers 202: the change is RECORDED as a new revision and the returned + * workload is the one still serving. The revision is promoted only when the + * reconciler reports the returned operation `succeeded`, so a workload whose + * pre-sync hook fails keeps reporting the previous image — poll the operation + * (or pass `waitForOperation: true`) before treating the new definition as + * live. + * + * Switching `scaling.mode` from `hpa` to `manual` additionally requires + * `replicas` in the same call; the service answers 422 without it. + */ +declare class ComputeWorkloadUpdateCommand extends Command { + /** + * Whether the command should retry on failure. + * + * FALSE. A PATCH looks idempotent and is not: each call MINTS A REVISION + * and an operation id server-side, and re-applying a revision re-runs the + * workload's pre-sync hook. A retried 502 whose original request had + * already been recorded would append a second identical revision and run + * the migration hook twice. + */ + protected retryOnFailure: boolean; + /** + * Get the method + */ + protected getMethod(): string; + /** + * Get the base url + */ + protected getBaseUrl(): string; + /** + * Get the path + */ + protected getPath(): string; + /** + * Get the body for the request. + * + * OVERRIDDEN BECAUSE THE UPSTREAM BODY IS `.strict()`. The base + * implementation sends the WHOLE input, which would put `workloadId` (a + * path parameter) and the client-side `waitForOperation` / + * `operationTimeoutMs` / `operationPollIntervalMs` knobs into the JSON — + * and every one of them is a key `UpdateWorkloadRequestSchema` does not + * list, so the service would answer 422 on the very first call. + */ + protected getBody(): Record; + /** + * Parse the response + */ + protected parseResponse(rawResponse: unknown): ComputeWorkloadMutationOutput; + /** + * Handle the client error + */ + protected handleClientError(error: ClientError): void; + /** + * Optionally wait for the cluster to converge + */ + protected processResponse(client: FlowcoreClient, response: ComputeWorkloadMutationOutput): Promise; +} + +type Logger = { + debug: (message: string, meta?: Record) => void; + info: (message: string, meta?: Record) => void; + warn: (message: string, meta?: Record) => void; + error: (message: string | Error, meta?: Record) => void; +}; + +/** + * Represents an event notification from the Flowcore system + */ +type NotificationEvent = { + pattern: string; + data: { + tenant: string; + eventId: string; + dataCoreId: string; + flowType: string; + eventType: string; + validTime: string; + }; +}; +/** + * Interface for OIDC authentication client + */ +type OidcClient$1 = { + getToken: () => Promise<{ + accessToken: string; + }>; +}; +/** + * Configuration options for the NotificationClient + */ +type NotificationClientOptions = { + reconnectInterval: number; + maxReconnects?: number; + maxEvents?: number; + logger?: Logger; +}; +interface NotificationClientAuthOptionsBearer { + oidcClient: OidcClient$1; +} +interface NotificationClientAuthOptionsApiKey { + apiKey: string; + apiKeyId?: string; +} +type NotificationClientAuthOptions = NotificationClientAuthOptionsBearer | NotificationClientAuthOptionsApiKey; +/** + * Client for handling WebSocket connections to the Flowcore notification system. + * Manages connection lifecycle, authentication, and event handling. + */ +declare class NotificationClient { + private readonly observer; + private readonly authOptions; + private readonly subscriptionSpec; + private url; + private webSocket; + private options; + private logger; + private eventCount; + private reconnectInterval; + private reconnectAttempts; + private _isOpen; + private _isConnecting; + /** + * Which handshake carries the credential. + * + * `subprotocol` is tried first and is the one that does NOT put the + * credential in the URL. `query` is the legacy transport, kept only so this + * client still works against a server that has not shipped subprotocol + * support yet. + */ + private authTransport; + /** True once a handshake has settled, so the fallback is probed at most once. */ + private transportSettled; + /** + * Creates a new NotificationClient instance + * @param observer - RxJS Subject for emitting notification events + * @param authOptions - Auth options for the client + * @param subscriptionSpec - Specification for what notifications to subscribe to + * @param options - Configuration options for the client + */ + constructor(observer: Subject, authOptions: NotificationClientAuthOptions, subscriptionSpec: { + tenant: string; + dataCore: string; + flowType?: string; + eventType?: string; + }, options?: Partial); + /** + * Is the websocket connection open + */ + get isOpen(): boolean; + /** + * Is the websocket connection currently connecting + */ + get isConnecting(): boolean; + /** + * Establishes WebSocket connection and sets up event handlers + */ + connect(): Promise; + /** + * Decides WHERE the credential travels, for the transport currently selected. + * + * This is the whole security property of this client, isolated so it can be + * asserted directly: on the `subprotocol` transport the returned query is + * EMPTY. An ingress access log records the request line, so a credential in + * the query string is written to disk in plaintext and is readable by + * everyone with log access — for a long-lived `fc_` key that is a full + * tenant compromise sitting in a log index. + */ + private buildCredentialHandshake; + /** + * True when the subprotocol handshake has just failed for the first time. + * + * The fallback is probed at most ONCE per client. After it settles, a later + * failure is a real failure and goes through normal reconnect handling. + */ + private shouldFallBackToQueryTransport; + /** + * Switches to the legacy query-string transport and reconnects immediately. + * + * This does NOT count as a reconnect attempt: no backoff is consumed and the + * caller sees one continuous connection attempt. + */ + private fallBackToQueryTransport; + /** + * Parses and dispatches a single raw notification frame. + * + * Runs inside the WebSocket `onmessage` callback, where any thrown error is + * uncaught and crashes the host process. Notification frames can occasionally + * be malformed (non-JSON, empty/absent `message`, truncated payloads, or + * non-event control frames), so every parse is guarded — a bad frame is logged + * and skipped instead of taking down the whole connection/process. + */ + private handleMessage; + /** + * Attempts to reconnect to the WebSocket server using exponential backoff + */ + private attemptReconnect; + /** + * Closes the WebSocket connection + */ + disconnect(): void; + /** + * Overrides the base WebSocket URL for testing or different environments + * @param url - The new base URL to use + */ + overrideBaseUrl(url: string): void; +} + +/** + * Interface for OIDC authentication client (reused from NotificationClient context) + */ +type OidcClient = { + getToken: () => Promise<{ + accessToken: string; + }>; +}; +/** + * Configuration options for the WebSocketClient + */ +type WebSocketClientOptions = { + /** Interval between reconnect attempts (ms). Defaults to 1000. */ + reconnectInterval?: number; + /** Maximum number of reconnect attempts. Defaults to undefined (infinite). */ + maxReconnects?: number; + /** Optional logger instance. */ + logger?: Logger; +}; +interface MinimalWebSocket { + readyState: number; + onopen: (() => void) | null; + onmessage: ((event: { + data: string | ArrayBuffer | Buffer; + }) => void) | null; + onclose: ((event: { + code: number; + reason: string; + wasClean: boolean; + }) => void) | null; + onerror: ((event: Event) => void) | null; + send(data: string): void; + close(code?: number, reason?: string): void; +} +type WebSocketFactory = (url: string) => MinimalWebSocket; +/** + * Generic client for managing a single, persistent WebSocket connection based on a command. + * Handles connection lifecycle, authentication, reconnection, and message sending/receiving. + */ +declare class WebSocketClient { + private readonly authOptions; + private overrideBaseUrl; + private webSocket; + private options; + private logger; + private reconnectInterval; + private reconnectAttempts; + private _isOpen; + private _isConnecting; + private webSocketFactory; + private internalSubject; + private currentCommand; + private currentConfig; + /** + * Creates a new WebSocketClient instance. + * @param authOptions - Authentication options (Bearer token via OIDC client or API Key). + * @param options - Configuration options for the client. + * @param webSocketFactory - Optional WebSocket factory for testing. + */ + constructor(authOptions: ClientOptions, options?: WebSocketClientOptions, webSocketFactory?: WebSocketFactory); + /** + * Override the base URL provided by commands. + * @param baseUrl - The new base URL to use (e.g., "wss://staging-server.api.flowcore.io"). + */ + setBaseUrl(baseUrl: string): void; + /** + * Returns true if the WebSocket connection is currently open. + */ + get isOpen(): boolean; + /** + * Returns true if the client is currently attempting to establish a WebSocket connection. + */ + get isConnecting(): boolean; + /** + * Establishes WebSocket connection based on the provided command. + * Disconnects any existing connection before starting the new one. + * @param command - The command defining the stream connection details. + * @returns An interface to interact with the active stream. + */ + connect(command: WebSocketCommand): Promise>; + /** + * Sets up the WebSocket event handlers (onopen, onmessage, onclose, onerror). + */ + private setupEventHandlers; + /** + * Attempts to reconnect to the WebSocket server using exponential backoff. + * Requires `currentConfig` to be set. + */ + private attemptReconnect; + /** + * Sends a message to the currently connected WebSocket. + * @param message - The message object to send (e.g., { content: "user input" }). + */ + private sendMessage; + /** + * Closes the WebSocket connection gracefully. + */ + disconnect(): void; + /** + * Implements the Disposable interface for clean resource management. + */ + [Symbol.dispose](): void; +} + +/** + * An error thrown when the response from the server is invalid + */ +declare class InvalidResponseException extends Error { + readonly errors: Record; + constructor(message: string, errors: Record); +} + +/** + * An error thrown when a resource is not found + */ +declare class NotFoundException extends Error { + constructor(resource: string, filters: Record); +} + +/** + * An error thrown when the command fails + */ +declare class CommandError extends Error { + constructor(commandName: string, message: string); +} + +/** + * Helper method for parsing the response + */ +declare const parseResponseHelper: (schema: T, response: unknown) => Static; + +export { type ActiveStreamInterface, type AddContextItem, type AddContextItemsRequest, type AiStreamConfig, type ApiKey, ApiKeyCreateCommand, type ApiKeyCreateInput, ApiKeyDeleteCommand, type ApiKeyDeleteInput, ApiKeyEditCommand, type ApiKeyEditInput, ApiKeyFetchCommand, type ApiKeyFetchInput, ApiKeyListCommand, type ApiKeyListInput, ApiKeyValidateCommand, type ApiKeyValidateInput, ApiKeyValidateWithTenantIdCommand, type ApiKeyValidateWithTenantIdInput, type ApiKeyValidation, type ApiKeyWithValue, type ArchivePolicyResponse, ArchivePolicyResponseSchema, type ArchiveRoleResponse, ArchiveRoleResponseSchema, type Artifact, type ArtifactContentChunk, type ArtifactContentDeltaChunk, type ArtifactDataChunk, type ArtifactEndChunk, ArtifactGetCommand, type ArtifactGetCommandInput, type ArtifactStartChunk, type ArtifactUrlChunk, type AuditLogEntry, AuditLogEntrySchema, type AuditLogResponse, AuditLogResponseSchema, type AwsMarketplaceCustomer, type AwsMarketplaceCustomerResolve, AwsMarketplaceCustomerResolveCommand, type AwsMarketplaceCustomerResolveInput, type AwsMarketplaceDedicatedClusterType, type AwsMarketplaceLink, type AwsMarketplaceLinkCreate, AwsMarketplaceLinkCreateCommand, type AwsMarketplaceLinkCreateInput, type AwsMarketplaceLinkDelete, AwsMarketplaceLinkDeleteCommand, type AwsMarketplaceLinkDeleteInput, type AwsMarketplaceLinkFetch, AwsMarketplaceLinkFetchCommand, type AwsMarketplaceLinkFetchInput, type AwsMarketplaceLinkList, AwsMarketplaceLinkListCommand, type AwsMarketplaceLinkListInput, type AwsMarketplaceProductMode, type AwsMarketplaceProductProperties, ClientError, type ClientOptions, Command, CommandError, type ComputeDeploymentEvent, type ComputeDeploymentEventObject, ComputeDeploymentEventObjectSchema, ComputeDeploymentEventSchema, type ComputeDomain, ComputeDomainAttachCommand, type ComputeDomainAttachCustomInput, type ComputeDomainAttachInput, type ComputeDomainAttachTls, type ComputeDomainAttachWildcardInput, ComputeDomainDetachCommand, type ComputeDomainDetachInput, ComputeDomainListCommand, type ComputeDomainListInput, type ComputeDomainListResponse, ComputeDomainListResponseSchema, ComputeDomainSchema, type ComputeDomainStatus, ComputeDomainStatusSchema, type ComputeDomainTls, ComputeDomainTlsSchema, type ComputeDomainTlsStatus, ComputeDomainTlsStatusSchema, type ComputeDomainVerification, ComputeDomainVerificationSchema, type ComputeDomainVerificationType, ComputeDomainVerificationTypeSchema, ComputeDomainVerifyCommand, type ComputeDomainVerifyInput, type ComputeDomainVerifyResponse, ComputeDomainVerifyResponseSchema, type ComputeLogEntry, ComputeLogEntrySchema, type ComputeLogStreamEvent, ComputeLogStreamEventSchema, type ComputeLogStreamName, ComputeLogStreamNameSchema, type ComputeNoContent, ComputeNoContentSchema, type ComputeOperation, type ComputeOperationDeploymentProgress, ComputeOperationDeploymentProgressSchema, ComputeOperationFetchCommand, type ComputeOperationFetchInput, type ComputeOperationPhase, ComputeOperationPhaseSchema, type ComputeOperationPreSyncProgress, ComputeOperationPreSyncProgressSchema, type ComputeOperationProgress, ComputeOperationProgressSchema, ComputeOperationSchema, type ComputeOperationStatus, ComputeOperationStatusSchema, type ComputeOperationStepStatus, ComputeOperationStepStatusSchema, type ComputeOperationType, ComputeOperationTypeSchema, type ComputeOperationWaitOptions, type ComputePreSyncSpec, ComputePreSyncSpecSchema, type ComputeProbe, type ComputeProbeExec, ComputeProbeExecSchema, type ComputeProbeHttpGet, ComputeProbeHttpGetSchema, ComputeProbeSchema, type ComputeProbeTcpSocket, ComputeProbeTcpSocketSchema, type ComputeRegistry, type ComputeRegistryDetail, type ComputeRegistryDetailResponse, ComputeRegistryDetailResponseSchema, ComputeRegistryDetailSchema, ComputeRegistryFetchCommand, type ComputeRegistryFetchInput, ComputeRegistryListCommand, type ComputeRegistryListInput, type ComputeRegistryListResponse, ComputeRegistryListResponseSchema, ComputeRegistryRegisterCommand, type ComputeRegistryRegisterInput, ComputeRegistryRemoveCommand, type ComputeRegistryRemoveInput, ComputeRegistryRotateCommand, type ComputeRegistryRotateInput, ComputeRegistrySchema, type ComputeRegistrySynthesisState, ComputeRegistrySynthesisStateSchema, type ComputeSlotTier, ComputeSlotTierSchema, type ComputeWorkload, ComputeWorkloadCreateCommand, type ComputeWorkloadCreateInput, type ComputeWorkloadCreateResponse, ComputeWorkloadCreateResponseSchema, ComputeWorkloadCreateTrackedCommand, type ComputeWorkloadDefinition, ComputeWorkloadDefinitionSchema, ComputeWorkloadDeleteCommand, type ComputeWorkloadDeleteInput, type ComputeWorkloadDeleteOutput, type ComputeWorkloadDeleteResponse, ComputeWorkloadDeleteResponseSchema, type ComputeWorkloadDeploymentEvents, ComputeWorkloadDeploymentEventsSchema, type ComputeWorkloadEnvVar, ComputeWorkloadEnvVarSchema, ComputeWorkloadEventsListCommand, type ComputeWorkloadEventsListInput, ComputeWorkloadFetchCommand, type ComputeWorkloadFetchInput, type ComputeWorkloadKind, ComputeWorkloadKindSchema, ComputeWorkloadListCommand, type ComputeWorkloadListInput, type ComputeWorkloadListResponse, ComputeWorkloadListResponseSchema, type ComputeWorkloadLogStream, ComputeWorkloadLogStreamCommand, type ComputeWorkloadLogStreamInput, type ComputeWorkloadLogs, ComputeWorkloadLogsFetchCommand, type ComputeWorkloadLogsFetchInput, ComputeWorkloadLogsSchema, type ComputeWorkloadMutationOutput, type ComputeWorkloadMutationResponse, ComputeWorkloadMutationResponseSchema, ComputeWorkloadPauseCommand, type ComputeWorkloadPauseInput, type ComputeWorkloadProbes, ComputeWorkloadProbesSchema, type ComputeWorkloadResponse, ComputeWorkloadResponseSchema, ComputeWorkloadResumeCommand, type ComputeWorkloadResumeInput, type ComputeWorkloadRevision, type ComputeWorkloadRevisionCause, ComputeWorkloadRevisionCauseSchema, type ComputeWorkloadRevisionList, ComputeWorkloadRevisionListSchema, ComputeWorkloadRevisionSchema, ComputeWorkloadRevisionsListCommand, type ComputeWorkloadRevisionsListInput, ComputeWorkloadRollbackCommand, type ComputeWorkloadRollbackInput, type ComputeWorkloadRun, ComputeWorkloadRunCommand, type ComputeWorkloadRunInput, type ComputeWorkloadRunKind, ComputeWorkloadRunKindSchema, type ComputeWorkloadRunList, ComputeWorkloadRunListSchema, type ComputeWorkloadRunOutput, type ComputeWorkloadRunResponse, ComputeWorkloadRunResponseSchema, ComputeWorkloadRunSchema, type ComputeWorkloadRunStatus, ComputeWorkloadRunStatusSchema, ComputeWorkloadRunsListCommand, type ComputeWorkloadRunsListInput, type ComputeWorkloadScaling, type ComputeWorkloadScalingMode, ComputeWorkloadScalingModeSchema, ComputeWorkloadScalingSchema, ComputeWorkloadSchema, type ComputeWorkloadSecretRef, ComputeWorkloadSecretRefSchema, type ComputeWorkloadStatus, ComputeWorkloadStatusSchema, ComputeWorkloadUpdateCommand, type ComputeWorkloadUpdateInput, type ComputeWorkloadVolume, ComputeWorkloadVolumeSchema, ContainerRegistListCommand, ContainerRegistryCreateCommand, type ContainerRegistryCreateInput, type ContainerRegistryCreateOutput, ContainerRegistryDeleteCommand, type ContainerRegistryDeleteInput, ContainerRegistryFetchCommand, type ContainerRegistryFetchInput, type ContainerRegistryFetchTenantInput, ContainerRegistryUpdateCommand, type ContextAddItemChunk, ContextAddItemCommand, type ContextAddItemCommandInput, type ContextAddItemCommandOutput, type ContextItem, ContextRemoveItemCommand, type ContextRemoveItemCommandInput, type ContextRemoveItemCommandOutput, type ContextUpdateResponse, type Conversation, type ConversationCreatedChunk, ConversationDeleteCommand, type ConversationDeleteCommandInput, type ConversationDeleteCommandOutput, type ConversationDeleteResponse, ConversationGetCommand, type ConversationGetCommandInput, type ConversationGetCommandOutput, ConversationListCommand, type ConversationListCommandInput, type ConversationListCommandOutput, type ConversationListResponse, type ConversationMetadata, ConversationStreamCommand, type ConversationStreamConfig, type ConversationStreamSendPayload, CustomCommand, DEFAULT_COMPUTE_OPERATION_POLL_INTERVAL_MS, DEFAULT_COMPUTE_OPERATION_TIMEOUT_MS, type DataCore, DataCoreCreateCommand, type DataCoreCreateInput, DataCoreExistsCommand, type DataCoreExistsInput, type DataCoreExistsOutput, type DataCoreFetchByIdInput, type DataCoreFetchByNameAndTenantIdInput, type DataCoreFetchByNameAndTenantInput, DataCoreFetchCommand, type DataCoreFetchInput, DataCoreListCommand, type DataCoreListInput, DataCoreRequestDeleteCommand, type DataCoreRequestDeleteInput, type DataCoreRequestDeleteOutput, DataCoreUpdateCommand, type DataCoreUpdateInput, type DataPathway, type DataPathwayAssignment, DataPathwayAssignmentCompleteCommand, type DataPathwayAssignmentCompleteInput, DataPathwayAssignmentExpireLeasesCommand, type DataPathwayAssignmentExpireLeasesInput, DataPathwayAssignmentFetchCommand, type DataPathwayAssignmentFetchInput, DataPathwayAssignmentHeartbeatCommand, type DataPathwayAssignmentHeartbeatInput, type DataPathwayAssignmentList, DataPathwayAssignmentListCommand, type DataPathwayAssignmentListInput, type DataPathwayAssignmentNext, DataPathwayAssignmentNextCommand, type DataPathwayAssignmentNextInput, type DataPathwayCapacity, DataPathwayCapacityFetchCommand, type DataPathwayCapacityFetchInput, type DataPathwayCommand, DataPathwayCommandDispatchConfigUpdateCommand, type DataPathwayCommandDispatchConfigUpdateInput, DataPathwayCommandDispatchPauseCommand, type DataPathwayCommandDispatchPauseInput, DataPathwayCommandDispatchRestartCommand, type DataPathwayCommandDispatchRestartInput, DataPathwayCommandDispatchResumeCommand, type DataPathwayCommandDispatchResumeInput, DataPathwayCommandDispatchStopCommand, type DataPathwayCommandDispatchStopInput, DataPathwayCommandFetchCommand, type DataPathwayCommandFetchInput, type DataPathwayCommandList, DataPathwayCommandPendingByPathwayCommand, type DataPathwayCommandPendingByPathwayInput, DataPathwayCommandPendingCommand, type DataPathwayCommandPendingInput, type DataPathwayCommandResponse, DataPathwayCommandUpdateStatusByPathwayCommand, type DataPathwayCommandUpdateStatusByPathwayInput, DataPathwayCommandUpdateStatusCommand, type DataPathwayCommandUpdateStatusInput, DataPathwayCreateCommand, type DataPathwayCreateInput, DataPathwayDeleteCommand, type DataPathwayDeleteInput, DataPathwayDeliveryLogBatchCommand, type DataPathwayDeliveryLogBatchInput, DataPathwayDeliveryLogListCommand, type DataPathwayDeliveryLogListInput, DataPathwayDisableCommand, type DataPathwayDisableInput, type DataPathwayExpireLeasesResponse, DataPathwayFetchByNameCommand, type DataPathwayFetchByNameInput, DataPathwayFetchCommand, type DataPathwayFetchInput, DataPathwayHealthCheckCommand, type DataPathwayHealthCheckInput, type DataPathwayList, DataPathwayListCommand, type DataPathwayListInput, DataPathwayMetricsFetchCommand, type DataPathwayMetricsFetchInput, type DataPathwayMutationResponse, type DataPathwayPumpState, DataPathwayPumpStateFetchBySourceCommand, type DataPathwayPumpStateFetchBySourceInput, DataPathwayPumpStateFetchCommand, type DataPathwayPumpStateFetchInput, DataPathwayPumpStateSaveBySourceCommand, type DataPathwayPumpStateSaveBySourceInput, DataPathwayPumpStateSaveCommand, type DataPathwayPumpStateSaveInput, type DataPathwayPumpStateSaveResponse, type DataPathwayQuota, DataPathwayQuotaFetchCommand, type DataPathwayQuotaFetchInput, type DataPathwayQuotaList, DataPathwayQuotaListCommand, type DataPathwayQuotaListInput, DataPathwayQuotaSetCommand, type DataPathwayQuotaSetInput, type DataPathwayQuotaSetResponse, type DataPathwayQuotaWithUsage, DataPathwayRestartFetchCommand, type DataPathwayRestartFetchInput, type DataPathwayRestartRequest, DataPathwayRestartRequestCommand, type DataPathwayRestartRequestInput, type DataPathwayRestartRequestResponse, type DataPathwaySlot, DataPathwaySlotDeregisterCommand, type DataPathwaySlotDeregisterInput, DataPathwaySlotFetchCommand, type DataPathwaySlotFetchInput, DataPathwaySlotHeartbeatCommand, type DataPathwaySlotHeartbeatInput, type DataPathwaySlotList, DataPathwaySlotListCommand, type DataPathwaySlotListInput, type DataPathwaySlotMutationResponse, DataPathwaySlotRegisterCommand, type DataPathwaySlotRegisterInput, DataPathwayUpsertByNameCommand, type DataPathwayUpsertByNameInput, type DataPathwayUpsertByNameResponse, DataPathwayUpsertByNameResponseSchema, type EntitlementGrant, type EntitlementRequestAccessItem, type EntitlementResponse, EntitlementResponseSchema, type ErrorChunk, EventListCommand, type EventListInput, type EventListOutput, type EventType, EventTypeCreateCommand, type EventTypeCreateInput, EventTypeExistsCommand, type EventTypeExistsInput, type EventTypeExistsOutput, type EventTypeFetchByIdInput, type EventTypeFetchByNameInput, EventTypeFetchCommand, type EventTypeFetchInput, EventTypeInfoCommand, type EventTypeInfoInput, type EventTypeInfoOutput, EventTypeListCommand, type EventTypeListInput, EventTypeListRemovedSensitiveDataCommand, type EventTypeListRemovedSensitiveDataInput, EventTypeRemoveSensitiveDataCommand, type EventTypeRemoveSensitiveDataInput, EventTypeRequestDeleteCommand, type EventTypeRequestDeleteInput, type EventTypeRequestDeleteOutput, EventTypeRequestTruncateCommand, type EventTypeRequestTruncateInput, type EventTypeRequestTruncateOutput, EventTypeSchema, type EventTypeSensitiveDataMask, type EventTypeSensitiveDataMaskParsed, EventTypeSensitiveDataMaskParsedSchema, EventTypeSensitiveDataMaskSchema, EventTypeUpdateCommand, type EventTypeUpdateInput, EventsFetchCommand, type EventsFetchEventsInput, type EventsFetchEventsOutput, EventsFetchTimeBucketsByNamesCommand, type EventsFetchTimeBucketsByNamesInput, type EventsFetchTimeBucketsByNamesOutput, FetchPumpStatusCommand, type FetchPumpStatusInput, type FlowType, FlowTypeCreateCommand, type FlowTypeCreateInput, FlowTypeExistsCommand, type FlowTypeExistsInput, type FlowTypeExistsOutput, type FlowTypeFetchByIdInput, type FlowTypeFetchByNameInput, FlowTypeFetchCommand, type FlowTypeFetchInput, FlowTypeListCommand, type FlowTypeListInput, FlowTypeRequestDeleteCommand, type FlowTypeRequestDeleteInput, type FlowTypeRequestDeleteOutput, FlowTypeUpdateCommand, type FlowTypeUpdateInput, FlowcoreClient, type FlowcoreEvent, type InfoChunk, IngestBatchCommand, type IngestBatchInput, type IngestBatchOutput, IngestEventCommand, type IngestEventInput, type IngestEventOutput, InvalidResponseException, KeyPoliciesCommand, type KeyPoliciesInput, type KeyPolicyLink, KeyPolicyLinkSchema, type KeyRoleLink, KeyRoleLinkSchema, KeyRolesCommand, type KeyRolesInput, LinkKeyPolicyCommand, type LinkKeyPolicyInput, LinkKeyRoleCommand, type LinkKeyRoleInput, LinkRolePolicyCommand, type LinkRolePolicyInput, LinkUserPolicyCommand, type LinkUserPolicyInput, LinkUserRoleCommand, type LinkUserRoleInput, type MarkdownDeltaChunk, type Message, NotFoundException, NotificationClient, type NotificationClientOptions, type NotificationEvent, type OidcClient, OrganizationPoliciesCommand, type OrganizationPoliciesInput, OrganizationRolesCommand, type OrganizationRolesInput, type Pagination, PaginationSchema, type PathwayConfig, type Permission, PermissionsListCommand, type PermissionsListInput, type Policy, PolicyArchiveCommand, type PolicyArchiveInput, type PolicyAssociations, PolicyAssociationsCommand, type PolicyAssociationsInput, PolicyAssociationsSchema, PolicyCreateCommand, type PolicyCreateInput, type PolicyFilter, PolicyFilterSchema, type PolicyFilterValue, PolicyFilterValueSchema, PolicyGetCommand, type PolicyGetInput, type PolicyKeyAssociation, PolicyKeyAssociationSchema, PolicyListCommand, type PolicyListInput, type PolicyRoleAssociation, PolicyRoleAssociationSchema, PolicySchema, type PolicyStatement, PolicyStatementSchema, PolicyUpdateCommand, type PolicyUpdateInput, type PolicyUserAssociation, PolicyUserAssociationSchema, PolicyValidateCommand, type PolicyValidateInput, type PolicyValidateResponse, PolicyValidateResponseSchema, type PumpConfig, type RemoveContextItemRequest, ResolveKeyEntitlementsCommand, type ResolveKeyEntitlementsInput, ResolveUserEntitlementsCommand, type ResolveUserEntitlementsInput, type Role, RoleArchiveCommand, type RoleArchiveInput, type RoleAssociations, RoleAssociationsCommand, type RoleAssociationsInput, RoleAssociationsSchema, RoleCreateCommand, type RoleCreateInput, RoleGetCommand, type RoleGetInput, type RoleKeyAssociation, RoleKeyAssociationSchema, RoleListCommand, type RoleListInput, RolePoliciesCommand, type RolePoliciesInput, type RolePolicyLink, RolePolicyLinkSchema, RoleSchema, RoleUpdateCommand, type RoleUpdateInput, type RoleUserAssociation, RoleUserAssociationSchema, type Secret, SecretCreateCommand, type SecretCreateInput, SecretDeleteCommand, type SecretDeleteInput, SecretEditCommand, type SecretEditInput, SecretFetchCommand, type SecretFetchInput, SecretListCommand, type SecretListInput, type SecurityCreatePAT, SecurityCreatePATCommand, type SecurityDeletePAT, SecurityDeletePATCommand, type SecurityDeletePATResponse, type SecurityExchangePAT, SecurityExchangePATCommand, type SecurityExchangePATResponse, type SecurityGetPAT, SecurityGetPATCommand, SecurityListPATCommand, SendPumpPulseCommand, type SendPumpPulseInput, type SensitiveDataDefinition, SensitiveDataDefinitionSchema, type ServiceAccount, ServiceAccountCreateCommand, type ServiceAccountCreateInput, ServiceAccountDeleteCommand, type ServiceAccountDeleteInput, ServiceAccountEditCommand, type ServiceAccountEditInput, ServiceAccountFetchCommand, type ServiceAccountFetchInput, ServiceAccountListCommand, type ServiceAccountListInput, ServiceAccountRotateSecretCommand, type ServiceAccountRotateSecretInput, type ServiceAccountSecretRotation, type ServiceAccountWithSecret, type StreamChunk, type TComputeDeploymentEvent, type TComputeDeploymentEventObject, type TComputeDomain, type TComputeDomainListResponse, type TComputeDomainStatus, type TComputeDomainTls, type TComputeDomainTlsStatus, type TComputeDomainVerification, type TComputeDomainVerificationType, type TComputeDomainVerifyResponse, type TComputeLogEntry, type TComputeLogStreamEvent, type TComputeLogStreamName, type TComputeNoContent, type TComputeOperation, type TComputeOperationDeploymentProgress, type TComputeOperationPhase, type TComputeOperationPreSyncProgress, type TComputeOperationProgress, type TComputeOperationStatus, type TComputeOperationStepStatus, type TComputeOperationType, type TComputePreSyncSpec, type TComputeProbe, type TComputeProbeExec, type TComputeProbeHttpGet, type TComputeProbeTcpSocket, type TComputeRegistry, type TComputeRegistryDetail, type TComputeRegistryDetailResponse, type TComputeRegistryListResponse, type TComputeRegistrySynthesisState, type TComputeSlotTier, type TComputeWorkload, type TComputeWorkloadCreateResponse, type TComputeWorkloadDefinition, type TComputeWorkloadDeleteResponse, type TComputeWorkloadDeploymentEvents, type TComputeWorkloadEnvVar, type TComputeWorkloadKind, type TComputeWorkloadListResponse, type TComputeWorkloadLogs, type TComputeWorkloadMutationResponse, type TComputeWorkloadProbes, type TComputeWorkloadResponse, type TComputeWorkloadRevision, type TComputeWorkloadRevisionCause, type TComputeWorkloadRevisionList, type TComputeWorkloadRun, type TComputeWorkloadRunKind, type TComputeWorkloadRunList, type TComputeWorkloadRunResponse, type TComputeWorkloadRunStatus, type TComputeWorkloadScaling, type TComputeWorkloadScalingMode, type TComputeWorkloadSecretRef, type TComputeWorkloadStatus, type TComputeWorkloadVolume, type Tenant, TenantAuditLogsCommand, type TenantAuditLogsInput, TenantCreateCommand, type TenantCreateInput, TenantDisableSensitiveDataCommand, type TenantDisableSensitiveDataInput, type TenantDisableSensitiveDataResponse, TenantEnableSensitiveDataCommand, type TenantEnableSensitiveDataInput, type TenantEnableSensitiveDataResponse, type TenantFetchByIdInput, type TenantFetchByNameInput, TenantFetchCommand, type TenantFetchInput, type TenantInstance, type TenantInstanceFetchByIdInput, type TenantInstanceFetchByNameInput, TenantInstanceFetchCommand, type TenantInstanceFetchInput, TenantListCommand, type TenantListInput, type TenantPreview, TenantPreviewCommand, type TenantPreviewInput, type TenantTranslateNameToId, TenantTranslateNameToIdCommand, type TenantTranslateNameToIdInput, TenantTranslateNameToIdSchema, TenantUpdateCommand, type TenantUpdateInput, TenantUserAddCommand, type TenantUserAddInput, TenantUserListCommand, type TenantUserListInput, type TenantUserListOutput, TenantUserRemoveCommand, type TenantUserRemoveInput, TimeBucketListCommand, type TimeBucketListInput, type TimeBucketListOutput, type TitleUpdateChunk, type ToolErrorChunk, type ToolInputChunk, type ToolOutputChunk, type ToolStartChunk, UnlinkKeyPolicyCommand, type UnlinkKeyPolicyInput, UnlinkKeyRoleCommand, type UnlinkKeyRoleInput, UnlinkRolePolicyCommand, type UnlinkRolePolicyInput, UnlinkUserPolicyCommand, type UnlinkUserPolicyInput, UnlinkUserRoleCommand, type UnlinkUserRoleInput, UserDeleteCommand, type UserDeleteInput, type UserDeleteOutput, UserInitializeInKeycloakCommand, type UserInitializeInKeycloakInput, type UserInitializeInKeycloakOutput, UserInviteToTenantCommand, type UserInviteToTenantInput, type UserInviteToTenantOutput, type UserPermission, UserPermissionSchema, UserPermissionsCommand, type UserPermissionsInput, UserPoliciesCommand, type UserPoliciesInput, type UserPolicyLink, UserPolicyLinkSchema, type UserRoleLink, UserRoleLinkSchema, UserRolesCommand, type UserRolesInput, type ValidPolicy, ValidPolicySchema, ValidateKeyCommand, type ValidateKeyInput, ValidateUserCommand, type ValidateUserInput, type ValidationMode, type ValidationRequestAccessItem, type ValidationResponse, ValidationResponseSchema, type Variable, VariableCreateCommand, type VariableCreateInput, VariableDeleteCommand, type VariableDeleteInput, VariableEditCommand, type VariableEditInput, VariableFetchCommand, type VariableFetchInput, VariableListCommand, type VariableListInput, type VirtualConfig, WebSocketClient, type WebSocketClientOptions, type WebSocketCommand, isEncryptedPayload, matchesPolicyFilters, parseEntitlementResponse, parseResponseHelper, permitsPayload, waitForComputeOperation }; diff --git a/dist/index.js b/dist/index.js new file mode 100644 index 0000000..c99563f --- /dev/null +++ b/dist/index.js @@ -0,0 +1,10532 @@ +import { Type } from '@sinclair/typebox'; +import { Value } from '@sinclair/typebox/value'; +import { Subject, Observable } from 'rxjs'; +import { WebSocket } from 'ws'; +import { Buffer } from 'buffer'; + +var __defProp = Object.defineProperty; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __esm = (fn, res) => function __init() { + return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res; +}; +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); +}; + +// src/exceptions/command-error.ts +var CommandError; +var init_command_error = __esm({ + "src/exceptions/command-error.ts"() { + CommandError = class extends Error { + constructor(commandName, message) { + super(`Command "${commandName}" failed with: ${message}`); + } + }; + } +}); + +// src/utils/local-cache.ts +var LocalCache; +var init_local_cache = __esm({ + "src/utils/local-cache.ts"() { + LocalCache = class { + constructor(defaultTtlMs) { + this.defaultTtlMs = defaultTtlMs; + } + defaultTtlMs; + cache = /* @__PURE__ */ new Map(); + timers = /* @__PURE__ */ new Map(); + get(key) { + return this.cache.get(key); + } + set(key, value, ttlMs) { + clearTimeout(this.timers.get(key)); + this.cache.set(key, value); + if (ttlMs ?? this.defaultTtlMs) { + const timer = setTimeout(() => this.cache.delete(key), ttlMs ?? this.defaultTtlMs); + this.timers.set(key, timer); + } + } + delete(key) { + clearTimeout(this.timers.get(key)); + this.cache.delete(key); + } + clear() { + for (const key of this.timers.keys()) { + clearTimeout(this.timers.get(key)); + } + this.cache.clear(); + this.timers.clear(); + } + }; + } +}); + +// src/common/tenant.cache.ts +var tenantCache; +var init_tenant_cache = __esm({ + "src/common/tenant.cache.ts"() { + init_local_cache(); + tenantCache = new LocalCache(60 * 1e3); + } +}); +var TenantSchema, TenantListItemSchema, TenantUserSchema, TenantPreviewSchema, TenantInstanceSchema; +var init_tenant = __esm({ + "src/contracts/tenant.ts"() { + TenantSchema = Type.Object({ + id: Type.String(), + name: Type.String(), + displayName: Type.String(), + description: Type.String(), + websiteUrl: Type.String(), + isDedicated: Type.Boolean(), + dedicated: Type.Union([ + Type.Null(), + Type.Object({ + status: Type.Union([ + Type.Literal("ready"), + Type.Literal("degraded"), + Type.Literal("offline") + ]), + configuration: Type.Object({ + domain: Type.String(), + configurationRepoUrl: Type.String(), + configurationRepoCredentials: Type.Union([Type.String(), Type.Null()]) + }) + }) + ]), + sensitiveDataEnabled: Type.Optional(Type.Boolean()) + }); + TenantListItemSchema = Type.Object({ + id: Type.String(), + name: Type.String(), + displayName: Type.String(), + description: Type.String(), + websiteUrl: Type.String(), + isDedicated: Type.Boolean(), + sensitiveDataEnabled: Type.Boolean(), + domain: Type.Union([Type.String(), Type.Null()]), + permissions: Type.Array(Type.String()) + }); + TenantUserSchema = Type.Object({ + id: Type.String(), + username: Type.String(), + email: Type.String(), + firstName: Type.Union([Type.String(), Type.Null()]), + lastName: Type.Union([Type.String(), Type.Null()]) + }); + TenantPreviewSchema = Type.Object({ + displayName: Type.String(), + websiteUrl: Type.String(), + description: Type.String() + }); + TenantInstanceSchema = Type.Object({ + isDedicated: Type.Boolean(), + instance: Type.Union([ + Type.Null(), + Type.Object({ + status: Type.String(), + domain: Type.String() + }) + ]) + }); + } +}); + +// src/exceptions/not-found.ts +var NotFoundException; +var init_not_found = __esm({ + "src/exceptions/not-found.ts"() { + NotFoundException = class extends Error { + constructor(resource, filters) { + super(`${resource} not found: ${JSON.stringify(filters)}`); + } + }; + } +}); + +// src/exceptions/invalid-response.ts +var InvalidResponseException; +var init_invalid_response = __esm({ + "src/exceptions/invalid-response.ts"() { + InvalidResponseException = class extends Error { + constructor(message, errors) { + const errorString = JSON.stringify(errors); + super(`${message}: ${errorString.slice(0, 1e3)}`); + this.errors = errors; + this.errors = errors; + } + errors; + }; + } +}); +var parseResponseHelper; +var init_parse_response_helper = __esm({ + "src/utils/parse-response-helper.ts"() { + init_invalid_response(); + parseResponseHelper = (schema, response) => { + if (!Value.Check(schema, response)) { + const parseErrors = Value.Errors(schema, response); + const errors = {}; + for (const error of parseErrors) { + errors[error.path] = error.message; + } + throw new InvalidResponseException("Invalid response", errors); + } + return response; + }; + } +}); + +// src/commands/tenant/tenant-instance.fetch.ts +var tenant_instance_fetch_exports = {}; +__export(tenant_instance_fetch_exports, { + TenantInstanceFetchCommand: () => TenantInstanceFetchCommand +}); +var TenantInstanceFetchCommand; +var init_tenant_instance_fetch = __esm({ + "src/commands/tenant/tenant-instance.fetch.ts"() { + init_command(); + init_tenant(); + init_not_found(); + init_parse_response_helper(); + TenantInstanceFetchCommand = class extends Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + if ("tenantId" in this.input && this.input.tenantId) { + return `/api/v1/tenants/by-id/${this.input.tenantId}/instance`; + } + return `/api/v1/tenants/by-name/${this.input.tenant}/instance`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(TenantInstanceSchema, rawResponse); + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("Tenant", { + [this.input.tenantId ? "id" : "name"]: this.input.tenantId ?? this.input.tenant + }); + } + throw error; + } + }; + } +}); + +// src/common/command.ts +var Command; +var init_command = __esm({ + "src/common/command.ts"() { + init_command_error(); + init_tenant_cache(); + Command = class { + /** + * Whether the command should retry on failure + */ + retryOnFailure = true; + /** + * The dedicated subdomain for the command + */ + dedicatedSubdomain; + /** + * The allowed modes for the command + */ + allowedModes = ["apiKey", "bearer"]; + /** + * The input for the command + */ + input; + /** + * The client auth options + */ + clientAuthOptions = {}; + constructor(input) { + this.input = input; + } + /** + * Set the client auth options - this is called by the FlowcoreClient + * before executing the command + */ + setClientAuthOptions(options) { + Object.assign(this.clientAuthOptions, options); + } + /** + * Get the dedicated base URL + */ + async getDedicatedBaseUrl(client) { + if (!this.dedicatedSubdomain) { + return null; + } + const inputTenant = typeof this.input === "object" && this.input !== null && "tenant" in this.input && typeof this.input.tenant === "string" && this.input.tenant; + if (!inputTenant) { + return null; + } + let tenant = tenantCache.get(inputTenant); + if (!tenant) { + const { TenantInstanceFetchCommand: TenantInstanceFetchCommand2 } = await Promise.resolve().then(() => (init_tenant_instance_fetch(), tenant_instance_fetch_exports)); + tenant = await client.execute(new TenantInstanceFetchCommand2({ tenant: inputTenant })); + tenantCache.set(inputTenant, tenant); + } + if (!tenant.isDedicated) { + return null; + } + if (!tenant.instance?.domain) { + throw new CommandError(this.constructor.name, `Tenant ${inputTenant} does not have a dedicated domain configured`); + } + return `https://${this.dedicatedSubdomain}.${tenant.instance.domain}`; + } + /** + * Get the method for the request + */ + getMethod() { + return "POST"; + } + /** + * Get the path for the request + */ + getPath() { + return "/"; + } + /** + * Get the body for the request + */ + getBody() { + if (this.getMethod() === "GET") { + return void 0; + } + return this.input ?? void 0; + } + /** + * Get the headers for the request + */ + getHeaders() { + return typeof this.getBody() === "object" ? { + "Content-Type": "application/json" + } : {}; + } + /** + * Handle the client error + */ + handleClientError(error) { + throw error; + } + /** + * Get the request object + */ + async getRequest(client, direct) { + return { + allowedModes: this.allowedModes, + body: this.getBody(), + headers: this.getHeaders(), + baseUrl: direct ? this.getBaseUrl() : await this.getDedicatedBaseUrl(client) ?? this.getBaseUrl(), + path: this.getPath(), + method: this.getMethod(), + parseResponse: this.parseResponse.bind(this), + processResponse: this.processResponse.bind(this), + handleClientError: this.handleClientError.bind(this), + retryOnFailure: this.retryOnFailure + }; + } + /** + * Wait for the response + */ + async processResponse(_client, response) { + return response; + } + }; + } +}); + +// src/commands/ai-agent-coordinator/artifact-get.command.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var ArtifactSchema = Type.Object({ + artifactId: Type.String({ example: "artifact_code_123" }), + artifactType: Type.Union([ + Type.Literal("code"), + Type.Literal("markdown"), + Type.Literal("table"), + Type.Literal("visualization"), + Type.Literal("html"), + Type.Literal("mermaid") + ], { description: "Type of artifact" }), + title: Type.String({ example: "Example Code Snippet" }), + content: Type.Optional(Type.String({ description: "String content" })), + data: Type.Optional(Type.Unknown({ description: "JSON data" })), + url: Type.Optional(Type.String({ format: "uri", description: "URL content" })) +}); +var ArtifactGetCommand = class extends Command { + getMethod() { + return "GET"; + } + getBaseUrl() { + return "https://ai-coordinator.api.flowcore.io"; + } + getPath() { + return `/api/v1/artifacts/${this.input.artifactId}`; + } + getHeaders() { + return { + "Accept": "application/json" + }; + } + parseResponse(rawResponse) { + const response = parseResponseHelper(ArtifactSchema, rawResponse); + return response; + } + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("Artifact", { id: this.input.artifactId }); + } + throw error; + } +}; + +// src/commands/ai-agent-coordinator/context-add-item.command.ts +init_command(); +var service = "ai-coordinator"; +var baseUrl = `https://${service}.api.flowcore.io`; +var ContextAddItemCommand = class extends Command { + getBaseUrl() { + return baseUrl; + } + getMethod() { + return "POST"; + } + getPath() { + return `/api/v1/conversations/${this.input.conversationId}/context/add`; + } + getBody() { + return { items: this.input.items }; + } + // Headers will be handled by base class based on getBody() + parseResponse(response) { + const data = response; + if (data?.context && Array.isArray(data.context)) { + return data; + } else { + throw new Error("Invalid response format for ContextAddItemCommand"); + } + } +}; + +// src/commands/ai-agent-coordinator/context-remove-item.command.ts +init_command(); +var service2 = "ai-coordinator"; +var baseUrl2 = `https://${service2}.api.flowcore.io`; +var ContextRemoveItemCommand = class extends Command { + getBaseUrl() { + return baseUrl2; + } + getMethod() { + return "POST"; + } + getPath() { + return `/api/v1/conversations/${this.input.conversationId}/context/remove`; + } + getBody() { + return { itemId: this.input.itemId }; + } + parseResponse(response) { + const data = response; + if (data?.context && Array.isArray(data.context)) { + return data; + } else { + throw new Error("Invalid response format for ContextRemoveItemCommand"); + } + } +}; + +// src/commands/ai-agent-coordinator/conversation-delete.command.ts +init_command(); +var service3 = "ai-coordinator"; +var baseUrl3 = `https://${service3}.api.flowcore.io`; +var ConversationDeleteCommand = class extends Command { + getBaseUrl() { + return baseUrl3; + } + getMethod() { + return "DELETE"; + } + getPath() { + return `/api/v1/conversations/${this.input.conversationId}`; + } + // No need to override getBody or getHeaders for DELETE with no body + parseResponse(response) { + const data = response; + if (data?.message) { + return data; + } else { + throw new Error("Invalid response format for ConversationDeleteCommand"); + } + } + // No specific error handling needed for DELETE beyond the base implementation (re-throw) +}; + +// src/commands/ai-agent-coordinator/conversation-get.command.ts +init_command(); + +// src/exceptions/client-error.ts +var ClientError = class extends Error { + constructor(message, status, command, body) { + super(`${command} failed with ${status}: ${body ? JSON.stringify(body) : message}`); + this.status = status; + this.command = command; + this.body = body; + } + status; + command; + body; +}; + +// src/exceptions/index.ts +init_invalid_response(); +init_not_found(); +init_command_error(); + +// src/commands/ai-agent-coordinator/conversation-get.command.ts +var service4 = "ai-coordinator"; +var baseUrl4 = `https://${service4}.api.flowcore.io`; +var ConversationGetCommand = class extends Command { + getBaseUrl() { + return baseUrl4; + } + getMethod() { + return "GET"; + } + getPath() { + return `/api/v1/conversations/${this.input.conversationId}`; + } + parseResponse(response) { + const data = response; + if (data?.id) { + return data; + } else { + throw new Error("Invalid response format for ConversationGetCommand"); + } + } + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException( + "Conversation", + { conversationId: this.input.conversationId } + ); + } + throw error; + } +}; + +// src/commands/ai-agent-coordinator/conversation-list.command.ts +init_command(); +var service5 = "ai-coordinator"; +var baseUrl5 = `https://${service5}.api.flowcore.io`; +var ConversationListCommand = class extends Command { + constructor() { + super({}); + } + getBaseUrl() { + return baseUrl5; + } + getMethod() { + return "GET"; + } + getPath() { + return `/api/v1/conversations`; + } + parseResponse(response) { + const data = response; + if (data && Array.isArray(data.conversations)) { + return data.conversations; + } else { + throw new Error("Invalid response format for ConversationListCommand"); + } + } +}; + +// src/commands/ai-agent-coordinator/conversation-stream.command.ts +var ConversationStreamCommand = class { + config; + constructor(config) { + if (!config.conversationId) { + throw new Error("conversationId is required in the config for ConversationStreamCommand"); + } + this.config = config; + } + /** Get the configuration object for the command. */ + getConfig() { + return this.config; + } + /** Get the base WebSocket URL. */ + getWebSocketBaseUrl() { + return "wss://ai-coordinator.api.flowcore.io"; + } + /** Get the WebSocket path segment. */ + getWebSocketPathSegment() { + return `api/v1/stream/${this.config.conversationId ? `${this.config.conversationId}` : ""}`; + } + /** Serializer function for outgoing payloads. */ + serializeSendPayload(payload) { + return JSON.stringify({ + type: "message", + // Example type, adjust as needed + payload + // Send the original payload nested + }); + } +}; + +// src/commands/tenant/tenant.disable-sensitive-data.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var responseSchema = Type.Object({ + sensitiveDataEnabled: Type.Boolean() +}); +var TenantDisableSensitiveDataCommand = class extends Command { + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/tenants/${this.input.tenantId}/disable-sensitive-data`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = parseResponseHelper(responseSchema, rawResponse); + return response; + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("Tenant", { + id: this.input.tenantId + }); + } + throw error; + } +}; + +// src/commands/tenant/tenant.enable-sensitive-data.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var responseSchema2 = Type.Object({ + sensitiveDataEnabled: Type.Boolean() +}); +var TenantEnableSensitiveDataCommand = class extends Command { + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/tenants/${this.input.tenantId}/enable-sensitive-data`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = parseResponseHelper(responseSchema2, rawResponse); + return response; + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("Tenant", { + id: this.input.tenantId + }); + } + throw error; + } +}; + +// src/commands/tenant/tenant.create.ts +init_command(); +init_tenant(); +init_parse_response_helper(); +var responseSchema3 = Type.Object({ + ...TenantSchema.properties, + dedicated: Type.Union([ + Type.Null(), + Type.Object({ + // parse as string to avoid SDK failures if new statuses are added + status: Type.String(), + configuration: Type.Object({ + domain: Type.String(), + configurationRepoUrl: Type.String(), + configurationRepoCredentials: Type.String() + }) + }) + ]), + configured: Type.Boolean(), + sensitiveDataEnabled: Type.Boolean() +}); +var TenantCreateCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/tenants`; + } + /** + * Get the body for the request + */ + getBody() { + const { tenantSlug, description, displayName } = this.input; + return { + tenant_slug: tenantSlug, + ...description !== void 0 && { description }, + ...displayName !== void 0 && { displayName } + }; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = parseResponseHelper(responseSchema3, rawResponse); + return response; + } +}; + +// src/commands/tenant/tenant.fetch.ts +init_command(); +init_tenant(); +init_not_found(); +init_parse_response_helper(); +var responseSchema4 = Type.Object({ + ...TenantSchema.properties, + dedicated: Type.Union([ + Type.Null(), + Type.Object({ + // parse as string to prevent sdk to fail when new status are added + status: Type.String(), + configuration: Type.Object({ + domain: Type.String(), + configurationRepoUrl: Type.String(), + configurationRepoCredentials: Type.Union([Type.String(), Type.Null()]) + }) + }) + ]) +}); +var TenantFetchCommand = class extends Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + if ("tenantId" in this.input) { + return `/api/v1/tenants/by-id/${this.input.tenantId}`; + } + return `/api/v1/tenants/by-name/${this.input.tenant}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = parseResponseHelper(responseSchema4, rawResponse); + return response; + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("Tenant", { + [this.input.tenantId ? "id" : "name"]: this.input.tenantId ?? this.input.tenant + }); + } + throw error; + } +}; + +// src/commands/index.ts +init_tenant_instance_fetch(); + +// src/commands/tenant/tenant.list.ts +init_command(); +init_tenant(); +init_parse_response_helper(); +var TenantListCommand = class extends Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + const query = new URLSearchParams(); + if (this.input.page !== void 0) { + query.set("page", this.input.page.toString()); + } + if (this.input.limit !== void 0) { + query.set("limit", this.input.limit.toString()); + } + if (this.input.ids !== void 0) { + const ids = Array.isArray(this.input.ids) ? this.input.ids.join(",") : this.input.ids; + query.set("ids", ids); + } + const qs = query.toString(); + return qs ? `/api/v1/tenants/list?${qs}` : `/api/v1/tenants/list`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = parseResponseHelper(Type.Array(TenantListItemSchema), rawResponse); + return response; + } +}; + +// src/commands/tenant/tenant.update.ts +init_command(); +init_tenant(); +init_command_error(); +init_not_found(); +init_parse_response_helper(); +var responseSchema5 = Type.Object({ + ...TenantSchema.properties, + dedicated: Type.Union([ + Type.Null(), + Type.Object({ + // parse as string to prevent sdk to fail when new status are added + status: Type.String(), + configuration: Type.Object({ + domain: Type.String(), + configurationRepoUrl: Type.String(), + configurationRepoCredentials: Type.String() + }) + }) + ]), + configured: Type.Boolean(), + sensitiveDataEnabled: Type.Boolean() +}); +var TenantUpdateCommand = class extends Command { + /** + * Get the method + */ + getMethod() { + return "PATCH"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/tenants/${this.input.tenantId}`; + } + /** + * Get the body for the request + */ + getBody() { + const { tenantId: _tenantId, ...payload } = this.input; + const updateFields = Object.fromEntries( + Object.entries(payload).filter(([_, value]) => value !== void 0) + ); + if (Object.keys(updateFields).length === 0) { + throw new CommandError(this.constructor.name, "No fields to update"); + } + return updateFields; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = parseResponseHelper(responseSchema5, rawResponse); + return response; + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("Tenant", { id: this.input.tenantId }); + } + throw error; + } +}; + +// src/commands/tenant/tenant.user-add.ts +init_command(); +init_parse_response_helper(); +var TenantUserAddCommand = class extends Command { + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/tenants/${this.input.tenantId}/add-user`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = parseResponseHelper( + Type.Object({ + success: Type.Boolean() + }), + rawResponse + ); + return response.success; + } +}; + +// src/commands/tenant/tenant.user-remove.ts +init_command(); +init_parse_response_helper(); +var TenantUserRemoveCommand = class extends Command { + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/tenants/${this.input.tenantId}/remove-user`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = parseResponseHelper( + Type.Object({ + success: Type.Boolean() + }), + rawResponse + ); + return response.success; + } +}; + +// src/common/command-custom.ts +init_command(); +var CustomCommand = class extends Command { + /** + * Get the base URL for the request + */ + getBaseUrl() { + return "NONE"; + } + /** + * Get the request object + */ + async getRequest(client, direct) { + return { + ...await super.getRequest(client, direct), + customExecute: this.customExecute.bind(this) + }; + } + /** + * Parse the response + */ + parseResponse(response) { + return response; + } +}; + +// src/commands/iam/tenant/user-managed-roles.ts +init_command(); +init_parse_response_helper(); +var TenantUserManagedRolesSchema = Type.Record( + Type.String(), + Type.Array(Type.String()) +); +var TenantUserManagedRolesCommand = class extends Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/tenants/${this.input.tenantId}/user-managed-roles`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = parseResponseHelper(TenantUserManagedRolesSchema, rawResponse); + return response; + } +}; + +// src/commands/tenant/tenant.user-list-inner.ts +init_command(); +init_tenant(); +init_parse_response_helper(); +var TenantUserListInnerCommand = class extends Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/tenants/${this.input.tenantId}/users`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = parseResponseHelper(Type.Array(TenantUserSchema), rawResponse); + return response; + } +}; + +// src/commands/tenant/tenant.user-list.ts +var TenantUserListCommand = class extends CustomCommand { + /** + * Custom execute method + */ + async customExecute(client) { + const usersCommand = new TenantUserListInnerCommand({ + tenantId: this.input.tenantId + }); + const tenantUserManagedRolesCommand = new TenantUserManagedRolesCommand({ + tenantId: this.input.tenantId + }); + const [users, tenantUserManagedRoles] = await Promise.all([ + client.execute(usersCommand), + client.execute(tenantUserManagedRolesCommand) + ]); + return users.map((user) => ({ + ...user, + managedRoles: tenantUserManagedRoles[user.id] || [] + })); + } +}; + +// src/commands/tenant/tenant.translate-name-to-id.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var TenantTranslateNameToIdSchema = Type.Object({ + id: Type.String(), + name: Type.String() +}); +var TenantTranslateNameToIdCommand = class extends Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/tenants/translate-name-to-id/${this.input.tenant}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = parseResponseHelper(TenantTranslateNameToIdSchema, rawResponse); + return response; + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("Tenant", { + tenant: this.input.tenant + }); + } + throw error; + } +}; + +// src/commands/tenant/tenant.preview.ts +init_command(); +init_tenant(); +init_not_found(); +init_parse_response_helper(); +var TenantPreviewCommand = class extends Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/tenants/preview/${this.input.name}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(TenantPreviewSchema, rawResponse); + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("Tenant", { name: this.input.name }); + } + throw error; + } +}; + +// src/commands/api-key/api-key.create.ts +init_command(); +init_parse_response_helper(); +var ApiKeySchema = Type.Object({ + id: Type.String(), + tenantId: Type.String(), + name: Type.String(), + description: Type.String(), + maskedApiKey: Type.String(), + createdAt: Type.String(), + lastUsedAt: Type.Union([Type.String(), Type.Null()]) +}); +var ApiKeyWithValueSchema = Type.Object({ + id: Type.String(), + tenantId: Type.String(), + name: Type.String(), + description: Type.String(), + maskedApiKey: Type.String(), + createdAt: Type.String(), + lastUsedAt: Type.Union([Type.String(), Type.Null()]), + apiKey: Type.String() +}); +var ApiKeyValidationSchema = Type.Object({ + valid: Type.Boolean(), + apiKeyId: Type.Optional(Type.String()), + tenantId: Type.Optional(Type.String()) +}); + +// src/commands/api-key/api-key.create.ts +var ApiKeyCreateCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant-store.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return "/api/v1/api-keys"; + } + /** + * The allowed modes for the command. Api-key mode requires tenant-store >= + * the release that accepts AuthType.ApiKey on the api-key management routes; + * authorization is still gated by IAM grants on frn:::tenant. + */ + allowedModes = ["apiKey", "bearer"]; + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(ApiKeyWithValueSchema, rawResponse); + } +}; + +// src/commands/api-key/api-key.fetch.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var ApiKeyFetchCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant-store.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/api-keys/${this.input.apiKeyId}`; + } + /** + * The allowed modes for the command. Api-key mode requires tenant-store >= + * the release that accepts AuthType.ApiKey on the api-key management routes; + * authorization is still gated by IAM grants on frn:::tenant. + */ + allowedModes = ["apiKey", "bearer"]; + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(ApiKeySchema, rawResponse); + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("ApiKey", { id: this.input.apiKeyId }); + } + throw error; + } +}; + +// src/commands/api-key/api-key.edit.ts +init_command(); +init_parse_response_helper(); +var ApiKeyEditCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "PATCH"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant-store.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/api-keys/${this.input.apiKeyId}`; + } + /** + * The allowed modes for the command. Api-key mode requires tenant-store >= + * the release that accepts AuthType.ApiKey on the api-key management routes; + * authorization is still gated by IAM grants on frn:::tenant. + */ + allowedModes = ["apiKey", "bearer"]; + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(ApiKeySchema, rawResponse); + } +}; + +// src/commands/api-key/api-key.delete.ts +init_command(); +var ApiKeyDeleteCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "DELETE"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant-store.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/api-keys/${this.input.apiKeyId}`; + } + /** + * The allowed modes for the command. Api-key mode requires tenant-store >= + * the release that accepts AuthType.ApiKey on the api-key management routes; + * authorization is still gated by IAM grants on frn:::tenant. + */ + allowedModes = ["apiKey", "bearer"]; + /** + * Parse the response + */ + parseResponse(_rawResponse) { + return true; + } +}; + +// src/commands/api-key/api-key.list.ts +init_command(); +init_parse_response_helper(); +var ApiKeyListCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant-store.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/api-keys?tenantId=${this.input.tenantId}`; + } + /** + * The allowed modes for the command. Api-key mode requires tenant-store >= + * the release that accepts AuthType.ApiKey on the api-key management routes; + * authorization is still gated by IAM grants on frn:::tenant. + */ + allowedModes = ["apiKey", "bearer"]; + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(Type.Array(ApiKeySchema), rawResponse); + } +}; + +// src/commands/api-key/api-key.validate.ts +init_command(); +init_parse_response_helper(); +var ApiKeyValidateCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant-store.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return "/api/v1/api-keys/validate"; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(ApiKeyValidationSchema, rawResponse); + } +}; + +// src/commands/api-key/api-key.validate-with-tenant-id.ts +init_command(); +init_parse_response_helper(); +var ApiKeyValidateWithTenantIdCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant-store.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return "/api/v1/api-keys/validate-with-tenant-id"; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(ApiKeyValidationSchema, rawResponse); + } +}; + +// src/commands/aws-marketplace/aws-marketplace-customer.resolve.ts +init_command(); +Type.Union([ + Type.Literal("managed"), + Type.Literal("self-hosted") +]); +Type.Record( + Type.String(), + Type.Optional(Type.String()) +); +var AwsMarketplaceProductModeSchema = Type.Union([ + Type.Literal("basic"), + Type.Literal("dedicated") +]); +var AwsMarketplaceCustomerSchema = Type.Object({ + customerId: Type.String(), + productCode: Type.String(), + accountId: Type.String(), + metadata: Type.String(), + productMode: AwsMarketplaceProductModeSchema +}); +var AwsMarketplaceLinkSchema = Type.Object({ + linkingId: Type.String(), + awsCustomerId: Type.String(), + awsProductCode: Type.String(), + awsAccountId: Type.String(), + tenant: Type.Union([Type.String(), Type.Null()]), + tenantId: Type.String(), + contactInfo: Type.Union([Type.String(), Type.Null()]), + productProperties: Type.Union([Type.Record(Type.String(), Type.String()), Type.Null()]), + linkedAt: Type.String() +}); +var AwsMarketplaceCustomerResolveSchema = Type.Object({ + success: Type.Boolean(), + customer: AwsMarketplaceCustomerSchema +}); +var AwsMarketplaceLinkCreateSchema = Type.Object({ + success: Type.Boolean(), + linkingId: Type.String(), + status: Type.Literal("linked") +}); +var AwsMarketplaceLinkListSchema = Type.Object({ + success: Type.Boolean(), + links: Type.Array(AwsMarketplaceLinkSchema) +}); +var AwsMarketplaceLinkFetchSchema = Type.Object({ + success: Type.Boolean(), + link: AwsMarketplaceLinkSchema +}); +var AwsMarketplaceLinkDeleteSchema = Type.Object({ + success: Type.Boolean(), + linkingId: Type.String(), + status: Type.Literal("unlinked") +}); + +// src/commands/aws-marketplace/aws-marketplace-customer.resolve.ts +init_parse_response_helper(); +var AwsMarketplaceCustomerResolveCommand = class extends Command { + /** + * Whether the command should retry on failure. + */ + retryOnFailure = false; + /** + * Get the method. + */ + getMethod() { + return "POST"; + } + /** + * Get the base url. + */ + getBaseUrl() { + return "https://subscription-2.api.flowcore.io"; + } + /** + * Get the path. + */ + getPath() { + return "/api/v1/aws-marketplace/customers/resolve"; + } + /** + * Parse the response. + */ + parseResponse(rawResponse) { + return parseResponseHelper(AwsMarketplaceCustomerResolveSchema, rawResponse); + } +}; + +// src/commands/aws-marketplace/aws-marketplace-link.create.ts +init_command(); +init_parse_response_helper(); +var AwsMarketplaceLinkCreateCommand = class extends Command { + /** + * Whether the command should retry on failure. + */ + retryOnFailure = false; + /** + * The allowed modes for the command. + */ + allowedModes = ["bearer"]; + /** + * Get the method. + */ + getMethod() { + return "POST"; + } + /** + * Get the base url. + */ + getBaseUrl() { + return "https://subscription-2.api.flowcore.io"; + } + /** + * Get the path. + */ + getPath() { + return "/api/v1/aws-marketplace/links"; + } + /** + * Parse the response. + */ + parseResponse(rawResponse) { + return parseResponseHelper(AwsMarketplaceLinkCreateSchema, rawResponse); + } +}; + +// src/commands/aws-marketplace/aws-marketplace-link.delete.ts +init_command(); +init_parse_response_helper(); +var AwsMarketplaceLinkDeleteCommand = class extends Command { + /** + * Whether the command should retry on failure. + */ + retryOnFailure = false; + /** + * The allowed modes for the command. + */ + allowedModes = ["bearer"]; + /** + * Get the method. + */ + getMethod() { + return "DELETE"; + } + /** + * Get the base url. + */ + getBaseUrl() { + return "https://subscription-2.api.flowcore.io"; + } + /** + * Get the path. + */ + getPath() { + const queryParams = new URLSearchParams(); + if (this.input.reason) queryParams.set("reason", this.input.reason); + const query = queryParams.toString(); + return `/api/v1/aws-marketplace/links/${this.input.linkingId}${query ? `?${query}` : ""}`; + } + /** + * Get the body. + */ + getBody() { + return void 0; + } + /** + * Parse the response. + */ + parseResponse(rawResponse) { + return parseResponseHelper(AwsMarketplaceLinkDeleteSchema, rawResponse); + } +}; + +// src/commands/aws-marketplace/aws-marketplace-link.fetch.ts +init_command(); +init_parse_response_helper(); +var AwsMarketplaceLinkFetchCommand = class extends Command { + /** + * Whether the command should retry on failure. + */ + retryOnFailure = false; + /** + * The allowed modes for the command. + */ + allowedModes = ["bearer"]; + /** + * Get the method. + */ + getMethod() { + return "GET"; + } + /** + * Get the base url. + */ + getBaseUrl() { + return "https://subscription-2.api.flowcore.io"; + } + /** + * Get the path. + */ + getPath() { + return `/api/v1/aws-marketplace/links/${this.input.linkingId}`; + } + /** + * Parse the response. + */ + parseResponse(rawResponse) { + return parseResponseHelper(AwsMarketplaceLinkFetchSchema, rawResponse); + } +}; + +// src/commands/aws-marketplace/aws-marketplace-link.list.ts +init_command(); +init_parse_response_helper(); +var AwsMarketplaceLinkListCommand = class extends Command { + /** + * Whether the command should retry on failure. + */ + retryOnFailure = false; + /** + * The allowed modes for the command. + */ + allowedModes = ["bearer"]; + /** + * Get the method. + */ + getMethod() { + return "GET"; + } + /** + * Get the base url. + */ + getBaseUrl() { + return "https://subscription-2.api.flowcore.io"; + } + /** + * Get the path. + */ + getPath() { + const queryParams = new URLSearchParams(); + if (this.input.tenant) queryParams.set("tenant", this.input.tenant); + if (this.input.tenantId) queryParams.set("tenantId", this.input.tenantId); + if (this.input.awsCustomerId) queryParams.set("awsCustomerId", this.input.awsCustomerId); + if (this.input.awsProductCode) queryParams.set("awsProductCode", this.input.awsProductCode); + return `/api/v1/aws-marketplace/links?${queryParams.toString()}`; + } + /** + * Parse the response. + */ + parseResponse(rawResponse) { + return parseResponseHelper(AwsMarketplaceLinkListSchema, rawResponse); + } +}; + +// src/commands/secret/secret.create.ts +init_command(); +init_parse_response_helper(); +var SecretSchema = Type.Object({ + tenantId: Type.String(), + key: Type.String(), + description: Type.String(), + createdAt: Type.String(), + updatedAt: Type.Union([Type.String(), Type.Null()]) +}); + +// src/commands/secret/secret.create.ts +var SecretCreateCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant-store.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/tenants/${this.input.tenantId}/secrets`; + } + /** + * The allowed modes for the command + */ + allowedModes = ["bearer"]; + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(SecretSchema, rawResponse); + } +}; + +// src/commands/secret/secret.delete.ts +init_command(); +var SecretDeleteCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "DELETE"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant-store.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/tenants/${this.input.tenantId}/secrets/${this.input.key}`; + } + /** + * The allowed modes for the command + */ + allowedModes = ["bearer"]; + /** + * Parse the response + */ + parseResponse(_rawResponse) { + return true; + } +}; + +// src/commands/secret/secret.edit.ts +init_command(); +init_parse_response_helper(); +var SecretEditCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "PATCH"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant-store.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/tenants/${this.input.tenantId}/secrets/${this.input.key}`; + } + /** + * The allowed modes for the command + */ + allowedModes = ["bearer"]; + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(SecretSchema, rawResponse); + } +}; + +// src/commands/secret/secret.fetch.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var SecretFetchCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant-store.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/tenants/${this.input.tenantId}/secrets/${this.input.key}`; + } + /** + * The allowed modes for the command + */ + allowedModes = ["bearer"]; + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(SecretSchema, rawResponse); + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("Secret", { tenantId: this.input.tenantId, key: this.input.key }); + } + throw error; + } +}; + +// src/commands/secret/secret.list.ts +init_command(); +init_parse_response_helper(); +var SecretListCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant-store.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/tenants/${this.input.tenantId}/secrets`; + } + /** + * The allowed modes for the command + */ + allowedModes = ["bearer"]; + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(Type.Array(SecretSchema), rawResponse); + } +}; + +// src/commands/service-account/service-account.create.ts +init_command(); +var ServiceAccountSchema = Type.Object({ + id: Type.String(), + tenantId: Type.String(), + name: Type.String(), + description: Type.String(), + linkedUserId: Type.String(), + clientId: Type.String(), + isAdmin: Type.Boolean(), + enabled: Type.Boolean(), + createdAt: Type.String(), + updatedAt: Type.Union([Type.String(), Type.Null()]), + lastRotatedAt: Type.Union([Type.String(), Type.Null()]) +}); +var ServiceAccountWithSecretSchema = Type.Object({ + id: Type.String(), + tenantId: Type.String(), + name: Type.String(), + description: Type.String(), + linkedUserId: Type.String(), + clientId: Type.String(), + isAdmin: Type.Boolean(), + enabled: Type.Boolean(), + createdAt: Type.String(), + updatedAt: Type.Union([Type.String(), Type.Null()]), + lastRotatedAt: Type.Union([Type.String(), Type.Null()]), + clientSecret: Type.String() +}); +var ServiceAccountSecretRotationSchema = Type.Object({ + id: Type.String(), + clientId: Type.String(), + clientSecret: Type.String() +}); + +// src/commands/service-account/service-account.create.ts +init_parse_response_helper(); +var ServiceAccountCreateCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant-store.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return "/api/v1/service-accounts"; + } + /** + * The allowed modes for the command + */ + allowedModes = ["bearer"]; + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(ServiceAccountWithSecretSchema, rawResponse); + } +}; + +// src/commands/service-account/service-account.delete.ts +init_command(); +var ServiceAccountDeleteCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "DELETE"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant-store.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/service-accounts/${this.input.serviceAccountId}`; + } + /** + * Get the body + */ + getBody() { + return void 0; + } + /** + * The allowed modes for the command + */ + allowedModes = ["bearer"]; + /** + * Parse the response + */ + parseResponse() { + return true; + } +}; + +// src/commands/service-account/service-account.edit.ts +init_command(); +init_parse_response_helper(); +var ServiceAccountEditCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "PATCH"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant-store.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/service-accounts/${this.input.serviceAccountId}`; + } + /** + * Get the body + */ + getBody() { + return { + ...this.input.description !== void 0 ? { description: this.input.description } : {}, + ...this.input.enabled !== void 0 ? { enabled: this.input.enabled } : {} + }; + } + /** + * The allowed modes for the command + */ + allowedModes = ["bearer"]; + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(ServiceAccountSchema, rawResponse); + } +}; + +// src/commands/service-account/service-account.fetch.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var ServiceAccountFetchCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant-store.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/service-accounts/${this.input.serviceAccountId}`; + } + /** + * The allowed modes for the command + */ + allowedModes = ["bearer"]; + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(ServiceAccountSchema, rawResponse); + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("ServiceAccount", { id: this.input.serviceAccountId }); + } + throw error; + } +}; + +// src/commands/service-account/service-account.list.ts +init_command(); +init_parse_response_helper(); +var ServiceAccountListCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant-store.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + const queryParams = new URLSearchParams({ + tenantId: this.input.tenantId + }); + return `/api/v1/service-accounts?${queryParams.toString()}`; + } + /** + * The allowed modes for the command + */ + allowedModes = ["bearer"]; + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(Type.Array(ServiceAccountSchema), rawResponse); + } +}; + +// src/commands/service-account/service-account.rotate-secret.ts +init_command(); +init_parse_response_helper(); +var ServiceAccountRotateSecretCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant-store.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/service-accounts/${this.input.serviceAccountId}/rotate-secret`; + } + /** + * Get the body + */ + getBody() { + return void 0; + } + /** + * The allowed modes for the command + */ + allowedModes = ["bearer"]; + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(ServiceAccountSecretRotationSchema, rawResponse); + } +}; + +// src/commands/variable/variable.create.ts +init_command(); +init_parse_response_helper(); +var VariableSchema = Type.Object({ + tenantId: Type.String(), + key: Type.String(), + description: Type.String(), + value: Type.String(), + createdAt: Type.String(), + updatedAt: Type.Union([Type.String(), Type.Null()]) +}); + +// src/commands/variable/variable.create.ts +var VariableCreateCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant-store.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/tenants/${this.input.tenantId}/variables`; + } + /** + * The allowed modes for the command + */ + allowedModes = ["bearer"]; + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(VariableSchema, rawResponse); + } +}; + +// src/commands/variable/variable.delete.ts +init_command(); +var VariableDeleteCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "DELETE"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant-store.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/tenants/${this.input.tenantId}/variables/${this.input.key}`; + } + /** + * The allowed modes for the command + */ + allowedModes = ["bearer"]; + /** + * Parse the response + */ + parseResponse() { + return true; + } +}; + +// src/commands/variable/variable.edit.ts +init_command(); +init_parse_response_helper(); +var VariableEditCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "PATCH"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant-store.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/tenants/${this.input.tenantId}/variables/${this.input.key}`; + } + /** + * The allowed modes for the command + */ + allowedModes = ["bearer"]; + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(VariableSchema, rawResponse); + } +}; + +// src/commands/variable/variable.fetch.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var VariableFetchCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant-store.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/tenants/${this.input.tenantId}/variables/${this.input.key}`; + } + /** + * The allowed modes for the command + */ + allowedModes = ["bearer"]; + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(VariableSchema, rawResponse); + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("Variable", { tenantId: this.input.tenantId, key: this.input.key }); + } + throw error; + } +}; + +// src/commands/variable/variable.list.ts +init_command(); +init_parse_response_helper(); +var VariableListCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://tenant-store.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/tenants/${this.input.tenantId}/variables`; + } + /** + * The allowed modes for the command + */ + allowedModes = ["bearer"]; + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(Type.Array(VariableSchema), rawResponse); + } +}; + +// src/commands/data-core/data-core.create.ts +init_command(); +var DataCoreSchema = Type.Object({ + /** Unique identifier for the data core */ + id: Type.String(), + /** ID of the tenant that owns this data core */ + tenantId: Type.String(), + /** Name of the tenant that owns this data core */ + tenant: Type.String(), + /** Name of the data core */ + name: Type.String(), + /** Description of the data core's purpose and contents */ + description: Type.String(), + /** Access control setting - determines if the data core is public or private */ + accessControl: Type.Union([Type.Literal("public"), Type.Literal("private")]), + /** Protection against accidental deletion */ + deleteProtection: Type.Boolean(), + /** Indicates if the data core is currently being deleted */ + isDeleting: Type.Boolean(), + /** Indicates if the data core is managed by Flowcore platform */ + isFlowcoreManaged: Type.Boolean() +}); +var DataCoreWithAccessSchema = Type.Object({ + ...DataCoreSchema.properties, + access: Type.Array( + Type.Union([Type.Literal("read"), Type.Literal("write"), Type.Literal("fetch"), Type.Literal("ingest")]) + ) +}); + +// src/commands/data-core/data-core.create.ts +init_parse_response_helper(); +var DataCoreCreateCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://data-core-2.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/data-cores`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(DataCoreSchema, rawResponse); + } +}; + +// src/commands/data-core/data-core.exists.ts +init_command(); +init_parse_response_helper(); +var DataCoreExistsCommand = class extends Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://data-core-2.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/data-cores/${this.input.dataCoreId}/exists`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = parseResponseHelper(Type.Object({ exists: Type.Boolean() }), rawResponse); + return response; + } +}; + +// src/commands/data-core/data-core.fetch.ts +init_command(); +init_parse_response_helper(); +init_not_found(); +function isDataCoreFetchByIdInput(input) { + return "dataCoreId" in input; +} +function isDataCoreFetchByNameAndTenantIdInput(input) { + return "tenantId" in input; +} +function isDataCoreFetchByNameAndTenantInput(input) { + return "tenant" in input; +} +var DataCoreFetchCommand = class extends Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://data-core-2.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + if (isDataCoreFetchByIdInput(this.input)) { + return `/api/v1/data-cores/${this.input.dataCoreId}`; + } + const queryParams = new URLSearchParams(); + if (isDataCoreFetchByNameAndTenantIdInput(this.input)) { + queryParams.set("tenantId", this.input.tenantId); + } + if (isDataCoreFetchByNameAndTenantInput(this.input)) { + queryParams.set("tenant", this.input.tenant); + } + queryParams.set("name", this.input.dataCore); + return `/api/v1/data-cores?${queryParams.toString()}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + if (isDataCoreFetchByIdInput(this.input)) { + const response2 = parseResponseHelper(DataCoreSchema, rawResponse); + return response2; + } + const response = parseResponseHelper(Type.Array(DataCoreSchema), rawResponse); + if (response.length === 0) { + if (isDataCoreFetchByNameAndTenantIdInput(this.input)) { + throw new NotFoundException("DataCore", { name: this.input.dataCore, tenantId: this.input.tenantId }); + } else { + throw new NotFoundException("DataCore", { name: this.input.dataCore, tenant: this.input.tenant }); + } + } + return response[0]; + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + if (isDataCoreFetchByIdInput(this.input)) { + throw new NotFoundException("DataCore", { id: this.input.dataCoreId }); + } else if (isDataCoreFetchByNameAndTenantIdInput(this.input)) { + throw new NotFoundException("DataCore", { name: this.input.dataCore, tenantId: this.input.tenantId }); + } else { + throw new NotFoundException("DataCore", { name: this.input.dataCore, tenant: this.input.tenant }); + } + } + throw error; + } +}; + +// src/commands/data-core/data-core.list.ts +init_command(); +init_parse_response_helper(); +var responseSchema6 = Type.Object({ + ...DataCoreWithAccessSchema.properties, + access: Type.Array(Type.String()) +}); +var DataCoreListCommand = class extends Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://data-core-2.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + const queryParams = new URLSearchParams(); + if (this.input.tenantId) { + queryParams.set("tenantId", this.input.tenantId); + } + if (this.input.tenant) { + queryParams.set("tenant", this.input.tenant); + } + if (this.input.name) { + queryParams.set("name", this.input.name); + } + if (this.input.page !== void 0) { + queryParams.set("page", this.input.page.toString()); + } + if (this.input.limit !== void 0) { + queryParams.set("limit", this.input.limit.toString()); + } + if (this.input.ids !== void 0) { + const ids = Array.isArray(this.input.ids) ? this.input.ids.join(",") : this.input.ids; + queryParams.set("ids", ids); + } + const qs = queryParams.toString(); + return qs ? `/api/v1/data-cores?${qs}` : "/api/v1/data-cores"; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(Type.Array(responseSchema6), rawResponse); + } +}; + +// src/commands/data-core/data-core.request-delete.ts +init_command(); +init_parse_response_helper(); +init_not_found(); +var DataCoreRequestDeleteCommand = class extends Command { + /** + * The dedicated subdomain for the command + */ + dedicatedSubdomain = "delete-manager"; + /** + * Get the method + */ + getMethod() { + return "DELETE"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://delete-manager.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/data-cores/${this.input.dataCoreId}/request-delete`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = parseResponseHelper( + Type.Object({ + success: Type.Boolean() + }), + rawResponse + ); + return response; + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("DataCore", { + "id": this.input.dataCoreId + }); + } + throw error; + } + /** + * Wait for the response (timeout: 25 seconds) + */ + async processResponse(client, response) { + if (!this.input.waitForDelete) { + return response; + } + const start = Date.now(); + while (Date.now() - start < 25e3) { + const response2 = await client.execute( + new DataCoreExistsCommand({ + dataCoreId: this.input.dataCoreId + }) + ); + if (!response2.exists) { + break; + } + await new Promise((resolve) => setTimeout(resolve, 100)); + } + return response; + } +}; + +// src/commands/data-core/data-core.update.ts +init_command(); +init_parse_response_helper(); +init_command_error(); +var DataCoreUpdateCommand = class extends Command { + /** + * Get the method + */ + getMethod() { + return "PATCH"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://data-core-2.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/data-cores/${this.input.dataCoreId}`; + } + /** + * Get the body for the request + */ + getBody() { + const { dataCoreId: _dataCoreId, ...payload } = this.input; + if (Object.keys(payload).length === 0) { + throw new CommandError(this.constructor.name, "No fields to update"); + } + return payload; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(DataCoreSchema, rawResponse); + } +}; + +// src/commands/flow-type/flow-type.create.ts +init_command(); +var FlowTypeSchema = Type.Object({ + id: Type.String(), + tenantId: Type.String(), + dataCoreId: Type.String(), + name: Type.String(), + description: Type.String(), + isDeleting: Type.Boolean() +}); + +// src/commands/flow-type/flow-type.create.ts +init_parse_response_helper(); +var FlowTypeCreateCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://flow-type-2.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/flow-types`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(FlowTypeSchema, rawResponse); + } +}; + +// src/commands/flow-type/flow-type.exists.ts +init_command(); +init_parse_response_helper(); +var FlowTypeExistsCommand = class extends Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://flow-type-2.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/flow-types/${this.input.flowTypeId}/exists`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = parseResponseHelper(Type.Object({ exists: Type.Boolean() }), rawResponse); + return response; + } +}; + +// src/commands/flow-type/flow-type.fetch.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var FlowTypeFetchCommand = class extends Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://flow-type-2.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + if ("flowTypeId" in this.input) { + return `/api/v1/flow-types/${this.input.flowTypeId}`; + } + const queryParams = new URLSearchParams(); + queryParams.set("dataCoreId", this.input.dataCoreId); + queryParams.set("name", this.input.flowType); + return `/api/v1/flow-types?${queryParams.toString()}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + if ("flowTypeId" in this.input) { + const response2 = parseResponseHelper(FlowTypeSchema, rawResponse); + return response2; + } + const response = parseResponseHelper(Type.Array(FlowTypeSchema), rawResponse); + if (response.length === 0) { + throw new NotFoundException("FlowType", { name: this.input.flowType }); + } + return response[0]; + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("FlowType", { + [this.input.flowTypeId ? "id" : "name"]: this.input.flowTypeId ?? this.input.flowType + }); + } + throw error; + } +}; + +// src/commands/flow-type/flow-type.list.ts +init_command(); +init_parse_response_helper(); +var FlowTypeListCommand = class extends Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://flow-type-2.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + const queryParams = new URLSearchParams(); + queryParams.set("dataCoreId", this.input.dataCoreId); + return `/api/v1/flow-types?${queryParams.toString()}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = parseResponseHelper(Type.Array(FlowTypeSchema), rawResponse); + return response; + } +}; + +// src/commands/flow-type/flow-type.request-delete.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var FlowTypeRequestDeleteCommand = class extends Command { + /** + * The dedicated subdomain for the command + */ + dedicatedSubdomain = "delete-manager"; + /** + * Get the method + */ + getMethod() { + return "DELETE"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://delete-manager.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/flow-types/${this.input.flowTypeId}/request-delete`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = parseResponseHelper( + Type.Object({ + success: Type.Boolean() + }), + rawResponse + ); + return response; + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("FlowType", { + "id": this.input.flowTypeId + }); + } + throw error; + } + /** + * Wait for the response (timeout: 25 seconds) + */ + async processResponse(client, response) { + if (!this.input.waitForDelete) { + return response; + } + const start = Date.now(); + while (Date.now() - start < 25e3) { + const response2 = await client.execute( + new FlowTypeExistsCommand({ + flowTypeId: this.input.flowTypeId + }) + ); + if (!response2.exists) { + break; + } + await new Promise((resolve) => setTimeout(resolve, 100)); + } + return response; + } +}; + +// src/commands/flow-type/flow-type.update.ts +init_command(); +init_parse_response_helper(); +var FlowTypeUpdateCommand = class extends Command { + /** + * Get the method + */ + getMethod() { + return "PATCH"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://flow-type-2.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/flow-types/${this.input.flowTypeId}`; + } + /** + * Get the body for the request + */ + getBody() { + const { flowTypeId: _flowTypeId, ...payload } = this.input; + return payload; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(FlowTypeSchema, rawResponse); + } +}; + +// src/commands/event-type/event-type.create.ts +init_command(); +var DetailedSensitiveDataFieldSchema = Type.Object({ + type: Type.Union([ + Type.Literal("string"), + Type.Literal("number"), + Type.Literal("boolean"), + Type.Literal("object"), + Type.Literal("array") + ]), + faker: Type.Optional(Type.String()), + args: Type.Optional(Type.Array(Type.Unknown())), + length: Type.Optional(Type.Number()), + pattern: Type.Optional(Type.String()), + redact: Type.Optional( + Type.Object({ + char: Type.String({ minLength: 1, maxLength: 1 }), + length: Type.Number({ minimum: 1 }) + }) + ), + min: Type.Optional(Type.Number()), + max: Type.Optional(Type.Number()), + precision: Type.Optional(Type.Number()), + count: Type.Optional(Type.Number()), + items: Type.Optional(Type.Unknown()), + properties: Type.Optional( + Type.Record( + Type.String(), + Type.Unknown() + ) + ) +}); +var SensitiveDataDefinitionSchema = Type.Union([ + Type.Literal(true), + Type.Union([Type.Literal("string"), Type.Literal("number"), Type.Literal("boolean")]), + DetailedSensitiveDataFieldSchema, + Type.Record(Type.String(), Type.Unknown()) +]); +var EventTypeSensitiveDataMaskSchema = Type.Object({ + key: Type.String(), + schema: Type.Record(Type.String(), SensitiveDataDefinitionSchema) +}); +Type.Array( + Type.Object({ + path: Type.String(), + definition: Type.Object({ + type: Type.Union([ + Type.Literal("string"), + Type.Literal("number"), + Type.Literal("boolean"), + Type.Literal("object"), + Type.Literal("array") + ]), + faker: Type.Optional(Type.String()), + args: Type.Array(Type.Unknown()), + length: Type.Optional(Type.Number()), + pattern: Type.Optional(Type.String()), + min: Type.Optional(Type.Number()), + max: Type.Optional(Type.Number()), + precision: Type.Optional(Type.Number()), + count: Type.Optional(Type.Number()), + items: Type.Optional(Type.Unknown()), + properties: Type.Optional(Type.Record(Type.String(), Type.Unknown())), + redact: Type.Optional( + Type.Object({ + char: Type.String(), + length: Type.Number() + }) + ) + }) + }) +); +var EventTypeSchema = Type.Object({ + /** Unique identifier for the event type */ + id: Type.String(), + /** ID of the tenant that owns this event type */ + tenantId: Type.String(), + /** ID of the data core this event type belongs to */ + dataCoreId: Type.String(), + /** ID of the flow type this event type belongs to */ + flowTypeId: Type.String(), + /** Name of the event type */ + name: Type.String(), + /** Description of the event type */ + description: Type.String(), + /** Indicates if the event type is currently being truncated */ + isTruncating: Type.Boolean(), + /** Indicates if the event type is currently being deleted */ + isDeleting: Type.Boolean(), + /** Creation timestamp */ + createdAt: Type.String(), + /** Last update timestamp */ + updatedAt: Type.Union([Type.String(), Type.Null()]), + /** SensitiveData mask configuration */ + sensitiveDataMask: Type.Optional(Type.Union([EventTypeSensitiveDataMaskSchema, Type.Null()])), + /** Indicates if SensitiveData handling is enabled */ + sensitiveDataEnabled: Type.Optional(Type.Boolean()) +}); +Type.Object({ + id: Type.String(), + tenantId: Type.String(), + dataCoreId: Type.String(), + flowTypeId: Type.String(), + eventTypeId: Type.String(), + parentKey: Type.String(), + key: Type.String(), + type: Type.String(), + application: Type.String(), + createdAt: Type.String() +}); +var EventTypeRemoveSensitiveDataSchema = Type.Object({ + success: Type.Boolean(), + id: Type.String() +}); +var EventTypeListRemovedSensitiveDataItemSchema = Type.Object({ + id: Type.String(), + tenantId: Type.String(), + dataCoreId: Type.String(), + flowTypeId: Type.String(), + eventTypeId: Type.String(), + application: Type.String(), + parentKey: Type.String(), + key: Type.String(), + type: Type.String(), + createdAt: Type.String() +}); +var EventTypeListRemovedSensitiveDataResponseSchema = Type.Object({ + data: Type.Array(EventTypeListRemovedSensitiveDataItemSchema), + pagination: Type.Object({ + page: Type.Number(), + pageSize: Type.Number(), + hasNextPage: Type.Boolean(), + hasPreviousPage: Type.Boolean() + }) +}); + +// src/commands/event-type/event-type.create.ts +init_parse_response_helper(); +var EventTypeCreateCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://event-type-2.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/event-types`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(EventTypeSchema, rawResponse); + } +}; + +// src/commands/event-type/event-type.exists.ts +init_command(); +init_parse_response_helper(); +var EventTypeExistsCommand = class extends Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://event-type-2.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/event-types/${this.input.eventTypeId}/exists`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = parseResponseHelper(Type.Object({ exists: Type.Boolean() }), rawResponse); + return response; + } +}; + +// src/commands/event-type/event-type.fetch.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var EventTypeFetchCommand = class extends Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://event-type-2.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + if ("eventTypeId" in this.input) { + return `/api/v1/event-types/${this.input.eventTypeId}`; + } + const queryParams = new URLSearchParams(); + queryParams.set("flowTypeId", this.input.flowTypeId); + queryParams.set("name", this.input.eventType); + return `/api/v1/event-types?${queryParams.toString()}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + if ("eventTypeId" in this.input) { + const response2 = parseResponseHelper(EventTypeSchema, rawResponse); + return response2; + } + const response = parseResponseHelper(Type.Array(EventTypeSchema), rawResponse); + if (response.length === 0) { + throw new NotFoundException("EventType", { name: this.input.eventType }); + } + return response[0]; + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("EventType", { + [this.input.eventTypeId ? "id" : "name"]: this.input.eventTypeId ?? this.input.eventType + }); + } + throw error; + } +}; + +// src/commands/events/event.list.ts +init_command(); +init_parse_response_helper(); +var FlowcoreEventSchema = Type.Object({ + eventId: Type.String(), + timeBucket: Type.String(), + tenant: Type.String(), + dataCoreId: Type.String(), + flowType: Type.String(), + eventType: Type.String(), + metadata: Type.Record(Type.String(), Type.Unknown()), + payload: Type.Record(Type.String(), Type.Unknown()), + validTime: Type.String() +}); + +// src/commands/events/event.list.ts +var responseSchema7 = Type.Object({ + events: Type.Array(FlowcoreEventSchema), + nextCursor: Type.Optional(Type.String()) +}); +var EventListCommand = class extends Command { + /** + * The dedicated subdomain for the command + */ + dedicatedSubdomain = "event-source"; + /** + * Get the method for the request + */ + getMethod() { + return "GET"; + } + /** + * Get the base url for the request + */ + getBaseUrl() { + return "https://event-source.api.flowcore.io"; + } + /** + * Get the path for the request + */ + getPath() { + const query = new URLSearchParams(); + const eventTypeIds = Array.isArray(this.input.eventTypeId) ? this.input.eventTypeId : [this.input.eventTypeId]; + for (const eventTypeId of eventTypeIds) { + query.append("eventTypeId", eventTypeId); + } + query.set("timeBucket", this.input.timeBucket); + this.input.cursor && query.set("cursor", this.input.cursor.toString()); + this.input.pageSize && query.set("pageSize", this.input.pageSize.toString()); + this.input.fromEventId && query.set("fromEventId", this.input.fromEventId); + this.input.afterEventId && query.set("afterEventId", this.input.afterEventId); + this.input.toEventId && query.set("toEventId", this.input.toEventId); + this.input.order && query.set("order", this.input.order); + this.input.includeSensitiveData && query.set("includeSensitiveData", this.input.includeSensitiveData.toString()); + return `/api/v1/events?${query.toString()}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = parseResponseHelper(responseSchema7, rawResponse); + return response; + } +}; + +// src/commands/events/time-bucket.list.ts +init_command(); +init_parse_response_helper(); +var responseSchema8 = Type.Object({ + timeBuckets: Type.Array(Type.String()), + nextCursor: Type.Optional(Type.Number()) +}); +var TimeBucketListCommand = class extends Command { + /** + * The dedicated subdomain for the command + */ + dedicatedSubdomain = "event-source"; + /** + * Get the method for the request + */ + getMethod() { + return "GET"; + } + /** + * Get the base url for the request + */ + getBaseUrl() { + return "https://event-source.api.flowcore.io"; + } + /** + * Get the path for the request + */ + getPath() { + const queryParams = new URLSearchParams(); + const eventTypeIds = Array.isArray(this.input.eventTypeId) ? this.input.eventTypeId : [this.input.eventTypeId]; + for (const eventTypeId of eventTypeIds) { + queryParams.append("eventTypeId", eventTypeId); + } + this.input.fromTimeBucket && queryParams.set("fromTimeBucket", this.input.fromTimeBucket); + this.input.toTimeBucket && queryParams.set("toTimeBucket", this.input.toTimeBucket); + this.input.order && queryParams.set("order", this.input.order); + this.input.pageSize && queryParams.set("pageSize", this.input.pageSize.toString()); + this.input.cursor && queryParams.set("cursor", this.input.cursor.toString()); + return `/api/v1/time-buckets?${queryParams.toString()}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = parseResponseHelper(responseSchema8, rawResponse); + return response; + } +}; + +// src/commands/event-type/event-type.info.ts +var EventTypeInfoCommand = class extends CustomCommand { + /** + * Custom execute method + */ + async customExecute(client) { + const lastEventsLimit = this.input.limit ?? 5; + const firstTimeBucketCommand = new TimeBucketListCommand({ + tenant: this.input.tenant, + eventTypeId: this.input.eventTypeId, + order: "asc", + pageSize: 1 + }); + const lastTimeBucketCommand = new TimeBucketListCommand({ + tenant: this.input.tenant, + eventTypeId: this.input.eventTypeId, + order: "desc", + pageSize: Math.max(lastEventsLimit, 100) + }); + const [firstTimeBucketResponse, lastTimeBucketResponse] = await Promise.all([ + client.execute(firstTimeBucketCommand), + client.execute(lastTimeBucketCommand) + ]); + const firstTimeBucket = firstTimeBucketResponse.timeBuckets[0]; + const lastTimeBucket = lastTimeBucketResponse.timeBuckets[0]; + if (!firstTimeBucket || !lastTimeBucket) { + return { + firstTimeBucket: void 0, + lastTimeBucket: void 0, + lastEvents: [] + }; + } + const lastEvents = []; + const minLastEventLimit = Math.max(lastEventsLimit, lastEventsLimit * 3); + for (const timeBucket of lastTimeBucketResponse.timeBuckets) { + let cursor; + do { + const eventListResponse = await client.execute( + new EventListCommand({ + eventTypeId: this.input.eventTypeId, + timeBucket, + pageSize: minLastEventLimit - lastEvents.length, + order: "desc", + tenant: this.input.tenant, + ...cursor && { cursor }, + ...this.input.includeSensitiveData && { includeSensitiveData: true } + }) + ); + lastEvents.push(...eventListResponse.events); + cursor = eventListResponse.nextCursor; + } while (cursor && lastEvents.length < lastEventsLimit); + if (lastEvents.length >= lastEventsLimit) { + break; + } + } + if (lastEvents.length > lastEventsLimit) { + lastEvents.length = lastEventsLimit; + } + return { + firstTimeBucket, + lastTimeBucket, + lastEvents + }; + } +}; + +// src/commands/event-type/event-type.list-removed-sensitive-data.ts +init_command(); +init_parse_response_helper(); +var EventTypeListRemovedSensitiveDataCommand = class extends Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://event-type-2.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + const queryParams = new URLSearchParams(); + this.input.dataCoreId && queryParams.set("dataCoreId", this.input.dataCoreId); + this.input.flowTypeId && queryParams.set("flowTypeId", this.input.flowTypeId); + this.input.eventTypeId && queryParams.set("eventTypeId", this.input.eventTypeId); + this.input.parentKey && queryParams.set("parentKey", this.input.parentKey); + this.input.application && queryParams.set("application", this.input.application); + this.input.page && queryParams.set("page", this.input.page.toString()); + this.input.pageSize && queryParams.set("pageSize", this.input.pageSize.toString()); + this.input.type && queryParams.set("type", this.input.type); + this.input.sort && queryParams.set("sort", this.input.sort); + this.input.createdAtFrom && queryParams.set("createdAtFrom", this.input.createdAtFrom); + this.input.createdAtTo && queryParams.set("createdAtTo", this.input.createdAtTo); + return `/api/v1/event-types/sensitive-data/${this.input.tenantId}?${queryParams.toString()}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(EventTypeListRemovedSensitiveDataResponseSchema, rawResponse); + } +}; + +// src/commands/event-type/event-type.list.ts +init_command(); +init_parse_response_helper(); +var EventTypeListCommand = class extends Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://event-type-2.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + const queryParams = new URLSearchParams(); + queryParams.set("flowTypeId", this.input.flowTypeId); + return `/api/v1/event-types?${queryParams.toString()}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = parseResponseHelper(Type.Array(EventTypeSchema), rawResponse); + return response; + } +}; + +// src/commands/event-type/event-type.remove-sensitive-data.ts +init_command(); +init_parse_response_helper(); +var EventTypeRemoveSensitiveDataCommand = class extends Command { + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://event-type-2.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/event-types/sensitive-data/remove`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(EventTypeRemoveSensitiveDataSchema, rawResponse); + } +}; + +// src/commands/event-type/event-type.request-delete.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var EventTypeRequestDeleteCommand = class extends Command { + /** + * The dedicated subdomain for the command + */ + dedicatedSubdomain = "delete-manager"; + /** + * Get the method + */ + getMethod() { + return "DELETE"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://delete-manager.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/event-types/${this.input.eventTypeId}/request-delete`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = parseResponseHelper( + Type.Object({ + success: Type.Boolean() + }), + rawResponse + ); + return response; + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("EventType", { + [this.input.eventTypeId ? "id" : "name"]: this.input.eventTypeId ?? this.input.eventTypeId + }); + } + throw error; + } + /** + * Wait for the response (timeout: 25 seconds) + */ + async processResponse(client, response) { + if (!this.input.waitForDelete) { + return response; + } + const start = Date.now(); + while (Date.now() - start < 25e3) { + const response2 = await client.execute( + new EventTypeExistsCommand({ + eventTypeId: this.input.eventTypeId + }) + ); + if (!response2.exists) { + break; + } + await new Promise((resolve) => setTimeout(resolve, 100)); + } + return response; + } +}; + +// src/commands/event-type/event-type.request-truncate.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var EventTypeRequestTruncateCommand = class extends Command { + /** + * The dedicated subdomain for the command + */ + dedicatedSubdomain = "delete-manager"; + /** + * Get the method + */ + getMethod() { + return "DELETE"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://delete-manager.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/event-types/${this.input.eventTypeId}/request-truncate`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = parseResponseHelper( + Type.Object({ + success: Type.Boolean() + }), + rawResponse + ); + return response; + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("EventType", { + [this.input.eventTypeId ? "id" : "name"]: this.input.eventTypeId ?? this.input.eventTypeId + }); + } + throw error; + } + /** + * Wait for the response (timeout: 25 seconds) + */ + async processResponse(client, response) { + if (!this.input.waitForTruncate) { + return response; + } + await new Promise((resolve) => setTimeout(resolve, 1e3)); + const start = Date.now(); + while (Date.now() - start < 25e3) { + const response2 = await client.execute( + new EventTypeFetchCommand({ + eventTypeId: this.input.eventTypeId + }) + ); + if (response2.isTruncating) { + break; + } + await new Promise((resolve) => setTimeout(resolve, 100)); + } + return response; + } +}; + +// src/commands/event-type/event-type.update.ts +init_command(); +init_parse_response_helper(); +var EventTypeUpdateCommand = class extends Command { + /** + * Get the method + */ + getMethod() { + return "PATCH"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://event-type-2.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/event-types/${this.input.eventTypeId}`; + } + /** + * Get the body for the request + */ + getBody() { + const { eventTypeId: _, ...payload } = this.input; + return payload; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(EventTypeSchema, rawResponse); + } +}; + +// src/commands/ingestion/ingest.batch.ts +init_command(); +init_parse_response_helper(); +var responseSchema9 = Type.Object({ + eventIds: Type.Array(Type.String()), + success: Type.Boolean() +}); +var IngestBatchCommand = class extends Command { + /** + * The dedicated subdomain for the command + */ + dedicatedSubdomain = "webhook"; + allowedModes = ["apiKey"]; + getMethod() { + return "POST"; + } + /** + * Get the base url for the request + */ + getBaseUrl() { + if (this.input.tenantName === "flowcore") { + return "https://flowcore.webhook.flowcore.io"; + } + return "https://webhook.api.flowcore.io"; + } + getHeaders() { + const metadata = this.input.metadata && Object.keys(this.input.metadata).length > 0 ? this.input.metadata : void 0; + if (metadata && this.input.ttl) { + metadata["ttl-on/stored-event"] = "true"; + } + if (metadata && this.input.isEphemeral) { + metadata["do-not-archive-on/stored-event"] = "true"; + } + const authHeader = this.clientAuthOptions.apiKey || null; + return { + "Content-Type": "application/json", + ...this.input.flowcoreManaged && { "X-Flowcore-Managed": "true" }, + ...metadata && { "x-flowcore-metadata-json": btoa(JSON.stringify(metadata)) }, + ...this.input.eventTime && { "x-flowcore-event-time": this.input.eventTime }, + ...this.input.validTime && { "x-flowcore-valid-time": this.input.validTime }, + ...authHeader && { "Authorization": authHeader } + }; + } + /** + * Get the path for the request + */ + getPath() { + return `/events/${this.input.tenantName}/${this.input.dataCoreId}/${this.input.flowTypeName}/${this.input.eventTypeName}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = parseResponseHelper(responseSchema9, rawResponse); + return response; + } + /** + * Get the body for the request + */ + getBody() { + return this.input.events; + } +}; + +// src/commands/ingestion/ingest.event.ts +init_command(); +init_parse_response_helper(); +var responseSchema10 = Type.Object({ + eventId: Type.String(), + success: Type.Boolean() +}); +var IngestEventCommand = class extends Command { + /** + * The dedicated subdomain for the command + */ + dedicatedSubdomain = "webhook"; + allowedModes = ["apiKey"]; + getMethod() { + return "POST"; + } + /** + * Get the base url for the request + */ + getBaseUrl() { + if (this.input.tenantName === "flowcore") { + return "https://flowcore.webhook.flowcore.io"; + } + return "https://webhook.api.flowcore.io"; + } + getHeaders() { + const metadata = this.input.metadata && Object.keys(this.input.metadata).length > 0 ? this.input.metadata : void 0; + if (metadata && this.input.ttl) { + metadata["ttl-on/stored-event"] = "true"; + } + if (metadata && this.input.isEphemeral) { + metadata["do-not-archive-on/stored-event"] = "true"; + } + const authHeader = this.clientAuthOptions.apiKey || null; + return { + "Content-Type": "application/json", + ...this.input.flowcoreManaged && { "X-Flowcore-Managed": "true" }, + ...metadata && { "x-flowcore-metadata-json": btoa(JSON.stringify(metadata)) }, + ...this.input.eventTime && { "x-flowcore-event-time": this.input.eventTime }, + ...this.input.validTime && { "x-flowcore-valid-time": this.input.validTime }, + ...authHeader && { "Authorization": authHeader } + }; + } + /** + * Get the path for the request + */ + getPath() { + return `/event/${this.input.tenantName}/${this.input.dataCoreId}/${this.input.flowTypeName}/${this.input.eventTypeName}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = parseResponseHelper(responseSchema10, rawResponse); + return response; + } + /** + * Get the body for the request + */ + getBody() { + return this.input.eventData; + } +}; + +// src/commands/events/events.fetch-time-buckets-by-names.ts +init_command(); +init_parse_response_helper(); +var responseSchema11 = Type.Object({ + timeBuckets: Type.Array(Type.String()), + nextCursor: Type.Optional(Type.Number()) +}); +var EventsFetchTimeBucketsByNamesCommand = class extends Command { + /** + * The dedicated subdomain for the command + */ + dedicatedSubdomain = "event-source"; + /** + * Get the base url for the request + */ + getBaseUrl() { + return "https://event-source.api.flowcore.io"; + } + /** + * Get the path for the request + */ + getPath() { + return "/api/v1/time-buckets/by-names"; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = parseResponseHelper(responseSchema11, rawResponse); + return response; + } + /** + * Get the body for the request + */ + getBody() { + const { ...rest } = this.input; + return rest; + } +}; + +// src/commands/events/events.fetch.ts +init_command(); +init_parse_response_helper(); +var responseSchema12 = Type.Object({ + events: Type.Array(FlowcoreEventSchema), + nextCursor: Type.Optional(Type.String()) +}); +var EventsFetchCommand = class extends Command { + /** + * The dedicated subdomain for the command + */ + dedicatedSubdomain = "event-source"; + /** + * Get the base url for the request + */ + getBaseUrl() { + return "https://event-source.api.flowcore.io"; + } + /** + * Get the path for the request + */ + getPath() { + const query = { + ...this.input.cursor ? { cursor: this.input.cursor.toString() } : {}, + ...this.input.pageSize ? { pageSize: this.input.pageSize.toString() } : {}, + ...this.input.fromEventId ? { fromEventId: this.input.fromEventId } : {}, + ...this.input.afterEventId ? { afterEventId: this.input.afterEventId } : {}, + ...this.input.toEventId ? { toEventId: this.input.toEventId } : {}, + ...this.input.includeSensitiveData ? { includeSensitiveData: this.input.includeSensitiveData.toString() } : {} + }; + return `/api/v1/events?${new URLSearchParams(query).toString()}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = parseResponseHelper(responseSchema12, rawResponse); + return response; + } + /** + * Get the body for the request + */ + getBody() { + return { + tenant: this.input.tenant, + dataCoreId: this.input.dataCoreId, + flowType: this.input.flowType, + eventTypes: this.input.eventTypes, + timeBucket: this.input.timeBucket + }; + } +}; + +// src/commands/container-registry/container-registry.create.ts +init_command(); +var ContainerRegistrySchema = Type.Object({ + tenantId: Type.String(), + name: Type.String(), + description: Type.Optional(Type.String()), + username: Type.Optional(Type.String()), + id: Type.String() +}); +var ContainerRegistryCreateSchema = Type.Object({ + id: Type.String() +}); +var ContainerRegistryDeleteSchema = Type.Object({ + status: Type.Number() +}); +var ContainerRegistryListSchema = Type.Array(ContainerRegistrySchema); + +// src/commands/container-registry/container-registry.create.ts +init_parse_response_helper(); +var ContainerRegistryCreateCommand = class extends Command { + /** + * GET the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://registry.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/container`; + } + /** + * Parse the response + */ + parseResponse(response) { + return parseResponseHelper(ContainerRegistryCreateSchema, response); + } +}; + +// src/commands/container-registry/container-registry.delete.ts +init_command(); +init_parse_response_helper(); +var ContainerRegistryDeleteCommand = class extends Command { + getMethod() { + return "DELETE"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://registry.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/container/${this.input.containerId}`; + } + /** + * Parse the response + */ + parseResponse(response) { + return parseResponseHelper(ContainerRegistryDeleteSchema, response); + } +}; + +// src/commands/container-registry/container-registry.fetch.ts +init_command(); +init_parse_response_helper(); +var ContainerRegistryFetchCommand = class extends Command { + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://registry.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/container/${this.input.containerId}`; + } + /** + * Parse the response + */ + parseResponse(response) { + return parseResponseHelper(ContainerRegistrySchema, response); + } +}; + +// src/commands/container-registry/container-registry.list.ts +init_command(); +init_parse_response_helper(); +var ContainerRegistListCommand = class extends Command { + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://registry.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/container/tenants/${this.input.tenantId}`; + } + /** + * Parse the response + */ + parseResponse(response) { + return parseResponseHelper(ContainerRegistryListSchema, response); + } +}; + +// src/commands/container-registry/container-registry.update.ts +init_command(); +init_parse_response_helper(); +var ContainerRegistryUpdateCommand = class extends Command { + getMethod() { + return "PATCH"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://registry.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/container/${this.input.containerId}`; + } + /** + * Parse the response + */ + parseResponse(response) { + return parseResponseHelper(ContainerRegistrySchema, response); + } +}; + +// src/commands/security/pat.create.ts +init_command(); +var PATSchema = Type.Object({ + id: Type.String(), + name: Type.String(), + description: Type.Optional(Type.String()), + token: Type.Optional(Type.String()), + createdAt: Type.String() +}); + +// src/commands/security/pat.create.ts +init_parse_response_helper(); +var SecurityCreatePATCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://security2.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/pat`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(PATSchema, rawResponse); + } +}; + +// src/commands/security/pat.delete.ts +init_command(); +init_parse_response_helper(); +var SecurityDeletePATCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "DELETE"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://security2.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/pat/${this.input.id}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper( + Type.Object({ + success: Type.Boolean() + }), + rawResponse + ); + } +}; + +// src/commands/security/pat.exchange.ts +init_command(); +init_parse_response_helper(); +var SecurityExchangePATCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://security2.api.flowcore.io"; + } + getHeaders() { + const headers = super.getHeaders(); + headers["x-flowcore-pat"] = this.input.pat; + return headers; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/pat/exchange/${this.input.username}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper( + Type.Object({ + accessToken: Type.String() + }), + rawResponse + ); + } +}; + +// src/commands/security/pat.get.ts +init_command(); +init_parse_response_helper(); +var SecurityGetPATCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://security2.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/pat/${this.input.id}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(PATSchema, rawResponse); + } +}; + +// src/commands/security/pat.list.ts +init_command(); +init_parse_response_helper(); +var SecurityListPATCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://security2.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/pat`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(Type.Array(PATSchema), rawResponse); + } +}; + +// src/commands/security/permissions.list.ts +init_command(); +init_parse_response_helper(); +var PermissionSchema = Type.Object({ + tenant: Type.String(), + type: Type.String(), + id: Type.String(), + action: Type.Array( + Type.Union([ + Type.Literal("read"), + Type.Literal("write"), + Type.Literal("ingest"), + Type.Literal("fetch"), + Type.Literal("sensitive-data-fetch"), + Type.String() + ]) + ) +}); + +// src/commands/security/permissions.list.ts +var responseSchema13 = Type.Object({ + ...PermissionSchema.properties, + // parse as string to prevent sdk to fail when new actions are added + action: Type.Array(Type.String()) +}); +var PermissionsListCommand = class extends Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + const queryParams = new URLSearchParams(); + if (this.input.type) { + queryParams.set("type", this.input.type); + } + return `/api/v1/permissions?${queryParams.toString()}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = parseResponseHelper(Type.Array(responseSchema13), rawResponse); + return response; + } +}; + +// src/commands/user/user.initialize-in-keycloak.ts +init_command(); +init_parse_response_helper(); +var responseSchema14 = Type.Object({ + id: Type.String(), + username: Type.String(), + email: Type.String(), + firstName: Type.String(), + lastName: Type.String() +}); +var UserInitializeInKeycloakCommand = class extends Command { + /** + * The allowed modes for the command + */ + allowedModes = ["bearer"]; + /** + * Get the base URL for the request + */ + getBaseUrl() { + return "https://user-2.api.flowcore.io"; + } + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the path for the request + */ + getPath() { + return "/api/users"; + } + /** + * Get the body for the request (must be an empty JSON object) + */ + getBody() { + return { + // intentionally empty + }; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = parseResponseHelper(responseSchema14, rawResponse); + return response; + } +}; + +// src/commands/user/user.delete.ts +init_command(); +init_parse_response_helper(); +var responseSchema15 = Type.Object({ + id: Type.String() +}); +var UserDeleteCommand = class extends Command { + /** + * The allowed modes for the command + */ + allowedModes = ["bearer"]; + /** + * Get the base URL for the request + */ + getBaseUrl() { + return "https://user-2.api.flowcore.io"; + } + /** + * Get the method + */ + getMethod() { + return "DELETE"; + } + /** + * Get the path for the request + */ + getPath() { + return `/api/users`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = parseResponseHelper(responseSchema15, rawResponse); + return response; + } +}; + +// src/commands/user/user.invite-to-tenant.ts +init_command(); +init_parse_response_helper(); +var responseSchema16 = Type.Object({ + success: Type.Boolean(), + tenantName: Type.String(), + invitedEmail: Type.String() +}); +var UserInviteToTenantCommand = class extends Command { + /** + * The allowed modes for the command + */ + allowedModes = ["bearer"]; + /** + * Get the base URL for the request + */ + getBaseUrl() { + return "https://user-2.api.flowcore.io"; + } + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the path for the request + */ + getPath() { + return "/api/users/invitations"; + } + /** + * Get the body for the request + */ + getBody() { + return { + tenantName: this.input.tenantName, + userEmail: this.input.userEmail + }; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const response = parseResponseHelper(responseSchema16, rawResponse); + return response; + } +}; + +// src/commands/data-pathways/assignment.complete.ts +init_command(); +var DataPathwayAssignmentCompleteCommand = class extends Command { + retryOnFailure = false; + allowedModes = ["apiKey"]; + getMethod() { + return "POST"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/assignments/complete`; + } + parseResponse(_rawResponse) { + return null; + } +}; + +// src/commands/data-pathways/assignment.expire-leases.ts +init_command(); +var SizeClassEnum = Type.Union([Type.Literal("small"), Type.Literal("medium"), Type.Literal("high")]); +var EndpointConfigSchema = Type.Object({ + url: Type.String(), + authHeaders: Type.Optional(Type.Record(Type.String(), Type.String())) +}); +var BackoffConfigSchema = Type.Optional( + Type.Object({ + initialMs: Type.Optional(Type.Integer()), + maxMs: Type.Optional(Type.Integer()), + multiplier: Type.Optional(Type.Number()) + }) +); +var TimeoutConfigSchema = Type.Optional( + Type.Object({ + deliveryMs: Type.Optional(Type.Integer()), + fetchMs: Type.Optional(Type.Integer()) + }) +); +var SourceConfigSchema = Type.Object({ + id: Type.Optional(Type.String()), + name: Type.Optional(Type.String()), + flowType: Type.String(), + eventTypes: Type.Array(Type.String()), + endpoints: Type.Array(EndpointConfigSchema), + batchSize: Type.Optional(Type.Integer()), + maxInFlight: Type.Optional(Type.Integer()), + backoff: BackoffConfigSchema, + timeouts: TimeoutConfigSchema +}); +var DataSourceConfigSchema = Type.Object({ + tenant: Type.String(), + dataCore: Type.String() +}); +var AuthConfigSchema = Type.Object({ + apiKey: Type.String() +}); +var PathwayConfigSchema = Type.Object({ + sources: Type.Array(SourceConfigSchema) +}); +var PumpConfigSchema = Type.Object({ + sources: Type.Array(SourceConfigSchema), + dataSource: DataSourceConfigSchema, + auth: Type.Optional(AuthConfigSchema) +}); +var PathwayTypeSchema = Type.Optional(Type.Union([Type.Literal("managed"), Type.Literal("virtual")])); +var VirtualConfigSchema = Type.Object({ + flowTypes: Type.Optional(Type.Array(Type.String())) +}); +var DeliveryStateSchema = Type.Union([Type.Literal("active"), Type.Literal("paused")]); +var DataPathwaySchema = Type.Object({ + id: Type.String(), + tenant: Type.String(), + name: Type.Optional(Type.Union([Type.String(), Type.Null()])), + dataCore: Type.String(), + sizeClass: SizeClassEnum, + type: PathwayTypeSchema, + enabled: Type.Boolean(), + priority: Type.Integer(), + version: Type.Integer(), + labels: Type.Record(Type.String(), Type.String()), + config: Type.Optional(PathwayConfigSchema), + virtualConfig: Type.Optional(VirtualConfigSchema), + deliveryState: Type.Optional(DeliveryStateSchema), + deliveryPauseTargets: Type.Optional(Type.Union([Type.Array(Type.String()), Type.Null()])), + createdAt: Type.String(), + updatedAt: Type.String() +}); +var DataPathwayListSchema = Type.Object({ + pathways: Type.Array(DataPathwaySchema), + total: Type.Integer() +}); +var DataPathwayMutationResponseSchema = Type.Object({ + pathwayId: Type.String(), + status: Type.String(), + apiKey: Type.Optional(Type.String()) +}); +var DataPathwaySlotSchema = Type.Object({ + id: Type.String(), + podUnitId: Type.String(), + class: SizeClassEnum, + labels: Type.Record(Type.String(), Type.String()), + lastSeen: Type.String(), + createdAt: Type.String(), + updatedAt: Type.String() +}); +var DataPathwaySlotListSchema = Type.Object({ + slots: Type.Array(DataPathwaySlotSchema), + total: Type.Integer() +}); +var DataPathwaySlotMutationResponseSchema = Type.Object({ + slotId: Type.String(), + status: Type.String() +}); +var DataPathwayAssignmentSchema = Type.Object({ + id: Type.String(), + pathwayId: Type.String(), + slotId: Type.String(), + generation: Type.Integer(), + leaseTTL: Type.String(), + status: Type.String(), + config: PumpConfigSchema, + createdAt: Type.String(), + updatedAt: Type.String() +}); +var AssignmentNextInnerSchema = Type.Object({ + assignmentId: Type.String(), + pathwayId: Type.String(), + slotId: Type.String(), + generation: Type.Integer(), + config: PumpConfigSchema, + leaseTTL: Type.String(), + status: Type.String() +}); +var DataPathwayAssignmentNextSchema = Type.Object({ + assignment: Type.Union([AssignmentNextInnerSchema, Type.Null()]) +}); +var DataPathwayAssignmentListSchema = Type.Object({ + assignments: Type.Array(DataPathwayAssignmentSchema), + total: Type.Integer() +}); +var DataPathwayExpireLeasesResponseSchema = Type.Object({ + expired: Type.Integer() +}); +var DataPathwayCommandSchema = Type.Object({ + id: Type.String(), + restartRequestId: Type.Union([Type.String(), Type.Null()]), + assignmentId: Type.String(), + type: Type.String(), + generation: Type.Integer(), + position: Type.Union([Type.Record(Type.String(), Type.Unknown()), Type.Null()]), + stopAt: Type.Union([Type.String(), Type.Null()]), + timeoutMs: Type.Union([Type.Integer(), Type.Null()]), + phase: Type.String(), + reason: Type.Union([Type.String(), Type.Null()]), + createdAt: Type.String() +}); +var DataPathwayCommandListSchema = Type.Object({ + commands: Type.Array(DataPathwayCommandSchema) +}); +var DataPathwayCommandResponseSchema = Type.Object({ + commandId: Type.String(), + phase: Type.String() +}); +var DataPathwayCommandDetailSchema = Type.Object({ + id: Type.String(), + restartRequestId: Type.Union([Type.String(), Type.Null()]), + assignmentId: Type.Union([Type.String(), Type.Null()]), + pathwayId: Type.Union([Type.String(), Type.Null()]), + type: Type.String(), + generation: Type.Union([Type.Integer(), Type.Null()]), + position: Type.Union([Type.Record(Type.String(), Type.Unknown()), Type.Null()]), + stopAt: Type.Union([Type.String(), Type.Null()]), + timeoutMs: Type.Union([Type.Integer(), Type.Null()]), + phase: Type.String(), + reason: Type.Union([Type.String(), Type.Null()]), + details: Type.Union([Type.String(), Type.Null()]), + config: Type.Union([Type.Record(Type.String(), Type.Unknown()), Type.Null()]), + sourceFlowTypes: Type.Union([Type.Array(Type.String()), Type.Null()]), + createdAt: Type.String(), + updatedAt: Type.String() +}); +var DataPathwayRestartRequestResponseSchema = Type.Object({ + restartRequestId: Type.String(), + acceptedTargets: Type.Array(Type.String()), + skippedTargets: Type.Array(Type.String()) +}); +var DataPathwayRestartRequestSchema = Type.Object({ + id: Type.String(), + targets: Type.Record(Type.String(), Type.Unknown()), + mode: Type.String(), + position: Type.Record(Type.String(), Type.Unknown()), + status: Type.String(), + requestedBy: Type.String(), + reason: Type.Union([Type.String(), Type.Null()]), + createdAt: Type.String(), + updatedAt: Type.String() +}); +var SlotCountSchema = Type.Object({ + free: Type.Integer(), + used: Type.Integer() +}); +var ThreeClassIntegersSchema = Type.Object({ + small: Type.Integer(), + medium: Type.Integer(), + high: Type.Integer() +}); +var DataPathwayCapacitySchema = Type.Object({ + slots: Type.Object({ + small: SlotCountSchema, + medium: SlotCountSchema, + high: SlotCountSchema + }), + pendingAssignments: ThreeClassIntegersSchema +}); +var DataPathwayQuotaSchema = Type.Object({ + tenant: Type.String(), + maxSlots: ThreeClassIntegersSchema, + createdAt: Type.String(), + updatedAt: Type.String() +}); +var DataPathwayQuotaWithUsageSchema = Type.Object({ + tenant: Type.String(), + maxSlots: ThreeClassIntegersSchema, + used: ThreeClassIntegersSchema +}); +var DataPathwayQuotaListSchema = Type.Object({ + quotas: Type.Array(DataPathwayQuotaSchema), + total: Type.Integer() +}); +var DataPathwayQuotaSetResponseSchema = Type.Object({ + tenant: Type.String(), + status: Type.String() +}); +var PumpStateValueSchema = Type.Object({ + timeBucket: Type.String(), + eventId: Type.Optional(Type.String()) +}); +var DataPathwayPumpStateSchema = Type.Object({ + pathwayId: Type.String(), + flowType: Type.String(), + state: Type.Union([PumpStateValueSchema, Type.Null()]) +}); +var DataPathwayPumpStateBySourceSchema = Type.Object({ + pathwayId: Type.String(), + sourceId: Type.String(), + flowType: Type.Union([Type.String(), Type.Null()]), + state: Type.Union([PumpStateValueSchema, Type.Null()]) +}); +var DataPathwayPumpStateSaveResponseSchema = Type.Object({ + status: Type.String() +}); +var DataPathwayDeliveryLogEntrySchema = Type.Object({ + id: Type.String(), + pathwayId: Type.String(), + assignmentId: Type.String(), + endpointUrl: Type.String(), + httpStatus: Type.Union([Type.Integer(), Type.Null()]), + success: Type.Boolean(), + batchSize: Type.Union([Type.Integer(), Type.Null()]), + durationMs: Type.Union([Type.Integer(), Type.Null()]), + errorMessage: Type.Union([Type.String(), Type.Null()]), + responseBody: Type.Union([Type.String(), Type.Null()]), + flowType: Type.Union([Type.String(), Type.Null()]), + sourceId: Type.Union([Type.String(), Type.Null()]), + eventType: Type.Union([Type.String(), Type.Null()]), + createdAt: Type.String() +}); +var DataPathwayDeliveryLogListSchema = Type.Object({ + entries: Type.Array(DataPathwayDeliveryLogEntrySchema), + total: Type.Integer() +}); +Type.Object({ + pathwayId: Type.String(), + assignmentId: Type.String(), + endpointUrl: Type.String(), + flowType: Type.Optional(Type.String()), + sourceId: Type.Optional(Type.String()), + eventType: Type.Optional(Type.String()), + httpStatus: Type.Optional(Type.Integer()), + success: Type.Boolean(), + batchSize: Type.Optional(Type.Integer()), + durationMs: Type.Optional(Type.Integer()), + errorMessage: Type.Optional(Type.String()), + responseBody: Type.Optional(Type.String()) +}); +var DataPathwayDeliveryLogBatchResponseSchema = Type.Object({ + inserted: Type.Integer() +}); +var ThroughputRecentResultSchema = Type.Object({ + status: Type.Number(), + durationMs: Type.Number(), + success: Type.Boolean(), + ageMs: Type.Number() +}); +var ThroughputSourceSchema = Type.Object({ + flowType: Type.String(), + name: Type.Optional(Type.String()), + eventsPerSecond: Type.Number(), + successRate: Type.Number(), + avgDurationMs: Type.Number(), + totalDelivered: Type.Number(), + totalFailed: Type.Number(), + lastDeliveryAgeMs: Type.Union([Type.Number(), Type.Null()]), + healthy: Type.Boolean(), + recentResults: Type.Array(ThroughputRecentResultSchema) +}); +var ThroughputEndpointSchema = Type.Object({ + eventsPerSecond: Type.Number(), + successRate: Type.Number(), + totalDelivered: Type.Number(), + totalFailed: Type.Number(), + lastDeliveryAgeMs: Type.Union([Type.Number(), Type.Null()]), + healthy: Type.Boolean(), + sources: Type.Record(Type.String(), ThroughputSourceSchema) +}); +var ThroughputSnapshotSchema = Type.Object({ + global: Type.Object({ + eventsPerSecond: Type.Number(), + totalRecorded: Type.Number(), + windowSeconds: Type.Number() + }), + endpoints: Type.Record(Type.String(), ThroughputEndpointSchema) +}); +var MetricsAssignmentEntrySchema = Type.Object({ + assignmentId: Type.String(), + status: Type.String(), + throughput: Type.Union([ThroughputSnapshotSchema, Type.Null()]), + updatedAt: Type.String() +}); +var DataPathwayMetricsSchema = Type.Object({ + pathwayId: Type.String(), + assignments: Type.Array(MetricsAssignmentEntrySchema) +}); +var DataPathwayHealthSchema = Type.Object({ + status: Type.Union([Type.Literal("healthy"), Type.Literal("unhealthy")]), + checks: Type.Object({ db: Type.Union([Type.Literal("ok"), Type.Literal("error")]) }), + uptime: Type.Number() +}); +var DataPathwayPumpPulseResponseSchema = Type.Object({ + status: Type.String() +}); +var PumpPulseEntrySchema = Type.Object({ + flowType: Type.String(), + timeBucket: Type.String(), + eventId: Type.Union([Type.String(), Type.Null()]), + isLive: Type.Boolean(), + buffer: Type.Object({ + depth: Type.Number(), + reserved: Type.Number(), + sizeBytes: Type.Number() + }), + counters: Type.Object({ + acknowledged: Type.Number(), + failed: Type.Number(), + pulled: Type.Number() + }), + uptimeMs: Type.Number(), + lastPulseAgeMs: Type.Number(), + healthy: Type.Boolean() +}); +var PumpStatusAssignmentSchema = Type.Object({ + id: Type.String(), + status: Type.String(), + leaseRemainingMs: Type.Number(), + lastHeartbeatAgeMs: Type.Number(), + metrics: Type.Unknown() +}); +var DataPathwayPumpStatusSchema = Type.Object({ + pathwayId: Type.String(), + pulses: Type.Array(PumpPulseEntrySchema), + assignment: Type.Union([PumpStatusAssignmentSchema, Type.Null()]) +}); + +// src/commands/data-pathways/assignment.expire-leases.ts +init_parse_response_helper(); +var DataPathwayAssignmentExpireLeasesCommand = class extends Command { + retryOnFailure = false; + allowedModes = ["apiKey"]; + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/assignments/expire-leases`; + } + getBody() { + return void 0; + } + parseResponse(rawResponse) { + return parseResponseHelper(DataPathwayExpireLeasesResponseSchema, rawResponse); + } +}; + +// src/commands/data-pathways/assignment.fetch.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var DataPathwayAssignmentFetchCommand = class extends Command { + allowedModes = ["bearer"]; + getMethod() { + return "GET"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/assignments/${this.input.id}`; + } + parseResponse(rawResponse) { + return parseResponseHelper(DataPathwayAssignmentSchema, rawResponse); + } + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("DataPathwayAssignment", { id: this.input.id }); + } + throw error; + } +}; + +// src/commands/data-pathways/assignment.heartbeat.ts +init_command(); +var DataPathwayAssignmentHeartbeatCommand = class extends Command { + retryOnFailure = false; + allowedModes = ["apiKey"]; + getMethod() { + return "POST"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/assignments/heartbeat`; + } + parseResponse(_rawResponse) { + return null; + } +}; + +// src/commands/data-pathways/assignment.list.ts +init_command(); +init_parse_response_helper(); +var DataPathwayAssignmentListCommand = class extends Command { + allowedModes = ["bearer"]; + getMethod() { + return "GET"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + const queryParams = new URLSearchParams(); + if (this.input.status) queryParams.set("status", this.input.status); + if (this.input.slotId) queryParams.set("slotId", this.input.slotId); + if (this.input.pathwayId) queryParams.set("pathwayId", this.input.pathwayId); + if (this.input.limit !== void 0) queryParams.set("limit", String(this.input.limit)); + if (this.input.offset !== void 0) queryParams.set("offset", String(this.input.offset)); + if (this.input.sort) queryParams.set("sort", this.input.sort); + const qs = queryParams.toString(); + return `/api/v1/assignments${qs ? `?${qs}` : ""}`; + } + parseResponse(rawResponse) { + return parseResponseHelper(DataPathwayAssignmentListSchema, rawResponse); + } +}; + +// src/commands/data-pathways/assignment.next.ts +init_command(); +init_parse_response_helper(); +var DataPathwayAssignmentNextCommand = class extends Command { + retryOnFailure = false; + allowedModes = ["apiKey"]; + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/assignments/next`; + } + parseResponse(rawResponse) { + return parseResponseHelper(DataPathwayAssignmentNextSchema, rawResponse); + } +}; + +// src/commands/data-pathways/capacity.fetch.ts +init_command(); +init_parse_response_helper(); +var DataPathwayCapacityFetchCommand = class extends Command { + allowedModes = ["bearer"]; + getMethod() { + return "GET"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/capacity`; + } + parseResponse(rawResponse) { + return parseResponseHelper(DataPathwayCapacitySchema, rawResponse); + } +}; + +// src/commands/data-pathways/command.dispatch-config-update.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var DataPathwayCommandDispatchConfigUpdateCommand = class extends Command { + retryOnFailure = false; + allowedModes = ["bearer"]; + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/assignments/${this.input.assignmentId}/commands/config-update`; + } + getBody() { + const { assignmentId: _assignmentId, ...payload } = this.input; + return payload; + } + parseResponse(rawResponse) { + return parseResponseHelper(DataPathwayCommandResponseSchema, rawResponse); + } + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("DataPathwayAssignment", { id: this.input.assignmentId }); + } + throw error; + } +}; + +// src/commands/data-pathways/command.dispatch-restart.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var DataPathwayCommandDispatchRestartCommand = class extends Command { + retryOnFailure = false; + allowedModes = ["bearer"]; + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/assignments/${this.input.assignmentId}/commands/datapump-restart`; + } + getBody() { + const { assignmentId: _assignmentId, ...payload } = this.input; + return payload; + } + parseResponse(rawResponse) { + return parseResponseHelper(DataPathwayCommandResponseSchema, rawResponse); + } + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("DataPathwayAssignment", { id: this.input.assignmentId }); + } + throw error; + } +}; + +// src/commands/data-pathways/command.dispatch-stop.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var DataPathwayCommandDispatchStopCommand = class extends Command { + retryOnFailure = false; + allowedModes = ["bearer"]; + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/assignments/${this.input.assignmentId}/commands/stop`; + } + getBody() { + const { assignmentId: _assignmentId, ...payload } = this.input; + return payload; + } + parseResponse(rawResponse) { + return parseResponseHelper(DataPathwayCommandResponseSchema, rawResponse); + } + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("DataPathwayAssignment", { id: this.input.assignmentId }); + } + throw error; + } +}; + +// src/commands/data-pathways/command.fetch.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var DataPathwayCommandFetchCommand = class extends Command { + allowedModes = ["bearer", "apiKey"]; + getMethod() { + return "GET"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/commands/${this.input.commandId}`; + } + parseResponse(rawResponse) { + return parseResponseHelper(DataPathwayCommandDetailSchema, rawResponse); + } + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("DataPathwayCommand", { commandId: this.input.commandId }); + } + throw error; + } +}; + +// src/commands/data-pathways/command.pending.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var DataPathwayCommandPendingCommand = class extends Command { + allowedModes = ["apiKey"]; + getMethod() { + return "GET"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/assignments/${this.input.assignmentId}/commands/pending`; + } + parseResponse(rawResponse) { + return parseResponseHelper(DataPathwayCommandListSchema, rawResponse); + } + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("DataPathwayAssignment", { id: this.input.assignmentId }); + } + throw error; + } +}; + +// src/commands/data-pathways/command.update-status.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var DataPathwayCommandUpdateStatusCommand = class extends Command { + retryOnFailure = false; + allowedModes = ["apiKey"]; + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/assignments/${this.input.assignmentId}/commands/${this.input.commandId}/status`; + } + getBody() { + const { assignmentId: _assignmentId, commandId: _commandId, ...payload } = this.input; + return payload; + } + parseResponse(rawResponse) { + return parseResponseHelper(DataPathwayCommandResponseSchema, rawResponse); + } + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("DataPathwayCommand", { + assignmentId: this.input.assignmentId, + commandId: this.input.commandId + }); + } + throw error; + } +}; + +// src/commands/data-pathways/delivery-log.batch.ts +init_command(); +init_parse_response_helper(); +var DataPathwayDeliveryLogBatchCommand = class extends Command { + retryOnFailure = false; + allowedModes = ["apiKey"]; + getMethod() { + return "POST"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return "/api/v1/delivery-log/batch"; + } + getBody() { + return { entries: this.input.entries }; + } + parseResponse(rawResponse) { + return parseResponseHelper(DataPathwayDeliveryLogBatchResponseSchema, rawResponse); + } +}; + +// src/commands/data-pathways/delivery-log.list.ts +init_command(); +init_parse_response_helper(); +var DataPathwayDeliveryLogListCommand = class extends Command { + allowedModes = ["bearer"]; + getMethod() { + return "GET"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + const queryParams = new URLSearchParams(); + queryParams.set("pathwayId", this.input.pathwayId); + if (this.input.success !== void 0) queryParams.set("success", String(this.input.success)); + if (this.input.limit !== void 0) queryParams.set("limit", String(this.input.limit)); + if (this.input.offset !== void 0) queryParams.set("offset", String(this.input.offset)); + if (this.input.sort) queryParams.set("sort", this.input.sort); + return `/api/v1/delivery-log?${queryParams}`; + } + parseResponse(rawResponse) { + return parseResponseHelper(DataPathwayDeliveryLogListSchema, rawResponse); + } +}; + +// src/commands/data-pathways/health.check.ts +init_command(); +init_parse_response_helper(); +var DataPathwayHealthCheckCommand = class extends Command { + retryOnFailure = false; + allowedModes = ["bearer"]; + getMethod() { + return "GET"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return "/api/v1/health"; + } + parseResponse(rawResponse) { + return parseResponseHelper(DataPathwayHealthSchema, rawResponse); + } +}; + +// src/commands/data-pathways/pathway.create.ts +init_command(); +init_parse_response_helper(); +var DataPathwayCreateCommand = class extends Command { + retryOnFailure = false; + allowedModes = ["bearer"]; + getMethod() { + return "PUT"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/pathways/${this.input.id}`; + } + getBody() { + const { id: _id, ...payload } = this.input; + return payload; + } + parseResponse(rawResponse) { + return parseResponseHelper(DataPathwayMutationResponseSchema, rawResponse); + } +}; + +// src/commands/data-pathways/pathway.delete.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var DataPathwayDeleteCommand = class extends Command { + retryOnFailure = false; + allowedModes = ["bearer"]; + getMethod() { + return "DELETE"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/pathways/${this.input.id}`; + } + getBody() { + const { id: _id, ...payload } = this.input; + return payload; + } + parseResponse(rawResponse) { + return parseResponseHelper(DataPathwayMutationResponseSchema, rawResponse); + } + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("DataPathway", { id: this.input.id }); + } + throw error; + } +}; + +// src/commands/data-pathways/pathway.disable.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var DataPathwayDisableCommand = class extends Command { + retryOnFailure = false; + allowedModes = ["bearer"]; + getMethod() { + return "POST"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/pathways/${this.input.id}/disable`; + } + getBody() { + const { id: _id, ...payload } = this.input; + return payload; + } + parseResponse(rawResponse) { + return parseResponseHelper(DataPathwayMutationResponseSchema, rawResponse); + } + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("DataPathway", { id: this.input.id }); + } + throw error; + } +}; + +// src/commands/data-pathways/pathway.fetch.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var DataPathwayFetchCommand = class extends Command { + allowedModes = ["bearer"]; + getMethod() { + return "GET"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/pathways/${this.input.id}`; + } + parseResponse(rawResponse) { + return parseResponseHelper(DataPathwaySchema, rawResponse); + } + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("DataPathway", { id: this.input.id }); + } + throw error; + } +}; + +// src/commands/data-pathways/pathway.fetch-by-name.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var DataPathwayFetchByNameCommand = class extends Command { + allowedModes = ["apiKey"]; + getMethod() { + return "GET"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + const qs = new URLSearchParams({ tenant: this.input.tenant }).toString(); + return `/api/v1/pathways/by-name/${encodeURIComponent(this.input.name)}?${qs}`; + } + parseResponse(rawResponse) { + return parseResponseHelper(DataPathwaySchema, rawResponse); + } + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("DataPathway", { name: this.input.name, tenant: this.input.tenant }); + } + throw error; + } +}; + +// src/commands/data-pathways/pathway.list.ts +init_command(); +init_parse_response_helper(); +var DataPathwayListCommand = class extends Command { + allowedModes = ["bearer"]; + getMethod() { + return "GET"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + const queryParams = new URLSearchParams(); + if (this.input.tenant) queryParams.set("tenant", this.input.tenant); + if (this.input.sizeClass) queryParams.set("sizeClass", this.input.sizeClass); + if (this.input.type) queryParams.set("type", this.input.type); + if (this.input.enabled !== void 0) queryParams.set("enabled", String(this.input.enabled)); + if (this.input.priority !== void 0) queryParams.set("priority", String(this.input.priority)); + if (this.input.limit !== void 0) queryParams.set("limit", String(this.input.limit)); + if (this.input.offset !== void 0) queryParams.set("offset", String(this.input.offset)); + if (this.input.page !== void 0) queryParams.set("page", String(this.input.page)); + if (this.input.ids !== void 0) { + const ids = Array.isArray(this.input.ids) ? this.input.ids.join(",") : this.input.ids; + queryParams.set("ids", ids); + } + if (this.input.sort) queryParams.set("sort", this.input.sort); + const qs = queryParams.toString(); + return `/api/v1/pathways${qs ? `?${qs}` : ""}`; + } + parseResponse(rawResponse) { + return parseResponseHelper(DataPathwayListSchema, rawResponse); + } +}; + +// src/commands/data-pathways/pathway.metrics.fetch.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var DataPathwayMetricsFetchCommand = class extends Command { + allowedModes = ["bearer"]; + getMethod() { + return "GET"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/pathways/${this.input.id}/metrics`; + } + parseResponse(rawResponse) { + return parseResponseHelper(DataPathwayMetricsSchema, rawResponse); + } + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("DataPathway", { id: this.input.id }); + } + throw error; + } +}; + +// src/commands/data-pathways/pathway.upsert-by-name.ts +init_command(); +init_parse_response_helper(); +var DataPathwayUpsertByNameResponseSchema = Type.Object({ + pathwayId: Type.String(), + status: Type.Union([Type.Literal("created"), Type.Literal("updated")]) +}); +var DataPathwayUpsertByNameCommand = class extends Command { + retryOnFailure = false; + allowedModes = ["apiKey"]; + getMethod() { + return "PUT"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/pathways/by-name/${encodeURIComponent(this.input.name)}`; + } + getBody() { + const { name: _name, ...payload } = this.input; + return payload; + } + parseResponse(rawResponse) { + return parseResponseHelper(DataPathwayUpsertByNameResponseSchema, rawResponse); + } +}; + +// src/commands/data-pathways/pathway-command.dispatch-pause.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var DataPathwayCommandDispatchPauseCommand = class extends Command { + retryOnFailure = false; + allowedModes = ["bearer"]; + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/pathways/${this.input.pathwayId}/commands/pause`; + } + getBody() { + const { pathwayId: _pathwayId, ...payload } = this.input; + return payload; + } + parseResponse(rawResponse) { + return parseResponseHelper(DataPathwayCommandResponseSchema, rawResponse); + } + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("DataPathway", { id: this.input.pathwayId }); + } + } +}; + +// src/commands/data-pathways/pathway-command.dispatch-resume.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var DataPathwayCommandDispatchResumeCommand = class extends Command { + retryOnFailure = false; + allowedModes = ["bearer"]; + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/pathways/${this.input.pathwayId}/commands/resume`; + } + getBody() { + const { pathwayId: _pathwayId, ...payload } = this.input; + return payload; + } + parseResponse(rawResponse) { + return parseResponseHelper(DataPathwayCommandResponseSchema, rawResponse); + } + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("DataPathway", { id: this.input.pathwayId }); + } + } +}; + +// src/commands/data-pathways/pathway-command.pending.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var DataPathwayCommandPendingByPathwayCommand = class extends Command { + allowedModes = ["bearer", "apiKey"]; + getMethod() { + return "GET"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/pathways/${this.input.pathwayId}/commands/pending`; + } + parseResponse(rawResponse) { + return parseResponseHelper(DataPathwayCommandListSchema, rawResponse); + } + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("DataPathway", { id: this.input.pathwayId }); + } + throw error; + } +}; + +// src/commands/data-pathways/pathway-command.update-status.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var DataPathwayCommandUpdateStatusByPathwayCommand = class extends Command { + retryOnFailure = false; + allowedModes = ["bearer", "apiKey"]; + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/pathways/${this.input.pathwayId}/commands/${this.input.commandId}/status`; + } + getBody() { + const { pathwayId: _pathwayId, commandId: _commandId, ...payload } = this.input; + return payload; + } + parseResponse(rawResponse) { + return parseResponseHelper(DataPathwayCommandResponseSchema, rawResponse); + } + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("DataPathwayCommand", { + pathwayId: this.input.pathwayId, + commandId: this.input.commandId + }); + } + throw error; + } +}; + +// src/commands/data-pathways/pump-pulse.send.ts +init_command(); +init_parse_response_helper(); +var SendPumpPulseCommand = class extends Command { + retryOnFailure = false; + allowedModes = ["apiKey"]; + getMethod() { + return "POST"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/pump-pulse`; + } + parseResponse(rawResponse) { + return parseResponseHelper(DataPathwayPumpPulseResponseSchema, rawResponse); + } +}; + +// src/commands/data-pathways/pump-state.fetch.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var DataPathwayPumpStateFetchCommand = class extends Command { + allowedModes = ["apiKey"]; + getMethod() { + return "GET"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/pump-states/${this.input.pathwayId}/${encodeURIComponent(this.input.flowType)}`; + } + parseResponse(rawResponse) { + return parseResponseHelper(DataPathwayPumpStateSchema, rawResponse); + } + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("DataPathwayPumpState", { + pathwayId: this.input.pathwayId, + flowType: this.input.flowType + }); + } + throw error; + } +}; + +// src/commands/data-pathways/pump-state.fetch-by-source.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var DataPathwayPumpStateFetchBySourceCommand = class extends Command { + allowedModes = ["apiKey"]; + getMethod() { + return "GET"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/pump-states/${this.input.pathwayId}/sources/${this.input.sourceId}`; + } + parseResponse(rawResponse) { + return parseResponseHelper(DataPathwayPumpStateBySourceSchema, rawResponse); + } + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("DataPathwayPumpState", { + pathwayId: this.input.pathwayId, + sourceId: this.input.sourceId + }); + } + throw error; + } +}; + +// src/commands/data-pathways/pump-state.save.ts +init_command(); +init_parse_response_helper(); +var DataPathwayPumpStateSaveCommand = class extends Command { + retryOnFailure = false; + allowedModes = ["apiKey"]; + getMethod() { + return "POST"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/pump-states/${this.input.pathwayId}/${encodeURIComponent(this.input.flowType)}`; + } + getBody() { + return { state: this.input.state }; + } + parseResponse(rawResponse) { + return parseResponseHelper(DataPathwayPumpStateSaveResponseSchema, rawResponse); + } +}; + +// src/commands/data-pathways/pump-state.save-by-source.ts +init_command(); +init_parse_response_helper(); +var DataPathwayPumpStateSaveBySourceCommand = class extends Command { + retryOnFailure = false; + allowedModes = ["apiKey"]; + getMethod() { + return "PUT"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/pump-states/${this.input.pathwayId}/sources/${this.input.sourceId}`; + } + getBody() { + return { state: this.input.state }; + } + parseResponse(rawResponse) { + return parseResponseHelper(DataPathwayPumpStateSaveResponseSchema, rawResponse); + } +}; + +// src/commands/data-pathways/pump-status.fetch.ts +init_command(); +init_parse_response_helper(); +init_not_found(); +var FetchPumpStatusCommand = class extends Command { + retryOnFailure = true; + allowedModes = ["bearer", "apiKey"]; + getMethod() { + return "GET"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/pathways/${this.input.pathwayId}/pump-status`; + } + getBody() { + return void 0; + } + parseResponse(rawResponse) { + return parseResponseHelper(DataPathwayPumpStatusSchema, rawResponse); + } + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("Pathway", { pathwayId: this.input.pathwayId }); + } + throw error; + } +}; + +// src/commands/data-pathways/quota.fetch.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var DataPathwayQuotaFetchCommand = class extends Command { + allowedModes = ["bearer"]; + getMethod() { + return "GET"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/quotas/${this.input.tenant}`; + } + parseResponse(rawResponse) { + return parseResponseHelper(DataPathwayQuotaWithUsageSchema, rawResponse); + } + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("DataPathwayQuota", { tenant: this.input.tenant }); + } + throw error; + } +}; + +// src/commands/data-pathways/quota.list.ts +init_command(); +init_parse_response_helper(); +var DataPathwayQuotaListCommand = class extends Command { + allowedModes = ["bearer"]; + getMethod() { + return "GET"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/quotas`; + } + parseResponse(rawResponse) { + return parseResponseHelper(DataPathwayQuotaListSchema, rawResponse); + } +}; + +// src/commands/data-pathways/quota.set.ts +init_command(); +init_parse_response_helper(); +var DataPathwayQuotaSetCommand = class extends Command { + retryOnFailure = false; + allowedModes = ["bearer"]; + getMethod() { + return "PUT"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/quotas/${this.input.tenant}`; + } + getBody() { + const { tenant: _tenant, ...payload } = this.input; + return payload; + } + parseResponse(rawResponse) { + return parseResponseHelper(DataPathwayQuotaSetResponseSchema, rawResponse); + } +}; + +// src/commands/data-pathways/restart.fetch.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var DataPathwayRestartFetchCommand = class extends Command { + allowedModes = ["bearer"]; + getMethod() { + return "GET"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/restarts/${this.input.id}`; + } + parseResponse(rawResponse) { + return parseResponseHelper(DataPathwayRestartRequestSchema, rawResponse); + } + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("DataPathwayRestartRequest", { id: this.input.id }); + } + throw error; + } +}; + +// src/commands/data-pathways/restart.request.ts +init_command(); +init_parse_response_helper(); +var DataPathwayRestartRequestCommand = class extends Command { + retryOnFailure = false; + allowedModes = ["bearer"]; + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/restarts/request`; + } + parseResponse(rawResponse) { + return parseResponseHelper(DataPathwayRestartRequestResponseSchema, rawResponse); + } +}; + +// src/commands/data-pathways/slot.deregister.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var DataPathwaySlotDeregisterCommand = class extends Command { + retryOnFailure = false; + allowedModes = ["apiKey"]; + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/slots/${this.input.id}/deregister`; + } + getBody() { + const { id: _id, ...payload } = this.input; + return payload; + } + parseResponse(rawResponse) { + return parseResponseHelper(DataPathwaySlotMutationResponseSchema, rawResponse); + } + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("DataPathwaySlot", { id: this.input.id }); + } + throw error; + } +}; + +// src/commands/data-pathways/slot.fetch.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var DataPathwaySlotFetchCommand = class extends Command { + allowedModes = ["apiKey"]; + getMethod() { + return "GET"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/slots/${this.input.id}`; + } + parseResponse(rawResponse) { + return parseResponseHelper(DataPathwaySlotSchema, rawResponse); + } + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("DataPathwaySlot", { id: this.input.id }); + } + throw error; + } +}; + +// src/commands/data-pathways/slot.heartbeat.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var DataPathwaySlotHeartbeatCommand = class extends Command { + retryOnFailure = false; + allowedModes = ["apiKey"]; + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/slots/${this.input.id}/heartbeat`; + } + getBody() { + return {}; + } + parseResponse(rawResponse) { + return parseResponseHelper(DataPathwaySlotMutationResponseSchema, rawResponse); + } + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("DataPathwaySlot", { id: this.input.id }); + } + throw error; + } +}; + +// src/commands/data-pathways/slot.list.ts +init_command(); +init_parse_response_helper(); +var DataPathwaySlotListCommand = class extends Command { + allowedModes = ["apiKey"]; + getMethod() { + return "GET"; + } + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + const queryParams = new URLSearchParams(); + if (this.input.class) queryParams.set("class", this.input.class); + if (this.input.limit !== void 0) queryParams.set("limit", String(this.input.limit)); + if (this.input.offset !== void 0) queryParams.set("offset", String(this.input.offset)); + if (this.input.sort) queryParams.set("sort", this.input.sort); + const qs = queryParams.toString(); + return `/api/v1/slots${qs ? `?${qs}` : ""}`; + } + parseResponse(rawResponse) { + return parseResponseHelper(DataPathwaySlotListSchema, rawResponse); + } +}; + +// src/commands/data-pathways/slot.register.ts +init_command(); +init_parse_response_helper(); +var DataPathwaySlotRegisterCommand = class extends Command { + retryOnFailure = false; + allowedModes = ["apiKey"]; + getBaseUrl() { + return "https://data-pathways.api.flowcore.io"; + } + getPath() { + return `/api/v1/slots/register`; + } + parseResponse(rawResponse) { + return parseResponseHelper(DataPathwaySlotMutationResponseSchema, rawResponse); + } +}; + +// src/commands/iam/permissions/get-user-permissions.ts +init_command(); +init_parse_response_helper(); +var UserPermissionSchema = Type.Object({ + tenant: Type.String(), + type: Type.String(), + id: Type.String(), + action: Type.Array(Type.String()) +}); +var UserPermissionsCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = true; + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return "/api/v1/permissions/"; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(Type.Array(UserPermissionSchema), rawResponse); + } +}; + +// src/commands/iam/policies/create-policy.ts +init_command(); +init_parse_response_helper(); +var PolicyFilterValueSchema = Type.Union([ + Type.String({ maxLength: 512 }), + Type.Number(), + Type.Boolean(), + Type.Null() +]); +var PolicyFilterPathSchema = Type.String({ + minLength: 1, + maxLength: 256, + pattern: "^[A-Za-z0-9_-]+(?:\\.[A-Za-z0-9_-]+){0,7}$" +}); +var PolicyFilterSchema = Type.Union([ + Type.Object({ path: PolicyFilterPathSchema, operator: Type.Literal("equals"), value: PolicyFilterValueSchema }, { additionalProperties: false }), + Type.Object({ path: PolicyFilterPathSchema, operator: Type.Literal("oneOf"), values: Type.Array(PolicyFilterValueSchema, { minItems: 1, maxItems: 20 }) }, { additionalProperties: false }), + Type.Object({ path: PolicyFilterPathSchema, operator: Type.Literal("exists"), value: Type.Boolean() }, { additionalProperties: false }) +]); +var RESERVED_PATH_SEGMENTS = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]); +function ownPath(payload, path) { + let current = payload; + for (const segment of path.split(".")) { + if (RESERVED_PATH_SEGMENTS.has(segment) || typeof current !== "object" || current === null || Array.isArray(current)) { + return { exists: false }; + } + if (!Object.hasOwn(current, segment)) return { exists: false }; + current = current[segment]; + } + return { exists: true, value: current }; +} +function isEncryptedPayload(payload) { + if (typeof payload !== "object" || payload === null || Array.isArray(payload)) return false; + if (!Object.hasOwn(payload, "encryptedPayload")) return false; + const keys = Object.keys(payload); + const value = payload.encryptedPayload; + return keys.length === 1 && typeof value === "string" && value.split(".").length === 3; +} +function matchesPolicyFilters(filters, payload) { + if (isEncryptedPayload(payload)) return false; + return filters.every((filter) => { + const resolved = ownPath(payload, filter.path); + if (filter.operator === "exists") return resolved.exists === filter.value; + if (!resolved.exists) return false; + if (filter.operator === "equals") return resolved.value === filter.value; + return filter.values.some((value) => resolved.value === value); + }); +} +function permitsPayload(grants, payload) { + return grants.some((grant) => grant.filters === void 0 || matchesPolicyFilters(grant.filters, payload)); +} + +// src/commands/iam/policies/create-policy.ts +var PolicyStatementSchema = Type.Object({ + statementId: Type.Optional(Type.String()), + resource: Type.String(), + action: Type.Union([Type.String(), Type.Array(Type.String())]), + filters: Type.Optional(Type.Array(PolicyFilterSchema, { minItems: 1, maxItems: 10 })) +}); +var PolicySchema = Type.Object({ + id: Type.String(), + organizationId: Type.String(), + name: Type.String(), + version: Type.String(), + policyDocuments: Type.Array(PolicyStatementSchema), + description: Type.Optional(Type.String()), + principal: Type.Optional(Type.String()), + flowcoreManaged: Type.Boolean(), + archived: Type.Optional(Type.Boolean()), + frn: Type.String() +}); +var PolicyCreateCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return "/api/v1/policies/"; + } + /** + * Get the body + */ + getBody() { + return { + ...this.input, + flowcoreManaged: this.input.flowcoreManaged ?? false + }; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(PolicySchema, rawResponse); + } +}; + +// src/commands/iam/policies/get-policy.ts +init_command(); +init_parse_response_helper(); +var PolicyListCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = true; + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return "/api/v1/policies/"; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(Type.Array(PolicySchema), rawResponse); + } +}; + +// src/commands/iam/policies/validate-policy.ts +init_command(); +init_parse_response_helper(); +var PolicyValidateResponseSchema = Type.Object({ + valid: Type.Literal(true) +}); +var PolicyValidateCommand = class extends Command { + /** + * Whether the command should retry on failure. + * + * Disabled because a 422 here indicates an invalid payload — retrying + * would just re-submit the same bad data. + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return "/api/v1/policies/validate"; + } + /** + * Get the body + */ + getBody() { + return { + ...this.input + }; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(PolicyValidateResponseSchema, rawResponse); + } +}; + +// src/commands/iam/policies/id/archive-policy.ts +init_command(); +init_parse_response_helper(); +var ArchivePolicyResponseSchema = Type.Object({ + message: Type.String() +}); +var PolicyArchiveCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "DELETE"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/policies/${this.input.policyId}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(ArchivePolicyResponseSchema, rawResponse); + } +}; + +// src/commands/iam/policies/id/get-policy.ts +init_command(); +init_parse_response_helper(); +var PolicyGetCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = true; + constructor(inputOrPolicyId) { + const input = typeof inputOrPolicyId === "string" ? { policyId: inputOrPolicyId } : inputOrPolicyId; + super(input); + } + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/policies/${this.input.policyId}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(PolicySchema, rawResponse); + } +}; + +// src/commands/iam/policies/id/update-policy.ts +init_command(); +init_parse_response_helper(); +var PolicyUpdateCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "PATCH"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/policies/${this.input.policyId}`; + } + /** + * Get the body + */ + getBody() { + const { ...rest } = this.input; + return { + ...rest, + flowcoreManaged: rest.flowcoreManaged ?? false + }; + } + getHeaders() { + return { ...super.getHeaders(), "x-flowcore-policy-conditions": "1" }; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(PolicySchema, rawResponse); + } +}; + +// src/commands/iam/policy-associations/get-key-policies.ts +init_command(); +init_parse_response_helper(); +var parseKeyPoliciesResponse = (rawResponse) => { + if (!rawResponse) { + return []; + } + if (!Array.isArray(rawResponse)) { + if (typeof rawResponse === "object" && "data" in rawResponse) { + return parseKeyPoliciesResponse(rawResponse.data); + } + if (typeof rawResponse === "object" && "policies" in rawResponse) { + return parseKeyPoliciesResponse( + rawResponse.policies + ); + } + return []; + } + try { + return parseResponseHelper(Type.Array(PolicySchema), rawResponse); + } catch (error) { + if (error instanceof Error && error.message.includes("flowcoreManaged") && Array.isArray(rawResponse)) { + const sanitizedPolicies = rawResponse.map((policy) => ({ + ...policy, + // Convert to boolean using double negation + flowcoreManaged: policy.flowcoreManaged === true || !!policy.flowcoreManaged + })); + return parseResponseHelper(Type.Array(PolicySchema), sanitizedPolicies); + } + throw error; + } +}; +var KeyPoliciesCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = true; + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/policy-associations/key/${this.input.keyId}/`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseKeyPoliciesResponse(rawResponse); + } +}; + +// src/commands/iam/policy-associations/get-organization-policies.ts +init_command(); +init_parse_response_helper(); +var OrganizationPoliciesCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = true; + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/policy-associations/organization/${this.input.organizationId}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + if (!rawResponse) { + return []; + } + if (Array.isArray(rawResponse)) { + return rawResponse.map((item) => { + try { + return parseResponseHelper(PolicySchema, item); + } catch (_error) { + const policy = item; + const id = typeof policy.id === "string" ? policy.id : "unknown"; + return { + id, + name: typeof policy.name === "string" ? policy.name : "Unknown Policy", + version: typeof policy.version === "string" ? policy.version : "1.0", + description: typeof policy.description === "string" ? policy.description : "", + flowcoreManaged: Boolean(policy.flowcoreManaged), + policyDocuments: Array.isArray(policy.policyDocuments) ? policy.policyDocuments : [], + organizationId: this.input.organizationId, + frn: typeof policy.frn === "string" ? policy.frn : `frn::${this.input.organizationId}:policy/${id}`, + archived: policy.archived === void 0 ? false : Boolean(policy.archived) + }; + } + }); + } + return parseResponseHelper(Type.Array(PolicySchema), rawResponse); + } +}; + +// src/commands/iam/policy-associations/get-policy-associations.ts +init_command(); +init_parse_response_helper(); +var PolicyKeyAssociationSchema = Type.Object({ + policyId: Type.String(), + organizationId: Type.String(), + keyId: Type.String() +}); +var PolicyUserAssociationSchema = Type.Object({ + policyId: Type.String(), + organizationId: Type.String(), + userId: Type.String() +}); +var PolicyRoleAssociationSchema = Type.Object({ + policyId: Type.String(), + organizationId: Type.String(), + roleId: Type.String() +}); +var PolicyAssociationsSchema = Type.Object({ + keys: Type.Array(PolicyKeyAssociationSchema), + users: Type.Array(PolicyUserAssociationSchema), + roles: Type.Array(PolicyRoleAssociationSchema) +}); +var parsePolicyAssociationsResponse = (rawResponse) => { + try { + return parseResponseHelper(PolicyAssociationsSchema, rawResponse); + } catch (_error) { + if (!rawResponse || typeof rawResponse !== "object") { + return { keys: [], users: [], roles: [] }; + } + const rawData = rawResponse; + let keys = Array.isArray(rawData.keys) ? rawData.keys : []; + let users = Array.isArray(rawData.users) ? rawData.users : []; + let roles = Array.isArray(rawData.roles) ? rawData.roles : []; + try { + keys = parseResponseHelper(Type.Array(PolicyKeyAssociationSchema), keys); + } catch (_error2) { + keys = []; + } + try { + users = parseResponseHelper( + Type.Array(PolicyUserAssociationSchema), + users + ); + } catch (_error2) { + users = []; + } + try { + roles = parseResponseHelper( + Type.Array(PolicyRoleAssociationSchema), + roles + ); + } catch (_error2) { + roles = []; + } + return { keys, users, roles }; + } +}; +var PolicyAssociationsCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = true; + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/policy-associations/${this.input.policyId}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parsePolicyAssociationsResponse(rawResponse); + } +}; + +// src/commands/iam/policy-associations/get-role-policies.ts +init_command(); +init_parse_response_helper(); +var parseRolePoliciesResponse = (rawResponse) => { + try { + return parseResponseHelper(Type.Array(PolicySchema), rawResponse); + } catch (error) { + if (error instanceof Error && error.message.includes("flowcoreManaged") && Array.isArray(rawResponse)) { + const sanitizedPolicies = rawResponse.map((policy) => ({ + ...policy, + // Convert to boolean with explicit type-safe conversion + flowcoreManaged: policy.flowcoreManaged === true || policy.flowcoreManaged === "true" || typeof policy.flowcoreManaged === "boolean" && policy.flowcoreManaged + })); + return parseResponseHelper(Type.Array(PolicySchema), sanitizedPolicies); + } + throw error; + } +}; +var RolePoliciesCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = true; + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/policy-associations/role/${this.input.roleId}/`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseRolePoliciesResponse(rawResponse); + } +}; + +// src/commands/iam/policy-associations/get-user-policies.ts +init_command(); +init_parse_response_helper(); +var UserPoliciesCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = true; + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/policy-associations/user/${this.input.userId}/`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(Type.Array(PolicySchema), rawResponse); + } +}; + +// src/commands/iam/policy-associations/link-key-policy.ts +init_command(); +init_parse_response_helper(); +var KeyPolicyLinkSchema = Type.Object({ + policyId: Type.String(), + organizationId: Type.String(), + keyId: Type.String() +}); +var LinkKeyPolicyCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/policy-associations/key/${this.input.keyId}/`; + } + /** + * Get the body + */ + getBody() { + return { + policyId: this.input.policyId + }; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(KeyPolicyLinkSchema, rawResponse); + } +}; + +// src/commands/iam/policy-associations/link-role-policy.ts +init_command(); +init_parse_response_helper(); +var RolePolicyLinkSchema = Type.Object({ + policyId: Type.String(), + organizationId: Type.String(), + roleId: Type.String() +}); +var LinkRolePolicyCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/policy-associations/role/${this.input.roleId}/`; + } + /** + * Get the body + */ + getBody() { + return { + policyId: this.input.policyId + }; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(RolePolicyLinkSchema, rawResponse); + } +}; + +// src/commands/iam/policy-associations/link-user-policy.ts +init_command(); +init_parse_response_helper(); +var UserPolicyLinkSchema = Type.Object({ + policyId: Type.String(), + organizationId: Type.String(), + userId: Type.String() +}); +var LinkUserPolicyCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/policy-associations/user/${this.input.userId}/`; + } + /** + * Get the body + */ + getBody() { + return { + policyId: this.input.policyId + }; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(UserPolicyLinkSchema, rawResponse); + } +}; + +// src/commands/iam/policy-associations/unlink-key-policy.ts +init_command(); +init_parse_response_helper(); +var UnlinkKeyPolicyCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "DELETE"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/policy-associations/key/${this.input.keyId}/`; + } + /** + * Get the body + */ + getBody() { + return { + policyId: this.input.policyId + }; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(KeyPolicyLinkSchema, rawResponse); + } +}; + +// src/commands/iam/policy-associations/unlink-role-policy.ts +init_command(); +init_parse_response_helper(); +var UnlinkRolePolicyCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "DELETE"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/policy-associations/role/${this.input.roleId}/`; + } + /** + * Get the body + */ + getBody() { + return { + policyId: this.input.policyId + }; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(RolePolicyLinkSchema, rawResponse); + } +}; + +// src/commands/iam/policy-associations/unlink-user-policy.ts +init_command(); +init_parse_response_helper(); +var UnlinkUserPolicyCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "DELETE"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/policy-associations/user/${this.input.userId}/`; + } + /** + * Get the body + */ + getBody() { + return { + policyId: this.input.policyId + }; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(UserPolicyLinkSchema, rawResponse); + } +}; + +// src/commands/iam/role-associations/get-key-roles.ts +init_command(); +init_parse_response_helper(); + +// src/commands/iam/roles/create-role.ts +init_command(); +init_parse_response_helper(); +var RoleSchema = Type.Object({ + id: Type.String(), + organizationId: Type.String(), + name: Type.String(), + description: Type.Optional(Type.String()), + flowcoreManaged: Type.Optional(Type.Boolean({ default: false })), + archived: Type.Optional(Type.Boolean()) +}); +var RoleCreateCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return "/api/v1/roles/"; + } + /** + * Get the body + */ + getBody() { + return { + ...this.input, + flowcoreManaged: this.input.flowcoreManaged ?? false + }; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(RoleSchema, rawResponse); + } +}; + +// src/commands/iam/role-associations/get-key-roles.ts +var KeyRolesCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = true; + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/role-associations/key/${this.input.keyId}/`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(Type.Array(RoleSchema), rawResponse); + } +}; + +// src/commands/iam/role-associations/get-organization-roles.ts +init_command(); +init_parse_response_helper(); +var FlexibleRoleSchema = Type.Object({ + id: Type.String(), + organizationId: Type.String(), + name: Type.String(), + description: Type.Optional(Type.String()), + flowcoreManaged: Type.Boolean(), + archived: Type.Optional(Type.Boolean()), + frn: Type.String(), + createdAt: Type.Optional(Type.String()), + updatedAt: Type.Optional(Type.String()) +}); +var OrganizationRolesCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = true; + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/role-associations/organization/${this.input.organizationId}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + const flexibleRoles = parseResponseHelper( + Type.Array(FlexibleRoleSchema), + rawResponse + ); + return flexibleRoles.map((role) => ({ + ...role, + archived: role.archived !== void 0 ? role.archived : false + })); + } +}; + +// src/commands/iam/role-associations/get-role-associations.ts +init_command(); +init_parse_response_helper(); +var RoleKeyAssociationSchema = Type.Object({ + roleId: Type.String(), + organizationId: Type.String(), + keyId: Type.String() +}); +var RoleUserAssociationSchema = Type.Object({ + roleId: Type.String(), + organizationId: Type.String(), + userId: Type.String() +}); +var RoleAssociationsSchema = Type.Object({ + keys: Type.Array(RoleKeyAssociationSchema), + users: Type.Array(RoleUserAssociationSchema) +}); +var RoleAssociationsCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = true; + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/role-associations/${this.input.roleId}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(RoleAssociationsSchema, rawResponse); + } +}; + +// src/commands/iam/role-associations/get-user-roles.ts +init_command(); +init_parse_response_helper(); +var UserRolesCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = true; + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + const basePath = `/api/v1/role-associations/user/${this.input.userId}/`; + if (this.input.organizationId) { + return `${basePath}?organizationId=${this.input.organizationId}`; + } + return basePath; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(Type.Array(RoleSchema), rawResponse); + } +}; + +// src/commands/iam/role-associations/link-key-role.ts +init_command(); +init_parse_response_helper(); +var KeyRoleLinkSchema = Type.Object({ + roleId: Type.String(), + organizationId: Type.String(), + keyId: Type.String() +}); +var LinkKeyRoleCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/role-associations/key/${this.input.keyId}/`; + } + /** + * Get the body + */ + getBody() { + return { + roleId: this.input.roleId + }; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(KeyRoleLinkSchema, rawResponse); + } +}; + +// src/commands/iam/role-associations/link-user-role.ts +init_command(); +init_parse_response_helper(); +var UserRoleLinkSchema = Type.Object({ + roleId: Type.String(), + organizationId: Type.String(), + userId: Type.String() +}); +var LinkUserRoleCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/role-associations/user/${this.input.userId}/`; + } + /** + * Get the body + */ + getBody() { + return { + roleId: this.input.roleId + }; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(UserRoleLinkSchema, rawResponse); + } +}; + +// src/commands/iam/role-associations/unlink-key-role.ts +init_command(); +init_parse_response_helper(); +var UnlinkKeyRoleCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "DELETE"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/role-associations/key/${this.input.keyId}/`; + } + /** + * Get the body + */ + getBody() { + return { + roleId: this.input.roleId + }; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(KeyRoleLinkSchema, rawResponse); + } +}; + +// src/commands/iam/role-associations/unlink-user-role.ts +init_command(); +init_parse_response_helper(); +var UnlinkUserRoleCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "DELETE"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/role-associations/user/${this.input.userId}/`; + } + /** + * Get the body + */ + getBody() { + return { + roleId: this.input.roleId + }; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(UserRoleLinkSchema, rawResponse); + } +}; + +// src/commands/iam/roles/get-roles.ts +init_command(); +init_parse_response_helper(); +var RoleListCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = true; + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return "/api/v1/roles/"; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(Type.Array(RoleSchema), rawResponse); + } +}; + +// src/commands/iam/roles/id/archive-role.ts +init_command(); +init_parse_response_helper(); +var ArchiveRoleResponseSchema = Type.Object({ + message: Type.String() +}); +var RoleArchiveCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "DELETE"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/roles/${this.input.roleId}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(ArchiveRoleResponseSchema, rawResponse); + } +}; + +// src/commands/iam/roles/id/get-role.ts +init_command(); +init_parse_response_helper(); +var RoleGetCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = true; + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/roles/${this.input.roleId}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(RoleSchema, rawResponse); + } +}; + +// src/commands/iam/roles/id/update-role.ts +init_command(); +init_parse_response_helper(); +var RoleUpdateCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "PATCH"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/roles/${this.input.roleId}`; + } + /** + * Get the body + */ + getBody() { + const { roleId, ...rest } = this.input; + return { + id: roleId, + ...rest, + flowcoreManaged: rest.flowcoreManaged ?? false + }; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(RoleSchema, rawResponse); + } +}; + +// src/commands/iam/tenant-iam-audit/get-audit-for-tenant.ts +init_command(); +init_parse_response_helper(); +var AuditLogEntrySchema = Type.Object({ + id: Type.String(), + event: Type.String(), + resourceName: Type.String(), + performedBy: Type.Union([ + Type.String(), + Type.Object({}), + // Allow performedBy to be any object + Type.Null() + // Or null + ]), + timestamp: Type.String(), + status: Type.String() +}); +var PaginationSchema = Type.Object({ + page: Type.Number(), + pageSize: Type.Number(), + totalItems: Type.Number(), + totalPages: Type.Number() +}); +var AuditLogResponseSchema = Type.Object({ + logs: Type.Array(AuditLogEntrySchema), + pagination: PaginationSchema +}); +var TenantAuditLogsCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = true; + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + let path = `/api/v1/tenant-iam-audit/${this.input.tenantId}`; + const queryParams = []; + if (this.input.page !== void 0) { + queryParams.push( + `page=${encodeURIComponent(this.input.page.toString())}` + ); + } + if (this.input.pageSize !== void 0) { + queryParams.push( + `pageSize=${encodeURIComponent(this.input.pageSize.toString())}` + ); + } + if (this.input.resourceType) { + queryParams.push( + `resourceType=${encodeURIComponent(this.input.resourceType)}` + ); + } + if (this.input.performedBy) { + queryParams.push( + `performedBy=${encodeURIComponent(this.input.performedBy)}` + ); + } + if (this.input.status) { + queryParams.push(`status=${encodeURIComponent(this.input.status)}`); + } + if (this.input.startDate) { + queryParams.push(`startDate=${encodeURIComponent(this.input.startDate)}`); + } + if (this.input.endDate) { + queryParams.push(`endDate=${encodeURIComponent(this.input.endDate)}`); + } + if (queryParams.length > 0) { + path += `?${queryParams.join("&")}`; + } + return path; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + if (!rawResponse) { + return { + logs: [], + pagination: { page: 1, pageSize: 20, totalItems: 0, totalPages: 0 } + }; + } + return parseResponseHelper(AuditLogResponseSchema, rawResponse); + } +}; + +// src/commands/iam/validate/validate-key.ts +init_command(); +init_parse_response_helper(); + +// src/commands/iam/validate/validate-user.ts +init_command(); +init_parse_response_helper(); +var ValidPolicySchema = Type.Object({ + policyFrn: Type.String(), + statementId: Type.String() +}); +var ValidationResponseSchema = Type.Object({ + valid: Type.Boolean(), + checksum: Type.String(), + validPolicies: Type.Array(ValidPolicySchema) +}); +var ValidateUserCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = true; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/validate/users/${this.input.userId}`; + } + /** + * Get the body + */ + getBody() { + const { ...rest } = this.input; + return rest; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(ValidationResponseSchema, rawResponse); + } +}; + +// src/commands/iam/validate/validate-key.ts +var ValidateKeyCommand = class extends Command { + /** + * Whether the command should retry on failure + */ + retryOnFailure = true; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/validate/keys/${this.input.keyId}`; + } + /** + * Get the body + */ + getBody() { + const { ...rest } = this.input; + return rest; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(ValidationResponseSchema, rawResponse); + } +}; + +// src/commands/iam/entitlements/resolve-user-entitlements.ts +init_command(); +init_parse_response_helper(); +var EntitlementResponseSchema = Type.Object({ + valid: Type.Literal(true), + requestChecksum: Type.String(), + entitlementChecksum: Type.String(), + cacheTtlSeconds: Type.Number(), + entitlements: Type.Array( + Type.Object({ + requestIndex: Type.Number(), + grants: Type.Array( + Type.Object({ + policyFrn: Type.String(), + statementId: Type.String(), + resource: Type.String(), + filters: Type.Optional(Type.Array(PolicyFilterSchema)) + }) + ) + }) + ) +}); +function parseEntitlementResponse(rawResponse) { + return parseResponseHelper(EntitlementResponseSchema, rawResponse); +} +var ResolveUserEntitlementsCommand = class extends Command { + retryOnFailure = true; + getMethod() { + return "POST"; + } + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + getPath() { + return `/api/v1/entitlements/users/${this.input.userId}`; + } + getBody() { + return { mode: this.input.mode, requestedAccess: this.input.requestedAccess }; + } + parseResponse(rawResponse) { + return parseEntitlementResponse(rawResponse); + } +}; + +// src/commands/iam/entitlements/resolve-key-entitlements.ts +init_command(); +init_parse_response_helper(); +var ResolveKeyEntitlementsCommand = class extends Command { + retryOnFailure = true; + getMethod() { + return "POST"; + } + getBaseUrl() { + return "https://iam.api.flowcore.io"; + } + getPath() { + return `/api/v1/entitlements/keys/${this.input.keyId}`; + } + getBody() { + return { mode: this.input.mode, requestedAccess: this.input.requestedAccess }; + } + parseResponse(rawResponse) { + return parseResponseHelper(EntitlementResponseSchema, rawResponse); + } +}; + +// src/commands/compute/compute-domain.attach.ts +init_command(); +var ComputeNoContentSchema = Type.Object({ + /** The HTTP status the service answered with (always 204) */ + status: Type.Number() +}); +var ComputeWorkloadStatusSchema = Type.Union([ + Type.Literal("pending"), + Type.Literal("running"), + Type.Literal("stopped"), + Type.Literal("failed"), + Type.Literal("archived") +]); +var ComputeWorkloadKindSchema = Type.Union([ + Type.Literal("service"), + Type.Literal("job") +]); +var ComputeSlotTierSchema = Type.Union([ + Type.Literal("nano"), + Type.Literal("micro"), + Type.Literal("small"), + Type.Literal("medium"), + Type.Literal("large") +]); +var ComputeProbeHttpGetSchema = Type.Object({ + /** Request path (defaults to `/` server-side) */ + path: Type.Optional(Type.String()), + /** Container port to probe */ + port: Type.Number(), + /** Extra request headers */ + headers: Type.Optional(Type.Record(Type.String(), Type.String())) +}); +var ComputeProbeTcpSocketSchema = Type.Object({ + /** Container port to dial */ + port: Type.Number() +}); +var ComputeProbeExecSchema = Type.Object({ + /** Command and arguments to run inside the container */ + command: Type.Array(Type.String()) +}); +var ComputeProbeSchema = Type.Object({ + /** HTTP GET handler */ + httpGet: Type.Optional(ComputeProbeHttpGetSchema), + /** TCP socket handler */ + tcpSocket: Type.Optional(ComputeProbeTcpSocketSchema), + /** Exec handler */ + exec: Type.Optional(ComputeProbeExecSchema), + /** Delay before the first probe */ + initialDelaySeconds: Type.Optional(Type.Number()), + /** Seconds between probes */ + periodSeconds: Type.Optional(Type.Number()), + /** Per-probe timeout in seconds */ + timeoutSeconds: Type.Optional(Type.Number()), + /** Consecutive failures before the probe is considered failed */ + failureThreshold: Type.Optional(Type.Number()) +}); +var ComputeWorkloadProbesSchema = Type.Object({ + /** Startup probe */ + startup: Type.Optional(ComputeProbeSchema), + /** Readiness probe */ + readiness: Type.Optional(ComputeProbeSchema), + /** Liveness probe */ + liveness: Type.Optional(ComputeProbeSchema) +}); +var ComputePreSyncSpecSchema = Type.Object({ + /** Label reported as `progress.preSync.name` (defaults to `pre-sync`) */ + name: Type.Optional(Type.String()), + /** Image the hook runs */ + image: Type.String(), + /** Command and arguments the hook runs */ + command: Type.Array(Type.String()), + /** Deadline for the hook (defaults to 300 server-side) */ + timeoutSeconds: Type.Optional(Type.Number()) +}); +var ComputeWorkloadScalingModeSchema = Type.Union([ + Type.Literal("manual"), + Type.Literal("hpa") +]); +var ComputeWorkloadScalingSchema = Type.Object({ + /** `manual` (default) or `hpa` */ + mode: Type.Optional(ComputeWorkloadScalingModeSchema), + /** The autoscaler's floor, 1..50. Also the count a create and a resume start at under `hpa` */ + minReplicas: Type.Optional(Type.Number()), + /** The autoscaler's ceiling, 1..50 — the number the tenant quota pre-flight measures */ + maxReplicas: Type.Optional(Type.Number()), + /** Target average CPU utilization, 1..100 percent of the slot's request */ + targetCpuPercent: Type.Optional(Type.Number()), + /** Target average memory utilization, 1..100 percent of the slot's request */ + targetMemoryPercent: Type.Optional(Type.Number()) +}); +var ComputeWorkloadEnvVarSchema = Type.Object({ + /** Variable name, e.g. `GREETING` */ + name: Type.String(), + /** Variable value, stored and replayed as-is */ + value: Type.String() +}); +var ComputeWorkloadSecretRefSchema = Type.Object({ + /** Variable name as the container sees it, e.g. `TOKEN` */ + name: Type.String(), + /** The key in the tenant's organization secrets that supplies the value */ + secretKey: Type.String() +}); +var ComputeWorkloadVolumeSchema = Type.Object({ + /** Lowercase DNS label, max 20 chars — embedded in the claim's object name */ + name: Type.String(), + /** Provisioned size in Gi, 1..1024 — growth-only after create */ + sizeGi: Type.Number(), + /** Absolute mount path inside the container (never `/`) */ + mountPath: Type.String() +}); +var ComputeWorkloadDefinitionSchema = Type.Object({ + /** Container image reference */ + image: Type.String(), + /** Compute slot tier */ + slotTier: ComputeSlotTierSchema, + /** Service or run-to-completion job (defaults to `service`) */ + kind: Type.Optional(ComputeWorkloadKindSchema), + /** Fixed replica count under `scaling.mode: "manual"` (defaults to 1) */ + replicas: Type.Optional(Type.Number()), + /** The container's listening port (defaults to 8080) */ + port: Type.Optional(Type.Number()), + /** Startup, readiness and liveness probes */ + probes: Type.Optional(ComputeWorkloadProbesSchema), + /** The pre-sync hook that gates every apply of this definition */ + preSync: Type.Optional(ComputePreSyncSpecSchema), + /** How the replica count is decided (defaults to `{ mode: "manual" }`) */ + scaling: Type.Optional(ComputeWorkloadScalingSchema), + /** Plain environment variables (defaults to an empty list) */ + env: Type.Optional(Type.Array(ComputeWorkloadEnvVarSchema)), + /** Organization-secret bindings, by key reference (defaults to an empty list) */ + secrets: Type.Optional(Type.Array(ComputeWorkloadSecretRefSchema)), + /** Persistent volumes, max 4 (defaults to an empty list). See ComputeWorkloadVolumeSchema */ + volumes: Type.Optional(Type.Array(ComputeWorkloadVolumeSchema)) +}); +var ComputeWorkloadSchema = Type.Object({ + /** The workload id (full UUID) */ + id: Type.String(), + /** The owning tenant id (full UUID) */ + tenantId: Type.String(), + /** Human name of the workload */ + name: Type.String(), + /** Lifecycle state */ + status: ComputeWorkloadStatusSchema, + /** Observed ready replica count, as reported by the reconciler */ + readyReplicas: Type.Number(), + /** Explanation of the latest non-healthy transition */ + reason: Type.Optional(Type.String()), + /** The definition of the ACTIVE revision */ + definition: Type.Optional(ComputeWorkloadDefinitionSchema), + /** Ordinal of the revision the platform has accepted as current */ + activeRevision: Type.Optional(Type.Number()), + /** When the active revision came from a rollback, the ordinal it was taken from */ + rolledBackFrom: Type.Optional(Type.Number()), + /** Whether the workload was deliberately paused (scaled to zero) */ + paused: Type.Optional(Type.Boolean()), + /** ISO-8601 creation timestamp */ + createdAt: Type.String(), + /** ISO-8601 last-update timestamp */ + updatedAt: Type.String() +}); +var ComputeWorkloadRunKindSchema = Type.Union([ + Type.Literal("batch"), + Type.Literal("pre_sync") +]); +var ComputeWorkloadRunStatusSchema = Type.Union([ + Type.Literal("running"), + Type.Literal("succeeded"), + Type.Literal("failed") +]); +var ComputeWorkloadRunSchema = Type.Object({ + /** The run id (full UUID) */ + id: Type.String(), + /** The workload the run belongs to (full UUID) */ + workloadId: Type.String(), + /** The owning tenant id (full UUID) */ + tenantId: Type.String(), + /** `batch` for an on-demand run, `pre_sync` for a deploy hook */ + kind: ComputeWorkloadRunKindSchema, + /** The Kubernetes Job object name (`run-` or `pre-sync--r`) */ + name: Type.String(), + /** Run state */ + status: ComputeWorkloadRunStatusSchema, + /** Explanation of a failure */ + reason: Type.Optional(Type.String()), + /** The operation the run is tracked under (full UUID) */ + operationId: Type.Optional(Type.String()), + /** ISO-8601 start timestamp */ + startedAt: Type.String(), + /** ISO-8601 completion timestamp, absent while the run is in flight */ + completedAt: Type.Optional(Type.String()) +}); +var ComputeWorkloadRunListSchema = Type.Object({ + /** One page of runs, newest first */ + runs: Type.Array(ComputeWorkloadRunSchema), + /** Opaque cursor for the next page; absent on the last page */ + nextCursor: Type.Optional(Type.String()) +}); +var ComputeWorkloadListResponseSchema = Type.Object({ + success: Type.Literal(true), + workloads: Type.Array(ComputeWorkloadSchema) +}); +var ComputeWorkloadResponseSchema = Type.Object({ + success: Type.Literal(true), + workload: ComputeWorkloadSchema +}); +var ComputeWorkloadCreateResponseSchema = Type.Object({ + success: Type.Literal(true), + workload: ComputeWorkloadSchema, + /** Poll `GET /api/v1/operations/{operationId}` for cluster convergence */ + operationId: Type.String() +}); +var ComputeWorkloadMutationResponseSchema = Type.Object({ + success: Type.Literal(true), + workload: ComputeWorkloadSchema, + /** Poll `GET /api/v1/operations/{operationId}` for cluster convergence */ + operationId: Type.String() +}); +var ComputeWorkloadDeleteResponseSchema = Type.Object({ + success: Type.Literal(true), + /** Poll `GET /api/v1/operations/{operationId}` for the teardown */ + operationId: Type.String() +}); +var ComputeWorkloadRunResponseSchema = Type.Object({ + success: Type.Literal(true), + /** The run row, already listed by `GET /runs` */ + run: ComputeWorkloadRunSchema, + /** The run id (full UUID) — also the Kubernetes Job name suffix */ + runId: Type.String(), + /** Poll `GET /api/v1/operations/{operationId}` for the run */ + operationId: Type.String() +}); +var ComputeLogStreamNameSchema = Type.Union([ + Type.Literal("stdout"), + Type.Literal("stderr") +]); +var ComputeLogEntrySchema = Type.Object({ + /** ISO-8601 timestamp of the line */ + timestamp: Type.String(), + /** The pod that emitted it */ + podName: Type.String(), + /** The container that emitted it */ + container: Type.String(), + /** Parsed log level */ + level: Type.String(), + /** The line itself */ + message: Type.String(), + /** `stdout` or `stderr` */ + stream: ComputeLogStreamNameSchema +}); +var ComputeWorkloadLogsSchema = Type.Object({ + /** The workload the lines belong to (full UUID) */ + workloadId: Type.String(), + /** Echo of the requested container filter; `null` when the query was not container-scoped */ + container: Type.Union([Type.String(), Type.Null()]), + /** How many lines matched upstream */ + totalMatches: Type.Number(), + /** The matching lines, newest-first as indexed upstream */ + logs: Type.Array(ComputeLogEntrySchema) +}); +var ComputeLogStreamEventSchema = Type.Object({ + /** ISO-8601 timestamp of the line, from the Kubernetes `timestamps=true` prefix */ + timestamp: Type.String(), + /** The pod that emitted it */ + pod: Type.String(), + /** The container that emitted it */ + container: Type.String(), + /** The line itself, passed through byte-for-byte */ + line: Type.String() +}); +var ComputeDomainStatusSchema = Type.Union([ + Type.Literal("pending_verification"), + Type.Literal("ready"), + Type.Literal("failed"), + Type.Literal("detached") +]); +var ComputeDomainVerificationTypeSchema = Type.Union([ + Type.Literal("cname"), + Type.Literal("platform_wildcard") +]); +var ComputeDomainVerificationSchema = Type.Object({ + /** `cname` for a custom hostname, `platform_wildcard` when the platform owns the zone */ + type: ComputeDomainVerificationTypeSchema, + /** The DNS record the caller must create */ + expectedTarget: Type.String(), + /** Whether the expected record was observed */ + verified: Type.Boolean() +}); +var ComputeDomainTlsStatusSchema = Type.Union([ + Type.Literal("pending_issuance"), + Type.Literal("issued"), + Type.Literal("failed") +]); +var ComputeDomainTlsSchema = Type.Object({ + /** Issuance state */ + status: ComputeDomainTlsStatusSchema, + /** The in-cluster Secret the certificate lands in */ + secretName: Type.String(), + /** The issuing CA, once observed */ + issuer: Type.Optional(Type.String()), + /** ISO-8601 expiry, once observed */ + expiresAt: Type.Optional(Type.String()) +}); +var ComputeDomainSchema = Type.Object({ + /** The domain binding id (full UUID) */ + domainId: Type.String(), + /** The workload the hostname routes to (full UUID) */ + workloadId: Type.String(), + /** The bound hostname */ + hostname: Type.String(), + /** The container port the ingress routes to */ + targetPort: Type.Number(), + /** Lifecycle state of the binding */ + status: ComputeDomainStatusSchema, + /** DNS ownership state */ + verification: ComputeDomainVerificationSchema, + /** Certificate state */ + tls: ComputeDomainTlsSchema, + /** ISO-8601 creation timestamp */ + createdAt: Type.String() +}); +var ComputeDomainListResponseSchema = Type.Object({ + success: Type.Literal(true), + domains: Type.Array(ComputeDomainSchema) +}); +var ComputeDomainVerifyResponseSchema = Type.Object({ + /** The domain binding id (full UUID) */ + domainId: Type.String(), + /** The bound hostname */ + hostname: Type.String(), + /** Lifecycle state after the observation */ + status: ComputeDomainStatusSchema, + /** What the DNS lookup saw */ + verification: ComputeDomainVerificationSchema, + /** What the read-only Certificate GET saw */ + tls: ComputeDomainTlsSchema +}); +var ComputeOperationTypeSchema = Type.Union([ + Type.Literal("workload.deploy"), + Type.Literal("workload.update"), + Type.Literal("workload.rollback"), + Type.Literal("workload.archive"), + Type.Literal("workload.pause"), + Type.Literal("workload.resume"), + Type.Literal("workload.run") +]); +var ComputeOperationStatusSchema = Type.Union([ + Type.Literal("pending"), + Type.Literal("in_progress"), + Type.Literal("succeeded"), + Type.Literal("failed") +]); +var ComputeOperationPhaseSchema = Type.Union([ + Type.Literal("queued"), + Type.Literal("pre_sync_running"), + Type.Literal("pre_sync_failed"), + Type.Literal("deploying"), + Type.Literal("rolling_out"), + Type.Literal("tearing_down"), + Type.Literal("pausing"), + Type.Literal("resuming"), + Type.Literal("running"), + Type.Literal("completed"), + Type.Literal("failed") +]); +var ComputeOperationStepStatusSchema = Type.Union([ + Type.Literal("pending"), + Type.Literal("running"), + Type.Literal("succeeded"), + Type.Literal("failed") +]); +var ComputeOperationPreSyncProgressSchema = Type.Object({ + /** The hook's label */ + name: Type.String(), + /** Step state */ + status: ComputeOperationStepStatusSchema, + /** ISO-8601 start timestamp */ + startedAt: Type.Optional(Type.String()), + /** ISO-8601 completion timestamp */ + completedAt: Type.Optional(Type.String()) +}); +var ComputeOperationDeploymentProgressSchema = Type.Object({ + /** Replicas the Deployment wants */ + desiredReplicas: Type.Number(), + /** Replicas already on the new template */ + updatedReplicas: Type.Number(), + /** Replicas reporting ready */ + readyReplicas: Type.Number() +}); +var ComputeOperationProgressSchema = Type.Object({ + /** The pre-sync hook, when the mutation gated on one */ + preSync: Type.Optional(ComputeOperationPreSyncProgressSchema), + /** The rollout, once it started */ + deployment: Type.Optional(ComputeOperationDeploymentProgressSchema) +}); +var ComputeOperationSchema = Type.Object({ + /** The operation id (full UUID) */ + operationId: Type.String(), + /** The workload the operation mutates (full UUID) */ + workloadId: Type.String(), + /** What kind of mutation this is */ + type: ComputeOperationTypeSchema, + /** Overall state */ + status: ComputeOperationStatusSchema, + /** Where the reconciler currently is */ + phase: ComputeOperationPhaseSchema, + /** Progress detail */ + progress: ComputeOperationProgressSchema, + /** Explanation of a non-succeeded outcome */ + reason: Type.Optional(Type.String()), + /** ISO-8601 creation timestamp */ + createdAt: Type.String(), + /** ISO-8601 last-update timestamp */ + updatedAt: Type.String() +}); +var ComputeWorkloadRevisionCauseSchema = Type.Union([ + Type.Literal("created"), + Type.Literal("update"), + Type.Literal("rollback") +]); +var ComputeWorkloadRevisionSchema = Type.Object({ + /** The revision ordinal, 1-based and monotonic per workload */ + revision: Type.Number(), + /** The container image this revision was recorded with */ + image: Type.String(), + /** The slot tier, absent on a row recorded before the field existed */ + slotTier: Type.Optional(ComputeSlotTierSchema), + /** Why the revision exists — `created`, `update` or `rollback` */ + cause: ComputeWorkloadRevisionCauseSchema, + /** At most one revision per workload is active */ + isActive: Type.Boolean(), + /** The ordinal a rollback restored from; present only on a rollback revision */ + rolledBackFrom: Type.Optional(Type.Number()), + /** The operation carrying this revision to the cluster (full UUID), when there is one */ + operationId: Type.Optional(Type.String()), + /** The operation's verdict; ABSENT when the revision names no operation */ + outcome: Type.Optional(ComputeOperationStatusSchema), + /** The operation's explanation of a non-succeeded outcome */ + outcomeReason: Type.Optional(Type.String()), + /** ISO-8601 creation timestamp */ + createdAt: Type.String() +}); +var ComputeWorkloadRevisionListSchema = Type.Object({ + /** One page of revisions, newest ordinal first */ + revisions: Type.Array(ComputeWorkloadRevisionSchema), + /** Opaque cursor for the next page; absent on the last page */ + nextCursor: Type.Optional(Type.String()) +}); +var ComputeDeploymentEventObjectSchema = Type.Object({ + /** The Kubernetes kind */ + kind: Type.String(), + /** The object's name */ + name: Type.String() +}); +var ComputeDeploymentEventSchema = Type.Object({ + /** The event object's own name, stable for the life of the event */ + name: Type.String(), + /** `Normal` or `Warning` in practice, but free-form on the wire */ + type: Type.String(), + /** The machine-readable reason, e.g. `Scheduled`, `BackOff` */ + reason: Type.String(), + /** The human-readable message; may be empty */ + message: Type.String(), + /** How many times the event has recurred; 1 for a single occurrence */ + count: Type.Number(), + /** The object the event is about */ + object: ComputeDeploymentEventObjectSchema, + /** The controller that reported it — kubelet, deployment-controller, … */ + source: Type.Optional(Type.String()), + /** ISO-8601 timestamp of the first occurrence */ + firstSeen: Type.Optional(Type.String()), + /** ISO-8601 timestamp of the most recent occurrence */ + lastSeen: Type.Optional(Type.String()) +}); +var ComputeWorkloadDeploymentEventsSchema = Type.Object({ + /** The workload the events belong to (full UUID) */ + workloadId: Type.String(), + /** The cluster's recent events, most recently seen first; possibly empty */ + events: Type.Array(ComputeDeploymentEventSchema) +}); +var ComputeRegistrySchema = Type.Object({ + /** The registry id (full UUID) */ + registryId: Type.String(), + /** Human label */ + name: Type.String(), + /** Registry host as a container runtime addresses it, e.g. `ghcr.io` */ + serverUrl: Type.String(), + /** The robot account the pull credential belongs to */ + username: Type.String(), + /** Whether this is the tenant's default registry */ + isDefault: Type.Boolean(), + /** ISO-8601 creation timestamp */ + createdAt: Type.String(), + /** ISO-8601 last-update timestamp — the rotation timestamp after a rotate */ + updatedAt: Type.String() +}); +var ComputeRegistrySynthesisStateSchema = Type.Union([ + Type.Literal("pending"), + Type.Literal("synthesized"), + Type.Literal("failed") +]); +var ComputeRegistryDetailSchema = Type.Object({ + ...ComputeRegistrySchema.properties, + /** Whether the reconciler turned the credential into a pull Secret */ + synthesisStatus: ComputeRegistrySynthesisStateSchema, + /** The reconciler's explanation of a failed synthesis — never credential material */ + synthesisReason: Type.Optional(Type.String()), + /** ISO-8601 timestamp of the synthesis report */ + synthesisAt: Type.Optional(Type.String()) +}); +var ComputeRegistryListResponseSchema = Type.Object({ + success: Type.Literal(true), + registries: Type.Array(ComputeRegistrySchema) +}); +var ComputeRegistryDetailResponseSchema = Type.Object({ + success: Type.Literal(true), + registry: ComputeRegistryDetailSchema +}); + +// src/commands/compute/compute-domain.attach.ts +init_not_found(); +init_parse_response_helper(); +var ComputeDomainAttachCommand = class extends Command { + /** + * Whether the command should retry on failure. + * + * FALSE: an attach mints a domain id, and a second attach of the same + * hostname answers 409 — a retry of an already-recorded request would + * surface that conflict as the caller's answer. + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://compute.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/workloads/${this.input.workloadId}/domains`; + } + /** + * Get the body for the request. + * + * OVERRIDDEN BECAUSE BOTH BRANCHES OF THE UPSTREAM BODY ARE `.strict()` — + * that is exactly what makes the union a real XOR. The base implementation + * would send `workloadId` (a path parameter) inside the JSON, which matches + * NEITHER branch, so every call would be 422. + */ + getBody() { + const { workloadId: _workloadId, ...payload } = this.input; + return payload; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(ComputeDomainSchema, rawResponse); + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("Workload", { + workloadId: this.input.workloadId + }); + } + throw error; + } +}; + +// src/commands/compute/compute-domain.detach.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var ComputeDomainDetachCommand = class extends Command { + /** + * Get the method + */ + getMethod() { + return "DELETE"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://compute.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/workloads/${this.input.workloadId}/domains/${this.input.domainId}`; + } + /** + * Get the body for the request. The route takes NO body. + */ + getBody() { + return void 0; + } + /** + * Parse the response. + * + * The endpoint answers 204 with an EMPTY body, which `FlowcoreClient` turns + * into `{ status: 204 }` before it reaches here — so this schema describes + * that synthetic object, not anything the service serialized. + */ + parseResponse(rawResponse) { + return parseResponseHelper(ComputeNoContentSchema, rawResponse); + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("Domain", { + workloadId: this.input.workloadId, + domainId: this.input.domainId + }); + } + throw error; + } +}; + +// src/commands/compute/compute-domain.list.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var ComputeDomainListCommand = class extends Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://compute.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/workloads/${this.input.workloadId}/domains`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(ComputeDomainListResponseSchema, rawResponse).domains; + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("Workload", { + workloadId: this.input.workloadId + }); + } + throw error; + } +}; + +// src/commands/compute/compute-domain.verify.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var ComputeDomainVerifyCommand = class extends Command { + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://compute.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/workloads/${this.input.workloadId}/domains/${this.input.domainId}/verify`; + } + /** + * Get the body for the request. The route takes NO body. + */ + getBody() { + return void 0; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(ComputeDomainVerifyResponseSchema, rawResponse); + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("Domain", { + workloadId: this.input.workloadId, + domainId: this.input.domainId + }); + } + throw error; + } +}; + +// src/commands/compute/compute-operation.fetch.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var ComputeOperationFetchCommand = class extends Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://compute.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/operations/${this.input.operationId}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(ComputeOperationSchema, rawResponse); + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("Operation", { + operationId: this.input.operationId + }); + } + throw error; + } +}; + +// src/commands/compute/compute-registry.fetch.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var ComputeRegistryFetchCommand = class extends Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://compute.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/registries/${this.input.registryId}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(ComputeRegistryDetailResponseSchema, rawResponse).registry; + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("Registry", { + registryId: this.input.registryId + }); + } + throw error; + } +}; + +// src/commands/compute/compute-registry.list.ts +init_command(); +init_parse_response_helper(); +var ComputeRegistryListCommand = class extends Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://compute.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + const queryParams = new URLSearchParams(); + queryParams.set("tenantId", this.input.tenantId); + return `/api/v1/registries?${queryParams.toString()}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(ComputeRegistryListResponseSchema, rawResponse).registries; + } +}; + +// src/commands/compute/compute-registry.register.ts +init_command(); +init_parse_response_helper(); +var ComputeRegistryRegisterCommand = class extends Command { + /** + * Whether the command should retry on failure. + * + * FALSE: a registration mints a registry id, and a second registration of + * the same `serverUrl` answers 409 — a retry of an already-recorded request + * would surface that conflict as the caller's answer. + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://compute.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return "/api/v1/registries"; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(ComputeRegistrySchema, rawResponse); + } +}; + +// src/commands/compute/compute-registry.remove.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var ComputeRegistryRemoveCommand = class extends Command { + /** + * Get the method + */ + getMethod() { + return "DELETE"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://compute.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/registries/${this.input.registryId}`; + } + /** + * Get the body for the request. The route takes NO body. + */ + getBody() { + return void 0; + } + /** + * Parse the response. + * + * The endpoint answers 204 with an EMPTY body, which `FlowcoreClient` turns + * into `{ status: 204 }` before it reaches here. + */ + parseResponse(rawResponse) { + return parseResponseHelper(ComputeNoContentSchema, rawResponse); + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("Registry", { + registryId: this.input.registryId + }); + } + throw error; + } +}; + +// src/commands/compute/compute-registry.rotate.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var ComputeRegistryRotateCommand = class extends Command { + /** + * Get the method + */ + getMethod() { + return "PATCH"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://compute.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/registries/${this.input.registryId}`; + } + /** + * Get the body for the request. + * + * OVERRIDDEN BECAUSE THE UPSTREAM BODY IS `.strict()` AND DELIBERATELY + * NARROW — `{ secret }` and nothing else, so that an attempt to smuggle a + * `serverUrl` or `isDefault` change through the rotation path is a 422. The + * base implementation would send `registryId`, a path parameter, inside the + * JSON and every call would be refused. + */ + getBody() { + const { registryId: _registryId, ...payload } = this.input; + return payload; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(ComputeRegistrySchema, rawResponse); + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("Registry", { + registryId: this.input.registryId + }); + } + throw error; + } +}; + +// src/commands/compute/compute-workload-events.list.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var ComputeWorkloadEventsListCommand = class extends Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://compute.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/workloads/${this.input.workloadId}/events`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(ComputeWorkloadDeploymentEventsSchema, rawResponse); + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("Workload", { + workloadId: this.input.workloadId + }); + } + throw error; + } +}; + +// src/commands/compute/compute-workload-logs.fetch.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var ComputeWorkloadLogsFetchCommand = class extends Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://compute.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + const queryParams = new URLSearchParams(); + if (this.input.since !== void 0) { + queryParams.set("since", this.input.since); + } + if (this.input.until !== void 0) { + queryParams.set("until", this.input.until); + } + if (this.input.search !== void 0) { + queryParams.set("search", this.input.search); + } + if (this.input.limit !== void 0) { + queryParams.set("limit", this.input.limit.toString()); + } + if (this.input.container !== void 0) { + queryParams.set("container", this.input.container); + } + const qs = queryParams.toString(); + const path = `/api/v1/workloads/${this.input.workloadId}/logs`; + return qs ? `${path}?${qs}` : path; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(ComputeWorkloadLogsSchema, rawResponse); + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("Workload", { + workloadId: this.input.workloadId + }); + } + throw error; + } +}; +init_not_found(); +init_parse_response_helper(); +function createSseParser(onFrame) { + let buffer = ""; + let eventName = ""; + let dataLines = []; + let sawField = false; + const dispatch = () => { + if (!sawField) { + return; + } + const frame = { event: eventName || "message", data: dataLines.join("\n") }; + eventName = ""; + dataLines = []; + sawField = false; + onFrame(frame); + }; + return (chunk) => { + buffer += chunk.replace(/\r\n/g, "\n").replace(/\r/g, "\n"); + const lines = buffer.split("\n"); + buffer = lines.pop() ?? ""; + for (const line of lines) { + if (line === "") { + dispatch(); + continue; + } + if (line.startsWith(":")) { + continue; + } + const separator = line.indexOf(":"); + const field = separator === -1 ? line : line.slice(0, separator); + let value = separator === -1 ? "" : line.slice(separator + 1); + if (value.startsWith(" ")) { + value = value.slice(1); + } + if (field === "event") { + eventName = value; + sawField = true; + } else if (field === "data") { + dataLines.push(value); + sawField = true; + } + } + }; +} +function errorFrameMessage(data) { + try { + const parsed = JSON.parse(data); + if (typeof parsed === "object" && parsed !== null && "message" in parsed) { + const { message } = parsed; + if (typeof message === "string" && message.length > 0) { + return message; + } + } + } catch { + } + return data || "The log stream failed after it had started"; +} +var ComputeWorkloadLogStreamCommand = class extends CustomCommand { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://compute.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + const queryParams = new URLSearchParams(); + if (this.input.container !== void 0) { + queryParams.set("container", this.input.container); + } + if (this.input.tailLines !== void 0) { + queryParams.set("tailLines", this.input.tailLines.toString()); + } + const qs = queryParams.toString(); + const path = `/api/v1/workloads/${this.input.workloadId}/logs/stream`; + return qs ? `${path}?${qs}` : path; + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("Workload", { + workloadId: this.input.workloadId + }); + } + throw error; + } + /** + * Custom execute method — opens the SSE connection and returns the stream + */ + async customExecute(client) { + const authHeader = await client.getAuthHeader(); + const abortController = new AbortController(); + const response = await fetch(`${this.getBaseUrl()}${this.getPath()}`, { + method: "GET", + headers: { + Accept: "text/event-stream", + ...authHeader ? { Authorization: authHeader } : {} + }, + signal: abortController.signal + }); + if (!response.ok) { + const body = await response.json().catch(() => void 0); + const error = new ClientError( + `${this.constructor.name} failed with ${response.status}: ${response.statusText}`, + response.status, + this.constructor.name, + body + ); + this.handleClientError(error); + throw error; + } + if (!response.body) { + throw new ClientError("Log stream response had no body", 0, this.constructor.name, { + workloadId: this.input.workloadId + }); + } + const subject = new Subject(); + const reader = response.body.getReader(); + const decoder = new TextDecoder(); + const push = createSseParser((frame) => { + if (frame.event === "error") { + subject.error( + // The message goes in the BODY as well as the message slot: + // ClientError renders `body` in preference to `message`, so text + // passed only as the message would never reach the reader. + new ClientError(errorFrameMessage(frame.data), 0, this.constructor.name, { + workloadId: this.input.workloadId, + message: errorFrameMessage(frame.data) + }) + ); + return; + } + if (frame.event !== "log") { + return; + } + subject.next(parseResponseHelper(ComputeLogStreamEventSchema, JSON.parse(frame.data))); + }); + const pump = async () => { + try { + for (; ; ) { + const { done, value } = await reader.read(); + if (done) { + break; + } + push(decoder.decode(value, { stream: true })); + } + } catch (error) { + if (!abortController.signal.aborted) { + subject.error(error instanceof Error ? error : new Error(String(error))); + return; + } + } + subject.complete(); + }; + let started = false; + const output$ = new Observable((subscriber) => { + const subscription = subject.subscribe(subscriber); + if (!started) { + started = true; + void pump(); + } + return subscription; + }); + return { + output$, + disconnect: () => { + if (abortController.signal.aborted) { + return; + } + abortController.abort(); + void reader.cancel().catch(() => { + }); + subject.complete(); + } + }; + } +}; + +// src/commands/compute/compute-workload-revisions.list.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var ComputeWorkloadRevisionsListCommand = class extends Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://compute.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + const queryParams = new URLSearchParams(); + if (this.input.limit !== void 0) { + queryParams.set("limit", this.input.limit.toString()); + } + if (this.input.cursor !== void 0) { + queryParams.set("cursor", this.input.cursor); + } + const qs = queryParams.toString(); + const path = `/api/v1/workloads/${this.input.workloadId}/revisions`; + return qs ? `${path}?${qs}` : path; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(ComputeWorkloadRevisionListSchema, rawResponse); + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("Workload", { + workloadId: this.input.workloadId + }); + } + throw error; + } +}; + +// src/commands/compute/compute-workload-runs.list.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var ComputeWorkloadRunsListCommand = class extends Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://compute.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + const queryParams = new URLSearchParams(); + if (this.input.limit !== void 0) { + queryParams.set("limit", this.input.limit.toString()); + } + if (this.input.cursor !== void 0) { + queryParams.set("cursor", this.input.cursor); + } + const qs = queryParams.toString(); + const path = `/api/v1/workloads/${this.input.workloadId}/runs`; + return qs ? `${path}?${qs}` : path; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(ComputeWorkloadRunListSchema, rawResponse); + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("Workload", { + workloadId: this.input.workloadId + }); + } + throw error; + } +}; + +// src/commands/compute/compute-workload.create.ts +init_command(); +init_parse_response_helper(); +var ComputeWorkloadCreateCommand = class extends Command { + /** + * Whether the command should retry on failure. + * + * FALSE: a create mints a workload id server-side, so a retried 502 would + * deploy the same workload twice. + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://compute.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return "/api/v1/workloads"; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(ComputeWorkloadResponseSchema, rawResponse).workload; + } +}; + +// src/commands/compute/compute-workload.create-tracked.ts +init_command(); +init_parse_response_helper(); +var ComputeWorkloadCreateTrackedCommand = class extends Command { + retryOnFailure = false; + getMethod() { + return "POST"; + } + getBaseUrl() { + return "https://compute.api.flowcore.io"; + } + getPath() { + return "/api/v1/workloads"; + } + parseResponse(rawResponse) { + return parseResponseHelper(ComputeWorkloadCreateResponseSchema, rawResponse); + } +}; + +// src/commands/compute/compute-workload.delete.ts +init_command(); +init_not_found(); +init_parse_response_helper(); + +// src/commands/compute/wait-for-operation.ts +init_command_error(); +init_not_found(); +var DEFAULT_COMPUTE_OPERATION_TIMEOUT_MS = 6e5; +var DEFAULT_COMPUTE_OPERATION_POLL_INTERVAL_MS = 1e3; +async function waitForComputeOperation(client, commandName, operationId, options) { + const timeoutMs = options.operationTimeoutMs ?? DEFAULT_COMPUTE_OPERATION_TIMEOUT_MS; + const pollIntervalMs = options.operationPollIntervalMs ?? DEFAULT_COMPUTE_OPERATION_POLL_INTERVAL_MS; + const start = Date.now(); + let lastSeen; + while (Date.now() - start < timeoutMs) { + try { + const operation = await client.execute(new ComputeOperationFetchCommand({ operationId })); + lastSeen = operation; + if (operation.status === "succeeded" || operation.status === "failed") { + return operation; + } + } catch (error) { + if (!(error instanceof NotFoundException)) { + throw error; + } + } + await new Promise((resolve) => setTimeout(resolve, pollIntervalMs)); + } + throw new CommandError( + commandName, + lastSeen ? `Operation ${operationId} did not reach a terminal state within ${timeoutMs}ms (last observed status "${lastSeen.status}", phase "${lastSeen.phase}")` : `Operation ${operationId} did not appear within ${timeoutMs}ms \u2014 the reconciler filed no progress report` + ); +} + +// src/commands/compute/compute-workload.delete.ts +var ComputeWorkloadDeleteCommand = class extends Command { + /** + * Get the method + */ + getMethod() { + return "DELETE"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://compute.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/workloads/${this.input.workloadId}`; + } + /** + * Get the body for the request. + * + * The route takes NO body. Left to the base implementation it would send + * the whole input — the path parameter and the client-side wait knobs — as + * JSON on a DELETE. + */ + getBody() { + return void 0; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(ComputeWorkloadDeleteResponseSchema, rawResponse); + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("Workload", { + workloadId: this.input.workloadId + }); + } + throw error; + } + /** + * Optionally wait for the teardown to finish + */ + async processResponse(client, response) { + if (!this.input.waitForOperation) { + return response; + } + const operation = await waitForComputeOperation(client, this.constructor.name, response.operationId, this.input); + return { ...response, operation }; + } +}; + +// src/commands/compute/compute-workload.fetch.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var ComputeWorkloadFetchCommand = class extends Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://compute.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/workloads/${this.input.workloadId}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(ComputeWorkloadResponseSchema, rawResponse).workload; + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("Workload", { + workloadId: this.input.workloadId + }); + } + throw error; + } +}; + +// src/commands/compute/compute-workload.list.ts +init_command(); +init_parse_response_helper(); +var ComputeWorkloadListCommand = class extends Command { + /** + * Get the method + */ + getMethod() { + return "GET"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://compute.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + const queryParams = new URLSearchParams(); + queryParams.set("tenantId", this.input.tenantId); + return `/api/v1/workloads?${queryParams.toString()}`; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(ComputeWorkloadListResponseSchema, rawResponse).workloads; + } +}; + +// src/commands/compute/compute-workload.pause.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var ComputeWorkloadPauseCommand = class extends Command { + /** + * Whether the command should retry on failure. + * + * FALSE: a pause mints an operation id, and the service answers 409 to a + * second pause — a retry of an already-recorded request would surface that + * conflict as the caller's answer. + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://compute.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/workloads/${this.input.workloadId}/pause`; + } + /** + * Get the body for the request. The route takes NO body. + */ + getBody() { + return void 0; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(ComputeWorkloadMutationResponseSchema, rawResponse); + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("Workload", { + workloadId: this.input.workloadId + }); + } + throw error; + } + /** + * Optionally wait for the scale-down to finish + */ + async processResponse(client, response) { + if (!this.input.waitForOperation) { + return response; + } + const operation = await waitForComputeOperation(client, this.constructor.name, response.operationId, this.input); + return { ...response, operation }; + } +}; + +// src/commands/compute/compute-workload.resume.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var ComputeWorkloadResumeCommand = class extends Command { + /** + * Whether the command should retry on failure. + * + * FALSE: a resume mints an operation id, and the service answers 409 to a + * second resume — a retry of an already-recorded request would surface that + * conflict as the caller's answer. + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://compute.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/workloads/${this.input.workloadId}/resume`; + } + /** + * Get the body for the request. The route takes NO body. + */ + getBody() { + return void 0; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(ComputeWorkloadMutationResponseSchema, rawResponse); + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("Workload", { + workloadId: this.input.workloadId + }); + } + throw error; + } + /** + * Optionally wait for the scale-up to finish + */ + async processResponse(client, response) { + if (!this.input.waitForOperation) { + return response; + } + const operation = await waitForComputeOperation(client, this.constructor.name, response.operationId, this.input); + return { ...response, operation }; + } +}; + +// src/commands/compute/compute-workload.rollback.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var ComputeWorkloadRollbackCommand = class extends Command { + /** + * Whether the command should retry on failure. + * + * FALSE: a rollback mints a revision and an operation id, and re-runs the + * target revision's pre-sync hook. + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://compute.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/workloads/${this.input.workloadId}/rollback`; + } + /** + * Get the body for the request. + * + * The route takes NO body — the target revision is derived server-side. + */ + getBody() { + return void 0; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(ComputeWorkloadMutationResponseSchema, rawResponse); + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("Workload", { + workloadId: this.input.workloadId + }); + } + throw error; + } + /** + * Optionally wait for the cluster to converge + */ + async processResponse(client, response) { + if (!this.input.waitForOperation) { + return response; + } + const operation = await waitForComputeOperation(client, this.constructor.name, response.operationId, this.input); + return { ...response, operation }; + } +}; + +// src/commands/compute/compute-workload.run.ts +init_command(); +init_not_found(); +init_parse_response_helper(); +var ComputeWorkloadRunCommand = class extends Command { + /** + * Whether the command should retry on failure. + * + * FALSE: a run mints a run id and spends the tenant's compute quota, so a + * retried 502 would start the job twice. + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "POST"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://compute.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/workloads/${this.input.workloadId}/run`; + } + /** + * Get the body for the request. The route takes NO body. + */ + getBody() { + return void 0; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(ComputeWorkloadRunResponseSchema, rawResponse); + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("Workload", { + workloadId: this.input.workloadId + }); + } + throw error; + } + /** + * Optionally wait for the run to reach a terminal state + */ + async processResponse(client, response) { + if (!this.input.waitForOperation) { + return response; + } + const operation = await waitForComputeOperation(client, this.constructor.name, response.operationId, this.input); + return { ...response, operation }; + } +}; + +// src/commands/compute/compute-workload.update.ts +init_command(); +init_command_error(); +init_not_found(); +init_parse_response_helper(); +var ComputeWorkloadUpdateCommand = class extends Command { + /** + * Whether the command should retry on failure. + * + * FALSE. A PATCH looks idempotent and is not: each call MINTS A REVISION + * and an operation id server-side, and re-applying a revision re-runs the + * workload's pre-sync hook. A retried 502 whose original request had + * already been recorded would append a second identical revision and run + * the migration hook twice. + */ + retryOnFailure = false; + /** + * Get the method + */ + getMethod() { + return "PATCH"; + } + /** + * Get the base url + */ + getBaseUrl() { + return "https://compute.api.flowcore.io"; + } + /** + * Get the path + */ + getPath() { + return `/api/v1/workloads/${this.input.workloadId}`; + } + /** + * Get the body for the request. + * + * OVERRIDDEN BECAUSE THE UPSTREAM BODY IS `.strict()`. The base + * implementation sends the WHOLE input, which would put `workloadId` (a + * path parameter) and the client-side `waitForOperation` / + * `operationTimeoutMs` / `operationPollIntervalMs` knobs into the JSON — + * and every one of them is a key `UpdateWorkloadRequestSchema` does not + * list, so the service would answer 422 on the very first call. + */ + getBody() { + const { + workloadId: _workloadId, + waitForOperation: _waitForOperation, + operationTimeoutMs: _operationTimeoutMs, + operationPollIntervalMs: _operationPollIntervalMs, + ...payload + } = this.input; + if (Object.keys(payload).length === 0) { + throw new CommandError(this.constructor.name, "No fields to update"); + } + return payload; + } + /** + * Parse the response + */ + parseResponse(rawResponse) { + return parseResponseHelper(ComputeWorkloadMutationResponseSchema, rawResponse); + } + /** + * Handle the client error + */ + handleClientError(error) { + if (error.status === 404) { + throw new NotFoundException("Workload", { + workloadId: this.input.workloadId + }); + } + throw error; + } + /** + * Optionally wait for the cluster to converge + */ + async processResponse(client, response) { + if (!this.input.waitForOperation) { + return response; + } + const operation = await waitForComputeOperation(client, this.constructor.name, response.operationId, this.input); + return { ...response, operation }; + } +}; + +// src/mod.ts +init_command(); + +// src/common/flowcore-client.ts +init_command_error(); + +// src/utils/try-catch.ts +async function tryCatch(promise) { + try { + const data = await promise; + return { data, error: null }; + } catch (error) { + return { data: null, error }; + } +} + +// src/common/flowcore-client.ts +init_tenant_cache(); +var RETRYABLE_ERROR_CODES = [408, 429, 500, 502, 503, 504]; +function isClientOptionsBearer(options) { + return "getBearerToken" in options; +} +function isClientOptionsApiKey(options) { + return "apiKey" in options; +} +var FlowcoreClient = class { + constructor(options) { + this.options = options; + if (isClientOptionsBearer(this.options)) { + this.mode = "bearer"; + } else if (isClientOptionsApiKey(this.options)) { + if (!this.options.apiKeyId) { + const parts = this.options.apiKey.split("_"); + if (parts.length !== 3 || parts[0] !== "fc") { + throw new Error("Invalid api key"); + } + this.options.apiKeyId = parts[1]; + } + this.mode = "apiKey"; + } else { + throw new Error("Invalid client options"); + } + if (this.options.retry === void 0) { + this.options.retry = { + delay: 250, + maxRetries: 3 + }; + } + } + options; + mode; + baseUrl; + /** + * Get the auth header + * + * Public so that a `CustomCommand` which owns its own transport — a + * streaming request whose body must NOT be consumed by `innerExecute`'s + * unconditional `response.json()` — can authenticate its own fetch with + * exactly the header every other command sends. Read-only: it derives the + * header from the client options and mutates nothing. + */ + async getAuthHeader() { + if (this.options.getBearerToken) { + const bearerToken = await this.options.getBearerToken(); + if (!bearerToken) { + return null; + } + return `Bearer ${bearerToken}`; + } + if (this.options.apiKeyId && this.options.apiKey) { + return `ApiKey ${this.options.apiKeyId}:${this.options.apiKey}`; + } + return null; + } + /** + * Execute a command (inner method) + */ + async innerExecute(command, retryCount = 0, direct) { + if (typeof command.setClientAuthOptions === "function") { + if (this.options.getBearerToken) { + const bearerToken = await this.options.getBearerToken(); + command.setClientAuthOptions({ token: bearerToken || void 0 }); + } else if (this.options.apiKeyId && this.options.apiKey) { + command.setClientAuthOptions({ + apiKeyId: this.options.apiKeyId, + apiKey: this.options.apiKey + }); + } + } + const request = await command.getRequest(this, direct); + if (request.customExecute) { + return request.customExecute(this); + } + if (!request.allowedModes.includes(this.mode)) { + throw new CommandError(command.constructor.name, `Not allowed in "${this.mode}" mode`); + } + const { data: authHeader, error: authHeaderError } = await tryCatch(this.getAuthHeader()); + if (authHeaderError) { + throw new ClientError("Failed to get auth header", 0, command.constructor.name, { + command: command.constructor.name, + error: authHeaderError + }); + } + const headers = { + ...authHeader ? { Authorization: authHeader } : {}, + ...request.headers + }; + let response; + const url = this.baseUrl ? this.baseUrl + request.path : request.baseUrl + request.path; + let body; + if (typeof request.body === "object") { + body = JSON.stringify(request.body); + } + try { + response = await fetch(url, { + method: request.method, + headers, + body + }); + } catch (error) { + if (request.retryOnFailure && this.options.retry && retryCount < this.options.retry.maxRetries) { + const delay = this.options.retry.delay; + await new Promise((resolve) => setTimeout(resolve, delay)); + return this.innerExecute(command, retryCount + 1, direct); + } + const message = error instanceof Error ? error.message : "Unknown error"; + throw new ClientError(`Failed to execute command: ${message}`, 0, command.constructor.name, { + command: command.constructor.name, + error + }); + } + if (!response.ok) { + if (request.retryOnFailure && this.options.retry && RETRYABLE_ERROR_CODES.includes(response.status) && retryCount < this.options.retry.maxRetries) { + const delay = this.options.retry.delay; + await new Promise((resolve) => setTimeout(resolve, delay)); + return this.innerExecute(command, retryCount + 1, direct); + } + const body2 = await response.json().catch(() => void 0); + const commandName = command.constructor.name; + const error = new ClientError( + `${commandName} failed with ${response.status}: ${response.statusText}`, + response.status, + command.constructor.name, + body2 + ); + request.handleClientError(error); + } + const responseBody = response.status === 204 ? { status: response.status } : await response.json(); + const parsedBody = await request.parseResponse(responseBody); + return request.processResponse(this, parsedBody); + } + /** + * Override the base URL for all commands + */ + setBaseUrl(baseUrl6) { + this.baseUrl = baseUrl6; + } + /** + * Execute a command + */ + execute(command, direct) { + return this.innerExecute(command, 0, direct); + } + /** + * Close the client and clean up resources + * This should be called when the client is no longer needed to prevent memory leaks + */ + close() { + tenantCache.clear(); + } + /** + * Dispose the client + */ + [Symbol.dispose]() { + this.close(); + } +}; + +// src/utils/logger.ts +var defaultLogger = { + debug: (message, meta) => { + console.debug(message, meta); + }, + info: (message, meta) => { + console.info(message, meta); + }, + warn: (message, meta) => { + console.warn(message, meta); + }, + error: (message, meta) => { + console.error(message, meta); + } +}; +var WebSocketConstructor = globalThis.WebSocket ?? WebSocket; +var MAX_RECONNECT_INTERVAL = 3e4; +var NotificationClient = class { + /** + * Creates a new NotificationClient instance + * @param observer - RxJS Subject for emitting notification events + * @param authOptions - Auth options for the client + * @param subscriptionSpec - Specification for what notifications to subscribe to + * @param options - Configuration options for the client + */ + constructor(observer, authOptions, subscriptionSpec, options) { + this.observer = observer; + this.authOptions = authOptions; + this.subscriptionSpec = subscriptionSpec; + this.options = { + reconnectInterval: 1e3, + ...options + }; + this.logger = options?.logger ?? defaultLogger; + this.reconnectInterval = options?.reconnectInterval ?? 1e3; + } + observer; + authOptions; + subscriptionSpec; + url = "wss://tenant.api.flowcore.io/notifications"; + webSocket; + options; + logger; + eventCount = 0; + reconnectInterval; + reconnectAttempts = 0; + _isOpen = false; + _isConnecting = false; + /** + * Which handshake carries the credential. + * + * `subprotocol` is tried first and is the one that does NOT put the + * credential in the URL. `query` is the legacy transport, kept only so this + * client still works against a server that has not shipped subprotocol + * support yet. + */ + authTransport = "subprotocol"; + /** True once a handshake has settled, so the fallback is probed at most once. */ + transportSettled = false; + /** + * Is the websocket connection open + */ + get isOpen() { + return this._isOpen; + } + /** + * Is the websocket connection currently connecting + */ + get isConnecting() { + return this._isConnecting; + } + /** + * Establishes WebSocket connection and sets up event handlers + */ + async connect() { + if (this._isConnecting || this._isOpen) { + this.logger.debug("Is already connecting or open"); + return; + } + this._isConnecting = true; + let flowcoreClient = null; + const urlParams = new URLSearchParams(); + let credential; + if ("oidcClient" in this.authOptions) { + const oidcClient = this.authOptions.oidcClient; + flowcoreClient = new FlowcoreClient({ + getBearerToken: async () => (await oidcClient.getToken()).accessToken + }); + credential = { kind: "bearer", token: (await oidcClient.getToken()).accessToken }; + } else { + flowcoreClient = new FlowcoreClient({ + apiKey: this.authOptions.apiKey, + ...this.authOptions.apiKeyId ? { apiKeyId: this.authOptions.apiKeyId } : {} + }); + credential = { + kind: "apiKey", + apiKey: this.authOptions.apiKey, + ...this.authOptions.apiKeyId ? { apiKeyId: this.authOptions.apiKeyId } : {} + }; + } + const handshake = this.buildCredentialHandshake(credential); + for (const [key, value] of handshake.query) { + urlParams.set(key, value); + } + const credentialProtocols = handshake.protocols; + const dataCore = await flowcoreClient.execute( + new DataCoreFetchCommand({ + tenant: this.subscriptionSpec.tenant, + dataCore: this.subscriptionSpec.dataCore + }) + ); + let flowType; + let eventType; + if (this.subscriptionSpec.flowType) { + flowType = await flowcoreClient.execute( + new FlowTypeFetchCommand({ + dataCoreId: dataCore.id, + flowType: this.subscriptionSpec.flowType + }) + ); + if (this.subscriptionSpec.eventType) { + eventType = await flowcoreClient.execute( + new EventTypeFetchCommand({ + flowTypeId: flowType?.id, + eventType: this.subscriptionSpec.eventType + }) + ); + } + } + const query = urlParams.toString(); + this.webSocket = new WebSocketConstructor( + query ? `${this.url}?${query}` : this.url, + credentialProtocols.length > 0 ? credentialProtocols : void 0 + ); + this.webSocket.onopen = () => { + this._isOpen = true; + this._isConnecting = false; + this.transportSettled = true; + this.logger.debug("WebSocket connection opened."); + this.reconnectInterval = this.options.reconnectInterval; + this.reconnectAttempts = 0; + this.webSocket.send( + JSON.stringify({ + tenant: this.subscriptionSpec.tenant, + dataCoreId: dataCore.id, + flowTypeId: flowType?.id, + eventTypeId: eventType?.id + }) + ); + }; + this.webSocket.onmessage = (event) => { + let parsedData; + if (event.data instanceof ArrayBuffer) { + parsedData = new TextDecoder().decode(event.data); + } else if (Buffer.isBuffer(event.data)) { + parsedData = event.data.toString(); + } else if (Array.isArray(event.data)) { + parsedData = Buffer.concat(event.data).toString(); + } else { + parsedData = event.data; + } + this.handleMessage(parsedData); + }; + this.webSocket.onclose = (event) => { + this._isOpen = false; + this.logger.debug(`Connection closed: Code [${event.code}], Reason: ${event.reason}`); + if (this.shouldFallBackToQueryTransport()) { + this.fallBackToQueryTransport(); + return; + } + if (![1e3].includes(event.code)) { + this.attemptReconnect(); + return; + } + this._isConnecting = false; + this.observer.complete(); + }; + this.webSocket.onerror = (error) => { + if (this.shouldFallBackToQueryTransport()) { + this.logger.debug("Subprotocol handshake refused; retrying on the legacy query transport"); + this.webSocket.close(); + return; + } + this.logger.error(`WebSocket encountered error: ${error}`); + this.observer.error(error); + this.webSocket.close(); + }; + } + /** + * Decides WHERE the credential travels, for the transport currently selected. + * + * This is the whole security property of this client, isolated so it can be + * asserted directly: on the `subprotocol` transport the returned query is + * EMPTY. An ingress access log records the request line, so a credential in + * the query string is written to disk in plaintext and is readable by + * everyone with log access — for a long-lived `fc_` key that is a full + * tenant compromise sitting in a log index. + */ + buildCredentialHandshake(credential) { + const query = new URLSearchParams(); + const protocols = []; + if (this.authTransport === "query") { + if (credential.kind === "bearer") { + query.set("token", credential.token); + } else { + query.set("api_key", credential.apiKey); + if (credential.apiKeyId) { + query.set("api_key_id", credential.apiKeyId); + } + } + return { query, protocols }; + } + if (credential.kind === "bearer") { + protocols.push("flowcore-bearer", credential.token); + } else { + protocols.push("flowcore-api-key", credential.apiKey); + if (credential.apiKeyId) { + protocols.push(credential.apiKeyId); + } + } + return { query, protocols }; + } + /** + * True when the subprotocol handshake has just failed for the first time. + * + * The fallback is probed at most ONCE per client. After it settles, a later + * failure is a real failure and goes through normal reconnect handling. + */ + shouldFallBackToQueryTransport() { + return this.authTransport === "subprotocol" && !this.transportSettled && !this._isOpen; + } + /** + * Switches to the legacy query-string transport and reconnects immediately. + * + * This does NOT count as a reconnect attempt: no backoff is consumed and the + * caller sees one continuous connection attempt. + */ + fallBackToQueryTransport() { + this.transportSettled = true; + this.authTransport = "query"; + this._isConnecting = false; + this.logger.debug("Falling back to the legacy query-string credential transport"); + void this.connect(); + } + /** + * Parses and dispatches a single raw notification frame. + * + * Runs inside the WebSocket `onmessage` callback, where any thrown error is + * uncaught and crashes the host process. Notification frames can occasionally + * be malformed (non-JSON, empty/absent `message`, truncated payloads, or + * non-event control frames), so every parse is guarded — a bad frame is logged + * and skipped instead of taking down the whole connection/process. + */ + handleMessage(rawData) { + let data; + try { + data = JSON.parse(rawData); + } catch (error) { + this.logger.warn( + `Discarding notification frame: outer payload is not valid JSON (${error instanceof Error ? error.message : String(error)})` + ); + return; + } + if (data.type === "validation") { + this.logger.error(`Bad request: ${data.summary} - ${data.message} - ${data.found} - ${data.errors}`); + return; + } + let parsed; + try { + parsed = JSON.parse(data.message); + } catch (error) { + this.logger.warn( + `Discarding notification frame: 'message' is not valid JSON (type ${typeof data.message}): ${error instanceof Error ? error.message : String(error)}` + ); + return; + } + if (!parsed || typeof parsed !== "object" || !parsed.data) { + this.logger.warn("Discarding notification frame: parsed payload is missing a 'data' field"); + return; + } + this.logger.debug(`Received event: ${parsed.pattern}`); + this.observer.next({ + pattern: parsed.pattern, + data: { + tenant: parsed.data.tenantId, + eventId: parsed.data.eventId, + dataCoreId: parsed.data.dataCore, + flowType: parsed.data.aggregator, + eventType: parsed.data.eventType, + validTime: parsed.data.validTime + } + }); + this.eventCount++; + if (this.options.maxEvents && this.options.maxEvents <= this.eventCount) { + this.observer.complete(); + this.eventCount = 0; + this.webSocket.close(1e3, "Max events received"); + } + } + /** + * Attempts to reconnect to the WebSocket server using exponential backoff + */ + attemptReconnect() { + if (this.options.maxReconnects && this.reconnectAttempts >= this.options.maxReconnects) { + this.logger.error( + `Max reconnect attempts ${this.reconnectAttempts}/${this.options.maxReconnects} reached. Giving up.` + ); + return; + } + this.reconnectAttempts++; + this._isConnecting = true; + this.logger.info( + `Attempting reconnection ${this.reconnectAttempts}${this.options.maxReconnects ? `/${this.options.maxReconnects}` : ""} in ${this.reconnectInterval} ms...` + ); + setTimeout(() => { + this.connect(); + }, this.reconnectInterval); + this.reconnectInterval = Math.min(MAX_RECONNECT_INTERVAL, this.reconnectInterval * 2); + } + /** + * Closes the WebSocket connection + */ + disconnect() { + if (this.webSocket) { + this.webSocket.close(1e3, "Disconnected by user"); + } + } + /** + * Overrides the base WebSocket URL for testing or different environments + * @param url - The new base URL to use + */ + overrideBaseUrl(url) { + this.url = url; + } +}; +var MAX_RECONNECT_INTERVAL2 = 3e4; +var WEBSOCKET_CLOSING = 2; +var WEBSOCKET_CLOSED = 3; +var WebSocketConstructor2 = globalThis.WebSocket ?? WebSocket; +var WebSocketClient = class { + /** + * Creates a new WebSocketClient instance. + * @param authOptions - Authentication options (Bearer token via OIDC client or API Key). + * @param options - Configuration options for the client. + * @param webSocketFactory - Optional WebSocket factory for testing. + */ + constructor(authOptions, options, webSocketFactory) { + this.authOptions = authOptions; + this.options = { reconnectInterval: 1e3, ...options }; + this.logger = options?.logger ?? defaultLogger; + this.reconnectInterval = this.options.reconnectInterval; + this.webSocketFactory = webSocketFactory ?? ((url) => new WebSocketConstructor2(url)); + this.overrideBaseUrl = void 0; + if ("getBearerToken" in authOptions === false && "apiKey" in authOptions === false) { + throw new Error("Invalid authOptions: Must provide either getBearerToken or apiKey/apiKeyId"); + } + } + authOptions; + overrideBaseUrl; + // Field to store the override URL + webSocket; + options; + logger; + reconnectInterval; + reconnectAttempts = 0; + _isOpen = false; + _isConnecting = false; + webSocketFactory; + // Internal subject to push received data + internalSubject = new Subject(); + // Store the current command and config for reconnects and sending + currentCommand = null; + currentConfig = null; + /** + * Override the base URL provided by commands. + * @param baseUrl - The new base URL to use (e.g., "wss://staging-server.api.flowcore.io"). + */ + setBaseUrl(baseUrl6) { + this.logger.info(`WebSocket base URL overridden to: ${baseUrl6}`); + this.overrideBaseUrl = baseUrl6; + } + /** + * Returns true if the WebSocket connection is currently open. + */ + get isOpen() { + return this._isOpen; + } + /** + * Returns true if the client is currently attempting to establish a WebSocket connection. + */ + get isConnecting() { + return this._isConnecting; + } + /** + * Establishes WebSocket connection based on the provided command. + * Disconnects any existing connection before starting the new one. + * @param command - The command defining the stream connection details. + * @returns An interface to interact with the active stream. + */ + // Using generic types for the command + async connect(command) { + if (this._isConnecting || this._isOpen) { + this.logger.debug("Disconnecting existing stream before starting new one."); + this.disconnect(); + await new Promise((resolve) => setTimeout(resolve, 50)); + } + this.currentCommand = command; + const config = command.getConfig(); + this.currentConfig = config; + this._isConnecting = true; + const baseUrl6 = this.overrideBaseUrl ?? command.getWebSocketBaseUrl(); + const pathSegment = command.getWebSocketPathSegment(config); + this.logger.debug(`Attempting to connect stream: ${baseUrl6}${pathSegment}`); + try { + const urlParams = new URLSearchParams(); + if ("getBearerToken" in this.authOptions && this.authOptions.getBearerToken) { + const token = await this.authOptions.getBearerToken(); + if (!token) throw new Error("Failed to get bearer token"); + urlParams.set("token", token); + } else if ("apiKey" in this.authOptions && this.authOptions.apiKey && this.authOptions.apiKeyId) { + urlParams.set("api_key", this.authOptions.apiKey); + urlParams.set("api_key_id", this.authOptions.apiKeyId); + } else { + throw new Error("Invalid authentication configuration."); + } + const cleanedBaseUrl = baseUrl6.endsWith("/") ? baseUrl6.slice(0, -1) : baseUrl6; + const cleanedPathSegment = pathSegment.startsWith("/") ? pathSegment.slice(1) : pathSegment; + const streamUrl = `${cleanedBaseUrl}/${cleanedPathSegment}?${urlParams.toString()}`; + this.logger.debug(`Connecting to WebSocket URL: ${streamUrl}`); + this.webSocket = this.webSocketFactory(streamUrl); + this.setupEventHandlers(); + return { + output$: this.internalSubject.asObservable(), + send: (payload) => this.sendMessage(payload), + disconnect: () => this.disconnect() + }; + } catch (error) { + this.logger.error(`Failed to initiate connection: ${error}`); + this._isConnecting = false; + this.currentCommand = null; + this.currentConfig = null; + throw error; + } + } + /** + * Sets up the WebSocket event handlers (onopen, onmessage, onclose, onerror). + */ + setupEventHandlers() { + this.webSocket.onopen = () => { + this._isOpen = true; + this._isConnecting = false; + const baseUrl6 = this.overrideBaseUrl ?? this.currentCommand?.getWebSocketBaseUrl(); + const pathSegment = this.currentCommand?.getWebSocketPathSegment(this.currentConfig); + const logUrl = baseUrl6 && pathSegment ? `${baseUrl6.replace(/\/?$/, "/")}${pathSegment.replace(/^\/?/, "")}` : "(unknown URL)"; + this.logger.debug(`WebSocket connection opened: ${logUrl}`); + this.reconnectInterval = this.options.reconnectInterval; + this.reconnectAttempts = 0; + }; + this.webSocket.onmessage = (event) => { + try { + let parsedData; + if (event.data instanceof ArrayBuffer) { + parsedData = new TextDecoder().decode(event.data); + } else if (Buffer.isBuffer(event.data)) { + parsedData = event.data.toString(); + } else { + parsedData = event.data; + } + const chunk = JSON.parse(parsedData); + if (typeof chunk !== "object" || chunk === null || typeof chunk.type !== "string") { + this.logger.warn(`Received invalid chunk format: ${parsedData}`); + return; + } + this.logger.debug(`Received chunk: ${chunk.type}`); + this.internalSubject.next(chunk); + } catch (error) { + this.logger.error(`Error processing received message: ${error}`); + } + }; + this.webSocket.onclose = (event) => { + const wasOpen = this._isOpen; + this._isOpen = false; + this._isConnecting = false; + const baseUrl6 = this.overrideBaseUrl ?? this.currentCommand?.getWebSocketBaseUrl(); + const pathSegment = this.currentCommand?.getWebSocketPathSegment(this.currentConfig); + const logUrl = baseUrl6 && pathSegment ? `${baseUrl6.replace(/\/?$/, "/")}${pathSegment.replace(/^\/?/, "")}` : "(unknown URL)"; + this.logger.debug( + `WebSocket connection closed: ${logUrl} Code [${event.code}], Reason: ${event.reason || "No reason given"} +. Was open: ${wasOpen}` + ); + if (wasOpen && event.code !== 1e3 && this.currentCommand) { + this.attemptReconnect(); + } else { + this.logger.debug(`Completing internal subject due to close event.`); + this.internalSubject.complete(); + this.currentCommand = null; + this.currentConfig = null; + } + }; + this.webSocket.onerror = () => { + const baseUrl6 = this.overrideBaseUrl ?? this.currentCommand?.getWebSocketBaseUrl(); + const pathSegment = this.currentCommand?.getWebSocketPathSegment(this.currentConfig); + const logUrl = baseUrl6 && pathSegment ? `${baseUrl6.replace(/\/?$/, "/")}${pathSegment.replace(/^\/?/, "")}` : "(unknown URL)"; + this.logger.error(`WebSocket encountered an error for stream: ${logUrl}.`); + if (this.webSocket.readyState !== WEBSOCKET_CLOSED && this.webSocket.readyState !== WEBSOCKET_CLOSING) { + this.webSocket.close(1011, "WebSocket error"); + } + this.internalSubject.error(new Error("WebSocket encountered an error")); + }; + } + /** + * Attempts to reconnect to the WebSocket server using exponential backoff. + * Requires `currentConfig` to be set. + */ + attemptReconnect() { + if (!this.currentCommand || !this.currentConfig) { + this.logger.error("Cannot reconnect without current command/config."); + if (!this.internalSubject.closed) this.internalSubject.complete(); + return; + } + if (this._isConnecting) { + this.logger.debug("Reconnect attempt already in progress."); + return; + } + const baseUrl6 = this.overrideBaseUrl ?? this.currentCommand.getWebSocketBaseUrl(); + const pathSegment = this.currentCommand.getWebSocketPathSegment(this.currentConfig); + const logUrl = baseUrl6 && pathSegment ? `${baseUrl6.replace(/\/?$/, "/")}${pathSegment.replace(/^\/?/, "")}` : "(unknown URL)"; + if (this.options.maxReconnects && this.reconnectAttempts >= this.options.maxReconnects) { + this.logger.error( + `Max reconnect attempts (${this.reconnectAttempts}/${this.options.maxReconnects}) reached. Giving up: ${logUrl}` + ); + if (!this.internalSubject.closed) this.internalSubject.complete(); + this.currentCommand = null; + this.currentConfig = null; + return; + } + this.reconnectAttempts++; + this._isConnecting = true; + this.logger.info( + `Attempting reconnection ${this.reconnectAttempts}${this.options.maxReconnects ? `/${this.options.maxReconnects}` : ""} + for ${logUrl} in ${this.reconnectInterval} ms...` + ); + setTimeout(async () => { + if (!this.currentCommand || !this.currentConfig) { + this.logger.debug("Reconnect cancelled as disconnect was called."); + this._isConnecting = false; + if (!this.internalSubject.closed) this.internalSubject.complete(); + return; + } + try { + const urlParams = new URLSearchParams(); + if ("getBearerToken" in this.authOptions && this.authOptions.getBearerToken) { + const token = await this.authOptions.getBearerToken(); + if (!token) throw new Error("Reconnect failed: Could not get bearer token"); + urlParams.set("token", token); + } else if ("apiKey" in this.authOptions && this.authOptions.apiKey && this.authOptions.apiKeyId) { + urlParams.set("api_key", this.authOptions.apiKey); + urlParams.set("api_key_id", this.authOptions.apiKeyId); + } else { + throw new Error("Reconnect failed: Invalid authentication configuration."); + } + const streamUrl = `${baseUrl6}${pathSegment}?${urlParams.toString()}`; + this.logger.debug(`Reconnecting to WebSocket URL: ${streamUrl}`); + this.webSocket = this.webSocketFactory(streamUrl); + this.setupEventHandlers(); + } catch (error) { + this.logger.error(`Reconnect attempt connection failed: ${error}`); + this._isConnecting = false; + this.reconnectInterval = Math.min(MAX_RECONNECT_INTERVAL2, this.reconnectInterval * 2); + this.attemptReconnect(); + } + }, this.reconnectInterval); + this.reconnectInterval = Math.min(MAX_RECONNECT_INTERVAL2, this.reconnectInterval * 2); + } + /** + * Sends a message to the currently connected WebSocket. + * @param message - The message object to send (e.g., { content: "user input" }). + */ + sendMessage(payload) { + const openState = 1; + if (!this._isOpen || this.webSocket.readyState !== openState || !this.currentCommand) { + this.logger.warn("Cannot send message: WebSocket is not open or command not set."); + return false; + } + try { + const serializer = this.currentCommand.serializeSendPayload ?? JSON.stringify; + const dataToSend = serializer(payload); + this.webSocket.send(dataToSend); + this.logger.debug(`Sent message: ${dataToSend}`); + return true; + } catch (error) { + this.logger.error(`Failed to send message: ${error}`); + return false; + } + } + /** + * Closes the WebSocket connection gracefully. + */ + disconnect() { + this.logger.debug("Disconnect called by user."); + const commandToClear = this.currentCommand; + this.currentCommand = null; + this.currentConfig = null; + if (this.webSocket) { + if (this._isOpen || this._isConnecting) { + this.webSocket.close(1e3, "Disconnected by user"); + } else { + this.logger.debug("WebSocket already closed or closing."); + } + } else { + this.logger.debug("No WebSocket instance to disconnect."); + } + this._isOpen = false; + this._isConnecting = false; + if (commandToClear && !this.internalSubject.closed) { + this.logger.debug("Completing internal subject due to disconnect call."); + this.internalSubject.complete(); + } + } + /** + * Implements the Disposable interface for clean resource management. + */ + [Symbol.dispose]() { + this.disconnect(); + } +}; + +// src/mod.ts +init_parse_response_helper(); + +export { ApiKeyCreateCommand, ApiKeyDeleteCommand, ApiKeyEditCommand, ApiKeyFetchCommand, ApiKeyListCommand, ApiKeyValidateCommand, ApiKeyValidateWithTenantIdCommand, ArchivePolicyResponseSchema, ArchiveRoleResponseSchema, ArtifactGetCommand, AuditLogEntrySchema, AuditLogResponseSchema, AwsMarketplaceCustomerResolveCommand, AwsMarketplaceLinkCreateCommand, AwsMarketplaceLinkDeleteCommand, AwsMarketplaceLinkFetchCommand, AwsMarketplaceLinkListCommand, ClientError, Command, CommandError, ComputeDeploymentEventObjectSchema, ComputeDeploymentEventSchema, ComputeDomainAttachCommand, ComputeDomainDetachCommand, ComputeDomainListCommand, ComputeDomainListResponseSchema, ComputeDomainSchema, ComputeDomainStatusSchema, ComputeDomainTlsSchema, ComputeDomainTlsStatusSchema, ComputeDomainVerificationSchema, ComputeDomainVerificationTypeSchema, ComputeDomainVerifyCommand, ComputeDomainVerifyResponseSchema, ComputeLogEntrySchema, ComputeLogStreamEventSchema, ComputeLogStreamNameSchema, ComputeNoContentSchema, ComputeOperationDeploymentProgressSchema, ComputeOperationFetchCommand, ComputeOperationPhaseSchema, ComputeOperationPreSyncProgressSchema, ComputeOperationProgressSchema, ComputeOperationSchema, ComputeOperationStatusSchema, ComputeOperationStepStatusSchema, ComputeOperationTypeSchema, ComputePreSyncSpecSchema, ComputeProbeExecSchema, ComputeProbeHttpGetSchema, ComputeProbeSchema, ComputeProbeTcpSocketSchema, ComputeRegistryDetailResponseSchema, ComputeRegistryDetailSchema, ComputeRegistryFetchCommand, ComputeRegistryListCommand, ComputeRegistryListResponseSchema, ComputeRegistryRegisterCommand, ComputeRegistryRemoveCommand, ComputeRegistryRotateCommand, ComputeRegistrySchema, ComputeRegistrySynthesisStateSchema, ComputeSlotTierSchema, ComputeWorkloadCreateCommand, ComputeWorkloadCreateResponseSchema, ComputeWorkloadCreateTrackedCommand, ComputeWorkloadDefinitionSchema, ComputeWorkloadDeleteCommand, ComputeWorkloadDeleteResponseSchema, ComputeWorkloadDeploymentEventsSchema, ComputeWorkloadEnvVarSchema, ComputeWorkloadEventsListCommand, ComputeWorkloadFetchCommand, ComputeWorkloadKindSchema, ComputeWorkloadListCommand, ComputeWorkloadListResponseSchema, ComputeWorkloadLogStreamCommand, ComputeWorkloadLogsFetchCommand, ComputeWorkloadLogsSchema, ComputeWorkloadMutationResponseSchema, ComputeWorkloadPauseCommand, ComputeWorkloadProbesSchema, ComputeWorkloadResponseSchema, ComputeWorkloadResumeCommand, ComputeWorkloadRevisionCauseSchema, ComputeWorkloadRevisionListSchema, ComputeWorkloadRevisionSchema, ComputeWorkloadRevisionsListCommand, ComputeWorkloadRollbackCommand, ComputeWorkloadRunCommand, ComputeWorkloadRunKindSchema, ComputeWorkloadRunListSchema, ComputeWorkloadRunResponseSchema, ComputeWorkloadRunSchema, ComputeWorkloadRunStatusSchema, ComputeWorkloadRunsListCommand, ComputeWorkloadScalingModeSchema, ComputeWorkloadScalingSchema, ComputeWorkloadSchema, ComputeWorkloadSecretRefSchema, ComputeWorkloadStatusSchema, ComputeWorkloadUpdateCommand, ComputeWorkloadVolumeSchema, ContainerRegistListCommand, ContainerRegistryCreateCommand, ContainerRegistryDeleteCommand, ContainerRegistryFetchCommand, ContainerRegistryUpdateCommand, ContextAddItemCommand, ContextRemoveItemCommand, ConversationDeleteCommand, ConversationGetCommand, ConversationListCommand, ConversationStreamCommand, CustomCommand, DEFAULT_COMPUTE_OPERATION_POLL_INTERVAL_MS, DEFAULT_COMPUTE_OPERATION_TIMEOUT_MS, DataCoreCreateCommand, DataCoreExistsCommand, DataCoreFetchCommand, DataCoreListCommand, DataCoreRequestDeleteCommand, DataCoreUpdateCommand, DataPathwayAssignmentCompleteCommand, DataPathwayAssignmentExpireLeasesCommand, DataPathwayAssignmentFetchCommand, DataPathwayAssignmentHeartbeatCommand, DataPathwayAssignmentListCommand, DataPathwayAssignmentNextCommand, DataPathwayCapacityFetchCommand, DataPathwayCommandDispatchConfigUpdateCommand, DataPathwayCommandDispatchPauseCommand, DataPathwayCommandDispatchRestartCommand, DataPathwayCommandDispatchResumeCommand, DataPathwayCommandDispatchStopCommand, DataPathwayCommandFetchCommand, DataPathwayCommandPendingByPathwayCommand, DataPathwayCommandPendingCommand, DataPathwayCommandUpdateStatusByPathwayCommand, DataPathwayCommandUpdateStatusCommand, DataPathwayCreateCommand, DataPathwayDeleteCommand, DataPathwayDeliveryLogBatchCommand, DataPathwayDeliveryLogListCommand, DataPathwayDisableCommand, DataPathwayFetchByNameCommand, DataPathwayFetchCommand, DataPathwayHealthCheckCommand, DataPathwayListCommand, DataPathwayMetricsFetchCommand, DataPathwayPumpStateFetchBySourceCommand, DataPathwayPumpStateFetchCommand, DataPathwayPumpStateSaveBySourceCommand, DataPathwayPumpStateSaveCommand, DataPathwayQuotaFetchCommand, DataPathwayQuotaListCommand, DataPathwayQuotaSetCommand, DataPathwayRestartFetchCommand, DataPathwayRestartRequestCommand, DataPathwaySlotDeregisterCommand, DataPathwaySlotFetchCommand, DataPathwaySlotHeartbeatCommand, DataPathwaySlotListCommand, DataPathwaySlotRegisterCommand, DataPathwayUpsertByNameCommand, DataPathwayUpsertByNameResponseSchema, EntitlementResponseSchema, EventListCommand, EventTypeCreateCommand, EventTypeExistsCommand, EventTypeFetchCommand, EventTypeInfoCommand, EventTypeListCommand, EventTypeListRemovedSensitiveDataCommand, EventTypeRemoveSensitiveDataCommand, EventTypeRequestDeleteCommand, EventTypeRequestTruncateCommand, EventTypeUpdateCommand, EventsFetchCommand, EventsFetchTimeBucketsByNamesCommand, FetchPumpStatusCommand, FlowTypeCreateCommand, FlowTypeExistsCommand, FlowTypeFetchCommand, FlowTypeListCommand, FlowTypeRequestDeleteCommand, FlowTypeUpdateCommand, FlowcoreClient, IngestBatchCommand, IngestEventCommand, InvalidResponseException, KeyPoliciesCommand, KeyPolicyLinkSchema, KeyRoleLinkSchema, KeyRolesCommand, LinkKeyPolicyCommand, LinkKeyRoleCommand, LinkRolePolicyCommand, LinkUserPolicyCommand, LinkUserRoleCommand, NotFoundException, NotificationClient, OrganizationPoliciesCommand, OrganizationRolesCommand, PaginationSchema, PermissionsListCommand, PolicyArchiveCommand, PolicyAssociationsCommand, PolicyAssociationsSchema, PolicyCreateCommand, PolicyFilterSchema, PolicyFilterValueSchema, PolicyGetCommand, PolicyKeyAssociationSchema, PolicyListCommand, PolicyRoleAssociationSchema, PolicySchema, PolicyStatementSchema, PolicyUpdateCommand, PolicyUserAssociationSchema, PolicyValidateCommand, PolicyValidateResponseSchema, ResolveKeyEntitlementsCommand, ResolveUserEntitlementsCommand, RoleArchiveCommand, RoleAssociationsCommand, RoleAssociationsSchema, RoleCreateCommand, RoleGetCommand, RoleKeyAssociationSchema, RoleListCommand, RolePoliciesCommand, RolePolicyLinkSchema, RoleSchema, RoleUpdateCommand, RoleUserAssociationSchema, SecretCreateCommand, SecretDeleteCommand, SecretEditCommand, SecretFetchCommand, SecretListCommand, SecurityCreatePATCommand, SecurityDeletePATCommand, SecurityExchangePATCommand, SecurityGetPATCommand, SecurityListPATCommand, SendPumpPulseCommand, ServiceAccountCreateCommand, ServiceAccountDeleteCommand, ServiceAccountEditCommand, ServiceAccountFetchCommand, ServiceAccountListCommand, ServiceAccountRotateSecretCommand, TenantAuditLogsCommand, TenantCreateCommand, TenantDisableSensitiveDataCommand, TenantEnableSensitiveDataCommand, TenantFetchCommand, TenantInstanceFetchCommand, TenantListCommand, TenantPreviewCommand, TenantTranslateNameToIdCommand, TenantTranslateNameToIdSchema, TenantUpdateCommand, TenantUserAddCommand, TenantUserListCommand, TenantUserRemoveCommand, TimeBucketListCommand, UnlinkKeyPolicyCommand, UnlinkKeyRoleCommand, UnlinkRolePolicyCommand, UnlinkUserPolicyCommand, UnlinkUserRoleCommand, UserDeleteCommand, UserInitializeInKeycloakCommand, UserInviteToTenantCommand, UserPermissionSchema, UserPermissionsCommand, UserPoliciesCommand, UserPolicyLinkSchema, UserRoleLinkSchema, UserRolesCommand, ValidPolicySchema, ValidateKeyCommand, ValidateUserCommand, ValidationResponseSchema, VariableCreateCommand, VariableDeleteCommand, VariableEditCommand, VariableFetchCommand, VariableListCommand, WebSocketClient, isEncryptedPayload, matchesPolicyFilters, parseEntitlementResponse, parseResponseHelper, permitsPayload, waitForComputeOperation }; +//# sourceMappingURL=index.js.map +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/src/commands/iam/entitlements/resolve-key-entitlements.ts b/src/commands/iam/entitlements/resolve-key-entitlements.ts new file mode 100644 index 0000000..1c98afa --- /dev/null +++ b/src/commands/iam/entitlements/resolve-key-entitlements.ts @@ -0,0 +1,26 @@ +import { Command } from "../../../common/command.ts" +import { parseResponseHelper } from "../../../utils/parse-response-helper.ts" +import { + type EntitlementRequestAccessItem, + type EntitlementResponse, + EntitlementResponseSchema, +} from "./resolve-user-entitlements.ts" + +export interface ResolveKeyEntitlementsInput { + keyId: string + mode: "tenant" | "organization" + requestedAccess: EntitlementRequestAccessItem[] +} + +export class ResolveKeyEntitlementsCommand extends Command { + protected override retryOnFailure = true + protected override getMethod(): string { return "POST" } + protected override getBaseUrl(): string { return "https://iam.api.flowcore.io" } + protected override getPath(): string { return `/api/v1/entitlements/keys/${this.input.keyId}` } + protected override getBody(): Record { + return { mode: this.input.mode, requestedAccess: this.input.requestedAccess } + } + protected override parseResponse(rawResponse: unknown): EntitlementResponse { + return parseResponseHelper(EntitlementResponseSchema, rawResponse) + } +} diff --git a/src/commands/iam/entitlements/resolve-user-entitlements.ts b/src/commands/iam/entitlements/resolve-user-entitlements.ts new file mode 100644 index 0000000..79ba381 --- /dev/null +++ b/src/commands/iam/entitlements/resolve-user-entitlements.ts @@ -0,0 +1,54 @@ +import { Command } from "../../../common/command.ts" +import { parseResponseHelper } from "../../../utils/parse-response-helper.ts" +import { PolicyFilterSchema } from "../policy-filters.ts" +import { type Static, Type } from "@sinclair/typebox" + +export interface EntitlementRequestAccessItem { + action: string | string[] + resource: string[] +} + +export const EntitlementResponseSchema = Type.Object({ + valid: Type.Literal(true), + requestChecksum: Type.String(), + entitlementChecksum: Type.String(), + cacheTtlSeconds: Type.Number(), + entitlements: Type.Array( + Type.Object({ + requestIndex: Type.Number(), + grants: Type.Array( + Type.Object({ + policyFrn: Type.String(), + statementId: Type.String(), + resource: Type.String(), + filters: Type.Optional(Type.Array(PolicyFilterSchema)), + }), + ), + }), + ), +}) + +export type EntitlementResponse = Static + +export function parseEntitlementResponse(rawResponse: unknown): EntitlementResponse { + return parseResponseHelper(EntitlementResponseSchema, rawResponse) +} + +export interface ResolveUserEntitlementsInput { + userId: string + mode: "tenant" | "organization" + requestedAccess: EntitlementRequestAccessItem[] +} + +export class ResolveUserEntitlementsCommand extends Command { + protected override retryOnFailure = true + protected override getMethod(): string { return "POST" } + protected override getBaseUrl(): string { return "https://iam.api.flowcore.io" } + protected override getPath(): string { return `/api/v1/entitlements/users/${this.input.userId}` } + protected override getBody(): Record { + return { mode: this.input.mode, requestedAccess: this.input.requestedAccess } + } + protected override parseResponse(rawResponse: unknown): EntitlementResponse { + return parseEntitlementResponse(rawResponse) + } +} diff --git a/src/commands/iam/policies/create-policy.ts b/src/commands/iam/policies/create-policy.ts index 450bdba..df81ef6 100644 --- a/src/commands/iam/policies/create-policy.ts +++ b/src/commands/iam/policies/create-policy.ts @@ -11,6 +11,7 @@ import { type TUnion, Type, } from "@sinclair/typebox" +import { type PolicyFilter, PolicyFilterSchema } from "../policy-filters.ts" /** * The schema for a policy statement document @@ -19,10 +20,12 @@ export const PolicyStatementSchema: TObject<{ statementId: TOptional resource: TString action: TUnion<[TString, TArray]> + filters: TOptional> }> = Type.Object({ statementId: Type.Optional(Type.String()), resource: Type.String(), action: Type.Union([Type.String(), Type.Array(Type.String())]), + filters: Type.Optional(Type.Array(PolicyFilterSchema, { minItems: 1, maxItems: 10 })), }) /** @@ -80,6 +83,8 @@ export interface PolicyCreateInput { resource: string /** The actions for this statement */ action: string | string[] + /** Optional plaintext event payload filters. */ + filters?: PolicyFilter[] }> /** The description of the policy */ description?: string diff --git a/src/commands/iam/policies/id/update-policy.ts b/src/commands/iam/policies/id/update-policy.ts index d8c823c..de03b5c 100644 --- a/src/commands/iam/policies/id/update-policy.ts +++ b/src/commands/iam/policies/id/update-policy.ts @@ -65,6 +65,10 @@ export class PolicyUpdateCommand extends Command { } } + protected override getHeaders(): Record { + return { ...super.getHeaders(), "x-flowcore-policy-conditions": "1" } + } + /** * Parse the response */ diff --git a/src/commands/iam/policies/validate-policy.ts b/src/commands/iam/policies/validate-policy.ts index 7d425ff..40eb5de 100644 --- a/src/commands/iam/policies/validate-policy.ts +++ b/src/commands/iam/policies/validate-policy.ts @@ -2,6 +2,7 @@ import { Command } from "../../../common/command.ts" import { parseResponseHelper } from "../../../utils/parse-response-helper.ts" import { type Static, type TLiteral, type TObject, Type } from "@sinclair/typebox" +import type { PolicyFilter } from "../policy-filters.ts" /** * The schema for a successful policy validation response. @@ -43,6 +44,8 @@ export interface PolicyValidateInput { resource: string /** The actions for this statement */ action: string | string[] + /** Optional plaintext event payload filters. */ + filters?: PolicyFilter[] }> /** The optional principal role FRN (cross-tenant is intentionally permitted here) */ principal?: string diff --git a/src/commands/iam/policy-filters.ts b/src/commands/iam/policy-filters.ts new file mode 100644 index 0000000..3323edb --- /dev/null +++ b/src/commands/iam/policy-filters.ts @@ -0,0 +1,67 @@ +import { type Static, Type } from "@sinclair/typebox" + +export const PolicyFilterValueSchema = Type.Union([ + Type.String({ maxLength: 512 }), + Type.Number(), + Type.Boolean(), + Type.Null(), +]) + +const PolicyFilterPathSchema = Type.String({ + minLength: 1, + maxLength: 256, + pattern: "^[A-Za-z0-9_-]+(?:\\.[A-Za-z0-9_-]+){0,7}$", +}) + +export const PolicyFilterSchema = Type.Union([ + Type.Object({ path: PolicyFilterPathSchema, operator: Type.Literal("equals"), value: PolicyFilterValueSchema }, { additionalProperties: false }), + Type.Object({ path: PolicyFilterPathSchema, operator: Type.Literal("oneOf"), values: Type.Array(PolicyFilterValueSchema, { minItems: 1, maxItems: 20 }) }, { additionalProperties: false }), + Type.Object({ path: PolicyFilterPathSchema, operator: Type.Literal("exists"), value: Type.Boolean() }, { additionalProperties: false }), +]) + +export type PolicyFilterValue = Static +export type PolicyFilter = Static + +const RESERVED_PATH_SEGMENTS = new Set(["__proto__", "prototype", "constructor"]) + +function ownPath(payload: unknown, path: string): { exists: boolean; value?: unknown } { + let current = payload + for (const segment of path.split(".")) { + if (RESERVED_PATH_SEGMENTS.has(segment) || typeof current !== "object" || current === null || Array.isArray(current)) { + return { exists: false } + } + if (!Object.hasOwn(current, segment)) return { exists: false } + current = (current as Record)[segment] + } + return { exists: true, value: current } +} + +export function isEncryptedPayload(payload: unknown): boolean { + if (typeof payload !== "object" || payload === null || Array.isArray(payload)) return false + if (!Object.hasOwn(payload, "encryptedPayload")) return false + const keys = Object.keys(payload) + const value = (payload as Record).encryptedPayload + return keys.length === 1 && typeof value === "string" && value.split(".").length === 3 +} + +export function matchesPolicyFilters(filters: readonly PolicyFilter[], payload: unknown): boolean { + if (isEncryptedPayload(payload)) return false + return filters.every((filter) => { + const resolved = ownPath(payload, filter.path) + if (filter.operator === "exists") return resolved.exists === filter.value + if (!resolved.exists) return false + if (filter.operator === "equals") return resolved.value === filter.value + return filter.values.some((value) => resolved.value === value) + }) +} + +export type EntitlementGrant = { + policyFrn: string + statementId: string + resource: string + filters?: PolicyFilter[] +} + +export function permitsPayload(grants: readonly EntitlementGrant[], payload: unknown): boolean { + return grants.some((grant) => grant.filters === undefined || matchesPolicyFilters(grant.filters, payload)) +} diff --git a/src/commands/index.ts b/src/commands/index.ts index ca1ac8f..f408a8e 100644 --- a/src/commands/index.ts +++ b/src/commands/index.ts @@ -152,6 +152,9 @@ export * from "./iam/tenant-iam-audit/get-audit-for-tenant.ts" export * from "./iam/validate/validate-key.ts" export * from "./iam/validate/validate-user.ts" +export * from "./iam/policy-filters.ts" +export * from "./iam/entitlements/resolve-user-entitlements.ts" +export * from "./iam/entitlements/resolve-key-entitlements.ts" // Compute export * from "./compute/compute-domain.attach.ts" diff --git a/test/tests/commands/iam/policies.test.ts b/test/tests/commands/iam/policies.test.ts index 36e72bf..fbafd7f 100644 --- a/test/tests/commands/iam/policies.test.ts +++ b/test/tests/commands/iam/policies.test.ts @@ -405,6 +405,7 @@ describe("Policy commands", () => { .matchHeaders({ "authorization": "Bearer BEARER_TOKEN", "content-type": "application/json", + "x-flowcore-policy-conditions": "1", }) .respondWith(200, mockResponse) @@ -439,6 +440,7 @@ describe("Policy commands", () => { .matchHeaders({ "authorization": "Bearer BEARER_TOKEN", "content-type": "application/json", + "x-flowcore-policy-conditions": "1", }) .respondWith(403, { error: "Insufficient permissions" }) diff --git a/test/tests/commands/policy-filters.test.ts b/test/tests/commands/policy-filters.test.ts new file mode 100644 index 0000000..0d4c3ae --- /dev/null +++ b/test/tests/commands/policy-filters.test.ts @@ -0,0 +1,37 @@ +import { isEncryptedPayload, matchesPolicyFilters, permitsPayload } from "../../../src/commands/iam/policy-filters.ts" +import { describe, expect, it } from "bun:test" + +describe("policy payload filters", () => { + it("uses strict own-property comparisons", () => { + expect(matchesPolicyFilters([{ path: "customer.region", operator: "equals", value: "EU" }], { customer: { region: "EU" } })).toBe(true) + expect(matchesPolicyFilters([{ path: "count", operator: "equals", value: 1 }], { count: "1" })).toBe(false) + expect(matchesPolicyFilters([{ path: "missing", operator: "exists", value: false }], { missing: null })).toBe(false) + expect(matchesPolicyFilters([{ path: "missing", operator: "exists", value: false }], {})).toBe(true) + }) + + it("supports oneOf and ANDs filters within a grant", () => { + expect(matchesPolicyFilters([ + { path: "region", operator: "oneOf", values: ["FO", "DK"] }, + { path: "active", operator: "equals", value: true }, + ], { region: "FO", active: true })).toBe(true) + }) + + it("blocks reserved traversal segments", () => { + expect(matchesPolicyFilters([{ path: "constructor.name", operator: "equals", value: "Object" }], {})).toBe(false) + expect(matchesPolicyFilters([{ path: "items.0", operator: "equals", value: "x" }], { items: ["x"] })).toBe(false) + }) + + it("recognizes only the canonical encrypted envelope", () => { + expect(isEncryptedPayload({ encryptedPayload: "a.b.c" })).toBe(true) + expect(isEncryptedPayload({ encryptedPayload: "a.b.c", visible: true })).toBe(false) + expect(matchesPolicyFilters([{ path: "encryptedPayload", operator: "exists", value: true }], { encryptedPayload: "a.b.c" })).toBe(false) + }) + + it("ORs grants and lets an unconditional grant dominate", () => { + const grants = [ + { policyFrn: "p1", statementId: "s1", resource: "r", filters: [{ path: "region", operator: "equals" as const, value: "FO" }] }, + { policyFrn: "p2", statementId: "s2", resource: "r" }, + ] + expect(permitsPayload(grants, { region: "US" })).toBe(true) + }) +})