softkave-node-utils 0.5.0 → 0.6.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/build/common/getClientConfig.d.ts +2 -4
- package/build/common/getClientConfig.js +15 -18
- package/build/common/getClientConfig.js.map +1 -1
- package/build/common/logger/fimidx-console-logger.js +3 -4
- package/build/common/logger/fimidx-console-logger.js.map +1 -1
- package/build/common/logger/fimidx-logger.js +3 -2
- package/build/common/logger/fimidx-logger.js.map +1 -1
- package/build/mongo/MongooseMongoDBConnection.d.ts +6 -6
- package/build/mongo/MongooseMongoDBConnection.js +1 -1
- package/build/mongo/MongooseMongoDBConnection.js.map +1 -1
- package/build/mongo/utils.d.ts +7 -7
- package/build/mongo/utils.js +2 -2
- package/build/mongo/utils.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
export declare const getClientConfig: () => {
|
|
2
|
-
|
|
3
|
-
fimidxAppId: string;
|
|
2
|
+
fimidxProjectId: string;
|
|
4
3
|
fimidxClientToken: string;
|
|
5
|
-
fimidxServerUrl: string | undefined;
|
|
6
|
-
nodeEnv: string;
|
|
7
4
|
fimidxLoggerEnabled: boolean;
|
|
5
|
+
fimidxServerUrl?: string | undefined;
|
|
8
6
|
};
|
|
9
7
|
//# sourceMappingURL=getClientConfig.d.ts.map
|
|
@@ -1,23 +1,20 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
const fimidxProjectId = process.env.NEXT_PUBLIC_FIMIDX_LOGGER_PROJECT_ID;
|
|
3
|
+
const fimidxClientToken = process.env.NEXT_PUBLIC_FIMIDX_LOGGER_CLIENT_TOKEN;
|
|
4
|
+
const fimidxLoggerEnabled = process.env.NEXT_PUBLIC_FIMIDX_LOGGER_ENABLED;
|
|
5
|
+
const fimidxServerUrl = process.env.NEXT_PUBLIC_FIMIDX_LOGGER_SERVER_URL;
|
|
6
|
+
const clientConfigSchema = z.object({
|
|
7
|
+
fimidxProjectId: z.string(),
|
|
8
|
+
fimidxClientToken: z.string(),
|
|
9
|
+
fimidxLoggerEnabled: z.boolean().default(false),
|
|
10
|
+
fimidxServerUrl: z.string().url().optional(),
|
|
11
|
+
});
|
|
2
12
|
export const getClientConfig = () => {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const fimidxClientToken = process.env.NEXT_PUBLIC_FIMIDX_LOGGER_CLIENT_TOKEN;
|
|
6
|
-
const fimidxServerUrl = process.env.NEXT_PUBLIC_FIMIDX_LOGGER_SERVER_URL;
|
|
7
|
-
const nodeEnv = process.env.NEXT_PUBLIC_APP_ENV;
|
|
8
|
-
const fimidxLoggerEnabled = process.env.NEXT_PUBLIC_FIMIDX_LOGGER_ENABLED === 'true';
|
|
9
|
-
// assert.ok(publicURL, 'NEXT_PUBLIC_URL is not set');
|
|
10
|
-
assert.ok(fimidxAppId, 'NEXT_PUBLIC_FIMIDX_LOGGER_APP_ID is not set');
|
|
11
|
-
assert.ok(fimidxClientToken, 'NEXT_PUBLIC_FIMIDX_LOGGER_CLIENT_TOKEN is not set');
|
|
12
|
-
// assert.ok(fimidxServerUrl, "NEXT_PUBLIC_FIMIDX_LOGGER_SERVER_URL is not set");
|
|
13
|
-
assert.ok(nodeEnv, 'NEXT_PUBLIC_APP_ENV is not set');
|
|
14
|
-
return {
|
|
15
|
-
publicURL,
|
|
16
|
-
fimidxAppId,
|
|
13
|
+
return clientConfigSchema.parse({
|
|
14
|
+
fimidxProjectId,
|
|
17
15
|
fimidxClientToken,
|
|
16
|
+
fimidxLoggerEnabled: fimidxLoggerEnabled === 'true',
|
|
18
17
|
fimidxServerUrl,
|
|
19
|
-
|
|
20
|
-
fimidxLoggerEnabled,
|
|
21
|
-
};
|
|
18
|
+
});
|
|
22
19
|
};
|
|
23
20
|
//# sourceMappingURL=getClientConfig.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getClientConfig.js","sourceRoot":"","sources":["../../src/common/getClientConfig.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"getClientConfig.js","sourceRoot":"","sources":["../../src/common/getClientConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,MAAM,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC;AACzE,MAAM,iBAAiB,GAAG,OAAO,CAAC,GAAG,CAAC,sCAAsC,CAAC;AAC7E,MAAM,mBAAmB,GAAG,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC;AAC1E,MAAM,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC;AAEzE,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE;IAC3B,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE;IAC7B,mBAAmB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IAC/C,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;CAC7C,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,EAAE;IAClC,OAAO,kBAAkB,CAAC,KAAK,CAAC;QAC9B,eAAe;QACf,iBAAiB;QACjB,mBAAmB,EAAE,mBAAmB,KAAK,MAAM;QACnD,eAAe;KAChB,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { FimidxConsoleLikeLogger } from 'fimidx';
|
|
2
2
|
import { getClientConfig } from '../getClientConfig.js';
|
|
3
3
|
import { fimidxLogger } from './fimidx-logger.js';
|
|
4
|
-
const {
|
|
4
|
+
const { fimidxLoggerEnabled } = getClientConfig();
|
|
5
5
|
export const fimidxConsoleLogger = new FimidxConsoleLikeLogger({
|
|
6
6
|
fimidxLogger: fimidxLogger,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
enabled: fimidxLoggerEnabled,
|
|
7
|
+
enableConsoleFallback: true,
|
|
8
|
+
logToFimidx: fimidxLoggerEnabled,
|
|
10
9
|
});
|
|
11
10
|
//# sourceMappingURL=fimidx-console-logger.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fimidx-console-logger.js","sourceRoot":"","sources":["../../../src/common/logger/fimidx-console-logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,uBAAuB,EAAC,MAAM,QAAQ,CAAC;AAC/C,OAAO,EAAC,eAAe,EAAC,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAEhD,MAAM,EAAC,
|
|
1
|
+
{"version":3,"file":"fimidx-console-logger.js","sourceRoot":"","sources":["../../../src/common/logger/fimidx-console-logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,uBAAuB,EAAC,MAAM,QAAQ,CAAC;AAC/C,OAAO,EAAC,eAAe,EAAC,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAEhD,MAAM,EAAC,mBAAmB,EAAC,GAAG,eAAe,EAAE,CAAC;AAEhD,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,uBAAuB,CAAC;IAC7D,YAAY,EAAE,YAAY;IAC1B,qBAAqB,EAAE,IAAI;IAC3B,WAAW,EAAE,mBAAmB;CACjC,CAAC,CAAC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { FimidxLogger } from 'fimidx';
|
|
2
2
|
import { getClientConfig } from '../getClientConfig.js';
|
|
3
|
-
const {
|
|
3
|
+
const { fimidxProjectId, fimidxClientToken, fimidxServerUrl } = getClientConfig();
|
|
4
4
|
export const fimidxLogger = new FimidxLogger({
|
|
5
|
-
|
|
5
|
+
projectId: fimidxProjectId,
|
|
6
6
|
clientToken: fimidxClientToken,
|
|
7
7
|
consoleLogOnError: true,
|
|
8
8
|
logRemoteErrors: true,
|
|
9
|
+
...(fimidxServerUrl ? { serverURL: fimidxServerUrl } : {}),
|
|
9
10
|
});
|
|
10
11
|
//# sourceMappingURL=fimidx-logger.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fimidx-logger.js","sourceRoot":"","sources":["../../../src/common/logger/fimidx-logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAC,eAAe,EAAC,MAAM,uBAAuB,CAAC;AAEtD,MAAM,EAAC,
|
|
1
|
+
{"version":3,"file":"fimidx-logger.js","sourceRoot":"","sources":["../../../src/common/logger/fimidx-logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAC,eAAe,EAAC,MAAM,uBAAuB,CAAC;AAEtD,MAAM,EAAC,eAAe,EAAE,iBAAiB,EAAE,eAAe,EAAC,GAAG,eAAe,EAAE,CAAC;AAEhF,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,YAAY,CAAC;IAC3C,SAAS,EAAE,eAAe;IAC1B,WAAW,EAAE,iBAAiB;IAC9B,iBAAiB,EAAE,IAAI;IACvB,eAAe,EAAE,IAAI;IACrB,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,EAAC,SAAS,EAAE,eAAe,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC;CACzD,CAAC,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import mongoose from 'mongoose';
|
|
2
2
|
import { type MongoDBConnection } from './types.js';
|
|
3
|
-
export declare class MongooseMongoDBConnection implements MongoDBConnection<Connection> {
|
|
4
|
-
protected connection: Connection;
|
|
5
|
-
protected promise: Promise<Connection>;
|
|
3
|
+
export declare class MongooseMongoDBConnection implements MongoDBConnection<mongoose.Connection> {
|
|
4
|
+
protected connection: mongoose.Connection;
|
|
5
|
+
protected promise: Promise<mongoose.Connection>;
|
|
6
6
|
constructor(uri: string, dbName: string);
|
|
7
|
-
get: <TConnection = Connection>() => TConnection;
|
|
8
|
-
wait: <TConnection = Connection>() => Promise<TConnection>;
|
|
7
|
+
get: <TConnection = mongoose.Connection>() => TConnection;
|
|
8
|
+
wait: <TConnection = mongoose.Connection>() => Promise<TConnection>;
|
|
9
9
|
close: () => Promise<void>;
|
|
10
10
|
}
|
|
11
11
|
//# sourceMappingURL=MongooseMongoDBConnection.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MongooseMongoDBConnection.js","sourceRoot":"","sources":["../../src/mongo/MongooseMongoDBConnection.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"MongooseMongoDBConnection.js","sourceRoot":"","sources":["../../src/mongo/MongooseMongoDBConnection.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAwB,MAAM,YAAY,CAAC;AAClD,OAAO,EAAC,0BAA0B,EAAC,MAAM,YAAY,CAAC;AAEtD,MAAM,OAAO,yBAAyB;IAMpC,YAAY,GAAW,EAAE,MAAc;QAMvC,QAAG,GAAG,GAAsC,EAAE;YAC5C,OAAO,IAAI,CAAC,UAAyB,CAAC;QACxC,CAAC,CAAC;QAEF,SAAI,GAAG,GAAsC,EAAE;YAC7C,OAAO,IAAI,CAAC,OAA+B,CAAC;QAC9C,CAAC,CAAC;QAEF,UAAK,GAAG,KAAK,IAAI,EAAE;YACjB,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;QAChC,CAAC,CAAC;QAfA,MAAM,EAAC,UAAU,EAAE,OAAO,EAAC,GAAG,0BAA0B,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QACtE,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CAaF"}
|
package/build/mongo/utils.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import mongoose from 'mongoose';
|
|
2
2
|
export declare function getMongooseMongoConnection(uri: string, dbName: string): {
|
|
3
|
-
connection: Connection;
|
|
4
|
-
promise: Promise<Connection>;
|
|
3
|
+
connection: mongoose.Connection;
|
|
4
|
+
promise: Promise<mongoose.Connection>;
|
|
5
5
|
};
|
|
6
|
-
export declare function isMongooseMongoConnection(connection: unknown): connection is Connection;
|
|
7
|
-
export declare function isMongooseMongoClientSession(session: unknown): session is ClientSession;
|
|
6
|
+
export declare function isMongooseMongoConnection(connection: unknown): connection is mongoose.Connection;
|
|
7
|
+
export declare function isMongooseMongoClientSession(session: unknown): session is mongoose.ClientSession;
|
|
8
8
|
export declare function ensureMongoTypeFields<T extends object>(schema: {
|
|
9
|
-
[path in keyof Required<T>]: SchemaDefinitionProperty<T[path]>;
|
|
10
|
-
}): { [path in keyof Required<T>]: SchemaDefinitionProperty<T[path]>; };
|
|
9
|
+
[path in keyof Required<T>]: mongoose.SchemaDefinitionProperty<T[path]>;
|
|
10
|
+
}): { [path in keyof Required<T>]: mongoose.SchemaDefinitionProperty<T[path], any, any>; };
|
|
11
11
|
//# sourceMappingURL=utils.d.ts.map
|
package/build/mongo/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import mongoose from 'mongoose';
|
|
2
2
|
export function getMongooseMongoConnection(uri, dbName) {
|
|
3
|
-
const connection = createConnection(uri, { dbName, autoIndex: false });
|
|
3
|
+
const connection = mongoose.createConnection(uri, { dbName, autoIndex: false });
|
|
4
4
|
const promise = connection.asPromise();
|
|
5
5
|
return { connection, promise };
|
|
6
6
|
}
|
package/build/mongo/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/mongo/utils.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/mongo/utils.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,MAAM,UAAU,0BAA0B,CAAC,GAAW,EAAE,MAAc;IACpE,MAAM,UAAU,GAAG,QAAQ,CAAC,gBAAgB,CAAC,GAAG,EAAE,EAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAC,CAAC,CAAC;IAC9E,MAAM,OAAO,GAAG,UAAU,CAAC,SAAS,EAAE,CAAC;IACvC,OAAO,EAAC,UAAU,EAAE,OAAO,EAAC,CAAC;AAC/B,CAAC;AAED,MAAM,UAAU,yBAAyB,CACvC,UAAmB;IAEnB,6CAA6C;IAC7C,OAAO,CAAC,CAAE,UAAkC,CAAC,WAAW,CAAC;AAC3D,CAAC;AAED,MAAM,UAAU,4BAA4B,CAC1C,OAAgB;IAEhB,OAAO,CAAC,CAAE,OAAkC,EAAE,MAAM,CAAC;AACvD,CAAC;AAED,qEAAqE;AACrE,yEAAyE;AACzE,wDAAwD;AACxD,MAAM,UAAU,qBAAqB,CAAmB,MAEvD;IACC,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "softkave-node-utils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Softkave Node.js utilities",
|
|
5
5
|
"author": {
|
|
6
6
|
"email": "ywordk@gmail.com",
|
|
@@ -62,12 +62,12 @@
|
|
|
62
62
|
"peerDependencies": {
|
|
63
63
|
"@types/lodash-es": "^4.17.12",
|
|
64
64
|
"@types/node": "^20",
|
|
65
|
-
"fimidx": "^0.
|
|
65
|
+
"fimidx": "^0.7.0",
|
|
66
66
|
"lodash-es": "^4.17.21",
|
|
67
|
-
"next": "15.
|
|
67
|
+
"next": "15.5.9",
|
|
68
68
|
"softkave-js-utils": "^0.17.1",
|
|
69
69
|
"zod": "^4.1.11",
|
|
70
|
-
"mongoose": "^
|
|
70
|
+
"mongoose": "^9.1.6",
|
|
71
71
|
"jsonwebtoken": "^9.0.2",
|
|
72
72
|
"typescript": "^5.9.3",
|
|
73
73
|
"@types/jsonwebtoken": "^9.0.10"
|