@alpic-ai/api 0.0.0-dev.geba155b → 0.0.0-dev.gebf0dc1

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.
Files changed (2) hide show
  1. package/dist/index.mjs +9 -1
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -1606,6 +1606,14 @@ const serverFieldsSchema = z.object({
1606
1606
  });
1607
1607
  //#endregion
1608
1608
  //#region src/api.contract.ts
1609
+ const isValidIanaTimeZone = (timeZone) => {
1610
+ try {
1611
+ new Intl.DateTimeFormat("en-US", { timeZone });
1612
+ return true;
1613
+ } catch {
1614
+ return false;
1615
+ }
1616
+ };
1609
1617
  const deploymentStatusSchema = z.enum([
1610
1618
  "ongoing",
1611
1619
  "deployed",
@@ -1988,7 +1996,7 @@ const getProjectAnalyticsContractV1 = base.route({
1988
1996
  startTimestamp: z.coerce.number().describe("Start timestamp in milliseconds"),
1989
1997
  endTimestamp: z.coerce.number().describe("End timestamp in milliseconds"),
1990
1998
  timeZone: z.string().describe("IANA timezone (e.g. Europe/Paris)")
1991
- }).refine(({ startTimestamp, endTimestamp }) => endTimestamp - startTimestamp > 0, { message: "End date must be after start date" }).refine(({ startTimestamp, endTimestamp }) => endTimestamp - startTimestamp <= 26784e5, { message: "Date range must be less than 1 month" }).refine(({ timeZone }) => Intl.supportedValuesOf("timeZone").includes(timeZone), { message: "Time zone must be a valid IANA timezone" })).output(z.object({
1999
+ }).refine(({ startTimestamp, endTimestamp }) => endTimestamp - startTimestamp > 0, { message: "End date must be after start date" }).refine(({ startTimestamp, endTimestamp }) => endTimestamp - startTimestamp <= 26784e5, { message: "Date range must be less than 1 month" }).refine(({ timeZone }) => isValidIanaTimeZone(timeZone), { message: "Time zone must be a valid IANA timezone" })).output(z.object({
1992
2000
  metadata: z.object({
1993
2001
  startTimestamp: z.number(),
1994
2002
  endTimestamp: z.number(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alpic-ai/api",
3
- "version": "0.0.0-dev.geba155b",
3
+ "version": "0.0.0-dev.gebf0dc1",
4
4
  "description": "Contract for the Alpic API",
5
5
  "type": "module",
6
6
  "main": "./dist/index.mjs",