@simtlix/simfinity-js 2.4.6 → 2.5.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/.claude/worktrees/agitated-kepler/.claude/settings.local.json +23 -0
- package/.claude/worktrees/agitated-kepler/AGGREGATION_CHANGES_SUMMARY.md +235 -0
- package/.claude/worktrees/agitated-kepler/AGGREGATION_EXAMPLE.md +567 -0
- package/.claude/worktrees/agitated-kepler/LICENSE +201 -0
- package/.claude/worktrees/agitated-kepler/README.md +3941 -0
- package/.claude/worktrees/agitated-kepler/eslint.config.mjs +71 -0
- package/.claude/worktrees/agitated-kepler/package-lock.json +4740 -0
- package/.claude/worktrees/agitated-kepler/package.json +41 -0
- package/.claude/worktrees/agitated-kepler/src/auth/errors.js +44 -0
- package/.claude/worktrees/agitated-kepler/src/auth/expressions.js +273 -0
- package/.claude/worktrees/agitated-kepler/src/auth/index.js +391 -0
- package/.claude/worktrees/agitated-kepler/src/auth/rules.js +274 -0
- package/.claude/worktrees/agitated-kepler/src/const/QLOperator.js +39 -0
- package/.claude/worktrees/agitated-kepler/src/const/QLSort.js +28 -0
- package/.claude/worktrees/agitated-kepler/src/const/QLValue.js +39 -0
- package/.claude/worktrees/agitated-kepler/src/errors/internal-server.error.js +11 -0
- package/.claude/worktrees/agitated-kepler/src/errors/simfinity.error.js +15 -0
- package/.claude/worktrees/agitated-kepler/src/index.js +2412 -0
- package/.claude/worktrees/agitated-kepler/src/plugins.js +53 -0
- package/.claude/worktrees/agitated-kepler/src/scalars.js +188 -0
- package/.claude/worktrees/agitated-kepler/src/validators.js +250 -0
- package/.claude/worktrees/agitated-kepler/yarn.lock +1154 -0
- package/.cursor/rules/simfinity-core-functions.mdc +3 -1
- package/README.md +202 -0
- package/package.json +1 -1
- package/src/index.js +235 -21
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GraphQLInputObjectType,
|
|
3
|
+
GraphQLNonNull,
|
|
4
|
+
GraphQLEnumType,
|
|
5
|
+
GraphQLString,
|
|
6
|
+
} from 'graphql';
|
|
7
|
+
|
|
8
|
+
const QLSortOrder = new GraphQLEnumType({
|
|
9
|
+
name: 'QLSortOrder',
|
|
10
|
+
values: {
|
|
11
|
+
DESC: {
|
|
12
|
+
value: 'DESC',
|
|
13
|
+
},
|
|
14
|
+
ASC: {
|
|
15
|
+
value: 'ASC',
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const QLSort = new GraphQLInputObjectType({
|
|
21
|
+
name: 'QLSort',
|
|
22
|
+
fields: () => ({
|
|
23
|
+
field: { type: new GraphQLNonNull(GraphQLString) },
|
|
24
|
+
order: { type: new GraphQLNonNull(QLSortOrder) },
|
|
25
|
+
}),
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export default QLSort;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { GraphQLScalarType, Kind } from 'graphql';
|
|
2
|
+
|
|
3
|
+
function parseQLValue(value) {
|
|
4
|
+
return value;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
const QLValue = new GraphQLScalarType({
|
|
8
|
+
name: 'QLValue',
|
|
9
|
+
serialize: parseQLValue,
|
|
10
|
+
parseValue: parseQLValue,
|
|
11
|
+
parseLiteral(ast) {
|
|
12
|
+
if (ast.kind === Kind.INT) {
|
|
13
|
+
return parseInt(ast.value, 10);
|
|
14
|
+
} if (ast.kind === Kind.FLOAT) {
|
|
15
|
+
return parseFloat(ast.value);
|
|
16
|
+
} if (ast.kind === Kind.BOOLEAN) {
|
|
17
|
+
return ast.value === 'true' || ast.value === true;
|
|
18
|
+
} if (ast.kind === Kind.STRING) {
|
|
19
|
+
return ast.value;
|
|
20
|
+
} if (ast.kind === Kind.LIST) {
|
|
21
|
+
const values = [];
|
|
22
|
+
ast.values.forEach((value) => {
|
|
23
|
+
if (value.kind === Kind.INT) {
|
|
24
|
+
values.push(parseInt(value.value, 10));
|
|
25
|
+
} else if (value.kind === Kind.FLOAT) {
|
|
26
|
+
values.push(parseFloat(value.value));
|
|
27
|
+
} else if (value.kind === Kind.BOOLEAN) {
|
|
28
|
+
values.push(value.value === 'true' || value.value === true);
|
|
29
|
+
} else if (value.kind === Kind.STRING) {
|
|
30
|
+
values.push(value.value);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
return values;
|
|
34
|
+
}
|
|
35
|
+
return null;
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export default QLValue;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import SimfinityError from './simfinity.error.js';
|
|
2
|
+
|
|
3
|
+
class InternalServerError extends SimfinityError {
|
|
4
|
+
constructor(message, cause) {
|
|
5
|
+
super(message, 'INTERNAL_SERVER_ERROR');
|
|
6
|
+
this.cause = cause;
|
|
7
|
+
this.getCause = () => this.cause;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default InternalServerError;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
class SimfinityError extends Error {
|
|
2
|
+
constructor(message, code, status) {
|
|
3
|
+
super(message);
|
|
4
|
+
this.extensions = {
|
|
5
|
+
code,
|
|
6
|
+
status,
|
|
7
|
+
timestamp: new Date().toUTCString(),
|
|
8
|
+
};
|
|
9
|
+
this.getCode = () => this.extensions.code;
|
|
10
|
+
this.getStatus = () => this.extensions.status;
|
|
11
|
+
this.getTimestamp = () => this.extensions.timestamp;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default SimfinityError;
|