Next.js website for Rocky Mountain Vending company featuring: - Product catalog with Stripe integration - Service areas and parts pages - Admin dashboard with Clerk authentication - SEO optimized pages with JSON-LD structured data Co-authored-by: Cursor <cursoragent@cursor.com>
36 lines
969 B
Text
36 lines
969 B
Text
import { executionAsyncId } from "./async-hook.mjs";
|
|
let _asyncIdCounter = 100;
|
|
class _AsyncResource {
|
|
__unenv__ = true;
|
|
type;
|
|
_asyncId;
|
|
_triggerAsyncId;
|
|
constructor(type, triggerAsyncId = executionAsyncId()) {
|
|
this.type = type;
|
|
this._asyncId = -1 * _asyncIdCounter++;
|
|
this._triggerAsyncId = typeof triggerAsyncId === "number" ? triggerAsyncId : triggerAsyncId?.triggerAsyncId;
|
|
}
|
|
static bind(fn, type, thisArg) {
|
|
const resource = new AsyncResource(type ?? "anonymous");
|
|
return resource.bind(fn);
|
|
}
|
|
bind(fn, thisArg) {
|
|
const binded = (...args) => this.runInAsyncScope(fn, thisArg, ...args);
|
|
binded.asyncResource = this;
|
|
return binded;
|
|
}
|
|
runInAsyncScope(fn, thisArg, ...args) {
|
|
const result = fn.apply(thisArg, args);
|
|
return result;
|
|
}
|
|
emitDestroy() {
|
|
return this;
|
|
}
|
|
asyncId() {
|
|
return this._asyncId;
|
|
}
|
|
triggerAsyncId() {
|
|
return this._triggerAsyncId;
|
|
}
|
|
}
|
|
export const AsyncResource = globalThis.AsyncResource || _AsyncResource;
|