@automateinc/fleet-types 1.0.106 → 1.0.108
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/bin/fleet-types.mjs
CHANGED
|
@@ -155,7 +155,7 @@ async function generateTypes() {
|
|
|
155
155
|
const emittedPath = routerSourcePath.replace(/\.ts$/, ".d.ts");
|
|
156
156
|
const sourceFile = ts.createSourceFile(emittedPath, emittedDeclaration, ts.ScriptTarget.Latest, true);
|
|
157
157
|
const sanitizedSourceFile = sanitizeBackendTypes(ts, sourceFile);
|
|
158
|
-
const transformedSourceFile =
|
|
158
|
+
const transformedSourceFile = transformProcedureOutputs(ts, sanitizedSourceFile);
|
|
159
159
|
const statements = transformedSourceFile.statements.filter(
|
|
160
160
|
statement =>
|
|
161
161
|
ts.isImportDeclaration(statement) ||
|
|
@@ -199,7 +199,7 @@ async function generateTypes() {
|
|
|
199
199
|
console.log(`Generated ${path.relative(callerRoot, outputPath)} from ${routerSourcePath}`);
|
|
200
200
|
}
|
|
201
201
|
|
|
202
|
-
function
|
|
202
|
+
function transformProcedureOutputs(ts, sourceFile) {
|
|
203
203
|
const procedureTypes = new Set(["TRPCMutationProcedure", "TRPCQueryProcedure", "TRPCSubscriptionProcedure"]);
|
|
204
204
|
const transformation = ts.transform(sourceFile, [
|
|
205
205
|
context => {
|
|
@@ -211,48 +211,14 @@ function transformProcedures(ts, sourceFile) {
|
|
|
211
211
|
node.typeArguments?.length
|
|
212
212
|
) {
|
|
213
213
|
const [procedureDefinition, ...remainingTypeArguments] = node.typeArguments;
|
|
214
|
-
const procedureType = node.qualifier.text;
|
|
215
|
-
|
|
216
214
|
if (ts.isTypeLiteralNode(procedureDefinition)) {
|
|
217
215
|
const members = procedureDefinition.members.map(member => {
|
|
218
|
-
if (!ts.isPropertySignature(member) || !member.type || !ts.isIdentifier(member.name)) return member;
|
|
219
|
-
|
|
220
216
|
if (
|
|
221
|
-
|
|
222
|
-
member.
|
|
223
|
-
ts.
|
|
217
|
+
ts.isPropertySignature(member) &&
|
|
218
|
+
member.type &&
|
|
219
|
+
ts.isIdentifier(member.name) &&
|
|
220
|
+
member.name.text === "output"
|
|
224
221
|
) {
|
|
225
|
-
const inputProperties = member.type.members.filter(ts.isPropertySignature);
|
|
226
|
-
const hasInputProperty = propertyName =>
|
|
227
|
-
inputProperties.some(property =>
|
|
228
|
-
ts.isIdentifier(property.name) || ts.isStringLiteral(property.name)
|
|
229
|
-
? property.name.text === propertyName
|
|
230
|
-
: false,
|
|
231
|
-
);
|
|
232
|
-
|
|
233
|
-
if (hasInputProperty("skip") && hasInputProperty("take") && !hasInputProperty("cursor")) {
|
|
234
|
-
const cursorProperty = ts.factory.createPropertySignature(
|
|
235
|
-
undefined,
|
|
236
|
-
"cursor",
|
|
237
|
-
ts.factory.createToken(ts.SyntaxKind.QuestionToken),
|
|
238
|
-
ts.factory.createKeywordTypeNode(ts.SyntaxKind.UnknownKeyword),
|
|
239
|
-
);
|
|
240
|
-
const inputType = ts.factory.updateTypeLiteralNode(member.type, [
|
|
241
|
-
cursorProperty,
|
|
242
|
-
...member.type.members,
|
|
243
|
-
]);
|
|
244
|
-
|
|
245
|
-
return ts.factory.updatePropertySignature(
|
|
246
|
-
member,
|
|
247
|
-
member.modifiers,
|
|
248
|
-
member.name,
|
|
249
|
-
member.questionToken,
|
|
250
|
-
inputType,
|
|
251
|
-
);
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
if (member.name.text === "output") {
|
|
256
222
|
return ts.factory.updatePropertySignature(
|
|
257
223
|
member,
|
|
258
224
|
member.modifiers,
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type { IStructuredContentTableColumnSortConfig } from "./structured-content-table-column-sort-config";
|
|
2
2
|
import type { IStructuredContentTableNamedColumnBase } from "./structured-content-table-named-column-base";
|
|
3
3
|
|
|
4
|
+
export type StructuredContentTableNumberFormat = "PERCENTAGE";
|
|
5
|
+
|
|
4
6
|
export interface IStructuredContentTableNumberColumn extends IStructuredContentTableNamedColumnBase {
|
|
5
|
-
config?: IStructuredContentTableColumnSortConfig
|
|
7
|
+
config?: IStructuredContentTableColumnSortConfig & {
|
|
8
|
+
format?: StructuredContentTableNumberFormat;
|
|
9
|
+
};
|
|
6
10
|
type: "NUMBER";
|
|
7
11
|
}
|
package/package.json
CHANGED