@osdk/generator 1.11.1-main-20240521212111 → 1.12.0-beta.1

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.
@@ -7,47 +7,66 @@ export interface DependencyVersions {
7
7
  areTheTypesWrongVersion: string;
8
8
  osdkApiVersion: string;
9
9
  osdkClientVersion: string;
10
+ osdkClientApiVersion: string;
10
11
  osdkLegacyClientVersion: string;
11
12
  }
12
- export declare function getPackageJsonContents(name: string, version: string, sdkVersion: "2.0" | "1.1", { typescriptVersion, tslibVersion, areTheTypesWrongVersion, osdkApiVersion, osdkClientVersion, osdkLegacyClientVersion, }: DependencyVersions): {
13
- name: string;
14
- version: string;
15
- main: string;
16
- module: string;
17
- exports: {
18
- ".": {
19
- import: string;
20
- require: string;
21
- };
22
- "./ontology/objects": {
23
- import: string;
24
- require: string;
25
- };
13
+ export declare function getExpectedDependencies(sdkVersion: "2.0" | "1.1", { osdkApiVersion, osdkClientVersion, osdkClientApiVersion, osdkLegacyClientVersion, }: DependencyVersions): {
14
+ devDependencies: {
15
+ "@osdk/client.api": string;
16
+ "@osdk/api": string;
17
+ } | {
18
+ "@osdk/legacy-client": string;
19
+ "@osdk/api": string;
26
20
  };
27
- scripts: {
28
- prepack: string;
29
- check: string;
21
+ peerDependencies: {
22
+ "@osdk/client.api": string;
23
+ "@osdk/client": string;
24
+ "@osdk/api": string;
25
+ } | {
26
+ "@osdk/legacy-client": string;
27
+ "@osdk/api": string;
30
28
  };
29
+ };
30
+ export declare function getPackageJsonContents(name: string, version: string, sdkVersion: "2.0" | "1.1", dependencyVersions: DependencyVersions): {
31
+ files: string[];
31
32
  devDependencies: {
32
- "@osdk/client": string;
33
33
  typescript: string;
34
34
  tslib: string;
35
35
  "@arethetypeswrong/cli": string;
36
+ "@osdk/client.api": string;
36
37
  "@osdk/api": string;
37
38
  } | {
38
- "@osdk/legacy-client": string;
39
39
  typescript: string;
40
40
  tslib: string;
41
41
  "@arethetypeswrong/cli": string;
42
+ "@osdk/legacy-client": string;
42
43
  "@osdk/api": string;
43
44
  };
44
45
  peerDependencies: {
46
+ "@osdk/client.api": string;
45
47
  "@osdk/client": string;
46
48
  "@osdk/api": string;
47
49
  } | {
48
50
  "@osdk/legacy-client": string;
49
51
  "@osdk/api": string;
50
52
  };
51
- files: string[];
53
+ name: string;
54
+ version: string;
55
+ main: string;
56
+ module: string;
57
+ exports: {
58
+ ".": {
59
+ import: string;
60
+ require: string;
61
+ };
62
+ "./ontology/objects": {
63
+ import: string;
64
+ require: string;
65
+ };
66
+ };
67
+ scripts: {
68
+ prepack: string;
69
+ check: string;
70
+ };
52
71
  };
53
72
  //# sourceMappingURL=generateClientSdkPackage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"generateClientSdkPackage.d.ts","sourceRoot":"","sources":["../../src/generateClientSdkPackage.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAGhD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAE1E,wBAAsB,wBAAwB,CAC5C,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,KAAK,GAAG,KAAK,EACzB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,sBAAsB,EAChC,SAAS,EAAE,SAAS,EACpB,kBAAkB,EAAE,kBAAkB,EACtC,UAAU,EAAE,MAAM,iBA0DnB;AA+BD,MAAM,WAAW,kBAAkB;IACjC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,uBAAuB,EAAE,MAAM,CAAC;IAChC,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,uBAAuB,EAAE,MAAM,CAAC;CACjC;AAED,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,KAAK,GAAG,KAAK,EACzB,EACE,iBAAiB,EACjB,YAAY,EACZ,uBAAuB,EACvB,cAAc,EACd,iBAAiB,EACjB,uBAAuB,GACxB,EAAE,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkDtB"}
1
+ {"version":3,"file":"generateClientSdkPackage.d.ts","sourceRoot":"","sources":["../../src/generateClientSdkPackage.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAGhD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAE1E,wBAAsB,wBAAwB,CAC5C,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,KAAK,GAAG,KAAK,EACzB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,sBAAsB,EAChC,SAAS,EAAE,SAAS,EACpB,kBAAkB,EAAE,kBAAkB,EACtC,UAAU,EAAE,MAAM,iBA0DnB;AA+BD,MAAM,WAAW,kBAAkB;IACjC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,uBAAuB,EAAE,MAAM,CAAC;IAChC,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,uBAAuB,EAAE,MAAM,CAAC;CACjC;AAED,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,KAAK,GAAG,KAAK,EACzB,EACE,cAAc,EACd,iBAAiB,EACjB,oBAAoB,EACpB,uBAAuB,GACxB,EAAE,kBAAkB;;;;;;;;;;;;;;;;EAoBtB;AA2BD,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,KAAK,GAAG,KAAK,EACzB,kBAAkB,EAAE,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmCvC"}
@@ -356,13 +356,13 @@ async function generatePerActionDataFiles(ontology, fs2, outDir, importExt, v2)
356
356
 
357
357
 
358
358
  // Represents the runtime arguments for the action
359
- export type ${paramsIdentifier} = NOOP<OsdkActionParameters<${paramsDefIdentifier}>>;
359
+ export type ${paramsIdentifier} = NOOP<OsdkActionParameters<${paramsDefIdentifier}>> | NOOP<OsdkActionParameters<${paramsDefIdentifier}>>[];
360
360
 
361
361
 
362
362
  // Represents a fqn of the action
363
363
  export interface ${action.apiName} {
364
364
  ${getDescriptionIfPresent(action.description)}
365
- <OP extends ApplyActionOptions>(args: ${paramsIdentifier}, options?: OP): Promise<ActionReturnTypeForOptions<OP>>;
365
+ <P extends ${paramsIdentifier}, OP extends P extends NOOP<OsdkActionParameters<${paramsDefIdentifier}>>[]? ApplyBatchActionOptions: ApplyActionOptions>(args: P, options?: OP): Promise<ActionReturnTypeForOptions<OP>>;
366
366
  }
367
367
 
368
368
 
@@ -400,7 +400,7 @@ async function generatePerActionDataFiles(ontology, fs2, outDir, importExt, v2)
400
400
  const importObjects = referencedObjectDefs.size > 0 ? `import type {${[...referencedObjectDefs].join(",")}} from "../objects${importExt}";` : "";
401
401
  await fs2.writeFile(path16__namespace.default.join(outDir, `${action.apiName}.ts`), await formatTs(`
402
402
  import type { ActionDefinition, ObjectActionDataType, ObjectSetActionDataType } from "@osdk/api";
403
- import type { ActionSignature, ApplyActionOptions, OsdkActionParameters,ActionReturnTypeForOptions, NOOP } from '@osdk/client';
403
+ import type { ActionSignature, ApplyActionOptions, ApplyBatchActionOptions, OsdkActionParameters,ActionReturnTypeForOptions, NOOP } from '@osdk/client.api';
404
404
  import { $osdkMetadata} from "../../OntologyMetadata${importExt}";
405
405
  ${importObjects}
406
406
 
@@ -628,8 +628,7 @@ function reexportTypes(typesToExport, genericArgsLeft = "", genericArgsRight = c
628
628
  var captureInBracketsRegex = /<(.*?)>/;
629
629
  var captureGenericParamNameRegex = /^\s?(.+?)( extends .*?)?( = .*?)?\s?$/;
630
630
  function cleanup(s) {
631
- if (s.length === 0)
632
- return "";
631
+ if (s.length === 0) return "";
633
632
  const genericParameterNames = captureInBracketsRegex.exec(s)?.[1]?.split(",")?.map((a) => {
634
633
  return captureGenericParamNameRegex.exec(a)?.[1] ?? a;
635
634
  });
@@ -1681,7 +1680,7 @@ function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(interfaceDef, v2 = false
1681
1680
 
1682
1681
  };`;
1683
1682
  }
1684
- var ExpectedOsdkVersion = "0.19.1";
1683
+ var ExpectedOsdkVersion = "0.20.0";
1685
1684
  async function generateOntologyMetadataFile(ontology, userAgent, fs2, outDir) {
1686
1685
  fs2.writeFile(path16__namespace.default.join(outDir, "OntologyMetadata.ts"), await formatTs(`
1687
1686
  import { OntologyMetadata as OM } from "@osdk/api";
@@ -1726,7 +1725,29 @@ async function generateClientSdkVersionTwoPointZero(ontology, userAgent, fs2, ou
1726
1725
  import * as Interfaces from "./ontology/interfaces${importExt}";
1727
1726
  import { OntologyMetadata } from "./OntologyMetadata${importExt}";
1728
1727
 
1729
- const _Ontology = {
1728
+ export interface Ontology extends OntologyDefinition<${stringUnionFrom2(objectNames)}> {
1729
+ metadata: OntologyMetadata,
1730
+ objects: {
1731
+ ${objectNames.map((objectName) => {
1732
+ return `${objectName}: Objects.${objectName}`;
1733
+ }).join(",\n")}
1734
+ },
1735
+ actions: {
1736
+ ${actionNames.map((actionName) => {
1737
+ return `${actionName}: typeof Actions.${actionName}`;
1738
+ }).join(",\n")}
1739
+ },
1740
+ queries: {
1741
+ // TODO
1742
+ },
1743
+ interfaces: {
1744
+ ${interfaceNames.map((objectName) => {
1745
+ return `${objectName}: Interfaces.${objectName}`;
1746
+ }).join(",\n")}
1747
+ }
1748
+ }
1749
+
1750
+ export const Ontology: Ontology = {
1730
1751
  metadata: OntologyMetadata,
1731
1752
  objects: {
1732
1753
  ${objectNames.map((objectName) => {
@@ -1748,11 +1769,8 @@ async function generateClientSdkVersionTwoPointZero(ontology, userAgent, fs2, ou
1748
1769
  }).join(",\n")}
1749
1770
 
1750
1771
  }
1751
- } satisfies OntologyDefinition<${stringUnionFrom2(objectNames)}>;
1772
+ };
1752
1773
 
1753
- type _Ontology = typeof _Ontology;
1754
- export interface Ontology extends _Ontology {}
1755
- export const Ontology = _Ontology as Ontology;
1756
1774
  `));
1757
1775
  await fs2.mkdir(path16__namespace.default.join(outDir, "ontology", "objects"), {
1758
1776
  recursive: true
@@ -1761,7 +1779,7 @@ async function generateClientSdkVersionTwoPointZero(ontology, userAgent, fs2, ou
1761
1779
  const obj = ontology.objectTypes[name];
1762
1780
  await fs2.writeFile(path16__namespace.default.join(outDir, "ontology", `objects`, `${name}.ts`), await formatTs(`
1763
1781
  import type { ObjectTypeDefinition, VersionBound, ObjectTypeLinkDefinition, PropertyDef } from "@osdk/api";
1764
- import { Osdk } from "@osdk/client";
1782
+ import { Osdk } from "@osdk/client.api";
1765
1783
  import { $osdkMetadata } from "../../OntologyMetadata${importExt}";
1766
1784
  import type { $ExpectedClientVersion } from "../../OntologyMetadata${importExt}";
1767
1785
 
@@ -1810,8 +1828,7 @@ async function generateOntologyInterfaces(fs2, outDir, interfaceNames, ontology,
1810
1828
 
1811
1829
  // src/generateClientSdkPackage.ts
1812
1830
  async function generateClientSdkPackage(packageName, packageVersion, sdkVersion, baseOutDir, ontology, minimalFs, dependencyVersions, cliVersion) {
1813
- if (!packageName)
1814
- throw new Error("Package name is require");
1831
+ if (!packageName) throw new Error("Package name is require");
1815
1832
  for (const packageType of ["module", "commonjs"]) {
1816
1833
  const outDir = path16__namespace.join(baseOutDir, "dist", packageType);
1817
1834
  await (sdkVersion === "1.1" ? generateClientSdkVersionOneDotOne : sdkVersion === "2.0" ? generateClientSdkVersionTwoPointZero : void 0)(ontology, `typescript-sdk/${packageVersion} osdk-cli/${cliVersion}`, minimalFs, outDir, packageType);
@@ -1853,14 +1870,52 @@ function getTsCompilerOptions(packageType) {
1853
1870
  };
1854
1871
  return compilerOptions;
1855
1872
  }
1856
- function getPackageJsonContents(name, version, sdkVersion, {
1857
- typescriptVersion,
1858
- tslibVersion,
1859
- areTheTypesWrongVersion,
1873
+ function getExpectedDependencies(sdkVersion, {
1860
1874
  osdkApiVersion,
1861
1875
  osdkClientVersion,
1876
+ osdkClientApiVersion,
1862
1877
  osdkLegacyClientVersion
1863
1878
  }) {
1879
+ return {
1880
+ devDependencies: {
1881
+ "@osdk/api": osdkApiVersion,
1882
+ ...sdkVersion === "2.0" ? {
1883
+ "@osdk/client.api": osdkClientApiVersion
1884
+ } : {
1885
+ "@osdk/legacy-client": osdkLegacyClientVersion
1886
+ }
1887
+ },
1888
+ peerDependencies: {
1889
+ "@osdk/api": osdkApiVersion,
1890
+ ...sdkVersion === "2.0" ? {
1891
+ "@osdk/client.api": osdkClientApiVersion,
1892
+ "@osdk/client": osdkClientVersion
1893
+ } : {
1894
+ "@osdk/legacy-client": osdkLegacyClientVersion
1895
+ }
1896
+ }
1897
+ };
1898
+ }
1899
+ function getExpectedDependenciesFull(sdkVersion, dependencyVersions) {
1900
+ const {
1901
+ typescriptVersion,
1902
+ tslibVersion,
1903
+ areTheTypesWrongVersion
1904
+ } = dependencyVersions;
1905
+ const base = getExpectedDependencies(sdkVersion, dependencyVersions);
1906
+ return {
1907
+ devDependencies: {
1908
+ ...base.devDependencies,
1909
+ "typescript": typescriptVersion,
1910
+ "tslib": tslibVersion,
1911
+ "@arethetypeswrong/cli": areTheTypesWrongVersion
1912
+ },
1913
+ peerDependencies: {
1914
+ ...base.peerDependencies
1915
+ }
1916
+ };
1917
+ }
1918
+ function getPackageJsonContents(name, version, sdkVersion, dependencyVersions) {
1864
1919
  const esmPrefix = "./dist/module";
1865
1920
  const commonjsPrefix = "./dist/commonjs";
1866
1921
  return {
@@ -1882,25 +1937,7 @@ function getPackageJsonContents(name, version, sdkVersion, {
1882
1937
  prepack: `tsc -p ${esmPrefix}/tsconfig.json && tsc -p ${commonjsPrefix}/tsconfig.json`,
1883
1938
  check: "npm exec attw $(npm pack)"
1884
1939
  },
1885
- devDependencies: {
1886
- "typescript": typescriptVersion,
1887
- "tslib": tslibVersion,
1888
- "@arethetypeswrong/cli": areTheTypesWrongVersion,
1889
- "@osdk/api": osdkApiVersion,
1890
- ...sdkVersion === "2.0" ? {
1891
- "@osdk/client": osdkClientVersion
1892
- } : {
1893
- "@osdk/legacy-client": osdkLegacyClientVersion
1894
- }
1895
- },
1896
- peerDependencies: {
1897
- "@osdk/api": osdkApiVersion,
1898
- ...sdkVersion === "2.0" ? {
1899
- "@osdk/client": osdkClientVersion
1900
- } : {
1901
- "@osdk/legacy-client": osdkLegacyClientVersion
1902
- }
1903
- },
1940
+ ...getExpectedDependenciesFull(sdkVersion, dependencyVersions),
1904
1941
  files: ["**/*.js", "**/*.d.ts", "dist/**/package.json"]
1905
1942
  };
1906
1943
  }
@@ -1911,5 +1948,6 @@ async function writeJson(minimalFs, filePath, body) {
1911
1948
  exports.__UNSTABLE_generateClientSdkPackage = generateClientSdkPackage;
1912
1949
  exports.generateClientSdkVersionOneDotOne = generateClientSdkVersionOneDotOne;
1913
1950
  exports.generateClientSdkVersionTwoPointZero = generateClientSdkVersionTwoPointZero;
1951
+ exports.getExpectedDependencies = getExpectedDependencies;
1914
1952
  //# sourceMappingURL=out.js.map
1915
1953
  //# sourceMappingURL=index.cjs.map