@okam/directus-node 0.3.0 → 0.4.0

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/package.json CHANGED
@@ -1,13 +1,18 @@
1
1
  {
2
2
  "name": "@okam/directus-node",
3
3
  "main": "./src/index.js",
4
- "version": "0.3.0",
4
+ "version": "0.4.0",
5
5
  "types": "./src/index.d.ts",
6
6
  "publishConfig": {
7
- "registry": "https://registry.npmjs.org"
7
+ "access": "public"
8
8
  },
9
9
  "repository": {
10
10
  "url": "https://github.com/OKAMca/stack.git"
11
11
  },
12
+ "dependencies": {
13
+ "@graphql-codegen/cli": "^5.0.3",
14
+ "@okam/logger": "1.1.0",
15
+ "tslib": "^2.8.1"
16
+ },
12
17
  "type": "commonjs"
13
18
  }
package/src/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from './lib/redirection';
2
2
  export { default as graphqlCodegenConfig } from './lib/codegen';
3
+ export { logger as DirectusNodeLogger } from './logger';
package/src/index.js CHANGED
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.graphqlCodegenConfig = void 0;
3
+ exports.DirectusNodeLogger = exports.graphqlCodegenConfig = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  tslib_1.__exportStar(require("./lib/redirection"), exports);
6
6
  var codegen_1 = require("./lib/codegen");
7
- Object.defineProperty(exports, "graphqlCodegenConfig", { enumerable: true, get: function () { return codegen_1.default; } });
7
+ Object.defineProperty(exports, "graphqlCodegenConfig", { enumerable: true, get: function () { return tslib_1.__importDefault(codegen_1).default; } });
8
+ var logger_1 = require("./logger");
9
+ Object.defineProperty(exports, "DirectusNodeLogger", { enumerable: true, get: function () { return logger_1.logger; } });
8
10
  //# sourceMappingURL=index.js.map
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/directus/directus-node/src/index.ts"],"names":[],"mappings":";;;;AAAA,4DAAiC;AACjC,yCAA+D;AAAtD,+GAAA,OAAO,OAAwB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/directus/directus-node/src/index.ts"],"names":[],"mappings":";;;;AAAA,4DAAiC;AACjC,yCAA+D;AAAtD,wIAAA,OAAO,OAAwB;AACxC,mCAAuD;AAA9C,4GAAA,MAAM,OAAsB"}
@@ -1,8 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fetchRedirects = exports.getDefaultConfig = exports.redirectDefaultLimit = void 0;
3
+ exports.redirectDefaultLimit = void 0;
4
+ exports.getDefaultConfig = getDefaultConfig;
5
+ exports.fetchRedirects = fetchRedirects;
4
6
  const tslib_1 = require("tslib");
5
7
  const promises_1 = require("node:fs/promises");
8
+ const logger_1 = require("../logger");
6
9
  exports.redirectDefaultLimit = 2000;
