Files
smartrequest/ts/core/index.ts
2025-07-28 17:23:48 +00:00

23 lines
800 B
TypeScript

import * as smartenv from '@push.rocks/smartenv';
// Export all base types - these are the public API
export * from '../core_base/types.js';
const smartenvInstance = new smartenv.Smartenv();
// Load the appropriate implementation based on environment
const implementation = await (async () => {
if (smartenvInstance.isNode) {
return smartenvInstance.getSafeNodeModule<typeof import('../core_node/index.js')>('../core_node/index.js');
} else {
return import('../core_fetch/index.js');
}
})();
// Export the implementation classes
export const CoreRequest = implementation.CoreRequest;
export const CoreResponse = implementation.CoreResponse;
// Export CoreResponse as a type for type annotations
export type CoreResponse<T = any> = InstanceType<typeof implementation.CoreResponse>;