@arkyn/types 1.5.1 → 1.5.3

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/dist/index.d.ts CHANGED
@@ -45,8 +45,12 @@ export * from "./components/TooltipProps";
45
45
  export * from "./hooks/Drawer";
46
46
  export * from "./hooks/Modal";
47
47
  export * from "./hooks/Toast";
48
- export * from "./server/formParseProps";
49
48
  export * from "./server/httpResponse";
49
+ export * from "./server/api/ApiResponseDTO";
50
+ export * from "./server/services/decodeRequestBody";
51
+ export * from "./server/services/formParse";
52
+ export * from "./server/services/getScopedParams";
53
+ export * from "./server/services/sendFileToS3";
50
54
  export * from "./shared/formats/formatDate";
51
55
  export * from "./shared/formats/formatJsonObject";
52
56
  export * from "./shared/formats/formatJsonString";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAG7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kCAAkC,CAAC;AACjD,cAAc,sCA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B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAG1C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAI9B,cAAc,uBAAuB,CAAC;AAEtC,cAAc,6BAA6B,CAAC;AAE5C,cAAc,qCAAqC,CAAC;AACpD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mCAAmC,CAAC;AAClD,cAAc,gCAAgC,CAAC;AAG/C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mCAAmC,CAAC;AAClD,cAAc,mCAAmC,CAAC;AAClD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC;AACjD,cAAc,mCAAmC,CAAC;AAClD,cAAc,mCAAmC,CAAC;AAClD,cAAc,uCAAuC,CAAC;AACtD,cAAc,gCAAgC,CAAC;AAE/C,cAAc,2CAA2C,CAAC;AAE1D,cAAc,4CAA4C,CAAC;AAC3D,cAAc,qCAAqC,CAAC;AACpD,cAAc,yCAAyC,CAAC;AACxD,cAAc,uCAAuC,CAAC;AAEtD,cAAc,kCAAkC,CAAC;AACjD,cAAc,mCAAmC,CAAC;AAClD,cAAc,kCAAkC,CAAC;AACjD,cAAc,mCAAmC,CAAC;AAClD,cAAc,oCAAoC,CAAC;AACnD,cAAc,iCAAiC,CAAC;AAChD,cAAc,uCAAuC,CAAC"}
package/dist/index.js CHANGED
@@ -48,9 +48,13 @@ export * from "./components/TooltipProps";
48
48
  export * from "./hooks/Drawer";
49
49
  export * from "./hooks/Modal";
50
50
  export * from "./hooks/Toast";
51
- // Server
52
- export * from "./server/formParseProps";
51
+ // server
53
52
  export * from "./server/httpResponse";
53
+ export * from "./server/api/ApiResponseDTO";
54
+ export * from "./server/services/decodeRequestBody";
55
+ export * from "./server/services/formParse";
56
+ export * from "./server/services/getScopedParams";
57
+ export * from "./server/services/sendFileToS3";
54
58
  // shared
55
59
  export * from "./shared/formats/formatDate";
56
60
  export * from "./shared/formats/formatJsonObject";
