@faststore/api 4.7.0-dev.4 → 4.7.0-dev.6

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/platforms/vtex/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,aAAa,EAAY,MAAM,SAAS,CAAA;AAKtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAExC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAIxC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAG9C,MAAM,WAAW,cAAc;IAC7B,uBAAuB;IACvB,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,EAAE,OAAO,CAAA;IAChB;;;;;SAKK;IACL,OAAO,EAAE;QACP,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAA;QAC1B,MAAM,EAAE,MAAM,CAAA;QACd,KAAK,EAAE,YAAY,CAAA;QACnB,UAAU,CAAC,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;QACrC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;QAC5C;;;;;WAKG;QACH,wBAAwB,CAAC,EAAE,GAAG,CAC5B,MAAM,EACN,OAAO,CAAC,OAAO,mBAAmB,EAAE,qBAAqB,GAAG,IAAI,CAAC,CAClE,CAAA;KACF,CAAA;IACD,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/B,OAAO,EAAE,MAAM,CAAA;IACf,YAAY,EAAE,OAAO,CAAA;IACrB,qFAAqF;IACrF,eAAe,CAAC,EAAE,MAAM,CA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAA6tiB,CAAC;mBAAsB,CAAC;kBAAqB,CAAC;yBAA8B,CAAC;uBAA0B,CAAC;yBAA4B,CAAC;uBAA0B,CAAC;iBAAoB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAAiia,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAlBj39B;AAED,wBAAgB,iBAAiB,CAAC,WAAW,CAAC,EAAE,aAAa,iBAe5D"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/platforms/vtex/resolvers/index.ts"],"names":[],"mappings":"AA0CA,eAAO,MAAM,YAAY;;;;;;oJAC8pF,mCAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAAyxiB,CAAC;mBAAsB,CAAC;kBAAqB,CAAC;yBAA8B,CAAC;uBAA0B,CAAC;yBAA4B,CAAC;uBAA0B,CAAC;iBAAoB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAAiia,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CADvoiC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/platforms/vtex/resolvers/index.ts"],"names":[],"mappings":"AA0CA,eAAO,MAAM,YAAY;;;;;;oJAC0tF,mCAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AE,MAAM,GACb,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC,CA4BvC;AAqBD,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,IAAI,CAAC,CAAC,GAAG;IACjE,MAAM,EAAE,eAAe,CACrB,IAAI,EACJ,GAAG,EACH,KAAK,CAAC,uBAAuB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,CAAC,CAC9D,CAAA;IAED,WAAW,EAAE,eAAe,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,CAAA;IAE7C,KAAK,EAAE,eAAe,CAAC,IAAI,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC,CAAA;CA0OhD,CAAA"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * `StoreProduct.releaseDate` is documented in the schema as ISO 8601, but
3
+ * Intelligent Search delivers whatever the account has stored — epoch
4
+ * milliseconds for some, an ISO string for others. Normalizing here keeps the
5
+ * resolver honest about the contract it advertises.
6
+ */
7
+ /**
8
+ * Normalizes a release date to an ISO 8601 calendar date (`YYYY-MM-DD`).
9
+ *
10
+ * Accepts epoch milliseconds, epoch seconds, and date strings. Returns an empty
11
+ * string when the input is absent or unparseable — never throws, and never
12
+ * returns `"Invalid Date"`.
13
+ *
14
+ * The calendar day is always taken in UTC, so a build produces the same markup
15
+ * on any machine. An input carrying a timezone offset is converted first, which
16
+ * means `2026-03-23T21:00:00-05:00` normalizes to `2026-03-24`. That is
17
+ * deliberate: preserving the source calendar day would make the output depend on
18
+ * the offset embedded in each record. An input with no timezone designator is
19
+ * read as UTC rather than as host-local time, for the same reason.
20
+ */
21
+ export declare const normalizeReleaseDate: (value: string | number | null | undefined) => string;
22
+ //# sourceMappingURL=releaseDate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"releaseDate.d.ts","sourceRoot":"","sources":["../../../../../src/platforms/vtex/utils/releaseDate.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA8BH;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,oBAAoB,GAC/B,OAAO,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,KACxC,MAkBF,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faststore/api",
3
- "version": "4.7.0-dev.4",
3
+ "version": "4.7.0-dev.6",
4
4
  "license": "MIT",
5
5
  "main": "dist/cjs/index.js",
6
6
  "typings": "dist/src/index.d.ts",
@@ -58,11 +58,11 @@
58
58
  "vite": "7.1.5",
59
59
  "vite-plugin-dts": "4.5.4",
60
60
  "vitest": "4.0.18",
61
- "@faststore/diagnostics": "^4.7.0-dev.4"
61
+ "@faststore/diagnostics": "^4.7.0-dev.6"
62
62
  },
