@osdk/foundry-sdk-generator 2.1.0-beta.15 → 2.1.0-beta.17
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 +27 -0
- package/build/browser/index.js +23 -19
- package/build/browser/index.js.map +1 -1
- package/build/esm/generate/betaClient/compileInMemory.d.ts +0 -2
- package/build/esm/generate/betaClient/compileInMemory.d.ts.map +1 -1
- package/build/esm/generate/betaClient/generatePackage.d.ts.map +1 -1
- package/build/esm/generate/betaClient/generatePackageJson.d.ts +23 -1
- package/build/esm/generate/betaClient/generatePackageJson.d.ts.map +1 -1
- package/build/esm/index.js +23 -19
- package/build/esm/index.js.map +1 -1
- package/package.json +9 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# @osdk/foundry-sdk-generator
|
|
2
2
|
|
|
3
|
+
## 2.1.0-beta.17
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 1b60b3d: Packages use more specific versions instead of indirection through shared.net
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [1b60b3d]
|
|
12
|
+
- @osdk/shared.client.impl@1.1.0-beta.3
|
|
13
|
+
- @osdk/client@2.1.0-beta.17
|
|
14
|
+
- @osdk/api@2.1.0-beta.17
|
|
15
|
+
- @osdk/generator@2.1.0-beta.17
|
|
16
|
+
|
|
17
|
+
## 2.1.0-beta.16
|
|
18
|
+
|
|
19
|
+
### Minor Changes
|
|
20
|
+
|
|
21
|
+
- 3a85529: Generated SDKS produce valid ESM packages
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- Updated dependencies [e5fe7c0]
|
|
26
|
+
- @osdk/client@2.1.0-beta.16
|
|
27
|
+
- @osdk/api@2.1.0-beta.16
|
|
28
|
+
- @osdk/generator@2.1.0-beta.16
|
|
29
|
+
|
|
3
30
|
## 2.1.0-beta.15
|
|
4
31
|
|
|
5
32
|
### Patch Changes
|
package/build/browser/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import path2__default, { join, dirname, isAbsolute, normalize } from 'path';
|
|
|
4
4
|
import yargs from 'yargs';
|
|
5
5
|
import { hideBin } from 'yargs/helpers';
|
|
6
6
|
import { exit } from 'process';
|
|
7
|
-
import {
|
|
7
|
+
import { createSharedClientContext } from '@osdk/shared.client.impl';
|
|
8
8
|
import { generateClientSdkVersionTwoPointZero } from '@osdk/generator';
|
|
9
9
|
import { mkdir, writeFile, readdir, readFile } from 'fs/promises';
|
|
10
10
|
import commonjs from '@rollup/plugin-commonjs';
|
|
@@ -13,9 +13,9 @@ import { rollup } from 'rollup';
|
|
|
13
13
|
import nodePolyfill from 'rollup-plugin-polyfill-node';
|
|
14
14
|
import { Project, Node } from 'ts-morph';
|
|
15
15
|
import * as fs from 'fs';
|
|
16
|
-
import { ModuleKind, ScriptTarget, createCompilerHost, createSourceFile, createProgram } from 'typescript';
|
|
16
|
+
import { ModuleKind, ScriptTarget, ModuleResolutionKind, createCompilerHost, createSourceFile, createProgram } from 'typescript';
|
|
17
17
|
|
|
18
|
-
// ../../node_modules/.pnpm/tsup@8.2.3_@microsoft+api-extractor@7.47.0_@types+node@22.
|
|
18
|
+
// ../../node_modules/.pnpm/tsup@8.2.3_@microsoft+api-extractor@7.47.0_@types+node@22.10.1__jiti@1.21.6_postcss@8.4.47_typescript@5.5.4_yaml@2.4.5/node_modules/tsup/assets/esm_shims.js
|
|
19
19
|
var getFilename = () => fileURLToPath(import.meta.url);
|
|
20
20
|
var getDirname = () => path2__default.dirname(getFilename());
|
|
21
21
|
var __dirname = /* @__PURE__ */ getDirname();
|
|
@@ -192,7 +192,7 @@ var OntologyMetadataResolver = class {
|
|
|
192
192
|
this.#authToken = authToken;
|
|
193
193
|
}
|
|
194
194
|
getClientContext() {
|
|
195
|
-
return
|
|
195
|
+
return createSharedClientContext(this.stackName.match(/^https?:\/\//) ? this.stackName : `https://${this.stackName}`, () => Promise.resolve(this.#authToken), `foundry-typescript-osdk-generator/${process.env.npm_package_version}`);
|
|
196
196
|
}
|
|
197
197
|
filterMetadataByApiName(ontologyFullMetadata, expectedEntities, pkgInfo) {
|
|
198
198
|
const filteredObjectTypes = Object.fromEntries(Object.entries(ontologyFullMetadata.objectTypes).filter(([, {
|
|
@@ -559,7 +559,7 @@ async function resolveDependenciesFromFindUp(deps, cwd) {
|
|
|
559
559
|
}
|
|
560
560
|
|
|
561
561
|
// src/utils/UserAgent.ts
|
|
562
|
-
var USER_AGENT = `typescript-sdk-generator/${"2.1.0-beta.
|
|
562
|
+
var USER_AGENT = `typescript-sdk-generator/${"2.1.0-beta.17"}`;
|
|
563
563
|
async function createRollupBuild(absolutePackagePath, packageName) {
|
|
564
564
|
const inputPath = `${absolutePackagePath}/${packageName}/index.js`;
|
|
565
565
|
const {
|
|
@@ -771,11 +771,12 @@ function outputModule(project) {
|
|
|
771
771
|
});
|
|
772
772
|
return modules.join("\n");
|
|
773
773
|
}
|
|
774
|
-
function compileInMemory(files
|
|
774
|
+
function compileInMemory(files) {
|
|
775
775
|
const inMemoryOutputFileSystem = {};
|
|
776
776
|
const compilerOptions = {
|
|
777
|
-
module: ModuleKind.NodeNext
|
|
778
|
-
target: ScriptTarget.
|
|
777
|
+
module: ModuleKind.NodeNext,
|
|
778
|
+
target: ScriptTarget.ES2020,
|
|
779
|
+
moduleResolution: ModuleResolutionKind.NodeNext,
|
|
779
780
|
declaration: true,
|
|
780
781
|
skipLibCheck: true
|
|
781
782
|
};
|
|
@@ -818,6 +819,7 @@ async function generatePackageJson(options) {
|
|
|
818
819
|
type: "module"
|
|
819
820
|
};
|
|
820
821
|
await writeFile(join(options.packagePath, "package.json"), JSON.stringify(packageJson, void 0, 4));
|
|
822
|
+
return packageJson;
|
|
821
823
|
}
|
|
822
824
|
function constructDependencies(dependencies) {
|
|
823
825
|
return dependencies?.reduce((acc, value) => {
|
|
@@ -841,8 +843,8 @@ async function generatePackage(ontologyInfo, options) {
|
|
|
841
843
|
});
|
|
842
844
|
const inMemoryFileSystem = {};
|
|
843
845
|
const hostFs = {
|
|
844
|
-
writeFile: async (path3,
|
|
845
|
-
inMemoryFileSystem[normalize(path3)] =
|
|
846
|
+
writeFile: async (path3, contents2) => {
|
|
847
|
+
inMemoryFileSystem[normalize(path3)] = contents2;
|
|
846
848
|
},
|
|
847
849
|
mkdir: async (path3, _options) => {
|
|
848
850
|
await mkdir(normalize(path3), {
|
|
@@ -852,6 +854,15 @@ async function generatePackage(ontologyInfo, options) {
|
|
|
852
854
|
readdir: (path3) => readdir(path3)
|
|
853
855
|
};
|
|
854
856
|
await generateClientSdkVersionTwoPointZero(ontologyInfo.filteredFullMetadata, `typescript-sdk/${options.packageVersion} ${USER_AGENT}`, hostFs, packagePath, "module", ontologyInfo.externalObjects, ontologyInfo.externalInterfaces);
|
|
857
|
+
const contents = await generatePackageJson({
|
|
858
|
+
packageName: options.packageName,
|
|
859
|
+
packagePath,
|
|
860
|
+
packageVersion: options.packageVersion,
|
|
861
|
+
dependencies: [],
|
|
862
|
+
peerDependencies: resolvedPeerDependencies,
|
|
863
|
+
beta: options.beta
|
|
864
|
+
});
|
|
865
|
+
await hostFs.writeFile(join(packagePath, "package.json"), JSON.stringify(contents));
|
|
855
866
|
const compilerOutput = compileInMemory(inMemoryFileSystem);
|
|
856
867
|
compilerOutput.diagnostics.forEach((d) => consola.error(`Error compiling file`, d.file?.fileName, d.messageText));
|
|
857
868
|
await mkdir(join(packagePath, "dist", "bundle"), {
|
|
@@ -874,19 +885,12 @@ async function generatePackage(ontologyInfo, options) {
|
|
|
874
885
|
} else {
|
|
875
886
|
consola.error("Could not find node_modules directory, skipping DTS bundling");
|
|
876
887
|
}
|
|
877
|
-
await Promise.all([...Object.entries(compilerOutput.files).map(async ([path3,
|
|
878
|
-
await writeFile(path3,
|
|
888
|
+
await Promise.all([...Object.entries(compilerOutput.files).map(async ([path3, contents2]) => {
|
|
889
|
+
await writeFile(path3, contents2, {
|
|
879
890
|
flag: "w"
|
|
880
891
|
});
|
|
881
892
|
}), await writeFile(join(packagePath, "dist", "bundle", "index.d.ts"), bundleDts, {
|
|
882
893
|
flag: "w"
|
|
883
|
-
}), generatePackageJson({
|
|
884
|
-
packageName: options.packageName,
|
|
885
|
-
packagePath,
|
|
886
|
-
packageVersion: options.packageVersion,
|
|
887
|
-
dependencies: [],
|
|
888
|
-
peerDependencies: resolvedPeerDependencies,
|
|
889
|
-
beta: options.beta
|
|
890
894
|
})]);
|
|
891
895
|
const absolutePackagePath = isAbsolute(options.outputDir) ? options.outputDir : join(process.cwd(), options.outputDir);
|
|
892
896
|
try {
|