@looker/sdk-codegen-utils 21.0.11 → 21.0.13
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/CHANGELOG.md +33 -2
- package/LICENSE +1 -1
- package/README.md +0 -1
- package/lib/esm/index.js +1 -0
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/testUtils.js +143 -0
- package/lib/esm/testUtils.js.map +1 -0
- package/lib/esm/utils.js +0 -2
- package/lib/esm/utils.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +11 -2
- package/lib/index.js.map +1 -1
- package/lib/testUtils.d.ts +36 -0
- package/lib/testUtils.js +162 -0
- package/lib/testUtils.js.map +1 -0
- package/lib/utils.js +1 -16
- package/lib/utils.js.map +1 -1
- package/package.json +11 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,8 +1,39 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## [21.0.13](https://github.com/looker-open-source/sdk-codegen/compare/sdk-codegen-utils-v21.0.12...sdk-codegen-utils-v21.0.13) (2024-09-14)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* fix release 24.16.2 ([#1505](https://github.com/looker-open-source/sdk-codegen/issues/1505)) ([1cd1806](https://github.com/looker-open-source/sdk-codegen/commit/1cd180615901d2daf1fb112b41f2a72d2caacf61))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* devDependencies
|
|
15
|
+
* @looker/sdk-rtl bumped from 21.6.2 to 21.6.3
|
|
16
|
+
* @looker/sdk bumped from 24.16.0 to 24.16.1
|
|
17
|
+
* @looker/sdk-node bumped from 24.16.0 to 24.16.1
|
|
18
|
+
|
|
19
|
+
## [21.0.12](https://github.com/looker-open-source/sdk-codegen/compare/sdk-codegen-utils-v21.0.11...sdk-codegen-utils-v21.0.12) (2024-09-11)
|
|
4
20
|
|
|
5
21
|
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* Remove the requests package from the TypeScript SDK ([#1491](https://github.com/looker-open-source/sdk-codegen/issues/1491)) ([670377c](https://github.com/looker-open-source/sdk-codegen/commit/670377c46a546bbd8dcc6679b8aeb041da1b4670)), closes [#1439](https://github.com/looker-open-source/sdk-codegen/issues/1439)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Dependencies
|
|
28
|
+
|
|
29
|
+
* The following workspace dependencies were updated
|
|
30
|
+
* devDependencies
|
|
31
|
+
* @looker/sdk-rtl bumped from 21.6.1 to 21.6.2
|
|
32
|
+
* @looker/sdk bumped from 24.12.1 to 24.16.0
|
|
33
|
+
* @looker/sdk-node bumped from 24.12.1 to 24.16.0
|
|
34
|
+
|
|
35
|
+
### [21.0.11](https://www.github.com/looker-open-source/sdk-codegen/compare/sdk-codegen-utils-v21.0.10...sdk-codegen-utils-v21.0.11) (2021-04-02)
|
|
36
|
+
|
|
6
37
|
### Features
|
|
7
38
|
|
|
8
|
-
|
|
39
|
+
- Added --versions option to the code generator ([#514](https://www.github.com/looker-open-source/sdk-codegen/issues/514)) ([ee6f3e8](https://www.github.com/looker-open-source/sdk-codegen/commit/ee6f3e8f55e300df1a75c9be89b47f067bc08dee))
|
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2023 Looker Data Sciences, Inc.
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -4,7 +4,6 @@ This package contains utility routines for the SDK code generator projects
|
|
|
4
4
|
|
|
5
5
|
The code in this package is really trivial and should not be used directly in your own projects.
|
|
6
6
|
|
|
7
|
-
This package has no node dependencies.
|
|
8
7
|
|
|
9
8
|
**DEPRECATED AND NOT SUPPORTED**: Looker does not support direct use of this package, other than via indirect use in the
|
|
10
9
|
[SDK Codegen project](https://github.com/looker-open-source/sdk-codegen) repository.
|
package/lib/esm/index.js
CHANGED
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/index.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nexport * from './utils';\nexport * from './testUtils';\n"],"mappings":"AA0BA,cAAc,SAAS;AACvB,cAAc,aAAa"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
3
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
5
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
6
|
+
import * as fs from 'fs';
|
|
7
|
+
import path from 'path';
|
|
8
|
+
import * as yaml from 'js-yaml';
|
|
9
|
+
import isEmpty from 'lodash/isEmpty';
|
|
10
|
+
import { findRootSync } from '@manypkg/find-root';
|
|
11
|
+
import { ApiConfigSection, NodeSession, readEnvConfig, readIniConfig } from '@looker/sdk-node';
|
|
12
|
+
import { ApiSettings } from '@looker/sdk-rtl';
|
|
13
|
+
import { Looker40SDK, functionalSdk40 } from '@looker/sdk';
|
|
14
|
+
var utf8 = 'utf-8';
|
|
15
|
+
export var specFromFile = (specFile, loader) => {
|
|
16
|
+
var specContent = fs.readFileSync(specFile, {
|
|
17
|
+
encoding: utf8
|
|
18
|
+
});
|
|
19
|
+
return loader(specContent);
|
|
20
|
+
};
|
|
21
|
+
var rootPath = '';
|
|
22
|
+
export var getRootPath = () => {
|
|
23
|
+
if (!rootPath) {
|
|
24
|
+
rootPath = findRootSync(__dirname).rootDir;
|
|
25
|
+
}
|
|
26
|
+
return rootPath;
|
|
27
|
+
};
|
|
28
|
+
export var rootFile = function rootFile() {
|
|
29
|
+
var fileName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
30
|
+
return path.join(getRootPath(), fileName);
|
|
31
|
+
};
|
|
32
|
+
var _mockSpec;
|
|
33
|
+
export var mockApiSpec = loader => {
|
|
34
|
+
if (!_mockSpec) {
|
|
35
|
+
var spec = rootFile('test/core/undoc_api_4.0.json');
|
|
36
|
+
if (!fs.existsSync(spec)) {
|
|
37
|
+
throw new Error("run 'bin/sdk_gen -f' to generate the API spec file '".concat(spec, "'"));
|
|
38
|
+
}
|
|
39
|
+
var obj = JSON.parse(fs.readFileSync(spec, utf8));
|
|
40
|
+
_mockSpec = loader(obj);
|
|
41
|
+
}
|
|
42
|
+
return _mockSpec;
|
|
43
|
+
};
|
|
44
|
+
export var testFile = function testFile() {
|
|
45
|
+
var filename = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
46
|
+
return path.join(rootFile('/packages/sdk-codegen-utils/data/'), filename);
|
|
47
|
+
};
|
|
48
|
+
export class MeldSettings extends ApiSettings {
|
|
49
|
+
constructor(settings) {
|
|
50
|
+
super(settings);
|
|
51
|
+
this.settings = settings;
|
|
52
|
+
}
|
|
53
|
+
readConfig(_section) {
|
|
54
|
+
return {
|
|
55
|
+
client_id: this.settings.client_id,
|
|
56
|
+
client_secret: this.settings.client_secret
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
export var lookUp = fileName => {
|
|
61
|
+
var root = getRootPath();
|
|
62
|
+
var dir = __dirname;
|
|
63
|
+
while (dir >= root) {
|
|
64
|
+
var f = path.join(dir, fileName);
|
|
65
|
+
if (fs.existsSync(f)) {
|
|
66
|
+
return f;
|
|
67
|
+
} else {
|
|
68
|
+
dir = path.join(dir, '../');
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return '';
|
|
72
|
+
};
|
|
73
|
+
export var getCypressSettings = () => {
|
|
74
|
+
var cypressFile = lookUp('cypress.env.json');
|
|
75
|
+
var config = fs.existsSync(cypressFile) ? JSON.parse(fs.readFileSync(cypressFile, utf8)) : {};
|
|
76
|
+
var cypress = {};
|
|
77
|
+
Object.keys(config).forEach(k => cypress[k.toLowerCase()] = config[k]);
|
|
78
|
+
var env = readEnvConfig('CYPRESS');
|
|
79
|
+
return _objectSpread(_objectSpread({}, cypress), env);
|
|
80
|
+
};
|
|
81
|
+
export var loadApiSettings = (_rootPath, localIni) => {
|
|
82
|
+
var cypressSettings = getCypressSettings();
|
|
83
|
+
var local = fs.existsSync(localIni) ? ApiConfigSection(fs.readFileSync(localIni, utf8)) : {};
|
|
84
|
+
var settings = _objectSpread(_objectSpread({
|
|
85
|
+
verify_ssl: false,
|
|
86
|
+
base_url: 'https://localhost:19999'
|
|
87
|
+
}, local), cypressSettings);
|
|
88
|
+
var result = new MeldSettings(settings);
|
|
89
|
+
var creds = result.readConfig();
|
|
90
|
+
if (isEmpty(creds)) {
|
|
91
|
+
throw new Error("Test SDK not initialized. Configure environment variables, 'cypress.env.json', or '".concat(localIni, "'"));
|
|
92
|
+
}
|
|
93
|
+
return result;
|
|
94
|
+
};
|
|
95
|
+
export var randomize = () => {
|
|
96
|
+
return Math.round(Math.random() * 100000);
|
|
97
|
+
};
|
|
98
|
+
export var entitle = (rando, title) => {
|
|
99
|
+
return "".concat(rando, " ").concat(title !== null && title !== void 0 ? title : '').trim();
|
|
100
|
+
};
|
|
101
|
+
export var createFunSdk = () => {
|
|
102
|
+
var root = getRootPath();
|
|
103
|
+
var localIni = process.env.LOOKERSDK_INI || "".concat(root, "looker.ini");
|
|
104
|
+
var settings = loadApiSettings(root, localIni);
|
|
105
|
+
var session = new NodeSession(settings);
|
|
106
|
+
return functionalSdk40(session);
|
|
107
|
+
};
|
|
108
|
+
export var TestConfig = function TestConfig(loader) {
|
|
109
|
+
var rootPath = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : getRootPath();
|
|
110
|
+
var testDataFile = 'data.yml';
|
|
111
|
+
var envPrefix = 'LOOKERSDK';
|
|
112
|
+
var sectionName = 'Looker';
|
|
113
|
+
var localIni = process.env.LOOKERSDK_INI || path.join(rootPath, 'looker.ini');
|
|
114
|
+
var settings = loadApiSettings(rootPath, localIni);
|
|
115
|
+
var session = new NodeSession(settings);
|
|
116
|
+
var sdk = new Looker40SDK(session);
|
|
117
|
+
var testPath = path.join(rootPath, '/packages/sdk-codegen-utils/data/');
|
|
118
|
+
var dataFile = testFile(testDataFile);
|
|
119
|
+
var testData = fs.existsSync(dataFile) ? yaml.load(fs.readFileSync(dataFile, utf8)) : {};
|
|
120
|
+
var apiTestModel = specFromFile(testFile('openApiRef.json'), loader);
|
|
121
|
+
var testIni = path.join(rootPath, testData.iniFile);
|
|
122
|
+
var section = readIniConfig(localIni, envPrefix, sectionName);
|
|
123
|
+
var baseUrl = section.base_url;
|
|
124
|
+
var timeout = parseInt(section.timeout, 10);
|
|
125
|
+
var testSection = readIniConfig(localIni, envPrefix, sectionName);
|
|
126
|
+
return {
|
|
127
|
+
apiTestModel,
|
|
128
|
+
dataFile,
|
|
129
|
+
localIni,
|
|
130
|
+
rootPath,
|
|
131
|
+
testData,
|
|
132
|
+
testIni,
|
|
133
|
+
testPath,
|
|
134
|
+
settings,
|
|
135
|
+
session,
|
|
136
|
+
sdk,
|
|
137
|
+
baseUrl,
|
|
138
|
+
section,
|
|
139
|
+
timeout,
|
|
140
|
+
testSection
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
//# sourceMappingURL=testUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testUtils.js","names":["fs","path","yaml","isEmpty","findRootSync","ApiConfigSection","NodeSession","readEnvConfig","readIniConfig","ApiSettings","Looker40SDK","functionalSdk40","utf8","specFromFile","specFile","loader","specContent","readFileSync","encoding","rootPath","getRootPath","__dirname","rootDir","rootFile","fileName","arguments","length","undefined","join","_mockSpec","mockApiSpec","spec","existsSync","Error","concat","obj","JSON","parse","testFile","filename","MeldSettings","constructor","settings","readConfig","_section","client_id","client_secret","lookUp","root","dir","f","getCypressSettings","cypressFile","config","cypress","Object","keys","forEach","k","toLowerCase","env","_objectSpread","loadApiSettings","_rootPath","localIni","cypressSettings","local","verify_ssl","base_url","result","creds","randomize","Math","round","random","entitle","rando","title","trim","createFunSdk","process","LOOKERSDK_INI","session","TestConfig","testDataFile","envPrefix","sectionName","sdk","testPath","dataFile","testData","load","apiTestModel","testIni","iniFile","section","baseUrl","timeout","parseInt","testSection"],"sources":["../../src/testUtils.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport * as fs from 'fs';\nimport path from 'path';\nimport * as yaml from 'js-yaml';\nimport isEmpty from 'lodash/isEmpty';\nimport { findRootSync } from '@manypkg/find-root';\nimport type { IApiConfig } from '@looker/sdk-node';\nimport {\n ApiConfigSection,\n NodeSession,\n readEnvConfig,\n readIniConfig,\n} from '@looker/sdk-node';\nimport type {\n IAPIMethods,\n IApiSection,\n IApiSettings,\n IAuthSession,\n} from '@looker/sdk-rtl';\nimport { ApiSettings } from '@looker/sdk-rtl';\n/* eslint-disable no-restricted-imports */\nimport { Looker40SDK, functionalSdk40 } from '@looker/sdk';\n\nconst utf8 = 'utf-8';\nexport type SpecLoader = (content: any) => any;\n\n/**\n * Convert a spec file into an APIModel\n * @param specFile name of spec file\n * @param loader callback to load spec as APIModel\n */\nexport const specFromFile = (specFile: string, loader: SpecLoader): any => {\n const specContent = fs.readFileSync(specFile, { encoding: utf8 });\n return loader(specContent);\n};\n\n/**\n * Properties used for various typescript-based tests\n */\nexport interface ITestConfig {\n /** the openApi.json snapshot in the test/ dir */\n apiTestModel: any;\n /** root dir of this repository */\n rootPath: string;\n /** <rootPath>/test dir */\n testPath: string;\n /** test/data.yml file */\n dataFile: string;\n /** root looker.ini file or LOOKERSDK_INI value */\n localIni: string;\n /** contents of test/data.yml */\n testData: any;\n /** ini file configured in testData */\n testIni: string;\n /* melded API config settings */\n settings: IApiSettings;\n /** melded sdk configuration session */\n session: IAuthSession;\n /** initialized typescript SDK from melded configuration */\n sdk: IAPIMethods;\n /** configured API base url */\n baseUrl: string;\n /** configured default INI section */\n section: any;\n /** configured timeout value */\n timeout: number;\n /** test INI section */\n testSection: any;\n}\n\nlet rootPath = '';\n/** fully resolved root dir of the repository */\nexport const getRootPath = (): string => {\n if (!rootPath) {\n rootPath = findRootSync(__dirname).rootDir;\n }\n return rootPath;\n};\n\n/**\n * Fully resolved path to a file based from the root path\n * @param fileName to path. It can start with folders\n */\nexport const rootFile = (fileName = ''): string =>\n path.join(getRootPath(), fileName);\n\nlet _mockSpec: any;\n/**\n * Returns the entire \"undocumented\" API specification as the model to use for mocking\n * because it includes everything from our current API\n * @param loader callback to load spec as APIModel\n */\nexport const mockApiSpec = (loader: SpecLoader) => {\n if (!_mockSpec) {\n const spec = rootFile('test/core/undoc_api_4.0.json');\n if (!fs.existsSync(spec)) {\n throw new Error(\n `run 'bin/sdk_gen -f' to generate the API spec file '${spec}'`\n );\n }\n const obj = JSON.parse(fs.readFileSync(spec, utf8));\n _mockSpec = loader(obj);\n }\n return _mockSpec;\n};\n\n/**\n * Fully resolved path to a file in the codegen test data folder\n * @param filename to path. It can start with folders\n */\nexport const testFile = (filename = ''): string =>\n path.join(rootFile('/packages/sdk-codegen-utils/data/'), filename);\n\nexport class MeldSettings extends ApiSettings {\n constructor(private settings: Partial<IApiSettings>) {\n super(settings);\n }\n\n readConfig(_section?: string): IApiSection {\n return {\n client_id: (this.settings as any).client_id,\n client_secret: (this.settings as any).client_secret,\n };\n }\n}\n\n/**\n * Find a file from the current directory up to the root of the repository\n * @param fileName to find from current directory\n */\nexport const lookUp = (fileName: string) => {\n const root = getRootPath();\n let dir = __dirname;\n while (dir >= root) {\n const f = path.join(dir, fileName);\n if (fs.existsSync(f)) {\n return f;\n } else {\n dir = path.join(dir, '../');\n }\n }\n return '';\n};\n\n/**\n * Gets the cypress settings\n */\nexport const getCypressSettings = (): Record<string, string> => {\n const cypressFile = lookUp('cypress.env.json');\n const config: any = fs.existsSync(cypressFile)\n ? JSON.parse(fs.readFileSync(cypressFile, utf8))\n : {};\n const cypress: Record<string, string> = {};\n Object.keys(config).forEach(k => (cypress[k.toLowerCase()] = config[k]));\n const env = readEnvConfig('CYPRESS');\n return {\n ...cypress,\n ...env,\n };\n};\n\n/**\n * Melds CYPRESS environment variables with cypress.env.json and optional looker.ini and returns the settings collection\n * @param rootPath root location of repository\n * @param localIni full name of default looker.ini. Needs to be passed in, but doesn't need to exist\n */\nexport const loadApiSettings = (\n _rootPath: string,\n localIni: string\n): IApiSettings => {\n const cypressSettings = getCypressSettings();\n const local: IApiConfig = fs.existsSync(localIni)\n ? ApiConfigSection(fs.readFileSync(localIni, utf8))\n : {};\n const settings = {\n verify_ssl: false,\n base_url: 'https://localhost:19999',\n ...local,\n ...cypressSettings,\n };\n const result = new MeldSettings(settings);\n const creds = result.readConfig();\n if (isEmpty(creds)) {\n throw new Error(\n `Test SDK not initialized. Configure environment variables, 'cypress.env.json', or '${localIni}'`\n );\n }\n return result;\n};\n\n/**\n * get a random value use for entity name constraints\n */\nexport const randomize = () => {\n return Math.round(Math.random() * 100000);\n};\n\n/**\n * Create a uniquely named title\n * @param rando value to use for unique name combo\n * @param title of entity to name\n */\nexport const entitle = (rando: string | number, title?: string) => {\n return `${rando} ${title ?? ''}`.trim();\n};\n\nexport const createFunSdk = (): IAPIMethods => {\n const root = getRootPath();\n const localIni = process.env.LOOKERSDK_INI || `${root}looker.ini`;\n const settings = loadApiSettings(root, localIni);\n const session = new NodeSession(settings);\n return functionalSdk40(session);\n};\n\n/**\n * Reads configuration information, returning various test values\n * @param loader callback to load spec as APIModel\n * @param rootPath root file path location for relative path resolution\n */\nexport const TestConfig = (\n loader: SpecLoader,\n rootPath = getRootPath()\n): ITestConfig => {\n const testDataFile = 'data.yml';\n const envPrefix = 'LOOKERSDK';\n const sectionName = 'Looker';\n const localIni =\n process.env.LOOKERSDK_INI || path.join(rootPath, 'looker.ini');\n const settings = loadApiSettings(rootPath, localIni);\n const session = new NodeSession(settings);\n const sdk: IAPIMethods = new Looker40SDK(session);\n const testPath = path.join(rootPath, '/packages/sdk-codegen-utils/data/');\n const dataFile = testFile(testDataFile);\n const testData: any = fs.existsSync(dataFile)\n ? yaml.load(fs.readFileSync(dataFile, utf8))\n : {};\n const apiTestModel = specFromFile(testFile('openApiRef.json'), loader);\n const testIni = path.join(rootPath, testData.iniFile);\n const section = readIniConfig(localIni, envPrefix, sectionName);\n const baseUrl = section.base_url;\n const timeout = parseInt(section.timeout, 10);\n const testSection = readIniConfig(localIni, envPrefix, sectionName);\n return {\n apiTestModel,\n dataFile,\n localIni,\n rootPath,\n testData,\n testIni,\n testPath,\n settings,\n session,\n sdk,\n baseUrl,\n section,\n timeout,\n testSection,\n };\n};\n"],"mappings":";;;;;AA0BA,OAAO,KAAKA,EAAE,MAAM,IAAI;A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
|
|
|
7
7
|
console.log(message);
|
|
8
8
|
return message;
|
|
9
9
|
};
|
|
10
|
-
|
|
11
10
|
var reset = message => "".concat(message).concat(Reset);
|
|
12
|
-
|
|
13
11
|
export var info = message => log(reset("".concat(FgCyan).concat(message)));
|
|
14
12
|
export var warn = message => log(reset("".concat(FgYellow).concat(message)));
|
|
15
13
|
export var danger = message => {
|
package/lib/esm/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"utils.js","names":["Reset","FgRed","FgGreen","FgYellow","FgCyan","log","message","console","reset","concat","info","warn","danger","success","debug","value","undefined","JSON","stringify","dump"],"sources":["../../src/utils.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2023 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\nconst Reset = '\\x1b[0m';\n// const Bright = \"\\x1b[1m\"\n// const Dim = \"\\x1b[2m\"\n// const Underscore = \"\\x1b[4m\"\n// const Blink = \"\\x1b[5m\"\n// const Reverse = \"\\x1b[7m\"\n// const Hidden = \"\\x1b[8m\"\n//\n// const FgBlack = \"\\x1b[30m\"\nconst FgRed = '\\x1b[31m';\nconst FgGreen = '\\x1b[32m';\nconst FgYellow = '\\x1b[33m';\n// const FgBlue = \"\\x1b[34m\"\n// const FgMagenta = \"\\x1b[35m\"\nconst FgCyan = '\\x1b[36m';\n// const FgWhite = \"\\x1b[37m\"\n//\n// const BgBlack = \"\\x1b[40m\"\n// const BgRed = \"\\x1b[41m\"\n// const BgGreen = \"\\x1b[42m\"\n// const BgYellow = \"\\x1b[43m\"\n// const BgBlue = \"\\x1b[44m\"\n// const BgMagenta = \"\\x1b[45m\"\n// const BgCyan = \"\\x1b[46m\"\n// const BgWhite = \"\\x1b[47m\"\n\n// Abstraction of log so it can be skipped when quiet mode is enabled\nexport const log = (message?: any) => {\n console.log(message);\n return message;\n};\n\nconst reset = (message: any) => `${message}${Reset}`;\n\nexport const info = (message: any) => log(reset(`${FgCyan}${message}`));\n\nexport const warn = (message: any) => log(reset(`${FgYellow}${message}`));\n\nexport const danger = (message: any) => {\n return log(reset(`${FgRed}${message}`));\n};\n\nexport const success = (message: any) => {\n return log(reset(`${FgGreen}${message}`));\n};\n\nexport const debug = (message: any, value?: any) => {\n if (value !== undefined)\n console.log(message, '=>', JSON.stringify(value, null, 2));\n else return log(message);\n};\n\nexport const dump = (value: any) => log(JSON.stringify(value, null, 2));\n"],"mappings":"AAyBA,IAAMA,KAAK,GAAG,SAAS;AASvB,IAAMC,KAAK,GAAG,UAAU;AACxB,IAAMC,OAAO,GAAG,UAAU;AAC1B,IAAMC,QAAQ,GAAG,UAAU;AAG3B,IAAMC,MAAM,GAAG,UAAU;AAazB,OAAO,IAAMC,GAAG,GAAIC,OAAa,IAAK;EACpCC,OAAO,CAACF,GAAG,CAACC,OAAO,CAAC;EACpB,OAAOA,OAAO;AAChB,CAAC;AAED,IAAME,KAAK,GAAIF,OAAY,OAAAG,MAAA,CAAQH,OAAO,EAAAG,MAAA,CAAGT,KAAK,CAAE;AAEpD,OAAO,IAAMU,IAAI,GAAIJ,OAAY,IAAKD,GAAG,CAACG,KAAK,IAAAC,MAAA,CAAIL,MAAM,EAAAK,MAAA,CAAGH,OAAO,CAAE,CAAC,CAAC;AAEvE,OAAO,IAAMK,IAAI,GAAIL,OAAY,IAAKD,GAAG,CAACG,KAAK,IAAAC,MAAA,CAAIN,QAAQ,EAAAM,MAAA,CAAGH,OAAO,CAAE,CAAC,CAAC;AAEzE,OAAO,IAAMM,MAAM,GAAIN,OAAY,IAAK;EACtC,OAAOD,GAAG,CAACG,KAAK,IAAAC,MAAA,CAAIR,KAAK,EAAAQ,MAAA,CAAGH,OAAO,CAAE,CAAC,CAAC;AACzC,CAAC;AAED,OAAO,IAAMO,OAAO,GAAIP,OAAY,IAAK;EACvC,OAAOD,GAAG,CAACG,KAAK,IAAAC,MAAA,CAAIP,OAAO,EAAAO,MAAA,CAAGH,OAAO,CAAE,CAAC,CAAC;AAC3C,CAAC;AAED,OAAO,IAAMQ,KAAK,GAAGA,CAACR,OAAY,EAAES,KAAW,KAAK;EAClD,IAAIA,KAAK,KAAKC,SAAS,EACrBT,OAAO,CAACF,GAAG,CAACC,OAAO,EAAE,IAAI,EAAEW,IAAI,CAACC,SAAS,CAACH,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,KACxD,OAAOV,GAAG,CAACC,OAAO,CAAC;AAC1B,CAAC;AAED,OAAO,IAAMa,IAAI,GAAIJ,KAAU,IAAKV,GAAG,CAACY,IAAI,CAACC,SAAS,CAACH,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC"}
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
|
|
7
6
|
var _utils = require("./utils");
|
|
8
|
-
|
|
9
7
|
Object.keys(_utils).forEach(function (key) {
|
|
10
8
|
if (key === "default" || key === "__esModule") return;
|
|
11
9
|
if (key in exports && exports[key] === _utils[key]) return;
|
|
@@ -16,4 +14,15 @@ Object.keys(_utils).forEach(function (key) {
|
|
|
16
14
|
}
|
|
17
15
|
});
|
|
18
16
|
});
|
|
17
|
+
var _testUtils = require("./testUtils");
|
|
18
|
+
Object.keys(_testUtils).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _testUtils[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function get() {
|
|
24
|
+
return _testUtils[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
19
28
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.js","names":["_utils","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_testUtils"],"sources":["../src/index.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nexport * from './utils';\nexport * from './testUtils';\n"],"mappings":";;;;;AA0BA,IAAAA,MAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,MAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,MAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAT,MAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,UAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,UAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,UAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAC,UAAA,CAAAL,GAAA;IAAA;EAAA;AAAA"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { IAPIMethods, IApiSection, IApiSettings, IAuthSession } from '@looker/sdk-rtl';
|
|
2
|
+
import { ApiSettings } from '@looker/sdk-rtl';
|
|
3
|
+
export type SpecLoader = (content: any) => any;
|
|
4
|
+
export declare const specFromFile: (specFile: string, loader: SpecLoader) => any;
|
|
5
|
+
export interface ITestConfig {
|
|
6
|
+
apiTestModel: any;
|
|
7
|
+
rootPath: string;
|
|
8
|
+
testPath: string;
|
|
9
|
+
dataFile: string;
|
|
10
|
+
localIni: string;
|
|
11
|
+
testData: any;
|
|
12
|
+
testIni: string;
|
|
13
|
+
settings: IApiSettings;
|
|
14
|
+
session: IAuthSession;
|
|
15
|
+
sdk: IAPIMethods;
|
|
16
|
+
baseUrl: string;
|
|
17
|
+
section: any;
|
|
18
|
+
timeout: number;
|
|
19
|
+
testSection: any;
|
|
20
|
+
}
|
|
21
|
+
export declare const getRootPath: () => string;
|
|
22
|
+
export declare const rootFile: (fileName?: string) => string;
|
|
23
|
+
export declare const mockApiSpec: (loader: SpecLoader) => any;
|
|
24
|
+
export declare const testFile: (filename?: string) => string;
|
|
25
|
+
export declare class MeldSettings extends ApiSettings {
|
|
26
|
+
private settings;
|
|
27
|
+
constructor(settings: Partial<IApiSettings>);
|
|
28
|
+
readConfig(_section?: string): IApiSection;
|
|
29
|
+
}
|
|
30
|
+
export declare const lookUp: (fileName: string) => string;
|
|
31
|
+
export declare const getCypressSettings: () => Record<string, string>;
|
|
32
|
+
export declare const loadApiSettings: (_rootPath: string, localIni: string) => IApiSettings;
|
|
33
|
+
export declare const randomize: () => number;
|
|
34
|
+
export declare const entitle: (rando: string | number, title?: string) => string;
|
|
35
|
+
export declare const createFunSdk: () => IAPIMethods;
|
|
36
|
+
export declare const TestConfig: (loader: SpecLoader, rootPath?: string) => ITestConfig;
|
package/lib/testUtils.js
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.testFile = exports.specFromFile = exports.rootFile = exports.randomize = exports.mockApiSpec = exports.lookUp = exports.loadApiSettings = exports.getRootPath = exports.getCypressSettings = exports.entitle = exports.createFunSdk = exports.TestConfig = exports.MeldSettings = void 0;
|
|
7
|
+
var fs = _interopRequireWildcard(require("fs"));
|
|
8
|
+
var _path = _interopRequireDefault(require("path"));
|
|
9
|
+
var yaml = _interopRequireWildcard(require("js-yaml"));
|
|
10
|
+
var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
|
|
11
|
+
var _findRoot = require("@manypkg/find-root");
|
|
12
|
+
var _sdkNode = require("@looker/sdk-node");
|
|
13
|
+
var _sdkRtl = require("@looker/sdk-rtl");
|
|
14
|
+
var _sdk = require("@looker/sdk");
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
17
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
18
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
19
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
20
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
21
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
22
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
23
|
+
var utf8 = 'utf-8';
|
|
24
|
+
var specFromFile = (specFile, loader) => {
|
|
25
|
+
var specContent = fs.readFileSync(specFile, {
|
|
26
|
+
encoding: utf8
|
|
27
|
+
});
|
|
28
|
+
return loader(specContent);
|
|
29
|
+
};
|
|
30
|
+
exports.specFromFile = specFromFile;
|
|
31
|
+
var rootPath = '';
|
|
32
|
+
var getRootPath = () => {
|
|
33
|
+
if (!rootPath) {
|
|
34
|
+
rootPath = (0, _findRoot.findRootSync)(__dirname).rootDir;
|
|
35
|
+
}
|
|
36
|
+
return rootPath;
|
|
37
|
+
};
|
|
38
|
+
exports.getRootPath = getRootPath;
|
|
39
|
+
var rootFile = exports.rootFile = function rootFile() {
|
|
40
|
+
var fileName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
41
|
+
return _path.default.join(getRootPath(), fileName);
|
|
42
|
+
};
|
|
43
|
+
var _mockSpec;
|
|
44
|
+
var mockApiSpec = loader => {
|
|
45
|
+
if (!_mockSpec) {
|
|
46
|
+
var spec = rootFile('test/core/undoc_api_4.0.json');
|
|
47
|
+
if (!fs.existsSync(spec)) {
|
|
48
|
+
throw new Error("run 'bin/sdk_gen -f' to generate the API spec file '".concat(spec, "'"));
|
|
49
|
+
}
|
|
50
|
+
var obj = JSON.parse(fs.readFileSync(spec, utf8));
|
|
51
|
+
_mockSpec = loader(obj);
|
|
52
|
+
}
|
|
53
|
+
return _mockSpec;
|
|
54
|
+
};
|
|
55
|
+
exports.mockApiSpec = mockApiSpec;
|
|
56
|
+
var testFile = exports.testFile = function testFile() {
|
|
57
|
+
var filename = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
58
|
+
return _path.default.join(rootFile('/packages/sdk-codegen-utils/data/'), filename);
|
|
59
|
+
};
|
|
60
|
+
class MeldSettings extends _sdkRtl.ApiSettings {
|
|
61
|
+
constructor(settings) {
|
|
62
|
+
super(settings);
|
|
63
|
+
this.settings = settings;
|
|
64
|
+
}
|
|
65
|
+
readConfig(_section) {
|
|
66
|
+
return {
|
|
67
|
+
client_id: this.settings.client_id,
|
|
68
|
+
client_secret: this.settings.client_secret
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
exports.MeldSettings = MeldSettings;
|
|
73
|
+
var lookUp = fileName => {
|
|
74
|
+
var root = getRootPath();
|
|
75
|
+
var dir = __dirname;
|
|
76
|
+
while (dir >= root) {
|
|
77
|
+
var f = _path.default.join(dir, fileName);
|
|
78
|
+
if (fs.existsSync(f)) {
|
|
79
|
+
return f;
|
|
80
|
+
} else {
|
|
81
|
+
dir = _path.default.join(dir, '../');
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return '';
|
|
85
|
+
};
|
|
86
|
+
exports.lookUp = lookUp;
|
|
87
|
+
var getCypressSettings = () => {
|
|
88
|
+
var cypressFile = lookUp('cypress.env.json');
|
|
89
|
+
var config = fs.existsSync(cypressFile) ? JSON.parse(fs.readFileSync(cypressFile, utf8)) : {};
|
|
90
|
+
var cypress = {};
|
|
91
|
+
Object.keys(config).forEach(k => cypress[k.toLowerCase()] = config[k]);
|
|
92
|
+
var env = (0, _sdkNode.readEnvConfig)('CYPRESS');
|
|
93
|
+
return _objectSpread(_objectSpread({}, cypress), env);
|
|
94
|
+
};
|
|
95
|
+
exports.getCypressSettings = getCypressSettings;
|
|
96
|
+
var loadApiSettings = (_rootPath, localIni) => {
|
|
97
|
+
var cypressSettings = getCypressSettings();
|
|
98
|
+
var local = fs.existsSync(localIni) ? (0, _sdkNode.ApiConfigSection)(fs.readFileSync(localIni, utf8)) : {};
|
|
99
|
+
var settings = _objectSpread(_objectSpread({
|
|
100
|
+
verify_ssl: false,
|
|
101
|
+
base_url: 'https://localhost:19999'
|
|
102
|
+
}, local), cypressSettings);
|
|
103
|
+
var result = new MeldSettings(settings);
|
|
104
|
+
var creds = result.readConfig();
|
|
105
|
+
if ((0, _isEmpty.default)(creds)) {
|
|
106
|
+
throw new Error("Test SDK not initialized. Configure environment variables, 'cypress.env.json', or '".concat(localIni, "'"));
|
|
107
|
+
}
|
|
108
|
+
return result;
|
|
109
|
+
};
|
|
110
|
+
exports.loadApiSettings = loadApiSettings;
|
|
111
|
+
var randomize = () => {
|
|
112
|
+
return Math.round(Math.random() * 100000);
|
|
113
|
+
};
|
|
114
|
+
exports.randomize = randomize;
|
|
115
|
+
var entitle = (rando, title) => {
|
|
116
|
+
return "".concat(rando, " ").concat(title !== null && title !== void 0 ? title : '').trim();
|
|
117
|
+
};
|
|
118
|
+
exports.entitle = entitle;
|
|
119
|
+
var createFunSdk = () => {
|
|
120
|
+
var root = getRootPath();
|
|
121
|
+
var localIni = process.env.LOOKERSDK_INI || "".concat(root, "looker.ini");
|
|
122
|
+
var settings = loadApiSettings(root, localIni);
|
|
123
|
+
var session = new _sdkNode.NodeSession(settings);
|
|
124
|
+
return (0, _sdk.functionalSdk40)(session);
|
|
125
|
+
};
|
|
126
|
+
exports.createFunSdk = createFunSdk;
|
|
127
|
+
var TestConfig = exports.TestConfig = function TestConfig(loader) {
|
|
128
|
+
var rootPath = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : getRootPath();
|
|
129
|
+
var testDataFile = 'data.yml';
|
|
130
|
+
var envPrefix = 'LOOKERSDK';
|
|
131
|
+
var sectionName = 'Looker';
|
|
132
|
+
var localIni = process.env.LOOKERSDK_INI || _path.default.join(rootPath, 'looker.ini');
|
|
133
|
+
var settings = loadApiSettings(rootPath, localIni);
|
|
134
|
+
var session = new _sdkNode.NodeSession(settings);
|
|
135
|
+
var sdk = new _sdk.Looker40SDK(session);
|
|
136
|
+
var testPath = _path.default.join(rootPath, '/packages/sdk-codegen-utils/data/');
|
|
137
|
+
var dataFile = testFile(testDataFile);
|
|
138
|
+
var testData = fs.existsSync(dataFile) ? yaml.load(fs.readFileSync(dataFile, utf8)) : {};
|
|
139
|
+
var apiTestModel = specFromFile(testFile('openApiRef.json'), loader);
|
|
140
|
+
var testIni = _path.default.join(rootPath, testData.iniFile);
|
|
141
|
+
var section = (0, _sdkNode.readIniConfig)(localIni, envPrefix, sectionName);
|
|
142
|
+
var baseUrl = section.base_url;
|
|
143
|
+
var timeout = parseInt(section.timeout, 10);
|
|
144
|
+
var testSection = (0, _sdkNode.readIniConfig)(localIni, envPrefix, sectionName);
|
|
145
|
+
return {
|
|
146
|
+
apiTestModel,
|
|
147
|
+
dataFile,
|
|
148
|
+
localIni,
|
|
149
|
+
rootPath,
|
|
150
|
+
testData,
|
|
151
|
+
testIni,
|
|
152
|
+
testPath,
|
|
153
|
+
settings,
|
|
154
|
+
session,
|
|
155
|
+
sdk,
|
|
156
|
+
baseUrl,
|
|
157
|
+
section,
|
|
158
|
+
timeout,
|
|
159
|
+
testSection
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
//# sourceMappingURL=testUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testUtils.js","names":["fs","_interopRequireWildcard","require","_path","_interopRequireDefault","yaml","_isEmpty","_findRoot","_sdkNode","_sdkRtl","_sdk","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","ownKeys","keys","getOwnPropertySymbols","o","filter","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","key","value","_toPropertyKey","configurable","writable","_toPrimitive","String","Symbol","toPrimitive","TypeError","Number","utf8","specFromFile","specFile","loader","specContent","readFileSync","encoding","exports","rootPath","getRootPath","findRootSync","__dirname","rootDir","rootFile","fileName","undefined","path","join","_mockSpec","mockApiSpec","spec","existsSync","Error","concat","JSON","parse","testFile","filename","MeldSettings","ApiSettings","constructor","settings","readConfig","_section","client_id","client_secret","lookUp","root","dir","f","getCypressSettings","cypressFile","config","cypress","k","toLowerCase","env","readEnvConfig","loadApiSettings","_rootPath","localIni","cypressSettings","local","ApiConfigSection","verify_ssl","base_url","result","creds","isEmpty","randomize","Math","round","random","entitle","rando","title","trim","createFunSdk","process","LOOKERSDK_INI","session","NodeSession","functionalSdk40","TestConfig","testDataFile","envPrefix","sectionName","sdk","Looker40SDK","testPath","dataFile","testData","load","apiTestModel","testIni","iniFile","section","readIniConfig","baseUrl","timeout","parseInt","testSection"],"sources":["../src/testUtils.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport * as fs from 'fs';\nimport path from 'path';\nimport * as yaml from 'js-yaml';\nimport isEmpty from 'lodash/isEmpty';\nimport { findRootSync } from '@manypkg/find-root';\nimport type { IApiConfig } from '@looker/sdk-node';\nimport {\n ApiConfigSection,\n NodeSession,\n readEnvConfig,\n readIniConfig,\n} from '@looker/sdk-node';\nimport type {\n IAPIMethods,\n IApiSection,\n IApiSettings,\n IAuthSession,\n} from '@looker/sdk-rtl';\nimport { ApiSettings } from '@looker/sdk-rtl';\n/* eslint-disable no-restricted-imports */\nimport { Looker40SDK, functionalSdk40 } from '@looker/sdk';\n\nconst utf8 = 'utf-8';\nexport type SpecLoader = (content: any) => any;\n\n/**\n * Convert a spec file into an APIModel\n * @param specFile name of spec file\n * @param loader callback to load spec as APIModel\n */\nexport const specFromFile = (specFile: string, loader: SpecLoader): any => {\n const specContent = fs.readFileSync(specFile, { encoding: utf8 });\n return loader(specContent);\n};\n\n/**\n * Properties used for various typescript-based tests\n */\nexport interface ITestConfig {\n /** the openApi.json snapshot in the test/ dir */\n apiTestModel: any;\n /** root dir of this repository */\n rootPath: string;\n /** <rootPath>/test dir */\n testPath: string;\n /** test/data.yml file */\n dataFile: string;\n /** root looker.ini file or LOOKERSDK_INI value */\n localIni: string;\n /** contents of test/data.yml */\n testData: any;\n /** ini file configured in testData */\n testIni: string;\n /* melded API config settings */\n settings: IApiSettings;\n /** melded sdk configuration session */\n session: IAuthSession;\n /** initialized typescript SDK from melded configuration */\n sdk: IAPIMethods;\n /** configured API base url */\n baseUrl: string;\n /** configured default INI section */\n section: any;\n /** configured timeout value */\n timeout: number;\n /** test INI section */\n testSection: any;\n}\n\nlet rootPath = '';\n/** fully resolved root dir of the repository */\nexport const getRootPath = (): string => {\n if (!rootPath) {\n rootPath = findRootSync(__dirname).rootDir;\n }\n return rootPath;\n};\n\n/**\n * Fully resolved path to a file based from the root path\n * @param fileName to path. It can start with folders\n */\nexport const rootFile = (fileName = ''): string =>\n path.join(getRootPath(), fileName);\n\nlet _mockSpec: any;\n/**\n * Returns the entire \"undocumented\" API specification as the model to use for mocking\n * because it includes everything from our current API\n * @param loader callback to load spec as APIModel\n */\nexport const mockApiSpec = (loader: SpecLoader) => {\n if (!_mockSpec) {\n const spec = rootFile('test/core/undoc_api_4.0.json');\n if (!fs.existsSync(spec)) {\n throw new Error(\n `run 'bin/sdk_gen -f' to generate the API spec file '${spec}'`\n );\n }\n const obj = JSON.parse(fs.readFileSync(spec, utf8));\n _mockSpec = loader(obj);\n }\n return _mockSpec;\n};\n\n/**\n * Fully resolved path to a file in the codegen test data folder\n * @param filename to path. It can start with folders\n */\nexport const testFile = (filename = ''): string =>\n path.join(rootFile('/packages/sdk-codegen-utils/data/'), filename);\n\nexport class MeldSettings extends ApiSettings {\n constructor(private settings: Partial<IApiSettings>) {\n super(settings);\n }\n\n readConfig(_section?: string): IApiSection {\n return {\n client_id: (this.settings as any).client_id,\n client_secret: (this.settings as any).client_secret,\n };\n }\n}\n\n/**\n * Find a file from the current directory up to the root of the repository\n * @param fileName to find from current directory\n */\nexport const lookUp = (fileName: string) => {\n const root = getRootPath();\n let dir = __dirname;\n while (dir >= root) {\n const f = path.join(dir, fileName);\n if (fs.existsSync(f)) {\n return f;\n } else {\n dir = path.join(dir, '../');\n }\n }\n return '';\n};\n\n/**\n * Gets the cypress settings\n */\nexport const getCypressSettings = (): Record<string, string> => {\n const cypressFile = lookUp('cypress.env.json');\n const config: any = fs.existsSync(cypressFile)\n ? JSON.parse(fs.readFileSync(cypressFile, utf8))\n : {};\n const cypress: Record<string, string> = {};\n Object.keys(config).forEach(k => (cypress[k.toLowerCase()] = config[k]));\n const env = readEnvConfig('CYPRESS');\n return {\n ...cypress,\n ...env,\n };\n};\n\n/**\n * Melds CYPRESS environment variables with cypress.env.json and optional looker.ini and returns the settings collection\n * @param rootPath root location of repository\n * @param localIni full name of default looker.ini. Needs to be passed in, but doesn't need to exist\n */\nexport const loadApiSettings = (\n _rootPath: string,\n localIni: string\n): IApiSettings => {\n const cypressSettings = getCypressSettings();\n const local: IApiConfig = fs.existsSync(localIni)\n ? ApiConfigSection(fs.readFileSync(localIni, utf8))\n : {};\n const settings = {\n verify_ssl: false,\n base_url: 'https://localhost:19999',\n ...local,\n ...cypressSettings,\n };\n const result = new MeldSettings(settings);\n const creds = result.readConfig();\n if (isEmpty(creds)) {\n throw new Error(\n `Test SDK not initialized. Configure environment variables, 'cypress.env.json', or '${localIni}'`\n );\n }\n return result;\n};\n\n/**\n * get a random value use for entity name constraints\n */\nexport const randomize = () => {\n return Math.round(Math.random() * 100000);\n};\n\n/**\n * Create a uniquely named title\n * @param rando value to use for unique name combo\n * @param title of entity to name\n */\nexport const entitle = (rando: string | number, title?: string) => {\n return `${rando} ${title ?? ''}`.trim();\n};\n\nexport const createFunSdk = (): IAPIMethods => {\n const root = getRootPath();\n const localIni = process.env.LOOKERSDK_INI || `${root}looker.ini`;\n const settings = loadApiSettings(root, localIni);\n const session = new NodeSession(settings);\n return functionalSdk40(session);\n};\n\n/**\n * Reads configuration information, returning various test values\n * @param loader callback to load spec as APIModel\n * @param rootPath root file path location for relative path resolution\n */\nexport const TestConfig = (\n loader: SpecLoader,\n rootPath = getRootPath()\n): ITestConfig => {\n const testDataFile = 'data.yml';\n const envPrefix = 'LOOKERSDK';\n const sectionName = 'Looker';\n const localIni =\n process.env.LOOKERSDK_INI || path.join(rootPath, 'looker.ini');\n const settings = loadApiSettings(rootPath, localIni);\n const session = new NodeSession(settings);\n const sdk: IAPIMethods = new Looker40SDK(session);\n const testPath = path.join(rootPath, '/packages/sdk-codegen-utils/data/');\n const dataFile = testFile(testDataFile);\n const testData: any = fs.existsSync(dataFile)\n ? yaml.load(fs.readFileSync(dataFile, utf8))\n : {};\n const apiTestModel = specFromFile(testFile('openApiRef.json'), loader);\n const testIni = path.join(rootPath, testData.iniFile);\n const section = readIniConfig(localIni, envPrefix, sectionName);\n const baseUrl = section.base_url;\n const timeout = parseInt(section.timeout, 10);\n const testSection = readIniConfig(localIni, envPrefix, sectionName);\n return {\n apiTestModel,\n dataFile,\n localIni,\n r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G,IAAIC,gBAAW,CAACR,OAAO,CAAC;EACjD,IAAMS,QAAQ,GAAG/D,aAAI,CAACC,IAAI,CAACT,QAAQ,EAAE,mCAAmC,CAAC;EACzE,IAAMwE,QAAQ,GAAGtD,QAAQ,CAACgD,YAAY,CAAC;EACvC,IAAMO,QAAa,GAAG5I,EAAE,CAACgF,UAAU,CAAC2D,QAAQ,CAAC,GACzCtI,IAAI,CAACwI,IAAI,CAAC7I,EAAE,CAACgE,YAAY,CAAC2E,QAAQ,EAAEhF,IAAI,CAAC,CAAC,GAC1C,CAAC,CAAC;EACN,IAAMmF,YAAY,GAAGlF,YAAY,CAACyB,QAAQ,CAAC,iBAAiB,CAAC,EAAEvB,MAAM,CAAC;EACtE,IAAMiF,OAAO,GAAGpE,aAAI,CAACC,IAAI,CAACT,QAAQ,EAAEyE,QAAQ,CAACI,OAAO,CAAC;EACrD,IAAMC,OAAO,GAAG,IAAAC,sBAAa,EAACrC,QAAQ,EAAEyB,SAAS,EAAEC,WAAW,CAAC;EAC/D,IAAMY,OAAO,GAAGF,OAAO,CAAC/B,QAAQ;EAChC,IAAMkC,OAAO,GAAGC,QAAQ,CAACJ,OAAO,CAACG,OAAO,EAAE,EAAE,CAAC;EAC7C,IAAME,WAAW,GAAG,IAAAJ,sBAAa,EAACrC,QAAQ,EAAEyB,SAAS,EAAEC,WAAW,CAAC;EACnE,OAAO;IACLO,YAAY;IACZH,QAAQ;IACR9B,QAAQ;IACR1C,QAAQ;IACRyE,QAAQ;IACRG,OAAO;IACPL,QAAQ;IACRhD,QAAQ;IACRuC,OAAO;IACPO,GAAG;IACHW,OAAO;IACPF,OAAO;IACPG,OAAO;IACPE;EACF,CAAC;AACH,CAAC"}
|
package/lib/utils.js
CHANGED
|
@@ -3,49 +3,34 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.warn = exports.success = exports.log = exports.info = exports.dump = exports.debug = exports.danger = void 0;
|
|
7
7
|
var Reset = '\x1b[0m';
|
|
8
8
|
var FgRed = '\x1b[31m';
|
|
9
9
|
var FgGreen = '\x1b[32m';
|
|
10
10
|
var FgYellow = '\x1b[33m';
|
|
11
11
|
var FgCyan = '\x1b[36m';
|
|
12
|
-
|
|
13
12
|
var log = message => {
|
|
14
13
|
console.log(message);
|
|
15
14
|
return message;
|
|
16
15
|
};
|
|
17
|
-
|
|
18
16
|
exports.log = log;
|
|
19
|
-
|
|
20
17
|
var reset = message => "".concat(message).concat(Reset);
|
|
21
|
-
|
|
22
18
|
var info = message => log(reset("".concat(FgCyan).concat(message)));
|
|
23
|
-
|
|
24
19
|
exports.info = info;
|
|
25
|
-
|
|
26
20
|
var warn = message => log(reset("".concat(FgYellow).concat(message)));
|
|
27
|
-
|
|
28
21
|
exports.warn = warn;
|
|
29
|
-
|
|
30
22
|
var danger = message => {
|
|
31
23
|
return log(reset("".concat(FgRed).concat(message)));
|
|
32
24
|
};
|
|
33
|
-
|
|
34
25
|
exports.danger = danger;
|
|
35
|
-
|
|
36
26
|
var success = message => {
|
|
37
27
|
return log(reset("".concat(FgGreen).concat(message)));
|
|
38
28
|
};
|
|
39
|
-
|
|
40
29
|
exports.success = success;
|
|
41
|
-
|
|
42
30
|
var debug = (message, value) => {
|
|
43
31
|
if (value !== undefined) console.log(message, '=>', JSON.stringify(value, null, 2));else return log(message);
|
|
44
32
|
};
|
|
45
|
-
|
|
46
33
|
exports.debug = debug;
|
|
47
|
-
|
|
48
34
|
var dump = value => log(JSON.stringify(value, null, 2));
|
|
49
|
-
|
|
50
35
|
exports.dump = dump;
|
|
51
36
|
//# sourceMappingURL=utils.js.map
|
package/lib/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"utils.js","names":["Reset","FgRed","FgGreen","FgYellow","FgCyan","log","message","console","exports","reset","concat","info","warn","danger","success","debug","value","undefined","JSON","stringify","dump"],"sources":["../src/utils.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2023 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\nconst Reset = '\\x1b[0m';\n// const Bright = \"\\x1b[1m\"\n// const Dim = \"\\x1b[2m\"\n// const Underscore = \"\\x1b[4m\"\n// const Blink = \"\\x1b[5m\"\n// const Reverse = \"\\x1b[7m\"\n// const Hidden = \"\\x1b[8m\"\n//\n// const FgBlack = \"\\x1b[30m\"\nconst FgRed = '\\x1b[31m';\nconst FgGreen = '\\x1b[32m';\nconst FgYellow = '\\x1b[33m';\n// const FgBlue = \"\\x1b[34m\"\n// const FgMagenta = \"\\x1b[35m\"\nconst FgCyan = '\\x1b[36m';\n// const FgWhite = \"\\x1b[37m\"\n//\n// const BgBlack = \"\\x1b[40m\"\n// const BgRed = \"\\x1b[41m\"\n// const BgGreen = \"\\x1b[42m\"\n// const BgYellow = \"\\x1b[43m\"\n// const BgBlue = \"\\x1b[44m\"\n// const BgMagenta = \"\\x1b[45m\"\n// const BgCyan = \"\\x1b[46m\"\n// const BgWhite = \"\\x1b[47m\"\n\n// Abstraction of log so it can be skipped when quiet mode is enabled\nexport const log = (message?: any) => {\n console.log(message);\n return message;\n};\n\nconst reset = (message: any) => `${message}${Reset}`;\n\nexport const info = (message: any) => log(reset(`${FgCyan}${message}`));\n\nexport const warn = (message: any) => log(reset(`${FgYellow}${message}`));\n\nexport const danger = (message: any) => {\n return log(reset(`${FgRed}${message}`));\n};\n\nexport const success = (message: any) => {\n return log(reset(`${FgGreen}${message}`));\n};\n\nexport const debug = (message: any, value?: any) => {\n if (value !== undefined)\n console.log(message, '=>', JSON.stringify(value, null, 2));\n else return log(message);\n};\n\nexport const dump = (value: any) => log(JSON.stringify(value, null, 2));\n"],"mappings":";;;;;;AAyBA,IAAMA,KAAK,GAAG,SAAS;AASvB,IAAMC,KAAK,GAAG,UAAU;AACxB,IAAMC,OAAO,GAAG,UAAU;AAC1B,IAAMC,QAAQ,GAAG,UAAU;AAG3B,IAAMC,MAAM,GAAG,UAAU;AAalB,IAAMC,GAAG,GAAIC,OAAa,IAAK;EACpCC,OAAO,CAACF,GAAG,CAACC,OAAO,CAAC;EACpB,OAAOA,OAAO;AAChB,CAAC;AAACE,OAAA,CAAAH,GAAA,GAAAA,GAAA;AAEF,IAAMI,KAAK,GAAIH,OAAY,OAAAI,MAAA,CAAQJ,OAAO,EAAAI,MAAA,CAAGV,KAAK,CAAE;AAE7C,IAAMW,IAAI,GAAIL,OAAY,IAAKD,GAAG,CAACI,KAAK,IAAAC,MAAA,CAAIN,MAAM,EAAAM,MAAA,CAAGJ,OAAO,CAAE,CAAC,CAAC;AAACE,OAAA,CAAAG,IAAA,GAAAA,IAAA;AAEjE,IAAMC,IAAI,GAAIN,OAAY,IAAKD,GAAG,CAACI,KAAK,IAAAC,MAAA,CAAIP,QAAQ,EAAAO,MAAA,CAAGJ,OAAO,CAAE,CAAC,CAAC;AAACE,OAAA,CAAAI,IAAA,GAAAA,IAAA;AAEnE,IAAMC,MAAM,GAAIP,OAAY,IAAK;EACtC,OAAOD,GAAG,CAACI,KAAK,IAAAC,MAAA,CAAIT,KAAK,EAAAS,MAAA,CAAGJ,OAAO,CAAE,CAAC,CAAC;AACzC,CAAC;AAACE,OAAA,CAAAK,MAAA,GAAAA,MAAA;AAEK,IAAMC,OAAO,GAAIR,OAAY,IAAK;EACvC,OAAOD,GAAG,CAACI,KAAK,IAAAC,MAAA,CAAIR,OAAO,EAAAQ,MAAA,CAAGJ,OAAO,CAAE,CAAC,CAAC;AAC3C,CAAC;AAACE,OAAA,CAAAM,OAAA,GAAAA,OAAA;AAEK,IAAMC,KAAK,GAAGA,CAACT,OAAY,EAAEU,KAAW,KAAK;EAClD,IAAIA,KAAK,KAAKC,SAAS,EACrBV,OAAO,CAACF,GAAG,CAACC,OAAO,EAAE,IAAI,EAAEY,IAAI,CAACC,SAAS,CAACH,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,KACxD,OAAOX,GAAG,CAACC,OAAO,CAAC;AAC1B,CAAC;AAACE,OAAA,CAAAO,KAAA,GAAAA,KAAA;AAEK,IAAMK,IAAI,GAAIJ,KAAU,IAAKX,GAAG,CAACa,IAAI,CAACC,SAAS,CAACH,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AAACR,OAAA,CAAAY,IAAA,GAAAA,IAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@looker/sdk-codegen-utils",
|
|
3
|
-
"version": "21.0.
|
|
3
|
+
"version": "21.0.13",
|
|
4
4
|
"description": "Looker SDK Codegen utils",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
@@ -30,5 +30,14 @@
|
|
|
30
30
|
"scripts": {
|
|
31
31
|
"watch:cjs": "yarn lerna exec --scope @looker/sdk-codegen-utils --stream 'BABEL_ENV=build_cjs babel src --root-mode upward --out-dir lib --source-maps --extensions .ts,.tsx --no-comments --watch'"
|
|
32
32
|
},
|
|
33
|
-
"
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@looker/sdk": "24.16.1",
|
|
35
|
+
"@looker/sdk-node": "24.16.1",
|
|
36
|
+
"@looker/sdk-rtl": "21.6.3",
|
|
37
|
+
"@manypkg/find-root": "2.2.1",
|
|
38
|
+
"@types/js-yaml": "4.0.9",
|
|
39
|
+
"js-yaml": "4.1.0",
|
|
40
|
+
"lodash": "4.17.21"
|
|
41
|
+
},
|
|
42
|
+
"gitHead": "f95fdcebe3e11b4cf1c7d07e26a6b8a153bd074f"
|
|
34
43
|
}
|