@fnlb-project/shared 1.5.127 → 1.5.128

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.
@@ -23,6 +23,7 @@ export interface IBaseActionInput {
23
23
  examples?: string[];
24
24
  required?: boolean;
25
25
  properties?: IObjectProperty[];
26
+ propertyFrom?: string;
26
27
  wildcardId?: string;
27
28
  }
28
29
  export interface ISingleInput extends IBaseActionInput {
@@ -80,6 +81,12 @@ export declare class ActionUsageClient<Schema extends Record<string, any> = {}>
80
81
  addObjectArrayParam<Id extends string>(id: Id, name: string, description: string, properties: IObjectProperty[], examples?: string[]): ActionUsageClient<Schema & {
81
82
  [K in Id]: Record<string, any>[];
82
83
  }>;
84
+ addPropertyKeyParam<Id extends string>(id: Id, name: string, description: string, propertyFrom: string, extended?: boolean, examples?: string[]): ActionUsageClient<Schema & {
85
+ [K in Id]: string;
86
+ }>;
87
+ addOptionalPropertyKeyParam<Id extends string>(id: Id, name: string, description: string, propertyFrom: string, extended?: boolean, examples?: string[]): ActionUsageClient<Schema & {
88
+ [K in Id]: string;
89
+ }>;
83
90
  addOptionalObjectArrayParam<Id extends string>(id: Id, name: string, description: string, properties: IObjectProperty[], examples?: string[]): ActionUsageClient<Schema & {
84
91
  [K in Id]: Record<string, any>[];
85
92
  }>;
@@ -1 +1 @@
1
- class B{params;constructor(f){this.params=f??[]}addParam(f,b,h,j,q,z="string",v){return this.params.push({id:f,type:0,dataType:z,required:!0,name:b,description:h,extended:j??!1,examples:q,wildcardId:v}),this}addOptionalParam(f,b,h,j,q,z="string",v){return this.params.push({id:f,type:0,dataType:z,required:!1,name:b,description:h,extended:j??!1,examples:q,wildcardId:v}),this}addSelect(f,b,h,j,q,z="string",v){return this.params.push({id:f,type:1,dataType:z,required:!0,name:b,description:h,options:j,examples:q,wildcardId:v}),this}addOptionalSelect(f,b,h,j,q,z="string",v){return this.params.push({id:f,type:1,dataType:z,required:!1,name:b,description:h,options:j,examples:q,wildcardId:v}),this}addArrayParam(f,b,h,j,q="string",z){return this.params.push({id:f,type:2,dataType:q,required:!0,name:b,description:h,examples:j,wildcardId:z}),this}addOptionalArrayParam(f,b,h,j,q="string",z){return this.params.push({id:f,type:2,dataType:q,required:!1,name:b,description:h,examples:j,wildcardId:z}),this}addObjectParam(f,b,h,j,q){return this.params.push({id:f,type:0,extended:!1,dataType:"object",required:!0,name:b,description:h,properties:j,examples:q}),this}addOptionalObjectParam(f,b,h,j,q){return this.params.push({id:f,type:0,extended:!1,dataType:"object",required:!1,name:b,description:h,properties:j,examples:q}),this}addObjectArrayParam(f,b,h,j,q){return this.params.push({id:f,type:2,dataType:"object",required:!0,name:b,description:h,properties:j,examples:q}),this}addOptionalObjectArrayParam(f,b,h,j,q){return this.params.push({id:f,type:2,dataType:"object",required:!1,name:b,description:h,properties:j,examples:q}),this}getUsage(){return this.params.map((f)=>B.getParamUsage(f)).join(" ")}getExample(){return this.params.map((f)=>B.getParamExample(f)).join(" ")}static getParamUsage(f){switch(f.type){case 0:if(f.dataType==="object")return f.required?`<{${f.name}}>`:`[{${f.name}}]`;return f.required?`<${f.extended?"...":""}${f.name}>`:`[${f.extended?"...":""}${f.name}]`;case 1:return f.required?`<${f.options.map((b)=>b.name).join(" | ")}>`:`[${f.options.map((b)=>b.name).join(" | ")}]`;case 2:if(f.dataType==="object")return f.required?`<{${f.name}}[]>`:`[{${f.name}}[]]`;return f.required?`<${f.name}[]>`:`[${f.name}[]]`;default:return""}}static getParamExample(f){let b=(v)=>v[Math.floor(Math.random()*v.length)],h=(v)=>v?b(v):b(["Angel","Brian","Catherine","David","Emma","Frank","Grace","Hannah","Ian","Julia","Josefina"]),j=(v)=>v?b(v):b(["Brian Stronghold","Catherine Joyful","David Noble","Emma Graceful","Frank Fearless","Grace Serene","Hannah Bold","Ian Clever","Julia Kindhearted","Romana Einstein"]),q=(v)=>b(v)?.name,z=(v)=>v?b(v):b(["Angel","Brian","Catherine","David","Emma","Frank","Grace","Hannah","Ian","Julia","Josefina"]);switch(f.type){case 0:if(f.dataType==="object")return f.examples?h(f.examples):"{...}";return f.extended?j(f.examples):h(f.examples);case 1:return q(f.options);case 2:if(f.dataType==="object")return f.examples?z(f.examples):"[{...}]";return z(f.examples);default:return""}}}export{B as ActionUsageClient};
1
+ class B{params;constructor(f){this.params=f??[]}addParam(f,b,h,j,q,z="string",v){return this.params.push({id:f,type:0,dataType:z,required:!0,name:b,description:h,extended:j??!1,examples:q,wildcardId:v}),this}addOptionalParam(f,b,h,j,q,z="string",v){return this.params.push({id:f,type:0,dataType:z,required:!1,name:b,description:h,extended:j??!1,examples:q,wildcardId:v}),this}addSelect(f,b,h,j,q,z="string",v){return this.params.push({id:f,type:1,dataType:z,required:!0,name:b,description:h,options:j,examples:q,wildcardId:v}),this}addOptionalSelect(f,b,h,j,q,z="string",v){return this.params.push({id:f,type:1,dataType:z,required:!1,name:b,description:h,options:j,examples:q,wildcardId:v}),this}addArrayParam(f,b,h,j,q="string",z){return this.params.push({id:f,type:2,dataType:q,required:!0,name:b,description:h,examples:j,wildcardId:z}),this}addOptionalArrayParam(f,b,h,j,q="string",z){return this.params.push({id:f,type:2,dataType:q,required:!1,name:b,description:h,examples:j,wildcardId:z}),this}addObjectParam(f,b,h,j,q){return this.params.push({id:f,type:0,extended:!1,dataType:"object",required:!0,name:b,description:h,properties:j,examples:q}),this}addOptionalObjectParam(f,b,h,j,q){return this.params.push({id:f,type:0,extended:!1,dataType:"object",required:!1,name:b,description:h,properties:j,examples:q}),this}addObjectArrayParam(f,b,h,j,q){return this.params.push({id:f,type:2,dataType:"object",required:!0,name:b,description:h,properties:j,examples:q}),this}addPropertyKeyParam(f,b,h,j,q,z){return this.params.push({id:f,type:0,dataType:"string",required:!0,name:b,description:h,extended:q??!1,examples:z,propertyFrom:j}),this}addOptionalPropertyKeyParam(f,b,h,j,q,z){return this.params.push({id:f,type:0,dataType:"string",required:!1,name:b,description:h,extended:q??!1,examples:z,propertyFrom:j}),this}addOptionalObjectArrayParam(f,b,h,j,q){return this.params.push({id:f,type:2,dataType:"object",required:!1,name:b,description:h,properties:j,examples:q}),this}getUsage(){return this.params.map((f)=>B.getParamUsage(f)).join(" ")}getExample(){return this.params.map((f)=>B.getParamExample(f)).join(" ")}static getParamUsage(f){switch(f.type){case 0:if(f.dataType==="object")return f.required?`<{${f.name}}>`:`[{${f.name}}]`;return f.required?`<${f.extended?"...":""}${f.name}>`:`[${f.extended?"...":""}${f.name}]`;case 1:return f.required?`<${f.options.map((b)=>b.name).join(" | ")}>`:`[${f.options.map((b)=>b.name).join(" | ")}]`;case 2:if(f.dataType==="object")return f.required?`<{${f.name}}[]>`:`[{${f.name}}[]]`;return f.required?`<${f.name}[]>`:`[${f.name}[]]`;default:return""}}static getParamExample(f){let b=(v)=>v[Math.floor(Math.random()*v.length)],h=(v)=>v?b(v):b(["Angel","Brian","Catherine","David","Emma","Frank","Grace","Hannah","Ian","Julia","Josefina"]),j=(v)=>v?b(v):b(["Brian Stronghold","Catherine Joyful","David Noble","Emma Graceful","Frank Fearless","Grace Serene","Hannah Bold","Ian Clever","Julia Kindhearted","Romana Einstein"]),q=(v)=>b(v)?.name,z=(v)=>v?b(v):b(["Angel","Brian","Catherine","David","Emma","Frank","Grace","Hannah","Ian","Julia","Josefina"]);switch(f.type){case 0:if(f.dataType==="object")return f.examples?h(f.examples):"{...}";return f.extended?j(f.examples):h(f.examples);case 1:return q(f.options);case 2:if(f.dataType==="object")return f.examples?z(f.examples):"[{...}]";return z(f.examples);default:return""}}}export{B as ActionUsageClient};
@@ -114,6 +114,7 @@ export interface IBaseActionInput {
114
114
  examples?: string[];
115
115
  required?: boolean;
116
116
  properties?: IObjectProperty[];
117
+ propertyFrom?: string;
117
118
  wildcardId?: string;
118
119
  }
119
120
  export interface ISingleInput extends IBaseActionInput {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fnlb-project/shared",
3
- "version": "1.5.127",
3
+ "version": "1.5.128",
4
4
  "description": "FNLB Shared Library",
5
5
  "files": [
6
6
  "dist"