63
63
  "peerDependencies": {
64
64
  "graphql": "16.11.0",
65
- "@faststore/diagnostics": "4.7.0-dev.4"
65
+ "@faststore/diagnostics": "4.7.0-dev.6"
66
66
  },
67
67
  "publishConfig": {
68
68
  "access": "public"
@@ -16,6 +16,7 @@ import {
16
16
  attributeToPropertyValue,
17
17
  VALUE_REFERENCES,
18
18
  } from '../utils/propertyValue'
19
+ import { normalizeReleaseDate } from '../utils/releaseDate'
19
20
  import { slugify } from '../utils/slugify'
20
21
  import type { Query } from './query'
21
22
 
@@ -298,7 +299,8 @@ export const StoreProduct: Record<string, GraphqlResolver<Root>> & {
298
299
  skuSpecifications ?? [],
299
300
  specificationGroups: ({ isVariantOf: { specificationGroups } }) =>
300
301
  specificationGroups,
301
- releaseDate: ({ isVariantOf: { releaseDate } }) => releaseDate ?? '',
302
+ releaseDate: ({ isVariantOf: { releaseDate } }) =>
303
+ normalizeReleaseDate(releaseDate),
302
304
  advertisement: ({ isVariantOf: { advertisement } }) => advertisement,
303
305
  deliveryPromiseBadges: ({ isVariantOf: { deliveryPromisesBadges } }) =>
304
306
  deliveryPromisesBadges,
@@ -0,0 +1,70 @@
1
+ /**
2
+ * `StoreProduct.releaseDate` is documented in the schema as ISO 8601, but
3
+ * Intelligent Search delivers whatever the account has stored — epoch
4
+ * milliseconds for some, an ISO string for others. Normalizing here keeps the
5
+ * resolver honest about the contract it advertises.
6
+ */
7
+
8
+ // Epoch values are disambiguated by magnitude, not digit count: anything at or
9
+ // above this is milliseconds (>= 1973-03-03), anything below is seconds. A
10
+ // millisecond value under the threshold is read as seconds — accepted, since no
11
+ // real catalog carries a release date that early, and a digit-count heuristic
12
+ // leaves a strictly larger hole (9-digit seconds and 12-digit milliseconds both
13
+ // fall through to the string parser, which reads them as a year).
14
+ const MILLISECONDS_THRESHOLD = 1e11
15
+
16
+ const isAllDigits = (value: string) => /^\d+$/.test(value)
17
+
18
+ // An ISO date-time with no timezone designator. `new Date()` reads these as
19
+ // host-local time (date-only forms are already read as UTC), which would make
20
+ // the emitted calendar day depend on the build machine's zone.
21
+ const ISO_DATE_TIME_WITHOUT_ZONE =
22
+ /^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}(:\d{2}(\.\d+)?)?$/
23
+
24
+ const toDate = (value: string): Date => {
25
+ if (!isAllDigits(value)) {
26
+ return new Date(
27
+ ISO_DATE_TIME_WITHOUT_ZONE.test(value) ? `${value}Z` : value
28
+ )
29
+ }
30
+
31
+ const epoch = Number(value)
32
+
33
+ return new Date(epoch >= MILLISECONDS_THRESHOLD ? epoch : epoch * 1000)
34
+ }
35
+
36
+ /**
37
+ * Normalizes a release date to an ISO 8601 calendar date (`YYYY-MM-DD`).
38
+ *
39
+ * Accepts epoch milliseconds, epoch seconds, and date strings. Returns an empty
40
+ * string when the input is absent or unparseable — never throws, and never
41
+ * returns `"Invalid Date"`.
42
+ *
43
+ * The calendar day is always taken in UTC, so a build produces the same markup
44
+ * on any machine. An input carrying a timezone offset is converted first, which
45
+ * means `2026-03-23T21:00:00-05:00` normalizes to `2026-03-24`. That is
46
+ * deliberate: preserving the source calendar day would make the output depend on
47
+ * the offset embedded in each record. An input with no timezone designator is
48
+ * read as UTC rather than as host-local time, for the same reason.
49
+ */
50
+ export const normalizeReleaseDate = (
51
+ value: string | number | null | undefined
52
+ ): string => {
53
+ if (value === null || value === undefined) {
54
+ return ''
55
+ }
56
+
57
+ const raw = String(value).trim()
58
+
59
+ if (raw === '') {
60
+ return ''
61
+ }
62
+
63
+ const date = toDate(raw)
64
+
65
+ if (Number.isNaN(date.getTime())) {
66
+ return ''
67
+ }
68
+
69
+ return date.toISOString().slice(0, 10)
70
+ }