7
10
  /**
8
11
  * Get Fetch Redirects Configuration
@@ -17,7 +20,6 @@ function getDefaultConfig() {
17
20
  limit: exports.redirectDefaultLimit,
18
21
  };
19
22
  }
20
- exports.getDefaultConfig = getDefaultConfig;
21
23
  function fetchRedirects(config) {
22
24
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
23
25
  var _a, _b;
@@ -65,14 +67,13 @@ function fetchRedirects(config) {
65
67
  yield (0, promises_1.writeFile)(redirectsFilename, writeDataRedirects);
66
68
  const writeDataRewrites = JSON.stringify(data.rewrites || []);
67
69
  yield (0, promises_1.writeFile)(rewritesFilename, writeDataRewrites);
68
- console.log(`Redirects count: ${((_a = data.redirects) === null || _a === void 0 ? void 0 : _a.length) || 0}, Rewrites count: ${((_b = data.rewrites) === null || _b === void 0 ? void 0 : _b.length) || 0}`);
70
+ (0, logger_1.log)(`Redirects count: ${((_a = data.redirects) === null || _a === void 0 ? void 0 : _a.length) || 0}, Rewrites count: ${((_b = data.rewrites) === null || _b === void 0 ? void 0 : _b.length) || 0}`);
69
71
  }
70
72
  catch (e) {
71
- console.warn('Error fetching redirects:', e.message);
73
+ (0, logger_1.log)(`Error fetching redirects: ${e.message}`, 'error');
72
74
  return true; // still want build to pass
73
75
  }
74
76
  return true;
75
77
  });
76
78
  }
77
- exports.fetchRedirects = fetchRedirects;
78
79
  //# sourceMappingURL=redirection.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"redirection.js","sourceRoot":"","sources":["../../../../../../libs/directus/directus-node/src/lib/redirection.ts"],"names":[],"mappings":";;;;AAAA,+CAA4C;AAU/B,QAAA,oBAAoB,GAAG,IAAI,CAAA;AAExC;;;GAGG;AACH,SAAgB,gBAAgB;IAC9B,OAAO;QACL,eAAe,EAAE,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,IAAI,EAAE;QAC7D,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,IAAI,EAAE;QACxD,iBAAiB,EAAE,2BAA2B;QAC9C,gBAAgB,EAAE,0BAA0B;QAC5C,KAAK,EAAE,4BAAoB;KAC5B,CAAA;AACH,CAAC;AARD,4CAQC;AAED,SAAsB,cAAc,CAAC,MAA6B;;;QAChE,MAAM,EAAE,eAAe,EAAE,aAAa,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,KAAK,EAAE,GAAG,MAAM,CAAA;QAE7F,IAAI,CAAC,eAAe,IAAI,CAAC,aAAa,EAAE,CAAC;YACvC,MAAM,IAAI,KAAK,CAAC,gFAAgF,CAAC,CAAA;QACnG,CAAC;QAED,IAAI,CAAC,iBAAiB,IAAI,CAAC,gBAAgB,EAAE,CAAC;YAC5C,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAA;QACrC,CAAC;QAED,MAAM,KAAK,GAAG;;;;;;;;;;;;;EAad,CAAA;QAEA,MAAM,WAAW,GAAG;YAClB,KAAK;YACL,uBAAuB;YACvB,SAAS,EAAE;gBACT,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI,4BAAoB;aAC7C;SACF,CAAA;QAED,IAAI,CAAC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CAAC,IAAI,EAAE,CAAA;YAEtC,MAAM,kBAAkB,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,IAAI,EAAE,CAAC,CAAA;YAC/D,MAAM,IAAA,oBAAS,EAAC,iBAAiB,EAAE,kBAAkB,CAAC,CAAA;YAEtD,MAAM,iBAAiB,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAA;YAC7D,MAAM,IAAA,oBAAS,EAAC,gBAAgB,EAAE,iBAAiB,CAAC,CAAA;YAEpD,IAAA,YAAG,EAAC,oBAAoB,CAAA,MAAA,IAAI,CAAC,SAAS,0CAAE,MAAM,KAAI,CAAC,qBAAqB,CAAA,MAAA,IAAI,CAAC,QAAQ,0CAAE,MAAM,KAAI,CAAC,EAAE,CAAC,CAAA;QACvG,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,IAAA,YAAG,EAAC,6BAA8B,CAAW,CAAC,OAAO,EAAE,EAAE,OAAO,CAAC,CAAA;YACjE,OAAO,IAAI,CAAA,CAAC,2BAA2B;QACzC,CAAC;QAED,OAAO,IAAI,CAAA;IACb,CAAC;CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare const logger: import("@okam/logger").Logger;
2
+ export declare const log: (message: string, severity?: import("@okam/logger").LogSeverity, context?: Record<string, unknown>) => void;
package/src/logger.js ADDED
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.log = exports.logger = void 0;
4
+ const logger_1 = require("@okam/logger");
5
+ exports.logger = (0, logger_1.createLogger)('[DirectusNode]');
6
+ exports.log = exports.logger.log;
7
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../../../libs/directus/directus-node/src/logger.ts"],"names":[],"mappings":";;;AAAA,yCAA2C;AAE9B,QAAA,MAAM,GAAG,IAAA,qBAAY,EAAC,gBAAgB,CAAC,CAAA;AAErC,WAAG,GAAK,cAAM,KAAA"}