@osdk/foundry-sdk-generator 2.2.0-beta.9 → 2.2.0-rc.24
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 +322 -0
- package/build/esm/index.js +158 -98
- package/build/esm/index.js.map +1 -1
- package/build/types/generate/betaClient/generatePackage.d.ts.map +1 -1
- package/build/types/generate/index.d.ts +1 -1
- package/build/types/generate/index.d.ts.map +1 -1
- package/build/types/ontologyMetadata/Result.d.ts.map +1 -1
- package/build/types/ontologyMetadata/ontologyMetadataResolver.d.ts +2 -2
- package/build/types/ontologyMetadata/ontologyMetadataResolver.d.ts.map +1 -1
- package/package.json +13 -12
package/build/esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { fileURLToPath as fileURLToPath$1 } from 'url';
|
|
2
|
-
import path, { join, dirname, isAbsolute
|
|
2
|
+
import path, { join, dirname, isAbsolute } from 'path';
|
|
3
3
|
import yargs from 'yargs';
|
|
4
4
|
import { hideBin } from 'yargs/helpers';
|
|
5
5
|
import { exit } from 'process';
|
|
@@ -8,6 +8,7 @@ import { generateClientSdkVersionTwoPointZero } from '@osdk/generator';
|
|
|
8
8
|
import { mkdir, writeFile, readdir, readFile } from 'fs/promises';
|
|
9
9
|
import * as path2 from 'node:path';
|
|
10
10
|
import path2__default from 'node:path';
|
|
11
|
+
import { normalize } from 'node:path/posix';
|
|
11
12
|
import { fileURLToPath } from 'node:url';
|
|
12
13
|
import commonjs from '@rollup/plugin-commonjs';
|
|
13
14
|
import { nodeResolve } from '@rollup/plugin-node-resolve';
|
|
@@ -15,9 +16,9 @@ import { rollup } from 'rollup';
|
|
|
15
16
|
import nodePolyfill from 'rollup-plugin-polyfill-node';
|
|
16
17
|
import { Project, Node } from 'ts-morph';
|
|
17
18
|
import * as fs from 'node:fs';
|
|
18
|
-
import {
|
|
19
|
+
import { ScriptTarget, ModuleKind, createCompilerHost, createSourceFile, createProgram } from 'typescript';
|
|
19
20
|
|
|
20
|
-
// ../../node_modules/.pnpm/tsup@8.
|
|
21
|
+
// ../../node_modules/.pnpm/tsup@8.4.0_@microsoft+api-extractor@7.52.7_@types+node@18.19.97__@swc+core@1.7.39_jiti@2.4.2__2dta44cza7xfoposuc4x3z55ly/node_modules/tsup/assets/esm_shims.js
|
|
21
22
|
var getFilename = () => fileURLToPath$1(import.meta.url);
|
|
22
23
|
var getDirname = () => path.dirname(getFilename());
|
|
23
24
|
var __dirname = /* @__PURE__ */ getDirname();
|
|
@@ -225,7 +226,7 @@ var OntologyMetadataResolver = class {
|
|
|
225
226
|
objectType.linkTypes = objectType.linkTypes.filter((linkType) => linkTypesToKeep.has(linkType.apiName));
|
|
226
227
|
});
|
|
227
228
|
const filteredActionTypes = Object.fromEntries(Object.entries(ontologyFullMetadata.actionTypes).filter(([actionApiName]) => {
|
|
228
|
-
if (expectedEntities.actionTypes.has(
|
|
229
|
+
if (expectedEntities.actionTypes.has(actionApiName)) {
|
|
229
230
|
return true;
|
|
230
231
|
}
|
|
231
232
|
return false;
|
|
@@ -268,71 +269,129 @@ var OntologyMetadataResolver = class {
|
|
|
268
269
|
} catch (e) {
|
|
269
270
|
return Result.err([`Unable to load the specified Ontology with network error: ${JSON.stringify(e)}`]);
|
|
270
271
|
}
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
272
|
+
if (extPackageInfo.size > 0) {
|
|
273
|
+
const ontologyFullMetadata = await OntologiesV2.getFullMetadata(this.getClientContext(), ontology.rid);
|
|
274
|
+
if (ontologyFullMetadata.errorName != null) {
|
|
275
|
+
return Result.err([`Unable to load the specified Ontology metadata.
|
|
274
276
|
${JSON.stringify(ontologyFullMetadata, null, 2)}`]);
|
|
275
|
-
}
|
|
276
|
-
const externalObjects = /* @__PURE__ */ new Map();
|
|
277
|
-
const externalInterfaces = /* @__PURE__ */ new Map();
|
|
278
|
-
for (const {
|
|
279
|
-
sdk
|
|
280
|
-
} of extPackageInfo.values()) {
|
|
281
|
-
if (sdk.npm?.npmPackageName == null) {
|
|
282
|
-
throw new Error("External package is not generated as an npm package");
|
|
283
277
|
}
|
|
284
|
-
const
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
278
|
+
const externalObjects = /* @__PURE__ */ new Map();
|
|
279
|
+
const externalInterfaces = /* @__PURE__ */ new Map();
|
|
280
|
+
for (const {
|
|
281
|
+
sdk
|
|
282
|
+
} of extPackageInfo.values()) {
|
|
283
|
+
if (sdk.npm?.npmPackageName == null) {
|
|
284
|
+
throw new Error("External package is not generated as an npm package");
|
|
285
|
+
}
|
|
286
|
+
const dataScope = sdk.inputs.dataScope.ontologyV2;
|
|
287
|
+
for (const rid of dataScope.objectTypes) {
|
|
288
|
+
const ot = Object.values(ontologyFullMetadata.objectTypes).find((ot2) => ot2.objectType.rid === rid);
|
|
289
|
+
if (!ot) {
|
|
290
|
+
throw new Error(`Could not find external object type with rid ${rid}`);
|
|
291
|
+
}
|
|
292
|
+
externalObjects.set(ot.objectType.apiName, sdk.npm.npmPackageName);
|
|
293
|
+
}
|
|
294
|
+
for (const rid of dataScope.interfaceTypes) {
|
|
295
|
+
const it = Object.values(ontologyFullMetadata.interfaceTypes).find((it2) => it2.rid === rid);
|
|
296
|
+
if (!it) {
|
|
297
|
+
throw new Error(`Could not find external interface type with rid ${rid}`);
|
|
298
|
+
}
|
|
299
|
+
externalInterfaces.set(it.apiName, sdk.npm.npmPackageName);
|
|
289
300
|
}
|
|
290
|
-
externalObjects.set(ot.objectType.apiName, sdk.npm.npmPackageName);
|
|
291
301
|
}
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
302
|
+
const linkTypes = /* @__PURE__ */ new Map();
|
|
303
|
+
const objectTypes = new Set(entities.objectTypesApiNamesToLoad);
|
|
304
|
+
const queryTypes = new Set(entities.queryTypesApiNamesToLoad);
|
|
305
|
+
for (const queryType of entities.queryTypesApiNamesToLoad ?? []) {
|
|
306
|
+
if (queryType.includes(":")) {
|
|
307
|
+
throw new Error(`Query types with fixed versions are not supported with external packages: ${queryType}`);
|
|
296
308
|
}
|
|
297
|
-
externalInterfaces.set(it.apiName, sdk.npm.npmPackageName);
|
|
298
309
|
}
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
if (!linkTypes.has(objectTypeApiName)) {
|
|
308
|
-
linkTypes.set(objectTypeApiName, /* @__PURE__ */ new Set());
|
|
310
|
+
const actionTypes = new Set(entities.actionTypesApiNamesToLoad);
|
|
311
|
+
const interfaceTypes = new Set(entities.interfaceTypesApiNamesToLoad);
|
|
312
|
+
for (const linkType of entities.linkTypesApiNamesToLoad ?? []) {
|
|
313
|
+
const [objectTypeApiName, linkTypeApiName] = linkType.split(".");
|
|
314
|
+
if (!linkTypes.has(objectTypeApiName)) {
|
|
315
|
+
linkTypes.set(objectTypeApiName, /* @__PURE__ */ new Set());
|
|
316
|
+
}
|
|
317
|
+
linkTypes.get(objectTypeApiName)?.add(linkTypeApiName);
|
|
309
318
|
}
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
return Result.
|
|
319
|
+
const filteredFullMetadata = this.filterMetadataByApiName(ontologyFullMetadata, {
|
|
320
|
+
objectTypes,
|
|
321
|
+
linkTypes,
|
|
322
|
+
actionTypes,
|
|
323
|
+
queryTypes,
|
|
324
|
+
interfaceTypes
|
|
325
|
+
}, extPackageInfo);
|
|
326
|
+
const validData = this.validateLoadedOntologyMetadata(filteredFullMetadata, {
|
|
327
|
+
objectTypes,
|
|
328
|
+
linkTypes,
|
|
329
|
+
actionTypes,
|
|
330
|
+
queryTypes,
|
|
331
|
+
interfaceTypes
|
|
332
|
+
}, extPackageInfo, ontologyFullMetadata);
|
|
333
|
+
if (validData.isErr()) {
|
|
334
|
+
return Result.err(validData.error);
|
|
335
|
+
}
|
|
336
|
+
return Result.ok({
|
|
337
|
+
requestedMetadata: filteredFullMetadata,
|
|
338
|
+
externalInterfaces,
|
|
339
|
+
externalObjects,
|
|
340
|
+
fixedVersionQueryTypes: []
|
|
341
|
+
});
|
|
342
|
+
} else {
|
|
343
|
+
const objectTypes = new Set(entities.objectTypesApiNamesToLoad);
|
|
344
|
+
const interfaceTypes = new Set(entities.interfaceTypesApiNamesToLoad);
|
|
345
|
+
const actionTypes = new Set(entities.actionTypesApiNamesToLoad);
|
|
346
|
+
const linkTypes = /* @__PURE__ */ new Map();
|
|
347
|
+
for (const linkType of entities.linkTypesApiNamesToLoad ?? []) {
|
|
348
|
+
const [objectTypeApiName, linkTypeApiName] = linkType.split(".");
|
|
349
|
+
if (!linkTypes.has(objectTypeApiName)) {
|
|
350
|
+
linkTypes.set(objectTypeApiName, /* @__PURE__ */ new Set());
|
|
351
|
+
}
|
|
352
|
+
linkTypes.get(objectTypeApiName)?.add(linkTypeApiName);
|
|
353
|
+
}
|
|
354
|
+
const queryTypes = /* @__PURE__ */ new Set();
|
|
355
|
+
const fixedVersionQueryTypes = [];
|
|
356
|
+
for (const queryType of entities.queryTypesApiNamesToLoad ?? []) {
|
|
357
|
+
if (queryTypes.has(queryType)) {
|
|
358
|
+
return Result.err([`Query type ${queryType} was specified multiple times.`]);
|
|
359
|
+
}
|
|
360
|
+
const lastColonIndex = queryType.lastIndexOf(":");
|
|
361
|
+
if (lastColonIndex !== -1) {
|
|
362
|
+
const queryTypeApiName = queryType.substring(0, lastColonIndex);
|
|
363
|
+
fixedVersionQueryTypes.push(queryTypeApiName);
|
|
364
|
+
}
|
|
365
|
+
queryTypes.add(queryType);
|
|
366
|
+
}
|
|
367
|
+
const requestedMetadata = await OntologiesV2.loadMetadata(this.getClientContext(), ontology.rid, {
|
|
368
|
+
actionTypes: [...actionTypes],
|
|
369
|
+
objectTypes: [...objectTypes],
|
|
370
|
+
queryTypes: [...queryTypes],
|
|
371
|
+
interfaceTypes: [...interfaceTypes],
|
|
372
|
+
linkTypes: Array.from(linkTypes.entries()).flatMap(([_, linkTypeApiNames]) => [...linkTypeApiNames])
|
|
373
|
+
}, {
|
|
374
|
+
preview: true
|
|
375
|
+
});
|
|
376
|
+
const validData = this.validateLoadedOntologyMetadata(requestedMetadata, {
|
|
377
|
+
objectTypes,
|
|
378
|
+
linkTypes,
|
|
379
|
+
actionTypes,
|
|
380
|
+
queryTypes,
|
|
381
|
+
interfaceTypes
|
|
382
|
+
}, extPackageInfo);
|
|
383
|
+
if (validData.isErr()) {
|
|
384
|
+
return Result.err(validData.error);
|
|
385
|
+
}
|
|
386
|
+
return Result.ok({
|
|
387
|
+
requestedMetadata,
|
|
388
|
+
externalInterfaces: /* @__PURE__ */ new Map(),
|
|
389
|
+
externalObjects: /* @__PURE__ */ new Map(),
|
|
390
|
+
fixedVersionQueryTypes
|
|
391
|
+
});
|
|
328
392
|
}
|
|
329
|
-
return Result.ok({
|
|
330
|
-
filteredFullMetadata,
|
|
331
|
-
externalInterfaces,
|
|
332
|
-
externalObjects
|
|
333
|
-
});
|
|
334
393
|
}
|
|
335
|
-
validateLoadedOntologyMetadata(filteredFullMetadata, expectedEntities,
|
|
394
|
+
validateLoadedOntologyMetadata(filteredFullMetadata, expectedEntities, packageInfo, fullMetadata) {
|
|
336
395
|
const errors = [];
|
|
337
396
|
const loadedObjectTypes = Object.fromEntries(Object.values(filteredFullMetadata.objectTypes).map((object) => [object.objectType.apiName, object]));
|
|
338
397
|
const loadedLinkTypes = Object.fromEntries(Object.values(filteredFullMetadata.objectTypes).map((object) => [object.objectType.apiName, Object.fromEntries(object.linkTypes.map((link) => [link.apiName, link]))]));
|
|
@@ -350,7 +409,7 @@ ${JSON.stringify(ontologyFullMetadata, null, 2)}`]);
|
|
|
350
409
|
}
|
|
351
410
|
for (const [, link] of Object.entries(loadedLinkTypes[object])) {
|
|
352
411
|
if (!expectedEntities.objectTypes.has(link.objectTypeApiName)) {
|
|
353
|
-
const fromFull =
|
|
412
|
+
const fromFull = fullMetadata?.objectTypes[link.objectTypeApiName];
|
|
354
413
|
if (fromFull && hasObjectType(packageInfo, fromFull)) {
|
|
355
414
|
continue;
|
|
356
415
|
}
|
|
@@ -389,14 +448,13 @@ ${JSON.stringify(ontologyFullMetadata, null, 2)}`]);
|
|
|
389
448
|
if (missingQueryTypes.length > 0) {
|
|
390
449
|
errors.push(`Unable to find the following Query Types: ${missingQueryTypes.join()}`);
|
|
391
450
|
}
|
|
392
|
-
const loadedActionTypes = Object.fromEntries(Object.entries(filteredFullMetadata.actionTypes).map(([actionApiName, action]) => [this.camelize(actionApiName), action]));
|
|
393
451
|
const missingActionTypes = [];
|
|
394
452
|
for (const actionApiName of expectedEntities.actionTypes) {
|
|
395
|
-
if (!
|
|
453
|
+
if (!filteredFullMetadata.actionTypes[actionApiName]) {
|
|
396
454
|
missingActionTypes.push(actionApiName);
|
|
397
455
|
}
|
|
398
456
|
}
|
|
399
|
-
for (const action of Object.values(
|
|
457
|
+
for (const action of Object.values(filteredFullMetadata.actionTypes)) {
|
|
400
458
|
const result = this.validateActionParameters(action, expectedEntities.objectTypes, expectedEntities.interfaceTypes);
|
|
401
459
|
if (result.isErr()) {
|
|
402
460
|
for (const errorString of result.error) {
|
|
@@ -419,8 +477,7 @@ ${JSON.stringify(ontologyFullMetadata, null, 2)}`]);
|
|
|
419
477
|
return results;
|
|
420
478
|
}
|
|
421
479
|
validateActionParameters(actionType, loadedObjectApiNames, loadedInterfaceApiNames) {
|
|
422
|
-
const
|
|
423
|
-
const parameterValidation = Object.entries(actionType.parameters).map(([_paramName, paramData]) => this.isSupportedActionTypeParameter(camelizedApiName, paramData.dataType, loadedObjectApiNames, loadedInterfaceApiNames));
|
|
480
|
+
const parameterValidation = Object.entries(actionType.parameters).map(([_paramName, paramData]) => this.isSupportedActionTypeParameter(actionType.apiName, paramData.dataType, loadedObjectApiNames, loadedInterfaceApiNames));
|
|
424
481
|
return Result.coalesce(parameterValidation);
|
|
425
482
|
}
|
|
426
483
|
visitSupportedQueryTypes(queryApiName, propertyName, baseType, loadedObjectApiNames) {
|
|
@@ -447,6 +504,8 @@ ${JSON.stringify(ontologyFullMetadata, null, 2)}`]);
|
|
|
447
504
|
return Result.ok({});
|
|
448
505
|
}
|
|
449
506
|
return Result.err([`Unable to load query ${queryApiName} because it takes an unsupported parameter type: ${JSON.stringify(baseType)} in parameter ${propertyName}`]);
|
|
507
|
+
case "entrySet":
|
|
508
|
+
return Result.coalesce([this.visitSupportedQueryTypes(queryApiName, propertyName, baseType.keyType, loadedObjectApiNames), this.visitSupportedQueryTypes(queryApiName, propertyName, baseType.valueType, loadedObjectApiNames)]);
|
|
450
509
|
case "string":
|
|
451
510
|
case "boolean":
|
|
452
511
|
case "attachment":
|
|
@@ -461,29 +520,30 @@ ${JSON.stringify(ontologyFullMetadata, null, 2)}`]);
|
|
|
461
520
|
case "null":
|
|
462
521
|
return Result.ok({});
|
|
463
522
|
case "unsupported":
|
|
523
|
+
return Result.err([`Unable to load query ${queryApiName} because it takes an unsupported parameter type: ${JSON.stringify(baseType)} in parameter ${propertyName}`]);
|
|
464
524
|
default:
|
|
465
525
|
return Result.err([`Unable to load query ${queryApiName} because it takes an unsupported parameter type: ${JSON.stringify(baseType)} in parameter ${propertyName}`]);
|
|
466
526
|
}
|
|
467
527
|
}
|
|
468
|
-
isSupportedActionTypeParameter(actionApiName,
|
|
469
|
-
switch (
|
|
528
|
+
isSupportedActionTypeParameter(actionApiName, actionTypeParameter, loadedObjectApiNames, loadedInterfaceApiNames) {
|
|
529
|
+
switch (actionTypeParameter.type) {
|
|
470
530
|
case "array":
|
|
471
|
-
return this.isSupportedActionTypeParameter(actionApiName,
|
|
531
|
+
return this.isSupportedActionTypeParameter(actionApiName, actionTypeParameter.subType, loadedObjectApiNames, loadedInterfaceApiNames);
|
|
472
532
|
case "object":
|
|
473
|
-
if (loadedObjectApiNames.has(
|
|
533
|
+
if (loadedObjectApiNames.has(actionTypeParameter.objectTypeApiName)) {
|
|
474
534
|
return Result.ok({});
|
|
475
535
|
}
|
|
476
|
-
return Result.err([`Unable to load action ${actionApiName} because it takes an unloaded object type as a parameter: ${
|
|
536
|
+
return Result.err([`Unable to load action ${actionApiName} because it takes an unloaded object type as a parameter: ${actionTypeParameter.objectTypeApiName} make sure to specify it as an argument with --ontologyObjects ${actionTypeParameter.objectTypeApiName})`]);
|
|
477
537
|
case "objectSet":
|
|
478
|
-
if (loadedObjectApiNames.has(
|
|
538
|
+
if (loadedObjectApiNames.has(actionTypeParameter.objectTypeApiName)) {
|
|
479
539
|
return Result.ok({});
|
|
480
540
|
}
|
|
481
|
-
return Result.err([`Unable to load action ${actionApiName} because it takes an ObjectSet of unloaded object type as a parameter: ${
|
|
541
|
+
return Result.err([`Unable to load action ${actionApiName} because it takes an ObjectSet of unloaded object type as a parameter: ${actionTypeParameter.objectTypeApiName} make sure to specify it as an argument with --ontologyObjects ${actionTypeParameter.objectTypeApiName})`]);
|
|
482
542
|
case "interfaceObject":
|
|
483
|
-
if (loadedInterfaceApiNames.has(
|
|
543
|
+
if (loadedInterfaceApiNames.has(actionTypeParameter.interfaceTypeApiName)) {
|
|
484
544
|
return Result.ok({});
|
|
485
545
|
}
|
|
486
|
-
return Result.err([`Unable to load action ${actionApiName} because it takes an unloaded interface type as a parameter: ${
|
|
546
|
+
return Result.err([`Unable to load action ${actionApiName} because it takes an unloaded interface type as a parameter: ${actionTypeParameter.interfaceTypeApiName} make sure to specify it as an argument with --ontologyInterfaces ${actionTypeParameter.interfaceTypeApiName}`]);
|
|
487
547
|
case "string":
|
|
488
548
|
case "boolean":
|
|
489
549
|
case "attachment":
|
|
@@ -495,14 +555,16 @@ ${JSON.stringify(ontologyFullMetadata, null, 2)}`]);
|
|
|
495
555
|
case "struct":
|
|
496
556
|
case "mediaReference":
|
|
497
557
|
case "objectType":
|
|
558
|
+
case "marking":
|
|
559
|
+
case "geohash":
|
|
560
|
+
case "geoshape":
|
|
498
561
|
return Result.ok({});
|
|
562
|
+
case "vector":
|
|
563
|
+
return Result.err([`Unable to load action ${actionApiName} because it takes an unsupported parameter: ${JSON.stringify(actionTypeParameter)} specify only the actions you want to load with the --actions argument.`]);
|
|
499
564
|
default:
|
|
500
|
-
return Result.err([`Unable to load action ${actionApiName} because it takes an unsupported parameter: ${JSON.stringify(
|
|
565
|
+
return Result.err([`Unable to load action ${actionApiName} because it takes an unsupported parameter: ${JSON.stringify(actionTypeParameter)} specify only the actions you want to load with the --actions argument.`]);
|
|
501
566
|
}
|
|
502
567
|
}
|
|
503
|
-
camelize(name) {
|
|
504
|
-
return name.replace(/-./g, (segment) => segment[1].toUpperCase());
|
|
505
|
-
}
|
|
506
568
|
};
|
|
507
569
|
function hasObjectType(z, fromFull) {
|
|
508
570
|
for (const q of z.values()) {
|
|
@@ -552,7 +614,7 @@ async function getDependencyVersionFromFindUpPackageJson(name, opts) {
|
|
|
552
614
|
findUp
|
|
553
615
|
} = await import('find-up');
|
|
554
616
|
const packageJsonPath = await findUp("package.json", opts);
|
|
555
|
-
!(packageJsonPath !==
|
|
617
|
+
!(packageJsonPath !== void 0) ? process.env.NODE_ENV !== "production" ? process.env.NODE_ENV !== "production" ? invariant(false, "Could not find package.json") : invariant() : process.env.NODE_ENV !== "production" ? invariant() : invariant() : void 0;
|
|
556
618
|
const packageJson = await readFile(packageJsonPath, {
|
|
557
619
|
encoding: "utf-8"
|
|
558
620
|
});
|
|
@@ -561,7 +623,7 @@ async function getDependencyVersionFromFindUpPackageJson(name, opts) {
|
|
|
561
623
|
}
|
|
562
624
|
const parsedPackageJson = JSON.parse(packageJson);
|
|
563
625
|
const version = parsedPackageJson.dependencies?.[name] ?? parsedPackageJson.devDependencies?.[name] ?? parsedPackageJson.peerDependencies?.[name];
|
|
564
|
-
!(version !==
|
|
626
|
+
!(version !== void 0) ? process.env.NODE_ENV !== "production" ? process.env.NODE_ENV !== "production" ? invariant(false, `Could not find a dependency for ${name} in ${packageJsonPath}`) : invariant() : process.env.NODE_ENV !== "production" ? invariant() : invariant() : void 0;
|
|
565
627
|
return version;
|
|
566
628
|
}
|
|
567
629
|
|
|
@@ -578,7 +640,7 @@ async function resolveDependenciesFromFindUp(deps, cwd) {
|
|
|
578
640
|
}
|
|
579
641
|
|
|
580
642
|
// src/utils/UserAgent.ts
|
|
581
|
-
var USER_AGENT = `typescript-sdk-generator/${"2.2.0-
|
|
643
|
+
var USER_AGENT = `typescript-sdk-generator/${"2.2.0-rc.24"}`;
|
|
582
644
|
async function createRollupBuild(absolutePackagePath, packageName) {
|
|
583
645
|
const inputPath = `${absolutePackagePath}/${packageName}/esm/index.js`;
|
|
584
646
|
const {
|
|
@@ -806,7 +868,7 @@ function compileInMemory(files, type) {
|
|
|
806
868
|
const originalSourceFile = compilerHost.getSourceFile;
|
|
807
869
|
compilerHost.getSourceFile = (fileName, languageVersion) => {
|
|
808
870
|
const sourceText = files[fileName];
|
|
809
|
-
return sourceText !==
|
|
871
|
+
return sourceText !== void 0 ? createSourceFile(fileName, sourceText, languageVersion) : originalSourceFile(fileName, languageVersion);
|
|
810
872
|
};
|
|
811
873
|
const program = createProgram(Object.keys(files), compilerOptions, compilerHost);
|
|
812
874
|
const emitOutput = program.emit();
|
|
@@ -845,7 +907,7 @@ async function generatePackageJson(options) {
|
|
|
845
907
|
peerDependencies: packagePeerDeps,
|
|
846
908
|
type: "commonjs"
|
|
847
909
|
};
|
|
848
|
-
await writeFile(join(options.packagePath, "package.json"), JSON.stringify(packageJson,
|
|
910
|
+
await writeFile(join(options.packagePath, "package.json"), JSON.stringify(packageJson, void 0, 4));
|
|
849
911
|
return packageJson;
|
|
850
912
|
}
|
|
851
913
|
function constructDependencies(dependencies) {
|
|
@@ -857,7 +919,7 @@ function constructDependencies(dependencies) {
|
|
|
857
919
|
|
|
858
920
|
// src/generate/betaClient/generatePackage.ts
|
|
859
921
|
var betaPeerDependencies = {
|
|
860
|
-
"@osdk/client":
|
|
922
|
+
"@osdk/client": void 0
|
|
861
923
|
};
|
|
862
924
|
async function generatePackage(ontologyInfo, options) {
|
|
863
925
|
const {
|
|
@@ -868,7 +930,7 @@ async function generatePackage(ontologyInfo, options) {
|
|
|
868
930
|
await mkdir(options.outputDir, {
|
|
869
931
|
recursive: true
|
|
870
932
|
});
|
|
871
|
-
await writeFile(path2__default.join(options.outputDir, "ontology.json"), JSON.stringify(ontologyInfo.
|
|
933
|
+
await writeFile(path2__default.join(options.outputDir, "ontology.json"), JSON.stringify(ontologyInfo.requestedMetadata, null, 2), "utf-8");
|
|
872
934
|
return;
|
|
873
935
|
}
|
|
874
936
|
const packagePath = customNormalize(join(options.outputDir, options.packageName));
|
|
@@ -888,15 +950,13 @@ async function generatePackage(ontologyInfo, options) {
|
|
|
888
950
|
},
|
|
889
951
|
readdir: (path4) => readdir(path4)
|
|
890
952
|
};
|
|
891
|
-
await generateClientSdkVersionTwoPointZero(ontologyInfo.
|
|
953
|
+
await generateClientSdkVersionTwoPointZero(ontologyInfo.requestedMetadata, `typescript-sdk/${options.packageVersion} ${USER_AGENT}`, hostFs, packagePath, "module", ontologyInfo.externalObjects, ontologyInfo.externalInterfaces, /* @__PURE__ */ new Map(), false, ontologyInfo.fixedVersionQueryTypes);
|
|
892
954
|
const contents = await generatePackageJson({
|
|
893
955
|
packageName: options.packageName,
|
|
894
956
|
packagePath,
|
|
895
957
|
packageVersion: options.packageVersion,
|
|
896
958
|
dependencies: [],
|
|
897
|
-
peerDependencies: resolvedPeerDependencies
|
|
898
|
-
beta: options.beta
|
|
899
|
-
});
|
|
959
|
+
peerDependencies: resolvedPeerDependencies});
|
|
900
960
|
const compilerOutput = {};
|
|
901
961
|
for (const type of ["esm", "cjs"]) {
|
|
902
962
|
await hostFs.writeFile(join(packagePath, "package.json"), JSON.stringify({
|
|
@@ -973,8 +1033,8 @@ function customNormalize(pathName) {
|
|
|
973
1033
|
// src/generate/commandUtils.ts
|
|
974
1034
|
function transformArrayArg(arg) {
|
|
975
1035
|
if (arg && arg.length > 0) {
|
|
976
|
-
if (arg[0] ===
|
|
977
|
-
return
|
|
1036
|
+
if (arg[0] === void 0) {
|
|
1037
|
+
return void 0;
|
|
978
1038
|
}
|
|
979
1039
|
}
|
|
980
1040
|
return arg;
|
|
@@ -1015,42 +1075,42 @@ var GeneratePackageCommand = class {
|
|
|
1015
1075
|
string: true,
|
|
1016
1076
|
demandOption: false,
|
|
1017
1077
|
description: `The API names of the object types to generate. Example Usage: --objectTypes Aircraft Airport`,
|
|
1018
|
-
default:
|
|
1078
|
+
default: void 0,
|
|
1019
1079
|
defaultDescription: `By default, no arguments will not load any object type.`
|
|
1020
1080
|
}).options("actionTypes", {
|
|
1021
1081
|
array: true,
|
|
1022
1082
|
string: true,
|
|
1023
1083
|
demandOption: false,
|
|
1024
1084
|
description: `The API names of the action types to generate. Example Usage: --actionTypes schedule-airplane-maintenance`,
|
|
1025
|
-
default:
|
|
1085
|
+
default: void 0,
|
|
1026
1086
|
defaultDescription: `By default, no arguments will not load any action type.`
|
|
1027
1087
|
}).options("linkTypes", {
|
|
1028
1088
|
array: true,
|
|
1029
1089
|
string: true,
|
|
1030
1090
|
demandOption: false,
|
|
1031
1091
|
description: `The link types to generate in the format of ObjectTypeApiName.LinkTypeApiName. Example Usage: --linkTypes Aircraft.scheduledFlight`,
|
|
1032
|
-
default:
|
|
1092
|
+
default: void 0,
|
|
1033
1093
|
defaultDescription: `By default, no arguments will not load any link type.`
|
|
1034
1094
|
}).options("queryTypes", {
|
|
1035
1095
|
array: true,
|
|
1036
1096
|
string: true,
|
|
1037
1097
|
demandOption: false,
|
|
1038
1098
|
description: `The API Names of the query types to generate. Example Usage: --queryTypes calculateMetric`,
|
|
1039
|
-
default:
|
|
1099
|
+
default: void 0,
|
|
1040
1100
|
defaultDescription: `By default, no arguments will not load any query type.`
|
|
1041
1101
|
}).options("interfaceTypes", {
|
|
1042
1102
|
array: true,
|
|
1043
1103
|
string: true,
|
|
1044
1104
|
demandOption: false,
|
|
1045
1105
|
description: `The API Names of the interface types to generate. Example Usage: --interfaceTypes Geolocatable`,
|
|
1046
|
-
default:
|
|
1106
|
+
default: void 0,
|
|
1047
1107
|
defaultDescription: `By default, no arguments will not load any interface type.`
|
|
1048
1108
|
}).options("experimentalFeatures", {
|
|
1049
1109
|
array: true,
|
|
1050
1110
|
string: true,
|
|
1051
1111
|
demandOption: false,
|
|
1052
1112
|
description: `Experimental features that can be modified or removed at any time. Example Usage: --experimentalFeatures realtimeUpdates`,
|
|
1053
|
-
default:
|
|
1113
|
+
default: void 0,
|
|
1054
1114
|
defaultDescription: `By default, no arguments will not enable any experimental features.`
|
|
1055
1115
|
}).options("beta", {
|
|
1056
1116
|
boolean: true,
|