@crvouga/mockingbird-service-google-maps 1.1.0 → 1.1.2
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/CHANGELOG.md +14 -0
- package/README.md +1 -1
- package/dist/{chunk-5OK5LOSY.js → chunk-G5DEDMPE.js} +36 -6
- package/dist/chunk-G5DEDMPE.js.map +7 -0
- package/dist/{chunk-DZGF5KV5.js → chunk-XR7ESTGM.js} +5 -3
- package/dist/chunk-XR7ESTGM.js.map +7 -0
- package/dist/cli.js +2 -2
- package/dist/index.d.ts +117 -89
- package/dist/index.js +1 -1
- package/dist/server.d.ts +221 -165
- package/dist/server.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-5OK5LOSY.js.map +0 -7
- package/dist/chunk-DZGF5KV5.js.map +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog — @crvouga/mockingbird-service-google-maps
|
|
2
2
|
|
|
3
|
+
## 1.1.2 (2026-09-26)
|
|
4
|
+
|
|
5
|
+
### Fixes and improvements
|
|
6
|
+
|
|
7
|
+
- treat enum [""] branches as unset markers in form coercion ([7177835](https://github.com/crvouga/mockingbird/commit/7177835cc510e14245d6648ad2821daa694bb80c))
|
|
8
|
+
|
|
9
|
+
## 1.1.1 (2026-09-25)
|
|
10
|
+
|
|
11
|
+
### Fixes and improvements
|
|
12
|
+
|
|
13
|
+
- take the rejected-request byte count from content-length, never by reading the body ([a0e5fb2](https://github.com/crvouga/mockingbird/commit/a0e5fb2fc80ab725c3552b612f3f091fd6c857fb))
|
|
14
|
+
- reject addressLines over the vendored PostalAddress limits instead of echoing them ([843917c](https://github.com/crvouga/mockingbird/commit/843917c9fe47d83ecd5ab45166ee67c22de9d35c))
|
|
15
|
+
- reject a present body by media type, and log what a rejected request sent ([12e351a](https://github.com/crvouga/mockingbird/commit/12e351aba53cfb7b41e31a7809419455fc2902eb))
|
|
16
|
+
|
|
3
17
|
## 1.1.0 (2026-09-25)
|
|
4
18
|
|
|
5
19
|
### Features
|
package/README.md
CHANGED
|
@@ -196,7 +196,7 @@ records operation, status, the resolved `placeId` and the `sessionToken`, and fo
|
|
|
196
196
|
script, which the shim replaces.
|
|
197
197
|
- `bun scripts/parity.ts`: live parity against `maps.googleapis.com` (and
|
|
198
198
|
`addressvalidation.googleapis.com` for `ValidateAddress`) with
|
|
199
|
-
`
|
|
199
|
+
`GOOGLE_MAPS_API_KEY` (env / `.env.local`; Address Validation must be enabled on
|
|
200
200
|
the key); exits 2 without it.
|
|
201
201
|
|
|
202
202
|
### Deliberately not modelled
|
|
@@ -1149,6 +1149,16 @@ var operationMetadata = (operation) => {
|
|
|
1149
1149
|
|
|
1150
1150
|
// ../core/dist/service.js
|
|
1151
1151
|
import { Hono } from "hono";
|
|
1152
|
+
|
|
1153
|
+
// ../core/dist/validation.js
|
|
1154
|
+
var recorded = /* @__PURE__ */ new WeakMap();
|
|
1155
|
+
var recordedIssues = (request) => recorded.get(request);
|
|
1156
|
+
|
|
1157
|
+
// ../core/dist/service.js
|
|
1158
|
+
var withIssues = (request, response) => {
|
|
1159
|
+
const issues = response.status >= 400 ? recordedIssues(request) : void 0;
|
|
1160
|
+
return issues && issues.length > 0 ? annotateResponse(response, { issues }) : response;
|
|
1161
|
+
};
|
|
1152
1162
|
var defineOperations = (handlers) => handlers;
|
|
1153
1163
|
var OperationRegistryError = class extends Error {
|
|
1154
1164
|
problems;
|
|
@@ -1234,9 +1244,7 @@ var createService = (options) => {
|
|
|
1234
1244
|
now
|
|
1235
1245
|
};
|
|
1236
1246
|
const short = await options.before?.(context);
|
|
1237
|
-
|
|
1238
|
-
return short;
|
|
1239
|
-
return handler(context);
|
|
1247
|
+
return withIssues(request, short ?? await handler(context));
|
|
1240
1248
|
};
|
|
1241
1249
|
app.on(operation.method.toUpperCase(), honoPath(operation.path), route);
|
|
1242
1250
|
}
|
|
@@ -1273,7 +1281,7 @@ var restoreNamespace = (sqlite, namespace, snapshot) => {
|
|
|
1273
1281
|
};
|
|
1274
1282
|
|
|
1275
1283
|
// ../core/dist/version.js
|
|
1276
|
-
var PACKAGE_VERSION = true ? "1.1.
|
|
1284
|
+
var PACKAGE_VERSION = true ? "1.1.2" : UNRELEASED_VERSION;
|
|
1277
1285
|
|
|
1278
1286
|
// ../core/dist/signing.js
|
|
1279
1287
|
var encoder = new TextEncoder();
|
|
@@ -1724,8 +1732,15 @@ var createRuntime = (options) => {
|
|
|
1724
1732
|
const started = monotonicNow();
|
|
1725
1733
|
const url = new URL(request.url);
|
|
1726
1734
|
const operationId = operationIdFor(request, url.pathname);
|
|
1735
|
+
const contentLength = request.headers.get("content-length");
|
|
1736
|
+
const received = {
|
|
1737
|
+
contentType: request.headers.get("content-type"),
|
|
1738
|
+
bodyBytes: contentLength !== null && /^\d+$/.test(contentLength) ? Number(contentLength) : null,
|
|
1739
|
+
transferEncoding: request.headers.get("transfer-encoding")
|
|
1740
|
+
};
|
|
1727
1741
|
const log = (status, faultId, response2) => {
|
|
1728
1742
|
const noted = response2 ? responseNotes(response2) : void 0;
|
|
1743
|
+
const rejected = status >= 400 && faultId === void 0;
|
|
1729
1744
|
const entry = {
|
|
1730
1745
|
service: options.name,
|
|
1731
1746
|
namespace,
|
|
@@ -1737,7 +1752,9 @@ var createRuntime = (options) => {
|
|
|
1737
1752
|
unmatched: options.document !== void 0 && operationId === void 0,
|
|
1738
1753
|
...faultId !== void 0 ? { faultId } : {},
|
|
1739
1754
|
...noted?.ids && Object.keys(noted.ids).length > 0 ? { ids: noted.ids } : {},
|
|
1740
|
-
...noted?.adopted ? { adopted: true } : {}
|
|
1755
|
+
...noted?.adopted ? { adopted: true } : {},
|
|
1756
|
+
...rejected ? { request: { ...received } } : {},
|
|
1757
|
+
...rejected && noted?.issues && noted.issues.length > 0 ? { issues: noted.issues.map((issue) => ({ ...issue })) } : {}
|
|
1741
1758
|
};
|
|
1742
1759
|
metrics.record(entry);
|
|
1743
1760
|
journal.record({ ...entry, at: new Date(clock.now()).toISOString() });
|
|
@@ -3053,6 +3070,8 @@ var POSTAL_ADDRESS = /* @__PURE__ */ new Set([
|
|
|
3053
3070
|
"organization"
|
|
3054
3071
|
]);
|
|
3055
3072
|
var MAX_INPUT_LENGTH = 280;
|
|
3073
|
+
var MAX_ADDRESS_LINES = 3;
|
|
3074
|
+
var MAX_ADDRESS_LINE_LENGTH = 80;
|
|
3056
3075
|
var isRecord4 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3057
3076
|
var optionalString = (value, field) => {
|
|
3058
3077
|
if (value === void 0 || value === null) return void 0;
|
|
@@ -3095,6 +3114,17 @@ var parseValidateRequest = (body) => {
|
|
|
3095
3114
|
`Invalid value at 'address.address_lines' (TYPE_STRING), ${JSON.stringify(rawLines)}`
|
|
3096
3115
|
);
|
|
3097
3116
|
}
|
|
3117
|
+
if (rawLines.length > MAX_ADDRESS_LINES) {
|
|
3118
|
+
throw new ValidationRequestError(
|
|
3119
|
+
`Invalid value at 'address.address_lines' (repeated STRING), a maximum of ${MAX_ADDRESS_LINES} address lines is allowed.`
|
|
3120
|
+
);
|
|
3121
|
+
}
|
|
3122
|
+
const overLong = rawLines.findIndex((line) => line.length > MAX_ADDRESS_LINE_LENGTH);
|
|
3123
|
+
if (overLong !== -1) {
|
|
3124
|
+
throw new ValidationRequestError(
|
|
3125
|
+
`Invalid value at 'address.address_lines[${overLong}]' (STRING), the maximum length is ${MAX_ADDRESS_LINE_LENGTH} characters.`
|
|
3126
|
+
);
|
|
3127
|
+
}
|
|
3098
3128
|
const addressLines = rawLines.map((line) => line.trim()).filter(Boolean);
|
|
3099
3129
|
if (addressLines.length === 0) {
|
|
3100
3130
|
throw new ValidationRequestError("Address lines are missing from the request.");
|
|
@@ -4070,4 +4100,4 @@ export {
|
|
|
4070
4100
|
keyCredential,
|
|
4071
4101
|
GoogleMapsAPI
|
|
4072
4102
|
};
|
|
4073
|
-
//# sourceMappingURL=chunk-
|
|
4103
|
+
//# sourceMappingURL=chunk-G5DEDMPE.js.map
|