@floristcloud/api-lib 1.0.82 → 1.1.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/commands/index.js +1 -0
- package/build/commands/session/get-active-sessions.query.js +12 -0
- package/build/commands/session/index.js +11 -0
- package/build/commands/session/session-logout.command.js +11 -0
- package/build/commands/session/session-revoke-all.command.js +11 -0
- package/build/commands/session/validate-session-s2s.query.js +25 -0
- package/build/constant/error.js +16 -0
- package/build/enum/index.js +1 -0
- package/build/enum/session-platform.enum.js +8 -0
- package/build/schemas/consignment/consignment.schema.js +1 -0
- package/build/schemas/index.js +1 -0
- package/build/schemas/session/session.schema.js +13 -0
- package/commands/index.ts +1 -0
- package/commands/session/get-active-sessions.query.ts +11 -0
- package/commands/session/index.ts +4 -0
- package/commands/session/session-logout.command.ts +10 -0
- package/commands/session/session-revoke-all.command.ts +10 -0
- package/commands/session/validate-session-s2s.query.ts +27 -0
- package/constant/error.ts +20 -0
- package/enum/index.ts +1 -0
- package/enum/session-platform.enum.ts +4 -0
- package/package.json +1 -1
- package/schemas/consignment/consignment.schema.ts +1 -0
- package/schemas/index.ts +1 -0
- package/schemas/session/session.schema.ts +11 -0
package/build/commands/index.js
CHANGED
|
@@ -62,3 +62,4 @@ __exportStar(require("./product-configuration/delete-product-configuration.comma
|
|
|
62
62
|
__exportStar(require("./product-configuration/find-product-configuration-by-attributes.query"), exports);
|
|
63
63
|
__exportStar(require("./bank-payment"), exports);
|
|
64
64
|
__exportStar(require("./integration"), exports);
|
|
65
|
+
__exportStar(require("./session"), exports);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetActiveSessionsContractQuery = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const schemas_1 = require("../../schemas");
|
|
6
|
+
const GetActiveSessionsResponseSchema = zod_1.z.object({
|
|
7
|
+
data: zod_1.z.array(schemas_1.SessionSchema),
|
|
8
|
+
});
|
|
9
|
+
var GetActiveSessionsContractQuery;
|
|
10
|
+
(function (GetActiveSessionsContractQuery) {
|
|
11
|
+
GetActiveSessionsContractQuery.ResponseSchema = GetActiveSessionsResponseSchema;
|
|
12
|
+
})(GetActiveSessionsContractQuery || (exports.GetActiveSessionsContractQuery = GetActiveSessionsContractQuery = {}));
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ValidateSessionS2SContractQuery = exports.GetActiveSessionsContractQuery = exports.SessionRevokeAllContractCommand = exports.SessionLogoutContractCommand = void 0;
|
|
4
|
+
var session_logout_command_1 = require("./session-logout.command");
|
|
5
|
+
Object.defineProperty(exports, "SessionLogoutContractCommand", { enumerable: true, get: function () { return session_logout_command_1.SessionLogoutContractCommand; } });
|
|
6
|
+
var session_revoke_all_command_1 = require("./session-revoke-all.command");
|
|
7
|
+
Object.defineProperty(exports, "SessionRevokeAllContractCommand", { enumerable: true, get: function () { return session_revoke_all_command_1.SessionRevokeAllContractCommand; } });
|
|
8
|
+
var get_active_sessions_query_1 = require("./get-active-sessions.query");
|
|
9
|
+
Object.defineProperty(exports, "GetActiveSessionsContractQuery", { enumerable: true, get: function () { return get_active_sessions_query_1.GetActiveSessionsContractQuery; } });
|
|
10
|
+
var validate_session_s2s_query_1 = require("./validate-session-s2s.query");
|
|
11
|
+
Object.defineProperty(exports, "ValidateSessionS2SContractQuery", { enumerable: true, get: function () { return validate_session_s2s_query_1.ValidateSessionS2SContractQuery; } });
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SessionLogoutContractCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const SessionLogoutResponseSchema = zod_1.z.object({
|
|
6
|
+
success: zod_1.z.boolean(),
|
|
7
|
+
});
|
|
8
|
+
var SessionLogoutContractCommand;
|
|
9
|
+
(function (SessionLogoutContractCommand) {
|
|
10
|
+
SessionLogoutContractCommand.ResponseSchema = SessionLogoutResponseSchema;
|
|
11
|
+
})(SessionLogoutContractCommand || (exports.SessionLogoutContractCommand = SessionLogoutContractCommand = {}));
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SessionRevokeAllContractCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const SessionRevokeAllResponseSchema = zod_1.z.object({
|
|
6
|
+
success: zod_1.z.boolean(),
|
|
7
|
+
});
|
|
8
|
+
var SessionRevokeAllContractCommand;
|
|
9
|
+
(function (SessionRevokeAllContractCommand) {
|
|
10
|
+
SessionRevokeAllContractCommand.ResponseSchema = SessionRevokeAllResponseSchema;
|
|
11
|
+
})(SessionRevokeAllContractCommand || (exports.SessionRevokeAllContractCommand = SessionRevokeAllContractCommand = {}));
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ValidateSessionS2SContractQuery = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const enum_1 = require("../../enum");
|
|
6
|
+
const ValidateSessionS2SRequestSchema = zod_1.z.object({
|
|
7
|
+
sessionToken: zod_1.z.string(),
|
|
8
|
+
});
|
|
9
|
+
const ValidateSessionS2SResponseSchema = zod_1.z.object({
|
|
10
|
+
data: zod_1.z.object({
|
|
11
|
+
userUUID: zod_1.z.string(),
|
|
12
|
+
companyUUID: zod_1.z.string(),
|
|
13
|
+
email: zod_1.z.string().nullable(),
|
|
14
|
+
phone: zod_1.z.string().nullable(),
|
|
15
|
+
roles: zod_1.z.array(zod_1.z.nativeEnum(enum_1.UserRoleEnum)),
|
|
16
|
+
status: zod_1.z.nativeEnum(enum_1.UserStatusEnum),
|
|
17
|
+
isGlobal: zod_1.z.boolean(),
|
|
18
|
+
type: zod_1.z.string().nullable(),
|
|
19
|
+
}),
|
|
20
|
+
});
|
|
21
|
+
var ValidateSessionS2SContractQuery;
|
|
22
|
+
(function (ValidateSessionS2SContractQuery) {
|
|
23
|
+
ValidateSessionS2SContractQuery.RequestSchema = ValidateSessionS2SRequestSchema;
|
|
24
|
+
ValidateSessionS2SContractQuery.ResponseSchema = ValidateSessionS2SResponseSchema;
|
|
25
|
+
})(ValidateSessionS2SContractQuery || (exports.ValidateSessionS2SContractQuery = ValidateSessionS2SContractQuery = {}));
|
package/build/constant/error.js
CHANGED
|
@@ -896,4 +896,20 @@ exports.ERRORS = {
|
|
|
896
896
|
IMPORT_UNKNOWN_ERROR: { code: 'ID002', message: 'Unknown error', httpCode: 500 },
|
|
897
897
|
IMPORT_ITEMS_COUNT_LIMIT_EXCEEDED: { code: 'ID003', message: 'Items count limit exceeded', httpCode: 400 },
|
|
898
898
|
NOT_IMPLEMENTED: { code: 'G001', message: 'Not implemented', httpCode: 501 },
|
|
899
|
+
// SESSION
|
|
900
|
+
SESSION_NOT_FOUND: { code: 'SES001', message: 'Session not found', httpCode: 401 },
|
|
901
|
+
SESSION_REVOKED: { code: 'SES002', message: 'Session has been revoked', httpCode: 401 },
|
|
902
|
+
SESSION_CROSS_TENANT: { code: 'SES003', message: 'Session does not belong to this tenant', httpCode: 401 },
|
|
903
|
+
SESSION_CREATE_FAILED: { code: 'SES004', message: 'Failed to create session', httpCode: 500 },
|
|
904
|
+
SESSION_LIMIT_EXCEEDED: { code: 'SES005', message: 'Maximum number of active sessions exceeded', httpCode: 429 },
|
|
905
|
+
SESSION_REVOKE_FAILED: { code: 'SES006', message: 'Failed to revoke session', httpCode: 500 },
|
|
906
|
+
SESSION_FETCH_FAILED: { code: 'SES007', message: 'Failed to fetch sessions', httpCode: 500 },
|
|
907
|
+
// CSRF
|
|
908
|
+
CSRF_TOKEN_MISSING: { code: 'CSRF001', message: 'CSRF token is missing', httpCode: 403 },
|
|
909
|
+
CSRF_TOKEN_INVALID: { code: 'CSRF002', message: 'CSRF token is invalid', httpCode: 403 },
|
|
910
|
+
// MOBILE AUTH
|
|
911
|
+
MOBILE_BROWSER_REQUEST_REJECTED: { code: 'MOB001', message: 'Browser requests are not allowed on this endpoint', httpCode: 403 },
|
|
912
|
+
MOBILE_RATE_LIMIT_EXCEEDED: { code: 'MOB002', message: 'Too many requests to mobile login endpoint', httpCode: 429 },
|
|
913
|
+
// UNIFIED AUTH (replaces separate USER_NOT_FOUND / INCORRECT_CREDENTIALS for login)
|
|
914
|
+
INVALID_CREDENTIALS: { code: 'AUTH001', message: 'Invalid credentials', httpCode: 401 },
|
|
899
915
|
};
|
package/build/enum/index.js
CHANGED
|
@@ -79,3 +79,4 @@ __exportStar(require("./transaction-type-groups"), exports);
|
|
|
79
79
|
__exportStar(require("./chat-has-manager-mode.enum"), exports);
|
|
80
80
|
__exportStar(require("./chat-no-manager-mode.enum"), exports);
|
|
81
81
|
__exportStar(require("./match-confidence.enum"), exports);
|
|
82
|
+
__exportStar(require("./session-platform.enum"), exports);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SessionPlatformEnum = void 0;
|
|
4
|
+
var SessionPlatformEnum;
|
|
5
|
+
(function (SessionPlatformEnum) {
|
|
6
|
+
SessionPlatformEnum["WEB"] = "WEB";
|
|
7
|
+
SessionPlatformEnum["MOBILE"] = "MOBILE";
|
|
8
|
+
})(SessionPlatformEnum || (exports.SessionPlatformEnum = SessionPlatformEnum = {}));
|
|
@@ -27,6 +27,7 @@ exports.ConsignmentWithStatisticForListSchema = exports.ConsignmentSchema.extend
|
|
|
27
27
|
currentCostPrice: zod_1.z.number(),
|
|
28
28
|
totalProductQuantity: zod_1.z.number(),
|
|
29
29
|
totalSellings: zod_1.z.number(),
|
|
30
|
+
totalApprovedWriteOffSellings: zod_1.z.number(),
|
|
30
31
|
}),
|
|
31
32
|
});
|
|
32
33
|
exports.ConsignmentWithStatisticSchema = exports.ConsignmentSchema.extend({
|
package/build/schemas/index.js
CHANGED
|
@@ -74,3 +74,4 @@ __exportStar(require("./client-payment-identifier/client-payment-identifier.sche
|
|
|
74
74
|
__exportStar(require("./bank-payment/get-bank-payment-match-suggestions.schema"), exports);
|
|
75
75
|
__exportStar(require("./messenger-profile"), exports);
|
|
76
76
|
__exportStar(require("./error-message.schema"), exports);
|
|
77
|
+
__exportStar(require("./session/session.schema"), exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SessionSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const enum_1 = require("../../enum");
|
|
6
|
+
exports.SessionSchema = zod_1.z.object({
|
|
7
|
+
id: zod_1.z.string(),
|
|
8
|
+
platform: zod_1.z.nativeEnum(enum_1.SessionPlatformEnum),
|
|
9
|
+
userAgent: zod_1.z.string().nullable(),
|
|
10
|
+
ipAddress: zod_1.z.string().nullable(),
|
|
11
|
+
lastActiveAt: zod_1.z.coerce.date(),
|
|
12
|
+
createdAt: zod_1.z.coerce.date(),
|
|
13
|
+
});
|
package/commands/index.ts
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { SessionSchema } from '../../schemas';
|
|
3
|
+
|
|
4
|
+
const GetActiveSessionsResponseSchema = z.object({
|
|
5
|
+
data: z.array(SessionSchema),
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
export namespace GetActiveSessionsContractQuery {
|
|
9
|
+
export const ResponseSchema = GetActiveSessionsResponseSchema;
|
|
10
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { SessionLogoutContractCommand } from './session-logout.command';
|
|
2
|
+
export { SessionRevokeAllContractCommand } from './session-revoke-all.command';
|
|
3
|
+
export { GetActiveSessionsContractQuery } from './get-active-sessions.query';
|
|
4
|
+
export { ValidateSessionS2SContractQuery } from './validate-session-s2s.query';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
const SessionLogoutResponseSchema = z.object({
|
|
4
|
+
success: z.boolean(),
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
export namespace SessionLogoutContractCommand {
|
|
8
|
+
export const ResponseSchema = SessionLogoutResponseSchema;
|
|
9
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
const SessionRevokeAllResponseSchema = z.object({
|
|
4
|
+
success: z.boolean(),
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
export namespace SessionRevokeAllContractCommand {
|
|
8
|
+
export const ResponseSchema = SessionRevokeAllResponseSchema;
|
|
9
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { UserRoleEnum, UserStatusEnum } from '../../enum';
|
|
3
|
+
|
|
4
|
+
const ValidateSessionS2SRequestSchema = z.object({
|
|
5
|
+
sessionToken: z.string(),
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
const ValidateSessionS2SResponseSchema = z.object({
|
|
9
|
+
data: z.object({
|
|
10
|
+
userUUID: z.string(),
|
|
11
|
+
companyUUID: z.string(),
|
|
12
|
+
email: z.string().nullable(),
|
|
13
|
+
phone: z.string().nullable(),
|
|
14
|
+
roles: z.array(z.nativeEnum(UserRoleEnum)),
|
|
15
|
+
status: z.nativeEnum(UserStatusEnum),
|
|
16
|
+
isGlobal: z.boolean(),
|
|
17
|
+
type: z.string().nullable(),
|
|
18
|
+
}),
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export namespace ValidateSessionS2SContractQuery {
|
|
22
|
+
export const RequestSchema = ValidateSessionS2SRequestSchema;
|
|
23
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
24
|
+
|
|
25
|
+
export const ResponseSchema = ValidateSessionS2SResponseSchema;
|
|
26
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
27
|
+
}
|
package/constant/error.ts
CHANGED
|
@@ -948,4 +948,24 @@ export const ERRORS = {
|
|
|
948
948
|
IMPORT_ITEMS_COUNT_LIMIT_EXCEEDED: { code: 'ID003', message: 'Items count limit exceeded', httpCode: 400 },
|
|
949
949
|
|
|
950
950
|
NOT_IMPLEMENTED: { code: 'G001', message: 'Not implemented', httpCode: 501 },
|
|
951
|
+
|
|
952
|
+
// SESSION
|
|
953
|
+
SESSION_NOT_FOUND: { code: 'SES001', message: 'Session not found', httpCode: 401 },
|
|
954
|
+
SESSION_REVOKED: { code: 'SES002', message: 'Session has been revoked', httpCode: 401 },
|
|
955
|
+
SESSION_CROSS_TENANT: { code: 'SES003', message: 'Session does not belong to this tenant', httpCode: 401 },
|
|
956
|
+
SESSION_CREATE_FAILED: { code: 'SES004', message: 'Failed to create session', httpCode: 500 },
|
|
957
|
+
SESSION_LIMIT_EXCEEDED: { code: 'SES005', message: 'Maximum number of active sessions exceeded', httpCode: 429 },
|
|
958
|
+
SESSION_REVOKE_FAILED: { code: 'SES006', message: 'Failed to revoke session', httpCode: 500 },
|
|
959
|
+
SESSION_FETCH_FAILED: { code: 'SES007', message: 'Failed to fetch sessions', httpCode: 500 },
|
|
960
|
+
|
|
961
|
+
// CSRF
|
|
962
|
+
CSRF_TOKEN_MISSING: { code: 'CSRF001', message: 'CSRF token is missing', httpCode: 403 },
|
|
963
|
+
CSRF_TOKEN_INVALID: { code: 'CSRF002', message: 'CSRF token is invalid', httpCode: 403 },
|
|
964
|
+
|
|
965
|
+
// MOBILE AUTH
|
|
966
|
+
MOBILE_BROWSER_REQUEST_REJECTED: { code: 'MOB001', message: 'Browser requests are not allowed on this endpoint', httpCode: 403 },
|
|
967
|
+
MOBILE_RATE_LIMIT_EXCEEDED: { code: 'MOB002', message: 'Too many requests to mobile login endpoint', httpCode: 429 },
|
|
968
|
+
|
|
969
|
+
// UNIFIED AUTH (replaces separate USER_NOT_FOUND / INCORRECT_CREDENTIALS for login)
|
|
970
|
+
INVALID_CREDENTIALS: { code: 'AUTH001', message: 'Invalid credentials', httpCode: 401 },
|
|
951
971
|
} as const;
|
package/enum/index.ts
CHANGED
package/package.json
CHANGED
package/schemas/index.ts
CHANGED
|
@@ -58,3 +58,4 @@ export * from './client-payment-identifier/client-payment-identifier.schema';
|
|
|
58
58
|
export * from './bank-payment/get-bank-payment-match-suggestions.schema';
|
|
59
59
|
export * from './messenger-profile';
|
|
60
60
|
export * from './error-message.schema';
|
|
61
|
+
export * from './session/session.schema';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { SessionPlatformEnum } from '../../enum';
|
|
3
|
+
|
|
4
|
+
export const SessionSchema = z.object({
|
|
5
|
+
id: z.string(),
|
|
6
|
+
platform: z.nativeEnum(SessionPlatformEnum),
|
|
7
|
+
userAgent: z.string().nullable(),
|
|
8
|
+
ipAddress: z.string().nullable(),
|
|
9
|
+
lastActiveAt: z.coerce.date(),
|
|
10
|
+
createdAt: z.coerce.date(),
|
|
11
|
+
});
|