@faasjs/knex 0.0.3-beta.87 → 0.0.3-beta.89

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,46 +1,21 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1
+ 'use strict';
2
+
3
+ var func = require('@faasjs/func');
4
+ var logger = require('@faasjs/logger');
5
+ var deep_merge = require('@faasjs/deep_merge');
6
+ var knex = require('knex');
29
7
 
30
- // src/index.ts
31
- var src_exports = {};
32
- __export(src_exports, {
33
- Knex: () => Knex,
34
- query: () => query,
35
- raw: () => raw,
36
- transaction: () => transaction,
37
- useKnex: () => useKnex
8
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
9
+
10
+ var knex__default = /*#__PURE__*/_interopDefault(knex);
11
+
12
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
13
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
14
+ }) : x)(function(x) {
15
+ if (typeof require !== "undefined")
16
+ return require.apply(this, arguments);
17
+ throw Error('Dynamic require of "' + x + '" is not supported');
38
18
  });
39
- module.exports = __toCommonJS(src_exports);
40
- var import_func = require("@faasjs/func");
41
- var import_logger = require("@faasjs/logger");
42
- var import_deep_merge = require("@faasjs/deep_merge");
43
- var import_knex = __toESM(require("knex"));
44
19
  var Name = "knex";
45
20
  if (!global["FaasJS_Knex"]) {
46
21
  global.FaasJS_Knex = {};
@@ -66,7 +41,7 @@ var Knex = class {
66
41
  data.dependencies["better-sqlite3"] = "*";
67
42
  else
68
43
  data.dependencies[client] = "*";
69
- new import_logger.Logger(this.name).debug("add dependencies: " + client);
44
+ new logger.Logger(this.name).debug("add dependencies: " + client);
70
45
  await next();
71
46
  }
72
47
  async onMount(data, next) {
@@ -94,7 +69,7 @@ var Knex = class {
94
69
  this.config[key] = value;
95
70
  }
96
71
  if (data.config.plugins && ((_a = data.config.plugins[this.name]) == null ? void 0 : _a.config))
97
- this.config = (0, import_deep_merge.deepMerge)(data.config.plugins[this.name].config, this.config);
72
+ this.config = deep_merge.deepMerge(data.config.plugins[this.name].config, this.config);
98
73
  if (this.config.client === "sqlite3")
99
74
  this.config.client = "better-sqlite3";
100
75
  if (this.config.client === "pg" && typeof ((_b = this.config.pool) == null ? void 0 : _b.propagateCreateError) === "undefined") {
@@ -110,9 +85,9 @@ var Knex = class {
110
85
  if (typeof this.config.connection === "string" && !this.config.connection.includes("json=true"))
111
86
  this.config.connection = this.config.connection + "?json=true";
112
87
  }
113
- this.adapter = (0, import_knex.default)(this.config);
88
+ this.adapter = knex__default.default(this.config);
114
89
  if (this.config.client === "pg") {
115
- const pg = require("pg");
90
+ const pg = __require("pg");
116
91
  const intTypes = [
117
92
  "INT2",
118
93
  "INT4",
@@ -188,8 +163,8 @@ var Knex = class {
188
163
  function useKnex(config) {
189
164
  const name = (config == null ? void 0 : config.name) || Name;
190
165
  if (global.FaasJS_Knex[name])
191
- return (0, import_func.usePlugin)(global.FaasJS_Knex[name]);
192
- return (0, import_func.usePlugin)(new Knex(config));
166
+ return func.usePlugin(global.FaasJS_Knex[name]);
167
+ return func.usePlugin(new Knex(config));
193
168
  }
194
169
  function query(table) {
195
170
  return useKnex().query(table);
@@ -200,11 +175,9 @@ async function transaction(scope, config) {
200
175
  async function raw(sql, bindings = []) {
201
176
  return useKnex().raw(sql, bindings);
202
177
  }
203
- // Annotate the CommonJS export names for ESM import in node:
204
- 0 && (module.exports = {
205
- Knex,
206
- query,
207
- raw,
208
- transaction,
209
- useKnex
210
- });
178
+
179
+ exports.Knex = Knex;
180
+ exports.query = query;
181
+ exports.raw = raw;
182
+ exports.transaction = transaction;
183
+ exports.useKnex = useKnex;
package/dist/index.mjs CHANGED
@@ -1,3 +1,8 @@
1
+ import { usePlugin } from '@faasjs/func';
2
+ import { Logger } from '@faasjs/logger';
3
+ import { deepMerge } from '@faasjs/deep_merge';
4
+ import knex from 'knex';
5
+
1
6
  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
7
  get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
8
  }) : x)(function(x) {
@@ -5,14 +10,6 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
5
10
  return require.apply(this, arguments);
6
11
  throw Error('Dynamic require of "' + x + '" is not supported');
7
12
  });
8
-
9
- // src/index.ts
10
- import {
11
- usePlugin
12
- } from "@faasjs/func";
13
- import { Logger } from "@faasjs/logger";
14
- import { deepMerge } from "@faasjs/deep_merge";
15
- import knex from "knex";
16
13
  var Name = "knex";
17
14
  if (!global["FaasJS_Knex"]) {
18
15
  global.FaasJS_Knex = {};
@@ -172,10 +169,5 @@ async function transaction(scope, config) {
172
169
  async function raw(sql, bindings = []) {
173
170
  return useKnex().raw(sql, bindings);
174
171
  }
175
- export {
176
- Knex,
177
- query,
178
- raw,
179
- transaction,
180
- useKnex
181
- };
172
+
173
+ export { Knex, query, raw, transaction, useKnex };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faasjs/knex",
3
- "version": "0.0.3-beta.87",
3
+ "version": "0.0.3-beta.89",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -21,9 +21,9 @@
21
21
  "dist"
22
22
  ],
23
23
  "dependencies": {
24
- "@faasjs/deep_merge": "^0.0.3-beta.87",
25
- "@faasjs/func": "^0.0.3-beta.87",
26
- "@faasjs/logger": "^0.0.3-beta.87",
24
+ "@faasjs/deep_merge": "^0.0.3-beta.89",
25
+ "@faasjs/func": "^0.0.3-beta.89",
26
+ "@faasjs/logger": "^0.0.3-beta.89",
27
27
  "knex": "*"
28
28
  },
29
29
  "devDependencies": {