jaypie 1.1.21 → 1.1.22

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/index.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ export * from "@jaypie/core";
2
+ export * from "@jaypie/aws";
3
+ export * from "@jaypie/express";
4
+ export * from "@jaypie/datadog";
5
+ export * from "@jaypie/lambda";
6
+ export * from "@jaypie/mongoose";
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "jaypie",
3
- "version": "1.1.21",
3
+ "version": "1.1.22",
4
4
  "license": "MIT",
5
5
  "author": "Finlayson Studio",
6
6
  "type": "module",
7
7
  "exports": {
8
8
  ".": {
9
+ "types": "./index.d.ts",
9
10
  "default": {
10
11
  "require": "./dist/jaypie.cjs",
11
12
  "default": "./src/index.js"
@@ -13,6 +14,7 @@
13
14
  }
14
15
  },
15
16
  "main": "src/index.js",
17
+ "types": "index.d.ts",
16
18
  "scripts": {
17
19
  "build": "rollup --config",
18
20
  "format": "npm run format:package && npm run format:lint",
@@ -26,15 +28,15 @@
26
28
  "test:spec:mongoose.package": "vitest run ./src/__tests__/mongoose.package.spec.js"
27
29
  },
28
30
  "dependencies": {
29
- "@jaypie/aws": "^1.1.14",
30
- "@jaypie/core": "^1.1.1",
31
- "@jaypie/datadog": "^1.1.0",
32
- "@jaypie/express": "^1.1.9",
33
- "@jaypie/lambda": "^1.1.2",
34
- "@jaypie/mongoose": "^1.1.0"
31
+ "@jaypie/aws": "^1.1.15",
32
+ "@jaypie/core": "^1.1.2",
33
+ "@jaypie/datadog": "^1.1.1",
34
+ "@jaypie/express": "^1.1.10",
35
+ "@jaypie/lambda": "^1.1.3",
36
+ "@jaypie/mongoose": "^1.1.1"
35
37
  },
36
38
  "publishConfig": {
37
39
  "access": "public"
38
40
  },
39
- "gitHead": "002d2c5523773f58cc4f65abd63e3784263e95df"
41
+ "gitHead": "08af07d30540e9e528d2a3d2a7f1cb972d27cdc2"
40
42
  }
@@ -1,75 +0,0 @@
1
- import { ConfigurationError, JAYPIE, log } from "@jaypie/core";
2
-
3
- //
4
- //
5
- // Helper Functions
6
- //
7
-
8
- const _importedModule = {};
9
- async function dynamicImport(module) {
10
- if (!_importedModule[module]) {
11
- try {
12
- _importedModule[module] = await import(module);
13
- // eslint-disable-next-line no-unused-vars
14
- } catch (error) {
15
- if (process.env.NODE_ENV === "test") {
16
- if (!_importedModule[module]) {
17
- // eslint-disable-next-line no-console
18
- console.warn(
19
- `[jaypie] Caught error importing ${module} -- Is it installed?`,
20
- );
21
- }
22
- }
23
- throw new ConfigurationError();
24
- }
25
- }
26
- return _importedModule[module];
27
- }
28
-
29
- //
30
- //
31
- // Main
32
- //
33
-
34
- export default async ({
35
- functions = ["default"],
36
- moduleImport,
37
- vars = [],
38
- } = {}) => {
39
- // Validate
40
- if (!moduleImport || typeof moduleImport !== "string") {
41
- throw new ConfigurationError("`moduleImport` must be a string");
42
- }
43
- if (!Array.isArray(functions)) {
44
- throw new ConfigurationError("`functions` must be an array");
45
- }
46
- if (!Array.isArray(vars)) {
47
- throw new ConfigurationError("`vars` must be an array");
48
- }
49
- if (!functions.length && !vars.length) {
50
- throw new ConfigurationError(
51
- "Either `functions` or `vars` must be provided",
52
- );
53
- }
54
- // Process
55
- try {
56
- // Attempt to import the module
57
- return await dynamicImport(moduleImport);
58
- // eslint-disable-next-line no-unused-vars
59
- } catch (error) {
60
- log
61
- .lib({ lib: JAYPIE.LIB.JAYPIE })
62
- .trace(`[jaypie] ${moduleImport} could not be imported; continuing`);
63
- }
64
- // Return
65
- const result = {};
66
- functions.forEach((func) => {
67
- result[func] = () => {
68
- throw new ConfigurationError(`${moduleImport}.${func} is not available`);
69
- };
70
- });
71
- vars.forEach((variable) => {
72
- result[variable] = null;
73
- });
74
- return result;
75
- };