okai 0.0.23 → 0.0.25

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/api.d.ts CHANGED
@@ -8,6 +8,17 @@ declare global {
8
8
  deletedBy?: string
9
9
  }
10
10
 
11
+ // Assume User DTO exists
12
+ export class User {
13
+ id: string
14
+ userName: string
15
+ email: string
16
+ firstName: string
17
+ lastName: string
18
+ displayName: string
19
+ profileUrl: string
20
+ }
21
+
11
22
  export type TypeOf = `typeof(${string})`
12
23
  export type InputAttrOptions = { type?:string, value?:string, placeholder?:string, help?:string, label?:string, title?:string, size?:string,
13
24
  pattern?:string, readOnly?:boolean, required?:boolean, disabled?:boolean, autocomplete?:string, autofocus?:string,
@@ -98,9 +109,9 @@ declare global {
98
109
  export function validateExactLength(length:number) : ClassFieldDecoratorDef
99
110
  export function validateMinimumLength(min:number) : ClassFieldDecoratorDef
100
111
  export function validateMaximumLength(max:number) : ClassFieldDecoratorDef
101
- export function validateLessThanLength(value:number) : ClassFieldDecoratorDef
112
+ export function validateLessThan(value:number) : ClassFieldDecoratorDef
102
113
  export function validateLessThanOrEqual(value:number) : ClassFieldDecoratorDef
103
- export function validateGreaterThanLength(value:number) : ClassFieldDecoratorDef
114
+ export function validateGreaterThan(value:number) : ClassFieldDecoratorDef
104
115
  export function validateGreaterThanOrEqual(value:number) : ClassFieldDecoratorDef
105
116
  export function validateScalePrecision(scale:number, precision:number) : ClassFieldDecoratorDef
106
117
  export function validateRegularExpression(pattern:string) : ClassFieldDecoratorDef
@@ -141,7 +152,7 @@ declare global {
141
152
  export function ignoreOnUpdate() : ClassFieldDecoratorDef
142
153
  export function ignoreOnInsert() : ClassFieldDecoratorDef
143
154
  export function ignoreDataMember() : ClassFieldDecoratorDef
144
- export function reference() : ClassFieldDecoratorDef
155
+ export function reference(opt?:{ selfId?:string, refId?:string, refLabel?:string }) : ClassFieldDecoratorDef
145
156
  export function referenceField(model:TypeOf, id?:string, field?:string) : ClassFieldDecoratorDef
146
157
  export function references(type:TypeOf) : ClassFieldDecoratorDef
147
158
  export function required() : ClassFieldDecoratorDef
@@ -264,9 +275,9 @@ declare global {
264
275
  validateExactLength:typeof validateExactLength
265
276
  validateMinimumLength:typeof validateMinimumLength
266
277
  validateMaximumLength:typeof validateMaximumLength
267
- validateLessThanLength:typeof validateLessThanLength
278
+ validateLessThan:typeof validateLessThan
268
279
  validateLessThanOrEqual:typeof validateLessThanOrEqual
269
- validateGreaterThanLength:typeof validateGreaterThanLength
280
+ validateGreaterThan:typeof validateGreaterThan
270
281
  validateGreaterThanOrEqual:typeof validateGreaterThanOrEqual
271
282
  validateScalePrecision:typeof validateScalePrecision
272
283
  validateRegularExpression:typeof validateRegularExpression
package/dist/cs-apis.js CHANGED
@@ -1,4 +1,4 @@
1
- import { getGroupName, splitCase } from "./utils.js";
1
+ import { getGroupName } from "./utils.js";
2
2
  import { CSharpGenerator } from "./cs-gen.js";
3
3
  export class CSharpApiGenerator extends CSharpGenerator {
4
4
  toApiClass(op) {
@@ -78,14 +78,6 @@ export class CSharpApiGenerator extends CSharpGenerator {
78
78
  }
79
79
  generate(ast) {
80
80
  const groupName = getGroupName(ast);
81
- const friendlyGroupName = splitCase(groupName);
82
- ast.operations.forEach(op => {
83
- if (op.request.attributes?.find(x => x.name === 'Tag'))
84
- return;
85
- if (!op.tags)
86
- op.tags = [];
87
- op.tags.push(friendlyGroupName);
88
- });
89
81
  this.namespaces = Array.from(ast.namespaces);
90
82
  this.apis = ast.operations.map(x => this.toApiClass(x));
91
83
  this.classes = ast.types.filter(t => !t.isEnum).map(x => this.toClass(x));
@@ -123,3 +115,8 @@ export class CSharpApiGenerator extends CSharpGenerator {
123
115
  return { [`MyApp.ServiceModel/${fileName}`]: cs };
124
116
  }
125
117
  }
118
+ export function toCSharpApis(csAst) {
119
+ const csFiles = new CSharpApiGenerator().generate(csAst);
120
+ const cs = csFiles[Object.keys(csFiles)[0]];
121
+ return cs;
122
+ }