@gustavo-valsechi/node 1.0.16 → 1.0.19

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
@@ -229,14 +229,18 @@ var healthRouter = (router, options, done) => {
229
229
  // src/server/index.ts
230
230
  var import_fastify = __toESM(require("fastify"));
231
231
  var import_fastify_plugin = __toESM(require("fastify-plugin"));
232
+ var import_cors = __toESM(require("@fastify/cors"));
232
233
  var app = (0, import_fastify.default)();
233
234
  var serverInit = (appConfig) => {
235
+ var _a;
234
236
  const PORT = process.env.HOST_PORT;
235
237
  const VERSION = process.env.HOST_VERSION;
236
238
  const DOMAIN = process.env.HOST_DOMAIN;
239
+ console.log(process.env);
237
240
  if (!PORT) throw new Error("HOST_PORT is required!");
238
241
  if (!VERSION) throw new Error("HOST_VERSION is required!");
239
242
  if (!DOMAIN) throw new Error("HOST_DOMAIN is required!");
243
+ app.register(import_cors.default, { origin: ((_a = process.env.CORS_HOSTS) == null ? void 0 : _a.split(";")) || true });
240
244
  app.register(
241
245
  (0, import_fastify_plugin.default)(async (instance) => {
242
246
  instance.addHook(
package/dist/index.mjs CHANGED
@@ -199,14 +199,18 @@ var healthRouter = (router, options, done) => {
199
199
  // src/server/index.ts
200
200
  import fastify from "fastify";
201
201
  import fp from "fastify-plugin";
202
+ import cors from "@fastify/cors";
202
203
  var app = fastify();
203
204
  var serverInit = (appConfig) => {
205
+ var _a;
204
206
  const PORT = process.env.HOST_PORT;
205
207
  const VERSION = process.env.HOST_VERSION;
206
208
  const DOMAIN = process.env.HOST_DOMAIN;
209
+ console.log(process.env);
207
210
  if (!PORT) throw new Error("HOST_PORT is required!");
208
211
  if (!VERSION) throw new Error("HOST_VERSION is required!");
209
212
  if (!DOMAIN) throw new Error("HOST_DOMAIN is required!");
213
+ app.register(cors, { origin: ((_a = process.env.CORS_HOSTS) == null ? void 0 : _a.split(";")) || true });
210
214
  app.register(
211
215
  fp(async (instance) => {
212
216
  instance.addHook(
@@ -74,6 +74,7 @@ var healthRouter = (router, options, done) => {
74
74
  // src/server/index.ts
75
75
  var import_fastify = __toESM(require("fastify"));
76
76
  var import_fastify_plugin = __toESM(require("fastify-plugin"));
77
+ var import_cors = __toESM(require("@fastify/cors"));
77
78
  var app = (0, import_fastify.default)();
78
79
 
79
80
  // src/router/api.ts
@@ -48,6 +48,7 @@ var healthRouter = (router, options, done) => {
48
48
  // src/server/index.ts
49
49
  import fastify from "fastify";
50
50
  import fp from "fastify-plugin";
51
+ import cors from "@fastify/cors";
51
52
  var app = fastify();
52
53
 
53
54
  // src/router/api.ts
@@ -2,7 +2,11 @@ import * as fastify from 'fastify';
2
2
  import { FastifyInstance } from 'fastify';
3
3
  import * as http from 'http';
4
4
 
5
- declare const app: FastifyInstance<http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>, http.IncomingMessage, http.ServerResponse<http.IncomingMessage>, fastify.FastifyBaseLogger, fastify.FastifyTypeProviderDefault> & PromiseLike<FastifyInstance<http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>, http.IncomingMessage, http.ServerResponse<http.IncomingMessage>, fastify.FastifyBaseLogger, fastify.FastifyTypeProviderDefault>>;
6
- declare const serverInit: (appConfig?: (app: FastifyInstance) => void) => FastifyInstance<http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>, http.IncomingMessage, http.ServerResponse<http.IncomingMessage>, fastify.FastifyBaseLogger, fastify.FastifyTypeProviderDefault> & PromiseLike<FastifyInstance<http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>, http.IncomingMessage, http.ServerResponse<http.IncomingMessage>, fastify.FastifyBaseLogger, fastify.FastifyTypeProviderDefault>>;
5
+ declare const app: FastifyInstance<http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>, http.IncomingMessage, http.ServerResponse<http.IncomingMessage>, fastify.FastifyBaseLogger, fastify.FastifyTypeProviderDefault> & PromiseLike<FastifyInstance<http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>, http.IncomingMessage, http.ServerResponse<http.IncomingMessage>, fastify.FastifyBaseLogger, fastify.FastifyTypeProviderDefault>> & {
6
+ __linterBrands: "SafePromiseLike";
7
+ };
8
+ declare const serverInit: (appConfig?: (app: FastifyInstance) => void) => FastifyInstance<http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>, http.IncomingMessage, http.ServerResponse<http.IncomingMessage>, fastify.FastifyBaseLogger, fastify.FastifyTypeProviderDefault> & PromiseLike<FastifyInstance<http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>, http.IncomingMessage, http.ServerResponse<http.IncomingMessage>, fastify.FastifyBaseLogger, fastify.FastifyTypeProviderDefault>> & {
9
+ __linterBrands: "SafePromiseLike";
10
+ };
7
11
 
8
12
  export { app, serverInit };
@@ -2,7 +2,11 @@ import * as fastify from 'fastify';
2
2
  import { FastifyInstance } from 'fastify';
3
3
  import * as http from 'http';
4
4
 
5
- declare const app: FastifyInstance<http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>, http.IncomingMessage, http.ServerResponse<http.IncomingMessage>, fastify.FastifyBaseLogger, fastify.FastifyTypeProviderDefault> & PromiseLike<FastifyInstance<http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>, http.IncomingMessage, http.ServerResponse<http.IncomingMessage>, fastify.FastifyBaseLogger, fastify.FastifyTypeProviderDefault>>;
6
- declare const serverInit: (appConfig?: (app: FastifyInstance) => void) => FastifyInstance<http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>, http.IncomingMessage, http.ServerResponse<http.IncomingMessage>, fastify.FastifyBaseLogger, fastify.FastifyTypeProviderDefault> & PromiseLike<FastifyInstance<http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>, http.IncomingMessage, http.ServerResponse<http.IncomingMessage>, fastify.FastifyBaseLogger, fastify.FastifyTypeProviderDefault>>;
5
+ declare const app: FastifyInstance<http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>, http.IncomingMessage, http.ServerResponse<http.IncomingMessage>, fastify.FastifyBaseLogger, fastify.FastifyTypeProviderDefault> & PromiseLike<FastifyInstance<http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>, http.IncomingMessage, http.ServerResponse<http.IncomingMessage>, fastify.FastifyBaseLogger, fastify.FastifyTypeProviderDefault>> & {
6
+ __linterBrands: "SafePromiseLike";
7
+ };
8
+ declare const serverInit: (appConfig?: (app: FastifyInstance) => void) => FastifyInstance<http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>, http.IncomingMessage, http.ServerResponse<http.IncomingMessage>, fastify.FastifyBaseLogger, fastify.FastifyTypeProviderDefault> & PromiseLike<FastifyInstance<http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>, http.IncomingMessage, http.ServerResponse<http.IncomingMessage>, fastify.FastifyBaseLogger, fastify.FastifyTypeProviderDefault>> & {
9
+ __linterBrands: "SafePromiseLike";
10
+ };
7
11
 
8
12
  export { app, serverInit };
@@ -83,14 +83,18 @@ var mainRouter = (router, options, done) => {
83
83
 
84
84
  // src/server/index.ts
85
85
  var import_fastify_plugin = __toESM(require("fastify-plugin"));
86
+ var import_cors = __toESM(require("@fastify/cors"));
86
87
  var app = (0, import_fastify.default)();
87
88
  var serverInit = (appConfig) => {
89
+ var _a;
88
90
  const PORT = process.env.HOST_PORT;
89
91
  const VERSION = process.env.HOST_VERSION;
90
92
  const DOMAIN = process.env.HOST_DOMAIN;
93
+ console.log(process.env);
91
94
  if (!PORT) throw new Error("HOST_PORT is required!");
92
95
  if (!VERSION) throw new Error("HOST_VERSION is required!");
93
96
  if (!DOMAIN) throw new Error("HOST_DOMAIN is required!");
97
+ app.register(import_cors.default, { origin: ((_a = process.env.CORS_HOSTS) == null ? void 0 : _a.split(";")) || true });
94
98
  app.register(
95
99
  (0, import_fastify_plugin.default)(async (instance) => {
96
100
  instance.addHook(
@@ -59,14 +59,18 @@ var mainRouter = (router, options, done) => {
59
59
 
60
60
  // src/server/index.ts
61
61
  import fp from "fastify-plugin";
62
+ import cors from "@fastify/cors";
62
63
  var app = fastify();
63
64
  var serverInit = (appConfig) => {
65
+ var _a;
64
66
  const PORT = process.env.HOST_PORT;
65
67
  const VERSION = process.env.HOST_VERSION;
66
68
  const DOMAIN = process.env.HOST_DOMAIN;
69
+ console.log(process.env);
67
70
  if (!PORT) throw new Error("HOST_PORT is required!");
68
71
  if (!VERSION) throw new Error("HOST_VERSION is required!");
69
72
  if (!DOMAIN) throw new Error("HOST_DOMAIN is required!");
73
+ app.register(cors, { origin: ((_a = process.env.CORS_HOSTS) == null ? void 0 : _a.split(";")) || true });
70
74
  app.register(
71
75
  fp(async (instance) => {
72
76
  instance.addHook(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gustavo-valsechi/node",
3
- "version": "1.0.16",
3
+ "version": "1.0.19",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -21,6 +21,7 @@
21
21
  "typeorm": "0.3.26"
22
22
  },
23
23
  "dependencies": {
24
+ "@fastify/cors": "11.2.0",
24
25
  "body-parser": "2.2.1",
25
26
  "dotenv": "16.4.5",
26
27
  "lodash": "4.17.21",
@@ -34,14 +35,14 @@
34
35
  "eslint": "9.1.1",
35
36
  "fastify": "5.6.2",
36
37
  "fastify-plugin": "5.1.0",
37
- "pg": "8.11.5",
38
38
  "morgan": "1.10.0",
39
- "typescript": "5.4.5",
40
- "vitest": "3.0.5",
39
+ "pg": "8.11.5",
41
40
  "rimraf": "6.1.0",
42
41
  "tsc-alias": "1.8.16",
43
42
  "tsup": "8.5.0",
44
- "typeorm": "0.3.26"
43
+ "typeorm": "0.3.26",
44
+ "typescript": "5.4.5",
45
+ "vitest": "3.0.5"
45
46
  },
46
47
  "publishConfig": {
47
48
  "access": "public"