@@ -0,0 +1,17 @@
1
+ type ApiSuccessResponse<T = any> = {
2
+ success: true;
3
+ status: number;
4
+ message: string;
5
+ response: T;
6
+ cause: null;
7
+ };
8
+ type ApiFailedResponse = {
9
+ success: false;
10
+ status: number;
11
+ message: string;
12
+ response: any;
13
+ cause: string | Error | null;
14
+ };
15
+ type ApiResponseDTO<T = any> = ApiSuccessResponse<T> | ApiFailedResponse;
16
+ export type { ApiResponseDTO };
17
+ //# sourceMappingURL=ApiResponseDTO.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ApiResponseDTO.d.ts","sourceRoot":"","sources":["../../../src/server/api/ApiResponseDTO.ts"],"names":[],"mappings":"AAAA,KAAK,kBAAkB,CAAC,CAAC,GAAG,GAAG,IAAI;IACjC,OAAO,EAAE,IAAI,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,CAAC,CAAC;IACZ,KAAK,EAAE,IAAI,CAAC;CACb,CAAC;AAEF,KAAK,iBAAiB,GAAG;IACvB,OAAO,EAAE,KAAK,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,GAAG,CAAC;IACd,KAAK,EAAE,MAAM,GAAG,KAAK,GAAG,IAAI,CAAC;CAC9B,CAAC;AAEF,KAAK,cAAc,CAAC,CAAC,GAAG,GAAG,IAAI,kBAAkB,CAAC,CAAC,CAAC,GAAG,iBAAiB,CAAC;AAEzE,YAAY,EAAE,cAAc,EAAE,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ type DecodeRequestBodyFunction = (request: Request) => Promise<any>;
2
+ export type { DecodeRequestBodyFunction };
3
+ //# sourceMappingURL=decodeRequestBody.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decodeRequestBody.d.ts","sourceRoot":"","sources":["../../../src/server/services/decodeRequestBody.ts"],"names":[],"mappings":"AAAA,KAAK,yBAAyB,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;AAEpE,YAAY,EAAE,yBAAyB,EAAE,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,20 @@
1
+ import { Schema } from "zod";
2
+ type SuccessResponse<T extends FormParseProps> = {
3
+ success: true;
4
+ data: T[1] extends Schema<infer U> ? U : never;
5
+ };
6
+ type ErrorResponse = {
7
+ success: false;
8
+ fields: {
9
+ [x: string]: string;
10
+ };
11
+ fieldErrors: {
12
+ [x: string]: string;
13
+ };
14
+ };
15
+ type FormParseProps = [formData: {
16
+ [k: string]: any;
17
+ }, schema: Schema];
18
+ type FormParseReturnType<T extends FormParseProps> = SuccessResponse<T> | ErrorResponse;
19
+ export type { FormParseProps, FormParseReturnType };
20
+ //# sourceMappingURL=formParse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formParse.d.ts","sourceRoot":"","sources":["../../../src/server/services/formParse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAE7B,KAAK,eAAe,CAAC,CAAC,SAAS,cAAc,IAAI;IAC/C,OAAO,EAAE,IAAI,CAAC;IACd,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;CAChD,CAAC;AAEF,KAAK,aAAa,GAAG;IACnB,OAAO,EAAE,KAAK,CAAC;IACf,MAAM,EAAE;QAAE,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAChC,WAAW,EAAE;QAAE,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;CACtC,CAAC;AAEF,KAAK,cAAc,GAAG,CAAC,QAAQ,EAAE;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAEvE,KAAK,mBAAmB,CAAC,CAAC,SAAS,cAAc,IAC7C,eAAe,CAAC,CAAC,CAAC,GAClB,aAAa,CAAC;AAElB,YAAY,EAAE,cAAc,EAAE,mBAAmB,EAAE,CAAC"}
@@ -0,0 +1 @@
1
+ import { Schema } from "zod";
@@ -0,0 +1,3 @@
1
+ type GetScopedParamsFunction = (request: Request, scope?: string) => URLSearchParams;
2
+ export type { GetScopedParamsFunction };
3
+ //# sourceMappingURL=getScopedParams.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getScopedParams.d.ts","sourceRoot":"","sources":["../../../src/server/services/getScopedParams.ts"],"names":[],"mappings":"AAAA,KAAK,uBAAuB,GAAG,CAC7B,OAAO,EAAE,OAAO,EAChB,KAAK,CAAC,EAAE,MAAM,KACX,eAAe,CAAC;AAErB,YAAY,EAAE,uBAAuB,EAAE,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,19 @@
1
+ type AwsConfig = {
2
+ AWS_REGION: string;
3
+ AWS_ACCESS_KEY_ID: string;
4
+ AWS_SECRET_ACCESS_KEY: string;
5
+ AWS_S3_BUCKET: string;
6
+ };
7
+ type Config = {
8
+ maxPartSize?: number;
9
+ fileName?: string;
10
+ reduceImageQuality?: number;
11
+ validateImageSize?: boolean;
12
+ validateImageMessage?: string;
13
+ };
14
+ type SendFileToS3Function = (request: Request, awsConfig: AwsConfig, config?: Config) => Promise<{
15
+ url?: string;
16
+ error?: string;
17
+ }>;
18
+ export type { AwsConfig, SendFileToS3Function };
19
+ //# sourceMappingURL=sendFileToS3.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sendFileToS3.d.ts","sourceRoot":"","sources":["../../../src/server/services/sendFileToS3.ts"],"names":[],"mappings":"AAAA,KAAK,SAAS,GAAG;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,KAAK,MAAM,GAAG;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC;AAEF,KAAK,oBAAoB,GAAG,CAC1B,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,EACpB,MAAM,CAAC,EAAE,MAAM,KACZ,OAAO,CAAC;IACX,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC,CAAC;AAEH,YAAY,EAAE,SAAS,EAAE,oBAAoB,EAAE,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkyn/types",
3
- "version": "1.5.1",
3
+ "version": "1.5.3",
4
4
  "main": "./dist/bundle.js",
