index.cjs 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. "use strict";
  2. var __defProp = Object.defineProperty;
  3. var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
  4. var __getOwnPropNames = Object.getOwnPropertyNames;
  5. var __hasOwnProp = Object.prototype.hasOwnProperty;
  6. var __export = (target, all) => {
  7. for (var name in all)
  8. __defProp(target, name, { get: all[name], enumerable: true });
  9. };
  10. var __copyProps = (to, from, except, desc) => {
  11. if (from && typeof from === "object" || typeof from === "function") {
  12. for (let key of __getOwnPropNames(from))
  13. if (!__hasOwnProp.call(to, key) && key !== except)
  14. __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  15. }
  16. return to;
  17. };
  18. var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
  19. var wasm_exports = {};
  20. __export(wasm_exports, {
  21. drizzle: () => drizzle
  22. });
  23. module.exports = __toCommonJS(wasm_exports);
  24. var import_client_wasm = require("@libsql/client-wasm");
  25. var import_utils = require("../../utils.cjs");
  26. var import_driver_core = require("../driver-core.cjs");
  27. function drizzle(...params) {
  28. if (typeof params[0] === "string") {
  29. const instance = (0, import_client_wasm.createClient)({
  30. url: params[0]
  31. });
  32. return (0, import_driver_core.construct)(instance, params[1]);
  33. }
  34. if ((0, import_utils.isConfig)(params[0])) {
  35. const { connection, client, ...drizzleConfig } = params[0];
  36. if (client) return (0, import_driver_core.construct)(client, drizzleConfig);
  37. const instance = typeof connection === "string" ? (0, import_client_wasm.createClient)({ url: connection }) : (0, import_client_wasm.createClient)(connection);
  38. return (0, import_driver_core.construct)(instance, drizzleConfig);
  39. }
  40. return (0, import_driver_core.construct)(params[0], params[1]);
  41. }
  42. ((drizzle2) => {
  43. function mock(config) {
  44. return (0, import_driver_core.construct)({}, config);
  45. }
  46. drizzle2.mock = mock;
  47. })(drizzle || (drizzle = {}));
  48. // Annotate the CommonJS export names for ESM import in node:
  49. 0 && (module.exports = {
  50. drizzle
  51. });
  52. //# sourceMappingURL=index.cjs.map