@onabl/contracts 0.1.0 → 0.1.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/forms.d.ts CHANGED
@@ -51,7 +51,7 @@ export declare const FormConfigSchema: z.ZodObject<{
51
51
  showOnQuote: z.ZodBoolean;
52
52
  }, z.core.$loose>>;
53
53
  }, z.core.$strip>;
54
- tokens: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
54
+ tokens: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>;
55
55
  }, z.core.$loose>;
56
56
  export declare const CreateFormSchema: z.ZodObject<{
57
57
  name: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
@@ -1 +1 @@
1
- {"version":3,"file":"forms.d.ts","sourceRoot":"","sources":["../src/forms.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AACtB,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,qBAAqB,CAAC;AA4BpD,eAAO,MAAM,oBAAoB;;;;;;;;iBAUjB,CAAC;AAEjB,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAab,CAAC;AAEjB,eAAO,MAAM,gBAAgB;;;iBAG3B,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;iBAWjC,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC1D,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
1
+ {"version":3,"file":"forms.d.ts","sourceRoot":"","sources":["../src/forms.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AACtB,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,qBAAqB,CAAC;AA4BpD,eAAO,MAAM,oBAAoB;;;;;;;;iBAUjB,CAAC;AAEjB,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAkBb,CAAC;AAEjB,eAAO,MAAM,gBAAgB;;;iBAG3B,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;iBAWjC,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC1D,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
package/dist/forms.js CHANGED
@@ -47,7 +47,12 @@ exports.FormConfigSchema = zod_1.z
47
47
  phase2: zod_1.z.array(PricingRuleSchema),
48
48
  phase3: zod_1.z.array(PricingRuleSchema),
49
49
  }),
50
- tokens: zod_1.z.record(zod_1.z.string(), zod_1.z.union([zod_1.z.number(), zod_1.z.string()])),
50
+ // Optional, defaulting to {} — a form's stored config predating the
51
+ // tokens feature (or never migrated) has no `tokens` key at all. Same
52
+ // gap as packages/engine's calculate(), which already defends against
53
+ // this at the resolveTokens() call site; this is the same fix one layer
54
+ // up, at the point stored config JSON is first parsed.
55
+ tokens: zod_1.z.record(zod_1.z.string(), zod_1.z.union([zod_1.z.number(), zod_1.z.string()])).default({}),
51
56
  })
52
57
  .passthrough();
53
58
  exports.CreateFormSchema = zod_1.z.object({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onabl/contracts",
3
- "version": "0.1.0",
3
+ "version": "0.1.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": {