@webority/api-contract 0.150.0 → 0.151.0
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/gaps.js +2 -2
- package/dist/names.js +1 -1
- package/package.json +2 -1
package/dist/gaps.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e=[`operationWithoutId`,`bodyNotRequired`,`bodyWithoutShape`,`parameterWithoutShape`,`hubValueWithoutShape`,`replyWithoutSchema`,`schemaWithoutRequired`,`emptySchema`,`notGenerated`],t={operationWithoutId:`operations with no id`,bodyNotRequired:`request bodies not marked required`,bodyWithoutShape:`request bodies with no shape`,parameterWithoutShape:`parameters with no shape`,hubValueWithoutShape:`hub values with no shape`,replyWithoutSchema:`replies with no shape`,schemaWithoutRequired:`object schemas with no required list`,emptySchema:`empty schemas`,notGenerated:`parts of the contract not generated`},n=3
|
|
2
|
-
`)}function
|
|
1
|
+
var e=[`operationWithoutId`,`bodyNotRequired`,`bodyWithoutShape`,`parameterWithoutShape`,`hubValueWithoutShape`,`replyWithoutSchema`,`schemaWithoutRequired`,`emptySchema`,`notGenerated`],t={operationWithoutId:`operations with no id`,bodyNotRequired:`request bodies not marked required`,bodyWithoutShape:`request bodies with no shape`,parameterWithoutShape:`parameters with no shape`,hubValueWithoutShape:`hub values with no shape`,replyWithoutSchema:`replies with no shape`,schemaWithoutRequired:`object schemas with no required list`,emptySchema:`empty schemas`,notGenerated:`parts of the contract not generated`},n=3,r=`#/components/schemas/`;function i(e){return[...s(e.operations),...c(e.operations),...l(e.operations),...u(e.operations),...d(e.hubs),...f(e.operations),...p(e.schemas,m(e)),...v(e.schemas),...e.leftOut.map(e=>({kind:`notGenerated`,where:e}))]}function a(r){let i=[];for(let a of e){let e=r.filter(e=>e.kind===a).map(e=>e.where);if(e.length===0)continue;let o=e.slice(0,n).join(`, `),s=e.length>n?` and ${e.length-n} more`:``;i.push(`${e.length} ${t[a]}: ${o}${s}`)}return i.join(`
|
|
2
|
+
`)}function o(e){return e.id===``?`${e.method} ${e.path}`:e.id}function s(e){return e.filter(e=>e.id===``).map(e=>({kind:`operationWithoutId`,where:`${e.method} ${e.path}`}))}function c(e){return e.filter(e=>e.body!==null&&!e.body.required).map(e=>({kind:`bodyNotRequired`,where:o(e)}))}function l(e){return e.filter(e=>e.body!==null&&e.body.schema===null).map(e=>({kind:`bodyWithoutShape`,where:o(e)}))}function u(e){let t=[];for(let n of e)for(let e of n.parameters)Object.keys(e.schema).length===0&&t.push({kind:`parameterWithoutShape`,where:`${o(n)} ${e.place} ${e.name}`});return t}function d(e){let t=[];for(let n of e)for(let e of[...n.methods,...n.events]){let r=`${n.name}.${e.name}`;for(let n of e.parameters)Object.keys(n.schema).length===0&&t.push({kind:`hubValueWithoutShape`,where:`${r}(${n.name})`});e.result!==null&&Object.keys(e.result).length===0&&t.push({kind:`hubValueWithoutShape`,where:`${r} result`})}return t}function f(e){let t=[];for(let n of e)for(let e of n.replies)e.status.startsWith(`2`)&&e.status!==`200`&&e.status!==`204`&&e.schema===null&&t.push({kind:`replyWithoutSchema`,where:`${o(n)} ${e.status}`});return t}function p(e,t){let n=[];for(let[r,i]of e)t.has(r)&&i.properties!==void 0&&Object.keys(i.properties).length>0&&i.required===void 0&&n.push({kind:`schemaWithoutRequired`,where:r});return n}function m(e){let t=/* @__PURE__ */ new Set,n=h(e.operations,e.hubs);for(let i=n.pop();i!==void 0;i=n.pop()){if(i.$ref?.startsWith(r)){let r=i.$ref.slice(21),a=e.schemas.get(r);!t.has(r)&&a!==void 0&&(t.add(r),n.push(a))}n.push(...g(i))}return t}function h(e,t){let n=[];for(let t of e)for(let e of t.replies)e.schema!==null&&n.push(e.schema);for(let e of t){for(let t of e.methods)t.result!==null&&n.push(t.result);for(let t of e.events)n.push(...t.parameters.map(e=>e.schema)),t.result!==null&&n.push(t.result)}return n}function g(e){let t=[..._(e.properties),..._(e.patternProperties),...e.prefixItems??[],...e.allOf??[],...e.oneOf??[],...e.anyOf??[]];for(let n of[e.items,e.additionalProperties,e.unevaluatedProperties])typeof n==`object`&&n&&t.push(n);return t}function _(e){return e===void 0?[]:Object.values(e)}function v(e){let t=[];for(let[n,r]of e)Object.keys(r).length===0&&t.push({kind:`emptySchema`,where:n});return t}export{i as findGaps,a as formatGaps};
|
package/dist/names.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
var e=/[^\p{L}\p{Nd}]+/u,t=/^\p{Nd}/u,n=/^[A-Za-z_$][A-Za-z0-9_$]*$/,r=/* @__PURE__ */ new Map([[`\\`,`\\\\`],[`'`,`\\'`],[`
|
|
2
|
-
`,`\\n`],[`\r`,`\\r`],[`\u2028`,`\\u2028`],[`\u2029`,`\\u2029`]]),i=/[\\'\n\r\u2028\u2029]/g;function a(n){let r=n.split(e).filter(e=>e!==``).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``);return r===``?`Unnamed`:t.test(r)?`_${r}`:r}function o(e,t){let n=e;for(let r=2;t.has(n);r++)n=`${e}${r}`;return t.add(n),n}function s(e){return n.test(e)?e:`'${e.replace(i,e=>r.get(e)??e)}'`}function c(e){return`'${e.replace(i,e=>r.get(e)??e)}'`}export{s as propertyKey,c as quote,a as typeName,o as uniqueName};
|
|
2
|
+
`,`\\n`],[`\r`,`\\r`],[`\u2028`,`\\u2028`],[`\u2029`,`\\u2029`]]),i=/[\\'\n\r\u2028\u2029]/g;function a(n){let r=n.split(e).filter(e=>e!==``).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``);return r===``?`Unnamed`:t.test(r)?`_${r}`:r}function o(e,t){let n=e;for(let r=2;t.has(n);r++)n=`${e}${r}`;return t.add(n),n}function s(e){return e===`__proto__`?`[${c(e)}]`:n.test(e)?e:`'${e.replace(i,e=>r.get(e)??e)}'`}function c(e){return`'${e.replace(i,e=>r.get(e)??e)}'`}export{s as propertyKey,c as quote,a as typeName,o as uniqueName};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webority/api-contract",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.151.0",
|
|
4
4
|
"description": "Generates one TypeScript file of API types from a backend OpenAPI 3.0, 3.1 or 3.2 contract, as plain text, with no runtime dependencies.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"type": "module",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/node": "25.6.0",
|
|
30
|
+
"@webority/code-standards": "0.151.0",
|
|
30
31
|
"typescript": "^7.0.2",
|
|
31
32
|
"vite": "^8.3.6",
|
|
32
33
|
"vitest": "5.1.0"
|