@automateinc/fleet-types 1.0.102 → 1.0.103

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.
@@ -54,7 +54,9 @@ async function generateTypes() {
54
54
  const prismaTypesPath = path.join(apiRoot, "prisma/types.d.ts");
55
55
  const executableExtension = process.platform === "win32" ? ".cmd" : "";
56
56
  const apiTscPath = path.join(apiRoot, `node_modules/.bin/tsc${executableExtension}`);
57
- const biomePath = path.join(packageRoot, `node_modules/.bin/biome${executableExtension}`);
57
+ const callerBiomePath = path.join(callerRoot, `node_modules/.bin/biome${executableExtension}`);
58
+ const packageBiomePath = path.join(packageRoot, `node_modules/.bin/biome${executableExtension}`);
59
+ const biomePath = existsSync(callerBiomePath) ? callerBiomePath : packageBiomePath;
58
60
  const temporaryDirectory = await mkdtemp(path.join(tmpdir(), "fleet-trpc-types-"));
59
61
  const declarationOutputDirectory = path.join(temporaryDirectory, "declarations");
60
62
  const declarationTsconfigPath = path.join(temporaryDirectory, "tsconfig.json");
@@ -92,7 +94,52 @@ async function generateTypes() {
92
94
  );
93
95
  await writeFile(
94
96
  serviceProviderShimPath,
95
- "export declare class ServiceProvider { static getAuthenticationService(): { login(email: string, password: string, tokenExpiry?: string): Promise<string> }; static getEncryptionService(): { decodeId(encodedId: string, prefix: string): number }; }\n",
97
+ `interface Permission {
98
+ name: string;
99
+ }
100
+
101
+ interface AuthenticatedUser {
102
+ id: number;
103
+ dailyHours: number | null;
104
+ permissionGroups: { permissions: Permission[] }[];
105
+ permissions: Permission[];
106
+ team: { folderKey: string | null; id: number } | null;
107
+ }
108
+
109
+ interface DecodedToken {
110
+ permissions: string[];
111
+ type: "USER" | "EMPLOYEE";
112
+ user: { id: string; role: string };
113
+ }
114
+
115
+ interface CacheOptions {
116
+ tags?: string[];
117
+ ttl?: number;
118
+ }
119
+
120
+ export declare class ServiceProvider {
121
+ static getAuthenticationService(): {
122
+ decodeToken(token: string): DecodedToken;
123
+ login(email: string, password: string, tokenExpiry?: string): Promise<string>;
124
+ };
125
+ static getCachingService(): {
126
+ fnc<T>(key: string, fn: Promise<T> | (() => Promise<T>), options?: CacheOptions): Promise<T>;
127
+ };
128
+ static getDatabaseService(): {
129
+ getPrisma(): {
130
+ user: {
131
+ findFirst(args: unknown): Promise<AuthenticatedUser | null>;
132
+ };
133
+ userAttendance: {
134
+ findFirst(args: unknown): Promise<{ id: number } | null>;
135
+ };
136
+ };
137
+ };
138
+ static getEncryptionService(): {
139
+ decodeId(encodedId: string, prefix: string): number;
140
+ };
141
+ }
142
+ `,
96
143
  );
97
144
  await writeFile(
98
145
  declarationTsconfigPath,
@@ -0,0 +1,54 @@
1
+ // Generated by `npx @automateinc/fleet-types generate`. Do not edit manually.
2
+ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<
3
+ {
4
+ ctx: {
5
+ client: "FLEET_MOBILE" | "FLEET_MOBILE_USER" | "FLEET_WEB" | undefined;
6
+ regionId: string | undefined;
7
+ request: import("express").Request<
8
+ import("express-serve-static-core").ParamsDictionary,
9
+ any,
10
+ any,
11
+ import("qs").ParsedQs,
12
+ Record<string, any>
13
+ >;
14
+ token: string | undefined;
15
+ };
16
+ meta: object;
17
+ errorShape: import("@trpc/server").TRPCDefaultErrorShape;
18
+ transformer: false;
19
+ },
20
+ import("@trpc/server").TRPCDecorateCreateRouterOptions<{
21
+ auth: import("@trpc/server").TRPCBuiltRouter<
22
+ {
23
+ ctx: {
24
+ client: "FLEET_MOBILE" | "FLEET_MOBILE_USER" | "FLEET_WEB" | undefined;
25
+ regionId: string | undefined;
26
+ request: import("express").Request<
27
+ import("express-serve-static-core").ParamsDictionary,
28
+ any,
29
+ any,
30
+ import("qs").ParsedQs,
31
+ Record<string, any>
32
+ >;
33
+ token: string | undefined;
34
+ };
35
+ meta: object;
36
+ errorShape: import("@trpc/server").TRPCDefaultErrorShape;
37
+ transformer: false;
38
+ },
39
+ import("@trpc/server").TRPCDecorateCreateRouterOptions<{
40
+ login: import("@trpc/server").TRPCMutationProcedure<{
41
+ input: {
42
+ email: string;
43
+ password: string;
44
+ };
45
+ output: {
46
+ token: string;
47
+ };
48
+ meta: object;
49
+ }>;
50
+ }>
51
+ >;
52
+ }>
53
+ >;
54
+ export type AppRouter = typeof appRouter;
package/package.json CHANGED
@@ -57,5 +57,5 @@
57
57
  "test": "echo \"Error: no test specified\" && exit 1"
58
58
  },
59
59
  "types": "dist/types/index.d.ts",
60
- "version": "1.0.102"
60
+ "version": "1.0.103"
61
61
  }