HEX
Server: nginx/1.18.0
System: Linux test-ipsremont 5.4.0-214-generic #234-Ubuntu SMP Fri Mar 14 23:50:27 UTC 2025 x86_64
User: ips (1000)
PHP: 8.0.30
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/quadcode/one-time-popup/node_modules/sass-embedded/dist/lib/src/request-tracker.js
"use strict";
// Copyright 2020 Google Inc. Use of this source code is governed by an
// MIT-style license that can be found in the LICENSE file or at
// https://opensource.org/licenses/MIT.
Object.defineProperty(exports, "__esModule", { value: true });
exports.RequestTracker = void 0;
/**
 * Manages pending inbound and outbound requests. Ensures that requests and
 * responses interact correctly and obey the Embedded Protocol.
 */
class RequestTracker {
    // The indices of this array correspond to each pending request's ID. Stores
    // the response type expected by each request.
    requests = [];
    /** The next available request ID. */
    get nextId() {
        for (let i = 0; i < this.requests.length; i++) {
            if (this.requests[i] === undefined || this.requests[i] === null) {
                return i;
            }
        }
        return this.requests.length;
    }
    /**
     * Adds an entry for a pending request with ID `id`. The entry stores the
     * expected response type. Throws an error if the Protocol Error is violated.
     */
    add(id, expectedResponseType) {
        if (id < 0) {
            throw Error(`Invalid request ID ${id}.`);
        }
        else if (this.requests[id]) {
            throw Error(`Request ID ${id} is already in use by an in-flight request.`);
        }
        this.requests[id] = expectedResponseType;
    }
    /**
     * Resolves a pending request with matching ID `id` and expected response type
     * `type`. Throws an error if the Protocol Error is violated.
     */
    resolve(id, type) {
        if (this.requests[id] === undefined || this.requests[id] === null) {
            throw Error(`Response ID ${id} does not match any pending requests.`);
        }
        else if (this.requests[id] !== type) {
            throw Error(`Response with ID ${id} does not match pending request's type. Expected ${this.requests[id]} but received ${type}.`);
        }
        this.requests[id] = null;
    }
}
exports.RequestTracker = RequestTracker;
//# sourceMappingURL=request-tracker.js.map