@temboplus/tembo-dashboard 0.0.1
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/README.md +130 -0
- package/dist/index.cjs.js +2 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.esm.js +2 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/lib/api/base-repository.d.ts +168 -0
- package/dist/lib/api/common-schemas.d.ts +115 -0
- package/dist/lib/api/index.d.ts +2 -0
- package/dist/lib/error/error.api.d.ts +62 -0
- package/dist/lib/error/index.d.ts +1 -0
- package/dist/lib/models/index.d.ts +2 -0
- package/dist/lib/models/transaction-summary.model.d.ts +22 -0
- package/dist/lib/models/wallet-info.model.d.ts +17 -0
- package/dist/lib/query/index.d.ts +2 -0
- package/dist/lib/query/query.builder.d.ts +65 -0
- package/dist/lib/query/query.types.d.ts +36 -0
- package/dist/modules/auth/auth.api-contract.d.ts +52 -0
- package/dist/modules/auth/auth.dtos.d.ts +31 -0
- package/dist/modules/auth/auth.repository.d.ts +17 -0
- package/dist/modules/auth/index.d.ts +4 -0
- package/dist/modules/auth/user.model.d.ts +48 -0
- package/dist/modules/collection/collection.api-contract.d.ts +385 -0
- package/dist/modules/collection/collection.dtos.d.ts +195 -0
- package/dist/modules/collection/collection.model.d.ts +145 -0
- package/dist/modules/collection/collection.query-builder.d.ts +18 -0
- package/dist/modules/collection/collection.repository.d.ts +38 -0
- package/dist/modules/collection/index.d.ts +5 -0
- package/dist/modules/payout/index.d.ts +5 -0
- package/dist/modules/payout/payout.api-contract.d.ts +427 -0
- package/dist/modules/payout/payout.dtos.d.ts +188 -0
- package/dist/modules/payout/payout.model.d.ts +156 -0
- package/dist/modules/payout/payout.query-builder.d.ts +15 -0
- package/dist/modules/payout/payout.repository.d.ts +34 -0
- package/package.json +60 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../src/lib/error/error.api.ts","../src/lib/query/query.types.ts","../src/lib/query/query.builder.ts","../node_modules/@ts-rest/core/index.esm.mjs","../src/lib/api/base-repository.ts","../src/lib/api/common-schemas.ts","../src/modules/auth/auth.dtos.ts","../src/modules/auth/auth.api-contract.ts","../src/modules/auth/user.model.ts","../src/modules/auth/auth.repository.ts","../src/modules/collection/collection.dtos.ts","../src/modules/collection/collection.api-contract.ts","../src/modules/collection/collection.model.ts","../src/modules/collection/collection.query-builder.ts","../src/modules/collection/collection.repository.ts","../src/modules/payout/payout.dtos.ts","../src/modules/payout/payout.api-contract.ts","../src/modules/payout/payout.model.ts","../src/modules/payout/payout.query-builder.ts","../src/lib/models/transaction-summary.model.ts","../src/lib/models/wallet-info.model.ts","../src/modules/payout/payout.repository.ts"],"sourcesContent":[null,null,null,"import { z } from 'zod';\n\nconst isZodType = (obj) => {\n return typeof (obj === null || obj === void 0 ? void 0 : obj.safeParse) === 'function';\n};\nconst isZodObject = (obj) => {\n if (typeof (obj === null || obj === void 0 ? void 0 : obj.passthrough) === 'function') {\n return true;\n }\n if (typeof (obj === null || obj === void 0 ? void 0 : obj.innerType) === 'function') {\n return isZodObject(obj === null || obj === void 0 ? void 0 : obj.innerType());\n }\n return false;\n};\nconst isZodObjectStrict = (obj) => {\n return typeof (obj === null || obj === void 0 ? void 0 : obj.passthrough) === 'function';\n};\nconst extractZodObjectShape = (obj) => {\n if (!isZodObject(obj)) {\n throw new Error('Unknown zod object type');\n }\n if ('innerType' in obj) {\n return extractZodObjectShape(obj.innerType());\n }\n return obj.shape;\n};\nconst zodMerge = (objectA, objectB) => {\n if (isZodObjectStrict(objectA)) {\n if (isZodObjectStrict(objectB)) {\n return objectA.merge(objectB);\n }\n return objectA;\n }\n if (isZodObjectStrict(objectB)) {\n return objectB;\n }\n return Object.assign({}, objectA, objectB);\n};\nconst checkZodSchema = (data, schema, { passThroughExtraKeys = false } = {}) => {\n if (isZodType(schema)) {\n const result = schema.safeParse(data);\n if (result.success) {\n return {\n success: true,\n data: passThroughExtraKeys && typeof data === 'object'\n ? { ...data, ...result.data }\n : result.data,\n };\n }\n return {\n success: false,\n error: result.error,\n };\n }\n return {\n success: true,\n data: data,\n };\n};\n// Convert a ZodError to a plain object because ZodError extends Error and causes problems with NestJS\nconst zodErrorResponse = (error) => {\n return {\n name: error.name,\n issues: error.issues,\n };\n};\nconst ZodErrorSchema = z.object({\n name: z.literal('ZodError'),\n issues: z.array(z\n .object({\n path: z.array(z.union([z.string(), z.number()])),\n message: z.string().optional(),\n code: z.nativeEnum(z.ZodIssueCode),\n })\n // ZodIssuse type are complex and potentially unstable. So we don’t deal with his specific fields other than the common.\n .catchall(z.any())),\n});\n\nconst ContractNoBody = Symbol('ContractNoBody');\n/**\n * Differentiate between a route and a router\n *\n * @param obj\n * @returns\n */\nconst isAppRoute = (obj) => {\n return 'method' in obj && 'path' in obj;\n};\nconst isAppRouteQuery = (route) => {\n return route.method === 'GET';\n};\nconst isAppRouteMutation = (route) => {\n return !isAppRouteQuery(route);\n};\n/**\n *\n * @deprecated Please use {@link initContract} instead.\n */\nconst initTsRest = () => initContract();\nconst recursivelyApplyOptions = (router, options) => {\n return Object.fromEntries(Object.entries(router).map(([key, value]) => {\n var _a, _b, _c;\n if (isAppRoute(value)) {\n return [\n key,\n {\n ...value,\n path: (options === null || options === void 0 ? void 0 : options.pathPrefix)\n ? options.pathPrefix + value.path\n : value.path,\n headers: zodMerge(options === null || options === void 0 ? void 0 : options.baseHeaders, value.headers),\n strictStatusCodes: (_a = value.strictStatusCodes) !== null && _a !== void 0 ? _a : options === null || options === void 0 ? void 0 : options.strictStatusCodes,\n validateResponseOnClient: (_b = value.validateResponseOnClient) !== null && _b !== void 0 ? _b : options === null || options === void 0 ? void 0 : options.validateResponseOnClient,\n responses: {\n ...options === null || options === void 0 ? void 0 : options.commonResponses,\n ...value.responses,\n },\n metadata: (options === null || options === void 0 ? void 0 : options.metadata)\n ? {\n ...options === null || options === void 0 ? void 0 : options.metadata,\n ...((_c = value.metadata) !== null && _c !== void 0 ? _c : {}),\n }\n : value.metadata,\n },\n ];\n }\n else {\n return [key, recursivelyApplyOptions(value, options)];\n }\n }));\n};\nconst ContractPlainTypeRuntimeSymbol = Symbol('ContractPlainType');\n/**\n * Instantiate a ts-rest client, primarily to access `router`, `response`, and `body`\n *\n * @returns {ContractInstance}\n */\nconst initContract = () => {\n return {\n // @ts-expect-error - this is a type error, but it's not clear how to fix it\n router: (endpoints, options) => recursivelyApplyOptions(endpoints, options),\n query: (args) => args,\n mutation: (args) => args,\n responses: (args) => args,\n response: () => ContractPlainTypeRuntimeSymbol,\n body: () => ContractPlainTypeRuntimeSymbol,\n type: () => ContractPlainTypeRuntimeSymbol,\n otherResponse: ({ contentType, body, }) => ({\n contentType,\n body,\n }),\n noBody: () => ContractNoBody,\n };\n};\n\n/**\n * @param path - The URL e.g. /posts/:id\n * @param params - The params e.g. `{ id: string }`\n * @returns - The URL with the params e.g. /posts/123\n */\nconst insertParamsIntoPath = ({ path, params, }) => {\n const pathParams = params;\n return path.replace(/\\/?:([^/?]+)\\??/g, (matched, p) => pathParams[p]\n ? `${matched.startsWith('/') ? '/' : ''}${pathParams[p]}`\n : '');\n};\n\n/**\n *\n * @param query - Any JSON object\n * @param json - Use JSON.stringify to encode the query values\n * @returns - The query url segment, using explode array syntax, and deep object syntax\n */\nconst convertQueryParamsToUrlString = (query, json = false) => {\n const queryString = json\n ? encodeQueryParamsJson(query)\n : encodeQueryParams(query);\n return (queryString === null || queryString === void 0 ? void 0 : queryString.length) > 0 ? '?' + queryString : '';\n};\nconst encodeQueryParamsJson = (query) => {\n if (!query) {\n return '';\n }\n return Object.entries(query)\n .filter(([, value]) => value !== undefined)\n .map(([key, value]) => {\n let encodedValue;\n // if value is a string and is not a reserved JSON value or a number, pass it without encoding\n // this makes strings look nicer in the URL (e.g. ?name=John instead of ?name=%22John%22)\n // this is also how OpenAPI will pass strings even if they are marked as application/json types\n if (typeof value === 'string' &&\n !['true', 'false', 'null'].includes(value.trim()) &&\n isNaN(Number(value))) {\n encodedValue = value;\n }\n else {\n encodedValue = JSON.stringify(value);\n }\n return `${encodeURIComponent(key)}=${encodeURIComponent(encodedValue)}`;\n })\n .join('&');\n};\nconst encodeQueryParams = (query) => {\n if (!query) {\n return '';\n }\n return (Object.keys(query)\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n .flatMap((key) => tokeniseValue(key, query[key]))\n .map(([key, value]) => {\n return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;\n })\n .join('&'));\n};\n/**\n * A recursive function to convert an object/string/number/Date/whatever into an array of key=value pairs\n *\n * The output of this should be flatMap-able to a string of key=value pairs which can be\n * joined with & to form a query string\n *\n * This should be fully compatible with the \"qs\" library, but without the need to add a dependency\n */\nconst tokeniseValue = (key, value) => {\n if (Array.isArray(value)) {\n return value.flatMap((v, idx) => tokeniseValue(`${key}[${idx}]`, v));\n }\n if (value instanceof Date) {\n return [[`${key}`, value.toISOString()]];\n }\n if (value === null) {\n return [[`${key}`, '']];\n }\n if (value === undefined) {\n return [];\n }\n if (typeof value === 'object') {\n return Object.keys(value).flatMap((k) => \n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n tokeniseValue(`${key}[${k}]`, value[k]));\n }\n return [[`${key}`, `${value}`]];\n};\n/**\n *\n * @param query - A server-side query object where values have been encoded as JSON strings\n * @returns - The same object with the JSON strings decoded. Objects that were encoded using toJSON such as Dates will remain as strings\n */\nconst parseJsonQueryObject = (query) => {\n return Object.fromEntries(Object.entries(query).map(([key, value]) => {\n let parsedValue;\n // if json parse fails, treat the value as a string\n // this allows us to pass strings without having to surround them with quotes\n try {\n parsedValue = JSON.parse(value);\n }\n catch {\n parsedValue = value;\n }\n return [key, parsedValue];\n }));\n};\n\nclass UnknownStatusError extends Error {\n constructor(response, knownResponseStatuses) {\n const expectedStatuses = knownResponseStatuses.join(',');\n super(`Server returned unexpected response. Expected one of: ${expectedStatuses} got: ${response.status}`);\n this.response = response;\n }\n}\n\n/**\n * @deprecated Only safe to use on the client-side. Use `ServerInferResponses`/`ClientInferResponses` instead.\n */\nfunction getRouteResponses(router) {\n return {};\n}\n/**\n * Default fetch api implementation:\n *\n * Can be used as a reference for implementing your own fetcher,\n * or used in the \"api\" field of ClientArgs to allow you to hook\n * into the request to run custom logic\n */\nconst tsRestFetchApi = async ({ route, path, method, headers, body, validateResponse, fetchOptions, }) => {\n const result = await fetch(path, {\n ...fetchOptions,\n method,\n headers,\n body,\n });\n const contentType = result.headers.get('content-type');\n if ((contentType === null || contentType === void 0 ? void 0 : contentType.includes('application/')) && (contentType === null || contentType === void 0 ? void 0 : contentType.includes('json'))) {\n const response = {\n status: result.status,\n body: await result.json(),\n headers: result.headers,\n };\n const responseSchema = route.responses[response.status];\n if ((validateResponse !== null && validateResponse !== void 0 ? validateResponse : route.validateResponseOnClient) &&\n isZodType(responseSchema)) {\n return {\n ...response,\n body: responseSchema.parse(response.body),\n };\n }\n return response;\n }\n if (contentType === null || contentType === void 0 ? void 0 : contentType.includes('text/')) {\n return {\n status: result.status,\n body: await result.text(),\n headers: result.headers,\n };\n }\n return {\n status: result.status,\n body: await result.blob(),\n headers: result.headers,\n };\n};\nconst createFormData = (body) => {\n const formData = new FormData();\n const appendToFormData = (key, value) => {\n if (value instanceof File) {\n formData.append(key, value);\n }\n else {\n formData.append(key, JSON.stringify(value));\n }\n };\n Object.entries(body).forEach(([key, value]) => {\n if (Array.isArray(value)) {\n for (const item of value) {\n appendToFormData(key, item);\n }\n }\n else {\n appendToFormData(key, value);\n }\n });\n return formData;\n};\nconst normalizeHeaders = (headers) => {\n return Object.fromEntries(Object.entries(headers).map(([k, v]) => [k.toLowerCase(), v]));\n};\nconst fetchApi = (options) => {\n const { path, clientArgs, route, body, query, extraInputArgs, headers, fetchOptions, } = options;\n const apiFetcher = clientArgs.api || tsRestFetchApi;\n const baseHeaders = clientArgs.baseHeaders &&\n Object.fromEntries(Object.entries(clientArgs.baseHeaders).map(([name, valueOrFunction]) => {\n if (typeof valueOrFunction === 'function') {\n return [name, valueOrFunction(options)];\n }\n else {\n return [name, valueOrFunction];\n }\n }));\n const combinedHeaders = {\n ...(baseHeaders && normalizeHeaders(baseHeaders)),\n ...normalizeHeaders(headers),\n };\n // Remove any headers that are set to undefined\n Object.keys(combinedHeaders).forEach((key) => {\n if (combinedHeaders[key] === undefined) {\n delete combinedHeaders[key];\n }\n });\n let fetcherArgs = {\n route,\n path,\n method: route.method,\n headers: combinedHeaders,\n body: undefined,\n rawBody: body,\n rawQuery: query,\n contentType: undefined,\n validateResponse: clientArgs.validateResponse,\n fetchOptions: {\n ...(clientArgs.credentials && { credentials: clientArgs.credentials }),\n ...fetchOptions,\n },\n ...((fetchOptions === null || fetchOptions === void 0 ? void 0 : fetchOptions.signal) && { signal: fetchOptions.signal }),\n ...((fetchOptions === null || fetchOptions === void 0 ? void 0 : fetchOptions.cache) && { cache: fetchOptions.cache }),\n ...(fetchOptions &&\n 'next' in fetchOptions &&\n !!(fetchOptions === null || fetchOptions === void 0 ? void 0 : fetchOptions.next) && { next: fetchOptions.next }),\n };\n if (route.method !== 'GET') {\n if ('contentType' in route && route.contentType === 'multipart/form-data') {\n fetcherArgs = {\n ...fetcherArgs,\n contentType: 'multipart/form-data',\n body: body instanceof FormData ? body : createFormData(body),\n };\n }\n else if ('contentType' in route &&\n route.contentType === 'application/x-www-form-urlencoded') {\n fetcherArgs = {\n ...fetcherArgs,\n contentType: 'application/x-www-form-urlencoded',\n headers: {\n 'content-type': 'application/x-www-form-urlencoded',\n ...fetcherArgs.headers,\n },\n body: typeof body === 'string'\n ? body\n : new URLSearchParams(body),\n };\n }\n else if (body !== null && body !== undefined) {\n fetcherArgs = {\n ...fetcherArgs,\n contentType: 'application/json',\n headers: {\n 'content-type': 'application/json',\n ...fetcherArgs.headers,\n },\n body: JSON.stringify(body),\n };\n }\n }\n return apiFetcher({\n ...fetcherArgs,\n ...extraInputArgs,\n });\n};\nconst evaluateFetchApiArgs = (route, clientArgs, inputArgs) => {\n const { query, params, body, headers, extraHeaders, overrideClientOptions, fetchOptions, \n // TODO: remove in 4.0\n cache, \n // TODO: remove in 4.0\n next, \n // extra input args\n ...extraInputArgs } = inputArgs || {};\n const overriddenClientArgs = {\n ...clientArgs,\n ...overrideClientOptions,\n };\n const completeUrl = getCompleteUrl(query, overriddenClientArgs.baseUrl, params, route, !!overriddenClientArgs.jsonQuery);\n return {\n path: completeUrl,\n clientArgs: overriddenClientArgs,\n route,\n body,\n query,\n extraInputArgs,\n fetchOptions: {\n ...(cache && { cache }),\n ...(next && { next }),\n ...fetchOptions,\n },\n headers: {\n ...extraHeaders,\n ...headers,\n },\n };\n};\n/**\n * @hidden\n */\nconst getCompleteUrl = (query, baseUrl, params, route, jsonQuery) => {\n const path = insertParamsIntoPath({\n path: route.path,\n params: params,\n });\n const queryComponent = convertQueryParamsToUrlString(query, jsonQuery);\n return `${baseUrl}${path}${queryComponent}`;\n};\nconst getRouteQuery = (route, clientArgs) => {\n const knownResponseStatuses = Object.keys(route.responses);\n return async (inputArgs) => {\n const fetchApiArgs = evaluateFetchApiArgs(route, clientArgs, inputArgs);\n const response = await fetchApi(fetchApiArgs);\n // TODO: in next major version, throw by default if `strictStatusCode` is enabled\n if (!clientArgs.throwOnUnknownStatus) {\n return response;\n }\n if (knownResponseStatuses.includes(response.status.toString())) {\n return response;\n }\n throw new UnknownStatusError(response, knownResponseStatuses);\n };\n};\nconst initClient = (router, args) => {\n return Object.fromEntries(Object.entries(router).map(([key, subRouter]) => {\n if (isAppRoute(subRouter)) {\n return [key, getRouteQuery(subRouter, args)];\n }\n else {\n return [key, initClient(subRouter, args)];\n }\n }));\n};\n\nclass ResponseValidationError extends Error {\n constructor(appRoute, cause) {\n super(`[ts-rest] Response validation failed for ${appRoute.method} ${appRoute.path}: ${cause.message}`);\n this.appRoute = appRoute;\n this.cause = cause;\n }\n}\n\nconst isAppRouteResponse = (value) => {\n return (value != null &&\n typeof value === 'object' &&\n 'status' in value &&\n typeof value.status === 'number');\n};\nconst isAppRouteOtherResponse = (response) => {\n return (response != null &&\n typeof response === 'object' &&\n 'contentType' in response);\n};\nconst isAppRouteNoBody = (response) => {\n return response === ContractNoBody;\n};\nconst validateResponse = ({ appRoute, response, }) => {\n if (isAppRouteResponse(response)) {\n const responseType = appRoute.responses[response.status];\n const responseSchema = isAppRouteOtherResponse(responseType)\n ? responseType.body\n : responseType;\n const responseValidation = checkZodSchema(response.body, responseSchema);\n if (!responseValidation.success) {\n throw new ResponseValidationError(appRoute, responseValidation.error);\n }\n return {\n status: response.status,\n body: responseValidation.data,\n };\n }\n return response;\n};\n\nclass TsRestResponseError extends Error {\n constructor(route, response) {\n super();\n this.statusCode = response.status;\n this.body = response.body;\n this.name = this.constructor.name;\n if (typeof response.body === 'string') {\n this.message = response.body;\n }\n else if (typeof response.body === 'object' &&\n response.body !== null &&\n 'message' in response.body &&\n typeof response.body.message === 'string') {\n this.message = response.body['message'];\n }\n else {\n this.message = 'Error';\n }\n }\n}\n\nconst isResponse = (response, contractEndpoint) => {\n return (typeof response === 'object' &&\n response !== null &&\n 'status' in response &&\n 'body' in response &&\n typeof response.status === 'number' &&\n response.status >= 200 &&\n response.status < 600 &&\n ((contractEndpoint === null || contractEndpoint === void 0 ? void 0 : contractEndpoint.strictStatusCodes)\n ? Object.keys(contractEndpoint.responses).includes(response.status.toString())\n : true));\n};\nconst isSuccessResponse = (response, contractEndpoint) => {\n return (isResponse(response, contractEndpoint) &&\n response.status >= 200 &&\n response.status < 300);\n};\nconst isErrorResponse = (response, contractEndpoint) => {\n return (isResponse(response, contractEndpoint) &&\n !isSuccessResponse(response, contractEndpoint));\n};\nconst isUnknownResponse = (response, contractEndpoint) => {\n return (isResponse(response) &&\n !Object.keys(contractEndpoint.responses).includes(response.status.toString()));\n};\nconst isUnknownSuccessResponse = (response, contractEndpoint) => {\n return (isSuccessResponse(response) && isUnknownResponse(response, contractEndpoint));\n};\nconst isUnknownErrorResponse = (response, contractEndpoint) => {\n return (isErrorResponse(response) && isUnknownResponse(response, contractEndpoint));\n};\nconst exhaustiveGuard = (response) => {\n throw new Error(`Unreachable code: Response status is ${response.status}`);\n};\n\nexport { ContractNoBody, ContractPlainTypeRuntimeSymbol, ResponseValidationError, TsRestResponseError, UnknownStatusError, ZodErrorSchema, checkZodSchema, convertQueryParamsToUrlString, encodeQueryParams, encodeQueryParamsJson, evaluateFetchApiArgs, exhaustiveGuard, extractZodObjectShape, fetchApi, getCompleteUrl, getRouteQuery, getRouteResponses, initClient, initContract, initTsRest, insertParamsIntoPath, isAppRoute, isAppRouteMutation, isAppRouteNoBody, isAppRouteOtherResponse, isAppRouteQuery, isAppRouteResponse, isErrorResponse, isResponse, isSuccessResponse, isUnknownErrorResponse, isUnknownResponse, isUnknownSuccessResponse, isZodObject, isZodObjectStrict, isZodType, parseJsonQueryObject, tsRestFetchApi, validateResponse, zodErrorResponse, zodMerge };\n",null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"names":["APIError","Error","constructor","args","super","message","this","name","statusCode","error","details","is","schema","safeParse","success","unknown","z","object","string","number","int","optional","FilterOperator","SortDirection","QUERY_BUILDER_TYPE","Symbol","QueryBuilder","options","filters","sort","includes","groupBy","join","count","page","pageSize","_a","obj","addFilter","criteria","where","field","value","operator","EQUALS","whereNot","NOT_EQUALS","whereLike","LIKE","whereLikeLower","LIKE_LOWER","whereContains","whereStartsWith","whereEndsWith","whereIn","values","IN","whereNull","IS_NULL","whereNotNull","IS_NOT_NULL","addSort","orderBy","direction","ASC","orderByAsc","orderByDesc","DESC","paginate","relations","relationsArray","Array","isArray","fields","fieldsArray","expression","countAs","alias","build","result","undefined","rangeStart","rangeEnd","length","filter","ascFields","s","map","descFields","eager","clone","ClonedBuilder","Object","assign","create","isZodObjectStrict","passthrough","literal","issues","array","path","union","code","nativeEnum","ZodIssueCode","catchall","any","ContractNoBody","isAppRoute","recursivelyApplyOptions","router","fromEntries","entries","key","_b","_c","objectA","objectB","pathPrefix","headers","baseHeaders","merge","strictStatusCodes","validateResponseOnClient","responses","commonResponses","metadata","ContractPlainTypeRuntimeSymbol","initContract","endpoints","query","mutation","response","body","type","otherResponse","contentType","noBody","encodeQueryParamsJson","encodedValue","trim","isNaN","Number","JSON","stringify","encodeURIComponent","encodeQueryParams","keys","flatMap","tokeniseValue","v","idx","Date","toISOString","k","UnknownStatusError","knownResponseStatuses","status","tsRestFetchApi","async","route","method","validateResponse","fetchOptions","fetch","get","json","responseSchema","parse","text","blob","createFormData","formData","FormData","appendToFormData","File","append","forEach","item","normalizeHeaders","toLowerCase","getCompleteUrl","baseUrl","params","jsonQuery","pathParams","replace","matched","p","startsWith","insertParamsIntoPath","queryComponent","queryString","convertQueryParamsToUrlString","getRouteQuery","clientArgs","inputArgs","fetchApiArgs","extraHeaders","overrideClientOptions","cache","next","extraInputArgs","overriddenClientArgs","evaluateFetchApiArgs","apiFetcher","api","valueOrFunction","combinedHeaders","fetcherArgs","rawBody","rawQuery","credentials","signal","URLSearchParams","fetchApi","throwOnUnknownStatus","toString","initClient","subRouter","BaseRepository","endpoint","contract","root","token","getToken","client","sanitizedRoot","sanitizedEndpoint","clientConfig","uuidv4","setToken","getCurrentToken","handleResponse","successStatusCode","parsedResponse","record","data","paginationSchema","positive","limit","total","min","totalPages","hasNext","boolean","hasPrev","accountSummarySchema","balance","availableBalance","accountNumber","accountName","CommonSchemas","pagination","transactionSummary","yesterday","today","thisMonth","lastMonth","accountSummary","AuthDTOSchemas","user","identity","loginRequest","default","email","password","authContract","login","summary","description","User","hasToken","getDisplayName","isEmailIdentity","test","from","console","fromJson","toJson","AuthRepository","loginData","userData","COLLECTION_STATUS","COLLECTION_CHANNEL","paymentStatusSchema","paymentChannelSchema","CollectionDTOSchemas","collection","id","statusMessage","accountNo","walletId","transactionDate","datetime","narration","msisdn","channel","amount","serviceFee","postedAmount","reference","partnerReference","nullable","transactionId","serviceFeeTransactionId","requestId","completedAt","createdAt","updatedAt","notes","currencyCode","collectionQueryParams","max","sortBy","enum","sortOrder","startDate","endDate","minAmount","maxAmount","search","paymentStatus","paymentChannel","collectionContract","getCollections","getCollection","getSummary","getBalance","COLLECTION_STATUS_INFO","PAYMENT_ACCEPTED","label","category","color","userFriendlyMessage","PENDING_ACK","PAYMENT_REJECTED","GENERIC_FAILURE","CHANNEL_INFO","AIRTEL","networkOperator","serviceName","TIGO","HALOTEL","Collection","CurrencyValidation","isCurrencyCode","Amount","parseFloat","isPending","isSuccessful","isFailed","_","info","getStatusInfo","getChannelInfo","getProviderName","getServiceName","isMobileCollection","isBankCollection","createMany","dataArray","Boolean","isAmountJson","amountInstance","serviceFeeValue","postedAmountValue","serviceFeeInstance","numericValue","postedAmountInstance","createManyFromJson","jsonArray","_d","CollectionQueryBuilder","whereStatus","whereChannel","wherePending","whereSuccessful","whereFailed","whereAmountBetween","GREATER_THAN_OR_EQUAL","LESS_THAN_OR_EQUAL","whereSender","whereAccount","whereReference","wherePartnerReference","toCollectionQuery","CollectionRepository","Math","ceil","collections","PAYOUT_STATUS","MOBILE_PAYOUT_CHANNEL","BANK_PAYOUT_CHANNEL","payoutStatusSchema","mobileChannelSchema","bankChannelSchema","payoutChannelSchema","PayoutDTOSchemas","payout","statusCodeText","statusDescription","countryCode","serviceCode","recipientNames","transactionRef","externalId","cbaReferenceNo","beepTransactionId","receiptNumber","reversedTransactionId","isReconciled","payoutQueryParams","ref","payoutStatus","payoutChannel","mobileChannel","bankChannel","payoutContract","getPayouts","getPayout","getPayoutSummary","PAYOUT_STATUS_INFO","PENDING","INSUFFICIENT_BALANCE","THIRDPARTY_FAILED","AMOUNT_EXCEED_MAXIMUM","WALLET_DEBITED","REVERSED","INVALID_SERVICE","MOBILE_CHANNEL_INFO","VODACOM","isMobileChannel","isBankChannel","BANK","getFailedStatuses","Payout","swiftCode","potentialSwiftCode","split","BankValidation","validateSwiftCodeForAnyCountry","detectedCountry","getCountryFromSwiftCode","Bank","warn","channelInfo","shortName","PayoutQueryBuilder","whereRecipient","toPayoutQuery","TransactionSummary","currency","getMonthlyGrowthRate","getRecentTotal","WalletInfo","actualBalance","hasSufficientBalance","PayoutRepository","payouts","getAccountBalance"],"mappings":"6JAMM,MAAOA,UAAiBC,MA2B5B,WAAAC,CAAYC,GAMVC,MAAMD,EAAKE,SACXC,KAAKC,KAAO,WAEZD,KAAKE,WAAaL,EAAKK,WACnBF,KAAKG,QAAOH,KAAKG,MAAQN,EAAKM,OAC9BN,EAAKO,UAASJ,KAAKI,QAAUP,EAAKO,SAqBjC,SAAOC,CAAGF,GAEf,OADeT,EAASY,OAAOC,UAAUJ,GAC3BK,QAGT,cAAOC,CAAQV,GACpB,OAAO,IAAIL,EAAS,CAClBK,QAASA,QAAAA,EAAW,4BACpBG,WAAY,MAIT,iBAAWI,GAMhB,OAAOI,EAAEC,OAAO,CACdZ,QAASW,EAAEE,SACXV,WAAYQ,EAAEG,SAASC,MACvBX,MAAOO,EAAEE,SAASG,WAClBX,QAASM,EAAEC,OAAO,CAAA,GAAII,kBCvFhBC,EAcAC,KAdZ,SAAYD,GACVA,EAAA,OAAA,KACAA,EAAA,WAAA,MACAA,EAAA,UAAA,KACAA,EAAA,mBAAA,MACAA,EAAA,aAAA,KACAA,EAAA,sBAAA,MACAA,EAAA,KAAA,OACAA,EAAA,WAAA,YACAA,EAAA,QAAA,SACAA,EAAA,YAAA,YACAA,EAAA,GAAA,IACD,CAZD,CAAYA,IAAAA,EAAc,CAAA,IAc1B,SAAYC,GACVA,EAAA,IAAA,MACAA,EAAA,KAAA,MACD,CAHD,CAAYA,IAAAA,EAAa,CAAA,UCXZC,EAAqBC,OAAO,4BAE5BC,EAYX,WAAAxB,CAAYyB,EAAwB,IAX1BrB,KAAAqB,QAAwB,CAChCC,QAAS,GACTC,KAAM,GACNC,SAAU,GACVC,QAAS,GACTC,KAAM,GACNC,MAAO,IACPC,KAAM,EACNC,SAAU,GAkBZ7B,KAAA8B,GAAuB,gBAdrB9B,KAAKqB,QAAU,CACbC,QAASD,EAAQC,SAAW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AIf,MAAM/H,EAAO+H,QAAwC4Q,GAAiBc,kBAAkBpP,MAAM,CAAA,GAAMtC,EAC9FnD,QAAezE,KAAK4N,OAAOiM,WAAW,CAAEjS,MAAO/H,IAC/CiI,EAAW9H,KAAKmO,eAGnB1J,EAAQ,KAEL8K,EAA4B,CAChC3N,KAAM/B,EAAK+B,KACX8M,MAAO7O,EAAK6O,MACZC,MAAO7G,EAAS6G,MAChBE,WAAY/G,EAAS6G,MAAQ,EAAImJ,KAAKC,KAAKjQ,EAAS6G,MAAQ9O,EAAK6O,OAAS,EAC1EI,QAASjP,EAAK+B,KAAO/B,EAAK6O,MAAQ5G,EAAS6G,MAC3CK,QAASnP,EAAK+B,KAAO,GAGvB,MAAO,CACLya,QAASvB,GAAO5E,WAAWpO,EAASyG,MACpCgB,WAAYA,GAOhB,eAAMuK,CAAUnI,GACd,MAAMlN,QAAezE,KAAK4N,OAAOkM,UAAU,CAAE7O,OAAQ,CAAE0G,QACjDpD,EAAOvO,KAAKmO,eAA2B1J,EAAQ,KAC/CgU,EAASqC,GAAOhK,KAAKvC,GAC3B,IAAKkK,EACH,MAAM,IAAI9Y,MAAM,4CAElB,OAAO8Y,EAMT,sBAAMsB,GACJ,MAAMtV,QAAezE,KAAK4N,OAAOmM,mBAC3BxL,EAAOvO,KAAKmO,eAAsC1J,EAAQ,KAChE,OAAOoX,GAAmB/K,KAAKvC,GAMjC,uBAAM+N,GACJ,MAAM7X,QAAezE,KAAK4N,OAAOsG,aAC3B3F,EAAOvO,KAAKmO,eAAiC1J,EAAQ,KAC3D,OAAOwX,GAAWnL,KAAKvC","x_google_ignoreList":[3]}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { AppRouter } from "@ts-rest/core";
|
|
2
|
+
import { InitClientArgs } from "@ts-rest/core";
|
|
3
|
+
/**
|
|
4
|
+
* BaseRepository - Generic base class for API repositories
|
|
5
|
+
*
|
|
6
|
+
* Provides a consistent way to interact with the Afloat API using ts-rest contracts.
|
|
7
|
+
* Handles authentication token management through multiple fallback mechanisms.
|
|
8
|
+
*
|
|
9
|
+
* **Token Resolution Order:**
|
|
10
|
+
* 1. Direct token provided in constructor
|
|
11
|
+
* 2. Global authentication state via getCurrentToken()
|
|
12
|
+
*
|
|
13
|
+
* @template TContract - The API contract extending `AppRouter` from `@ts-rest/core`
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* // Usage 1: Direct token usage (Recommended for server-side usage)
|
|
18
|
+
* const repo = new WalletRepository("wallet", walletContract, {
|
|
19
|
+
* token: "user-auth-token"
|
|
20
|
+
* });
|
|
21
|
+
*
|
|
22
|
+
* // Usage 2: Global auth state (Recommended for client-side usage)
|
|
23
|
+
* // Token automatically retrieved from AfloatAuth.instance
|
|
24
|
+
* const repo = new WalletRepository("wallet", walletContract);
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare class BaseRepository<TContract extends AppRouter> {
|
|
28
|
+
/**
|
|
29
|
+
* The ts-rest contract defining the API endpoints
|
|
30
|
+
* @protected
|
|
31
|
+
*/
|
|
32
|
+
protected contract: TContract;
|
|
33
|
+
/**
|
|
34
|
+
* The API endpoint path for this repository
|
|
35
|
+
* @protected
|
|
36
|
+
*/
|
|
37
|
+
protected endpoint: string;
|
|
38
|
+
/**
|
|
39
|
+
* Optional custom API root URL
|
|
40
|
+
* @protected
|
|
41
|
+
*/
|
|
42
|
+
protected root: string | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Optional authentication token for API calls
|
|
45
|
+
* @protected
|
|
46
|
+
*/
|
|
47
|
+
protected token: string | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Creates a new BaseRepository instance.
|
|
50
|
+
*
|
|
51
|
+
* @param endpoint - The API endpoint path (e.g., "users", "wallets")
|
|
52
|
+
* @param contract - The ts-rest contract defining the API
|
|
53
|
+
* @param options - Optional configuration
|
|
54
|
+
* @param options.root - Custom API root URL (defaults to https://gateway.temboplus.com/dashboard)
|
|
55
|
+
* @param options.token - Authentication token for API calls
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```typescript
|
|
59
|
+
* // Server-side with explicit token
|
|
60
|
+
* const repo = new WalletRepository("wallet", walletContract, {
|
|
61
|
+
* token: "user-auth-token",
|
|
62
|
+
* root: "https://gateway.temboplus.com/dashboard"
|
|
63
|
+
* });
|
|
64
|
+
*
|
|
65
|
+
* // Client-side using global auth state
|
|
66
|
+
* const repo = new WalletRepository("wallet", walletContract);
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
constructor(endpoint: string, contract: TContract, options?: {
|
|
70
|
+
root?: string;
|
|
71
|
+
token?: string;
|
|
72
|
+
});
|
|
73
|
+
/**
|
|
74
|
+
* Resolves an authentication token for API calls.
|
|
75
|
+
*
|
|
76
|
+
* Uses a fallback chain to find a valid token:
|
|
77
|
+
* 1. Instance token (set in constructor)
|
|
78
|
+
* 2. Return an empty string if no token is found (e.g., for public/unauthenticated endpoints)
|
|
79
|
+
*
|
|
80
|
+
* @protected
|
|
81
|
+
* @returns The authentication token
|
|
82
|
+
* @throws {Error} If no valid token can be found
|
|
83
|
+
*/
|
|
84
|
+
protected getToken(): string;
|
|
85
|
+
/**
|
|
86
|
+
* Gets the configured ts-rest client for making API requests.
|
|
87
|
+
*
|
|
88
|
+
* Automatically includes authentication headers and request tracking.
|
|
89
|
+
* The client resolves the authentication token using the fallback chain.
|
|
90
|
+
*
|
|
91
|
+
* @returns Configured ts-rest client instance
|
|
92
|
+
* @throws {Error} If no authentication token is available
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```typescript
|
|
96
|
+
* // Client automatically includes token and request ID
|
|
97
|
+
* const result = await this.client.getUsers({ query: { limit: 10 } });
|
|
98
|
+
*
|
|
99
|
+
* // Headers automatically included:
|
|
100
|
+
* // - token: "user-auth-token"
|
|
101
|
+
* // - x-request-id: "uuid-v4-string"
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
get client(): { [TKey in keyof TContract]: TContract[TKey] extends import("@ts-rest/core").AppRoute ? import("@ts-rest/core").AppRouteFunction<TContract[TKey], InitClientArgs, import("@ts-rest/core").PartialClientInferRequest<TContract[TKey], InitClientArgs>> : TContract[TKey] extends AppRouter ? TContract[TKey] extends infer T extends AppRouter ? { [TKey_1 in keyof T]: TContract[TKey][TKey_1] extends import("@ts-rest/core").AppRoute ? import("@ts-rest/core").AppRouteFunction<TContract[TKey][TKey_1], InitClientArgs, import("@ts-rest/core").PartialClientInferRequest<TContract[TKey][TKey_1], InitClientArgs>> : TContract[TKey][TKey_1] extends AppRouter ? TContract[TKey][TKey_1] extends infer T_1 extends AppRouter ? { [TKey_2 in keyof T_1]: TContract[TKey][TKey_1][TKey_2] extends import("@ts-rest/core").AppRoute ? import("@ts-rest/core").AppRouteFunction<TContract[TKey][TKey_1][TKey_2], InitClientArgs, import("@ts-rest/core").PartialClientInferRequest<TContract[TKey][TKey_1][TKey_2], InitClientArgs>> : TContract[TKey][TKey_1][TKey_2] extends AppRouter ? TContract[TKey][TKey_1][TKey_2] extends infer T_2 extends AppRouter ? { [TKey_3 in keyof T_2]: TContract[TKey][TKey_1][TKey_2][TKey_3] extends import("@ts-rest/core").AppRoute ? import("@ts-rest/core").AppRouteFunction<TContract[TKey][TKey_1][TKey_2][TKey_3], InitClientArgs, import("@ts-rest/core").PartialClientInferRequest<TContract[TKey][TKey_1][TKey_2][TKey_3], InitClientArgs>> : TContract[TKey][TKey_1][TKey_2][TKey_3] extends AppRouter ? TContract[TKey][TKey_1][TKey_2][TKey_3] extends infer T_3 extends AppRouter ? { [TKey_4 in keyof T_3]: TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4] extends import("@ts-rest/core").AppRoute ? import("@ts-rest/core").AppRouteFunction<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4], InitClientArgs, import("@ts-rest/core").PartialClientInferRequest<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4], InitClientArgs>> : TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4] extends AppRouter ? TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4] extends infer T_4 extends AppRouter ? { [TKey_5 in keyof T_4]: TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5] extends import("@ts-rest/core").AppRoute ? import("@ts-rest/core").AppRouteFunction<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5], InitClientArgs, import("@ts-rest/core").PartialClientInferRequest<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5], InitClientArgs>> : TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5] extends AppRouter ? TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5] extends infer T_5 extends AppRouter ? { [TKey_6 in keyof T_5]: TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6] extends import("@ts-rest/core").AppRoute ? import("@ts-rest/core").AppRouteFunction<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6], InitClientArgs, import("@ts-rest/core").PartialClientInferRequest<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6], InitClientArgs>> : TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6] extends AppRouter ? TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6] extends infer T_6 extends AppRouter ? { [TKey_7 in keyof T_6]: TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7] extends import("@ts-rest/core").AppRoute ? import("@ts-rest/core").AppRouteFunction<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7], InitClientArgs, import("@ts-rest/core").PartialClientInferRequest<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7], InitClientArgs>> : TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7] extends AppRouter ? TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7] extends infer T_7 extends AppRouter ? { [TKey_8 in keyof T_7]: TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8] extends import("@ts-rest/core").AppRoute ? import("@ts-rest/core").AppRouteFunction<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8], InitClientArgs, import("@ts-rest/core").PartialClientInferRequest<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8], InitClientArgs>> : TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8] extends AppRouter ? TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8] extends infer T_8 extends AppRouter ? { [TKey_9 in keyof T_8]: TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8][TKey_9] extends import("@ts-rest/core").AppRoute ? import("@ts-rest/core").AppRouteFunction<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8][TKey_9], InitClientArgs, import("@ts-rest/core").PartialClientInferRequest<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8][TKey_9], InitClientArgs>> : TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8][TKey_9] extends AppRouter ? TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8][TKey_9] extends infer T_9 extends AppRouter ? { [TKey_10 in keyof T_9]: TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8][TKey_9][TKey_10] extends import("@ts-rest/core").AppRoute ? import("@ts-rest/core").AppRouteFunction<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8][TKey_9][TKey_10], InitClientArgs, import("@ts-rest/core").PartialClientInferRequest<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8][TKey_9][TKey_10], InitClientArgs>> : TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8][TKey_9][TKey_10] extends AppRouter ? /*elided*/ any : never; } : never : never; } : never : never; } : never : never; } : never : never; } : never : never; } : never : never; } : never : never; } : never : never; } : never : never; } : never : never; };
|
|
105
|
+
/**
|
|
106
|
+
* Updates the authentication token used by this repository.
|
|
107
|
+
*
|
|
108
|
+
* @param token - The new authentication token
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```typescript
|
|
112
|
+
* // Useful for switching between different user contexts
|
|
113
|
+
* repository.setToken("new-auth-token");
|
|
114
|
+
*
|
|
115
|
+
* // Or clearing the token to fall back to global auth state
|
|
116
|
+
* repository.setToken(undefined);
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
119
|
+
setToken(token: string): void;
|
|
120
|
+
/**
|
|
121
|
+
* Gets the currently configured token (if set directly on the instance).
|
|
122
|
+
*
|
|
123
|
+
* @returns The current authentication token or undefined
|
|
124
|
+
*
|
|
125
|
+
* @note This only returns tokens set directly on the instance, not tokens
|
|
126
|
+
* resolved from the global authentication state.
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* ```typescript
|
|
130
|
+
* const directToken = repository.getCurrentToken();
|
|
131
|
+
* if (directToken) {
|
|
132
|
+
* console.log("Repository has a direct token");
|
|
133
|
+
* } else {
|
|
134
|
+
* console.log("Repository will use global auth state");
|
|
135
|
+
* }
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
138
|
+
getCurrentToken(): string | undefined;
|
|
139
|
+
/**
|
|
140
|
+
* Handles API responses consistently across all repositories.
|
|
141
|
+
*
|
|
142
|
+
* Checks the HTTP status code and either returns the response body for
|
|
143
|
+
* successful requests or throws appropriate errors for failures.
|
|
144
|
+
*
|
|
145
|
+
* @template T - The expected type of the successful response body
|
|
146
|
+
* @param result - The API response object with status and body
|
|
147
|
+
* @param successStatusCode - The expected HTTP status code for success
|
|
148
|
+
* @returns The response body typed as T
|
|
149
|
+
* @throws {APIError} For API errors (400, 401, 403, 404, 500, etc.)
|
|
150
|
+
*
|
|
151
|
+
* @example
|
|
152
|
+
* ```typescript
|
|
153
|
+
* const result = await this.client.getUser({ params: { id: "123" } });
|
|
154
|
+
* return this.handleResponse<User>(result, 200);
|
|
155
|
+
*
|
|
156
|
+
* // Automatically handles error cases:
|
|
157
|
+
* // - 400: Bad Request with detailed error info
|
|
158
|
+
* // - 401: Unauthorized (authentication required)
|
|
159
|
+
* // - 403: Forbidden (insufficient permissions)
|
|
160
|
+
* // - 404: Not Found
|
|
161
|
+
* // - Other: Generic server error
|
|
162
|
+
* ```
|
|
163
|
+
*/
|
|
164
|
+
handleResponse<T>(result: {
|
|
165
|
+
status: number;
|
|
166
|
+
body: unknown;
|
|
167
|
+
}, successStatusCode: number): T;
|
|
168
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
declare const paginationSchema: z.ZodObject<{
|
|
3
|
+
page: z.ZodNumber;
|
|
4
|
+
limit: z.ZodNumber;
|
|
5
|
+
total: z.ZodNumber;
|
|
6
|
+
totalPages: z.ZodNumber;
|
|
7
|
+
hasNext: z.ZodBoolean;
|
|
8
|
+
hasPrev: z.ZodBoolean;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
page: number;
|
|
11
|
+
limit: number;
|
|
12
|
+
total: number;
|
|
13
|
+
totalPages: number;
|
|
14
|
+
hasNext: boolean;
|
|
15
|
+
hasPrev: boolean;
|
|
16
|
+
}, {
|
|
17
|
+
page: number;
|
|
18
|
+
limit: number;
|
|
19
|
+
total: number;
|
|
20
|
+
totalPages: number;
|
|
21
|
+
hasNext: boolean;
|
|
22
|
+
hasPrev: boolean;
|
|
23
|
+
}>;
|
|
24
|
+
declare const accountSummarySchema: z.ZodObject<{
|
|
25
|
+
balance: z.ZodNumber;
|
|
26
|
+
availableBalance: z.ZodNumber;
|
|
27
|
+
accountNumber: z.ZodString;
|
|
28
|
+
accountName: z.ZodString;
|
|
29
|
+
}, "strip", z.ZodTypeAny, {
|
|
30
|
+
balance: number;
|
|
31
|
+
availableBalance: number;
|
|
32
|
+
accountNumber: string;
|
|
33
|
+
accountName: string;
|
|
34
|
+
}, {
|
|
35
|
+
balance: number;
|
|
36
|
+
availableBalance: number;
|
|
37
|
+
accountNumber: string;
|
|
38
|
+
accountName: string;
|
|
39
|
+
}>;
|
|
40
|
+
declare const transactionSummarySchema: z.ZodObject<{
|
|
41
|
+
yesterday: z.ZodNumber;
|
|
42
|
+
today: z.ZodNumber;
|
|
43
|
+
thisMonth: z.ZodNumber;
|
|
44
|
+
lastMonth: z.ZodNumber;
|
|
45
|
+
}, "strip", z.ZodTypeAny, {
|
|
46
|
+
yesterday: number;
|
|
47
|
+
today: number;
|
|
48
|
+
thisMonth: number;
|
|
49
|
+
lastMonth: number;
|
|
50
|
+
}, {
|
|
51
|
+
yesterday: number;
|
|
52
|
+
today: number;
|
|
53
|
+
thisMonth: number;
|
|
54
|
+
lastMonth: number;
|
|
55
|
+
}>;
|
|
56
|
+
export declare const CommonSchemas: {
|
|
57
|
+
pagination: z.ZodObject<{
|
|
58
|
+
page: z.ZodNumber;
|
|
59
|
+
limit: z.ZodNumber;
|
|
60
|
+
total: z.ZodNumber;
|
|
61
|
+
totalPages: z.ZodNumber;
|
|
62
|
+
hasNext: z.ZodBoolean;
|
|
63
|
+
hasPrev: z.ZodBoolean;
|
|
64
|
+
}, "strip", z.ZodTypeAny, {
|
|
65
|
+
page: number;
|
|
66
|
+
limit: number;
|
|
67
|
+
total: number;
|
|
68
|
+
totalPages: number;
|
|
69
|
+
hasNext: boolean;
|
|
70
|
+
hasPrev: boolean;
|
|
71
|
+
}, {
|
|
72
|
+
page: number;
|
|
73
|
+
limit: number;
|
|
74
|
+
total: number;
|
|
75
|
+
totalPages: number;
|
|
76
|
+
hasNext: boolean;
|
|
77
|
+
hasPrev: boolean;
|
|
78
|
+
}>;
|
|
79
|
+
transactionSummary: z.ZodObject<{
|
|
80
|
+
yesterday: z.ZodNumber;
|
|
81
|
+
today: z.ZodNumber;
|
|
82
|
+
thisMonth: z.ZodNumber;
|
|
83
|
+
lastMonth: z.ZodNumber;
|
|
84
|
+
}, "strip", z.ZodTypeAny, {
|
|
85
|
+
yesterday: number;
|
|
86
|
+
today: number;
|
|
87
|
+
thisMonth: number;
|
|
88
|
+
lastMonth: number;
|
|
89
|
+
}, {
|
|
90
|
+
yesterday: number;
|
|
91
|
+
today: number;
|
|
92
|
+
thisMonth: number;
|
|
93
|
+
lastMonth: number;
|
|
94
|
+
}>;
|
|
95
|
+
accountSummary: z.ZodObject<{
|
|
96
|
+
balance: z.ZodNumber;
|
|
97
|
+
availableBalance: z.ZodNumber;
|
|
98
|
+
accountNumber: z.ZodString;
|
|
99
|
+
accountName: z.ZodString;
|
|
100
|
+
}, "strip", z.ZodTypeAny, {
|
|
101
|
+
balance: number;
|
|
102
|
+
availableBalance: number;
|
|
103
|
+
accountNumber: string;
|
|
104
|
+
accountName: string;
|
|
105
|
+
}, {
|
|
106
|
+
balance: number;
|
|
107
|
+
availableBalance: number;
|
|
108
|
+
accountNumber: string;
|
|
109
|
+
accountName: string;
|
|
110
|
+
}>;
|
|
111
|
+
};
|
|
112
|
+
export type PaginationDTO = z.infer<typeof paginationSchema>;
|
|
113
|
+
export type TransactionSummaryDTO = z.infer<typeof transactionSummarySchema>;
|
|
114
|
+
export type WalletSummaryDTO = z.infer<typeof accountSummarySchema>;
|
|
115
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Custom error class representing API-related errors.
|
|
4
|
+
* Extends the built-in `Error` class to include additional properties such as `statusCode`, `error`, and `details`.
|
|
5
|
+
*/
|
|
6
|
+
export declare class APIError extends Error {
|
|
7
|
+
/**
|
|
8
|
+
* The HTTP status code associated with the error.
|
|
9
|
+
* @type {number}
|
|
10
|
+
*/
|
|
11
|
+
readonly statusCode: number;
|
|
12
|
+
/**
|
|
13
|
+
* An optional error identifier or code.
|
|
14
|
+
* @type {string | undefined}
|
|
15
|
+
*/
|
|
16
|
+
readonly error?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Additional details about the error, often used for debugging purposes.
|
|
19
|
+
* @type {Record<string, unknown> | undefined}
|
|
20
|
+
*/
|
|
21
|
+
readonly details?: Record<string, unknown>;
|
|
22
|
+
/**
|
|
23
|
+
* Creates a new `APIError` instance.
|
|
24
|
+
* @param {Object} args - The arguments to initialize the error.
|
|
25
|
+
* @param {string} args.message - The error message.
|
|
26
|
+
* @param {number} args.statusCode - The HTTP status code associated with the error.
|
|
27
|
+
* @param {string} [args.error] - An optional error identifier or code.
|
|
28
|
+
* @param {Record<string, unknown>} [args.details] - Additional details about the error.
|
|
29
|
+
*/
|
|
30
|
+
constructor(args: {
|
|
31
|
+
message: string;
|
|
32
|
+
statusCode: number;
|
|
33
|
+
error?: string;
|
|
34
|
+
details?: Record<string, unknown>;
|
|
35
|
+
});
|
|
36
|
+
/**
|
|
37
|
+
* Validates whether an unknown value conforms to the APIError schema.
|
|
38
|
+
* This is more thorough than an instanceof check as it verifies all required properties
|
|
39
|
+
* and their types using the defined schema.
|
|
40
|
+
*
|
|
41
|
+
* @param {unknown} error - Any value to be validated
|
|
42
|
+
* @returns {error is APIError} Type predicate indicating if the value is a valid APIError
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* try {
|
|
46
|
+
* throw new Error('Network failed');
|
|
47
|
+
* } catch (err) {
|
|
48
|
+
* if (APIError.is(err)) {
|
|
49
|
+
* // err is typed as APIError here
|
|
50
|
+
* console.log(err.statusCode);
|
|
51
|
+
* }
|
|
52
|
+
* }
|
|
53
|
+
*/
|
|
54
|
+
static is(error: unknown): error is APIError;
|
|
55
|
+
static unknown(message?: string): APIError;
|
|
56
|
+
static get schema(): z.ZodObject<{
|
|
57
|
+
message: z.ZodString;
|
|
58
|
+
statusCode: z.ZodNumber;
|
|
59
|
+
error: z.ZodOptional<z.ZodString>;
|
|
60
|
+
details: z.ZodOptional<z.AnyZodObject>;
|
|
61
|
+
}>;
|
|
62
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./error.api";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Amount, CurrencyCode } from "@temboplus/frontend-core";
|
|
2
|
+
import { TransactionSummaryDTO } from "../api";
|
|
3
|
+
/**
|
|
4
|
+
* Represents payout summary statistics
|
|
5
|
+
*/
|
|
6
|
+
export declare class TransactionSummary {
|
|
7
|
+
readonly yesterday: Amount;
|
|
8
|
+
readonly today: Amount;
|
|
9
|
+
readonly thisMonth: Amount;
|
|
10
|
+
readonly lastMonth: Amount;
|
|
11
|
+
readonly currency: CurrencyCode;
|
|
12
|
+
constructor(data: TransactionSummaryDTO, currency?: CurrencyCode);
|
|
13
|
+
/**
|
|
14
|
+
* Get growth percentage from last month to this month
|
|
15
|
+
*/
|
|
16
|
+
getMonthlyGrowthRate(): number;
|
|
17
|
+
/**
|
|
18
|
+
* Get total for current period (today + yesterday)
|
|
19
|
+
*/
|
|
20
|
+
getRecentTotal(): Amount;
|
|
21
|
+
static from(data: TransactionSummaryDTO, currency?: CurrencyCode): TransactionSummary;
|
|
22
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Amount, CurrencyCode } from "@temboplus/frontend-core";
|
|
2
|
+
import { WalletSummaryDTO } from "../api";
|
|
3
|
+
/**
|
|
4
|
+
* Represents account balance information
|
|
5
|
+
*/
|
|
6
|
+
export declare class WalletInfo {
|
|
7
|
+
readonly accountName: string;
|
|
8
|
+
readonly availableBalance: Amount;
|
|
9
|
+
readonly actualBalance: Amount;
|
|
10
|
+
readonly currency: CurrencyCode;
|
|
11
|
+
constructor(data: WalletSummaryDTO);
|
|
12
|
+
/**
|
|
13
|
+
* Check if there are sufficient funds for a payout
|
|
14
|
+
*/
|
|
15
|
+
hasSufficientBalance(amount: number): boolean;
|
|
16
|
+
static from(data: WalletSummaryDTO): WalletInfo;
|
|
17
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { FilterCriteria, QueryOptions, SortCriteria, SortDirection } from "./query.types";
|
|
2
|
+
export declare const QUERY_BUILDER_TYPE: unique symbol;
|
|
3
|
+
export declare class QueryBuilder {
|
|
4
|
+
protected options: QueryOptions;
|
|
5
|
+
constructor(options?: QueryOptions);
|
|
6
|
+
/**
|
|
7
|
+
* Type tag to identify QueryBuilder instances
|
|
8
|
+
*/
|
|
9
|
+
[QUERY_BUILDER_TYPE]: string;
|
|
10
|
+
/**
|
|
11
|
+
* Safely check if an object is a QueryBuilder instance
|
|
12
|
+
*/
|
|
13
|
+
static is(obj: any): obj is QueryBuilder;
|
|
14
|
+
addFilter(criteria: FilterCriteria): this;
|
|
15
|
+
where(field: string, value: any): this;
|
|
16
|
+
whereNot(field: string, value: any): this;
|
|
17
|
+
whereLike(field: string, value: string): this;
|
|
18
|
+
whereLikeLower(field: string, value: string): this;
|
|
19
|
+
whereContains(field: string, value: string): this;
|
|
20
|
+
whereStartsWith(field: string, value: string): this;
|
|
21
|
+
whereEndsWith(field: string, value: string): this;
|
|
22
|
+
whereIn(field: string, values: any[]): this;
|
|
23
|
+
whereNull(field: string): this;
|
|
24
|
+
whereNotNull(field: string): this;
|
|
25
|
+
addSort(criteria: SortCriteria): this;
|
|
26
|
+
orderBy(field: string, direction?: SortDirection): this;
|
|
27
|
+
orderByAsc(field: string): this;
|
|
28
|
+
orderByDesc(field: string): this;
|
|
29
|
+
paginate(page: number, pageSize: number): this;
|
|
30
|
+
/**
|
|
31
|
+
* Add eager loading for related models
|
|
32
|
+
* @param relations Relation name or array of relation names
|
|
33
|
+
*/
|
|
34
|
+
with(relations: string | string[]): this;
|
|
35
|
+
/**
|
|
36
|
+
* Add a JOIN to the query to fetch related models
|
|
37
|
+
* @param relations Relation name or array of relation names to join
|
|
38
|
+
*/
|
|
39
|
+
join(relations: string | string[]): this;
|
|
40
|
+
/**
|
|
41
|
+
* Add GROUP BY clause to the query
|
|
42
|
+
* @param fields Field or fields to group by
|
|
43
|
+
*/
|
|
44
|
+
groupBy(fields: string | string[]): this;
|
|
45
|
+
/**
|
|
46
|
+
* Enable count mode for the query
|
|
47
|
+
* @param expression Optional count expression (defaults to '*')
|
|
48
|
+
*/
|
|
49
|
+
count(expression?: string): this;
|
|
50
|
+
/**
|
|
51
|
+
* Count specific expression with alias
|
|
52
|
+
* @param expression Expression to count
|
|
53
|
+
* @param alias Alias for the count result
|
|
54
|
+
*/
|
|
55
|
+
countAs(expression: string, alias: string): this;
|
|
56
|
+
/**
|
|
57
|
+
* @returns an objection-find query
|
|
58
|
+
*/
|
|
59
|
+
build(): Record<string, any>;
|
|
60
|
+
/**
|
|
61
|
+
* Create a clone of this query builder
|
|
62
|
+
*/
|
|
63
|
+
clone(): this;
|
|
64
|
+
static create(options?: QueryOptions): QueryBuilder;
|
|
65
|
+
}
|