@autobe/utils 0.29.1 → 0.30.0-dev.20260315
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/LICENSE +661 -661
- package/README.md +261 -0
- package/lib/AutoBeEscaper.d.ts +4 -0
- package/lib/AutoBeEscaper.js +85 -0
- package/lib/AutoBeEscaper.js.map +1 -0
- package/lib/StringUtil.d.ts +1 -0
- package/lib/StringUtil.js +15 -36
- package/lib/StringUtil.js.map +1 -1
- package/lib/aggregate/AutoBeProcessAggregateFactory.js +9 -0
- package/lib/aggregate/AutoBeProcessAggregateFactory.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/interface/AutoBeOpenApiEndpointComparator.d.ts +1 -0
- package/lib/interface/AutoBeOpenApiEndpointComparator.js +4 -0
- package/lib/interface/AutoBeOpenApiEndpointComparator.js.map +1 -1
- package/lib/interface/AutoBeOpenApiTypeChecker.d.ts +14 -0
- package/lib/interface/AutoBeOpenApiTypeChecker.js +67 -0
- package/lib/interface/AutoBeOpenApiTypeChecker.js.map +1 -1
- package/lib/interface/invertOpenApiDocument.d.ts +1 -1
- package/lib/interface/invertOpenApiDocument.js +22 -7
- package/lib/interface/invertOpenApiDocument.js.map +1 -1
- package/lib/interface/missedOpenApiSchemas.js +3 -3
- package/lib/interface/missedOpenApiSchemas.js.map +1 -1
- package/lib/interface/revertOpenApiAccessor.js +2 -2
- package/lib/interface/revertOpenApiAccessor.js.map +1 -1
- package/lib/interface/transformOpenApiDocument.d.ts +2 -2
- package/lib/interface/transformOpenApiDocument.js +14 -11
- package/lib/interface/transformOpenApiDocument.js.map +1 -1
- package/lib/prisma/writePrismaApplication.d.ts +2 -2
- package/lib/prisma/writePrismaApplication.js +75 -66
- package/lib/prisma/writePrismaApplication.js.map +1 -1
- package/lib/test/validateTestExpression.js +3 -1
- package/lib/test/validateTestExpression.js.map +1 -1
- package/lib/test/validateTestStatement.js +3 -1
- package/lib/test/validateTestStatement.js.map +1 -1
- package/package.json +5 -5
- package/src/ArrayUtil.ts +21 -21
- package/src/AutoBeEscaper.ts +83 -0
- package/src/MapUtil.ts +10 -10
- package/src/StringUtil.ts +34 -59
- package/src/aggregate/AutoBeFunctionCallingMetricFactory.ts +44 -44
- package/src/aggregate/AutoBeProcessAggregateFactory.ts +161 -152
- package/src/aggregate/TokenUsageComputer.ts +49 -49
- package/src/aggregate/index.ts +3 -3
- package/src/index.ts +10 -9
- package/src/interface/AutoBeOpenApiEndpointComparator.ts +27 -20
- package/src/interface/AutoBeOpenApiTypeChecker.ts +127 -43
- package/src/interface/index.ts +6 -6
- package/src/interface/invertOpenApiDocument.ts +80 -68
- package/src/interface/missedOpenApiSchemas.ts +25 -25
- package/src/interface/revertOpenApiAccessor.ts +25 -25
- package/src/interface/transformOpenApiDocument.ts +94 -91
- package/src/prisma/index.ts +1 -1
- package/src/prisma/writePrismaApplication.ts +456 -439
- package/src/test/AutoBeTestExpressionValidator.ts +253 -253
- package/src/test/AutoBeTestStatementValidator.ts +72 -72
- package/src/test/IAutoBeTextValidateContext.ts +10 -10
- package/src/test/index.ts +2 -2
- package/src/test/validateTestApiOperateStatement.ts +92 -92
- package/src/test/validateTestExpression.ts +16 -10
- package/src/test/validateTestFunction.ts +7 -7
- package/src/test/validateTestStatement.ts +16 -10
|
@@ -1,152 +1,161 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AutoBeAggregateEventBase,
|
|
3
|
-
AutoBePhase,
|
|
4
|
-
AutoBeProcessAggregate,
|
|
5
|
-
AutoBeProcessAggregateCollection,
|
|
6
|
-
} from "@autobe/interface";
|
|
7
|
-
|
|
8
|
-
import { AutoBeFunctionCallingMetricFactory } from "./AutoBeFunctionCallingMetricFactory";
|
|
9
|
-
import { TokenUsageComputer } from "./TokenUsageComputer";
|
|
10
|
-
|
|
11
|
-
export namespace AutoBeProcessAggregateFactory {
|
|
12
|
-
export const createAggregate = (): AutoBeProcessAggregate => ({
|
|
13
|
-
metric: AutoBeFunctionCallingMetricFactory.create(),
|
|
14
|
-
tokenUsage: {
|
|
15
|
-
total: 0,
|
|
16
|
-
input: {
|
|
17
|
-
total: 0,
|
|
18
|
-
cached: 0,
|
|
19
|
-
},
|
|
20
|
-
output: {
|
|
21
|
-
total: 0,
|
|
22
|
-
reasoning: 0,
|
|
23
|
-
accepted_prediction: 0,
|
|
24
|
-
rejected_prediction: 0,
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
export const createCollection = <
|
|
30
|
-
Phase extends AutoBePhase | "all",
|
|
31
|
-
>(): AutoBeProcessAggregateCollection<Phase> =>
|
|
32
|
-
({
|
|
33
|
-
total: createAggregate(),
|
|
34
|
-
}) satisfies AutoBeProcessAggregateCollection as AutoBeProcessAggregateCollection<Phase>;
|
|
35
|
-
|
|
36
|
-
export const computeTotal = <Phase extends AutoBePhase | "all">(
|
|
37
|
-
collection: AutoBeProcessAggregateCollection<Phase>,
|
|
38
|
-
): AutoBeProcessAggregate => {
|
|
39
|
-
const total: AutoBeProcessAggregate = createAggregate();
|
|
40
|
-
for (const [key, value] of Object.entries(collection)) {
|
|
41
|
-
if (key === "total") continue;
|
|
42
|
-
AutoBeFunctionCallingMetricFactory.increment(total.metric, value.metric);
|
|
43
|
-
TokenUsageComputer.increment(total.tokenUsage, value.tokenUsage);
|
|
44
|
-
}
|
|
45
|
-
return total;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export const emplaceEvent = <
|
|
49
|
-
Event extends AutoBeAggregateEventBase & {
|
|
50
|
-
type: string;
|
|
51
|
-
},
|
|
52
|
-
>(
|
|
53
|
-
collection: AutoBeProcessAggregateCollection,
|
|
54
|
-
event: Event,
|
|
55
|
-
): void => {
|
|
56
|
-
|
|
57
|
-
collection.
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
(
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
AutoBeFunctionCallingMetricFactory.increment(
|
|
106
|
-
|
|
107
|
-
value.metric,
|
|
108
|
-
);
|
|
109
|
-
TokenUsageComputer.increment(
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
1
|
+
import {
|
|
2
|
+
AutoBeAggregateEventBase,
|
|
3
|
+
AutoBePhase,
|
|
4
|
+
AutoBeProcessAggregate,
|
|
5
|
+
AutoBeProcessAggregateCollection,
|
|
6
|
+
} from "@autobe/interface";
|
|
7
|
+
|
|
8
|
+
import { AutoBeFunctionCallingMetricFactory } from "./AutoBeFunctionCallingMetricFactory";
|
|
9
|
+
import { TokenUsageComputer } from "./TokenUsageComputer";
|
|
10
|
+
|
|
11
|
+
export namespace AutoBeProcessAggregateFactory {
|
|
12
|
+
export const createAggregate = (): AutoBeProcessAggregate => ({
|
|
13
|
+
metric: AutoBeFunctionCallingMetricFactory.create(),
|
|
14
|
+
tokenUsage: {
|
|
15
|
+
total: 0,
|
|
16
|
+
input: {
|
|
17
|
+
total: 0,
|
|
18
|
+
cached: 0,
|
|
19
|
+
},
|
|
20
|
+
output: {
|
|
21
|
+
total: 0,
|
|
22
|
+
reasoning: 0,
|
|
23
|
+
accepted_prediction: 0,
|
|
24
|
+
rejected_prediction: 0,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export const createCollection = <
|
|
30
|
+
Phase extends AutoBePhase | "all",
|
|
31
|
+
>(): AutoBeProcessAggregateCollection<Phase> =>
|
|
32
|
+
({
|
|
33
|
+
total: createAggregate(),
|
|
34
|
+
}) satisfies AutoBeProcessAggregateCollection as AutoBeProcessAggregateCollection<Phase>;
|
|
35
|
+
|
|
36
|
+
export const computeTotal = <Phase extends AutoBePhase | "all">(
|
|
37
|
+
collection: AutoBeProcessAggregateCollection<Phase>,
|
|
38
|
+
): AutoBeProcessAggregate => {
|
|
39
|
+
const total: AutoBeProcessAggregate = createAggregate();
|
|
40
|
+
for (const [key, value] of Object.entries(collection)) {
|
|
41
|
+
if (key === "total") continue;
|
|
42
|
+
AutoBeFunctionCallingMetricFactory.increment(total.metric, value.metric);
|
|
43
|
+
TokenUsageComputer.increment(total.tokenUsage, value.tokenUsage);
|
|
44
|
+
}
|
|
45
|
+
return total;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const emplaceEvent = <
|
|
49
|
+
Event extends AutoBeAggregateEventBase & {
|
|
50
|
+
type: string;
|
|
51
|
+
},
|
|
52
|
+
>(
|
|
53
|
+
collection: AutoBeProcessAggregateCollection,
|
|
54
|
+
event: Event,
|
|
55
|
+
): void => {
|
|
56
|
+
// biome-ignore lint: intended
|
|
57
|
+
(collection as any)[event.type] ??= createAggregate();
|
|
58
|
+
collection.total ??= computeTotal(collection);
|
|
59
|
+
|
|
60
|
+
// biome-ignore lint: intended
|
|
61
|
+
const local: AutoBeProcessAggregate = (collection as any)[
|
|
62
|
+
event.type
|
|
63
|
+
] as AutoBeProcessAggregate;
|
|
64
|
+
const total: AutoBeProcessAggregate = collection.total;
|
|
65
|
+
|
|
66
|
+
AutoBeFunctionCallingMetricFactory.increment(local.metric, event.metric);
|
|
67
|
+
AutoBeFunctionCallingMetricFactory.increment(total.metric, event.metric);
|
|
68
|
+
TokenUsageComputer.increment(local.tokenUsage, event.tokenUsage);
|
|
69
|
+
TokenUsageComputer.increment(total.tokenUsage, event.tokenUsage);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export const filterPhase = <Phase extends AutoBePhase>(
|
|
73
|
+
collection: AutoBeProcessAggregateCollection,
|
|
74
|
+
phase: Phase,
|
|
75
|
+
): AutoBeProcessAggregateCollection<Phase> => {
|
|
76
|
+
const result: AutoBeProcessAggregateCollection<Phase> = createCollection();
|
|
77
|
+
for (const [key, value] of Object.entries(collection)) {
|
|
78
|
+
if (key === "total") continue;
|
|
79
|
+
else if (key.startsWith(phase) === false) continue;
|
|
80
|
+
|
|
81
|
+
// biome-ignore lint: intended
|
|
82
|
+
(result as any)[key] = value;
|
|
83
|
+
AutoBeFunctionCallingMetricFactory.increment(
|
|
84
|
+
result.total.metric,
|
|
85
|
+
value.metric,
|
|
86
|
+
);
|
|
87
|
+
TokenUsageComputer.increment(result.total.tokenUsage, value.tokenUsage);
|
|
88
|
+
}
|
|
89
|
+
return result;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export const reduce = (
|
|
93
|
+
collections: AutoBeProcessAggregateCollection[],
|
|
94
|
+
): AutoBeProcessAggregateCollection => {
|
|
95
|
+
const result: AutoBeProcessAggregateCollection = createCollection();
|
|
96
|
+
for (const collection of collections) {
|
|
97
|
+
for (const [key, value] of Object.entries(collection)) {
|
|
98
|
+
if (key === "total") continue;
|
|
99
|
+
// biome-ignore lint: intended
|
|
100
|
+
(result as any)[key] ??= createAggregate();
|
|
101
|
+
// biome-ignore lint: intended
|
|
102
|
+
const local: AutoBeProcessAggregate = (result as any)[
|
|
103
|
+
key
|
|
104
|
+
] as AutoBeProcessAggregate;
|
|
105
|
+
AutoBeFunctionCallingMetricFactory.increment(
|
|
106
|
+
local.metric,
|
|
107
|
+
value.metric,
|
|
108
|
+
);
|
|
109
|
+
TokenUsageComputer.increment(local.tokenUsage, value.tokenUsage);
|
|
110
|
+
AutoBeFunctionCallingMetricFactory.increment(
|
|
111
|
+
result.total.metric,
|
|
112
|
+
value.metric,
|
|
113
|
+
);
|
|
114
|
+
TokenUsageComputer.increment(result.total.tokenUsage, value.tokenUsage);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
result.total ??= createAggregate();
|
|
118
|
+
Object.assign(result.total, computeTotal(result));
|
|
119
|
+
return result;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
export const increment = (
|
|
123
|
+
x: AutoBeProcessAggregateCollection,
|
|
124
|
+
y: AutoBeProcessAggregateCollection,
|
|
125
|
+
): void => {
|
|
126
|
+
for (const [key, value] of Object.entries(y)) {
|
|
127
|
+
if (key === "total") continue;
|
|
128
|
+
// biome-ignore lint: intended
|
|
129
|
+
(x as any)[key] ??= createAggregate();
|
|
130
|
+
// biome-ignore lint: intended
|
|
131
|
+
const local: AutoBeProcessAggregate = (x as any)[
|
|
132
|
+
key
|
|
133
|
+
] as AutoBeProcessAggregate;
|
|
134
|
+
AutoBeFunctionCallingMetricFactory.increment(local.metric, value.metric);
|
|
135
|
+
}
|
|
136
|
+
x.total ??= createAggregate();
|
|
137
|
+
Object.assign(x.total, computeTotal(x));
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
export const minus = (
|
|
141
|
+
x: AutoBeProcessAggregateCollection,
|
|
142
|
+
y: AutoBeProcessAggregateCollection,
|
|
143
|
+
): AutoBeProcessAggregateCollection => {
|
|
144
|
+
const result = JSON.parse(
|
|
145
|
+
JSON.stringify(x),
|
|
146
|
+
) as AutoBeProcessAggregateCollection;
|
|
147
|
+
for (const [key, value] of Object.entries(y)) {
|
|
148
|
+
if (key === "total") continue;
|
|
149
|
+
// biome-ignore lint: intended
|
|
150
|
+
(result as any)[key] ??= createAggregate();
|
|
151
|
+
// biome-ignore lint: intended
|
|
152
|
+
const local: AutoBeProcessAggregate = (result as any)[
|
|
153
|
+
key
|
|
154
|
+
] as AutoBeProcessAggregate;
|
|
155
|
+
AutoBeFunctionCallingMetricFactory.minus(local.metric, value.metric);
|
|
156
|
+
}
|
|
157
|
+
result.total ??= createAggregate();
|
|
158
|
+
Object.assign(result.total, computeTotal(result));
|
|
159
|
+
return result;
|
|
160
|
+
};
|
|
161
|
+
}
|
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
import { IAutoBeTokenUsageJson } from "@autobe/interface";
|
|
2
|
-
|
|
3
|
-
export namespace TokenUsageComputer {
|
|
4
|
-
export const zero = (): IAutoBeTokenUsageJson.IComponent => ({
|
|
5
|
-
total: 0,
|
|
6
|
-
input: {
|
|
7
|
-
total: 0,
|
|
8
|
-
cached: 0,
|
|
9
|
-
},
|
|
10
|
-
output: {
|
|
11
|
-
total: 0,
|
|
12
|
-
reasoning: 0,
|
|
13
|
-
accepted_prediction: 0,
|
|
14
|
-
rejected_prediction: 0,
|
|
15
|
-
},
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
export const plus = (
|
|
19
|
-
x: IAutoBeTokenUsageJson.IComponent,
|
|
20
|
-
y: IAutoBeTokenUsageJson.IComponent,
|
|
21
|
-
): IAutoBeTokenUsageJson.IComponent => ({
|
|
22
|
-
total: x.total + y.total,
|
|
23
|
-
input: {
|
|
24
|
-
total: x.input.total + y.input.total,
|
|
25
|
-
cached: x.input.cached + y.input.cached,
|
|
26
|
-
},
|
|
27
|
-
output: {
|
|
28
|
-
total: x.output.total + y.output.total,
|
|
29
|
-
reasoning: x.output.reasoning + y.output.reasoning,
|
|
30
|
-
accepted_prediction:
|
|
31
|
-
x.output.accepted_prediction + y.output.accepted_prediction,
|
|
32
|
-
rejected_prediction:
|
|
33
|
-
x.output.rejected_prediction + y.output.rejected_prediction,
|
|
34
|
-
},
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
export const increment = (
|
|
38
|
-
x: IAutoBeTokenUsageJson.IComponent,
|
|
39
|
-
y: IAutoBeTokenUsageJson.IComponent,
|
|
40
|
-
): void => {
|
|
41
|
-
x.total += y.total;
|
|
42
|
-
x.input.total += y.input.total;
|
|
43
|
-
x.input.cached += y.input.cached;
|
|
44
|
-
x.output.total += y.output.total;
|
|
45
|
-
x.output.reasoning += y.output.reasoning;
|
|
46
|
-
x.output.accepted_prediction += y.output.accepted_prediction;
|
|
47
|
-
x.output.rejected_prediction += y.output.rejected_prediction;
|
|
48
|
-
};
|
|
49
|
-
}
|
|
1
|
+
import { IAutoBeTokenUsageJson } from "@autobe/interface";
|
|
2
|
+
|
|
3
|
+
export namespace TokenUsageComputer {
|
|
4
|
+
export const zero = (): IAutoBeTokenUsageJson.IComponent => ({
|
|
5
|
+
total: 0,
|
|
6
|
+
input: {
|
|
7
|
+
total: 0,
|
|
8
|
+
cached: 0,
|
|
9
|
+
},
|
|
10
|
+
output: {
|
|
11
|
+
total: 0,
|
|
12
|
+
reasoning: 0,
|
|
13
|
+
accepted_prediction: 0,
|
|
14
|
+
rejected_prediction: 0,
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export const plus = (
|
|
19
|
+
x: IAutoBeTokenUsageJson.IComponent,
|
|
20
|
+
y: IAutoBeTokenUsageJson.IComponent,
|
|
21
|
+
): IAutoBeTokenUsageJson.IComponent => ({
|
|
22
|
+
total: x.total + y.total,
|
|
23
|
+
input: {
|
|
24
|
+
total: x.input.total + y.input.total,
|
|
25
|
+
cached: x.input.cached + y.input.cached,
|
|
26
|
+
},
|
|
27
|
+
output: {
|
|
28
|
+
total: x.output.total + y.output.total,
|
|
29
|
+
reasoning: x.output.reasoning + y.output.reasoning,
|
|
30
|
+
accepted_prediction:
|
|
31
|
+
x.output.accepted_prediction + y.output.accepted_prediction,
|
|
32
|
+
rejected_prediction:
|
|
33
|
+
x.output.rejected_prediction + y.output.rejected_prediction,
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export const increment = (
|
|
38
|
+
x: IAutoBeTokenUsageJson.IComponent,
|
|
39
|
+
y: IAutoBeTokenUsageJson.IComponent,
|
|
40
|
+
): void => {
|
|
41
|
+
x.total += y.total;
|
|
42
|
+
x.input.total += y.input.total;
|
|
43
|
+
x.input.cached += y.input.cached;
|
|
44
|
+
x.output.total += y.output.total;
|
|
45
|
+
x.output.reasoning += y.output.reasoning;
|
|
46
|
+
x.output.accepted_prediction += y.output.accepted_prediction;
|
|
47
|
+
x.output.rejected_prediction += y.output.rejected_prediction;
|
|
48
|
+
};
|
|
49
|
+
}
|
package/src/aggregate/index.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./AutoBeFunctionCallingMetricFactory";
|
|
2
|
-
export * from "./AutoBeProcessAggregateFactory";
|
|
3
|
-
export * from "./TokenUsageComputer";
|
|
1
|
+
export * from "./AutoBeFunctionCallingMetricFactory";
|
|
2
|
+
export * from "./AutoBeProcessAggregateFactory";
|
|
3
|
+
export * from "./TokenUsageComputer";
|
package/src/index.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
export * from "./aggregate";
|
|
2
|
-
|
|
3
|
-
export * from "./prisma";
|
|
4
|
-
export * from "./interface";
|
|
5
|
-
export * from "./test";
|
|
6
|
-
|
|
7
|
-
export * from "./ArrayUtil";
|
|
8
|
-
export * from "./
|
|
9
|
-
export * from "./
|
|
1
|
+
export * from "./aggregate";
|
|
2
|
+
|
|
3
|
+
export * from "./prisma";
|
|
4
|
+
export * from "./interface";
|
|
5
|
+
export * from "./test";
|
|
6
|
+
|
|
7
|
+
export * from "./ArrayUtil";
|
|
8
|
+
export * from "./AutoBeEscaper";
|
|
9
|
+
export * from "./MapUtil";
|
|
10
|
+
export * from "./StringUtil";
|
|
@@ -1,20 +1,27 @@
|
|
|
1
|
-
import { AutoBeOpenApi } from "@autobe/interface";
|
|
2
|
-
import { hash } from "tstl";
|
|
3
|
-
|
|
4
|
-
export namespace AutoBeOpenApiEndpointComparator {
|
|
5
|
-
export function compare(
|
|
6
|
-
x: AutoBeOpenApi.IEndpoint,
|
|
7
|
-
y: AutoBeOpenApi.IEndpoint,
|
|
8
|
-
): number {
|
|
9
|
-
if (x.path !== y.path) return x.path.localeCompare(y.path);
|
|
10
|
-
return x.method.localeCompare(y.method);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export const equals = (
|
|
14
|
-
x: AutoBeOpenApi.IEndpoint,
|
|
15
|
-
y: AutoBeOpenApi.IEndpoint,
|
|
16
|
-
): boolean => x.method === y.method && x.path === y.path;
|
|
17
|
-
|
|
18
|
-
export const hashCode = (endpoint: AutoBeOpenApi.IEndpoint): number =>
|
|
19
|
-
hash(endpoint.path, endpoint.method);
|
|
20
|
-
|
|
1
|
+
import { AutoBeOpenApi } from "@autobe/interface";
|
|
2
|
+
import { hash } from "tstl";
|
|
3
|
+
|
|
4
|
+
export namespace AutoBeOpenApiEndpointComparator {
|
|
5
|
+
export function compare(
|
|
6
|
+
x: AutoBeOpenApi.IEndpoint,
|
|
7
|
+
y: AutoBeOpenApi.IEndpoint,
|
|
8
|
+
): number {
|
|
9
|
+
if (x.path !== y.path) return x.path.localeCompare(y.path);
|
|
10
|
+
return x.method.localeCompare(y.method);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const equals = (
|
|
14
|
+
x: AutoBeOpenApi.IEndpoint,
|
|
15
|
+
y: AutoBeOpenApi.IEndpoint,
|
|
16
|
+
): boolean => x.method === y.method && x.path === y.path;
|
|
17
|
+
|
|
18
|
+
export const hashCode = (endpoint: AutoBeOpenApi.IEndpoint): number =>
|
|
19
|
+
hash(endpoint.path, endpoint.method);
|
|
20
|
+
|
|
21
|
+
export const clone = (
|
|
22
|
+
endpoint: AutoBeOpenApi.IEndpoint,
|
|
23
|
+
): AutoBeOpenApi.IEndpoint => ({
|
|
24
|
+
path: endpoint.path,
|
|
25
|
+
method: endpoint.method,
|
|
26
|
+
});
|
|
27
|
+
}
|