@knapsack/schema-utils 4.72.0--canary.4920.be98a9b.0 → 4.72.0--canary.5313.31d559e.0

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,144 @@
1
+ # v4.71.16 (Thu Dec 05 2024)
2
+
3
+ #### 🐛 Bug Fix
4
+
5
+ - refactor React Renderer to use `tsc` for build [#5224](https://github.com/knapsack-labs/app-monorepo/pull/5224) ([@EvanLovely](https://github.com/EvanLovely) [@mabry1985](https://github.com/mabry1985))
6
+
7
+ #### Authors: 2
8
+
9
+ - Evan Lovely ([@EvanLovely](https://github.com/EvanLovely))
10
+ - Josh Mabry ([@mabry1985](https://github.com/mabry1985))
11
+
12
+ ---
13
+
14
+ # v4.71.13 (Wed Dec 04 2024)
15
+
16
+ #### 🐛 Bug Fix
17
+
18
+ - Bump version to: v4.71.12 \[skip ci\] ([@KnapsackBot](https://github.com/KnapsackBot))
19
+ - Update CHANGELOG.md \[skip ci\] ([@KnapsackBot](https://github.com/KnapsackBot))
20
+ - Bump version to: v4.71.11 \[skip ci\] ([@KnapsackBot](https://github.com/KnapsackBot))
21
+ - Merge branch 'latest' into feature/ksp-5777-gsk-sso-issues ([@illepic](https://github.com/illepic))
22
+
23
+ #### 🏠 Internal
24
+
25
+ - adds evt handlers for design src logs [#5194](https://github.com/knapsack-labs/app-monorepo/pull/5194) ([@mabry1985](https://github.com/mabry1985))
26
+ - setup login w popup [#5209](https://github.com/knapsack-labs/app-monorepo/pull/5209) ([@GormanDesign](https://github.com/GormanDesign) [@mabry1985](https://github.com/mabry1985) [@EvanLovely](https://github.com/EvanLovely) [@KnapsackBot](https://github.com/KnapsackBot) [@illepic](https://github.com/illepic))
27
+ - migrate to new Figma oAuth endpoints and configuration [#5206](https://github.com/knapsack-labs/app-monorepo/pull/5206) ([@mabry1985](https://github.com/mabry1985))
28
+
29
+ #### Authors: 5
30
+
31
+ - Christopher Bloom ([@illepic](https://github.com/illepic))
32
+ - Evan Lovely ([@EvanLovely](https://github.com/EvanLovely))
33
+ - Josh Mabry ([@mabry1985](https://github.com/mabry1985))
34
+ - KnapsackBot ([@KnapsackBot](https://github.com/KnapsackBot))
35
+ - Matt Gorman ([@GormanDesign](https://github.com/GormanDesign))
36
+
37
+ ---
38
+
39
+ # v4.71.12 (Thu Nov 21 2024)
40
+
41
+ #### 🐛 Bug Fix
42
+
43
+ - Fix component alignment in pattern stage and embeds [#5138](https://github.com/knapsack-labs/app-monorepo/pull/5138) ([@GormanDesign](https://github.com/GormanDesign))
44
+ - Merge branch 'latest' into feature/ksp-5732-fix-component-alignment-in-pattern-stage-and-embeds ([@GormanDesign](https://github.com/GormanDesign))
45
+
46
+ #### Authors: 1
47
+
48
+ - Matt Gorman ([@GormanDesign](https://github.com/GormanDesign))
49
+
50
+ ---
51
+
52
+ # v4.71.10 (Thu Nov 21 2024)
53
+
54
+ #### 🐛 Bug Fix
55
+
56
+ - fix prop reordering doesnt stick [#5196](https://github.com/knapsack-labs/app-monorepo/pull/5196) ([@mabry1985](https://github.com/mabry1985))
57
+
58
+ #### Authors: 1
59
+
60
+ - Josh Mabry ([@mabry1985](https://github.com/mabry1985))
61
+
62
+ ---
63
+
64
+ # v4.71.9 (Wed Nov 20 2024)
65
+
66
+ #### 🏠 Internal
67
+
68
+ - setup TS strict mode KSP-5492 [#5183](https://github.com/knapsack-labs/app-monorepo/pull/5183) ([@EvanLovely](https://github.com/EvanLovely))
69
+
70
+ #### Authors: 1
71
+
72
+ - Evan Lovely ([@EvanLovely](https://github.com/EvanLovely))
73
+
74
+ ---
75
+
76
+ # v4.71.8 (Fri Nov 15 2024)
77
+
78
+ #### 🐛 Bug Fix
79
+
80
+ - Merge branch 'latest' into feature/KSP-5764-add-button-modes ([@brittanysmart](https://github.com/brittanysmart))
81
+ - Merge branch 'latest' into GormanDesign-patch-2 ([@GormanDesign](https://github.com/GormanDesign))
82
+
83
+ #### 🏠 Internal
84
+
85
+ - update gsk-digital-channels sso page content [#5178](https://github.com/knapsack-labs/app-monorepo/pull/5178) ([@GormanDesign](https://github.com/GormanDesign))
86
+ - fix figma tiles show processing message indefinitely [#5179](https://github.com/knapsack-labs/app-monorepo/pull/5179) ([@mabry1985](https://github.com/mabry1985))
87
+
88
+ #### Authors: 3
89
+
90
+ - Brittany Smart ([@brittanysmart](https://github.com/brittanysmart))
91
+ - Josh Mabry ([@mabry1985](https://github.com/mabry1985))
92
+ - Matt Gorman ([@GormanDesign](https://github.com/GormanDesign))
93
+
94
+ ---
95
+
96
+ # v4.71.6 (Thu Nov 14 2024)
97
+
98
+ #### 🐛 Bug Fix
99
+
100
+ - Merge branch 'latest' into feature/ksp-5437-update-auth0-node-sdk ([@freneticpixel](https://github.com/freneticpixel))
101
+ - Merge branch 'latest' into feature/ksp-5710-collections-block-filters ([@GormanDesign](https://github.com/GormanDesign))
102
+ - Merge remote-tracking branch 'origin/latest' into feature/ksp-5437-update-auth0-node-sdk ([@freneticpixel](https://github.com/freneticpixel))
103
+
104
+ #### Authors: 2
105
+
106
+ - Jim Frenette ([@freneticpixel](https://github.com/freneticpixel))
107
+ - Matt Gorman ([@GormanDesign](https://github.com/GormanDesign))
108
+
109
+ ---
110
+
111
+ # v4.71.5 (Tue Nov 05 2024)
112
+
113
+ #### 🐛 Bug Fix
114
+
115
+ - Merge branch 'latest' into feature/ksp-5712-collection-names-containing-periods-eg-1-base-breaks-the ([@GormanDesign](https://github.com/GormanDesign))
116
+ - Merge branch 'latest' into feature/ksp-5668-handle-figma-blocks-when-updating-design-source-file ([@GormanDesign](https://github.com/GormanDesign))
117
+
118
+ #### 🏠 Internal
119
+
120
+ - Update dependency tslib to ^2.8.1 [#5095](https://github.com/knapsack-labs/app-monorepo/pull/5095) ([@renovate[bot]](https://github.com/renovate[bot]))
121
+ - Update Typescript [#5051](https://github.com/knapsack-labs/app-monorepo/pull/5051) ([@renovate[bot]](https://github.com/renovate[bot]))
122
+
123
+ #### Authors: 2
124
+
125
+ - [@renovate[bot]](https://github.com/renovate[bot])
126
+ - Matt Gorman ([@GormanDesign](https://github.com/GormanDesign))
127
+
128
+ ---
129
+
130
+ # v4.71.4 (Tue Oct 29 2024)
131
+
132
+ #### 🏠 Internal
133
+
134
+ - Update dependency tslib to ^2.8.0 [#5025](https://github.com/knapsack-labs/app-monorepo/pull/5025) ([@renovate[bot]](https://github.com/renovate[bot]))
135
+
136
+ #### Authors: 1
137
+
138
+ - [@renovate[bot]](https://github.com/renovate[bot])
139
+
140
+ ---
141
+
1
142
  # v4.71.1 (Wed Oct 23 2024)
2
143
 
3
144
  #### 🐛 Bug Fix
@@ -1,18 +1,2 @@
1
- 'use strict';
2
-
3
- var l = require('ajv');
4
- var g = require('ajv-keywords/keywords/typeof.js');
5
-
6
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
7
-
8
- var l__default = /*#__PURE__*/_interopDefault(l);
9
- var g__default = /*#__PURE__*/_interopDefault(g);
10
-
11
- var m=Object.defineProperty;var t=(e,r)=>m(e,"name",{value:r,configurable:!0});var s=new l__default.default;g__default.default(s);var c=new l__default.default({useDefaults:!0});function d(e){let r=s.validateSchema(e);return {ok:r,message:r?"":`Schema itself is not valid. ${s.errorsText()}`}}t(d,"validateSchema");function v(e,r){let{ok:a,message:n}=d(e);if(!a)return {ok:!1,message:n,data:r};let o={...r},i=!!c.validate(e,o);return {ok:i,message:i?"":c.errorsText(),data:o}}t(v,"validateSchemaAndAssignDefaults");function p(e,r){let{ok:a,message:n}=d(e);if(!a)return {ok:!1,message:n};let o=!!s.validate(e,r);return {ok:o,message:o?"":s.errorsText(),errors:o?[]:s.errors}}t(p,"validateDataAgainstSchema");
12
-
13
- exports.ajv = s;
14
- exports.validateDataAgainstSchema = p;
15
- exports.validateSchema = d;
16
- exports.validateSchemaAndAssignDefaults = v;
17
- //# sourceMappingURL=schema-utils.js.map
1
+ 'use strict';var l=require('ajv'),g=require('ajv-keywords/keywords/typeof.js');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var l__default=/*#__PURE__*/_interopDefault(l);var g__default=/*#__PURE__*/_interopDefault(g);var m=Object.defineProperty;var t=(e,r)=>m(e,"name",{value:r,configurable:!0});var s=new l__default.default;g__default.default(s);var c=new l__default.default({useDefaults:!0});function d(e){let r=s.validateSchema(e);return {ok:r,message:r?"":`Schema itself is not valid. ${s.errorsText()}`}}t(d,"validateSchema");function v(e,r){let{ok:a,message:n}=d(e);if(!a)return {ok:!1,message:n,data:r};let o={...r},i=!!c.validate(e,o);return {ok:i,message:i?"":c.errorsText(),data:o}}t(v,"validateSchemaAndAssignDefaults");function p(e,r){let{ok:a,message:n}=d(e);if(!a)return {ok:!1,message:n};let o=!!s.validate(e,r);return {ok:o,message:o?"":s.errorsText(),errors:o?[]:s.errors||[]}}t(p,"validateDataAgainstSchema");exports.ajv=s;exports.validateDataAgainstSchema=p;exports.validateSchema=d;exports.validateSchemaAndAssignDefaults=v;//# sourceMappingURL=schema-utils.js.map
18
2
  //# sourceMappingURL=schema-utils.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/schema-utils.ts"],"names":["ajv","Ajv","addTypeofKeyword","ajvDefaults","validateSchema","schema","isSchemaValid","__name","validateSchemaAndAssignDefaults","data","ok","message","newData","isValid","validateDataAgainstSchema"],"mappings":";;;;;;;;;;AAAA,IAAA,CAAA,CAAA,MAAA,CAAA,cAAA,CAAA,IAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAA,CAAA,CAAA,CAAA,CAAA,MAAA,CAAA,CAAA,KAAA,CAAA,CAAA,CAAA,YAAA,CAAA,CAAA,CAAA,CAAA,CAAA,KAGaA,CAAM,CAAA,IAAIC,mBAEvBC,kBAAAA,CAAiBF,CAAG,CAIpB,CAAA,IAAMG,CAAc,CAAA,IAAIF,mBAAI,CAC1B,WAAA,CAAa,CACf,CAAA,CAAC,EAOM,SAASG,CAAAA,CAAeC,CAG7B,CAAA,CACA,IAAMC,CAAgBN,CAAAA,CAAAA,CAAI,cAAeK,CAAAA,CAAM,EAC/C,OAAO,CACL,EAAI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.com/epoberezkin/ajv\nimport addTypeofKeyword from 'ajv-keywords/keywords/typeof.js';\n\nexport const ajv = new Ajv();\n\naddTypeofKeyword(ajv);\n\ntype ajvErrors = import('ajv').ErrorObject[];\n\nconst ajvDefaults = new Ajv({\n useDefaults: true,\n});\n\n/**\n * Validate Schema itself (metaSchema)\n * Validates against contents of the `$schema` field\n * @link https://github.com/epoberezkin/ajv#validateschemaobject-schema---boolean\n */\nexport function validateSchema(schema: Record<string, unknown>): {\n ok: boolean;\n message: string;\n} {\n const isSchemaValid = ajv.validateSchema(schema);\n return {\n ok: isSchemaValid,\n message: isSchemaValid\n ? ''\n : `Schema itself is not valid. ${ajv.errorsText()}`,\n };\n}\n\n/**\n * Validate Schema and Assign Defaults\n * Any `default` on properties will be added if that property is absent\n * @link https://github.com/epoberezkin/ajv#assigning-defaults\n */\nexport function validateSchemaAndAssignDefaults<T>(\n schema: Record<string, unknown>,\n data: T,\n): { ok: boolean; message: string; data: T } {\n const { ok, message } = validateSchema(schema);\n if (!ok) {\n return {\n ok: false,\n message,\n data,\n };\n }\n\n const newData = { ...data };\n // This `validate` function mutates `newData`, so that's why we created a new object above first.\n const isValid = !!ajvDefaults.validate(schema, newData);\n return {\n ok: isValid,\n message: isValid ? '' : ajvDefaults.errorsText(),\n data: newData,\n };\n}\n\n/**\n * Validate Data against Schema\n * @link https://github.com/epoberezkin/ajv\n */\nexport function validateDataAgainstSchema<T>(\n schema: Record<string, unknown>,\n data: T,\n): {\n ok: boolean;\n message: string;\n errors?: ajvErrors;\n} {\n const { ok, message } = validateSchema(schema);\n if (!ok) {\n return {\n ok: false,\n message,\n };\n }\n\n const isValid = !!ajv.validate(schema, data);\n return {\n ok: isValid,\n message: isValid ? '' : ajv.errorsText(),\n errors: isValid ? [] : ajv.errors,\n };\n}\n\n//\n"]}
1
+ {"version":3,"sources":["../src/schema-utils.ts"],"names":["ajv","Ajv","addTypeofKeyword","ajvDefaults","validateSchema","schema","isSchemaValid","__name","validateSchemaAndAssign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AAA,SAASM,EACdT,CACAI,CAAAA,CAAAA,CAKA,CACA,GAAM,CAAE,EAAAC,CAAAA,CAAAA,CAAI,QAAAC,CAAQ,CAAA,CAAIP,EAAeC,CAAM,CAAA,CAC7C,GAAI,CAACK,EACH,OAAO,CACL,EAAI,CAAA,CAAA,CAAA,CACJ,QAAAC,CACF,CAAA,CAGF,IAAME,CAAAA,CAAU,CAAC,CAACb,CAAAA,CAAI,SAASK,CAAQI,CAAAA,CAAI,EAC3C,OAAO,CACL,EAAII,CAAAA,CAAAA,CACJ,QAASA,CAAU,CAAA,EAAA,CAAKb,CAAI,CAAA,UAAA,GAC5B,MAAQa,CAAAA,CAAAA,CAAU,EAAC,CAAIb,EAAI,MAAU,EAAA,EACvC,CACF,CAtBgBO,EAAAO,CAAA,CAAA,2BAAA,CAAA","file":"schema-utils.js","sourcesContent":["import Ajv from 'ajv'; // https://github.com/epoberezkin/ajv\nimport addTypeofKeyword from 'ajv-keywords/keywords/typeof.js';\n\nexport const ajv = new Ajv();\n\naddTypeofKeyword(ajv);\n\ntype ajvErrors = import('ajv').ErrorObject[];\n\nconst ajvDefaults = new Ajv({\n useDefaults: true,\n});\n\n/**\n * Validate Schema itself (metaSchema)\n * Validates against contents of the `$schema` field\n * @link https://github.com/epoberezkin/ajv#validateschemaobject-schema---boolean\n */\nexport function validateSchema(schema: Record<string, unknown>): {\n ok: boolean;\n message: string;\n} {\n const isSchemaValid = ajv.validateSchema(schema);\n return {\n ok: isSchemaValid,\n message: isSchemaValid\n ? ''\n : `Schema itself is not valid. ${ajv.errorsText()}`,\n };\n}\n\n/**\n * Validate Schema and Assign Defaults\n * Any `default` on properties will be added if that property is absent\n * @link https://github.com/epoberezkin/ajv#assigning-defaults\n */\nexport function validateSchemaAndAssignDefaults<T>(\n schema: Record<string, unknown>,\n data: T,\n): { ok: boolean; message: string; data: T } {\n const { ok, message } = validateSchema(schema);\n if (!ok) {\n return {\n ok: false,\n message,\n data,\n };\n }\n\n const newData = { ...data };\n // This `validate` function mutates `newData`, so that's why we created a new object above first.\n const isValid = !!ajvDefaults.validate(schema, newData);\n return {\n ok: isValid,\n message: isValid ? '' : ajvDefaults.errorsText(),\n data: newData,\n };\n}\n\n/**\n * Validate Data against Schema\n * @link https://github.com/epoberezkin/ajv\n */\nexport function validateDataAgainstSchema<T>(\n schema: Record<string, unknown>,\n data: T,\n): {\n ok: boolean;\n message: string;\n errors?: ajvErrors;\n} {\n const { ok, message } = validateSchema(schema);\n if (!ok) {\n return {\n ok: false,\n message,\n };\n }\n\n const isValid = !!ajv.validate(schema, data);\n return {\n ok: isValid,\n message: isValid ? '' : ajv.errorsText(),\n errors: isValid ? [] : ajv.errors || [],\n };\n}\n\n//\n"]}
@@ -1,8 +1,2 @@
1
- import l from 'ajv';
2
- import g from 'ajv-keywords/keywords/typeof.js';
3
-
4
- var m=Object.defineProperty;var t=(e,r)=>m(e,"name",{value:r,configurable:!0});var s=new l;g(s);var c=new l({useDefaults:!0});function d(e){let r=s.validateSchema(e);return {ok:r,message:r?"":`Schema itself is not valid. ${s.errorsText()}`}}t(d,"validateSchema");function v(e,r){let{ok:a,message:n}=d(e);if(!a)return {ok:!1,message:n,data:r};let o={...r},i=!!c.validate(e,o);return {ok:i,message:i?"":c.errorsText(),data:o}}t(v,"validateSchemaAndAssignDefaults");function p(e,r){let{ok:a,message:n}=d(e);if(!a)return {ok:!1,message:n};let o=!!s.validate(e,r);return {ok:o,message:o?"":s.errorsText(),errors:o?[]:s.errors}}t(p,"validateDataAgainstSchema");
5
-
6
- export { s as ajv, p as validateDataAgainstSchema, d as validateSchema, v as validateSchemaAndAssignDefaults };
7
- //# sourceMappingURL=schema-utils.mjs.map
1
+ import l from'ajv';import g from'ajv-keywords/keywords/typeof.js';var m=Object.defineProperty;var t=(e,r)=>m(e,"name",{value:r,configurable:!0});var s=new l;g(s);var c=new l({useDefaults:!0});function d(e){let r=s.validateSchema(e);return {ok:r,message:r?"":`Schema itself is not valid. ${s.errorsText()}`}}t(d,"validateSchema");function v(e,r){let{ok:a,message:n}=d(e);if(!a)return {ok:!1,message:n,data:r};let o={...r},i=!!c.validate(e,o);return {ok:i,message:i?"":c.errorsText(),data:o}}t(v,"validateSchemaAndAssignDefaults");function p(e,r){let{ok:a,message:n}=d(e);if(!a)return {ok:!1,message:n};let o=!!s.validate(e,r);return {ok:o,message:o?"":s.errorsText(),errors:o?[]:s.errors||[]}}t(p,"validateDataAgainstSchema");export{s as ajv,p as validateDataAgainstSchema,d as validateSchema,v as validateSchemaAndAssignDefaults};//# sourceMappingURL=schema-utils.mjs.map
8
2
  //# sourceMappingURL=schema-utils.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/schema-utils.ts"],"names":["ajv","Ajv","addTypeofKeyword","ajvDefaults","validateSchema","schema","isSchemaValid","__name","validateSchemaAndAssignDefaults","data","ok","message","newData","isValid","validateDataAgainstSchema"],"mappings":";;;AAAA,IAAA,CAAA,CAAA,MAAA,CAAA,cAAA,CAAA,IAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAA,CAAA,CAAA,CAAA,CAAA,MAAA,CAAA,CAAA,KAAA,CAAA,CAAA,CAAA,YAAA,CAAA,CAAA,CAAA,CAAA,CAAA,KAGaA,CAAM,CAAA,IAAIC,EAEvBC,CAAAA,CAAiBF,CAAG,CAIpB,CAAA,IAAMG,CAAc,CAAA,IAAIF,EAAI,CAC1B,WAAA,CAAa,CACf,CAAA,CAAC,EAOM,SAASG,CAAAA,CAAeC,CAG7B,CAAA,CACA,IAAMC,CAAgBN,CAAAA,CAAAA,CAAI,cAAeK,CAAAA,CAAM,EAC/C,OAAO,CACL,EAAIC,CAAAA,CAAAA,CACJ,QAASA,CACL,CAAA,EAAA,CACA,CAA+BN,4BAAAA,EAAAA,CAAAA,CAAI,YAAY,CAAA,CACrD,CACF,CAXgBO,EAAAH,CAAA,CAAA,gBAAA,CAAA,CAkBT,SAASI,CAAAA,CACdH,EACAI,CAC2C,CAAA,CAC3C,GAAM,CAAE,GAAAC,CAAI,CAAA,OAAA,CAAAC,CAAQ,CAAA,CAAIP,EAAeC,CAAM,CAAA,CAC7C,GAAI,CAACK,EACH,OAAO,CACL,EAAI,CAAA,CAAA,CAAA,CACJ,QAAAC,CACA,CAAA,IAAA,CAAAF,CACF,CAGF,CAAA,IAAMG,EAAU,CAAE,GAAGH,CAAK,CAAA,CAEpBI,EAAU,CAAC,CAACV,CAAY,CAAA,QAAA,CAASE,EAAQO,CAAO,CAAA,CACtD,OAAO,CACL,GAAIC,CACJ,CAAA,OAAA,CAASA,CAAU,CAAA,EAAA,CAAKV,EAAY,UAAW,EAAA,CAC/C,IAAMS,CAAAA,CACR,CACF,CArBgBL,CAAAA,CAAAC,CAAA,CAAA,iCAAA,CAAA,CA2BT,SAASM,CACdT,CAAAA,CAAAA,CACAI,CAKA,CAAA,CACA,GAAM,CAAE,EAAA,CAAAC,EAAI,OAAAC,CAAAA,CAAQ,EAAIP,CAAeC,CAAAA,CAAM,CAC7C,CAAA,GAAI,CAACK,CACH,CAAA,OAAO,CACL,EAAA,CAAI,GACJ,OAAAC,CAAAA,CACF,CAGF,CAAA,IAAME,EAAU,CAAC,CAACb,CAAI,CAAA,QAAA,CAASK,EAAQI,CAAI,CAAA,CAC3C,OAAO,CACL,GAAII,CACJ,CAAA,OAAA,CAASA,CAAU,CAAA,EAAA,CAAKb,EAAI,UAAW,EAAA,CACvC,MAAQa,CAAAA,CAAAA,CAAU,EAAKb,CAAAA,CAAAA,CAAI,MAC7B,CACF,CAtBgBO,EAAAO,CAAA,CAAA,2BAAA,CAAA","file":"schema-utils.mjs","sourcesContent":["import Ajv from 'ajv'; // https://github.com/epoberezkin/ajv\nimport addTypeofKeyword from 'ajv-keywords/keywords/typeof.js';\n\nexport const ajv = new Ajv();\n\naddTypeofKeyword(ajv);\n\ntype ajvErrors = import('ajv').ErrorObject[];\n\nconst ajvDefaults = new Ajv({\n useDefaults: true,\n});\n\n/**\n * Validate Schema itself (metaSchema)\n * Validates against contents of the `$schema` field\n * @link https://github.com/epoberezkin/ajv#validateschemaobject-schema---boolean\n */\nexport function validateSchema(schema: Record<string, unknown>): {\n ok: boolean;\n message: string;\n} {\n const isSchemaValid = ajv.validateSchema(schema);\n return {\n ok: isSchemaValid,\n message: isSchemaValid\n ? ''\n : `Schema itself is not valid. ${ajv.errorsText()}`,\n };\n}\n\n/**\n * Validate Schema and Assign Defaults\n * Any `default` on properties will be added if that property is absent\n * @link https://github.com/epoberezkin/ajv#assigning-defaults\n */\nexport function validateSchemaAndAssignDefaults<T>(\n schema: Record<string, unknown>,\n data: T,\n): { ok: boolean; message: string; data: T } {\n const { ok, message } = validateSchema(schema);\n if (!ok) {\n return {\n ok: false,\n message,\n data,\n };\n }\n\n const newData = { ...data };\n // This `validate` function mutates `newData`, so that's why we created a new object above first.\n const isValid = !!ajvDefaults.validate(schema, newData);\n return {\n ok: isValid,\n message: isValid ? '' : ajvDefaults.errorsText(),\n data: newData,\n };\n}\n\n/**\n * Validate Data against Schema\n * @link https://github.com/epoberezkin/ajv\n */\nexport function validateDataAgainstSchema<T>(\n schema: Record<string, unknown>,\n data: T,\n): {\n ok: boolean;\n message: string;\n errors?: ajvErrors;\n} {\n const { ok, message } = validateSchema(schema);\n if (!ok) {\n return {\n ok: false,\n message,\n };\n }\n\n const isValid = !!ajv.validate(schema, data);\n return {\n ok: isValid,\n message: isValid ? '' : ajv.errorsText(),\n errors: isValid ? [] : ajv.errors,\n };\n}\n\n//\n"]}
1
+ {"version":3,"sources":["../src/schema-utils.ts"],"names":["ajv","Ajv","addTypeofKeyword","ajvDefaults","validateSchema","schema","isSchemaValid","__name","validateSchemaAndAssignDefaults","data","ok","message","newData","isValid","validateDataAgainstSchema"],"mappings":"kEAAA,IAAA,CAAA,CAAA,MAAA,CAAA,cAAA,CAAA,IAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAA,CAAA,CAAA,CAAA,CAAA,MAAA,CAAA,CAAA,KAAA,CAAA,CAAA,CAAA,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AAA,CAGF,IAAME,CAAAA,CAAU,CAAC,CAACb,CAAAA,CAAI,SAASK,CAAQI,CAAAA,CAAI,EAC3C,OAAO,CACL,EAAII,CAAAA,CAAAA,CACJ,QAASA,CAAU,CAAA,EAAA,CAAKb,CAAI,CAAA,UAAA,GAC5B,MAAQa,CAAAA,CAAAA,CAAU,EAAC,CAAIb,EAAI,MAAU,EAAA,EACvC,CACF,CAtBgBO,EAAAO,CAAA,CAAA,2BAAA,CAAA","file":"schema-utils.mjs","sourcesContent":["import Ajv from 'ajv'; // https://github.com/epoberezkin/ajv\nimport addTypeofKeyword from 'ajv-keywords/keywords/typeof.js';\n\nexport const ajv = new Ajv();\n\naddTypeofKeyword(ajv);\n\ntype ajvErrors = import('ajv').ErrorObject[];\n\nconst ajvDefaults = new Ajv({\n useDefaults: true,\n});\n\n/**\n * Validate Schema itself (metaSchema)\n * Validates against contents of the `$schema` field\n * @link https://github.com/epoberezkin/ajv#validateschemaobject-schema---boolean\n */\nexport function validateSchema(schema: Record<string, unknown>): {\n ok: boolean;\n message: string;\n} {\n const isSchemaValid = ajv.validateSchema(schema);\n return {\n ok: isSchemaValid,\n message: isSchemaValid\n ? ''\n : `Schema itself is not valid. ${ajv.errorsText()}`,\n };\n}\n\n/**\n * Validate Schema and Assign Defaults\n * Any `default` on properties will be added if that property is absent\n * @link https://github.com/epoberezkin/ajv#assigning-defaults\n */\nexport function validateSchemaAndAssignDefaults<T>(\n schema: Record<string, unknown>,\n data: T,\n): { ok: boolean; message: string; data: T } {\n const { ok, message } = validateSchema(schema);\n if (!ok) {\n return {\n ok: false,\n message,\n data,\n };\n }\n\n const newData = { ...data };\n // This `validate` function mutates `newData`, so that's why we created a new object above first.\n const isValid = !!ajvDefaults.validate(schema, newData);\n return {\n ok: isValid,\n message: isValid ? '' : ajvDefaults.errorsText(),\n data: newData,\n };\n}\n\n/**\n * Validate Data against Schema\n * @link https://github.com/epoberezkin/ajv\n */\nexport function validateDataAgainstSchema<T>(\n schema: Record<string, unknown>,\n data: T,\n): {\n ok: boolean;\n message: string;\n errors?: ajvErrors;\n} {\n const { ok, message } = validateSchema(schema);\n if (!ok) {\n return {\n ok: false,\n message,\n };\n }\n\n const isValid = !!ajv.validate(schema, data);\n return {\n ok: isValid,\n message: isValid ? '' : ajv.errorsText(),\n errors: isValid ? [] : ajv.errors || [],\n };\n}\n\n//\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@knapsack/schema-utils",
3
3
  "description": "A Knapsack component that helps build Design Systems",
4
- "version": "4.72.0--canary.4920.be98a9b.0",
4
+ "version": "4.72.0--canary.5313.31d559e.0",
5
5
  "source": "src/schema-utils.ts",
6
6
  "main": "dist/schema-utils.js",
7
7
  "module": "dist/schema-utils.mjs",
@@ -26,13 +26,13 @@
26
26
  "dependencies": {
27
27
  "ajv": "^6.12.6",
28
28
  "ajv-keywords": "^3.5.2",
29
- "tslib": "^2.8.0"
29
+ "tslib": "^2.8.1"
30
30
  },
31
31
  "devDependencies": {
32
- "@knapsack/eslint-config-starter": "4.72.0--canary.4920.be98a9b.0",
33
- "@knapsack/typescript-config-starter": "4.72.0--canary.4920.be98a9b.0",
32
+ "@knapsack/eslint-config-starter": "4.72.0--canary.5313.31d559e.0",
33
+ "@knapsack/typescript-config-starter": "4.72.0--canary.5313.31d559e.0",
34
34
  "eslint": "^8.57.0",
35
- "tsup": "^8.3.0"
35
+ "tsup": "^8.3.5"
36
36
  },
37
37
  "license": "GPL-2.0-or-later",
38
38
  "publishConfig": {
@@ -43,5 +43,5 @@
43
43
  "directory": "libs/schema-utils",
44
44
  "type": "git"
45
45
  },
46
- "gitHead": "be98a9b39ed70c97fd88e8359e5420250a582b6f"
46
+ "gitHead": "31d559ecb396c0d66f822f42bd0256c931ad6d4c"
47
47
  }