@osdk/generator 1.11.1-main-20240521212111 → 1.12.0-main-20240529132607
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 +3 -4
- package/build/browser/index.js +70 -31
- package/build/browser/index.js.map +1 -1
- package/build/cjs/generateClientSdkPackage.d.cts +39 -20
- package/build/cjs/generateClientSdkPackage.d.ts.map +1 -1
- package/build/cjs/index.cjs +70 -30
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/index.d.cts +1 -1
- package/build/cjs/index.d.ts.map +1 -1
- package/build/cjs/v2.0/generateClientSdkVersionTwoPointZero.d.ts.map +1 -1
- package/build/esm/generateClientSdkPackage.d.ts +39 -20
- package/build/esm/generateClientSdkPackage.d.ts.map +1 -1
- package/build/esm/index.d.ts +1 -1
- package/build/esm/index.d.ts.map +1 -1
- package/build/esm/index.js +70 -31
- package/build/esm/index.js.map +1 -1
- package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.d.ts.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
# @osdk/generator
|
|
2
2
|
|
|
3
|
-
## 1.
|
|
3
|
+
## 1.12.0-main-20240529132607
|
|
4
4
|
|
|
5
|
-
###
|
|
5
|
+
### Minor Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
- @osdk/generator-converters@0.6.1-main-20240521212111
|
|
7
|
+
- 0ecd42b: Generates 2.0's Ontology.ts in a typescript 5.5.0-beta safe way
|
|
9
8
|
|
|
10
9
|
## 1.11.0
|
|
11
10
|
|
package/build/browser/index.js
CHANGED
|
@@ -375,7 +375,7 @@ async function generatePerActionDataFiles(ontology, fs2, outDir, importExt, v2)
|
|
|
375
375
|
const importObjects = referencedObjectDefs.size > 0 ? `import type {${[...referencedObjectDefs].join(",")}} from "../objects${importExt}";` : "";
|
|
376
376
|
await fs2.writeFile(path16__default.join(outDir, `${action.apiName}.ts`), await formatTs(`
|
|
377
377
|
import type { ActionDefinition, ObjectActionDataType, ObjectSetActionDataType } from "@osdk/api";
|
|
378
|
-
import type { ActionSignature, ApplyActionOptions, OsdkActionParameters,ActionReturnTypeForOptions, NOOP } from '@osdk/client';
|
|
378
|
+
import type { ActionSignature, ApplyActionOptions, OsdkActionParameters,ActionReturnTypeForOptions, NOOP } from '@osdk/client.api';
|
|
379
379
|
import { $osdkMetadata} from "../../OntologyMetadata${importExt}";
|
|
380
380
|
${importObjects}
|
|
381
381
|
|
|
@@ -1701,7 +1701,29 @@ async function generateClientSdkVersionTwoPointZero(ontology, userAgent, fs2, ou
|
|
|
1701
1701
|
import * as Interfaces from "./ontology/interfaces${importExt}";
|
|
1702
1702
|
import { OntologyMetadata } from "./OntologyMetadata${importExt}";
|
|
1703
1703
|
|
|
1704
|
-
|
|
1704
|
+
export interface Ontology extends OntologyDefinition<${stringUnionFrom2(objectNames)}> {
|
|
1705
|
+
metadata: OntologyMetadata,
|
|
1706
|
+
objects: {
|
|
1707
|
+
${objectNames.map((objectName) => {
|
|
1708
|
+
return `${objectName}: Objects.${objectName}`;
|
|
1709
|
+
}).join(",\n")}
|
|
1710
|
+
},
|
|
1711
|
+
actions: {
|
|
1712
|
+
${actionNames.map((actionName) => {
|
|
1713
|
+
return `${actionName}: typeof Actions.${actionName}`;
|
|
1714
|
+
}).join(",\n")}
|
|
1715
|
+
},
|
|
1716
|
+
queries: {
|
|
1717
|
+
// TODO
|
|
1718
|
+
},
|
|
1719
|
+
interfaces: {
|
|
1720
|
+
${interfaceNames.map((objectName) => {
|
|
1721
|
+
return `${objectName}: Interfaces.${objectName}`;
|
|
1722
|
+
}).join(",\n")}
|
|
1723
|
+
}
|
|
1724
|
+
}
|
|
1725
|
+
|
|
1726
|
+
export const Ontology: Ontology = {
|
|
1705
1727
|
metadata: OntologyMetadata,
|
|
1706
1728
|
objects: {
|
|
1707
1729
|
${objectNames.map((objectName) => {
|
|
@@ -1723,11 +1745,8 @@ async function generateClientSdkVersionTwoPointZero(ontology, userAgent, fs2, ou
|
|
|
1723
1745
|
}).join(",\n")}
|
|
1724
1746
|
|
|
1725
1747
|
}
|
|
1726
|
-
}
|
|
1748
|
+
};
|
|
1727
1749
|
|
|
1728
|
-
type _Ontology = typeof _Ontology;
|
|
1729
|
-
export interface Ontology extends _Ontology {}
|
|
1730
|
-
export const Ontology = _Ontology as Ontology;
|
|
1731
1750
|
`));
|
|
1732
1751
|
await fs2.mkdir(path16__default.join(outDir, "ontology", "objects"), {
|
|
1733
1752
|
recursive: true
|
|
@@ -1736,7 +1755,7 @@ async function generateClientSdkVersionTwoPointZero(ontology, userAgent, fs2, ou
|
|
|
1736
1755
|
const obj = ontology.objectTypes[name];
|
|
1737
1756
|
await fs2.writeFile(path16__default.join(outDir, "ontology", `objects`, `${name}.ts`), await formatTs(`
|
|
1738
1757
|
import type { ObjectTypeDefinition, VersionBound, ObjectTypeLinkDefinition, PropertyDef } from "@osdk/api";
|
|
1739
|
-
import { Osdk } from "@osdk/client";
|
|
1758
|
+
import { Osdk } from "@osdk/client.api";
|
|
1740
1759
|
import { $osdkMetadata } from "../../OntologyMetadata${importExt}";
|
|
1741
1760
|
import type { $ExpectedClientVersion } from "../../OntologyMetadata${importExt}";
|
|
1742
1761
|
|
|
@@ -1828,14 +1847,52 @@ function getTsCompilerOptions(packageType) {
|
|
|
1828
1847
|
};
|
|
1829
1848
|
return compilerOptions;
|
|
1830
1849
|
}
|
|
1831
|
-
function
|
|
1832
|
-
typescriptVersion,
|
|
1833
|
-
tslibVersion,
|
|
1834
|
-
areTheTypesWrongVersion,
|
|
1850
|
+
function getExpectedDependencies(sdkVersion, {
|
|
1835
1851
|
osdkApiVersion,
|
|
1836
1852
|
osdkClientVersion,
|
|
1853
|
+
osdkClientApiVersion,
|
|
1837
1854
|
osdkLegacyClientVersion
|
|
1838
1855
|
}) {
|
|
1856
|
+
return {
|
|
1857
|
+
devDependencies: {
|
|
1858
|
+
"@osdk/api": osdkApiVersion,
|
|
1859
|
+
...sdkVersion === "2.0" ? {
|
|
1860
|
+
"@osdk/client.api": osdkClientApiVersion
|
|
1861
|
+
} : {
|
|
1862
|
+
"@osdk/legacy-client": osdkLegacyClientVersion
|
|
1863
|
+
}
|
|
1864
|
+
},
|
|
1865
|
+
peerDependencies: {
|
|
1866
|
+
"@osdk/api": osdkApiVersion,
|
|
1867
|
+
...sdkVersion === "2.0" ? {
|
|
1868
|
+
"@osdk/client.api": osdkClientApiVersion,
|
|
1869
|
+
"@osdk/client": osdkClientVersion
|
|
1870
|
+
} : {
|
|
1871
|
+
"@osdk/legacy-client": osdkLegacyClientVersion
|
|
1872
|
+
}
|
|
1873
|
+
}
|
|
1874
|
+
};
|
|
1875
|
+
}
|
|
1876
|
+
function getExpectedDependenciesFull(sdkVersion, dependencyVersions) {
|
|
1877
|
+
const {
|
|
1878
|
+
typescriptVersion,
|
|
1879
|
+
tslibVersion,
|
|
1880
|
+
areTheTypesWrongVersion
|
|
1881
|
+
} = dependencyVersions;
|
|
1882
|
+
const base = getExpectedDependencies(sdkVersion, dependencyVersions);
|
|
1883
|
+
return {
|
|
1884
|
+
devDependencies: {
|
|
1885
|
+
...base.devDependencies,
|
|
1886
|
+
"typescript": typescriptVersion,
|
|
1887
|
+
"tslib": tslibVersion,
|
|
1888
|
+
"@arethetypeswrong/cli": areTheTypesWrongVersion
|
|
1889
|
+
},
|
|
1890
|
+
peerDependencies: {
|
|
1891
|
+
...base.peerDependencies
|
|
1892
|
+
}
|
|
1893
|
+
};
|
|
1894
|
+
}
|
|
1895
|
+
function getPackageJsonContents(name, version, sdkVersion, dependencyVersions) {
|
|
1839
1896
|
const esmPrefix = "./dist/module";
|
|
1840
1897
|
const commonjsPrefix = "./dist/commonjs";
|
|
1841
1898
|
return {
|
|
@@ -1857,25 +1914,7 @@ function getPackageJsonContents(name, version, sdkVersion, {
|
|
|
1857
1914
|
prepack: `tsc -p ${esmPrefix}/tsconfig.json && tsc -p ${commonjsPrefix}/tsconfig.json`,
|
|
1858
1915
|
check: "npm exec attw $(npm pack)"
|
|
1859
1916
|
},
|
|
1860
|
-
|
|
1861
|
-
"typescript": typescriptVersion,
|
|
1862
|
-
"tslib": tslibVersion,
|
|
1863
|
-
"@arethetypeswrong/cli": areTheTypesWrongVersion,
|
|
1864
|
-
"@osdk/api": osdkApiVersion,
|
|
1865
|
-
...sdkVersion === "2.0" ? {
|
|
1866
|
-
"@osdk/client": osdkClientVersion
|
|
1867
|
-
} : {
|
|
1868
|
-
"@osdk/legacy-client": osdkLegacyClientVersion
|
|
1869
|
-
}
|
|
1870
|
-
},
|
|
1871
|
-
peerDependencies: {
|
|
1872
|
-
"@osdk/api": osdkApiVersion,
|
|
1873
|
-
...sdkVersion === "2.0" ? {
|
|
1874
|
-
"@osdk/client": osdkClientVersion
|
|
1875
|
-
} : {
|
|
1876
|
-
"@osdk/legacy-client": osdkLegacyClientVersion
|
|
1877
|
-
}
|
|
1878
|
-
},
|
|
1917
|
+
...getExpectedDependenciesFull(sdkVersion, dependencyVersions),
|
|
1879
1918
|
files: ["**/*.js", "**/*.d.ts", "dist/**/package.json"]
|
|
1880
1919
|
};
|
|
1881
1920
|
}
|
|
@@ -1883,6 +1922,6 @@ async function writeJson(minimalFs, filePath, body) {
|
|
|
1883
1922
|
return await minimalFs.writeFile(filePath, JSON.stringify(body, void 0, 2) + "\n");
|
|
1884
1923
|
}
|
|
1885
1924
|
|
|
1886
|
-
export { generateClientSdkPackage as __UNSTABLE_generateClientSdkPackage, generateClientSdkVersionOneDotOne, generateClientSdkVersionTwoPointZero };
|
|
1925
|
+
export { generateClientSdkPackage as __UNSTABLE_generateClientSdkPackage, generateClientSdkVersionOneDotOne, generateClientSdkVersionTwoPointZero, getExpectedDependencies };
|
|
1887
1926
|
//# sourceMappingURL=out.js.map
|
|
1888
1927
|
//# sourceMappingURL=index.js.map
|