UNPKG

@promptbook/azure-openai

Version:

Promptbook: Run AI apps in plain human language across multiple models and platforms

30 lines (29 loc) 1.08 kB
import type { JsonArray, JsonObject } from 'type-fest'; import type { OrderJsonOptions } from '../normalization/orderJson'; import type { CheckSerializableAsJsonOptions } from './checkSerializableAsJson'; /** * Options for the `$exportJson` function */ export type ExportJsonOptions<TObject> = CheckSerializableAsJsonOptions & Partial<Pick<OrderJsonOptions<TObject & (JsonObject | JsonArray)>, 'order'>> & { /** * Value to be checked, ordered and deeply frozen */ value: TObject; }; /** * Utility to export a JSON object from a function * * 1) Checks if the value is serializable as JSON * 2) Makes a deep clone of the object * 2) Orders the object properties * 2) Deeply freezes the cloned object * * Note: This function does not mutates the given object * * @returns The same type of object as the input but read-only and re-ordered * @public exported from `@promptbook/utils` */ export declare function exportJson<TObject>(options: ExportJsonOptions<TObject>): TObject; /** * TODO: [🧠] Is there a way how to meaningfully test this utility */