@looker/sdk-codegen 21.8.2 → 21.9.2

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.
Files changed (80) hide show
  1. package/CHANGELOG.md +153 -167
  2. package/README.md +0 -1
  3. package/lib/codeGen.d.ts +15 -1
  4. package/lib/codeGen.js +23 -6
  5. package/lib/codeGen.js.map +1 -1
  6. package/lib/codeGenerators.d.ts +3 -3
  7. package/lib/codeGenerators.js +2 -4
  8. package/lib/codeGenerators.js.map +1 -1
  9. package/lib/csharp.gen.d.ts +1 -1
  10. package/lib/csharp.gen.js +2 -2
  11. package/lib/csharp.gen.js.map +1 -1
  12. package/lib/declarationInfo.d.ts +3 -3
  13. package/lib/declarationInfo.js +1 -2
  14. package/lib/declarationInfo.js.map +1 -1
  15. package/lib/esm/codeGen.js +33 -23
  16. package/lib/esm/codeGen.js.map +1 -1
  17. package/lib/esm/codeGenerators.js +17 -28
  18. package/lib/esm/codeGenerators.js.map +1 -1
  19. package/lib/esm/csharp.gen.js +11 -18
  20. package/lib/esm/csharp.gen.js.map +1 -1
  21. package/lib/esm/declarationInfo.js +3 -10
  22. package/lib/esm/declarationInfo.js.map +1 -1
  23. package/lib/esm/exampleInfo.js +9 -24
  24. package/lib/esm/exampleInfo.js.map +1 -1
  25. package/lib/esm/go.gen.js +11 -18
  26. package/lib/esm/go.gen.js.map +1 -1
  27. package/lib/esm/index.js +13 -148
  28. package/lib/esm/index.js.map +1 -1
  29. package/lib/esm/kotlin.gen.js +11 -18
  30. package/lib/esm/kotlin.gen.js.map +1 -1
  31. package/lib/esm/pseudo.gen.js +6 -13
  32. package/lib/esm/pseudo.gen.js.map +1 -1
  33. package/lib/esm/python.gen.js +13 -20
  34. package/lib/esm/python.gen.js.map +1 -1
  35. package/lib/esm/sdkModels.js +431 -116
  36. package/lib/esm/sdkModels.js.map +1 -1
  37. package/lib/esm/specConverter.js +31 -59
  38. package/lib/esm/specConverter.js.map +1 -1
  39. package/lib/esm/specDiff.js +19 -36
  40. package/lib/esm/specDiff.js.map +1 -1
  41. package/lib/esm/swift.gen.js +17 -24
  42. package/lib/esm/swift.gen.js.map +1 -1
  43. package/lib/esm/typescript.gen.js +168 -31
  44. package/lib/esm/typescript.gen.js.map +1 -1
  45. package/lib/exampleInfo.d.ts +8 -20
  46. package/lib/exampleInfo.js +1 -2
  47. package/lib/exampleInfo.js.map +1 -1
  48. package/lib/go.gen.js +3 -3
  49. package/lib/go.gen.js.map +1 -1
  50. package/lib/index.js.map +1 -1
  51. package/lib/kotlin.gen.d.ts +1 -1
  52. package/lib/kotlin.gen.js +2 -2
  53. package/lib/kotlin.gen.js.map +1 -1
  54. package/lib/pseudo.gen.js +2 -2
  55. package/lib/pseudo.gen.js.map +1 -1
  56. package/lib/python.gen.js +4 -4
  57. package/lib/python.gen.js.map +1 -1
  58. package/lib/sdkModels.d.ts +33 -13
  59. package/lib/sdkModels.js +397 -46
  60. package/lib/sdkModels.js.map +1 -1
  61. package/lib/specConverter.d.ts +9 -12
  62. package/lib/specConverter.js +14 -22
  63. package/lib/specConverter.js.map +1 -1
  64. package/lib/specDiff.d.ts +4 -4
  65. package/lib/specDiff.js +6 -8
  66. package/lib/specDiff.js.map +1 -1
  67. package/lib/swift.gen.js +2 -2
  68. package/lib/swift.gen.js.map +1 -1
  69. package/lib/typescript.gen.d.ts +13 -0
  70. package/lib/typescript.gen.js +157 -13
  71. package/lib/typescript.gen.js.map +1 -1
  72. package/package.json +8 -7
  73. package/lib/esm/testUtils/index.js +0 -17
  74. package/lib/esm/testUtils/index.js.map +0 -1
  75. package/lib/esm/testUtils/testUtils.js +0 -66
  76. package/lib/esm/testUtils/testUtils.js.map +0 -1
  77. package/lib/testUtils/index.js +0 -17
  78. package/lib/testUtils/index.js.map +0 -1
  79. package/lib/testUtils/testUtils.js +0 -66
  80. package/lib/testUtils/testUtils.js.map +0 -1
