Rocky_Mountain_Vending/.pnpm-store/v10/files/f3/819ffb8862fc4bcd124a164acd9fe6414067726b780dbd8de7e30d2407ee0d7f77e6c9c43bdfd8d5e1b654f96d72951660d4c70c90fbfaae71ac40d834f8d4
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
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>
2026-02-12 16:22:15 -07:00

117 lines
3.6 KiB
Text

const PROTECTED_KEYS = {
REQUEST_ID: Symbol.for("_AWS_LAMBDA_REQUEST_ID"),
X_RAY_TRACE_ID: Symbol.for("_AWS_LAMBDA_X_RAY_TRACE_ID"),
TENANT_ID: Symbol.for("_AWS_LAMBDA_TENANT_ID"),
};
const NO_GLOBAL_AWS_LAMBDA = ["true", "1"].includes(process.env?.AWS_LAMBDA_NODEJS_NO_GLOBAL_AWSLAMBDA ?? "");
if (!NO_GLOBAL_AWS_LAMBDA) {
globalThis.awslambda = globalThis.awslambda || {};
}
class InvokeStoreBase {
static PROTECTED_KEYS = PROTECTED_KEYS;
isProtectedKey(key) {
return Object.values(PROTECTED_KEYS).includes(key);
}
getRequestId() {
return this.get(PROTECTED_KEYS.REQUEST_ID) ?? "-";
}
getXRayTraceId() {
return this.get(PROTECTED_KEYS.X_RAY_TRACE_ID);
}
getTenantId() {
return this.get(PROTECTED_KEYS.TENANT_ID);
}
}
class InvokeStoreSingle extends InvokeStoreBase {
currentContext;
getContext() {
return this.currentContext;
}
hasContext() {
return this.currentContext !== undefined;
}
get(key) {
return this.currentContext?.[key];
}
set(key, value) {
if (this.isProtectedKey(key)) {
throw new Error(`Cannot modify protected Lambda context field: ${String(key)}`);
}
this.currentContext = this.currentContext || {};
this.currentContext[key] = value;
}
run(context, fn) {
this.currentContext = context;
return fn();
}
}
class InvokeStoreMulti extends InvokeStoreBase {
als;
static async create() {
const instance = new InvokeStoreMulti();
const asyncHooks = await import('node:async_hooks');
instance.als = new asyncHooks.AsyncLocalStorage();
return instance;
}
getContext() {
return this.als.getStore();
}
hasContext() {
return this.als.getStore() !== undefined;
}
get(key) {
return this.als.getStore()?.[key];
}
set(key, value) {
if (this.isProtectedKey(key)) {
throw new Error(`Cannot modify protected Lambda context field: ${String(key)}`);
}
const store = this.als.getStore();
if (!store) {
throw new Error("No context available");
}
store[key] = value;
}
run(context, fn) {
return this.als.run(context, fn);
}
}
var InvokeStore;
(function (InvokeStore) {
let instance = null;
async function getInstanceAsync() {
if (!instance) {
instance = (async () => {
const isMulti = "AWS_LAMBDA_MAX_CONCURRENCY" in process.env;
const newInstance = isMulti
? await InvokeStoreMulti.create()
: new InvokeStoreSingle();
if (!NO_GLOBAL_AWS_LAMBDA && globalThis.awslambda?.InvokeStore) {
return globalThis.awslambda.InvokeStore;
}
else if (!NO_GLOBAL_AWS_LAMBDA && globalThis.awslambda) {
globalThis.awslambda.InvokeStore = newInstance;
return newInstance;
}
else {
return newInstance;
}
})();
}
return instance;
}
InvokeStore.getInstanceAsync = getInstanceAsync;
InvokeStore._testing = process.env.AWS_LAMBDA_BENCHMARK_MODE === "1"
? {
reset: () => {
instance = null;
if (globalThis.awslambda?.InvokeStore) {
delete globalThis.awslambda.InvokeStore;
}
globalThis.awslambda = {};
},
}
: undefined;
})(InvokeStore || (InvokeStore = {}));
export { InvokeStore, InvokeStoreBase };