@budgetbuddyde/types 1.0.32 → 1.0.34

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.
@@ -7,6 +7,7 @@ export type TApiResponse<T> = {
7
7
  status: number | HTTPStatusCode;
8
8
  message: string | null;
9
9
  data: T | null;
10
+ from: 'db' | 'cache';
10
11
  };
11
12
  /**
12
13
  * Represents an API response.
@@ -26,6 +27,7 @@ export declare class ApiResponse<T> {
26
27
  status: number | HTTPStatusCode;
27
28
  message: string | null;
28
29
  data: T | null;
30
+ from: 'db' | 'cache';
29
31
  private constructor();
30
32
  /**
31
33
  * Creates a new instance of ApiResponseBuilder.
@@ -57,6 +59,12 @@ export declare class ApiResponseBuilder<T> {
57
59
  * @returns The ApiResponseBuilder instance.
58
60
  */
59
61
  withData(data: T | null): ApiResponseBuilder<T>;
62
+ /**
63
+ * Sets the source of the response data.
64
+ * @param from The source of the response data. Must be either "db" or "cache".
65
+ * @returns The ApiResponseBuilder instance.
66
+ */
67
+ withFrom(from: 'db' | 'cache'): ApiResponseBuilder<T>;
60
68
  /**
61
69
  * Builds the API response.
62
70
  * @returns The built ApiResponse instance.
@@ -20,6 +20,7 @@ class ApiResponse {
20
20
  this.status = 200;
21
21
  this.message = null;
22
22
  this.data = null;
23
+ this.from = 'db';
23
24
  }
24
25
  /**
25
26
  * Creates a new instance of ApiResponseBuilder.
@@ -66,6 +67,15 @@ class ApiResponseBuilder {
66
67
  this.response.data = data;
67
68
  return this;
68
69
  }
70
+ /**
71
+ * Sets the source of the response data.
72
+ * @param from The source of the response data. Must be either "db" or "cache".
73
+ * @returns The ApiResponseBuilder instance.
74
+ */
75
+ withFrom(from) {
76
+ this.response.from = from;
77
+ return this;
78
+ }
69
79
  /**
70
80
  * Builds the API response.
71
81
  * @returns The built ApiResponse instance.
@@ -0,0 +1,27 @@
1
+ import { z } from 'zod';
2
+ export declare const ZNewsletter: z.ZodObject<{
3
+ id: z.ZodString;
4
+ enabled: z.ZodBoolean;
5
+ newsletter: z.ZodString;
6
+ name: z.ZodString;
7
+ description: z.ZodDefault<z.ZodNullable<z.ZodString>>;
8
+ created: z.ZodEffects<z.ZodUnion<[z.ZodUnion<[z.ZodDate, z.ZodNumber]>, z.ZodString]>, Date, string | number | Date>;
9
+ updated: z.ZodEffects<z.ZodUnion<[z.ZodUnion<[z.ZodDate, z.ZodNumber]>, z.ZodString]>, Date, string | number | Date>;
10
+ }, "strip", z.ZodTypeAny, {
11
+ id: string;
12
+ name: string;
13
+ description: string | null;
14
+ created: Date;
15
+ updated: Date;
16
+ enabled: boolean;
17
+ newsletter: string;
18
+ }, {
19
+ id: string;
20
+ name: string;
21
+ created: (string | number | Date) & (string | number | Date | undefined);
22
+ updated: (string | number | Date) & (string | number | Date | undefined);
23
+ enabled: boolean;
24
+ newsletter: string;
25
+ description?: string | null | undefined;
26
+ }>;
27
+ export type TNewsletter = z.infer<typeof ZNewsletter>;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ZNewsletter = void 0;
4
+ const zod_1 = require("zod");
5
+ const PocketBase_types_1 = require("./PocketBase.types");
6
+ const Base_type_1 = require("./Base.type");
7
+ exports.ZNewsletter = zod_1.z.object({
8
+ id: PocketBase_types_1.ZId,
9
+ enabled: zod_1.z.boolean(),
10
+ newsletter: zod_1.z.string(),
11
+ name: zod_1.z.string(),
12
+ description: zod_1.z.string().nullable().default(null),
13
+ created: Base_type_1.ZDate,
14
+ updated: Base_type_1.ZDate,
15
+ });
@@ -3294,6 +3294,7 @@ export declare const ZAssetWatchlistWithQuote: z.ZodObject<{
3294
3294
  name: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
3295
3295
  surname: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
3296
3296
  verified: z.ZodBoolean;
3297
+ newsletter: z.ZodArray<z.ZodString, "many">;
3297
3298
  collectionId: z.ZodString;
3298
3299
  collectionName: z.ZodString;
3299
3300
  id: z.ZodString;
@@ -3307,6 +3308,7 @@ export declare const ZAssetWatchlistWithQuote: z.ZodObject<{
3307
3308
  collectionName: string;
3308
3309
  created: Date;
3309
3310
  updated: Date;
3311
+ newsletter: string[];
3310
3312
  avatar: string | null;
3311
3313
  emailVisibility: boolean;
3312
3314
  username: string;
@@ -3319,6 +3321,7 @@ export declare const ZAssetWatchlistWithQuote: z.ZodObject<{
3319
3321
  collectionName: string;
3320
3322
  created: (string | number | Date) & (string | number | Date | undefined);
3321
3323
  updated: (string | number | Date) & (string | number | Date | undefined);
3324
+ newsletter: string[];
3322
3325
  emailVisibility: boolean;
3323
3326
  username: string;
3324
3327
  verified: boolean;
@@ -3363,6 +3366,7 @@ export declare const ZAssetWatchlistWithQuote: z.ZodObject<{
3363
3366
  collectionName: string;
3364
3367
  created: Date;
3365
3368
  updated: Date;
3369
+ newsletter: string[];
3366
3370
  avatar: string | null;
3367
3371
  emailVisibility: boolean;
3368
3372
  username: string;
@@ -3387,6 +3391,7 @@ export declare const ZAssetWatchlistWithQuote: z.ZodObject<{
3387
3391
  collectionName: string;
3388
3392
  created: (string | number | Date) & (string | number | Date | undefined);
3389
3393
  updated: (string | number | Date) & (string | number | Date | undefined);
3394
+ newsletter: string[];
3390
3395
  emailVisibility: boolean;
3391
3396
  username: string;
3392
3397
  verified: boolean;
@@ -3452,6 +3457,7 @@ export declare const ZAssetWatchlistWithQuote: z.ZodObject<{
3452
3457
  collectionName: string;
3453
3458
  created: Date;
3454
3459
  updated: Date;
3460
+ newsletter: string[];
3455
3461
  avatar: string | null;
3456
3462
  emailVisibility: boolean;
3457
3463
  username: string;
@@ -3498,6 +3504,7 @@ export declare const ZAssetWatchlistWithQuote: z.ZodObject<{
3498
3504
  collectionName: string;
3499
3505
  created: (string | number | Date) & (string | number | Date | undefined);
3500
3506
  updated: (string | number | Date) & (string | number | Date | undefined);
3507
+ newsletter: string[];
3501
3508
  emailVisibility: boolean;
3502
3509
  username: string;
3503
3510
  verified: boolean;
@@ -7,6 +7,7 @@ export declare const ZUser: z.ZodNullable<z.ZodObject<{
7
7
  name: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
8
8
  surname: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
9
9
  verified: z.ZodBoolean;
10
+ newsletter: z.ZodArray<z.ZodString, "many">;
10
11
  collectionId: z.ZodString;
11
12
  collectionName: z.ZodString;
12
13
  id: z.ZodString;
@@ -20,6 +21,7 @@ export declare const ZUser: z.ZodNullable<z.ZodObject<{
20
21
  collectionName: string;
21
22
  created: Date;
22
23
  updated: Date;
24
+ newsletter: string[];
23
25
  avatar: string | null;
24
26
  emailVisibility: boolean;
25
27
  username: string;
@@ -32,6 +34,7 @@ export declare const ZUser: z.ZodNullable<z.ZodObject<{
32
34
  collectionName: string;
33
35
  created: (string | number | Date) & (string | number | Date | undefined);
34
36
  updated: (string | number | Date) & (string | number | Date | undefined);
37
+ newsletter: string[];
35
38
  emailVisibility: boolean;
36
39
  username: string;
37
40
  verified: boolean;
package/lib/User.types.js CHANGED
@@ -14,6 +14,7 @@ exports.ZUser = zod_1.z
14
14
  name: PocketBase_types_1.ZNullableString,
15
15
  surname: PocketBase_types_1.ZNullableString,
16
16
  verified: zod_1.z.boolean(),
17
+ newsletter: zod_1.z.array(PocketBase_types_1.ZId),
17
18
  }).shape,
18
19
  })
19
20
  .nullable();
package/lib/index.d.ts CHANGED
@@ -11,3 +11,4 @@ export * from './Budget.types';
11
11
  export * from './DailyBalance.types';
12
12
  export * from './MonthlyBalance.types';
13
13
  export * from './Stocks';
14
+ export * from './Newsletter.types';
package/lib/index.js CHANGED
@@ -27,3 +27,4 @@ __exportStar(require("./Budget.types"), exports);
27
27
  __exportStar(require("./DailyBalance.types"), exports);
28
28
  __exportStar(require("./MonthlyBalance.types"), exports);
29
29
  __exportStar(require("./Stocks"), exports);
30
+ __exportStar(require("./Newsletter.types"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@budgetbuddyde/types",
3
- "version": "1.0.32",
3
+ "version": "1.0.34",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "description": "Budget Buddy Typescript Types",