@@ -13,9 +13,10 @@ export declare enum TypeOfType {
13
13
  Enum = 4,
14
14
  Complex = 5
15
15
  }
16
+ export declare const parseFields: (fields: FieldsSpec) => ArgValues;
16
17
  export declare const typeOfType: (type: IType) => TypeOfType;
17
18
  export declare const isSpecialName: (name: string) => boolean;
18
- export declare type ArgValues = {
19
+ export type ArgValues = {
19
20
  [key: string]: any;
20
21
  };
21
22
  export declare const safeName: (value: string) => string;
@@ -49,14 +50,14 @@ export interface IParameter extends ITypedSymbol {
49
50
  doEncode(): boolean;
50
51
  }
51
52
  export declare const describeParam: (param: IParameter) => string;
52
- export declare type KeyedCollection<T> = Record<string, T>;
53
- export declare type MethodList = KeyedCollection<IMethod>;
54
- export declare type TypeList = KeyedCollection<IType>;
55
- export declare type TagList = KeyedCollection<MethodList>;
56
- export declare type TypeTagList = KeyedCollection<TypeList>;
57
- export declare type PropertyList = KeyedCollection<IProperty>;
58
- export declare type KeyList = Set<string>;
59
- export declare type EnumValueType = string | number;
53
+ export type KeyedCollection<T> = Record<string, T>;
54
+ export type MethodList = KeyedCollection<IMethod>;
55
+ export type TypeList = KeyedCollection<IType>;
56
+ export type TagList = KeyedCollection<MethodList>;
57
+ export type TypeTagList = KeyedCollection<TypeList>;
58
+ export type PropertyList = KeyedCollection<IProperty>;
59
+ export type KeyList = Set<string>;
60
+ export type EnumValueType = string | number;
60
61
  export declare const keyValues: (list: KeyList) => string[];
61
62
  export declare const mayQuote: (value: any, quoteChar?: string) => string;
62
63
  export declare const methodRefs: (api: IApiModel, refs: KeyList) => IMethod[];
@@ -78,8 +79,8 @@ export declare enum SearchCriterion {
78
79
  status = 8,
79
80
  response = 9
80
81
  }
81
- export declare type SearchCriterionTerm = keyof typeof SearchCriterion;
82
- export declare type SearchCriteria = Set<SearchCriterion>;
82
+ export type SearchCriterionTerm = keyof typeof SearchCriterion;
83
+ export type SearchCriteria = Set<SearchCriterion>;
83
84
  export declare const SearchAll: SearchCriteria;
84
85
  export declare const criteriaToSet: (criteria: string[]) => SearchCriteria;
85
86
  export declare const setToCriteria: (criteria: SearchCriteria) => string[];
@@ -99,6 +100,12 @@ export declare enum MetaType {
99
100
  Request = "Request",
100
101
  Enumerated = "Enumerated"
101
102
  }
103
+ export interface ITypeMock {
104
+ fields?: FieldsSpec;
105
+ override?: string | ArgValues | ((response: any, mocked: any) => any);
106
+ httpCode?: number;
107
+ empty?: boolean;
108
+ }
102
109
  export interface IType extends ISymbol {
103
110
  properties: PropertyList;
104
111
  requiredProperties: PropertyList;
@@ -121,6 +128,8 @@ export interface IType extends ISymbol {
121
128
  className: string;
122
129
  intrinsic: boolean;
123
130
  metaType: MetaType;
131
+ mock(options?: ITypeMock): any | undefined;
132
+ mockType<T>(options?: ITypeMock): T;
124
133
  instanceOf(className: string): boolean;
125
134
  asHashString(): string;
126
135
  isRecursive(): boolean;
@@ -140,7 +149,8 @@ export interface IMethodResponse {
140
149
  search(rx: RegExp, criteria: SearchCriteria): boolean;
141
150
  searchString(criteria: SearchCriteria): string;
142
151
  }
143
- export declare const tagTypes: (api: ApiModel, types: TypeList) => {};
152
+ export declare const tagTypes: (api: ApiModel, types: TypeList) => ArgValues;
153
+ export type FieldsSpec = string | string[] | ArgValues;
144
154
  export interface IProperty extends ITypedSymbol {
145
155
  required: boolean;
146
156
  nullable: boolean;
@@ -148,6 +158,9 @@ export interface IProperty extends ITypedSymbol {
148
158
  readOnly: boolean;
149
159
  writeOnly: boolean;
150
160
  deprecated: boolean;
161
+ schema: OAS.SchemaObject;
162
+ owner: string;
163
+ mock(options?: ITypeMock): any | undefined;
151
164
  searchString(include: SearchCriteria): string;
152
165
  search(rx: RegExp, include: SearchCriteria): boolean;
153
166
  summary(): string;
@@ -190,6 +203,7 @@ export declare class Property extends SchemadSymbol implements IProperty {
190
203
  asHashString(): string;
191
204
  searchString(criteria: SearchCriteria): string;
192
205
  search(rx: RegExp, criteria: SearchCriteria): boolean;
206
+ mock(options?: ITypeMock): any | undefined;
193
207
  }
194
208
  export declare class Parameter extends SchemadSymbol implements IParameter {
195
209
  description: string;
@@ -333,6 +347,8 @@ export declare class Type implements IType {
333
347
  get requiredProperties(): PropertyList;
334
348
  get optionalProperties(): PropertyList;
335
349
  get hasSpecialNeeds(): boolean;
350
+ mock(options?: ITypeMock): any | undefined;
351
+ mockType<T>(options?: ITypeMock): T;
336
352
  load(api: ApiModel): void;
337
353
  instanceOf(className: string): boolean;
338
354
  asHashString(): string;
@@ -346,12 +362,14 @@ export declare class ArrayType extends Type {
346
362
  constructor(elementType: IType, schema: OAS.SchemaObject);
347
363
  get className(): string;
348
364
  get readOnly(): boolean;
365
+ mock(options?: ITypeMock): any | undefined;
349
366
  }
350
367
  export declare class EnumType extends Type implements IEnumType {
351
368
  elementType: IType;
352
369
  readonly values: EnumValueType[];
353
370
  constructor(elementType: IType, schema: OAS.SchemaObject, api: ApiModel, typeName?: string, methodName?: string);
354
371
  private findName;
372
+ mock(_options?: ITypeMock): any | undefined;
355
373
  searchString(criteria: SearchCriteria): string;
356
374
  get className(): string;
357
375
  get readOnly(): boolean;
@@ -373,6 +391,7 @@ export declare class IntrinsicType extends Type {
373
391
  static stringTypes: string[];
374
392
  isString: boolean;
375
393
  constructor(name: string);
394
+ mock(options?: ITypeMock): any;
376
395
  get className(): string;
377
396
  get intrinsic(): boolean;
378
397
  get readOnly(): boolean;
@@ -384,6 +403,7 @@ export declare class WriteType extends Type {
384
403
  constructor(api: IApiModel, type: IType);
385
404
  private static readonlyProps;
386
405
  }
406
+ export declare const specToModel: (spec: any) => ApiModel;
387
407
  export interface IApiModel extends IModel {
388
408
  version: string;
389
409
  description: string;
@@ -418,7 +438,7 @@ export declare class ApiModel implements ISymbolTable, IApiModel {
418
438
  resolveType(schema: string | OAS.SchemaObject | OAS.ReferenceObject, style?: string, typeName?: string, methodName?: string): IType;
419
439
  private requestTypeName;
420
440
  makeRequestType(method: IMethod): RequestType;
421
- registerEnum(type: IType, methodName?: string): IType;
441
+ registerEnum(type: IType, methodName?: string): IType | EnumType;
422
442
  private _getRequestType;
423
443
  getRequestType(method: IMethod): IType | undefined;
424
444
  getEnumList(): TypeList;