@crvouga/mockingbird-service-google-maps 1.8.1 → 2.0.0
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 +37 -0
- package/DISCOVERY.md +55 -0
- package/README.md +3 -3
- package/SUPPORT.md +16 -0
- package/dist/chunk-DY4P32X4.js +850 -0
- package/dist/chunk-DY4P32X4.js.map +7 -0
- package/dist/{chunk-5R4HFNRA.js → chunk-O2FDQBMY.js} +789 -260
- package/dist/chunk-O2FDQBMY.js.map +7 -0
- package/dist/cli.js +2 -2
- package/dist/index.d.ts +37 -5
- package/dist/index.js +1 -1
- package/dist/server.d.ts +66 -4
- package/dist/server.js +2 -2
- package/openapi.yaml +747 -0
- package/package.json +29 -4
- package/dist/chunk-45IZ6HBU.js +0 -363
- package/dist/chunk-45IZ6HBU.js.map +0 -7
- package/dist/chunk-5R4HFNRA.js.map +0 -7
package/dist/cli.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -219,6 +219,15 @@ type FaultCandidate = {
|
|
|
219
219
|
namespace: string;
|
|
220
220
|
};
|
|
221
221
|
type FaultRegistry = {
|
|
222
|
+
isolateNamespaces(): void;
|
|
223
|
+
snapshot(namespace: string): {
|
|
224
|
+
rules: (FaultRule & {
|
|
225
|
+
remaining: number | null;
|
|
226
|
+
hits: number;
|
|
227
|
+
position: number;
|
|
228
|
+
})[];
|
|
229
|
+
rngState: number;
|
|
230
|
+
};
|
|
222
231
|
add(rule: FaultRule): FaultRule;
|
|
223
232
|
list(): (FaultRule & {
|
|
224
233
|
remaining: number | null;
|
|
@@ -226,6 +235,14 @@ type FaultRegistry = {
|
|
|
226
235
|
})[];
|
|
227
236
|
remove(id: string): boolean;
|
|
228
237
|
clear(): void;
|
|
238
|
+
restore(namespace: string, state: {
|
|
239
|
+
rules: (FaultRule & {
|
|
240
|
+
remaining: number | null;
|
|
241
|
+
hits: number;
|
|
242
|
+
position: number;
|
|
243
|
+
})[];
|
|
244
|
+
rngState: number;
|
|
245
|
+
}): void;
|
|
229
246
|
/**
|
|
230
247
|
* Every fault this request should get, in rule order, stopping at the first that answers
|
|
231
248
|
* or drops (effect-only and delay-only rules let later rules match too). Consumes one of
|
|
@@ -403,8 +420,8 @@ type MetricsReport = {
|
|
|
403
420
|
};
|
|
404
421
|
type Metrics = {
|
|
405
422
|
record(entry: RequestLog): void;
|
|
406
|
-
report(): MetricsReport;
|
|
407
|
-
reset(): void;
|
|
423
|
+
report(namespace?: string): MetricsReport;
|
|
424
|
+
reset(namespace?: string): void;
|
|
408
425
|
};
|
|
409
426
|
|
|
410
427
|
/** One journal entry: a request log stamped with when (on the mock clock) it was handled. */
|
|
@@ -558,6 +575,9 @@ type PublishInput = {
|
|
|
558
575
|
id?: string;
|
|
559
576
|
};
|
|
560
577
|
type WebhookHub = {
|
|
578
|
+
pending(namespace: string): number;
|
|
579
|
+
snapshot(namespace: string): unknown;
|
|
580
|
+
restore(namespace: string, snapshot: unknown): void;
|
|
561
581
|
publish(input: PublishInput): WebhookMessage;
|
|
562
582
|
/** Replace a namespace's own endpoints (`PUT /__admin/webhook-endpoints`). */
|
|
563
583
|
setEndpoints(namespace: string, endpoints: WebhookEndpoint[]): WebhookEndpoint[];
|
|
@@ -585,6 +605,8 @@ type ServiceTimelineState = Readonly<{
|
|
|
585
605
|
}>;
|
|
586
606
|
type ServiceCheckpoint = Checkpoint<ServiceTimelineState>;
|
|
587
607
|
type ServiceRuntime<T extends ServiceInstance> = FetchAPI & {
|
|
608
|
+
/** Stop package-owned lifecycle timers when a supervisor closes the runtime. */
|
|
609
|
+
stop?(): void;
|
|
588
610
|
readonly name: string;
|
|
589
611
|
readonly sqlite: SqliteClient$1;
|
|
590
612
|
readonly clock: Clock;
|
|
@@ -595,6 +617,13 @@ type ServiceRuntime<T extends ServiceInstance> = FetchAPI & {
|
|
|
595
617
|
readonly credentials: CredentialRegistry;
|
|
596
618
|
/** The webhook hub, when the service has outbound webhooks. */
|
|
597
619
|
readonly webhooks: WebhookHub | undefined;
|
|
620
|
+
/** Enable independent namespace clocks and PRNGs before serving a fleet. */
|
|
621
|
+
isolateNamespaces(): void;
|
|
622
|
+
namespaceClock(namespace?: string): Clock;
|
|
623
|
+
namespaceOf(request: Request): string;
|
|
624
|
+
/** Opaque in-process checkpoint including records, controls and webhook history. */
|
|
625
|
+
fleetSnapshot(namespace: string): object;
|
|
626
|
+
fleetRestore(snapshot: unknown, namespace: string): void;
|
|
598
627
|
/** Expand a named preset into fault rules (and webhook faults) for `namespace`. */
|
|
599
628
|
applyPreset(name: string, namespace?: string, overrides?: Partial<FaultRule>): FaultRule[];
|
|
600
629
|
/** The instance behind `namespace` (the default one when omitted), created on first use. */
|
|
@@ -976,7 +1005,7 @@ declare const supportedOperationIds: readonly ["PlaceAutocomplete", "PlaceDetail
|
|
|
976
1005
|
* same namespace), in the callback shapes and status enums the real script uses.
|
|
977
1006
|
*/
|
|
978
1007
|
type ShimOptions = {
|
|
979
|
-
/** Origin (plus any `/ns/<name>` prefix) the shim's `fetch` calls go to. */
|
|
1008
|
+
/** Origin (plus any `/__admin/ns/<name>` prefix) the shim's `fetch` calls go to. */
|
|
980
1009
|
base: string;
|
|
981
1010
|
key: string;
|
|
982
1011
|
/** The key was refused: the shim calls `window.gm_authFailure()` once loaded. */
|
|
@@ -996,6 +1025,7 @@ type GoogleMapsRuntimeOptions = {
|
|
|
996
1025
|
sqlite?: SqliteClient;
|
|
997
1026
|
clock?: Clock;
|
|
998
1027
|
seed?: number | string;
|
|
1028
|
+
adminPrefix?: string;
|
|
999
1029
|
adminKey?: string;
|
|
1000
1030
|
onLog?: (entry: RequestLog) => void;
|
|
1001
1031
|
/** Addresses every namespace resolves. Default: the QA corpus. */
|
|
@@ -1004,8 +1034,8 @@ type GoogleMapsRuntimeOptions = {
|
|
|
1004
1034
|
};
|
|
1005
1035
|
type GoogleMapsRuntime = ServiceRuntime<GoogleMapsAPI>;
|
|
1006
1036
|
/**
|
|
1007
|
-
* The Google Maps mock with Mockingbird's full service contract: `/health`, `/__admin/*`,
|
|
1008
|
-
* namespaces by header, by `/ns/<name>` path prefix, or by API key
|
|
1037
|
+
* The Google Maps mock with Mockingbird's full service contract: `/__admin/health`, `/__admin/*`,
|
|
1038
|
+
* namespaces by header, by `/__admin/ns/<name>` path prefix, or by API key
|
|
1009
1039
|
* (`PUT /__admin/credentials {"credentials": {"<PLACES_KEY>": "<namespace>"}}`), clock control,
|
|
1010
1040
|
* fault presets and a request journal. Google Maps sends no webhooks.
|
|
1011
1041
|
*/
|
|
@@ -1029,6 +1059,7 @@ type GoogleMapsAPIOptions = APIOptions & {
|
|
|
1029
1059
|
/** Initial per-namespace settings (accepted keys, public URL for the JS shim). */
|
|
1030
1060
|
settings?: Partial<Settings>;
|
|
1031
1061
|
/** The public namespace name, so the JS shim can call back into the same namespace. */
|
|
1062
|
+
adminPrefix?: string;
|
|
1032
1063
|
publicNamespace?: string;
|
|
1033
1064
|
};
|
|
1034
1065
|
/**
|
|
@@ -1045,6 +1076,7 @@ declare class GoogleMapsAPI implements FetchAPI$1 {
|
|
|
1045
1076
|
readonly sqlite: SqliteClient;
|
|
1046
1077
|
readonly state: GoogleMapsState;
|
|
1047
1078
|
private readonly service;
|
|
1079
|
+
private readonly adminPrefix;
|
|
1048
1080
|
private readonly publicNamespace;
|
|
1049
1081
|
constructor(options?: GoogleMapsAPIOptions);
|
|
1050
1082
|
fetch(request: Request): Promise<Response>;
|
package/dist/index.js
CHANGED
package/dist/server.d.ts
CHANGED
|
@@ -155,6 +155,15 @@ type FaultCandidate$1 = {
|
|
|
155
155
|
namespace: string;
|
|
156
156
|
};
|
|
157
157
|
type FaultRegistry$1 = {
|
|
158
|
+
isolateNamespaces(): void;
|
|
159
|
+
snapshot(namespace: string): {
|
|
160
|
+
rules: (FaultRule$1 & {
|
|
161
|
+
remaining: number | null;
|
|
162
|
+
hits: number;
|
|
163
|
+
position: number;
|
|
164
|
+
})[];
|
|
165
|
+
rngState: number;
|
|
166
|
+
};
|
|
158
167
|
add(rule: FaultRule$1): FaultRule$1;
|
|
159
168
|
list(): (FaultRule$1 & {
|
|
160
169
|
remaining: number | null;
|
|
@@ -162,6 +171,14 @@ type FaultRegistry$1 = {
|
|
|
162
171
|
})[];
|
|
163
172
|
remove(id: string): boolean;
|
|
164
173
|
clear(): void;
|
|
174
|
+
restore(namespace: string, state: {
|
|
175
|
+
rules: (FaultRule$1 & {
|
|
176
|
+
remaining: number | null;
|
|
177
|
+
hits: number;
|
|
178
|
+
position: number;
|
|
179
|
+
})[];
|
|
180
|
+
rngState: number;
|
|
181
|
+
}): void;
|
|
165
182
|
/**
|
|
166
183
|
* Every fault this request should get, in rule order, stopping at the first that answers
|
|
167
184
|
* or drops (effect-only and delay-only rules let later rules match too). Consumes one of
|
|
@@ -326,8 +343,8 @@ type MetricsReport$1 = {
|
|
|
326
343
|
};
|
|
327
344
|
type Metrics$1 = {
|
|
328
345
|
record(entry: RequestLog$1): void;
|
|
329
|
-
report(): MetricsReport$1;
|
|
330
|
-
reset(): void;
|
|
346
|
+
report(namespace?: string): MetricsReport$1;
|
|
347
|
+
reset(namespace?: string): void;
|
|
331
348
|
};
|
|
332
349
|
|
|
333
350
|
/** One journal entry: a request log stamped with when (on the mock clock) it was handled. */
|
|
@@ -481,6 +498,9 @@ type PublishInput$1 = {
|
|
|
481
498
|
id?: string;
|
|
482
499
|
};
|
|
483
500
|
type WebhookHub$1 = {
|
|
501
|
+
pending(namespace: string): number;
|
|
502
|
+
snapshot(namespace: string): unknown;
|
|
503
|
+
restore(namespace: string, snapshot: unknown): void;
|
|
484
504
|
publish(input: PublishInput$1): WebhookMessage$1;
|
|
485
505
|
/** Replace a namespace's own endpoints (`PUT /__admin/webhook-endpoints`). */
|
|
486
506
|
setEndpoints(namespace: string, endpoints: WebhookEndpoint$1[]): WebhookEndpoint$1[];
|
|
@@ -508,6 +528,8 @@ type ServiceTimelineState$1 = Readonly<{
|
|
|
508
528
|
}>;
|
|
509
529
|
type ServiceCheckpoint$1 = Checkpoint$1<ServiceTimelineState$1>;
|
|
510
530
|
type ServiceRuntime$1<T extends ServiceInstance$1> = FetchAPI$2 & {
|
|
531
|
+
/** Stop package-owned lifecycle timers when a supervisor closes the runtime. */
|
|
532
|
+
stop?(): void;
|
|
511
533
|
readonly name: string;
|
|
512
534
|
readonly sqlite: SqliteClient$2;
|
|
513
535
|
readonly clock: Clock$1;
|
|
@@ -518,6 +540,13 @@ type ServiceRuntime$1<T extends ServiceInstance$1> = FetchAPI$2 & {
|
|
|
518
540
|
readonly credentials: CredentialRegistry$1;
|
|
519
541
|
/** The webhook hub, when the service has outbound webhooks. */
|
|
520
542
|
readonly webhooks: WebhookHub$1 | undefined;
|
|
543
|
+
/** Enable independent namespace clocks and PRNGs before serving a fleet. */
|
|
544
|
+
isolateNamespaces(): void;
|
|
545
|
+
namespaceClock(namespace?: string): Clock$1;
|
|
546
|
+
namespaceOf(request: Request): string;
|
|
547
|
+
/** Opaque in-process checkpoint including records, controls and webhook history. */
|
|
548
|
+
fleetSnapshot(namespace: string): object;
|
|
549
|
+
fleetRestore(snapshot: unknown, namespace: string): void;
|
|
521
550
|
/** Expand a named preset into fault rules (and webhook faults) for `namespace`. */
|
|
522
551
|
applyPreset(name: string, namespace?: string, overrides?: Partial<FaultRule$1>): FaultRule$1[];
|
|
523
552
|
/** The instance behind `namespace` (the default one when omitted), created on first use. */
|
|
@@ -564,6 +593,7 @@ type CliOption = {
|
|
|
564
593
|
};
|
|
565
594
|
type CliValues = Record<string, string | boolean | undefined>;
|
|
566
595
|
type CommonServeOptions = {
|
|
596
|
+
adminPrefix?: string;
|
|
567
597
|
adminKey: string | undefined;
|
|
568
598
|
seed: string | undefined;
|
|
569
599
|
onLog: ((entry: RequestLog$1) => void) | undefined;
|
|
@@ -781,6 +811,15 @@ type FaultCandidate = {
|
|
|
781
811
|
namespace: string;
|
|
782
812
|
};
|
|
783
813
|
type FaultRegistry = {
|
|
814
|
+
isolateNamespaces(): void;
|
|
815
|
+
snapshot(namespace: string): {
|
|
816
|
+
rules: (FaultRule & {
|
|
817
|
+
remaining: number | null;
|
|
818
|
+
hits: number;
|
|
819
|
+
position: number;
|
|
820
|
+
})[];
|
|
821
|
+
rngState: number;
|
|
822
|
+
};
|
|
784
823
|
add(rule: FaultRule): FaultRule;
|
|
785
824
|
list(): (FaultRule & {
|
|
786
825
|
remaining: number | null;
|
|
@@ -788,6 +827,14 @@ type FaultRegistry = {
|
|
|
788
827
|
})[];
|
|
789
828
|
remove(id: string): boolean;
|
|
790
829
|
clear(): void;
|
|
830
|
+
restore(namespace: string, state: {
|
|
831
|
+
rules: (FaultRule & {
|
|
832
|
+
remaining: number | null;
|
|
833
|
+
hits: number;
|
|
834
|
+
position: number;
|
|
835
|
+
})[];
|
|
836
|
+
rngState: number;
|
|
837
|
+
}): void;
|
|
791
838
|
/**
|
|
792
839
|
* Every fault this request should get, in rule order, stopping at the first that answers
|
|
793
840
|
* or drops (effect-only and delay-only rules let later rules match too). Consumes one of
|
|
@@ -965,8 +1012,8 @@ type MetricsReport = {
|
|
|
965
1012
|
};
|
|
966
1013
|
type Metrics = {
|
|
967
1014
|
record(entry: RequestLog): void;
|
|
968
|
-
report(): MetricsReport;
|
|
969
|
-
reset(): void;
|
|
1015
|
+
report(namespace?: string): MetricsReport;
|
|
1016
|
+
reset(namespace?: string): void;
|
|
970
1017
|
};
|
|
971
1018
|
|
|
972
1019
|
/** One journal entry: a request log stamped with when (on the mock clock) it was handled. */
|
|
@@ -1120,6 +1167,9 @@ type PublishInput = {
|
|
|
1120
1167
|
id?: string;
|
|
1121
1168
|
};
|
|
1122
1169
|
type WebhookHub = {
|
|
1170
|
+
pending(namespace: string): number;
|
|
1171
|
+
snapshot(namespace: string): unknown;
|
|
1172
|
+
restore(namespace: string, snapshot: unknown): void;
|
|
1123
1173
|
publish(input: PublishInput): WebhookMessage;
|
|
1124
1174
|
/** Replace a namespace's own endpoints (`PUT /__admin/webhook-endpoints`). */
|
|
1125
1175
|
setEndpoints(namespace: string, endpoints: WebhookEndpoint[]): WebhookEndpoint[];
|
|
@@ -1147,6 +1197,8 @@ type ServiceTimelineState = Readonly<{
|
|
|
1147
1197
|
}>;
|
|
1148
1198
|
type ServiceCheckpoint = Checkpoint<ServiceTimelineState>;
|
|
1149
1199
|
type ServiceRuntime<T extends ServiceInstance> = FetchAPI$1 & {
|
|
1200
|
+
/** Stop package-owned lifecycle timers when a supervisor closes the runtime. */
|
|
1201
|
+
stop?(): void;
|
|
1150
1202
|
readonly name: string;
|
|
1151
1203
|
readonly sqlite: SqliteClient$1;
|
|
1152
1204
|
readonly clock: Clock;
|
|
@@ -1157,6 +1209,13 @@ type ServiceRuntime<T extends ServiceInstance> = FetchAPI$1 & {
|
|
|
1157
1209
|
readonly credentials: CredentialRegistry;
|
|
1158
1210
|
/** The webhook hub, when the service has outbound webhooks. */
|
|
1159
1211
|
readonly webhooks: WebhookHub | undefined;
|
|
1212
|
+
/** Enable independent namespace clocks and PRNGs before serving a fleet. */
|
|
1213
|
+
isolateNamespaces(): void;
|
|
1214
|
+
namespaceClock(namespace?: string): Clock;
|
|
1215
|
+
namespaceOf(request: Request): string;
|
|
1216
|
+
/** Opaque in-process checkpoint including records, controls and webhook history. */
|
|
1217
|
+
fleetSnapshot(namespace: string): object;
|
|
1218
|
+
fleetRestore(snapshot: unknown, namespace: string): void;
|
|
1160
1219
|
/** Expand a named preset into fault rules (and webhook faults) for `namespace`. */
|
|
1161
1220
|
applyPreset(name: string, namespace?: string, overrides?: Partial<FaultRule>): FaultRule[];
|
|
1162
1221
|
/** The instance behind `namespace` (the default one when omitted), created on first use. */
|
|
@@ -1313,6 +1372,7 @@ type GoogleMapsAPIOptions = APIOptions & {
|
|
|
1313
1372
|
/** Initial per-namespace settings (accepted keys, public URL for the JS shim). */
|
|
1314
1373
|
settings?: Partial<Settings>;
|
|
1315
1374
|
/** The public namespace name, so the JS shim can call back into the same namespace. */
|
|
1375
|
+
adminPrefix?: string;
|
|
1316
1376
|
publicNamespace?: string;
|
|
1317
1377
|
};
|
|
1318
1378
|
/**
|
|
@@ -1324,6 +1384,7 @@ declare class GoogleMapsAPI implements FetchAPI {
|
|
|
1324
1384
|
readonly sqlite: SqliteClient;
|
|
1325
1385
|
readonly state: GoogleMapsState;
|
|
1326
1386
|
private readonly service;
|
|
1387
|
+
private readonly adminPrefix;
|
|
1327
1388
|
private readonly publicNamespace;
|
|
1328
1389
|
constructor(options?: GoogleMapsAPIOptions);
|
|
1329
1390
|
fetch(request: Request): Promise<Response>;
|
|
@@ -1348,6 +1409,7 @@ type GoogleMapsRuntimeOptions = {
|
|
|
1348
1409
|
sqlite?: SqliteClient;
|
|
1349
1410
|
clock?: Clock;
|
|
1350
1411
|
seed?: number | string;
|
|
1412
|
+
adminPrefix?: string;
|
|
1351
1413
|
adminKey?: string;
|
|
1352
1414
|
onLog?: (entry: RequestLog) => void;
|
|
1353
1415
|
/** Addresses every namespace resolves. Default: the QA corpus. */
|