@mrleebo/prisma-ast
Advanced tools
Comparing version 0.4.3 to 0.5.0
@@ -1466,2 +1466,6 @@ 'use strict'; | ||
_proto.field = function field(name, fieldType) { | ||
if (fieldType === void 0) { | ||
fieldType = 'String'; | ||
} | ||
var subject = this.getSubject(); | ||
@@ -1475,8 +1479,10 @@ | ||
var field = { | ||
var field = subject.properties.reduce(function (memo, block) { | ||
return block.type === 'field' && block.name === name ? block : memo; | ||
}, { | ||
type: 'field', | ||
name: name, | ||
fieldType: fieldType | ||
}; | ||
subject.properties.push(field); | ||
}); | ||
if (!subject.properties.includes(field)) subject.properties.push(field); | ||
this._parent = subject; | ||
@@ -1483,0 +1489,0 @@ this._subject = field; |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("chevrotain"),t=require("os"),n=e.createToken({name:"Identifier",pattern:/[a-zA-Z]\w*/}),r=e.createToken({name:"Datasource",pattern:/datasource/,push_mode:"block"}),a=e.createToken({name:"Generator",pattern:/generator/,push_mode:"block"}),u=e.createToken({name:"Model",pattern:/model/,push_mode:"block"}),i=e.createToken({name:"Enum",pattern:/enum/,push_mode:"block"}),o=e.createToken({name:"True",pattern:/true/,longer_alt:n}),c=e.createToken({name:"False",pattern:/false/,longer_alt:n}),s=e.createToken({name:"Null",pattern:/null/,longer_alt:n}),m=e.createToken({name:"Comment",pattern:e.Lexer.NA}),l=e.createToken({name:"DocComment",pattern:/\/\/\/\s*(.+)/,categories:[m]}),p=e.createToken({name:"LineComment",pattern:/\/\/\s*(.+)/,categories:[m]}),f=e.createToken({name:"Attribute",pattern:e.Lexer.NA}),L=e.createToken({name:"ModelAttribute",pattern:/@@/,label:"'@@'",categories:[f]}),E=e.createToken({name:"FieldAttribute",pattern:/@/,label:"'@'",categories:[f]}),y=e.createToken({name:"Dot",pattern:/\./,label:"'.'"}),d=e.createToken({name:"QuestionMark",pattern:/\?/,label:"'?'"}),h=e.createToken({name:"LCurly",pattern:/{/,label:"'{'"}),v=e.createToken({name:"RCurly",pattern:/}/,label:"'}'",pop_mode:!0}),b=e.createToken({name:"LRound",pattern:/\(/,label:"'('"}),g=e.createToken({name:"RRound",pattern:/\)/,label:"')'"}),A=e.createToken({name:"LSquare",pattern:/\[/,label:"'['"}),U=e.createToken({name:"RSquare",pattern:/\]/,label:"']'"}),k=e.createToken({name:"Comma",pattern:/,/,label:"','"}),S=e.createToken({name:"Colon",pattern:/:/,label:"':'"}),O=e.createToken({name:"Equals",pattern:/=/,label:"'='"}),B=e.createToken({name:"StringLiteral",pattern:/"(:?[^\\"\n\r]|\\(:?[bfnrtv"\\/]|u[0-9a-fA-F]{4}))*"/}),T=e.createToken({name:"NumberLiteral",pattern:/-?(0|[1-9]\d*)(\.\d+)?([eE][+-]?\d+)?/}),N=e.createToken({name:"WhiteSpace",pattern:/\s+/,group:e.Lexer.SKIPPED}),M=e.createToken({name:"LineBreak",pattern:/\n|\r\n/,line_breaks:!0,label:"LineBreak"}),C=[m,l,p,M,N],R={modes:{global:[].concat(C,[r,a,u,i]),block:[].concat(C,[f,L,E,y,d,h,v,A,U,b,g,k,S,O,o,c,s,B,T,n])},defaultMode:"global"},w=new e.Lexer(R);function j(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,(Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var x=new(function(e){function t(){var t;return(t=e.call(this,R)||this).break=t.RULE("break",(function(){t.CONSUME1(M),t.CONSUME2(M)})),t.keyedArg=t.RULE("keyedArg",(function(){t.CONSUME(n,{LABEL:"keyName"}),t.CONSUME(S),t.SUBRULE(t.value)})),t.array=t.RULE("array",(function(){t.CONSUME(A),t.MANY_SEP({SEP:k,DEF:function(){t.SUBRULE(t.value)}}),t.CONSUME(U)})),t.func=t.RULE("func",(function(){t.CONSUME(n,{LABEL:"funcName"}),t.CONSUME(b),t.MANY_SEP({SEP:k,DEF:function(){t.OR([{ALT:function(){return t.SUBRULE(t.keyedArg)}},{ALT:function(){return t.SUBRULE(t.value)}}])}}),t.CONSUME(g)})),t.value=t.RULE("value",(function(){t.OR([{ALT:function(){return t.CONSUME(B,{LABEL:"value"})}},{ALT:function(){return t.CONSUME(T,{LABEL:"value"})}},{ALT:function(){return t.SUBRULE(t.array,{LABEL:"value"})}},{ALT:function(){return t.SUBRULE(t.func,{LABEL:"value"})}},{ALT:function(){return t.CONSUME(o,{LABEL:"value"})}},{ALT:function(){return t.CONSUME(c,{LABEL:"value"})}},{ALT:function(){return t.CONSUME(s,{LABEL:"value"})}},{ALT:function(){return t.CONSUME(n,{LABEL:"value"})}}])})),t.property=t.RULE("property",(function(){t.CONSUME(n,{LABEL:"propertyName"}),t.CONSUME(O),t.SUBRULE(t.value,{LABEL:"propertyValue"})})),t.assignment=t.RULE("assignment",(function(){t.CONSUME(n,{LABEL:"assignmentName"}),t.CONSUME(O),t.SUBRULE(t.value,{LABEL:"assignmentValue"})})),t.field=t.RULE("field",(function(){t.CONSUME(n,{LABEL:"fieldName"}),t.SUBRULE(t.value,{LABEL:"fieldType"}),t.OPTION1((function(){t.OR([{ALT:function(){t.CONSUME(A,{LABEL:"array"}),t.CONSUME(U,{LABEL:"array"})}},{ALT:function(){return t.CONSUME(d,{LABEL:"optional"})}}])})),t.MANY((function(){t.SUBRULE(t.attribute,{LABEL:"attributeList"})})),t.OPTION2((function(){t.CONSUME(m,{LABEL:"comment"})}))})),t.block=t.RULE("block",(function(e){void 0===e&&(e={});var n=e.componentType,r="enum"===n,a="model"===n;t.CONSUME(h),t.CONSUME1(M),t.MANY((function(){t.OR([{ALT:function(){return t.SUBRULE(t.comment,{LABEL:"list"})}},{GATE:function(){return a},ALT:function(){return t.SUBRULE(t.property,{LABEL:"list"})}},{ALT:function(){return t.SUBRULE(t.attribute,{LABEL:"list"})}},{GATE:function(){return a},ALT:function(){return t.SUBRULE(t.field,{LABEL:"list"})}},{GATE:function(){return r},ALT:function(){return t.SUBRULE(t.enum,{LABEL:"list"})}},{GATE:function(){return!a},ALT:function(){return t.SUBRULE(t.assignment,{LABEL:"list"})}},{ALT:function(){return t.SUBRULE(t.break,{LABEL:"list"})}},{ALT:function(){return t.CONSUME2(M)}}])})),t.CONSUME(v)})),t.enum=t.RULE("enum",(function(){t.CONSUME(n,{LABEL:"enumName"}),t.OPTION((function(){t.CONSUME(m,{LABEL:"comment"})}))})),t.attribute=t.RULE("attribute",(function(){t.OR1([{ALT:function(){return t.CONSUME(L,{LABEL:"modelAttribute"})}},{ALT:function(){return t.CONSUME(E,{LABEL:"fieldAttribute"})}}]),t.OR2([{ALT:function(){t.CONSUME1(n,{LABEL:"groupName"}),t.CONSUME(y),t.CONSUME2(n,{LABEL:"attributeName"})}},{ALT:function(){return t.CONSUME(n,{LABEL:"attributeName"})}}]),t.OPTION((function(){t.CONSUME(b),t.MANY_SEP({SEP:k,DEF:function(){t.SUBRULE(t.attributeArg)}}),t.CONSUME(g)}))})),t.attributeArg=t.RULE("attributeArg",(function(){t.OR([{ALT:function(){return t.SUBRULE(t.keyedArg,{LABEL:"value"})}},{ALT:function(){return t.SUBRULE(t.value,{LABEL:"value"})}}])})),t.component=t.RULE("component",(function(){var e=t.OR1([{ALT:function(){return t.CONSUME(r,{LABEL:"type"})}},{ALT:function(){return t.CONSUME(a,{LABEL:"type"})}},{ALT:function(){return t.CONSUME(u,{LABEL:"type"})}},{ALT:function(){return t.CONSUME(i,{LABEL:"type"})}}]);t.OR2([{ALT:function(){t.CONSUME1(n,{LABEL:"groupName"}),t.CONSUME(y),t.CONSUME2(n,{LABEL:"componentName"})}},{ALT:function(){return t.CONSUME(n,{LABEL:"componentName"})}}]),t.SUBRULE(t.block,{ARGS:[{componentType:e.image}]})})),t.comment=t.RULE("comment",(function(){t.CONSUME(m,{LABEL:"text"})})),t.schema=t.RULE("schema",(function(){t.MANY((function(){t.OR([{ALT:function(){return t.SUBRULE(t.comment,{LABEL:"list"})}},{ALT:function(){return t.SUBRULE(t.component,{LABEL:"list"})}},{ALT:function(){return t.SUBRULE(t.break,{LABEL:"list"})}},{ALT:function(){return t.CONSUME(M)}}])}))})),t.performSelfAnalysis(),t}return j(t,e),t}(e.CstParser)),_=function(e){function t(){var t;return(t=e.call(this)||this).validateVisitor(),t}j(t,e);var n=t.prototype;return n.schema=function(e){var t,n=this;return{type:"schema",list:(null==(t=e.list)?void 0:t.map((function(e){return n.visit([e])})))||[]}},n.component=function(e){var t=e.type[0].image,n=e.componentName[0].image,r=this.visit(e.block);switch(t){case"datasource":return{type:"datasource",name:n,assignments:r};case"generator":return{type:"generator",name:n,assignments:r};case"model":return{type:"model",name:n,properties:r};case"enum":return{type:"enum",name:n,enumerators:r};default:throw new Error("Unexpected block type: "+t)}},n.break=function(){return{type:"break"}},n.comment=function(e){return{type:"comment",text:e.text[0].image}},n.block=function(e){var t,n=this;return null==(t=e.list)?void 0:t.map((function(e){return n.visit([e])}))},n.assignment=function(e){var t=this.visit(e.assignmentValue);return{type:"assignment",key:e.assignmentName[0].image,value:t}},n.field=function(e){var t,n,r=this,a=this.visit(e.fieldType),u=e.fieldName[0].image,i=e.attributeList&&e.attributeList.map((function(e){return r.visit([e])})),o=null==(t=e.comment)||null==(n=t[0])?void 0:n.image;return{type:"field",name:u,fieldType:a,array:null!=e.array,optional:null!=e.optional,attributes:i,comment:o}},n.attribute=function(e){var t=this,n=e.attributeName[0].image,r=(e.groupName||[{}])[0].image,a=e.attributeArg&&e.attributeArg.map((function(e){return t.visit(e)}));return{type:"attribute",name:n,kind:null!=e.modelAttribute?"model":"field",group:r,args:a}},n.attributeArg=function(e){return{type:"attributeArgument",value:this.visit(e.value)}},n.func=function(e){var t=this,n=e.funcName[0].image,r=e.value&&e.value.map((function(e){return t.visit([e])})),a=e.keyedArg&&e.keyedArg.map((function(e){return t.visit([e])}));return{type:"function",name:n,params:(r||a)&&[].concat(null!=r?r:[],null!=a?a:[])}},n.array=function(e){var t=this;return{type:"array",args:e.value&&e.value.map((function(e){return t.visit([e])}))}},n.keyedArg=function(e){return{type:"keyValue",key:e.keyName[0].image,value:this.visit(e.value)}},n.value=function(e){return"image"in e.value[0]?e.value[0].image:this.visit(e.value)},n.enum=function(e){var t,n;return{type:"enumerator",name:e.enumName[0].image,comment:null==(t=e.comment)||null==(n=t[0])?void 0:n.image}},t}(x.getBaseCstVisitorConstructorWithDefaults());function P(e){var t=w.tokenize(e);x.input=t.tokens;var n=x.schema();if(x.errors.length>0)throw x.errors[0];return(new _).visit(n)}var I=["break","comment"],V=["generator","datasource","model","enum","break","comment"];function D(e,n){void 0===n&&(n={});var r=n.sort,a=n.locales,u=void 0===a?void 0:a,i=n.sortOrder,o=void 0===i?void 0:i,c=e.list;if(void 0!==r&&r){c=e.list=c.filter((function(e){return"break"!==e.type}));var s=function(e,t,n){return void 0===n&&(n=V),function(r,a){if(-1!==I.indexOf(r.type)!=(-1!==I.indexOf(a.type)))return e.list.indexOf(r)-e.list.indexOf(a);n!==V&&(n=n.concat(V));var u=n.indexOf(r.type)-n.indexOf(a.type);return 0!==u?u:"name"in r&&"name"in a?r.name.localeCompare(a.name,t):0}}(e,u,o);c.sort(s)}return c.map(F).filter(Boolean).join(t.EOL).replace(/(\r?\n\s*){3,}/g,t.EOL+t.EOL)+t.EOL}function F(e){switch(e.type){case"comment":return G(e);case"datasource":return r=H((n=e).assignments),"\ndatasource "+n.name+" {\n "+r+"\n}";case"enum":return function(e){var n=e.enumerators.map(q).filter(Boolean).join(t.EOL+" ").replace(/(\r?\n\s*){3,}/g,t.EOL+t.EOL+" ");return"\nenum "+e.name+" {\n "+n+"\n}"}(e);case"generator":return function(e){var t=H(e.assignments);return"\ngenerator "+e.name+" {\n "+t+"\n}"}(e);case"model":return function(e){var n,r,a,u,i,o=(r=0,a=(n=e.properties).reduce((function(e,t,n,a){return"break"===t.type||(n>0&&"break"===a[n-1].type&&(e[++r]=[]),e[r].push(t)),e}),[[]]),u=a.map((function(e){return e.reduce((function(e,t){return Math.max(e,"field"===t.type?t.name.length:0)}),0)})),i=a.map((function(e){return e.reduce((function(e,t){return Math.max(e,"field"===t.type?K(t).length:0)}),0)})),n.map((function(e,t,n){return t>0&&"break"!==e.type&&"break"===n[t-1].type&&(u.shift(),i.shift()),function(e,t,n){switch(void 0===t&&(t=0),void 0===n&&(n=0),e.type){case"attribute":return z(e);case"field":return function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=0);var r=e.name.padEnd(t),a=K(e).padEnd(n),u=e.attributes?e.attributes.map(z):[],i=e.comment;return[r,a].concat(u).filter(Boolean).join(" ").trim()+(i?" "+i:"")}(e,t,n);case"comment":return G(e);case"break":return Y();default:throw new Error("Unrecognized property type")}}(e,u[0],i[0])})).filter(Boolean).join(t.EOL+" ").replace(/(\r?\n\s*){3,}/g,t.EOL+t.EOL+" "));return"\nmodel "+e.name+" {\n "+o+"\n}"}(e);case"break":return Y();default:throw new Error("Unrecognized block type")}var n,r}function G(e){return e.text}function Y(){return t.EOL}function q(e){switch(e.type){case"enumerator":return[e.name,e.comment].filter(Boolean).join(" ");case"attribute":return z(e);case"comment":return G(e);case"break":return Y();default:throw new Error("Unexpected enumerator type")}}function z(e){var t=e.args&&e.args.length>0?"("+e.args.map(W).filter(Boolean).join(", ")+")":"",n=[e.name];return e.group&&n.unshift(e.group),("field"===e.kind?"@":"@@")+n.join(".")+t}function W(e){return Z(e.value)}function K(e){var t=e.array?"[]":e.optional?"?":"";if("object"==typeof e.fieldType)switch(e.fieldType.type){case"function":return""+Q(e.fieldType)+t;default:throw new Error("Unexpected field type")}return""+e.fieldType+t}function Q(e){var t=e.params?e.params.map(Z):"";return e.name+"("+t+")"}function Z(e){switch(typeof e){case"object":if("type"in e)switch(e.type){case"keyValue":return e.key+": "+Z(e.value);case"function":return Q(e);case"array":return"["+(null!=e.args?e.args.map(Z).join(", "):"")+"]";default:throw new Error("Unexpected value type")}throw new Error("Unexpected object value");default:return String(e)}}function H(e){var n=0,r=e.reduce((function(e,t,r,a){return"break"===t.type||(r>0&&"break"===a[r-1].type&&(e[++n]=[]),e[n].push(t)),e}),[[]]).map((function(e){return e.reduce((function(e,t){return Math.max(e,"assignment"===t.type?t.key.length:0)}),0)}));return e.map((function(e,t,n){return t>0&&"break"!==e.type&&"break"===n[t-1].type&&r.shift(),function(e,t){switch(void 0===t&&(t=0),e.type){case"comment":return G(e);case"break":return Y();case"assignment":return e.key.padEnd(t)+" = "+Z(e.value);default:throw new Error("Unexpected assignment type")}}(e,r[0])})).filter(Boolean).join(t.EOL+" ").replace(/(\r?\n\s*){3,}/g,t.EOL+t.EOL+" ")}var J=function(){function e(e){void 0===e&&(e=""),this.schema=P(e)}var t=e.prototype;return t.print=function(e){return void 0===e&&(e={}),D(this.schema,e)},t.getSchema=function(){return this.schema},t.generator=function(e,t){void 0===t&&(t="prisma-client-js");var n=this.schema.list.reduce((function(t,n){return"generator"===n.type&&n.name===e?n:t}),{type:"generator",name:e,assignments:[{type:"assignment",key:"provider",value:'"'+t+'"'}]});return this.schema.list.includes(n)||this.schema.list.push(n),this._subject=n,this},t.drop=function(e){var t=this.schema.list.findIndex((function(t){return"name"in t&&t.name===e}));return this.schema.list.splice(t,1),this},t.datasource=function(e,t){var n={type:"datasource",name:"db",assignments:[{type:"assignment",key:"url",value:"string"==typeof t?'"'+t+'"':{type:"function",name:"env",params:['"'+t.env+'"']}},{type:"assignment",key:"provider",value:e}]},r=this.schema.list.findIndex((function(e){return"datasource"===e.type}));return this.schema.list.splice(r,-1!==r?1:0,n),this._subject=n,this},t.model=function(e){var t=this.schema.list.reduce((function(t,n){return"model"===n.type&&n.name===e?n:t}),{type:"model",name:e,properties:[]});return this.schema.list.includes(t)||this.schema.list.push(t),this._subject=t,this},t.enum=function(e,t){void 0===t&&(t=[]);var n=this.schema.list.reduce((function(t,n){return"enum"===n.type&&n.name===e?n:t}),{type:"enum",name:e,enumerators:t.map((function(e){return{type:"enumerator",name:e}}))});return this.schema.list.includes(n)||this.schema.list.push(n),this._subject=n,this},t.enumerator=function(e){var t=this.getSubject();if(!t||!("type"in t)||"enum"!==t.type)throw new Error("Subject must be a prisma model!");return t.enumerators.push({type:"enumerator",name:e}),this},t.getSubject=function(){return this._subject},t.getParent=function(){return this._parent},t.blockAttribute=function(e,t){var n=this.getSubject();if(!n||!("type"in n)||"model"!==n.type){var r=this.getParent();if(!r||!("type"in r)||"model"!==r.type)throw new Error("Subject must be a prisma model!");n=this._subject=r}var a=t?"string"==typeof t?[{type:"attributeArgument",value:'"'+t+'"'}]:Array.isArray(t)?[{type:"attributeArgument",value:{type:"array",args:t}}]:Object.entries(t).map((function(e){return{type:"attributeArgument",value:{type:"keyValue",key:e[0],value:e[1]}}})):[];return n.properties.push({type:"attribute",kind:"model",name:e,args:a}),this},t.attribute=function(e,t){var n=this.getParent(),r=this.getSubject();if(!n||!("type"in n)||"model"!==n.type)throw new Error("Parent must be a prisma model!");if(!r||!("type"in r)||"field"!==r.type)throw new Error("Subject must be a prisma field!");r.attributes||(r.attributes=[]);var a=r.attributes.reduce((function(t,n){return"attribute"===n.type&&n.name===e?n:t}),{type:"attribute",kind:"field",name:e});if(Array.isArray(t)){var u=function e(t){var n,r;return"string"==typeof t?t:{type:"function",name:t.name,params:null!=(n=null==(r=t.function)?void 0:r.map(e))?n:[]}};t.length>0&&(a.args=t.map((function(e){return{type:"attributeArgument",value:u(e)}})))}else"object"==typeof t&&(a.args=Object.entries(t).map((function(e){return{type:"attributeArgument",value:{type:"keyValue",key:e[0],value:{type:"array",args:e[1]}}}})));return r.attributes.includes(a)||r.attributes.push(a),this},t.assignment=function(e,t){var n=this.getSubject();if(!n||!("type"in n)||!["generator","datasource"].includes(n.type))throw new Error("Subject must be a prisma generator or datasource!");var r=n.assignments.reduce((function(n,r){return"assignment"===r.type&&r.key===e?function(e,n){return e.value='"'+t+'"',e}(r):n}),{type:"assignment",key:e,value:'"'+t+'"'});return n.assignments.includes(r)||n.assignments.push(r),this},t.blockInsert=function(e){var t=this.getSubject(),n=["datasource","enum","generator","model"];if(!t||!("type"in t)||!n.includes(t.type)){var r=this.getParent();if(!r||!("type"in r)||!n.includes(r.type))throw new Error("Subject must be a prisma block!");t=this._subject=r}switch(t.type){case"datasource":t.assignments.push(e);break;case"enum":t.enumerators.push(e);break;case"generator":t.assignments.push(e);break;case"model":t.properties.push(e)}return this},t.break=function(){return this.blockInsert({type:"break"})},t.comment=function(e,t){return void 0===t&&(t=!1),this.blockInsert({type:"comment",text:"//"+(t?"/":"")+" "+e})},t.schemaComment=function(e,t){return void 0===t&&(t=!1),this.schema.list.push({type:"comment",text:"//"+(t?"/":"")+" "+e}),this},t.field=function(e,t){var n=this.getSubject();if(!n||!("type"in n)||"model"!==n.type){var r=this.getParent();if(!r||!("type"in r)||"model"!==r.type)throw new Error("Subject must be a prisma model!");n=this._subject=r}var a={type:"field",name:e,fieldType:t};return n.properties.push(a),this._parent=n,this._subject=a,this},t.then=function(e){return e(this._subject),this},e}();exports.ConcretePrismaSchemaBuilder=J,exports.createPrismaSchemaBuilder=function(e){return new J(e)},exports.getSchema=P,exports.printSchema=D; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("chevrotain"),t=require("os"),n=e.createToken({name:"Identifier",pattern:/[a-zA-Z]\w*/}),r=e.createToken({name:"Datasource",pattern:/datasource/,push_mode:"block"}),a=e.createToken({name:"Generator",pattern:/generator/,push_mode:"block"}),u=e.createToken({name:"Model",pattern:/model/,push_mode:"block"}),i=e.createToken({name:"Enum",pattern:/enum/,push_mode:"block"}),o=e.createToken({name:"True",pattern:/true/,longer_alt:n}),c=e.createToken({name:"False",pattern:/false/,longer_alt:n}),s=e.createToken({name:"Null",pattern:/null/,longer_alt:n}),m=e.createToken({name:"Comment",pattern:e.Lexer.NA}),l=e.createToken({name:"DocComment",pattern:/\/\/\/\s*(.+)/,categories:[m]}),p=e.createToken({name:"LineComment",pattern:/\/\/\s*(.+)/,categories:[m]}),f=e.createToken({name:"Attribute",pattern:e.Lexer.NA}),L=e.createToken({name:"ModelAttribute",pattern:/@@/,label:"'@@'",categories:[f]}),E=e.createToken({name:"FieldAttribute",pattern:/@/,label:"'@'",categories:[f]}),d=e.createToken({name:"Dot",pattern:/\./,label:"'.'"}),y=e.createToken({name:"QuestionMark",pattern:/\?/,label:"'?'"}),h=e.createToken({name:"LCurly",pattern:/{/,label:"'{'"}),v=e.createToken({name:"RCurly",pattern:/}/,label:"'}'",pop_mode:!0}),b=e.createToken({name:"LRound",pattern:/\(/,label:"'('"}),g=e.createToken({name:"RRound",pattern:/\)/,label:"')'"}),A=e.createToken({name:"LSquare",pattern:/\[/,label:"'['"}),U=e.createToken({name:"RSquare",pattern:/\]/,label:"']'"}),k=e.createToken({name:"Comma",pattern:/,/,label:"','"}),S=e.createToken({name:"Colon",pattern:/:/,label:"':'"}),O=e.createToken({name:"Equals",pattern:/=/,label:"'='"}),B=e.createToken({name:"StringLiteral",pattern:/"(:?[^\\"\n\r]|\\(:?[bfnrtv"\\/]|u[0-9a-fA-F]{4}))*"/}),T=e.createToken({name:"NumberLiteral",pattern:/-?(0|[1-9]\d*)(\.\d+)?([eE][+-]?\d+)?/}),N=e.createToken({name:"WhiteSpace",pattern:/\s+/,group:e.Lexer.SKIPPED}),M=e.createToken({name:"LineBreak",pattern:/\n|\r\n/,line_breaks:!0,label:"LineBreak"}),C=[m,l,p,M,N],R={modes:{global:[].concat(C,[r,a,u,i]),block:[].concat(C,[f,L,E,d,y,h,v,A,U,b,g,k,S,O,o,c,s,B,T,n])},defaultMode:"global"},w=new e.Lexer(R);function j(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,(Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var x=new(function(e){function t(){var t;return(t=e.call(this,R)||this).break=t.RULE("break",(function(){t.CONSUME1(M),t.CONSUME2(M)})),t.keyedArg=t.RULE("keyedArg",(function(){t.CONSUME(n,{LABEL:"keyName"}),t.CONSUME(S),t.SUBRULE(t.value)})),t.array=t.RULE("array",(function(){t.CONSUME(A),t.MANY_SEP({SEP:k,DEF:function(){t.SUBRULE(t.value)}}),t.CONSUME(U)})),t.func=t.RULE("func",(function(){t.CONSUME(n,{LABEL:"funcName"}),t.CONSUME(b),t.MANY_SEP({SEP:k,DEF:function(){t.OR([{ALT:function(){return t.SUBRULE(t.keyedArg)}},{ALT:function(){return t.SUBRULE(t.value)}}])}}),t.CONSUME(g)})),t.value=t.RULE("value",(function(){t.OR([{ALT:function(){return t.CONSUME(B,{LABEL:"value"})}},{ALT:function(){return t.CONSUME(T,{LABEL:"value"})}},{ALT:function(){return t.SUBRULE(t.array,{LABEL:"value"})}},{ALT:function(){return t.SUBRULE(t.func,{LABEL:"value"})}},{ALT:function(){return t.CONSUME(o,{LABEL:"value"})}},{ALT:function(){return t.CONSUME(c,{LABEL:"value"})}},{ALT:function(){return t.CONSUME(s,{LABEL:"value"})}},{ALT:function(){return t.CONSUME(n,{LABEL:"value"})}}])})),t.property=t.RULE("property",(function(){t.CONSUME(n,{LABEL:"propertyName"}),t.CONSUME(O),t.SUBRULE(t.value,{LABEL:"propertyValue"})})),t.assignment=t.RULE("assignment",(function(){t.CONSUME(n,{LABEL:"assignmentName"}),t.CONSUME(O),t.SUBRULE(t.value,{LABEL:"assignmentValue"})})),t.field=t.RULE("field",(function(){t.CONSUME(n,{LABEL:"fieldName"}),t.SUBRULE(t.value,{LABEL:"fieldType"}),t.OPTION1((function(){t.OR([{ALT:function(){t.CONSUME(A,{LABEL:"array"}),t.CONSUME(U,{LABEL:"array"})}},{ALT:function(){return t.CONSUME(y,{LABEL:"optional"})}}])})),t.MANY((function(){t.SUBRULE(t.attribute,{LABEL:"attributeList"})})),t.OPTION2((function(){t.CONSUME(m,{LABEL:"comment"})}))})),t.block=t.RULE("block",(function(e){void 0===e&&(e={});var n=e.componentType,r="enum"===n,a="model"===n;t.CONSUME(h),t.CONSUME1(M),t.MANY((function(){t.OR([{ALT:function(){return t.SUBRULE(t.comment,{LABEL:"list"})}},{GATE:function(){return a},ALT:function(){return t.SUBRULE(t.property,{LABEL:"list"})}},{ALT:function(){return t.SUBRULE(t.attribute,{LABEL:"list"})}},{GATE:function(){return a},ALT:function(){return t.SUBRULE(t.field,{LABEL:"list"})}},{GATE:function(){return r},ALT:function(){return t.SUBRULE(t.enum,{LABEL:"list"})}},{GATE:function(){return!a},ALT:function(){return t.SUBRULE(t.assignment,{LABEL:"list"})}},{ALT:function(){return t.SUBRULE(t.break,{LABEL:"list"})}},{ALT:function(){return t.CONSUME2(M)}}])})),t.CONSUME(v)})),t.enum=t.RULE("enum",(function(){t.CONSUME(n,{LABEL:"enumName"}),t.OPTION((function(){t.CONSUME(m,{LABEL:"comment"})}))})),t.attribute=t.RULE("attribute",(function(){t.OR1([{ALT:function(){return t.CONSUME(L,{LABEL:"modelAttribute"})}},{ALT:function(){return t.CONSUME(E,{LABEL:"fieldAttribute"})}}]),t.OR2([{ALT:function(){t.CONSUME1(n,{LABEL:"groupName"}),t.CONSUME(d),t.CONSUME2(n,{LABEL:"attributeName"})}},{ALT:function(){return t.CONSUME(n,{LABEL:"attributeName"})}}]),t.OPTION((function(){t.CONSUME(b),t.MANY_SEP({SEP:k,DEF:function(){t.SUBRULE(t.attributeArg)}}),t.CONSUME(g)}))})),t.attributeArg=t.RULE("attributeArg",(function(){t.OR([{ALT:function(){return t.SUBRULE(t.keyedArg,{LABEL:"value"})}},{ALT:function(){return t.SUBRULE(t.value,{LABEL:"value"})}}])})),t.component=t.RULE("component",(function(){var e=t.OR1([{ALT:function(){return t.CONSUME(r,{LABEL:"type"})}},{ALT:function(){return t.CONSUME(a,{LABEL:"type"})}},{ALT:function(){return t.CONSUME(u,{LABEL:"type"})}},{ALT:function(){return t.CONSUME(i,{LABEL:"type"})}}]);t.OR2([{ALT:function(){t.CONSUME1(n,{LABEL:"groupName"}),t.CONSUME(d),t.CONSUME2(n,{LABEL:"componentName"})}},{ALT:function(){return t.CONSUME(n,{LABEL:"componentName"})}}]),t.SUBRULE(t.block,{ARGS:[{componentType:e.image}]})})),t.comment=t.RULE("comment",(function(){t.CONSUME(m,{LABEL:"text"})})),t.schema=t.RULE("schema",(function(){t.MANY((function(){t.OR([{ALT:function(){return t.SUBRULE(t.comment,{LABEL:"list"})}},{ALT:function(){return t.SUBRULE(t.component,{LABEL:"list"})}},{ALT:function(){return t.SUBRULE(t.break,{LABEL:"list"})}},{ALT:function(){return t.CONSUME(M)}}])}))})),t.performSelfAnalysis(),t}return j(t,e),t}(e.CstParser)),_=function(e){function t(){var t;return(t=e.call(this)||this).validateVisitor(),t}j(t,e);var n=t.prototype;return n.schema=function(e){var t,n=this;return{type:"schema",list:(null==(t=e.list)?void 0:t.map((function(e){return n.visit([e])})))||[]}},n.component=function(e){var t=e.type[0].image,n=e.componentName[0].image,r=this.visit(e.block);switch(t){case"datasource":return{type:"datasource",name:n,assignments:r};case"generator":return{type:"generator",name:n,assignments:r};case"model":return{type:"model",name:n,properties:r};case"enum":return{type:"enum",name:n,enumerators:r};default:throw new Error("Unexpected block type: "+t)}},n.break=function(){return{type:"break"}},n.comment=function(e){return{type:"comment",text:e.text[0].image}},n.block=function(e){var t,n=this;return null==(t=e.list)?void 0:t.map((function(e){return n.visit([e])}))},n.assignment=function(e){var t=this.visit(e.assignmentValue);return{type:"assignment",key:e.assignmentName[0].image,value:t}},n.field=function(e){var t,n,r=this,a=this.visit(e.fieldType),u=e.fieldName[0].image,i=e.attributeList&&e.attributeList.map((function(e){return r.visit([e])})),o=null==(t=e.comment)||null==(n=t[0])?void 0:n.image;return{type:"field",name:u,fieldType:a,array:null!=e.array,optional:null!=e.optional,attributes:i,comment:o}},n.attribute=function(e){var t=this,n=e.attributeName[0].image,r=(e.groupName||[{}])[0].image,a=e.attributeArg&&e.attributeArg.map((function(e){return t.visit(e)}));return{type:"attribute",name:n,kind:null!=e.modelAttribute?"model":"field",group:r,args:a}},n.attributeArg=function(e){return{type:"attributeArgument",value:this.visit(e.value)}},n.func=function(e){var t=this,n=e.funcName[0].image,r=e.value&&e.value.map((function(e){return t.visit([e])})),a=e.keyedArg&&e.keyedArg.map((function(e){return t.visit([e])}));return{type:"function",name:n,params:(r||a)&&[].concat(null!=r?r:[],null!=a?a:[])}},n.array=function(e){var t=this;return{type:"array",args:e.value&&e.value.map((function(e){return t.visit([e])}))}},n.keyedArg=function(e){return{type:"keyValue",key:e.keyName[0].image,value:this.visit(e.value)}},n.value=function(e){return"image"in e.value[0]?e.value[0].image:this.visit(e.value)},n.enum=function(e){var t,n;return{type:"enumerator",name:e.enumName[0].image,comment:null==(t=e.comment)||null==(n=t[0])?void 0:n.image}},t}(x.getBaseCstVisitorConstructorWithDefaults());function P(e){var t=w.tokenize(e);x.input=t.tokens;var n=x.schema();if(x.errors.length>0)throw x.errors[0];return(new _).visit(n)}var I=["break","comment"],V=["generator","datasource","model","enum","break","comment"];function D(e,n){void 0===n&&(n={});var r=n.sort,a=n.locales,u=void 0===a?void 0:a,i=n.sortOrder,o=void 0===i?void 0:i,c=e.list;if(void 0!==r&&r){c=e.list=c.filter((function(e){return"break"!==e.type}));var s=function(e,t,n){return void 0===n&&(n=V),function(r,a){if(-1!==I.indexOf(r.type)!=(-1!==I.indexOf(a.type)))return e.list.indexOf(r)-e.list.indexOf(a);n!==V&&(n=n.concat(V));var u=n.indexOf(r.type)-n.indexOf(a.type);return 0!==u?u:"name"in r&&"name"in a?r.name.localeCompare(a.name,t):0}}(e,u,o);c.sort(s)}return c.map(F).filter(Boolean).join(t.EOL).replace(/(\r?\n\s*){3,}/g,t.EOL+t.EOL)+t.EOL}function F(e){switch(e.type){case"comment":return G(e);case"datasource":return r=H((n=e).assignments),"\ndatasource "+n.name+" {\n "+r+"\n}";case"enum":return function(e){var n=e.enumerators.map(q).filter(Boolean).join(t.EOL+" ").replace(/(\r?\n\s*){3,}/g,t.EOL+t.EOL+" ");return"\nenum "+e.name+" {\n "+n+"\n}"}(e);case"generator":return function(e){var t=H(e.assignments);return"\ngenerator "+e.name+" {\n "+t+"\n}"}(e);case"model":return function(e){var n,r,a,u,i,o=(r=0,a=(n=e.properties).reduce((function(e,t,n,a){return"break"===t.type||(n>0&&"break"===a[n-1].type&&(e[++r]=[]),e[r].push(t)),e}),[[]]),u=a.map((function(e){return e.reduce((function(e,t){return Math.max(e,"field"===t.type?t.name.length:0)}),0)})),i=a.map((function(e){return e.reduce((function(e,t){return Math.max(e,"field"===t.type?K(t).length:0)}),0)})),n.map((function(e,t,n){return t>0&&"break"!==e.type&&"break"===n[t-1].type&&(u.shift(),i.shift()),function(e,t,n){switch(void 0===t&&(t=0),void 0===n&&(n=0),e.type){case"attribute":return z(e);case"field":return function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=0);var r=e.name.padEnd(t),a=K(e).padEnd(n),u=e.attributes?e.attributes.map(z):[],i=e.comment;return[r,a].concat(u).filter(Boolean).join(" ").trim()+(i?" "+i:"")}(e,t,n);case"comment":return G(e);case"break":return Y();default:throw new Error("Unrecognized property type")}}(e,u[0],i[0])})).filter(Boolean).join(t.EOL+" ").replace(/(\r?\n\s*){3,}/g,t.EOL+t.EOL+" "));return"\nmodel "+e.name+" {\n "+o+"\n}"}(e);case"break":return Y();default:throw new Error("Unrecognized block type")}var n,r}function G(e){return e.text}function Y(){return t.EOL}function q(e){switch(e.type){case"enumerator":return[e.name,e.comment].filter(Boolean).join(" ");case"attribute":return z(e);case"comment":return G(e);case"break":return Y();default:throw new Error("Unexpected enumerator type")}}function z(e){var t=e.args&&e.args.length>0?"("+e.args.map(W).filter(Boolean).join(", ")+")":"",n=[e.name];return e.group&&n.unshift(e.group),("field"===e.kind?"@":"@@")+n.join(".")+t}function W(e){return Z(e.value)}function K(e){var t=e.array?"[]":e.optional?"?":"";if("object"==typeof e.fieldType)switch(e.fieldType.type){case"function":return""+Q(e.fieldType)+t;default:throw new Error("Unexpected field type")}return""+e.fieldType+t}function Q(e){var t=e.params?e.params.map(Z):"";return e.name+"("+t+")"}function Z(e){switch(typeof e){case"object":if("type"in e)switch(e.type){case"keyValue":return e.key+": "+Z(e.value);case"function":return Q(e);case"array":return"["+(null!=e.args?e.args.map(Z).join(", "):"")+"]";default:throw new Error("Unexpected value type")}throw new Error("Unexpected object value");default:return String(e)}}function H(e){var n=0,r=e.reduce((function(e,t,r,a){return"break"===t.type||(r>0&&"break"===a[r-1].type&&(e[++n]=[]),e[n].push(t)),e}),[[]]).map((function(e){return e.reduce((function(e,t){return Math.max(e,"assignment"===t.type?t.key.length:0)}),0)}));return e.map((function(e,t,n){return t>0&&"break"!==e.type&&"break"===n[t-1].type&&r.shift(),function(e,t){switch(void 0===t&&(t=0),e.type){case"comment":return G(e);case"break":return Y();case"assignment":return e.key.padEnd(t)+" = "+Z(e.value);default:throw new Error("Unexpected assignment type")}}(e,r[0])})).filter(Boolean).join(t.EOL+" ").replace(/(\r?\n\s*){3,}/g,t.EOL+t.EOL+" ")}var J=function(){function e(e){void 0===e&&(e=""),this.schema=P(e)}var t=e.prototype;return t.print=function(e){return void 0===e&&(e={}),D(this.schema,e)},t.getSchema=function(){return this.schema},t.generator=function(e,t){void 0===t&&(t="prisma-client-js");var n=this.schema.list.reduce((function(t,n){return"generator"===n.type&&n.name===e?n:t}),{type:"generator",name:e,assignments:[{type:"assignment",key:"provider",value:'"'+t+'"'}]});return this.schema.list.includes(n)||this.schema.list.push(n),this._subject=n,this},t.drop=function(e){var t=this.schema.list.findIndex((function(t){return"name"in t&&t.name===e}));return this.schema.list.splice(t,1),this},t.datasource=function(e,t){var n={type:"datasource",name:"db",assignments:[{type:"assignment",key:"url",value:"string"==typeof t?'"'+t+'"':{type:"function",name:"env",params:['"'+t.env+'"']}},{type:"assignment",key:"provider",value:e}]},r=this.schema.list.findIndex((function(e){return"datasource"===e.type}));return this.schema.list.splice(r,-1!==r?1:0,n),this._subject=n,this},t.model=function(e){var t=this.schema.list.reduce((function(t,n){return"model"===n.type&&n.name===e?n:t}),{type:"model",name:e,properties:[]});return this.schema.list.includes(t)||this.schema.list.push(t),this._subject=t,this},t.enum=function(e,t){void 0===t&&(t=[]);var n=this.schema.list.reduce((function(t,n){return"enum"===n.type&&n.name===e?n:t}),{type:"enum",name:e,enumerators:t.map((function(e){return{type:"enumerator",name:e}}))});return this.schema.list.includes(n)||this.schema.list.push(n),this._subject=n,this},t.enumerator=function(e){var t=this.getSubject();if(!t||!("type"in t)||"enum"!==t.type)throw new Error("Subject must be a prisma model!");return t.enumerators.push({type:"enumerator",name:e}),this},t.getSubject=function(){return this._subject},t.getParent=function(){return this._parent},t.blockAttribute=function(e,t){var n=this.getSubject();if(!n||!("type"in n)||"model"!==n.type){var r=this.getParent();if(!r||!("type"in r)||"model"!==r.type)throw new Error("Subject must be a prisma model!");n=this._subject=r}var a=t?"string"==typeof t?[{type:"attributeArgument",value:'"'+t+'"'}]:Array.isArray(t)?[{type:"attributeArgument",value:{type:"array",args:t}}]:Object.entries(t).map((function(e){return{type:"attributeArgument",value:{type:"keyValue",key:e[0],value:e[1]}}})):[];return n.properties.push({type:"attribute",kind:"model",name:e,args:a}),this},t.attribute=function(e,t){var n=this.getParent(),r=this.getSubject();if(!n||!("type"in n)||"model"!==n.type)throw new Error("Parent must be a prisma model!");if(!r||!("type"in r)||"field"!==r.type)throw new Error("Subject must be a prisma field!");r.attributes||(r.attributes=[]);var a=r.attributes.reduce((function(t,n){return"attribute"===n.type&&n.name===e?n:t}),{type:"attribute",kind:"field",name:e});if(Array.isArray(t)){var u=function e(t){var n,r;return"string"==typeof t?t:{type:"function",name:t.name,params:null!=(n=null==(r=t.function)?void 0:r.map(e))?n:[]}};t.length>0&&(a.args=t.map((function(e){return{type:"attributeArgument",value:u(e)}})))}else"object"==typeof t&&(a.args=Object.entries(t).map((function(e){return{type:"attributeArgument",value:{type:"keyValue",key:e[0],value:{type:"array",args:e[1]}}}})));return r.attributes.includes(a)||r.attributes.push(a),this},t.assignment=function(e,t){var n=this.getSubject();if(!n||!("type"in n)||!["generator","datasource"].includes(n.type))throw new Error("Subject must be a prisma generator or datasource!");var r=n.assignments.reduce((function(n,r){return"assignment"===r.type&&r.key===e?function(e,n){return e.value='"'+t+'"',e}(r):n}),{type:"assignment",key:e,value:'"'+t+'"'});return n.assignments.includes(r)||n.assignments.push(r),this},t.blockInsert=function(e){var t=this.getSubject(),n=["datasource","enum","generator","model"];if(!t||!("type"in t)||!n.includes(t.type)){var r=this.getParent();if(!r||!("type"in r)||!n.includes(r.type))throw new Error("Subject must be a prisma block!");t=this._subject=r}switch(t.type){case"datasource":t.assignments.push(e);break;case"enum":t.enumerators.push(e);break;case"generator":t.assignments.push(e);break;case"model":t.properties.push(e)}return this},t.break=function(){return this.blockInsert({type:"break"})},t.comment=function(e,t){return void 0===t&&(t=!1),this.blockInsert({type:"comment",text:"//"+(t?"/":"")+" "+e})},t.schemaComment=function(e,t){return void 0===t&&(t=!1),this.schema.list.push({type:"comment",text:"//"+(t?"/":"")+" "+e}),this},t.field=function(e,t){void 0===t&&(t="String");var n=this.getSubject();if(!n||!("type"in n)||"model"!==n.type){var r=this.getParent();if(!r||!("type"in r)||"model"!==r.type)throw new Error("Subject must be a prisma model!");n=this._subject=r}var a=n.properties.reduce((function(t,n){return"field"===n.type&&n.name===e?n:t}),{type:"field",name:e,fieldType:t});return n.properties.includes(a)||n.properties.push(a),this._parent=n,this._subject=a,this},t.then=function(e){return e(this._subject),this},e}();exports.ConcretePrismaSchemaBuilder=J,exports.createPrismaSchemaBuilder=function(e){return new J(e)},exports.getSchema=P,exports.printSchema=D; | ||
//# sourceMappingURL=prisma-ast.cjs.production.min.js.map |
@@ -1462,2 +1462,6 @@ import { Lexer, createToken, CstParser } from 'chevrotain'; | ||
_proto.field = function field(name, fieldType) { | ||
if (fieldType === void 0) { | ||
fieldType = 'String'; | ||
} | ||
var subject = this.getSubject(); | ||
@@ -1471,8 +1475,10 @@ | ||
var field = { | ||
var field = subject.properties.reduce(function (memo, block) { | ||
return block.type === 'field' && block.name === name ? block : memo; | ||
}, { | ||
type: 'field', | ||
name: name, | ||
fieldType: fieldType | ||
}; | ||
subject.properties.push(field); | ||
}); | ||
if (!subject.properties.includes(field)) subject.properties.push(field); | ||
this._parent = subject; | ||
@@ -1479,0 +1485,0 @@ this._subject = field; |
@@ -42,3 +42,3 @@ import * as schema from './getSchema'; | ||
schemaComment(text: string, node?: boolean): this; | ||
field(name: string, fieldType: string | schema.Func): this; | ||
field(name: string, fieldType?: string | schema.Func): this; | ||
then<R extends schema.Block>(callback: (subject: R) => R): this; | ||
@@ -45,0 +45,0 @@ } |
{ | ||
"version": "0.4.3", | ||
"version": "0.5.0", | ||
"license": "MIT", | ||
@@ -4,0 +4,0 @@ "main": "dist/index.js", |
@@ -200,2 +200,17 @@ # @mrleebo/prisma-ast | ||
### Add an attribute to an existing field | ||
If the field already exists, you can add new attributes to it by making calls to `.attribute()`. | ||
```ts | ||
builder.model('Project').field('name').attribute('unique') | ||
``` | ||
```prisma | ||
model Project { | ||
name String @unique | ||
projectCode String @unique | ||
} | ||
``` | ||
### Add an index to a model | ||
@@ -202,0 +217,0 @@ |
@@ -413,4 +413,7 @@ import * as schema from './getSchema'; | ||
/** Add a field to the current model. The field can be customized further with one or more .attribute() calls. */ | ||
field(name: string, fieldType: string | schema.Func): this { | ||
/** | ||
* Adds or updates a field in the current model. The field can be customized | ||
* further with one or more .attribute() calls. | ||
* */ | ||
field(name: string, fieldType: string | schema.Func = 'String'): this { | ||
let subject = this.getSubject<schema.Model>(); | ||
@@ -425,8 +428,13 @@ if (!subject || !('type' in subject) || subject.type !== 'model') { | ||
const field: schema.Field = { | ||
type: 'field', | ||
name, | ||
fieldType, | ||
}; | ||
subject.properties.push(field); | ||
const field = subject.properties.reduce<schema.Field>( | ||
(memo, block) => | ||
block.type === 'field' && block.name === name ? block : memo, | ||
{ | ||
type: 'field', | ||
name, | ||
fieldType, | ||
} | ||
); | ||
if (!subject.properties.includes(field)) subject.properties.push(field); | ||
this._parent = subject; | ||
@@ -433,0 +441,0 @@ this._subject = field; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
387315
4343
313