@onesub/server 0.24.0 → 0.26.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.
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Holds every `log.*` call site in the package to the field vocabulary declared in
3
+ * `log-format.ts`.
4
+ *
5
+ * Why a source-scanning test rather than more per-call-site assertions. The value of
6
+ * moving data out of the message is that an operator can filter on `productId` — and
7
+ * that value is destroyed by one file calling it `product`, silently, on a path no
8
+ * test happens to exercise. That is not hypothetical: while building
9
+ * `provider-log-fields.test.ts` a mutation renaming `productId` to `product` at the
10
+ * "No orderId in product purchase" site **passed all 13 of its tests**, because that
11
+ * site is not one of the ones asserted. Covering ~100 sites individually to close
12
+ * that gap is not maintainable; checking the vocabulary once, over all of them, is.
13
+ *
14
+ * The vocabulary lives in `log-format.ts`'s module doc and is parsed out of it here,
15
+ * so there is exactly one list. A doc comment is an odd place for an enforced
16
+ * contract, but the alternative — an exported `const` array — would ship a
17
+ * test-only value in the bundle that `npm run size` gates.
18
+ *
19
+ * What this test cannot do: it does not know whether a field is *correctly named*
20
+ * for its value, only that the name is one of the sanctioned ones. `bundleId:
21
+ * tx.productId` passes here. Per-site assertions in `provider-log-fields.test.ts`
22
+ * cover that for the paths that matter.
23
+ */
24
+ export {};
25
+ //# sourceMappingURL=field-vocabulary.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field-vocabulary.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/field-vocabulary.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * What the Apple and Google providers actually put on a log line.
3
+ *
4
+ * These paths had **no log assertions at all** before this file, which is worth
5
+ * stating plainly: the 49 call sites in `providers/apple.ts` and
6
+ * `providers/google.ts` could have been migrated to `(message, fields)` — or
7
+ * broken — and the whole suite would have stayed green either way. So this file
8
+ * is not belt-and-braces on top of `log-format.test.ts`; it is the only thing
9
+ * that holds the providers to the contract.
10
+ *
11
+ * It tests through the real provider functions rather than through
12
+ * `formatLogArgs`, because the two failure modes that matter are call-site
13
+ * failures a pure formatter test cannot see:
14
+ *
15
+ * 1. **A value left in the message.** `formatLogArgs` escapes whatever it is
16
+ * given; it cannot know that `bundleId` should have been a field. Only an
17
+ * assertion on the rendered line catches an interpolated value.
18
+ * 2. **A field named differently in two places.** The point of moving values
19
+ * out of the message is that an operator can filter on `productId`. That is
20
+ * lost the moment one file calls it `product` — and nothing but an exact
21
+ * assertion notices.
22
+ *
23
+ * Hence exact-line assertions, not `toContain`. A substring match would pass on
24
+ * `productId=x` *and* on a message that happened to mention it.
25
+ */
26
+ export {};
27
+ //# sourceMappingURL=provider-log-fields.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider-log-fields.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/provider-log-fields.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * What the routes, stores and webhook handlers put on a log line.
3
+ *
4
+ * This is the half of the migration that delivers the point of it. `userId` does not
5
+ * exist in the provider layer — it arrives in a request body — so "show me every
6
+ * rejection for this user" only became answerable when these call sites moved.
7
+ * `provider-log-fields.test.ts` covers Apple and Google; this covers the other 54.
8
+ *
9
+ * Driven through HTTP with supertest rather than by calling handlers, because two of
10
+ * the values under test (`userId`, `bundleId`) are attacker-supplied through the
11
+ * request and the escaping only matters on that path. `bundleId` in particular is
12
+ * read out of an **unverified** JWS by `peekAppleBundleId`, which makes
13
+ * `apps.ts`'s "No app configured" line the most attacker-reachable log site in the
14
+ * package.
15
+ *
16
+ * Exact-line assertions again, for the reason given in `provider-log-fields.test.ts`:
17
+ * a substring match cannot tell a field from a sentence that mentions the value.
18
+ */
19
+ export {};
20
+ //# sourceMappingURL=route-log-fields.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route-log-fields.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/route-log-fields.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG"}
@@ -1 +1 @@
1
- {"version":3,"file":"apps.d.ts","sourceRoot":"","sources":["../src/apps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAG1E;;;;;;;GAOG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,eAAe,EAAE,CAAC;IACjC,QAAQ,CAAC,UAAU,EAAE,eAAe,GAAG,SAAS,CAAC;IACjD;;;;OAIG;IACH,SAAS,CAAC,IAAI,EAAE,OAAO,GAAG,kBAAkB,CAAC;CAC9C;AAED,MAAM,WAAW,OAAO;IACtB,gEAAgE;IAChE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAClC,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CACtC;AAQD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,kBAAkB,GAAG,WAAW,CAMtE;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,kBAAkB,GAAG,WAAW,CA8DxE;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAUjE"}
1
+ {"version":3,"file":"apps.d.ts","sourceRoot":"","sources":["../src/apps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAG1E;;;;;;;GAOG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,eAAe,EAAE,CAAC;IACjC,QAAQ,CAAC,UAAU,EAAE,eAAe,GAAG,SAAS,CAAC;IACjD;;;;OAIG;IACH,SAAS,CAAC,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