@automateinc/fleet-types 1.0.118 → 1.0.119-dev.fe6307d
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 +53 -148
- package/biome.json +0 -1
- package/dist/types/client-field.d.ts +1 -4
- package/dist/types/client-quotation-position-version.d.ts +1 -6
- package/dist/types/client-quotation-site-draft.d.ts +1 -2
- package/dist/types/client-quotation.d.ts +2 -6
- package/dist/types/client-request-action-execution.d.ts +1 -7
- package/dist/types/client-request-field-visibility-rule.d.ts +1 -7
- package/dist/types/client-request.d.ts +2 -13
- package/dist/types/config.d.ts +1 -8
- package/dist/types/day-of-week.d.ts +1 -8
- package/dist/types/dispatch.d.ts +1 -8
- package/dist/types/employee-field.d.ts +4 -12
- package/dist/types/employee-group.d.ts +0 -1
- package/dist/types/index.d.ts +6 -34
- package/dist/types/metadata.d.ts +1 -6
- package/dist/types/models.d.ts +1 -5
- package/dist/types/one-time-password.d.ts +1 -5
- package/dist/types/patrol-point.d.ts +1 -6
- package/dist/types/recruitment.d.ts +1 -7
- package/dist/types/request-action-execution.d.ts +1 -7
- package/dist/types/request.d.ts +2 -14
- package/dist/types/restriction.d.ts +1 -7
- package/dist/types/schedule.d.ts +1 -8
- package/dist/types/scheduling-requirement.d.ts +1 -5
- package/dist/types/{client-site.d.ts → site.d.ts} +4 -1
- package/dist/types/structured-content-collapse-node.d.ts +1 -2
- package/dist/types/structured-content-default-avatar-node.d.ts +1 -2
- package/dist/types/structured-content-node-base.d.ts +1 -10
- package/dist/types/structured-content-root.d.ts +1 -4
- package/dist/types/structured-content-space-node.d.ts +1 -2
- package/dist/types/structured-content-statistic-node.d.ts +1 -2
- package/dist/types/structured-content-table-boolean-column.d.ts +1 -2
- package/dist/types/structured-content-table-column-sort-config.d.ts +1 -4
- package/dist/types/structured-content-table-date-column.d.ts +1 -2
- package/dist/types/structured-content-table-date-range-filter.d.ts +1 -2
- package/dist/types/structured-content-table-date-time-column.d.ts +1 -2
- package/dist/types/structured-content-table-default-avatar-column.d.ts +1 -2
- package/dist/types/structured-content-table-link-column.d.ts +1 -2
- package/dist/types/structured-content-table-named-column-base.d.ts +1 -2
- package/dist/types/structured-content-table-node.d.ts +1 -2
- package/dist/types/structured-content-table-number-column.d.ts +1 -2
- package/dist/types/structured-content-table-select-filter.d.ts +1 -2
- package/dist/types/structured-content-table-tag-column.d.ts +1 -2
- package/dist/types/structured-content-table-text-column.d.ts +1 -2
- package/dist/types/structured-content-table-time-column.d.ts +1 -2
- package/dist/types/structured-content.d.ts +3 -15
- package/dist/types/todo-dependency-type.d.ts +1 -5
- package/dist/types/todo-json-value.d.ts +1 -4
- package/dist/types/todo-status.d.ts +1 -6
- package/dist/types/todo-view-type.d.ts +1 -7
- package/dist/types/zone.d.ts +1 -9
- package/package.json +3 -3
- package/dist/types/employee-monthly-pay-review-event.d.ts +0 -21
- package/dist/types/employee-monthly-pay-review-field.d.ts +0 -13
- package/dist/types/employee-monthly-pay-review.d.ts +0 -15
- package/dist/types/schedule-site.d.ts +0 -11
- package/dist/types/user-attendance-check-in-location.d.ts +0 -11
- package/dist/types/user-attendance.d.ts +0 -20
package/bin/fleet-types.mjs
CHANGED
|
@@ -58,10 +58,7 @@ if (!command || command === "--help" || command === "-h") {
|
|
|
58
58
|
|
|
59
59
|
async function generateTypes() {
|
|
60
60
|
const callerRoot = process.cwd();
|
|
61
|
-
const packageRoot = path.resolve(
|
|
62
|
-
path.dirname(fileURLToPath(import.meta.url)),
|
|
63
|
-
"..",
|
|
64
|
-
);
|
|
61
|
+
const packageRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
|
65
62
|
|
|
66
63
|
try {
|
|
67
64
|
loadEnvFile(path.join(callerRoot, ".env"));
|
|
@@ -73,16 +70,12 @@ async function generateTypes() {
|
|
|
73
70
|
|
|
74
71
|
const fleetApiPath = process.env.FLEET_API_PATH;
|
|
75
72
|
if (!fleetApiPath) {
|
|
76
|
-
throw new Error(
|
|
77
|
-
"FLEET_API_PATH is not set. Add it to .env or the process environment.",
|
|
78
|
-
);
|
|
73
|
+
throw new Error("FLEET_API_PATH is not set. Add it to .env or the process environment.");
|
|
79
74
|
}
|
|
80
75
|
|
|
81
76
|
const fleetApiTypesPath = process.env.FLEET_API_TYPES_PATH;
|
|
82
77
|
if (!fleetApiTypesPath) {
|
|
83
|
-
throw new Error(
|
|
84
|
-
"FLEET_API_TYPES_PATH is not set. Add it to .env or the process environment.",
|
|
85
|
-
);
|
|
78
|
+
throw new Error("FLEET_API_TYPES_PATH is not set. Add it to .env or the process environment.");
|
|
86
79
|
}
|
|
87
80
|
|
|
88
81
|
const apiRoot = path.resolve(callerRoot, fleetApiPath);
|
|
@@ -91,27 +84,15 @@ async function generateTypes() {
|
|
|
91
84
|
const prismaJsonSourcePath = path.join(apiRoot, "prisma/types.d.ts");
|
|
92
85
|
const apiTsconfigPath = path.join(apiRoot, "tsconfig.json");
|
|
93
86
|
const executableExtension = process.platform === "win32" ? ".cmd" : "";
|
|
94
|
-
const callerBiomePath = path.join(
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
);
|
|
98
|
-
const packageBiomePath = path.join(
|
|
99
|
-
packageRoot,
|
|
100
|
-
`node_modules/.bin/biome${executableExtension}`,
|
|
101
|
-
);
|
|
102
|
-
const biomePath = existsSync(callerBiomePath)
|
|
103
|
-
? callerBiomePath
|
|
104
|
-
: packageBiomePath;
|
|
105
|
-
const requireFromPackage = createRequire(
|
|
106
|
-
path.join(packageRoot, "package.json"),
|
|
107
|
-
);
|
|
87
|
+
const callerBiomePath = path.join(callerRoot, `node_modules/.bin/biome${executableExtension}`);
|
|
88
|
+
const packageBiomePath = path.join(packageRoot, `node_modules/.bin/biome${executableExtension}`);
|
|
89
|
+
const biomePath = existsSync(callerBiomePath) ? callerBiomePath : packageBiomePath;
|
|
90
|
+
const requireFromPackage = createRequire(path.join(packageRoot, "package.json"));
|
|
108
91
|
const ts = requireFromPackage("typescript");
|
|
109
92
|
const configResult = ts.readConfigFile(apiTsconfigPath, ts.sys.readFile);
|
|
110
93
|
|
|
111
94
|
if (configResult.error) {
|
|
112
|
-
throw new Error(
|
|
113
|
-
formatTypeScriptDiagnostics(ts, [configResult.error], apiRoot),
|
|
114
|
-
);
|
|
95
|
+
throw new Error(formatTypeScriptDiagnostics(ts, [configResult.error], apiRoot));
|
|
115
96
|
}
|
|
116
97
|
|
|
117
98
|
const parsedConfig = ts.parseJsonConfigFileContent(
|
|
@@ -130,9 +111,7 @@ async function generateTypes() {
|
|
|
130
111
|
);
|
|
131
112
|
|
|
132
113
|
if (parsedConfig.errors.length > 0) {
|
|
133
|
-
throw new Error(
|
|
134
|
-
formatTypeScriptDiagnostics(ts, parsedConfig.errors, apiRoot),
|
|
135
|
-
);
|
|
114
|
+
throw new Error(formatTypeScriptDiagnostics(ts, parsedConfig.errors, apiRoot));
|
|
136
115
|
}
|
|
137
116
|
|
|
138
117
|
const program = ts.createProgram({
|
|
@@ -146,20 +125,16 @@ async function generateTypes() {
|
|
|
146
125
|
throw new Error(`Unable to load AppRouter source at ${routerSourcePath}.`);
|
|
147
126
|
}
|
|
148
127
|
if (!prismaJsonSource) {
|
|
149
|
-
throw new Error(
|
|
150
|
-
`Unable to load PrismaJson declarations at ${prismaJsonSourcePath}.`,
|
|
151
|
-
);
|
|
128
|
+
throw new Error(`Unable to load PrismaJson declarations at ${prismaJsonSourcePath}.`);
|
|
152
129
|
}
|
|
153
130
|
|
|
154
131
|
const sourceDiagnostics = [
|
|
155
132
|
...program.getSyntacticDiagnostics(routerSource),
|
|
156
133
|
...program.getSemanticDiagnostics(routerSource),
|
|
157
|
-
].filter(
|
|
134
|
+
].filter(diagnostic => diagnostic.category === ts.DiagnosticCategory.Error);
|
|
158
135
|
|
|
159
136
|
if (sourceDiagnostics.length > 0) {
|
|
160
|
-
throw new Error(
|
|
161
|
-
formatTypeScriptDiagnostics(ts, sourceDiagnostics, apiRoot),
|
|
162
|
-
);
|
|
137
|
+
throw new Error(formatTypeScriptDiagnostics(ts, sourceDiagnostics, apiRoot));
|
|
163
138
|
}
|
|
164
139
|
|
|
165
140
|
let emittedDeclaration;
|
|
@@ -172,65 +147,41 @@ async function generateTypes() {
|
|
|
172
147
|
true,
|
|
173
148
|
);
|
|
174
149
|
const emitDiagnostics = emitResult.diagnostics.filter(
|
|
175
|
-
|
|
150
|
+
diagnostic => diagnostic.category === ts.DiagnosticCategory.Error,
|
|
176
151
|
);
|
|
177
152
|
|
|
178
153
|
if (emitDiagnostics.length > 0) {
|
|
179
154
|
throw new Error(formatTypeScriptDiagnostics(ts, emitDiagnostics, apiRoot));
|
|
180
155
|
}
|
|
181
156
|
if (!emittedDeclaration) {
|
|
182
|
-
throw new Error(
|
|
183
|
-
`TypeScript did not emit a declaration for ${routerSourcePath}.`,
|
|
184
|
-
);
|
|
157
|
+
throw new Error(`TypeScript did not emit a declaration for ${routerSourcePath}.`);
|
|
185
158
|
}
|
|
186
159
|
|
|
187
160
|
const emittedPath = routerSourcePath.replace(/\.ts$/, ".d.ts");
|
|
188
|
-
const sourceFile = ts.createSourceFile(
|
|
189
|
-
emittedPath,
|
|
190
|
-
emittedDeclaration,
|
|
191
|
-
ts.ScriptTarget.Latest,
|
|
192
|
-
true,
|
|
193
|
-
);
|
|
161
|
+
const sourceFile = ts.createSourceFile(emittedPath, emittedDeclaration, ts.ScriptTarget.Latest, true);
|
|
194
162
|
const sanitizedSourceFile = sanitizeBackendTypes(ts, sourceFile);
|
|
195
|
-
const transformedSourceFile = transformProcedureOutputs(
|
|
196
|
-
|
|
197
|
-
sanitizedSourceFile,
|
|
198
|
-
);
|
|
199
|
-
const prismaJsonDeclaration = createPrismaJsonDeclaration(
|
|
200
|
-
ts,
|
|
201
|
-
prismaJsonSource,
|
|
202
|
-
);
|
|
163
|
+
const transformedSourceFile = transformProcedureOutputs(ts, sanitizedSourceFile);
|
|
164
|
+
const prismaJsonDeclaration = createPrismaJsonDeclaration(ts, prismaJsonSource);
|
|
203
165
|
const statements = transformedSourceFile.statements.filter(
|
|
204
|
-
|
|
166
|
+
statement =>
|
|
205
167
|
ts.isImportDeclaration(statement) ||
|
|
206
168
|
ts.isImportEqualsDeclaration(statement) ||
|
|
207
169
|
(ts.isVariableStatement(statement) &&
|
|
208
170
|
statement.declarationList.declarations.some(
|
|
209
|
-
(declaration)
|
|
210
|
-
ts.isIdentifier(declaration.name) &&
|
|
211
|
-
declaration.name.text === "appRouter",
|
|
171
|
+
declaration => ts.isIdentifier(declaration.name) && declaration.name.text === "appRouter",
|
|
212
172
|
)) ||
|
|
213
|
-
(ts.isTypeAliasDeclaration(statement) &&
|
|
214
|
-
statement.name.text === "AppRouter"),
|
|
173
|
+
(ts.isTypeAliasDeclaration(statement) && statement.name.text === "AppRouter"),
|
|
215
174
|
);
|
|
216
175
|
|
|
217
|
-
if (!statements.some(
|
|
176
|
+
if (!statements.some(statement => ts.isTypeAliasDeclaration(statement))) {
|
|
218
177
|
throw new Error("AppRouter was not found in the emitted declaration.");
|
|
219
178
|
}
|
|
220
179
|
|
|
221
180
|
const printer = ts.createPrinter({ newLine: ts.NewLineKind.LineFeed });
|
|
222
181
|
const appRouterDeclaration = statements
|
|
223
|
-
.map((statement)
|
|
224
|
-
printer.printNode(
|
|
225
|
-
ts.EmitHint.Unspecified,
|
|
226
|
-
statement,
|
|
227
|
-
transformedSourceFile,
|
|
228
|
-
),
|
|
229
|
-
)
|
|
182
|
+
.map(statement => printer.printNode(ts.EmitHint.Unspecified, statement, transformedSourceFile))
|
|
230
183
|
.join("\n")
|
|
231
|
-
.replace(/^(?: {4})+/gm, (indentation)
|
|
232
|
-
"\t".repeat(indentation.length / 4),
|
|
233
|
-
);
|
|
184
|
+
.replace(/^(?: {4})+/gm, indentation => "\t".repeat(indentation.length / 4));
|
|
234
185
|
|
|
235
186
|
await mkdir(path.dirname(outputPath), { recursive: true });
|
|
236
187
|
await writeFile(
|
|
@@ -239,27 +190,19 @@ async function generateTypes() {
|
|
|
239
190
|
);
|
|
240
191
|
|
|
241
192
|
if (existsSync(biomePath)) {
|
|
242
|
-
const biomeResult = spawnSync(
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
cwd: callerRoot,
|
|
247
|
-
stdio: "inherit",
|
|
248
|
-
},
|
|
249
|
-
);
|
|
193
|
+
const biomeResult = spawnSync(biomePath, ["format", "--write", outputPath], {
|
|
194
|
+
cwd: callerRoot,
|
|
195
|
+
stdio: "inherit",
|
|
196
|
+
});
|
|
250
197
|
if (biomeResult.error) {
|
|
251
198
|
throw biomeResult.error;
|
|
252
199
|
}
|
|
253
200
|
if (biomeResult.status !== 0) {
|
|
254
|
-
throw new Error(
|
|
255
|
-
`Biome formatting failed with exit code ${biomeResult.status}.`,
|
|
256
|
-
);
|
|
201
|
+
throw new Error(`Biome formatting failed with exit code ${biomeResult.status}.`);
|
|
257
202
|
}
|
|
258
203
|
}
|
|
259
204
|
|
|
260
|
-
console.log(
|
|
261
|
-
`Generated ${path.relative(callerRoot, outputPath)} from ${routerSourcePath}`,
|
|
262
|
-
);
|
|
205
|
+
console.log(`Generated ${path.relative(callerRoot, outputPath)} from ${routerSourcePath}`);
|
|
263
206
|
}
|
|
264
207
|
|
|
265
208
|
function createPrismaJsonDeclaration(ts, sourceFile) {
|
|
@@ -267,75 +210,49 @@ function createPrismaJsonDeclaration(ts, sourceFile) {
|
|
|
267
210
|
|
|
268
211
|
for (const statement of sourceFile.statements) {
|
|
269
212
|
if (!ts.isImportDeclaration(statement) || !statement.importClause) continue;
|
|
270
|
-
if (
|
|
271
|
-
!ts.isStringLiteral(statement.moduleSpecifier) ||
|
|
272
|
-
!statement.moduleSpecifier.text.startsWith("@/")
|
|
273
|
-
)
|
|
274
|
-
continue;
|
|
213
|
+
if (!ts.isStringLiteral(statement.moduleSpecifier) || !statement.moduleSpecifier.text.startsWith("@/")) continue;
|
|
275
214
|
|
|
276
|
-
if (statement.importClause.name)
|
|
277
|
-
backendTypeNames.add(statement.importClause.name.text);
|
|
215
|
+
if (statement.importClause.name) backendTypeNames.add(statement.importClause.name.text);
|
|
278
216
|
|
|
279
217
|
const bindings = statement.importClause.namedBindings;
|
|
280
218
|
if (bindings && ts.isNamespaceImport(bindings)) {
|
|
281
219
|
backendTypeNames.add(bindings.name.text);
|
|
282
220
|
} else if (bindings) {
|
|
283
|
-
for (const element of bindings.elements)
|
|
284
|
-
backendTypeNames.add(element.name.text);
|
|
221
|
+
for (const element of bindings.elements) backendTypeNames.add(element.name.text);
|
|
285
222
|
}
|
|
286
223
|
}
|
|
287
224
|
|
|
288
|
-
const sanitizedSourceFile = sanitizeBackendTypes(
|
|
289
|
-
ts,
|
|
290
|
-
sourceFile,
|
|
291
|
-
backendTypeNames,
|
|
292
|
-
);
|
|
225
|
+
const sanitizedSourceFile = sanitizeBackendTypes(ts, sourceFile, backendTypeNames);
|
|
293
226
|
const globalDeclarations = sanitizedSourceFile.statements.filter(
|
|
294
|
-
(statement)
|
|
295
|
-
ts.isModuleDeclaration(statement) && statement.name.text === "global",
|
|
227
|
+
statement => ts.isModuleDeclaration(statement) && statement.name.text === "global",
|
|
296
228
|
);
|
|
297
229
|
|
|
298
230
|
if (globalDeclarations.length === 0) {
|
|
299
|
-
throw new Error(
|
|
300
|
-
`PrismaJson global declarations were not found in ${sourceFile.fileName}.`,
|
|
301
|
-
);
|
|
231
|
+
throw new Error(`PrismaJson global declarations were not found in ${sourceFile.fileName}.`);
|
|
302
232
|
}
|
|
303
233
|
|
|
304
234
|
const printer = ts.createPrinter({ newLine: ts.NewLineKind.LineFeed });
|
|
305
235
|
|
|
306
236
|
return globalDeclarations
|
|
307
|
-
.map((statement)
|
|
308
|
-
printer.printNode(
|
|
309
|
-
ts.EmitHint.Unspecified,
|
|
310
|
-
statement,
|
|
311
|
-
sanitizedSourceFile,
|
|
312
|
-
),
|
|
313
|
-
)
|
|
237
|
+
.map(statement => printer.printNode(ts.EmitHint.Unspecified, statement, sanitizedSourceFile))
|
|
314
238
|
.join("\n")
|
|
315
|
-
.replace(/^(?: {4})+/gm, (indentation)
|
|
316
|
-
"\t".repeat(indentation.length / 4),
|
|
317
|
-
);
|
|
239
|
+
.replace(/^(?: {4})+/gm, indentation => "\t".repeat(indentation.length / 4));
|
|
318
240
|
}
|
|
319
241
|
|
|
320
242
|
function transformProcedureOutputs(ts, sourceFile) {
|
|
321
|
-
const procedureTypes = new Set([
|
|
322
|
-
"TRPCMutationProcedure",
|
|
323
|
-
"TRPCQueryProcedure",
|
|
324
|
-
"TRPCSubscriptionProcedure",
|
|
325
|
-
]);
|
|
243
|
+
const procedureTypes = new Set(["TRPCMutationProcedure", "TRPCQueryProcedure", "TRPCSubscriptionProcedure"]);
|
|
326
244
|
const transformation = ts.transform(sourceFile, [
|
|
327
|
-
|
|
328
|
-
const visit =
|
|
245
|
+
context => {
|
|
246
|
+
const visit = node => {
|
|
329
247
|
if (
|
|
330
248
|
ts.isImportTypeNode(node) &&
|
|
331
249
|
ts.isIdentifier(node.qualifier) &&
|
|
332
250
|
procedureTypes.has(node.qualifier.text) &&
|
|
333
251
|
node.typeArguments?.length
|
|
334
252
|
) {
|
|
335
|
-
const [procedureDefinition, ...remainingTypeArguments] =
|
|
336
|
-
node.typeArguments;
|
|
253
|
+
const [procedureDefinition, ...remainingTypeArguments] = node.typeArguments;
|
|
337
254
|
if (ts.isTypeLiteralNode(procedureDefinition)) {
|
|
338
|
-
const members = procedureDefinition.members.map(
|
|
255
|
+
const members = procedureDefinition.members.map(member => {
|
|
339
256
|
if (
|
|
340
257
|
ts.isPropertySignature(member) &&
|
|
341
258
|
member.type &&
|
|
@@ -347,18 +264,13 @@ function transformProcedureOutputs(ts, sourceFile) {
|
|
|
347
264
|
member.modifiers,
|
|
348
265
|
member.name,
|
|
349
266
|
member.questionToken,
|
|
350
|
-
ts.factory.createTypeReferenceNode("FleetProcedureOutput", [
|
|
351
|
-
member.type,
|
|
352
|
-
]),
|
|
267
|
+
ts.factory.createTypeReferenceNode("FleetProcedureOutput", [member.type]),
|
|
353
268
|
);
|
|
354
269
|
}
|
|
355
270
|
|
|
356
271
|
return member;
|
|
357
272
|
});
|
|
358
|
-
const updatedDefinition = ts.factory.updateTypeLiteralNode(
|
|
359
|
-
procedureDefinition,
|
|
360
|
-
members,
|
|
361
|
-
);
|
|
273
|
+
const updatedDefinition = ts.factory.updateTypeLiteralNode(procedureDefinition, members);
|
|
362
274
|
|
|
363
275
|
return ts.factory.updateImportTypeNode(
|
|
364
276
|
node,
|
|
@@ -374,7 +286,7 @@ function transformProcedureOutputs(ts, sourceFile) {
|
|
|
374
286
|
return ts.visitEachChild(node, visit, context);
|
|
375
287
|
};
|
|
376
288
|
|
|
377
|
-
return
|
|
289
|
+
return rootNode => ts.visitNode(rootNode, visit);
|
|
378
290
|
},
|
|
379
291
|
]);
|
|
380
292
|
const transformedSourceFile = transformation.transformed[0];
|
|
@@ -386,12 +298,10 @@ function transformProcedureOutputs(ts, sourceFile) {
|
|
|
386
298
|
|
|
387
299
|
function sanitizeBackendTypes(ts, sourceFile, backendTypeNames = new Set()) {
|
|
388
300
|
const transformation = ts.transform(sourceFile, [
|
|
389
|
-
|
|
390
|
-
const visit =
|
|
301
|
+
context => {
|
|
302
|
+
const visit = node => {
|
|
391
303
|
if (
|
|
392
|
-
(ts.isTypeReferenceNode(node) ||
|
|
393
|
-
ts.isIndexedAccessTypeNode(node) ||
|
|
394
|
-
ts.isTypeQueryNode(node)) &&
|
|
304
|
+
(ts.isTypeReferenceNode(node) || ts.isIndexedAccessTypeNode(node) || ts.isTypeQueryNode(node)) &&
|
|
395
305
|
referencesBackendType(ts, node, backendTypeNames)
|
|
396
306
|
) {
|
|
397
307
|
return ts.factory.createKeywordTypeNode(ts.SyntaxKind.UnknownKeyword);
|
|
@@ -409,7 +319,7 @@ function sanitizeBackendTypes(ts, sourceFile, backendTypeNames = new Set()) {
|
|
|
409
319
|
return ts.visitEachChild(node, visit, context);
|
|
410
320
|
};
|
|
411
321
|
|
|
412
|
-
return
|
|
322
|
+
return rootNode => ts.visitNode(rootNode, visit);
|
|
413
323
|
},
|
|
414
324
|
]);
|
|
415
325
|
const transformedSourceFile = transformation.transformed[0];
|
|
@@ -428,19 +338,14 @@ function referencesBackendType(ts, node, backendTypeNames) {
|
|
|
428
338
|
return ts.isIdentifier(typeName) && backendTypeNames.has(typeName.text);
|
|
429
339
|
}
|
|
430
340
|
|
|
431
|
-
if (ts.isIndexedAccessTypeNode(node))
|
|
432
|
-
return referencesBackendType(ts, node.objectType, backendTypeNames);
|
|
341
|
+
if (ts.isIndexedAccessTypeNode(node)) return referencesBackendType(ts, node.objectType, backendTypeNames);
|
|
433
342
|
|
|
434
343
|
if (ts.isTypeQueryNode(node)) {
|
|
435
344
|
let expressionName = node.exprName;
|
|
436
345
|
|
|
437
|
-
while (ts.isQualifiedName(expressionName))
|
|
438
|
-
expressionName = expressionName.left;
|
|
346
|
+
while (ts.isQualifiedName(expressionName)) expressionName = expressionName.left;
|
|
439
347
|
|
|
440
|
-
return (
|
|
441
|
-
ts.isIdentifier(expressionName) &&
|
|
442
|
-
backendTypeNames.has(expressionName.text)
|
|
443
|
-
);
|
|
348
|
+
return ts.isIdentifier(expressionName) && backendTypeNames.has(expressionName.text);
|
|
444
349
|
}
|
|
445
350
|
|
|
446
351
|
return false;
|
|
@@ -448,7 +353,7 @@ function referencesBackendType(ts, node, backendTypeNames) {
|
|
|
448
353
|
|
|
449
354
|
function formatTypeScriptDiagnostics(ts, diagnostics, currentDirectory) {
|
|
450
355
|
return ts.formatDiagnosticsWithColorAndContext(diagnostics, {
|
|
451
|
-
getCanonicalFileName:
|
|
356
|
+
getCanonicalFileName: fileName => fileName,
|
|
452
357
|
getCurrentDirectory: () => currentDirectory,
|
|
453
358
|
getNewLine: () => "\n",
|
|
454
359
|
});
|
package/biome.json
CHANGED
|
@@ -11,10 +11,7 @@ type ClientFieldRequest = {
|
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
export type ClientFieldRequestInput = ClientFieldBase & ClientFieldRequest;
|
|
14
|
-
export type ClientFieldMetadataInput = Pick<
|
|
15
|
-
ClientFieldBase,
|
|
16
|
-
"fieldType" | "defaultValue"
|
|
17
|
-
> & {
|
|
14
|
+
export type ClientFieldMetadataInput = Pick<ClientFieldBase, "fieldType" | "defaultValue"> & {
|
|
18
15
|
path: string[];
|
|
19
16
|
};
|
|
20
17
|
|
|
@@ -10,12 +10,7 @@ export interface IClientQuotationPositionVersion {
|
|
|
10
10
|
positionVersionId?: string | null;
|
|
11
11
|
|
|
12
12
|
name: string;
|
|
13
|
-
status:
|
|
14
|
-
| "UNVERIFIED"
|
|
15
|
-
| "PENDING_VERIFICATION"
|
|
16
|
-
| "VERIFIED"
|
|
17
|
-
| "REJECTED"
|
|
18
|
-
| "CHANGES_NEEDED";
|
|
13
|
+
status: "UNVERIFIED" | "PENDING_VERIFICATION" | "VERIFIED" | "REJECTED" | "CHANGES_NEEDED";
|
|
19
14
|
reason?: string | null;
|
|
20
15
|
|
|
21
16
|
coversSaturday: boolean;
|
|
@@ -3,14 +3,10 @@ export interface IClientQuotation {
|
|
|
3
3
|
createdAt: string;
|
|
4
4
|
updatedAt: string;
|
|
5
5
|
|
|
6
|
-
status:
|
|
7
|
-
| "DRAFT"
|
|
8
|
-
| "PENDING_APPROVAL"
|
|
9
|
-
| "APPROVED"
|
|
10
|
-
| "REJECTED"
|
|
11
|
-
| "CHANGES_NEEDED";
|
|
6
|
+
status: "DRAFT" | "PENDING_APPROVAL" | "APPROVED" | "REJECTED" | "CHANGES_NEEDED";
|
|
12
7
|
|
|
13
8
|
clientId: string;
|
|
9
|
+
zoneId: string;
|
|
14
10
|
createdById?: string;
|
|
15
11
|
approvedById?: string;
|
|
16
12
|
|
|
@@ -4,13 +4,7 @@ export interface IClientRequestActionExecution {
|
|
|
4
4
|
updatedAt: string;
|
|
5
5
|
|
|
6
6
|
actionId: string;
|
|
7
|
-
status:
|
|
8
|
-
| "PENDING"
|
|
9
|
-
| "COMPLETED"
|
|
10
|
-
| "PROCESSING"
|
|
11
|
-
| "FAILED"
|
|
12
|
-
| "SKIPPED"
|
|
13
|
-
| "ON_HOLD";
|
|
7
|
+
status: "PENDING" | "COMPLETED" | "PROCESSING" | "FAILED" | "SKIPPED" | "ON_HOLD";
|
|
14
8
|
startedAt: string | null;
|
|
15
9
|
endedAt: string | null;
|
|
16
10
|
failureReason?: string;
|
|
@@ -3,13 +3,7 @@ import type { IClientRequestCategoryField } from "./client-request-category-fiel
|
|
|
3
3
|
export interface IClientRequestFieldVisibilityRule {
|
|
4
4
|
id: string;
|
|
5
5
|
action: "SHOW" | "HIDE";
|
|
6
|
-
operator:
|
|
7
|
-
| "EQUALS"
|
|
8
|
-
| "NOT_EQUALS"
|
|
9
|
-
| "CONTAINS"
|
|
10
|
-
| "NOT_CONTAINS"
|
|
11
|
-
| "IS_EMPTY"
|
|
12
|
-
| "IS_NOT_EMPTY";
|
|
6
|
+
operator: "EQUALS" | "NOT_EQUALS" | "CONTAINS" | "NOT_CONTAINS" | "IS_EMPTY" | "IS_NOT_EMPTY";
|
|
13
7
|
sourceFieldId: string;
|
|
14
8
|
targetFieldId: string;
|
|
15
9
|
order: number;
|
|
@@ -15,19 +15,8 @@ export interface IClientRequest {
|
|
|
15
15
|
verifiedById?: string;
|
|
16
16
|
rejectedById?: string;
|
|
17
17
|
|
|
18
|
-
status:
|
|
19
|
-
|
|
20
|
-
| "APPROVED"
|
|
21
|
-
| "REJECTED"
|
|
22
|
-
| "WITHDRAWN"
|
|
23
|
-
| "PENDING_VERIFICATION"
|
|
24
|
-
| "ARCHIVED";
|
|
25
|
-
actionsExecutionStatus:
|
|
26
|
-
| "PENDING"
|
|
27
|
-
| "COMPLETED"
|
|
28
|
-
| "PROCESSING"
|
|
29
|
-
| "FAILED"
|
|
30
|
-
| "SKIPPED";
|
|
18
|
+
status: "PENDING_APPROVAL" | "APPROVED" | "REJECTED" | "WITHDRAWN" | "PENDING_VERIFICATION" | "ARCHIVED";
|
|
19
|
+
actionsExecutionStatus: "PENDING" | "COMPLETED" | "PROCESSING" | "FAILED" | "SKIPPED";
|
|
31
20
|
|
|
32
21
|
metadata?: any;
|
|
33
22
|
}
|
package/dist/types/config.d.ts
CHANGED
|
@@ -5,14 +5,7 @@ export interface IConfig {
|
|
|
5
5
|
name: string;
|
|
6
6
|
value: any;
|
|
7
7
|
type: "DEFAULT" | "TEAM" | "REGION" | "COMPANY";
|
|
8
|
-
valueType:
|
|
9
|
-
| "STRING"
|
|
10
|
-
| "NUMBER"
|
|
11
|
-
| "BOOLEAN"
|
|
12
|
-
| "DATE"
|
|
13
|
-
| "DATETIME"
|
|
14
|
-
| "TIME"
|
|
15
|
-
| "JSON";
|
|
8
|
+
valueType: "STRING" | "NUMBER" | "BOOLEAN" | "DATE" | "DATETIME" | "TIME" | "JSON";
|
|
16
9
|
teamId?: string;
|
|
17
10
|
regionId?: string;
|
|
18
11
|
companyId?: string;
|
package/dist/types/dispatch.d.ts
CHANGED
|
@@ -3,14 +3,7 @@ export interface IDispatch {
|
|
|
3
3
|
createdAt: string;
|
|
4
4
|
updatedAt: string;
|
|
5
5
|
deletedAt: string;
|
|
6
|
-
status:
|
|
7
|
-
| "PENDING"
|
|
8
|
-
| "FLEET_CHECK"
|
|
9
|
-
| "FLEET_CHECK_COMPLETE"
|
|
10
|
-
| "IN_PROGRESS"
|
|
11
|
-
| "COMPLETE"
|
|
12
|
-
| "INTERRUPTED"
|
|
13
|
-
| "NOT_SET";
|
|
6
|
+
status: "PENDING" | "FLEET_CHECK" | "FLEET_CHECK_COMPLETE" | "IN_PROGRESS" | "COMPLETE" | "INTERRUPTED" | "NOT_SET";
|
|
14
7
|
statusUpdatedAt: string;
|
|
15
8
|
date: string;
|
|
16
9
|
verified: boolean;
|
|
@@ -24,21 +24,13 @@ type EmployeeFieldRecruitment = {
|
|
|
24
24
|
recruitmentGroup: EmployeeFieldRecruitmentGroup;
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
export type EmployeeFieldRequestInput = EmployeeFieldBase &
|
|
28
|
-
|
|
29
|
-
export type
|
|
30
|
-
EmployeeFieldRecruitment;
|
|
31
|
-
export type EmployeeFieldMetadataInput = Pick<
|
|
32
|
-
EmployeeFieldBase,
|
|
33
|
-
"fieldType" | "defaultValue"
|
|
34
|
-
> & {
|
|
27
|
+
export type EmployeeFieldRequestInput = EmployeeFieldBase & EmployeeFieldRequest;
|
|
28
|
+
export type EmployeeFieldRecruitmentInput = EmployeeFieldBase & EmployeeFieldRecruitment;
|
|
29
|
+
export type EmployeeFieldMetadataInput = Pick<EmployeeFieldBase, "fieldType" | "defaultValue"> & {
|
|
35
30
|
path: string[];
|
|
36
31
|
};
|
|
37
32
|
|
|
38
|
-
type EmployeeFieldInput =
|
|
39
|
-
| EmployeeFieldRequestInput
|
|
40
|
-
| EmployeeFieldRecruitmentInput
|
|
41
|
-
| EmployeeFieldMetadataInput;
|
|
33
|
+
type EmployeeFieldInput = EmployeeFieldRequestInput | EmployeeFieldRecruitmentInput | EmployeeFieldMetadataInput;
|
|
42
34
|
|
|
43
35
|
export interface IEmployeeField {
|
|
44
36
|
id: string;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
UseInfiniteQueryOptions,
|
|
3
|
-
UseMutationOptions,
|
|
4
|
-
UseQueryOptions,
|
|
5
|
-
} from "@tanstack/react-query";
|
|
1
|
+
import { UseInfiniteQueryOptions, UseMutationOptions, UseQueryOptions } from "@tanstack/react-query";
|
|
6
2
|
import { AxiosError } from "axios";
|
|
7
3
|
|
|
8
4
|
type APIError = {
|
|
@@ -14,34 +10,16 @@ type APIError = {
|
|
|
14
10
|
}>;
|
|
15
11
|
};
|
|
16
12
|
|
|
17
|
-
export type MutationOptions<Response, Args = void> = UseMutationOptions<
|
|
18
|
-
Response,
|
|
19
|
-
AxiosError<APIError>,
|
|
20
|
-
Args,
|
|
21
|
-
any
|
|
22
|
-
>;
|
|
13
|
+
export type MutationOptions<Response, Args = void> = UseMutationOptions<Response, AxiosError<APIError>, Args, any>;
|
|
23
14
|
|
|
24
|
-
export type QueryOptions<Response> = UseQueryOptions<
|
|
25
|
-
Response,
|
|
26
|
-
AxiosError<APIError>,
|
|
27
|
-
Response,
|
|
28
|
-
any
|
|
29
|
-
>;
|
|
15
|
+
export type QueryOptions<Response> = UseQueryOptions<Response, AxiosError<APIError>, Response, any>;
|
|
30
16
|
|
|
31
17
|
export type InfiniteQueryOptions<Response> = Omit<
|
|
32
|
-
UseInfiniteQueryOptions<
|
|
33
|
-
Response,
|
|
34
|
-
AxiosError<APIError>,
|
|
35
|
-
Response,
|
|
36
|
-
Response,
|
|
37
|
-
any
|
|
38
|
-
>,
|
|
18
|
+
UseInfiniteQueryOptions<Response, AxiosError<APIError>, Response, Response, any>,
|
|
39
19
|
"queryKey" | "queryFn"
|
|
40
20
|
>;
|
|
41
21
|
|
|
42
|
-
export type FormInputType<T extends (...args: any) => any> = Parameters<
|
|
43
|
-
ReturnType<T>["mutate"]
|
|
44
|
-
>[0];
|
|
22
|
+
export type FormInputType<T extends (...args: any) => any> = Parameters<ReturnType<T>["mutate"]>[0];
|
|
45
23
|
|
|
46
24
|
export type PaginatedResponse<T> = {
|
|
47
25
|
limit: number;
|
|
@@ -109,7 +87,6 @@ export * from "./client-request-field-visibility-rule";
|
|
|
109
87
|
export * from "./client-request-type";
|
|
110
88
|
export * from "./client-request-value";
|
|
111
89
|
export * from "./client-request-verification";
|
|
112
|
-
export * from "./client-site";
|
|
113
90
|
export * from "./client-status";
|
|
114
91
|
export * from "./client-status-check";
|
|
115
92
|
export * from "./client-status-check-requirement";
|
|
@@ -148,9 +125,6 @@ export * from "./employee-group-snapshot-cost";
|
|
|
148
125
|
export * from "./employee-label";
|
|
149
126
|
export * from "./employee-label-assignment";
|
|
150
127
|
export * from "./employee-monthly-payroll";
|
|
151
|
-
export * from "./employee-monthly-pay-review";
|
|
152
|
-
export * from "./employee-monthly-pay-review-event";
|
|
153
|
-
export * from "./employee-monthly-pay-review-field";
|
|
154
128
|
export * from "./employee-status";
|
|
155
129
|
export * from "./file";
|
|
156
130
|
export * from "./gender";
|
|
@@ -227,11 +201,11 @@ export * from "./schedule-assignment-policy";
|
|
|
227
201
|
export * from "./schedule-attendance";
|
|
228
202
|
export * from "./schedule-day-off";
|
|
229
203
|
export * from "./schedule-draft";
|
|
230
|
-
export * from "./schedule-site";
|
|
231
204
|
export * from "./scheduling-requirement";
|
|
232
205
|
export * from "./shift";
|
|
233
206
|
export * from "./shift-type";
|
|
234
207
|
export * from "./signing-mode";
|
|
208
|
+
export * from "./site";
|
|
235
209
|
export * from "./standard-operating-procedure";
|
|
236
210
|
export * from "./structured-content";
|
|
237
211
|
export * from "./structured-content-collapse-node";
|
|
@@ -314,8 +288,6 @@ export * from "./todo-watcher";
|
|
|
314
288
|
export * from "./unit";
|
|
315
289
|
export * from "./unit-room";
|
|
316
290
|
export * from "./user";
|
|
317
|
-
export * from "./user-attendance";
|
|
318
|
-
export * from "./user-attendance-check-in-location";
|
|
319
291
|
export * from "./vehicle";
|
|
320
292
|
export * from "./vehicle-contract";
|
|
321
293
|
export * from "./vehicle-contract-payment";
|
package/dist/types/metadata.d.ts
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
IMetadataDocuments,
|
|
3
|
-
IMetadataExpiringDocuments,
|
|
4
|
-
IMetadataMissingDocuments,
|
|
5
|
-
IMetadataStatusCheck,
|
|
6
|
-
} from ".";
|
|
1
|
+
import { IMetadataDocuments, IMetadataExpiringDocuments, IMetadataMissingDocuments, IMetadataStatusCheck } from ".";
|
|
7
2
|
|
|
8
3
|
export interface IMetadata {
|
|
9
4
|
expiringDocuments?: {
|