@fnlb-project/shared 1.5.124 → 1.5.125

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
+ wildcardId?: string;
26
27
  }
27
28
  export interface ISingleInput extends IBaseActionInput {
28
29
  type: ActionIOType.Single;
@@ -48,26 +49,26 @@ export interface IObjectProperty {
48
49
  required?: boolean;
49
50
  }
50
51
  export type ActionInput = ISingleInput | ISelectInput | IArrayInput;
51
- export type DataTypeToType<T extends ActionDataType> = T extends ActionDataType.Integer | ActionDataType.Float ? number : T extends ActionDataType.Boolean ? boolean : T extends ActionDataType.Object ? Record<string, any> : string;
52
+ export type DataTypeToType<T extends ActionDataType> = T extends ActionDataType.Integer | ActionDataType.Float ? number : T extends ActionDataType.Boolean ? boolean : T extends ActionDataType.Object ? Record<string, any> : T extends ActionDataType.Wildcard ? any : string;
52
53
  export declare class ActionUsageClient<Schema extends Record<string, any> = {}> {
53
54
  params: ActionInput[];
54
55
  constructor(params?: ActionInput[]);
55
- addParam<Id extends string, DT extends ActionDataType = ActionDataType.String>(id: Id, name: string, description: string, extended?: boolean, examples?: string[], dataType?: DT): ActionUsageClient<Schema & {
56
+ addParam<Id extends string, DT extends ActionDataType = ActionDataType.String>(id: Id, name: string, description: string, extended?: boolean, examples?: string[], dataType?: DT, wildcardId?: string): ActionUsageClient<Schema & {
56
57
  [K in Id]: DataTypeToType<DT>;
57
58
  }>;
58
- addOptionalParam<Id extends string, DT extends ActionDataType = ActionDataType.String>(id: Id, name: string, description: string, extended?: boolean, examples?: string[], dataType?: DT): ActionUsageClient<Schema & {
59
+ addOptionalParam<Id extends string, DT extends ActionDataType = ActionDataType.String>(id: Id, name: string, description: string, extended?: boolean, examples?: string[], dataType?: DT, wildcardId?: string): ActionUsageClient<Schema & {
59
60
  [K in Id]: DataTypeToType<DT>;
60
61
  }>;
61
- addSelect<Id extends string, DT extends ActionDataType = ActionDataType.String>(id: Id, name: string, description: string, options: ISelectInputOptions[], examples?: string[], dataType?: DT): ActionUsageClient<Schema & {
62
+ addSelect<Id extends string, DT extends ActionDataType = ActionDataType.String>(id: Id, name: string, description: string, options: ISelectInputOptions[], examples?: string[], dataType?: DT, wildcardId?: string): ActionUsageClient<Schema & {
62
63
  [K in Id]: DataTypeToType<DT>;
63
64
  }>;
64
- addOptionalSelect<Id extends string, DT extends ActionDataType = ActionDataType.String>(id: Id, name: string, description: string, options: ISelectInputOptions[], examples?: string[], dataType?: DT): ActionUsageClient<Schema & {
65
+ addOptionalSelect<Id extends string, DT extends ActionDataType = ActionDataType.String>(id: Id, name: string, description: string, options: ISelectInputOptions[], examples?: string[], dataType?: DT, wildcardId?: string): ActionUsageClient<Schema & {
65
66
  [K in Id]: DataTypeToType<DT>;
66
67
  }>;
67
- addArrayParam<Id extends string, DT extends ActionDataType = ActionDataType.String>(id: Id, name: string, description: string, examples?: string[], dataType?: DT): ActionUsageClient<Schema & {
68
+ addArrayParam<Id extends string, DT extends ActionDataType = ActionDataType.String>(id: Id, name: string, description: string, examples?: string[], dataType?: DT, wildcardId?: string): ActionUsageClient<Schema & {
68
69
  [K in Id]: DataTypeToType<DT>[];
69
70
  }>;
70
- addOptionalArrayParam<Id extends string, DT extends ActionDataType = ActionDataType.String>(id: Id, name: string, description: string, examples?: string[], dataType?: DT): ActionUsageClient<Schema & {
71
+ addOptionalArrayParam<Id extends string, DT extends ActionDataType = ActionDataType.String>(id: Id, name: string, description: string, examples?: string[], dataType?: DT, wildcardId?: string): ActionUsageClient<Schema & {
71
72
  [K in Id]: DataTypeToType<DT>[];
72
73
  }>;
73
74
  addObjectParam<Id extends string>(id: Id, name: string, description: string, properties: IObjectProperty[], examples?: string[]): ActionUsageClient<Schema & {
@@ -1 +1 @@
1
- class z{params;constructor(f){this.params=f??[]}addParam(f,b,h,j,q,w="string"){return this.params.push({id:f,type:0,dataType:w,required:!0,name:b,description:h,extended:j??!1,examples:q}),this}addOptionalParam(f,b,h,j,q,w="string"){return this.params.push({id:f,type:0,dataType:w,required:!1,name:b,description:h,extended:j??!1,examples:q}),this}addSelect(f,b,h,j,q,w="string"){return this.params.push({id:f,type:1,dataType:w,required:!0,name:b,description:h,options:j,examples:q}),this}addOptionalSelect(f,b,h,j,q,w="string"){return this.params.push({id:f,type:1,dataType:w,required:!1,name:b,description:h,options:j,examples:q}),this}addArrayParam(f,b,h,j,q="string"){return this.params.push({id:f,type:2,dataType:q,required:!0,name:b,description:h,examples:j}),this}addOptionalArrayParam(f,b,h,j,q="string"){return this.params.push({id:f,type:2,dataType:q,required:!1,name:b,description:h,examples:j}),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)=>z.getParamUsage(f)).join(" ")}getExample(){return this.params.map((f)=>z.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,w=(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?w(f.examples):"[{...}]";return w(f.examples);default:return""}}}export{z 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}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
+ wildcardId?: string;
117
118
  }
118
119
  export interface ISingleInput extends IBaseActionInput {
119
120
  type: ActionIOType.Single;
@@ -147,6 +148,7 @@ export interface IActionOutput {
147
148
  description?: string;
148
149
  required?: boolean;
149
150
  properties?: IObjectProperty[];
151
+ wildcardId?: string;
150
152
  }
151
153
  export interface ISerializedActionControlFlow {
152
154
  id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fnlb-project/shared",
3
- "version": "1.5.124",
3
+ "version": "1.5.125",
4
4
  "description": "FNLB Shared Library",
5
5
  "files": [
6
6
  "dist"