Tonne of debugging - getting ready for the production builds

This commit is contained in:
2026-02-16 10:44:18 -07:00
parent a77306fac2
commit 7895ce683e
1367 changed files with 404191 additions and 2005 deletions

View File

@@ -0,0 +1,22 @@
import { z } from 'zod';
/** Strip spaces, uppercase */
export declare function normalizePostalCode(raw: string): string;
/** Validate Canadian postal code (all provinces) */
export declare function isValidCanadianPostalCode(code: string): boolean;
export declare const postalCodeParamSchema: z.ZodObject<{
postalCode: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
}, "strip", z.ZodTypeAny, {
postalCode: string;
}, {
postalCode: string;
}>;
export declare const postalCodeQuerySchema: z.ZodObject<{
refresh: z.ZodDefault<z.ZodOptional<z.ZodEnum<["true", "false"]>>>;
}, "strip", z.ZodTypeAny, {
refresh: "true" | "false";
}, {
refresh?: "true" | "false" | undefined;
}>;
export type PostalCodeParam = z.infer<typeof postalCodeParamSchema>;
export type PostalCodeQuery = z.infer<typeof postalCodeQuerySchema>;
//# sourceMappingURL=postal-codes.schemas.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"postal-codes.schemas.d.ts","sourceRoot":"","sources":["../../../../src/modules/influence/postal-codes/postal-codes.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,8BAA8B;AAC9B,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED,oDAAoD;AACpD,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE/D;AAED,eAAO,MAAM,qBAAqB;;;;;;EAKhC,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;EAEhC,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACpE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}

View File

@@ -0,0 +1,24 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.postalCodeQuerySchema = exports.postalCodeParamSchema = void 0;
exports.normalizePostalCode = normalizePostalCode;
exports.isValidCanadianPostalCode = isValidCanadianPostalCode;
const zod_1 = require("zod");
/** Strip spaces, uppercase */
function normalizePostalCode(raw) {
return raw.replace(/\s/g, '').toUpperCase();
}
/** Validate Canadian postal code (all provinces) */
function isValidCanadianPostalCode(code) {
return /^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJKLMNPRSTVWXYZ]\d[ABCEGHJKLMNPRSTVWXYZ]\d$/.test(code);
}
exports.postalCodeParamSchema = zod_1.z.object({
postalCode: zod_1.z
.string()
.transform(normalizePostalCode)
.refine(isValidCanadianPostalCode, { message: 'Invalid Canadian postal code' }),
});
exports.postalCodeQuerySchema = zod_1.z.object({
refresh: zod_1.z.enum(['true', 'false']).optional().default('false'),
});
//# sourceMappingURL=postal-codes.schemas.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"postal-codes.schemas.js","sourceRoot":"","sources":["../../../../src/modules/influence/postal-codes/postal-codes.schemas.ts"],"names":[],"mappings":";;;AAGA,kDAEC;AAGD,8DAEC;AAVD,6BAAwB;AAExB,8BAA8B;AAC9B,SAAgB,mBAAmB,CAAC,GAAW;IAC7C,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;AAC9C,CAAC;AAED,oDAAoD;AACpD,SAAgB,yBAAyB,CAAC,IAAY;IACpD,OAAO,0EAA0E,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC/F,CAAC;AAEY,QAAA,qBAAqB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC5C,UAAU,EAAE,OAAC;SACV,MAAM,EAAE;SACR,SAAS,CAAC,mBAAmB,CAAC;SAC9B,MAAM,CAAC,yBAAyB,EAAE,EAAE,OAAO,EAAE,8BAA8B,EAAE,CAAC;CAClF,CAAC,CAAC;AAEU,QAAA,qBAAqB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC5C,OAAO,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC;CAC/D,CAAC,CAAC"}

View File

@@ -0,0 +1,60 @@
import { Prisma } from '@prisma/client';
interface UpsertData {
postalCode: string;
city?: string | null;
province?: string | null;
centroidLat?: number | null;
centroidLng?: number | null;
}
export declare const postalCodesService: {
upsert(data: UpsertData): Promise<{
id: string;
city: string | null;
postalCode: string;
province: string | null;
centroidLat: Prisma.Decimal | null;
centroidLng: Prisma.Decimal | null;
lastUpdated: Date;
}>;
findByPostalCode(code: string): Promise<{
id: string;
city: string | null;
postalCode: string;
province: string | null;
centroidLat: Prisma.Decimal | null;
centroidLng: Prisma.Decimal | null;
lastUpdated: Date;
} | null>;
findAll(filters: {
page: number;
limit: number;
search?: string;
}): Promise<{
postalCodes: {
id: string;
city: string | null;
postalCode: string;
province: string | null;
centroidLat: Prisma.Decimal | null;
centroidLng: Prisma.Decimal | null;
lastUpdated: Date;
}[];
pagination: {
page: number;
limit: number;
total: number;
totalPages: number;
};
}>;
delete(code: string): Promise<{
id: string;
city: string | null;
postalCode: string;
province: string | null;
centroidLat: Prisma.Decimal | null;
centroidLng: Prisma.Decimal | null;
lastUpdated: Date;
}>;
};
export {};
//# sourceMappingURL=postal-codes.service.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"postal-codes.service.d.ts","sourceRoot":"","sources":["../../../../src/modules/influence/postal-codes/postal-codes.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAGxC,UAAU,UAAU;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED,eAAO,MAAM,kBAAkB;iBACV,UAAU;;;;;;;;;2BAoBA,MAAM;;;;;;;;;qBAMZ;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE;;;;;;;;;;;;;;;;;iBA6BpD,MAAM;;;;;;;;;CAK1B,CAAC"}

View File

@@ -0,0 +1,61 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.postalCodesService = void 0;
const database_1 = require("../../../config/database");
exports.postalCodesService = {
async upsert(data) {
return database_1.prisma.postalCodeCache.upsert({
where: { postalCode: data.postalCode },
update: {
city: data.city ?? undefined,
province: data.province ?? undefined,
centroidLat: data.centroidLat ?? undefined,
centroidLng: data.centroidLng ?? undefined,
lastUpdated: new Date(),
},
create: {
postalCode: data.postalCode,
city: data.city ?? null,
province: data.province ?? null,
centroidLat: data.centroidLat ?? null,
centroidLng: data.centroidLng ?? null,
},
});
},
async findByPostalCode(code) {
return database_1.prisma.postalCodeCache.findUnique({
where: { postalCode: code },
});
},
async findAll(filters) {
const { page, limit, search } = filters;
const skip = (page - 1) * limit;
const where = {};
if (search) {
where.OR = [
{ postalCode: { contains: search, mode: 'insensitive' } },
{ city: { contains: search, mode: 'insensitive' } },
{ province: { contains: search, mode: 'insensitive' } },
];
}
const [items, total] = await Promise.all([
database_1.prisma.postalCodeCache.findMany({
where,
skip,
take: limit,
orderBy: { lastUpdated: 'desc' },
}),
database_1.prisma.postalCodeCache.count({ where }),
]);
return {
postalCodes: items,
pagination: { page, limit, total, totalPages: Math.ceil(total / limit) },
};
},
async delete(code) {
return database_1.prisma.postalCodeCache.delete({
where: { postalCode: code },
});
},
};
//# sourceMappingURL=postal-codes.service.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"postal-codes.service.js","sourceRoot":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