@adaptic/backend-legacy 0.0.71 → 0.0.72
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/config/jwtConfig.cjs +52 -0
- package/config/jwtConfig.d.ts +16 -0
- package/config/jwtConfig.d.ts.map +1 -0
- package/config/jwtConfig.js.map +1 -0
- package/config/metrics.cjs +261 -0
- package/config/metrics.d.ts +88 -0
- package/config/metrics.d.ts.map +1 -0
- package/config/metrics.js.map +1 -0
- package/config/persisted-queries.cjs +122 -0
- package/config/persisted-queries.d.ts +40 -0
- package/config/persisted-queries.d.ts.map +1 -0
- package/config/persisted-queries.js.map +1 -0
- package/config/tracing.cjs +128 -0
- package/config/tracing.d.ts +24 -0
- package/config/tracing.d.ts.map +1 -0
- package/config/tracing.js.map +1 -0
- package/middleware/audit-logger.cjs +223 -0
- package/middleware/audit-logger.d.ts +85 -0
- package/middleware/audit-logger.d.ts.map +1 -0
- package/middleware/audit-logger.js.map +1 -0
- package/middleware/auth.cjs +44 -0
- package/middleware/auth.d.ts +6 -0
- package/middleware/auth.d.ts.map +1 -0
- package/middleware/auth.js.map +1 -0
- package/middleware/graphql-validation-plugin.cjs +164 -0
- package/middleware/graphql-validation-plugin.d.ts +37 -0
- package/middleware/graphql-validation-plugin.d.ts.map +1 -0
- package/middleware/graphql-validation-plugin.js.map +1 -0
- package/middleware/index.cjs +46 -0
- package/middleware/index.d.ts +13 -0
- package/middleware/index.d.ts.map +1 -0
- package/middleware/index.js.map +1 -0
- package/middleware/input-validator.cjs +220 -0
- package/middleware/input-validator.d.ts +63 -0
- package/middleware/input-validator.d.ts.map +1 -0
- package/middleware/input-validator.js.map +1 -0
- package/middleware/query-complexity.cjs +182 -0
- package/middleware/query-complexity.d.ts +56 -0
- package/middleware/query-complexity.d.ts.map +1 -0
- package/middleware/query-complexity.js.map +1 -0
- package/middleware/rate-limiter.cjs +112 -0
- package/middleware/rate-limiter.d.ts +16 -0
- package/middleware/rate-limiter.d.ts.map +1 -0
- package/middleware/rate-limiter.js.map +1 -0
- package/middleware/soft-delete.cjs +175 -0
- package/middleware/soft-delete.d.ts +146 -0
- package/middleware/soft-delete.d.ts.map +1 -0
- package/middleware/soft-delete.js.map +1 -0
- package/middleware/types.cjs +17 -0
- package/middleware/types.d.ts +87 -0
- package/middleware/types.d.ts.map +1 -0
- package/middleware/types.js.map +1 -0
- package/middleware/validation-examples.cjs +403 -0
- package/middleware/validation-examples.d.ts +76 -0
- package/middleware/validation-examples.d.ts.map +1 -0
- package/middleware/validation-examples.js.map +1 -0
- package/package.json +4 -1
- package/validators/allocation-validator.cjs +85 -0
- package/validators/allocation-validator.d.ts +32 -0
- package/validators/allocation-validator.d.ts.map +1 -0
- package/validators/allocation-validator.js.map +1 -0
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VALIDATION_RULES = void 0;
|
|
4
|
+
exports.createValidationPlugin = createValidationPlugin;
|
|
5
|
+
const graphql_1 = require("graphql");
|
|
6
|
+
const input_validator_1 = require("./input-validator.cjs");
|
|
7
|
+
/**
|
|
8
|
+
* Predefined validation rules for common field patterns
|
|
9
|
+
*/
|
|
10
|
+
const VALIDATION_RULES = [
|
|
11
|
+
// Percentage fields (0-100)
|
|
12
|
+
{
|
|
13
|
+
pattern: /.*Pct$/i,
|
|
14
|
+
validator: (value, fieldName) => {
|
|
15
|
+
if (typeof value === 'number') {
|
|
16
|
+
(0, input_validator_1.validatePercentage)(value, fieldName);
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
description: 'Percentage fields ending with Pct',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
pattern: /.*Percent(age)?$/i,
|
|
23
|
+
validator: (value, fieldName) => {
|
|
24
|
+
if (typeof value === 'number') {
|
|
25
|
+
(0, input_validator_1.validatePercentage)(value, fieldName);
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
description: 'Percentage fields ending with Percent or Percentage',
|
|
29
|
+
},
|
|
30
|
+
// Quantity fields (must be positive)
|
|
31
|
+
{
|
|
32
|
+
pattern: /^quantity$/i,
|
|
33
|
+
validator: (value, fieldName) => {
|
|
34
|
+
if (typeof value === 'number') {
|
|
35
|
+
(0, input_validator_1.validatePositiveNumber)(value, fieldName);
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
description: 'Quantity fields',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
pattern: /.*Threshold$/i,
|
|
42
|
+
validator: (value, fieldName) => {
|
|
43
|
+
if (typeof value === 'number' && value !== 0) {
|
|
44
|
+
(0, input_validator_1.validatePositiveNumber)(value, fieldName);
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
description: 'Threshold fields',
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
pattern: /^count$/i,
|
|
51
|
+
validator: (value, fieldName) => {
|
|
52
|
+
if (typeof value === 'number') {
|
|
53
|
+
(0, input_validator_1.validatePositiveNumber)(value, fieldName);
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
description: 'Count fields',
|
|
57
|
+
},
|
|
58
|
+
// Required string fields (non-empty)
|
|
59
|
+
{
|
|
60
|
+
pattern: /^(name|title|description|symbol|type|status)$/i,
|
|
61
|
+
validator: (value, fieldName) => {
|
|
62
|
+
if (typeof value === 'string') {
|
|
63
|
+
(0, input_validator_1.validateNonEmpty)(value, fieldName);
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
description: 'Common required string fields',
|
|
67
|
+
},
|
|
68
|
+
];
|
|
69
|
+
exports.VALIDATION_RULES = VALIDATION_RULES;
|
|
70
|
+
/**
|
|
71
|
+
* Recursively validates an object's fields based on predefined rules
|
|
72
|
+
*/
|
|
73
|
+
function validateObject(obj, path = '') {
|
|
74
|
+
const errors = [];
|
|
75
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
76
|
+
const fieldPath = path ? `${path}.${key}` : key;
|
|
77
|
+
// Skip null or undefined values
|
|
78
|
+
if (value === null || value === undefined) {
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
// Recursively validate nested objects
|
|
82
|
+
if (typeof value === 'object' && !Array.isArray(value)) {
|
|
83
|
+
const nestedErrors = validateObject(value, fieldPath);
|
|
84
|
+
errors.push(...nestedErrors);
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
// Apply validation rules to the field
|
|
88
|
+
for (const rule of VALIDATION_RULES) {
|
|
89
|
+
if (rule.pattern.test(key)) {
|
|
90
|
+
try {
|
|
91
|
+
rule.validator(value, fieldPath);
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
if (error instanceof input_validator_1.ValidationError) {
|
|
95
|
+
errors.push(...error.fields);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
break; // Only apply the first matching rule
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return errors;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Apollo Server plugin that validates GraphQL mutation inputs
|
|
106
|
+
*
|
|
107
|
+
* This plugin intercepts all mutation operations and validates input fields
|
|
108
|
+
* before they reach the resolver. It applies validation rules based on field
|
|
109
|
+
* name patterns to ensure data integrity.
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* ```typescript
|
|
113
|
+
* const server = new ApolloServer({
|
|
114
|
+
* schema,
|
|
115
|
+
* plugins: [
|
|
116
|
+
* ApolloServerPluginDrainHttpServer({ httpServer }),
|
|
117
|
+
* createValidationPlugin(),
|
|
118
|
+
* ],
|
|
119
|
+
* });
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
function createValidationPlugin() {
|
|
123
|
+
return {
|
|
124
|
+
async requestDidStart() {
|
|
125
|
+
return {
|
|
126
|
+
async didResolveOperation(requestContext) {
|
|
127
|
+
const { operation, request } = requestContext;
|
|
128
|
+
// Only validate mutations
|
|
129
|
+
if (!operation || operation.operation !== 'mutation') {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
const variables = request.variables || {};
|
|
133
|
+
const errors = [];
|
|
134
|
+
// Validate each mutation's variables
|
|
135
|
+
for (const [variableName, variableValue] of Object.entries(variables)) {
|
|
136
|
+
if (variableValue && typeof variableValue === 'object') {
|
|
137
|
+
// Check if this is a data object (common pattern in mutations)
|
|
138
|
+
const dataObj = variableValue;
|
|
139
|
+
if ('data' in dataObj && typeof dataObj.data === 'object') {
|
|
140
|
+
const validationErrors = validateObject(dataObj.data, variableName);
|
|
141
|
+
errors.push(...validationErrors);
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
// Validate the entire variable object
|
|
145
|
+
const validationErrors = validateObject(dataObj, variableName);
|
|
146
|
+
errors.push(...validationErrors);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
// If there are validation errors, throw before resolver execution
|
|
151
|
+
if (errors.length > 0) {
|
|
152
|
+
throw new graphql_1.GraphQLError(`Input validation failed for ${errors.length} field${errors.length > 1 ? 's' : ''}`, {
|
|
153
|
+
extensions: {
|
|
154
|
+
code: 'BAD_USER_INPUT',
|
|
155
|
+
validationErrors: errors,
|
|
156
|
+
},
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
};
|
|
161
|
+
},
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
//# sourceMappingURL=graphql-validation-plugin.js.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ApolloServerPlugin } from '@apollo/server';
|
|
2
|
+
/**
|
|
3
|
+
* Field validation rules mapped by field name patterns
|
|
4
|
+
*/
|
|
5
|
+
interface FieldValidationRule {
|
|
6
|
+
pattern: RegExp;
|
|
7
|
+
validator: (value: unknown, fieldName: string) => void;
|
|
8
|
+
description: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Predefined validation rules for common field patterns
|
|
12
|
+
*/
|
|
13
|
+
declare const VALIDATION_RULES: FieldValidationRule[];
|
|
14
|
+
/**
|
|
15
|
+
* Apollo Server plugin that validates GraphQL mutation inputs
|
|
16
|
+
*
|
|
17
|
+
* This plugin intercepts all mutation operations and validates input fields
|
|
18
|
+
* before they reach the resolver. It applies validation rules based on field
|
|
19
|
+
* name patterns to ensure data integrity.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* const server = new ApolloServer({
|
|
24
|
+
* schema,
|
|
25
|
+
* plugins: [
|
|
26
|
+
* ApolloServerPluginDrainHttpServer({ httpServer }),
|
|
27
|
+
* createValidationPlugin(),
|
|
28
|
+
* ],
|
|
29
|
+
* });
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare function createValidationPlugin(): ApolloServerPlugin;
|
|
33
|
+
/**
|
|
34
|
+
* Export validation rules for testing and documentation
|
|
35
|
+
*/
|
|
36
|
+
export { VALIDATION_RULES };
|
|
37
|
+
//# sourceMappingURL=graphql-validation-plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphql-validation-plugin.d.ts","sourceRoot":"","sources":["../../src/middleware/graphql-validation-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAA0B,MAAM,gBAAgB,CAAC;AAU5E;;GAEG;AACH,UAAU,mBAAmB;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACvD,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,QAAA,MAAM,gBAAgB,EAAE,mBAAmB,EA0D1C,CAAC;AA+CF;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,sBAAsB,IAAI,kBAAkB,CAuD3D;AAED;;GAEG;AACH,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphql-validation-plugin.js","sourceRoot":"","sources":["../../src/middleware/graphql-validation-plugin.ts"],"names":[],"mappings":";;;AAiJA,wDAuDC;AAvMD,qCAAuC;AACvC,uDAM2B;AAW3B;;GAEG;AACH,MAAM,gBAAgB,GAA0B;IAC9C,4BAA4B;IAC5B;QACE,OAAO,EAAE,SAAS;QAClB,SAAS,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE;YAC9B,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;gBAC9B,IAAA,oCAAkB,EAAC,KAAK,EAAE,SAAS,CAAC,CAAC;YACvC,CAAC;QACH,CAAC;QACD,WAAW,EAAE,mCAAmC;KACjD;IACD;QACE,OAAO,EAAE,mBAAmB;QAC5B,SAAS,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE;YAC9B,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;gBAC9B,IAAA,oCAAkB,EAAC,KAAK,EAAE,SAAS,CAAC,CAAC;YACvC,CAAC;QACH,CAAC;QACD,WAAW,EAAE,qDAAqD;KACnE;IACD,qCAAqC;IACrC;QACE,OAAO,EAAE,aAAa;QACtB,SAAS,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE;YAC9B,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;gBAC9B,IAAA,wCAAsB,EAAC,KAAK,EAAE,SAAS,CAAC,CAAC;YAC3C,CAAC;QACH,CAAC;QACD,WAAW,EAAE,iBAAiB;KAC/B;IACD;QACE,OAAO,EAAE,eAAe;QACxB,SAAS,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE;YAC9B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,CAAC,EAAE,CAAC;gBAC7C,IAAA,wCAAsB,EAAC,KAAK,EAAE,SAAS,CAAC,CAAC;YAC3C,CAAC;QACH,CAAC;QACD,WAAW,E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;gCAC1D,MAAM,gBAAgB,GAAG,cAAc,CACrC,OAAO,CAAC,IAA+B,EACvC,YAAY,CACb,CAAC;gCACF,MAAM,CAAC,IAAI,CAAC,GAAG,gBAAgB,CAAC,CAAC;4BACnC,CAAC;iCAAM,CAAC;gCACN,sCAAsC;gCACtC,MAAM,gBAAgB,GAAG,cAAc,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;gCAC/D,MAAM,CAAC,IAAI,CAAC,GAAG,gBAAgB,CAAC,CAAC;4BACnC,CAAC;wBACH,CAAC;oBACH,CAAC;oBAED,kEAAkE;oBAClE,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;wBACtB,MAAM,IAAI,sBAAY,CACpB,+BAA+B,MAAM,CAAC,MAAM,SAAS,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,EACnF;4BACE,UAAU,EAAE;gCACV,IAAI,EAAE,gBAAgB;gCACtB,gBAAgB,EAAE,MAAM;6BACzB;yBACF,CACF,CAAC;oBACJ,CAAC;gBACH,CAAC;aACF,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Middleware Index
|
|
4
|
+
*
|
|
5
|
+
* Provides GraphQL mutation input validation, audit logging,
|
|
6
|
+
* soft-delete handling, and authentication middleware.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.CustomValidators = exports.hardDelete = exports.restoreRecord = exports.softDeleteRecord = exports.isSoftDeleteModel = exports.deletedOnlyFilter = exports.softDeleteFilter = exports.SOFT_DELETE_MODELS = exports.extractChangedFields = exports.extractRecordId = exports.extractUserId = exports.parseMutationOperation = exports.createAuditLogPlugin = exports.authMiddleware = exports.VALIDATION_RULES = exports.createValidationPlugin = exports.ValidationError = exports.validateFields = exports.validateConfidenceScore = exports.validateNonEmpty = exports.validateUrl = exports.validateEmail = exports.validatePositiveNumber = exports.validatePercentage = void 0;
|
|
10
|
+
// Export validation functions
|
|
11
|
+
var input_validator_1 = require("./input-validator.cjs");
|
|
12
|
+
Object.defineProperty(exports, "validatePercentage", { enumerable: true, get: function () { return input_validator_1.validatePercentage; } });
|
|
13
|
+
Object.defineProperty(exports, "validatePositiveNumber", { enumerable: true, get: function () { return input_validator_1.validatePositiveNumber; } });
|
|
14
|
+
Object.defineProperty(exports, "validateEmail", { enumerable: true, get: function () { return input_validator_1.validateEmail; } });
|
|
15
|
+
Object.defineProperty(exports, "validateUrl", { enumerable: true, get: function () { return input_validator_1.validateUrl; } });
|
|
16
|
+
Object.defineProperty(exports, "validateNonEmpty", { enumerable: true, get: function () { return input_validator_1.validateNonEmpty; } });
|
|
17
|
+
Object.defineProperty(exports, "validateConfidenceScore", { enumerable: true, get: function () { return input_validator_1.validateConfidenceScore; } });
|
|
18
|
+
Object.defineProperty(exports, "validateFields", { enumerable: true, get: function () { return input_validator_1.validateFields; } });
|
|
19
|
+
Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return input_validator_1.ValidationError; } });
|
|
20
|
+
// Export GraphQL validation plugin
|
|
21
|
+
var graphql_validation_plugin_1 = require("./graphql-validation-plugin.cjs");
|
|
22
|
+
Object.defineProperty(exports, "createValidationPlugin", { enumerable: true, get: function () { return graphql_validation_plugin_1.createValidationPlugin; } });
|
|
23
|
+
Object.defineProperty(exports, "VALIDATION_RULES", { enumerable: true, get: function () { return graphql_validation_plugin_1.VALIDATION_RULES; } });
|
|
24
|
+
// Export authentication middleware
|
|
25
|
+
var auth_1 = require("./auth.cjs");
|
|
26
|
+
Object.defineProperty(exports, "authMiddleware", { enumerable: true, get: function () { return auth_1.authMiddleware; } });
|
|
27
|
+
// Export audit logging plugin
|
|
28
|
+
var audit_logger_1 = require("./audit-logger.cjs");
|
|
29
|
+
Object.defineProperty(exports, "createAuditLogPlugin", { enumerable: true, get: function () { return audit_logger_1.createAuditLogPlugin; } });
|
|
30
|
+
Object.defineProperty(exports, "parseMutationOperation", { enumerable: true, get: function () { return audit_logger_1.parseMutationOperation; } });
|
|
31
|
+
Object.defineProperty(exports, "extractUserId", { enumerable: true, get: function () { return audit_logger_1.extractUserId; } });
|
|
32
|
+
Object.defineProperty(exports, "extractRecordId", { enumerable: true, get: function () { return audit_logger_1.extractRecordId; } });
|
|
33
|
+
Object.defineProperty(exports, "extractChangedFields", { enumerable: true, get: function () { return audit_logger_1.extractChangedFields; } });
|
|
34
|
+
// Export soft-delete utilities
|
|
35
|
+
var soft_delete_1 = require("./soft-delete.cjs");
|
|
36
|
+
Object.defineProperty(exports, "SOFT_DELETE_MODELS", { enumerable: true, get: function () { return soft_delete_1.SOFT_DELETE_MODELS; } });
|
|
37
|
+
Object.defineProperty(exports, "softDeleteFilter", { enumerable: true, get: function () { return soft_delete_1.softDeleteFilter; } });
|
|
38
|
+
Object.defineProperty(exports, "deletedOnlyFilter", { enumerable: true, get: function () { return soft_delete_1.deletedOnlyFilter; } });
|
|
39
|
+
Object.defineProperty(exports, "isSoftDeleteModel", { enumerable: true, get: function () { return soft_delete_1.isSoftDeleteModel; } });
|
|
40
|
+
Object.defineProperty(exports, "softDeleteRecord", { enumerable: true, get: function () { return soft_delete_1.softDeleteRecord; } });
|
|
41
|
+
Object.defineProperty(exports, "restoreRecord", { enumerable: true, get: function () { return soft_delete_1.restoreRecord; } });
|
|
42
|
+
Object.defineProperty(exports, "hardDelete", { enumerable: true, get: function () { return soft_delete_1.hardDelete; } });
|
|
43
|
+
// Export example validators for reference
|
|
44
|
+
var validation_examples_1 = require("./validation-examples.cjs");
|
|
45
|
+
Object.defineProperty(exports, "CustomValidators", { enumerable: true, get: function () { return validation_examples_1.CustomValidators; } });
|
|
46
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Middleware Index
|
|
3
|
+
*
|
|
4
|
+
* Provides GraphQL mutation input validation, audit logging,
|
|
5
|
+
* soft-delete handling, and authentication middleware.
|
|
6
|
+
*/
|
|
7
|
+
export { validatePercentage, validatePositiveNumber, validateEmail, validateUrl, validateNonEmpty, validateConfidenceScore, validateFields, ValidationError, ValidationErrorDetail, } from './input-validator';
|
|
8
|
+
export { createValidationPlugin, VALIDATION_RULES, } from './graphql-validation-plugin';
|
|
9
|
+
export { authMiddleware, AuthenticatedRequest } from './auth';
|
|
10
|
+
export { createAuditLogPlugin, parseMutationOperation, extractUserId, extractRecordId, extractChangedFields, } from './audit-logger';
|
|
11
|
+
export { SOFT_DELETE_MODELS, softDeleteFilter, deletedOnlyFilter, isSoftDeleteModel, softDeleteRecord, restoreRecord, hardDelete, } from './soft-delete';
|
|
12
|
+
export { CustomValidators } from './validation-examples';
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/middleware/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,uBAAuB,EACvB,cAAc,EACd,eAAe,EACf,qBAAqB,GACtB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAC;AAG9D,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,aAAa,EACb,eAAe,EACf,oBAAoB,GACrB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,UAAU,GACX,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/middleware/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,8BAA8B;AAC9B,qDAU2B;AATzB,qHAAA,kBAAkB,OAAA;AAClB,yHAAA,sBAAsB,OAAA;AACtB,gHAAA,aAAa,OAAA;AACb,8GAAA,WAAW,OAAA;AACX,mHAAA,gBAAgB,OAAA;AAChB,0HAAA,uBAAuB,OAAA;AACvB,iHAAA,cAAc,OAAA;AACd,kHAAA,eAAe,OAAA;AAIjB,mCAAmC;AACnC,yEAGqC;AAFnC,mIAAA,sBAAsB,OAAA;AACtB,6HAAA,gBAAgB,OAAA;AAGlB,mCAAmC;AACnC,+BAA8D;AAArD,sGAAA,cAAc,OAAA;AAEvB,8BAA8B;AAC9B,+CAMwB;AALtB,oHAAA,oBAAoB,OAAA;AACpB,sHAAA,sBAAsB,OAAA;AACtB,6GAAA,aAAa,OAAA;AACb,+GAAA,eAAe,OAAA;AACf,oHAAA,oBAAoB,OAAA;AAGtB,+BAA+B;AAC/B,6CAQuB;AAPrB,iHAAA,kBAAkB,OAAA;AAClB,+GAAA,gBAAgB,OAAA;AAChB,gHAAA,iBAAiB,OAAA;AACjB,gHAAA,iBAAiB,OAAA;AACjB,+GAAA,gBAAgB,OAAA;AAChB,4GAAA,aAAa,OAAA;AACb,yGAAA,UAAU,OAAA;AAGZ,0CAA0C;AAC1C,6DAAyD;AAAhD,uHAAA,gBAAgB,OAAA"}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ValidationError = void 0;
|
|
4
|
+
exports.validatePercentage = validatePercentage;
|
|
5
|
+
exports.validatePositiveNumber = validatePositiveNumber;
|
|
6
|
+
exports.validateEmail = validateEmail;
|
|
7
|
+
exports.validateUrl = validateUrl;
|
|
8
|
+
exports.validateNonEmpty = validateNonEmpty;
|
|
9
|
+
exports.validateConfidenceScore = validateConfidenceScore;
|
|
10
|
+
exports.validateFields = validateFields;
|
|
11
|
+
const graphql_1 = require("graphql");
|
|
12
|
+
/**
|
|
13
|
+
* Custom error class for validation failures
|
|
14
|
+
*/
|
|
15
|
+
class ValidationError extends graphql_1.GraphQLError {
|
|
16
|
+
constructor(message, fields) {
|
|
17
|
+
super(message, {
|
|
18
|
+
extensions: {
|
|
19
|
+
code: 'BAD_USER_INPUT',
|
|
20
|
+
validationErrors: fields,
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
this.fields = fields;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.ValidationError = ValidationError;
|
|
27
|
+
/**
|
|
28
|
+
* Validates that a number is within the 0-100 percentage range
|
|
29
|
+
* @param value - The numeric value to validate
|
|
30
|
+
* @param fieldName - The name of the field for error reporting
|
|
31
|
+
* @throws ValidationError if the value is not between 0 and 100
|
|
32
|
+
*/
|
|
33
|
+
function validatePercentage(value, fieldName) {
|
|
34
|
+
if (typeof value !== 'number' || isNaN(value)) {
|
|
35
|
+
throw new ValidationError('Invalid percentage value', [
|
|
36
|
+
{
|
|
37
|
+
field: fieldName,
|
|
38
|
+
value,
|
|
39
|
+
message: 'Must be a valid number',
|
|
40
|
+
constraint: 'isNumber',
|
|
41
|
+
},
|
|
42
|
+
]);
|
|
43
|
+
}
|
|
44
|
+
if (value < 0 || value > 100) {
|
|
45
|
+
throw new ValidationError('Percentage out of range', [
|
|
46
|
+
{
|
|
47
|
+
field: fieldName,
|
|
48
|
+
value,
|
|
49
|
+
message: 'Must be between 0 and 100',
|
|
50
|
+
constraint: 'range',
|
|
51
|
+
},
|
|
52
|
+
]);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Validates that a number is positive (greater than 0)
|
|
57
|
+
* @param value - The numeric value to validate
|
|
58
|
+
* @param fieldName - The name of the field for error reporting
|
|
59
|
+
* @throws ValidationError if the value is not positive
|
|
60
|
+
*/
|
|
61
|
+
function validatePositiveNumber(value, fieldName) {
|
|
62
|
+
if (typeof value !== 'number' || isNaN(value)) {
|
|
63
|
+
throw new ValidationError('Invalid numeric value', [
|
|
64
|
+
{
|
|
65
|
+
field: fieldName,
|
|
66
|
+
value,
|
|
67
|
+
message: 'Must be a valid number',
|
|
68
|
+
constraint: 'isNumber',
|
|
69
|
+
},
|
|
70
|
+
]);
|
|
71
|
+
}
|
|
72
|
+
if (value <= 0) {
|
|
73
|
+
throw new ValidationError('Number must be positive', [
|
|
74
|
+
{
|
|
75
|
+
field: fieldName,
|
|
76
|
+
value,
|
|
77
|
+
message: 'Must be greater than 0',
|
|
78
|
+
constraint: 'positive',
|
|
79
|
+
},
|
|
80
|
+
]);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Validates that a string is a valid email format
|
|
85
|
+
* @param value - The string value to validate
|
|
86
|
+
* @throws ValidationError if the value is not a valid email
|
|
87
|
+
*/
|
|
88
|
+
function validateEmail(value) {
|
|
89
|
+
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
90
|
+
if (typeof value !== 'string') {
|
|
91
|
+
throw new ValidationError('Invalid email value', [
|
|
92
|
+
{
|
|
93
|
+
field: 'email',
|
|
94
|
+
value,
|
|
95
|
+
message: 'Must be a string',
|
|
96
|
+
constraint: 'isString',
|
|
97
|
+
},
|
|
98
|
+
]);
|
|
99
|
+
}
|
|
100
|
+
if (!emailRegex.test(value)) {
|
|
101
|
+
throw new ValidationError('Invalid email format', [
|
|
102
|
+
{
|
|
103
|
+
field: 'email',
|
|
104
|
+
value,
|
|
105
|
+
message: 'Must be a valid email address',
|
|
106
|
+
constraint: 'email',
|
|
107
|
+
},
|
|
108
|
+
]);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Validates that a string is a valid URL format
|
|
113
|
+
* @param value - The string value to validate
|
|
114
|
+
* @throws ValidationError if the value is not a valid URL
|
|
115
|
+
*/
|
|
116
|
+
function validateUrl(value) {
|
|
117
|
+
if (typeof value !== 'string') {
|
|
118
|
+
throw new ValidationError('Invalid URL value', [
|
|
119
|
+
{
|
|
120
|
+
field: 'url',
|
|
121
|
+
value,
|
|
122
|
+
message: 'Must be a string',
|
|
123
|
+
constraint: 'isString',
|
|
124
|
+
},
|
|
125
|
+
]);
|
|
126
|
+
}
|
|
127
|
+
try {
|
|
128
|
+
new URL(value);
|
|
129
|
+
}
|
|
130
|
+
catch (_a) {
|
|
131
|
+
throw new ValidationError('Invalid URL format', [
|
|
132
|
+
{
|
|
133
|
+
field: 'url',
|
|
134
|
+
value,
|
|
135
|
+
message: 'Must be a valid URL',
|
|
136
|
+
constraint: 'url',
|
|
137
|
+
},
|
|
138
|
+
]);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Validates that a string is non-empty
|
|
143
|
+
* @param value - The string value to validate
|
|
144
|
+
* @param fieldName - The name of the field for error reporting
|
|
145
|
+
* @throws ValidationError if the value is empty or not a string
|
|
146
|
+
*/
|
|
147
|
+
function validateNonEmpty(value, fieldName) {
|
|
148
|
+
if (typeof value !== 'string') {
|
|
149
|
+
throw new ValidationError('Invalid string value', [
|
|
150
|
+
{
|
|
151
|
+
field: fieldName,
|
|
152
|
+
value,
|
|
153
|
+
message: 'Must be a string',
|
|
154
|
+
constraint: 'isString',
|
|
155
|
+
},
|
|
156
|
+
]);
|
|
157
|
+
}
|
|
158
|
+
if (value.trim().length === 0) {
|
|
159
|
+
throw new ValidationError('String cannot be empty', [
|
|
160
|
+
{
|
|
161
|
+
field: fieldName,
|
|
162
|
+
value,
|
|
163
|
+
message: 'Must not be empty',
|
|
164
|
+
constraint: 'notEmpty',
|
|
165
|
+
},
|
|
166
|
+
]);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Validates that a confidence score is within the 0-1 range
|
|
171
|
+
* @param value - The numeric value to validate
|
|
172
|
+
* @throws ValidationError if the value is not between 0 and 1
|
|
173
|
+
*/
|
|
174
|
+
function validateConfidenceScore(value) {
|
|
175
|
+
if (typeof value !== 'number' || isNaN(value)) {
|
|
176
|
+
throw new ValidationError('Invalid confidence score', [
|
|
177
|
+
{
|
|
178
|
+
field: 'confidenceScore',
|
|
179
|
+
value,
|
|
180
|
+
message: 'Must be a valid number',
|
|
181
|
+
constraint: 'isNumber',
|
|
182
|
+
},
|
|
183
|
+
]);
|
|
184
|
+
}
|
|
185
|
+
if (value < 0 || value > 1) {
|
|
186
|
+
throw new ValidationError('Confidence score out of range', [
|
|
187
|
+
{
|
|
188
|
+
field: 'confidenceScore',
|
|
189
|
+
value,
|
|
190
|
+
message: 'Must be between 0 and 1',
|
|
191
|
+
constraint: 'range',
|
|
192
|
+
},
|
|
193
|
+
]);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Validates multiple fields and accumulates all validation errors
|
|
198
|
+
* @param validations - Array of validation functions to execute
|
|
199
|
+
* @throws ValidationError with all accumulated field errors
|
|
200
|
+
*/
|
|
201
|
+
function validateFields(validations) {
|
|
202
|
+
const errors = [];
|
|
203
|
+
for (const validation of validations) {
|
|
204
|
+
try {
|
|
205
|
+
validation();
|
|
206
|
+
}
|
|
207
|
+
catch (error) {
|
|
208
|
+
if (error instanceof ValidationError) {
|
|
209
|
+
errors.push(...error.fields);
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
throw error;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
if (errors.length > 0) {
|
|
217
|
+
throw new ValidationError('Validation failed for multiple fields', errors);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
//# sourceMappingURL=input-validator.js.map
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { GraphQLError } from 'graphql';
|
|
2
|
+
/**
|
|
3
|
+
* Validation error details for field-level error reporting
|
|
4
|
+
*/
|
|
5
|
+
export interface ValidationErrorDetail {
|
|
6
|
+
field: string;
|
|
7
|
+
value: unknown;
|
|
8
|
+
message: string;
|
|
9
|
+
constraint: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Custom error class for validation failures
|
|
13
|
+
*/
|
|
14
|
+
export declare class ValidationError extends GraphQLError {
|
|
15
|
+
readonly fields: ValidationErrorDetail[];
|
|
16
|
+
constructor(message: string, fields: ValidationErrorDetail[]);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Validates that a number is within the 0-100 percentage range
|
|
20
|
+
* @param value - The numeric value to validate
|
|
21
|
+
* @param fieldName - The name of the field for error reporting
|
|
22
|
+
* @throws ValidationError if the value is not between 0 and 100
|
|
23
|
+
*/
|
|
24
|
+
export declare function validatePercentage(value: number, fieldName: string): void;
|
|
25
|
+
/**
|
|
26
|
+
* Validates that a number is positive (greater than 0)
|
|
27
|
+
* @param value - The numeric value to validate
|
|
28
|
+
* @param fieldName - The name of the field for error reporting
|
|
29
|
+
* @throws ValidationError if the value is not positive
|
|
30
|
+
*/
|
|
31
|
+
export declare function validatePositiveNumber(value: number, fieldName: string): void;
|
|
32
|
+
/**
|
|
33
|
+
* Validates that a string is a valid email format
|
|
34
|
+
* @param value - The string value to validate
|
|
35
|
+
* @throws ValidationError if the value is not a valid email
|
|
36
|
+
*/
|
|
37
|
+
export declare function validateEmail(value: string): void;
|
|
38
|
+
/**
|
|
39
|
+
* Validates that a string is a valid URL format
|
|
40
|
+
* @param value - The string value to validate
|
|
41
|
+
* @throws ValidationError if the value is not a valid URL
|
|
42
|
+
*/
|
|
43
|
+
export declare function validateUrl(value: string): void;
|
|
44
|
+
/**
|
|
45
|
+
* Validates that a string is non-empty
|
|
46
|
+
* @param value - The string value to validate
|
|
47
|
+
* @param fieldName - The name of the field for error reporting
|
|
48
|
+
* @throws ValidationError if the value is empty or not a string
|
|
49
|
+
*/
|
|
50
|
+
export declare function validateNonEmpty(value: string, fieldName: string): void;
|
|
51
|
+
/**
|
|
52
|
+
* Validates that a confidence score is within the 0-1 range
|
|
53
|
+
* @param value - The numeric value to validate
|
|
54
|
+
* @throws ValidationError if the value is not between 0 and 1
|
|
55
|
+
*/
|
|
56
|
+
export declare function validateConfidenceScore(value: number): void;
|
|
57
|
+
/**
|
|
58
|
+
* Validates multiple fields and accumulates all validation errors
|
|
59
|
+
* @param validations - Array of validation functions to execute
|
|
60
|
+
* @throws ValidationError with all accumulated field errors
|
|
61
|
+
*/
|
|
62
|
+
export declare function validateFields(validations: Array<() => void>): void;
|
|
63
|
+
//# sourceMappingURL=input-validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-validator.d.ts","sourceRoot":"","sources":["../../src/middleware/input-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,qBAAa,eAAgB,SAAQ,YAAY;IAC/C,SAAgB,MAAM,EAAE,qBAAqB,EAAE,CAAC;gBAEpC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,qBAAqB,EAAE;CAS7D;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAsBzE;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAsB7E;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAwBjD;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,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