5
5
  "module": "./src/index.ts",
6
6
  "type": "module",
package/src/index.ts CHANGED
@@ -51,10 +51,17 @@ export * from "./hooks/Drawer";
51
51
  export * from "./hooks/Modal";
52
52
  export * from "./hooks/Toast";
53
53
 
54
- // Server
55
- export * from "./server/formParseProps";
54
+ // server
55
+
56
56
  export * from "./server/httpResponse";
57
57
 
58
+ export * from "./server/api/ApiResponseDTO";
59
+
60
+ export * from "./server/services/decodeRequestBody";
61
+ export * from "./server/services/formParse";
62
+ export * from "./server/services/getScopedParams";
63
+ export * from "./server/services/sendFileToS3";
64
+
58
65
  // shared
59
66
  export * from "./shared/formats/formatDate";
60
67
  export * from "./shared/formats/formatJsonObject";
@@ -0,0 +1,19 @@
1
+ type ApiSuccessResponse<T = any> = {
2
+ success: true;
3
+ status: number;
4
+ message: string;
5
+ response: T;
6
+ cause: null;
7
+ };
8
+
9
+ type ApiFailedResponse = {
10
+ success: false;
11
+ status: number;
12
+ message: string;
13
+ response: any;
14
+ cause: string | Error | null;
15
+ };
16
+
17
+ type ApiResponseDTO<T = any> = ApiSuccessResponse<T> | ApiFailedResponse;
18
+
19
+ export type { ApiResponseDTO };
@@ -0,0 +1,3 @@
1
+ type DecodeRequestBodyFunction = (request: Request) => Promise<any>;
2
+
3
+ export type { DecodeRequestBodyFunction };
@@ -0,0 +1,20 @@
1
+ import { Schema } from "zod";
2
+
3
+ type SuccessResponse<T extends FormParseProps> = {
4
+ success: true;
5
+ data: T[1] extends Schema<infer U> ? U : never;
6
+ };
7
+
8
+ type ErrorResponse = {
9
+ success: false;
10
+ fields: { [x: string]: string };
11
+ fieldErrors: { [x: string]: string };
12
+ };
13
+
14
+ type FormParseProps = [formData: { [k: string]: any }, schema: Schema];
15
+
16
+ type FormParseReturnType<T extends FormParseProps> =
17
+ | SuccessResponse<T>
18
+ | ErrorResponse;
19
+
20
+ export type { FormParseProps, FormParseReturnType };
@@ -0,0 +1,6 @@
1
+ type GetScopedParamsFunction = (
2
+ request: Request,
3
+ scope?: string
4
+ ) => URLSearchParams;
5
+
6
+ export type { GetScopedParamsFunction };
@@ -0,0 +1,25 @@
1
+ type AwsConfig = {
2
+ AWS_REGION: string;
3
+ AWS_ACCESS_KEY_ID: string;
4
+ AWS_SECRET_ACCESS_KEY: string;
5
+ AWS_S3_BUCKET: string;
6
+ };
7
+
8
+ type Config = {
9
+ maxPartSize?: number;
10
+ fileName?: string;
11
+ reduceImageQuality?: number;
12
+ validateImageSize?: boolean;
13
+ validateImageMessage?: string;
14
+ };
15
+
16
+ type SendFileToS3Function = (
17
+ request: Request,
18
+ awsConfig: AwsConfig,
19
+ config?: Config
20
+ ) => Promise<{
21
+ url?: string;
22
+ error?: string;
23
+ }>;
24
+
25
+ export type { AwsConfig, SendFileToS3Function };