/*!
 * Copyright (c) 2026 Vertex Software LLC. All rights reserved.
 */
import { g as grpcWebClient_umdExports } from './wrappers_pb-Xw_x1jYm.js';

function requestUnary(caller) {
    return new Promise((resolve, reject) => {
        caller((err, res) => {
            if (err != null) {
                reject(err);
            }
            else if (res != null) {
                resolve(res);
            }
            else {
                reject(new Error('Invalid gRPC response. Error and result are empty.'));
            }
        });
    });
}
async function* requestPaged(fetch, next) {
    let cursor = undefined;
    do {
        const res = await requestUnary(fetch(cursor));
        yield res;
        cursor = next(res);
    } while (cursor != null);
}
async function createMetadata(jwtProvider, deviceId) {
    const jwt = await jwtProvider();
    const meta = new grpcWebClient_umdExports.grpc.Metadata({
        'jwt-context': JSON.stringify({
            jwt,
            metadata: { 'x-device-id': deviceId || '' },
        }),
    });
    return meta;
}

export { requestPaged as a, createMetadata as c, requestUnary as r };
//# sourceMappingURL=grpc-CZAYqbTu.js.map

//# sourceMappingURL=grpc-CZAYqbTu.js.map