@onabl/contracts 0.4.0 → 0.4.1

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/dist/tenants.d.ts CHANGED
@@ -24,6 +24,7 @@ export declare const UpdateSettingsSchema: z.ZodObject<{
24
24
  currency: z.ZodOptional<z.ZodString>;
25
25
  currencySymbol: z.ZodOptional<z.ZodString>;
26
26
  locale: z.ZodOptional<z.ZodString>;
27
+ timezone: z.ZodOptional<z.ZodString>;
27
28
  numberingPrefix: z.ZodOptional<z.ZodString>;
28
29
  }, z.core.$strip>;
29
30
  export type UpdateSettings = z.infer<typeof UpdateSettingsSchema>;
@@ -1 +1 @@
1
- {"version":3,"file":"tenants.d.ts","sourceRoot":"","sources":["../src/tenants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAGtB,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;iBA0B/B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,uBAAuB;;iBAElC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC"}
1
+ {"version":3,"file":"tenants.d.ts","sourceRoot":"","sources":["../src/tenants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAGtB,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiC/B,CAAC;AAWH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,uBAAuB;;iBAElC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC"}
package/dist/tenants.js CHANGED
@@ -28,8 +28,24 @@ exports.UpdateSettingsSchema = zod_1.z.object({
28
28
  currency: zod_1.z.string().length(3).optional(),
29
29
  currencySymbol: zod_1.z.string().trim().min(1).max(4).optional(),
30
30
  locale: zod_1.z.string().trim().min(2).max(35).optional(),
31
+ timezone: zod_1.z
32
+ .string()
33
+ .trim()
34
+ .min(1)
35
+ .max(64)
36
+ .refine(isValidTimeZone, { message: "Not a valid IANA timezone (e.g. Africa/Johannesburg)" })
37
+ .optional(),
31
38
  numberingPrefix: zod_1.z.string().trim().min(2).max(5).optional(),
32
39
  });
40
+ function isValidTimeZone(value) {
41
+ try {
42
+ new Intl.DateTimeFormat("en", { timeZone: value });
43
+ return true;
44
+ }
45
+ catch {
46
+ return false;
47
+ }
48
+ }
33
49
  exports.UpdateDefaultFormSchema = zod_1.z.object({
34
50
  formId: zod_1.z.string().uuid().nullable(),
35
51
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onabl/contracts",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Zod request/response validation schemas for onabl's public API — the SDK's typed contract with the API.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -23,8 +23,8 @@
23
23
  },
24
24
  "devDependencies": {
25
25
  "eslint": "latest",
26
- "@onabl/typescript-config": "0.0.1",
27
- "@onabl/eslint-config": "0.0.1"
26
+ "@onabl/eslint-config": "0.0.1",
27
+ "@onabl/typescript-config": "0.0.1"
28
28
  },
29
29
  "dependencies": {
30
30
  "@onabl/types": "0.5.0"