@osdk/generator 2.1.0-beta.6 → 2.1.0-beta.8
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 +26 -0
- package/build/browser/GenerateContext/GenerateContext.d.ts +1 -0
- package/build/browser/GenerateContext/GenerateContext.d.ts.map +1 -1
- package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js +4 -4
- package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js.map +1 -1
- package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js +3 -3
- package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js.map +1 -1
- package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.d.ts +1 -1
- package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.d.ts.map +1 -1
- package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.js +3 -2
- package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.js.map +1 -1
- package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.test.js +25 -30
- package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.test.js.map +1 -1
- package/build/browser/v2.0/generatePerActionDataFiles.d.ts +1 -1
- package/build/browser/v2.0/generatePerActionDataFiles.d.ts.map +1 -1
- package/build/browser/v2.0/generatePerActionDataFiles.js +3 -2
- package/build/browser/v2.0/generatePerActionDataFiles.js.map +1 -1
- package/build/browser/v2.0/generatePerInterfaceDataFiles.js +4 -3
- package/build/browser/v2.0/generatePerInterfaceDataFiles.js.map +1 -1
- package/build/browser/v2.0/generatePerObjectDataFiles.d.ts.map +1 -1
- package/build/browser/v2.0/generatePerObjectDataFiles.js +1 -1
- package/build/browser/v2.0/generatePerObjectDataFiles.js.map +1 -1
- package/build/browser/v2.0/generatePerQueryDataFiles.d.ts +1 -1
- package/build/browser/v2.0/generatePerQueryDataFiles.d.ts.map +1 -1
- package/build/browser/v2.0/generatePerQueryDataFiles.js +5 -5
- package/build/browser/v2.0/generatePerQueryDataFiles.js.map +1 -1
- package/build/browser/v2.0/generatePerQueryDataFiles.test.js +7 -8
- package/build/browser/v2.0/generatePerQueryDataFiles.test.js.map +1 -1
- package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.d.ts.map +1 -1
- package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js +6 -5
- package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js.map +1 -1
- package/build/esm/GenerateContext/GenerateContext.d.ts +1 -0
- package/build/esm/GenerateContext/GenerateContext.d.ts.map +1 -1
- package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js +4 -4
- package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js.map +1 -1
- package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js +3 -3
- package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js.map +1 -1
- package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.d.ts +1 -1
- package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.d.ts.map +1 -1
- package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.js +3 -2
- package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.js.map +1 -1
- package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.test.js +25 -30
- package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.test.js.map +1 -1
- package/build/esm/v2.0/generatePerActionDataFiles.d.ts +1 -1
- package/build/esm/v2.0/generatePerActionDataFiles.d.ts.map +1 -1
- package/build/esm/v2.0/generatePerActionDataFiles.js +3 -2
- package/build/esm/v2.0/generatePerActionDataFiles.js.map +1 -1
- package/build/esm/v2.0/generatePerInterfaceDataFiles.js +4 -3
- package/build/esm/v2.0/generatePerInterfaceDataFiles.js.map +1 -1
- package/build/esm/v2.0/generatePerObjectDataFiles.d.ts.map +1 -1
- package/build/esm/v2.0/generatePerObjectDataFiles.js +1 -1
- package/build/esm/v2.0/generatePerObjectDataFiles.js.map +1 -1
- package/build/esm/v2.0/generatePerQueryDataFiles.d.ts +1 -1
- package/build/esm/v2.0/generatePerQueryDataFiles.d.ts.map +1 -1
- package/build/esm/v2.0/generatePerQueryDataFiles.js +5 -5
- package/build/esm/v2.0/generatePerQueryDataFiles.js.map +1 -1
- package/build/esm/v2.0/generatePerQueryDataFiles.test.js +7 -8
- package/build/esm/v2.0/generatePerQueryDataFiles.test.js.map +1 -1
- package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.d.ts.map +1 -1
- package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js +6 -5
- package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @osdk/generator
|
|
2
2
|
|
|
3
|
+
## 2.1.0-beta.8
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 71dfb4c: Now export all api shapes from client, so use that dependency instead.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [9f3807c]
|
|
12
|
+
- @osdk/api@2.1.0-beta.8
|
|
13
|
+
- @osdk/generator-converters@2.1.0-beta.8
|
|
14
|
+
|
|
15
|
+
## 2.1.0-beta.7
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- 9018dc2: Updating platform api dependencies.
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Updated dependencies [27866a8]
|
|
24
|
+
- Updated dependencies [9018dc2]
|
|
25
|
+
- Updated dependencies [31e7d70]
|
|
26
|
+
- @osdk/api@2.1.0-beta.7
|
|
27
|
+
- @osdk/generator-converters@2.1.0-beta.7
|
|
28
|
+
|
|
3
29
|
## 2.1.0-beta.6
|
|
4
30
|
|
|
5
31
|
### Minor Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenerateContext.d.ts","sourceRoot":"","sources":["../../../src/GenerateContext/GenerateContext.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAC3E,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAElF,MAAM,WAAW,eAAe;IAC9B,iBAAiB,EAAE,sBAAsB,CAAC;IAC1C,QAAQ,EAAE,0BAA0B,CAAC;IAErC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,EAAE,EAAE,SAAS,CAAC;IAEd,MAAM,EAAE,MAAM,CAAC;IAEf,oBAAoB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1C,sBAAsB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"GenerateContext.d.ts","sourceRoot":"","sources":["../../../src/GenerateContext/GenerateContext.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAC3E,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAElF,MAAM,WAAW,eAAe;IAC9B,iBAAiB,EAAE,sBAAsB,CAAC;IAC1C,QAAQ,EAAE,0BAA0B,CAAC;IAErC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,EAAE,EAAE,SAAS,CAAC;IAEd,MAAM,EAAE,MAAM,CAAC;IAEf,oBAAoB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1C,sBAAsB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7C,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B"}
|
|
@@ -22,7 +22,7 @@ import { deleteUndefineds } from "../util/deleteUndefineds.js";
|
|
|
22
22
|
import { stringify } from "../util/stringify.js";
|
|
23
23
|
import { createDefinition, createObjectSet, createOsdkObject, createPropertyKeys, createProps } from "./wireObjectTypeV2ToSdkObjectConstV2.js";
|
|
24
24
|
/** @internal */
|
|
25
|
-
export function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(interfaceDef, ontology, v2 = false) {
|
|
25
|
+
export function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(interfaceDef, ontology, v2 = false, forInternalUse = false) {
|
|
26
26
|
const definition = deleteUndefineds(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(interfaceDef.raw, v2));
|
|
27
27
|
const objectDefIdentifier = interfaceDef.getDefinitionIdentifier(v2);
|
|
28
28
|
const parents = definition.implements?.map(p => {
|
|
@@ -78,13 +78,13 @@ export function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(interfaceDef, ont
|
|
|
78
78
|
// if we want links to work
|
|
79
79
|
|
|
80
80
|
return `${[].join("\n")}
|
|
81
|
-
${v2 ? function () {
|
|
81
|
+
${v2 ? function (forInternalUse = false) {
|
|
82
82
|
return `import type {
|
|
83
83
|
InterfaceDefinition as $InterfaceDefinition,
|
|
84
84
|
ObjectSet as $ObjectSet,
|
|
85
85
|
Osdk as $Osdk,
|
|
86
86
|
PropertyValueWireToClient as $PropType,
|
|
87
|
-
} from "@osdk/api";
|
|
87
|
+
} from "${forInternalUse ? "@osdk/api" : "@osdk/client"}";
|
|
88
88
|
|
|
89
89
|
${Object.keys(definition.links).length === 0 ? `export type ${osdkObjectLinksIdentifier} = {};` : `
|
|
90
90
|
export interface ${osdkObjectLinksIdentifier} {
|
|
@@ -116,7 +116,7 @@ ${stringify(definition.links, {
|
|
|
116
116
|
${createDefinition(interfaceDef, ontology, interfaceDef.shortApiName, ids)}
|
|
117
117
|
|
|
118
118
|
`;
|
|
119
|
-
}() : ""}
|
|
119
|
+
}(forInternalUse) : ""}
|
|
120
120
|
|
|
121
121
|
export const ${interfaceDef.shortApiName}: ${interfaceDef.shortApiName} = {
|
|
122
122
|
type: "interface",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js","names":["__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition","fastDeepEqual","invariant","extractNamespace","EnhancedInterfaceType","deleteUndefineds","stringify","createDefinition","createObjectSet","createOsdkObject","createPropertyKeys","createProps","__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst","interfaceDef","ontology","v2","definition","raw","objectDefIdentifier","getDefinitionIdentifier","parents","implements","map","p","parent","requireInterfaceType","it","mergedProperties","properties","apiName","Object","keys","process","env","NODE_ENV","objectSetIdentifier","shortApiName","propertyKeysIdentifier","osdkObjectPropsIdentifier","osdkObjectStrictPropsIdentifier","osdkObjectLinksIdentifier","osdkObjectIdentifier","ids","apiNamespace","badProperties","filter","length","Error","fullApiName","join","links","linkTarget","requireObjectType","targetType","getImportedDefinitionIdentifier","multiplicity"],"sources":["UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition } from \"@osdk/generator-converters\";\nimport fastDeepEqual from \"fast-deep-equal\";\nimport invariant from \"tiny-invariant\";\nimport { extractNamespace } from \"../GenerateContext/EnhancedBase.js\";\nimport { EnhancedInterfaceType } from \"../GenerateContext/EnhancedInterfaceType.js\";\nimport { deleteUndefineds } from \"../util/deleteUndefineds.js\";\nimport { stringify } from \"../util/stringify.js\";\nimport { createDefinition, createObjectSet, createOsdkObject, createPropertyKeys, createProps, } from \"./wireObjectTypeV2ToSdkObjectConstV2.js\";\n/** @internal */\nexport function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(interfaceDef, ontology, v2 = false) {\n const definition = deleteUndefineds(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(interfaceDef.raw, v2));\n const objectDefIdentifier = interfaceDef.getDefinitionIdentifier(v2);\n const parents = definition.implements?.map(p => {\n const parent = ontology.requireInterfaceType(p, true);\n if (parent instanceof EnhancedInterfaceType) {\n const it = deleteUndefineds(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(parent.raw, v2));\n return it;\n }\n }) ?? [];\n const mergedProperties = { ...definition.properties };\n for (const parent of parents) {\n if (parent == null) {\n // came from a foreign type and we cannot merge properties yet\n // so if they weren't listed on the interface its over\n continue;\n }\n for (const apiName of Object.keys(parent.properties)) {\n if (definition.properties[apiName] != null) {\n invariant(fastDeepEqual(definition.properties[apiName], parent.properties[apiName]), `Interface ${definition.apiName} redefines property '${apiName}' from parent '${parent.apiName}' but the properties do not match`);\n }\n else if (mergedProperties[apiName] != null) {\n invariant(fastDeepEqual(mergedProperties[apiName], parent.properties[apiName]), `Some interface defines a conflicting property '${apiName}' that does not match property from parent '${parent.apiName}'`);\n }\n mergedProperties[apiName] = parent.properties[apiName];\n }\n }\n definition.properties = mergedProperties;\n const objectSetIdentifier = `${interfaceDef.shortApiName}.ObjectSet`;\n const propertyKeysIdentifier = `${interfaceDef.shortApiName}.PropertyKeys`;\n // const osdkObjectPropsIdentifier = `OsdkObjectProps$${objectDefIdentifier}`;\n const osdkObjectPropsIdentifier = `${interfaceDef.shortApiName}.Props`;\n const osdkObjectStrictPropsIdentifier = `${interfaceDef.shortApiName}.StrictProps`;\n const osdkObjectLinksIdentifier = `OsdkObjectLinks$${objectDefIdentifier}`;\n const osdkObjectIdentifier = `${interfaceDef.shortApiName}.OsdkObject`;\n const ids = {\n objectDefIdentifier: interfaceDef.shortApiName,\n osdkObjectLinksIdentifier,\n osdkObjectPropsIdentifier,\n osdkObjectStrictPropsIdentifier,\n objectSetIdentifier,\n osdkObjectIdentifier,\n propertyKeysIdentifier,\n };\n if (interfaceDef.apiNamespace) {\n const badProperties = Object.keys(definition.properties).filter(apiName => extractNamespace(apiName)[0] == null);\n if (badProperties.length > 0) {\n throw new Error(`Interfaces with fully qualified api names MUST NOT have any properties with an unqualified api name. Interface: ${interfaceDef.fullApiName}, properties: ${badProperties.join(\", \")}`);\n }\n }\n function getV2Types() {\n return `import type {\n InterfaceDefinition as $InterfaceDefinition,\n ObjectSet as $ObjectSet, \n Osdk as $Osdk,\n PropertyValueWireToClient as $PropType,\n } from \"@osdk/api\";\n \n ${Object.keys(definition.links).length === 0\n ? `export type ${osdkObjectLinksIdentifier} = {};`\n : `\n export interface ${osdkObjectLinksIdentifier} {\n${stringify(definition.links, {\n \"*\": (definition) => {\n const linkTarget = ontology.requireObjectType(definition.targetType)\n .getImportedDefinitionIdentifier(v2);\n return `${definition.multiplicity\n ? `${linkTarget}[\"objectSet\"]`\n : `SingleLinkAccessor<${linkTarget}>`}\n `;\n },\n })}\n }\n `}\n\n export namespace ${interfaceDef.shortApiName} {\n\n ${createPropertyKeys(interfaceDef)}\n\n\n ${createProps(interfaceDef, \"Props\", false)}\n ${createProps(interfaceDef, \"StrictProps\", true)}\n\n\n ${createObjectSet(interfaceDef, ids)}\n\n ${createOsdkObject(interfaceDef, \"OsdkInstance\", ids)}\n \n } \n\n ${createDefinition(interfaceDef, ontology, interfaceDef.shortApiName, ids)}\n\n`;\n }\n // FIXME: We need to fill in the imports\n // if we want links to work\n const imports = [];\n definition;\n return `${imports.join(\"\\n\")}\n ${v2 ? getV2Types() : \"\"}\n\n export const ${interfaceDef.shortApiName}: ${interfaceDef.shortApiName} = {\n type: \"interface\",\n apiName: \"${interfaceDef.fullApiName}\",\n osdkMetadata: $osdkMetadata,\n };`;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,mDAAmD,QAAQ,4BAA4B;AAChG,OAAOC,aAAa,MAAM,iBAAiB;AAC3C,OAAOC,SAAS,MAAM,gBAAgB;AACtC,SAASC,gBAAgB,QAAQ,oCAAoC;AACrE,SAASC,qBAAqB,QAAQ,6CAA6C;AACnF,SAASC,gBAAgB,QAAQ,6BAA6B;AAC9D,SAASC,SAAS,QAAQ,sBAAsB;AAChD,SAASC,gBAAgB,EAAEC,eAAe,EAAEC,gBAAgB,EAAEC,kBAAkB,EAAEC,WAAW,QAAS,yCAAyC;AAC/I;AACA,OAAO,SAASC,8CAA8CA,CAACC,YAAY,EAAEC,QAAQ,EAAEC,EAAE,GAAG,KAAK,EAAE;EAC/F,MAAMC,UAAU,GAAGX,gBAAgB,CAACL,mDAAmD,CAACa,YAAY,CAACI,GAAG,EAAEF,EAAE,CAAC,CAAC;EAC9G,MAAMG,mBAAmB,GAAGL,YAAY,CAACM,uBAAuB,CAACJ,EAAE,CAAC;EACpE,MAAMK,OAAO,GAAGJ,UAAU,CAACK,UAAU,EAAEC,GAAG,CAACC,CAAC,IAAI;IAC5C,MAAMC,MAAM,GAAGV,QAAQ,CAACW,oBAAoB,CAACF,CAAC,EAAE,IAAI,CAAC;IACrD,IAAIC,MAAM,YAAYpB,qBAAqB,EAAE;MACzC,MAAMsB,EAAE,GAAGrB,gBAAgB,CAACL,mDAAmD,CAACwB,MAAM,CAACP,GAAG,EAAEF,EAAE,CAAC,CAAC;MAChG,OAAOW,EAAE;IACb;EACJ,CAAC,CAAC,IAAI,EAAE;EACR,MAAMC,gBAAgB,GAAG;IAAE,GAAGX,UA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GAAGJ,UAAU,eAAe,GAC5B,sBAAsBA,UAAU,GAAG;AAC7D,WAAW;MACK;IACJ,CAAC,CAAC;AACd;AACA,KAAK;AACL;AACA,uBAAuBtC,YAAY,CAACuB,YAAY;AAChD;AACA,QAAQ1B,kBAAkB,CAACG,YAAY,CAAC;AACxC;AACA;AACA,QAAQF,WAAW,CAACE,YAAY,EAAE,OAAO,EAAE,KAAK,CAAC;AACjD,QAAQF,WAAW,CAACE,YAAY,EAAE,aAAa,EAAE,IAAI,CAAC;AACtD;AACA;AACA,QAAQL,eAAe,CAACK,YAAY,EAAE6B,GAAG,CAAC;AAC1C;AACA,QAAQjC,gBAAgB,CAACI,YAAY,EAAE,cAAc,EAAE6B,GAAG,CAAC;AAC3D;AACA;AACA;AACA,MAAMnC,gBAAgB,CAACM,YAAY,EAAEC,QAAQ,EAAED,YAAY,CAACuB,YAAY,EAAEM,GAAG,CAAC;AAC9E;AACA,CAAC;EACG,CAAC,CAMiB,CAAC,GAAG,EAAE;AAC5B;AACA,mBAAmB7B,YAAY,CAACuB,YAAY,KAAKvB,YAAY,CAACuB,YAAY;AAC1E;AACA,kBAAkBvB,YAAY,CAACmC,WAAW;AAC1C;AACA,UAAU;AACV","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js","names":["__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition","fastDeepEqual","invariant","extractNamespace","EnhancedInterfaceType","deleteUndefineds","stringify","createDefinition","createObjectSet","createOsdkObject","createPropertyKeys","createProps","__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst","interfaceDef","ontology","v2","forInternalUse","definition","raw","objectDefIdentifier","getDefinitionIdentifier","parents","implements","map","p","parent","requireInterfaceType","it","mergedProperties","properties","apiName","Object","keys","process","env","NODE_ENV","objectSetIdentifier","shortApiName","propertyKeysIdentifier","osdkObjectPropsIdentifier","osdkObjectStrictPropsIdentifier","osdkObjectLinksIdentifier","osdkObjectIdentifier","ids","apiNamespace","badProperties","filter","length","Error","fullApiName","join","links","linkTarget","requireObjectType","targetType","getImportedDefinitionIdentifier","multiplicity"],"sources":["UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition } from \"@osdk/generator-converters\";\nimport fastDeepEqual from \"fast-deep-equal\";\nimport invariant from \"tiny-invariant\";\nimport { extractNamespace } from \"../GenerateContext/EnhancedBase.js\";\nimport { EnhancedInterfaceType } from \"../GenerateContext/EnhancedInterfaceType.js\";\nimport { deleteUndefineds } from \"../util/deleteUndefineds.js\";\nimport { stringify } from \"../util/stringify.js\";\nimport { createDefinition, createObjectSet, createOsdkObject, createPropertyKeys, createProps, } from \"./wireObjectTypeV2ToSdkObjectConstV2.js\";\n/** @internal */\nexport function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(interfaceDef, ontology, v2 = false, forInternalUse = false) {\n const definition = deleteUndefineds(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(interfaceDef.raw, v2));\n const objectDefIdentifier = interfaceDef.getDefinitionIdentifier(v2);\n const parents = definition.implements?.map(p => {\n const parent = ontology.requireInterfaceType(p, true);\n if (parent instanceof EnhancedInterfaceType) {\n const it = deleteUndefineds(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(parent.raw, v2));\n return it;\n }\n }) ?? [];\n const mergedProperties = { ...definition.properties };\n for (const parent of parents) {\n if (parent == null) {\n // came from a foreign type and we cannot merge properties yet\n // so if they weren't listed on the interface its over\n continue;\n }\n for (const apiName of Object.keys(parent.properties)) {\n if (definition.properties[apiName] != null) {\n invariant(fastDeepEqual(definition.properties[apiName], parent.properties[apiName]), `Interface ${definition.apiName} redefines property '${apiName}' from parent '${parent.apiName}' but the properties do not match`);\n }\n else if (mergedProperties[apiName] != null) {\n invariant(fastDeepEqual(mergedProperties[apiName], parent.properties[apiName]), `Some interface defines a conflicting property '${apiName}' that does not match property from parent '${parent.apiName}'`);\n }\n mergedProperties[apiName] = parent.properties[apiName];\n }\n }\n definition.properties = mergedProperties;\n const objectSetIdentifier = `${interfaceDef.shortApiName}.ObjectSet`;\n const propertyKeysIdentifier = `${interfaceDef.shortApiName}.PropertyKeys`;\n // const osdkObjectPropsIdentifier = `OsdkObjectProps$${objectDefIdentifier}`;\n const osdkObjectPropsIdentifier = `${interfaceDef.shortApiName}.Props`;\n const osdkObjectStrictPropsIdentifier = `${interfaceDef.shortApiName}.StrictProps`;\n const osdkObjectLinksIdentifier = `OsdkObjectLinks$${objectDefIdentifier}`;\n const osdkObjectIdentifier = `${interfaceDef.shortApiName}.OsdkObject`;\n const ids = {\n objectDefIdentifier: interfaceDef.shortApiName,\n osdkObjectLinksIdentifier,\n osdkObjectPropsIdentifier,\n osdkObjectStrictPropsIdentifier,\n objectSetIdentifier,\n osdkObjectIdentifier,\n propertyKeysIdentifier,\n };\n if (interfaceDef.apiNamespace) {\n const badProperties = Object.keys(definition.properties).filter(apiName => extractNamespace(apiName)[0] == null);\n if (badProperties.length > 0) {\n throw new Error(`Interfaces with fully qualified api names MUST NOT have any properties with an unqualified api name. Interface: ${interfaceDef.fullApiName}, properties: ${badProperties.join(\", \")}`);\n }\n }\n function getV2Types(forInternalUse = false) {\n return `import type {\n InterfaceDefinition as $InterfaceDefinition,\n ObjectSet as $ObjectSet, \n Osdk as $Osdk,\n PropertyValueWireToClient as $PropType,\n } from \"${forInternalUse ? \"@osdk/api\" : \"@osdk/client\"}\";\n \n ${Object.keys(definition.links).length === 0\n ? `export type ${osdkObjectLinksIdentifier} = {};`\n : `\n export interface ${osdkObjectLinksIdentifier} {\n${stringify(definition.links, {\n \"*\": (definition) => {\n const linkTarget = ontology.requireObjectType(definition.targetType)\n .getImportedDefinitionIdentifier(v2);\n return `${definition.multiplicity\n ? `${linkTarget}[\"objectSet\"]`\n : `SingleLinkAccessor<${linkTarget}>`}\n `;\n },\n })}\n }\n `}\n\n export namespace ${interfaceDef.shortApiName} {\n\n ${createPropertyKeys(interfaceDef)}\n\n\n ${createProps(interfaceDef, \"Props\", false)}\n ${createProps(interfaceDef, \"StrictProps\", true)}\n\n\n ${createObjectSet(interfaceDef, ids)}\n\n ${createOsdkObject(interfaceDef, \"OsdkInstance\", ids)}\n \n } \n\n ${createDefinition(interfaceDef, ontology, interfaceDef.shortApiName, ids)}\n\n`;\n }\n // FIXME: We need to fill in the imports\n // if we want links to work\n const imports = [];\n definition;\n return `${imports.join(\"\\n\")}\n ${v2 ? getV2Types(forInternalUse) : \"\"}\n\n export const ${interfaceDef.shortApiName}: ${interfaceDef.shortApiName} = {\n type: \"interface\",\n apiName: \"${interfaceDef.fullApiName}\",\n osdkMetadata: $osdkMetadata,\n };`;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,mDAAmD,QAAQ,4BAA4B;AAChG,OAAOC,aAAa,MAAM,iBAAiB;AAC3C,OAAOC,SAAS,MAAM,gBAAgB;AACtC,SAASC,gBAAgB,QAAQ,oCAAoC;AACrE,SAASC,qBAAqB,QAAQ,6CAA6C;AACnF,SAASC,gBAAgB,QAAQ,6BAA6B;AAC9D,SAASC,SAAS,QAAQ,sBAAsB;AAChD,SAASC,gBAAgB,EAAEC,eAAe,EAAEC,gBAAgB,EAAEC,kBAAkB,EAAEC,WAAW,QAAS,yCAAyC;AAC/I;AACA,OAAO,SAASC,8CAA8CA,CAACC,YA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,YAAY,CAACwB,YAAY,EAAEM,GAAG,CAAC;AAC9E;AACA,CAAC;EACG,CAAC,CAMiB3B,cAAc,CAAC,GAAG,EAAE;AAC1C;AACA,mBAAmBH,YAAY,CAACwB,YAAY,KAAKxB,YAAY,CAACwB,YAAY;AAC1E;AACA,kBAAkBxB,YAAY,CAACoC,WAAW;AAC1C;AACA,UAAU;AACV","ignoreList":[]}
|
|
@@ -70,7 +70,7 @@ describe(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst, () => {
|
|
|
70
70
|
if (ontology.interfaceTypes.Bar instanceof ForeignType) {
|
|
71
71
|
throw new Error("Expected Bar to be an EnhancedInterfaceType");
|
|
72
72
|
}
|
|
73
|
-
const formattedCode = await format(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(ontology.interfaceTypes.Bar, ontology, true), {
|
|
73
|
+
const formattedCode = await format(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(ontology.interfaceTypes.Bar, ontology, true, true), {
|
|
74
74
|
parser: "typescript",
|
|
75
75
|
printWidth: 100
|
|
76
76
|
});
|
|
@@ -145,7 +145,7 @@ describe(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst, () => {
|
|
|
145
145
|
sanitized: simpleOntology("ontology", [simpleInterface("Foo", [fooSpt], ["Parent"]), simpleInterface("Parent", [barSpt], [])]),
|
|
146
146
|
importExt: ""
|
|
147
147
|
});
|
|
148
|
-
const formattedCode = await format(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(ontology.interfaceTypes.Foo, ontology, true), {
|
|
148
|
+
const formattedCode = await format(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(ontology.interfaceTypes.Foo, ontology, true, true), {
|
|
149
149
|
parser: "typescript"
|
|
150
150
|
});
|
|
151
151
|
expect(formattedCode).toMatchInlineSnapshot(`
|
|
@@ -221,7 +221,7 @@ describe(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst, () => {
|
|
|
221
221
|
sanitized: simpleOntology("ontology", [simpleInterface("Foo", [fooSpt, barSpt], ["Parent"]), simpleInterface("Parent", [barSpt], [])]),
|
|
222
222
|
importExt: ""
|
|
223
223
|
});
|
|
224
|
-
const formattedCode = await format(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(ontology.interfaceTypes.Foo, ontology, true), {
|
|
224
|
+
const formattedCode = await format(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(ontology.interfaceTypes.Foo, ontology, true, true), {
|
|
225
225
|
parser: "typescript"
|
|
226
226
|
});
|
|
227
227
|
expect(formattedCode).toMatchInlineSnapshot(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js","names":["format","describe","expect","it","EnhancedInterfaceType","enhanceOntology","ForeignType","__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst","simpleSpt","apiName","metadataLevel","dataType","type","rid","displayName","description","undefined","simpleInterface","spts","parents","properties","Object","fromEntries","map","spt","extendsInterfaces","links","simpleOntology","interfaces","interfaceTypes","i","sharedPropertyTypes","flatMap","entries","actionTypes","objectTypes","ontology","queryTypes","sanitized","importExt","Bar","toBe","Error","formattedCode","parser","printWidth","toMatchInlineSnapshot","fooSpt","barSpt","Foo"],"sources":["UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { format } from \"prettier\";\nimport { describe, expect, it } from \"vitest\";\nimport { EnhancedInterfaceType } from \"../GenerateContext/EnhancedInterfaceType.js\";\nimport { enhanceOntology } from \"../GenerateContext/enhanceOntology.js\";\nimport { ForeignType } from \"../GenerateContext/ForeignType.js\";\nimport { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst } from \"./UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js\";\nfunction simpleSpt(apiName, metadataLevel = 2) {\n return {\n apiName,\n dataType: {\n type: \"integer\",\n },\n rid: `${apiName}Rid`,\n displayName: metadataLevel >= 1 ? `${apiName} property dn` : apiName,\n description: metadataLevel >= 2 ? `${apiName} property desc` : undefined,\n };\n}\nfunction simpleInterface(apiName, spts, parents, metadataLevel = 2) {\n const properties = Object.fromEntries(spts.map(spt => [spt.apiName, spt]));\n return {\n apiName,\n rid: `${apiName}Rid`,\n displayName: metadataLevel >= 1 ? `${apiName} interface dn` : apiName,\n description: metadataLevel >= 2 ? `${apiName} interface desc` : undefined,\n extendsInterfaces: parents,\n links: {},\n properties,\n };\n}\nfunction simpleOntology(apiName, interfaces) {\n const interfaceTypes = Object\n .fromEntries(interfaces.map(i => [i.apiName, i]));\n const sharedPropertyTypes = Object\n .fromEntries(interfaces.flatMap(i => Object.entries(i.properties)));\n return {\n actionTypes: {},\n interfaceTypes,\n objectTypes: {},\n ontology: {\n apiName,\n description: `${apiName} ontology desc`,\n displayName: `${apiName} ontology dn`,\n rid: `${apiName} ontology rid`,\n },\n queryTypes: {},\n sharedPropertyTypes,\n };\n}\ndescribe(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst, () => {\n it(\"Does not say (inherited) on properties locally defined\", async () => {\n const ontology = enhanceOntology({\n sanitized: simpleOntology(\"ontology\", [\n simpleInterface(\"Bar\", [simpleSpt(\"bar\", 0)], [], 0),\n ]),\n importExt: \"\",\n });\n expect(ontology.interfaceTypes.Bar instanceof EnhancedInterfaceType).toBe(true);\n // type guard for below\n if (ontology.interfaceTypes.Bar instanceof ForeignType) {\n throw new Error(\"Expected Bar to be an EnhancedInterfaceType\");\n }\n const formattedCode = await format(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(ontology.interfaceTypes.Bar, ontology, true), {\n parser: \"typescript\",\n printWidth: 100,\n });\n expect(formattedCode).toMatchInlineSnapshot(`\n \"import type {\n InterfaceDefinition as $InterfaceDefinition,\n ObjectSet as $ObjectSet,\n Osdk as $Osdk,\n PropertyValueWireToClient as $PropType,\n } from \"@osdk/api\";\n\n export type OsdkObjectLinks$Bar = {};\n\n export namespace Bar {\n export type PropertyKeys = \"bar\";\n\n export interface Props {\n readonly bar: $PropType[\"integer\"] | undefined;\n }\n export type StrictProps = Props;\n\n export interface ObjectSet extends $ObjectSet<Bar, Bar.ObjectSet> {}\n\n export type OsdkInstance<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Bar.Props = keyof Bar.Props,\n > = $Osdk.Instance<Bar, OPTIONS, K>;\n\n /** @deprecated use OsdkInstance */\n export type OsdkObject<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Bar.Props = keyof Bar.Props,\n > = OsdkInstance<OPTIONS, K>;\n }\n\n export interface Bar extends $InterfaceDefinition {\n osdkMetadata: typeof $osdkMetadata;\n type: \"interface\";\n apiName: \"Bar\";\n __DefinitionMetadata?: {\n objectSet: Bar.ObjectSet;\n props: Bar.Props;\n linksType: OsdkObjectLinks$Bar;\n strictProps: Bar.StrictProps;\n apiName: \"Bar\";\n displayName: \"Bar\";\n implements: [];\n links: {};\n properties: {\n /**\n * (no ontology metadata)\n */\n bar: $PropertyDef<\"integer\", \"nullable\", \"single\">;\n };\n rid: \"BarRid\";\n type: \"interface\";\n };\n }\n\n export const Bar: Bar = {\n type: \"interface\",\n apiName: \"Bar\",\n osdkMetadata: $osdkMetadata,\n };\n \"\n `);\n });\n it(\"Generates properties for inherited SPTs\", async () => {\n const fooSpt = simpleSpt(\"foo\");\n const barSpt = simpleSpt(\"bar\");\n const ontology = enhanceOntology({\n sanitized: simpleOntology(\"ontology\", [\n simpleInterface(\"Foo\", [fooSpt], [\"Parent\"]),\n simpleInterface(\"Parent\", [barSpt], []),\n ]),\n importExt: \"\",\n });\n const formattedCode = await format(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(ontology.interfaceTypes.Foo, ontology, true), {\n parser: \"typescript\",\n });\n expect(formattedCode).toMatchInlineSnapshot(`\n \"import type {\n InterfaceDefinition as $InterfaceDefinition,\n ObjectSet as $ObjectSet,\n Osdk as $Osdk,\n PropertyValueWireToClient as $PropType,\n } from \"@osdk/api\";\n\n export type OsdkObjectLinks$Foo = {};\n\n export namespace Foo {\n export type PropertyKeys = \"foo\";\n\n export interface Props {\n readonly foo: $PropType[\"integer\"] | undefined;\n }\n export type StrictProps = Props;\n\n export interface ObjectSet extends $ObjectSet<Foo, Foo.ObjectSet> {}\n\n export type OsdkInstance<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Foo.Props = keyof Foo.Props,\n > = $Osdk.Instance<Foo, OPTIONS, K>;\n\n /** @deprecated use OsdkInstance */\n export type OsdkObject<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Foo.Props = keyof Foo.Props,\n > = OsdkInstance<OPTIONS, K>;\n }\n\n export interface Foo extends $InterfaceDefinition {\n osdkMetadata: typeof $osdkMetadata;\n type: \"interface\";\n apiName: \"Foo\";\n __DefinitionMetadata?: {\n objectSet: Foo.ObjectSet;\n props: Foo.Props;\n linksType: OsdkObjectLinks$Foo;\n strictProps: Foo.StrictProps;\n apiName: \"Foo\";\n description: \"Foo interface desc\";\n displayName: \"Foo interface dn\";\n implements: [\"Parent\"];\n links: {};\n properties: {\n /**\n * display name: 'foo property dn',\n * description: foo property desc\n */\n foo: $PropertyDef<\"integer\", \"nullable\", \"single\">;\n };\n rid: \"FooRid\";\n type: \"interface\";\n };\n }\n\n export const Foo: Foo = {\n type: \"interface\",\n apiName: \"Foo\",\n osdkMetadata: $osdkMetadata,\n };\n \"\n `);\n });\n it(\"allows for SPT reuse if the same\", async () => {\n const fooSpt = simpleSpt(\"foo\");\n const barSpt = simpleSpt(\"bar\");\n const ontology = enhanceOntology({\n sanitized: simpleOntology(\"ontology\", [\n simpleInterface(\"Foo\", [fooSpt, barSpt], [\"Parent\"]),\n simpleInterface(\"Parent\", [barSpt], []),\n ]),\n importExt: \"\",\n });\n const formattedCode = await format(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(ontology.interfaceTypes.Foo, ontology, true), {\n parser: \"typescript\",\n });\n expect(formattedCode).toMatchInlineSnapshot(`\n \"import type {\n InterfaceDefinition as $InterfaceDefinition,\n ObjectSet as $ObjectSet,\n Osdk as $Osdk,\n PropertyValueWireToClient as $PropType,\n } from \"@osdk/api\";\n\n export type OsdkObjectLinks$Foo = {};\n\n export namespace Foo {\n export type PropertyKeys = \"foo\" | \"bar\";\n\n export interface Props {\n readonly bar: $PropType[\"integer\"] | undefined;\n readonly foo: $PropType[\"integer\"] | undefined;\n }\n export type StrictProps = Props;\n\n export interface ObjectSet extends $ObjectSet<Foo, Foo.ObjectSet> {}\n\n export type OsdkInstance<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Foo.Props = keyof Foo.Props,\n > = $Osdk.Instance<Foo, OPTIONS, K>;\n\n /** @deprecated use OsdkInstance */\n export type OsdkObject<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Foo.Props = keyof Foo.Props,\n > = OsdkInstance<OPTIONS, K>;\n }\n\n export interface Foo extends $InterfaceDefinition {\n osdkMetadata: typeof $osdkMetadata;\n type: \"interface\";\n apiName: \"Foo\";\n __DefinitionMetadata?: {\n objectSet: Foo.ObjectSet;\n props: Foo.Props;\n linksType: OsdkObjectLinks$Foo;\n strictProps: Foo.StrictProps;\n apiName: \"Foo\";\n description: \"Foo interface desc\";\n displayName: \"Foo interface dn\";\n implements: [\"Parent\"];\n links: {};\n properties: {\n /**\n * display name: 'bar property dn',\n * description: bar property desc\n */\n bar: $PropertyDef<\"integer\", \"nullable\", \"single\">;\n /**\n * display name: 'foo property dn',\n * description: foo property desc\n */\n foo: $PropertyDef<\"integer\", \"nullable\", \"single\">;\n };\n rid: \"FooRid\";\n type: \"interface\";\n };\n }\n\n export const Foo: Foo = {\n type: \"interface\",\n apiName: \"Foo\",\n osdkMetadata: $osdkMetadata,\n };\n \"\n `);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,MAAM,QAAQ,UAAU;AACjC,SAASC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAC7C,SAASC,qBAAqB,QAAQ,6CAA6C;AACnF,SAASC,eAAe,QAAQ,uCAAuC;AACvE,SAASC,WAAW,QAAQ,mCAAmC;AAC/D,SAASC,8CAA8C,QAAQ,mDAAmD;AAClH,SAASC,SAASA,CAACC,OAAO,EAAEC,aAAa,GAAG,CAAC,EAAE;EAC3C,OAAO;IACHD,OAAO;IACPE,QAAQ,EAAE;MACNC,IAAI,EAAE;IACV,CAAC;IACDC,GAAG,EAAE,GAAGJ,OAAO,KAAK;IACpBK,WAAW,EAAEJ,aAAa,IAAI,CAAC,GAAG,GAAGD,OAAO,cAAc,GAAGA,OAAO;IACpEM,WAAW,EAAEL,aAAa,IAAI,CAAC,GAAG,GAAGD,OAAO,gBAAgB,GAAGO;EACnE,CAAC;AACL;AACA,SAASC,eAAeA,CAACR,OAAO,EAAES,IAAI,EAAEC,OAAO,EAAET,aAAa,GAAG,CAAC,EAAE;EAChE,MAAMU,UAAU,GAAGC,MAAM,CAACC,WAAW,CAACJ,IAAI,CAACK,GAAG,CAACC,GAAG,IAAI,CAACA,GAAG,CAACf,OAAO,EAAEe,GAAG,CAAC,CAAC,CAAC;EAC1E,OAAO;IACHf,OAAO;IACPI,GAAG,EAAE,GAAGJ,OAAO,KAAK;IACpBK,WAAW,EAAEJ,aAAa,IAAI,CAAC,GAAG,GAAGD,OAAO,eAAe,GAAGA,OAAO;IACrEM,WAAW,EAAEL,aAAa,IAAI,CAAC,GAAG,GAAGD,OAAO,i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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACF,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js","names":["format","describe","expect","it","EnhancedInterfaceType","enhanceOntology","ForeignType","__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst","simpleSpt","apiName","metadataLevel","dataType","type","rid","displayName","description","undefined","simpleInterface","spts","parents","properties","Object","fromEntries","map","spt","extendsInterfaces","links","simpleOntology","interfaces","interfaceTypes","i","sharedPropertyTypes","flatMap","entries","actionTypes","objectTypes","ontology","queryTypes","sanitized","importExt","Bar","toBe","Error","formattedCode","parser","printWidth","toMatchInlineSnapshot","fooSpt","barSpt","Foo"],"sources":["UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { format } from \"prettier\";\nimport { describe, expect, it } from \"vitest\";\nimport { EnhancedInterfaceType } from \"../GenerateContext/EnhancedInterfaceType.js\";\nimport { enhanceOntology } from \"../GenerateContext/enhanceOntology.js\";\nimport { ForeignType } from \"../GenerateContext/ForeignType.js\";\nimport { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst } from \"./UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js\";\nfunction simpleSpt(apiName, metadataLevel = 2) {\n return {\n apiName,\n dataType: {\n type: \"integer\",\n },\n rid: `${apiName}Rid`,\n displayName: metadataLevel >= 1 ? `${apiName} property dn` : apiName,\n description: metadataLevel >= 2 ? `${apiName} property desc` : undefined,\n };\n}\nfunction simpleInterface(apiName, spts, parents, metadataLevel = 2) {\n const properties = Object.fromEntries(spts.map(spt => [spt.apiName, spt]));\n return {\n apiName,\n rid: `${apiName}Rid`,\n displayName: metadataLevel >= 1 ? `${apiName} interface dn` : apiName,\n description: metadataLevel >= 2 ? `${apiName} interface desc` : undefined,\n extendsInterfaces: parents,\n links: {},\n properties,\n };\n}\nfunction simpleOntology(apiName, interfaces) {\n const interfaceTypes = Object\n .fromEntries(interfaces.map(i => [i.apiName, i]));\n const sharedPropertyTypes = Object\n .fromEntries(interfaces.flatMap(i => Object.entries(i.properties)));\n return {\n actionTypes: {},\n interfaceTypes,\n objectTypes: {},\n ontology: {\n apiName,\n description: `${apiName} ontology desc`,\n displayName: `${apiName} ontology dn`,\n rid: `${apiName} ontology rid`,\n },\n queryTypes: {},\n sharedPropertyTypes,\n };\n}\ndescribe(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst, () => {\n it(\"Does not say (inherited) on properties locally defined\", async () => {\n const ontology = enhanceOntology({\n sanitized: simpleOntology(\"ontology\", [\n simpleInterface(\"Bar\", [simpleSpt(\"bar\", 0)], [], 0),\n ]),\n importExt: \"\",\n });\n expect(ontology.interfaceTypes.Bar instanceof EnhancedInterfaceType).toBe(true);\n // type guard for below\n if (ontology.interfaceTypes.Bar instanceof ForeignType) {\n throw new Error(\"Expected Bar to be an EnhancedInterfaceType\");\n }\n const formattedCode = await format(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(ontology.interfaceTypes.Bar, ontology, true, true), {\n parser: \"typescript\",\n printWidth: 100,\n });\n expect(formattedCode).toMatchInlineSnapshot(`\n \"import type {\n InterfaceDefinition as $InterfaceDefinition,\n ObjectSet as $ObjectSet,\n Osdk as $Osdk,\n PropertyValueWireToClient as $PropType,\n } from \"@osdk/api\";\n\n export type OsdkObjectLinks$Bar = {};\n\n export namespace Bar {\n export type PropertyKeys = \"bar\";\n\n export interface Props {\n readonly bar: $PropType[\"integer\"] | undefined;\n }\n export type StrictProps = Props;\n\n export interface ObjectSet extends $ObjectSet<Bar, Bar.ObjectSet> {}\n\n export type OsdkInstance<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Bar.Props = keyof Bar.Props,\n > = $Osdk.Instance<Bar, OPTIONS, K>;\n\n /** @deprecated use OsdkInstance */\n export type OsdkObject<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Bar.Props = keyof Bar.Props,\n > = OsdkInstance<OPTIONS, K>;\n }\n\n export interface Bar extends $InterfaceDefinition {\n osdkMetadata: typeof $osdkMetadata;\n type: \"interface\";\n apiName: \"Bar\";\n __DefinitionMetadata?: {\n objectSet: Bar.ObjectSet;\n props: Bar.Props;\n linksType: OsdkObjectLinks$Bar;\n strictProps: Bar.StrictProps;\n apiName: \"Bar\";\n displayName: \"Bar\";\n implements: [];\n links: {};\n properties: {\n /**\n * (no ontology metadata)\n */\n bar: $PropertyDef<\"integer\", \"nullable\", \"single\">;\n };\n rid: \"BarRid\";\n type: \"interface\";\n };\n }\n\n export const Bar: Bar = {\n type: \"interface\",\n apiName: \"Bar\",\n osdkMetadata: $osdkMetadata,\n };\n \"\n `);\n });\n it(\"Generates properties for inherited SPTs\", async () => {\n const fooSpt = simpleSpt(\"foo\");\n const barSpt = simpleSpt(\"bar\");\n const ontology = enhanceOntology({\n sanitized: simpleOntology(\"ontology\", [\n simpleInterface(\"Foo\", [fooSpt], [\"Parent\"]),\n simpleInterface(\"Parent\", [barSpt], []),\n ]),\n importExt: \"\",\n });\n const formattedCode = await format(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(ontology.interfaceTypes.Foo, ontology, true, true), {\n parser: \"typescript\",\n });\n expect(formattedCode).toMatchInlineSnapshot(`\n \"import type {\n InterfaceDefinition as $InterfaceDefinition,\n ObjectSet as $ObjectSet,\n Osdk as $Osdk,\n PropertyValueWireToClient as $PropType,\n } from \"@osdk/api\";\n\n export type OsdkObjectLinks$Foo = {};\n\n export namespace Foo {\n export type PropertyKeys = \"foo\";\n\n export interface Props {\n readonly foo: $PropType[\"integer\"] | undefined;\n }\n export type StrictProps = Props;\n\n export interface ObjectSet extends $ObjectSet<Foo, Foo.ObjectSet> {}\n\n export type OsdkInstance<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Foo.Props = keyof Foo.Props,\n > = $Osdk.Instance<Foo, OPTIONS, K>;\n\n /** @deprecated use OsdkInstance */\n export type OsdkObject<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Foo.Props = keyof Foo.Props,\n > = OsdkInstance<OPTIONS, K>;\n }\n\n export interface Foo extends $InterfaceDefinition {\n osdkMetadata: typeof $osdkMetadata;\n type: \"interface\";\n apiName: \"Foo\";\n __DefinitionMetadata?: {\n objectSet: Foo.ObjectSet;\n props: Foo.Props;\n linksType: OsdkObjectLinks$Foo;\n strictProps: Foo.StrictProps;\n apiName: \"Foo\";\n description: \"Foo interface desc\";\n displayName: \"Foo interface dn\";\n implements: [\"Parent\"];\n links: {};\n properties: {\n /**\n * display name: 'foo property dn',\n * description: foo property desc\n */\n foo: $PropertyDef<\"integer\", \"nullable\", \"single\">;\n };\n rid: \"FooRid\";\n type: \"interface\";\n };\n }\n\n export const Foo: Foo = {\n type: \"interface\",\n apiName: \"Foo\",\n osdkMetadata: $osdkMetadata,\n };\n \"\n `);\n });\n it(\"allows for SPT reuse if the same\", async () => {\n const fooSpt = simpleSpt(\"foo\");\n const barSpt = simpleSpt(\"bar\");\n const ontology = enhanceOntology({\n sanitized: simpleOntology(\"ontology\", [\n simpleInterface(\"Foo\", [fooSpt, barSpt], [\"Parent\"]),\n simpleInterface(\"Parent\", [barSpt], []),\n ]),\n importExt: \"\",\n });\n const formattedCode = await format(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(ontology.interfaceTypes.Foo, ontology, true, true), {\n parser: \"typescript\",\n });\n expect(formattedCode).toMatchInlineSnapshot(`\n \"import type {\n InterfaceDefinition as $InterfaceDefinition,\n ObjectSet as $ObjectSet,\n Osdk as $Osdk,\n PropertyValueWireToClient as $PropType,\n } from \"@osdk/api\";\n\n export type OsdkObjectLinks$Foo = {};\n\n export namespace Foo {\n export type PropertyKeys = \"foo\" | \"bar\";\n\n export interface Props {\n readonly bar: $PropType[\"integer\"] | undefined;\n readonly foo: $PropType[\"integer\"] | undefined;\n }\n export type StrictProps = Props;\n\n export interface ObjectSet extends $ObjectSet<Foo, Foo.ObjectSet> {}\n\n export type OsdkInstance<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Foo.Props = keyof Foo.Props,\n > = $Osdk.Instance<Foo, OPTIONS, K>;\n\n /** @deprecated use OsdkInstance */\n export type OsdkObject<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Foo.Props = keyof Foo.Props,\n > = OsdkInstance<OPTIONS, K>;\n }\n\n export interface Foo extends $InterfaceDefinition {\n osdkMetadata: typeof $osdkMetadata;\n type: \"interface\";\n apiName: \"Foo\";\n __DefinitionMetadata?: {\n objectSet: Foo.ObjectSet;\n props: Foo.Props;\n linksType: OsdkObjectLinks$Foo;\n strictProps: Foo.StrictProps;\n apiName: \"Foo\";\n description: \"Foo interface desc\";\n displayName: \"Foo interface dn\";\n implements: [\"Parent\"];\n links: {};\n properties: {\n /**\n * display name: 'bar property dn',\n * description: bar property desc\n */\n bar: $PropertyDef<\"integer\", \"nullable\", \"single\">;\n /**\n * display name: 'foo property dn',\n * description: foo property desc\n */\n foo: $PropertyDef<\"integer\", \"nullable\", \"single\">;\n };\n rid: \"FooRid\";\n type: \"interface\";\n };\n }\n\n export const Foo: Foo = {\n type: \"interface\",\n apiName: \"Foo\",\n osdkMetadata: $os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D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACF,CAAC,CAAC;EACF3C,EAAE,CAAC,kCAAkC,EAAE,YAAY;IAC/C,MAAM4C,MAAM,GAAGvC,SAAS,CAAC,KAAK,CAAC;IAC/B,MAAMwC,MAAM,GAAGxC,SAAS,CAAC,KAAK,CAAC;IAC/B,MAAM4B,QAAQ,GAAG/B,eAAe,CAAC;MAC7BiC,SAAS,EAAEX,cAAc,CAAC,UAAU,EAAE,CAClCV,eAAe,CAAC,KAAK,EAAE,CAAC8B,MAAM,EAAEC,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,EACpD/B,eAAe,CAAC,QAAQ,EAAE,CAAC+B,MAAM,CAAC,EAAE,EAAE,CAAC,CAC1C,CAAC;MACFT,SAAS,EAAE;IACf,CAAC,CAAC;IACF,MAAMI,aAAa,GAAG,MAAM3C,MAAM,CAACO,8CAA8C,CAAC6B,QAAQ,CAACP,cAAc,CAACoB,GAAG,EAAEb,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE;MAClIQ,MAAM,EAAE;IACZ,CAAC,CAAC;IACF1C,MAAM,CAACyC,aAAa,CAAC,CAACG,qBAAqB,CAAC;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACF,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { MinimalFs } from "../MinimalFs.js";
|
|
2
2
|
import type { WireOntologyDefinition } from "../WireOntologyDefinition.js";
|
|
3
|
-
export declare function generateClientSdkVersionTwoPointZero(ontology: WireOntologyDefinition, userAgent: string, fs: MinimalFs, outDir: string, packageType?: "module" | "commonjs", externalObjects?: Map<string, string>, externalInterfaces?: Map<string, string>, externalSpts?: Map<string, string
|
|
3
|
+
export declare function generateClientSdkVersionTwoPointZero(ontology: WireOntologyDefinition, userAgent: string, fs: MinimalFs, outDir: string, packageType?: "module" | "commonjs", externalObjects?: Map<string, string>, externalInterfaces?: Map<string, string>, externalSpts?: Map<string, string>, forInternalUse?: boolean): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=generateClientSdkVersionTwoPointZero.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateClientSdkVersionTwoPointZero.d.ts","sourceRoot":"","sources":["../../../src/v2.0/generateClientSdkVersionTwoPointZero.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAGjD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAQ3E,wBAAsB,oCAAoC,CACxD,QAAQ,EAAE,sBAAsB,EAChC,SAAS,EAAE,MAAM,EACjB,EAAE,EAAE,SAAS,EACb,MAAM,EAAE,MAAM,EACd,WAAW,GAAE,QAAQ,GAAG,UAAuB,EAC/C,eAAe,GAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAa,EAChD,kBAAkB,GAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAa,EACnD,YAAY,GAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAa,
|
|
1
|
+
{"version":3,"file":"generateClientSdkVersionTwoPointZero.d.ts","sourceRoot":"","sources":["../../../src/v2.0/generateClientSdkVersionTwoPointZero.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAGjD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAQ3E,wBAAsB,oCAAoC,CACxD,QAAQ,EAAE,sBAAsB,EAChC,SAAS,EAAE,MAAM,EACjB,EAAE,EAAE,SAAS,EACb,MAAM,EAAE,MAAM,EACd,WAAW,GAAE,QAAQ,GAAG,UAAuB,EAC/C,eAAe,GAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAa,EAChD,kBAAkB,GAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAa,EACnD,YAAY,GAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAa,EAC7C,cAAc,GAAE,OAAe,iBAmChC"}
|
|
@@ -22,7 +22,7 @@ import { generatePerInterfaceDataFiles } from "./generatePerInterfaceDataFiles.j
|
|
|
22
22
|
import { generatePerObjectDataFiles } from "./generatePerObjectDataFiles.js";
|
|
23
23
|
import { generatePerQueryDataFilesV2 } from "./generatePerQueryDataFiles.js";
|
|
24
24
|
import { generateRootIndexTsFile } from "./generateRootIndexTsFile.js";
|
|
25
|
-
export async function generateClientSdkVersionTwoPointZero(ontology, userAgent, fs, outDir, packageType = "commonjs", externalObjects = new Map(), externalInterfaces = new Map(), externalSpts = new Map()) {
|
|
25
|
+
export async function generateClientSdkVersionTwoPointZero(ontology, userAgent, fs, outDir, packageType = "commonjs", externalObjects = new Map(), externalInterfaces = new Map(), externalSpts = new Map(), forInternalUse = false) {
|
|
26
26
|
const importExt = packageType === "module" ? ".js" : "";
|
|
27
27
|
// Structurally, we need to have multiple ontologies read in
|
|
28
28
|
// with one per package.
|
|
@@ -43,7 +43,8 @@ export async function generateClientSdkVersionTwoPointZero(ontology, userAgent,
|
|
|
43
43
|
ontology: enhancedOntology,
|
|
44
44
|
importExt,
|
|
45
45
|
fs,
|
|
46
|
-
outDir
|
|
46
|
+
outDir,
|
|
47
|
+
forInternalUse
|
|
47
48
|
};
|
|
48
49
|
await generateRootIndexTsFile(ctx);
|
|
49
50
|
await generateOntologyMetadataFile(ctx, userAgent);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateClientSdkVersionTwoPointZero.js","names":["enhanceOntology","sanitizeMetadata","verifyOutDir","generateOntologyMetadataFile","generatePerActionDataFiles","generatePerInterfaceDataFiles","generatePerObjectDataFiles","generatePerQueryDataFilesV2","generateRootIndexTsFile","generateClientSdkVersionTwoPointZero","ontology","userAgent","fs","outDir","packageType","externalObjects","Map","externalInterfaces","externalSpts","importExt","sanitizedOntology","mkdir","recursive","enhancedOntology","sanitized","ctx"],"sources":["generateClientSdkVersionTwoPointZero.js"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { enhanceOntology } from \"../GenerateContext/enhanceOntology.js\";\nimport { sanitizeMetadata } from \"../shared/sanitizeMetadata.js\";\nimport { verifyOutDir } from \"../util/verifyOutDir.js\";\nimport { generateOntologyMetadataFile } from \"./generateMetadata.js\";\nimport { generatePerActionDataFiles } from \"./generatePerActionDataFiles.js\";\nimport { generatePerInterfaceDataFiles } from \"./generatePerInterfaceDataFiles.js\";\nimport { generatePerObjectDataFiles } from \"./generatePerObjectDataFiles.js\";\nimport { generatePerQueryDataFilesV2 } from \"./generatePerQueryDataFiles.js\";\nimport { generateRootIndexTsFile } from \"./generateRootIndexTsFile.js\";\nexport async function generateClientSdkVersionTwoPointZero(ontology, userAgent, fs, outDir, packageType = \"commonjs\", externalObjects = new Map(), externalInterfaces = new Map(), externalSpts = new Map()) {\n const importExt = packageType === \"module\" ? \".js\" : \"\";\n // Structurally, we need to have multiple ontologies read in\n // with one per package.\n await verifyOutDir(outDir, fs);\n const sanitizedOntology = sanitizeMetadata(ontology);\n await fs.mkdir(outDir, { recursive: true });\n const enhancedOntology = enhanceOntology({\n sanitized: sanitizedOntology,\n importExt,\n externalObjects,\n externalInterfaces,\n externalSpts,\n });\n const ctx = {\n sanitizedOntology,\n ontology: enhancedOntology,\n importExt,\n fs,\n outDir,\n };\n await generateRootIndexTsFile(ctx);\n await generateOntologyMetadataFile(ctx, userAgent);\n await generatePerObjectDataFiles(ctx);\n await generatePerInterfaceDataFiles(ctx);\n await generatePerActionDataFiles(ctx);\n await generatePerQueryDataFilesV2(ctx, true);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,eAAe,QAAQ,uCAAuC;AACvE,SAASC,gBAAgB,QAAQ,+BAA+B;AAChE,SAASC,YAAY,QAAQ,yBAAyB;AACtD,SAASC,4BAA4B,QAAQ,uBAAuB;AACpE,SAASC,0BAA0B,QAAQ,iCAAiC;AAC5E,SAASC,6BAA6B,QAAQ,oCAAoC;AAClF,SAASC,0BAA0B,QAAQ,iCAAiC;AAC5E,SAASC,2BAA2B,QAAQ,gCAAgC;AAC5E,SAASC,uBAAuB,QAAQ,8BAA8B;AACtE,OAAO,eAAeC,oCAAoCA,CAACC,QAAQ,EAAEC,SAAS,EAAEC,EAAE,EAAEC,MAAM,EAAEC,WAAW,GAAG,UAAU,EAAEC,eAAe,GAAG,IAAIC,GAAG,CAAC,CAAC,EAAEC,kBAAkB,GAAG,IAAID,GAAG,CAAC,CAAC,EAAEE,YAAY,GAAG,IAAIF,GAAG,CAAC,CAAC,EAAE;
|
|
1
|
+
{"version":3,"file":"generateClientSdkVersionTwoPointZero.js","names":["enhanceOntology","sanitizeMetadata","verifyOutDir","generateOntologyMetadataFile","generatePerActionDataFiles","generatePerInterfaceDataFiles","generatePerObjectDataFiles","generatePerQueryDataFilesV2","generateRootIndexTsFile","generateClientSdkVersionTwoPointZero","ontology","userAgent","fs","outDir","packageType","externalObjects","Map","externalInterfaces","externalSpts","forInternalUse","importExt","sanitizedOntology","mkdir","recursive","enhancedOntology","sanitized","ctx"],"sources":["generateClientSdkVersionTwoPointZero.js"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { enhanceOntology } from \"../GenerateContext/enhanceOntology.js\";\nimport { sanitizeMetadata } from \"../shared/sanitizeMetadata.js\";\nimport { verifyOutDir } from \"../util/verifyOutDir.js\";\nimport { generateOntologyMetadataFile } from \"./generateMetadata.js\";\nimport { generatePerActionDataFiles } from \"./generatePerActionDataFiles.js\";\nimport { generatePerInterfaceDataFiles } from \"./generatePerInterfaceDataFiles.js\";\nimport { generatePerObjectDataFiles } from \"./generatePerObjectDataFiles.js\";\nimport { generatePerQueryDataFilesV2 } from \"./generatePerQueryDataFiles.js\";\nimport { generateRootIndexTsFile } from \"./generateRootIndexTsFile.js\";\nexport async function generateClientSdkVersionTwoPointZero(ontology, userAgent, fs, outDir, packageType = \"commonjs\", externalObjects = new Map(), externalInterfaces = new Map(), externalSpts = new Map(), forInternalUse = false) {\n const importExt = packageType === \"module\" ? \".js\" : \"\";\n // Structurally, we need to have multiple ontologies read in\n // with one per package.\n await verifyOutDir(outDir, fs);\n const sanitizedOntology = sanitizeMetadata(ontology);\n await fs.mkdir(outDir, { recursive: true });\n const enhancedOntology = enhanceOntology({\n sanitized: sanitizedOntology,\n importExt,\n externalObjects,\n externalInterfaces,\n externalSpts,\n });\n const ctx = {\n sanitizedOntology,\n ontology: enhancedOntology,\n importExt,\n fs,\n outDir,\n forInternalUse,\n };\n await generateRootIndexTsFile(ctx);\n await generateOntologyMetadataFile(ctx, userAgent);\n await generatePerObjectDataFiles(ctx);\n await generatePerInterfaceDataFiles(ctx);\n await generatePerActionDataFiles(ctx);\n await generatePerQueryDataFilesV2(ctx, true);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,eAAe,QAAQ,uCAAuC;AACvE,SAASC,gBAAgB,QAAQ,+BAA+B;AAChE,SAASC,YAAY,QAAQ,yBAAyB;AACtD,SAASC,4BAA4B,QAAQ,uBAAuB;AACpE,SAASC,0BAA0B,QAAQ,iCAAiC;AAC5E,SAASC,6BAA6B,QAAQ,oCAAoC;AAClF,SAASC,0BAA0B,QAAQ,iCAAiC;AAC5E,SAASC,2BAA2B,QAAQ,gCAAgC;AAC5E,SAASC,uBAAuB,QAAQ,8BAA8B;AACtE,OAAO,eAAeC,oCAAoCA,CAACC,QAAQ,EAAEC,SAAS,EAAEC,EAAE,EAAEC,MAAM,EAAEC,WAAW,GAAG,UAAU,EAAEC,eAAe,GAAG,IAAIC,GAAG,CAAC,CAAC,EAAEC,kBAAkB,GAAG,IAAID,GAAG,CAAC,CAAC,EAAEE,YAAY,GAAG,IAAIF,GAAG,CAAC,CAAC,EAAEG,cAAc,GAAG,KAAK,EAAE;EACjO,MAAMC,SAAS,GAAGN,WAAW,KAAK,QAAQ,GAAG,KAAK,GAAG,EAAE;EACvD;EACA;EACA,MAAMZ,YAAY,CAACW,MAAM,EAAED,EAAE,CAAC;EAC9B,MAAMS,iBAAiB,GAAGpB,gBAAgB,CAACS,QAAQ,CAAC;EACpD,MAAME,EAAE,CAACU,KAAK,CAACT,MAAM,EAAE;IAAEU,SAAS,EAAE;EAAK,CAAC,CAAC;EAC3C,MAAMC,gBAAgB,GAAGxB,eAAe,CAAC;IACrCyB,SAAS,EAAEJ,iBAAiB;IAC5BD,SAAS;IACTL,eAAe;IACfE,kBAAkB;IAClBC;EACJ,CAAC,CAAC;EACF,MAAMQ,GAAG,GAAG;IACRL,iBAAiB;IACjBX,QAAQ,EAAEc,gBAAgB;IAC1BJ,SAAS;IACTR,EAAE;IACFC,MAAM;IACNM;EACJ,CAAC;EACD,MAAMX,uBAAuB,CAACkB,GAAG,CAAC;EAClC,MAAMvB,4BAA4B,CAACuB,GAAG,EAAEf,SAAS,CAAC;EAClD,MAAML,0BAA0B,CAACoB,GAAG,CAAC;EACrC,MAAMrB,6BAA6B,CAACqB,GAAG,CAAC;EACxC,MAAMtB,0BAA0B,CAACsB,GAAG,CAAC;EACrC,MAAMnB,2BAA2B,CAACmB,GAAG,EAAE,IAAI,CAAC;AAChD","ignoreList":[]}
|
|
@@ -396,7 +396,7 @@ describe("generator", () => {
|
|
|
396
396
|
ActionReturnTypeForOptions,
|
|
397
397
|
ApplyActionOptions,
|
|
398
398
|
ApplyBatchActionOptions,
|
|
399
|
-
} from '@osdk/
|
|
399
|
+
} from '@osdk/client';
|
|
400
400
|
import { $osdkMetadata } from '../../OntologyMetadata';
|
|
401
401
|
import type { Todo } from '../objects/Todo';
|
|
402
402
|
|
|
@@ -472,7 +472,7 @@ describe("generator", () => {
|
|
|
472
472
|
ActionReturnTypeForOptions,
|
|
473
473
|
ApplyActionOptions,
|
|
474
474
|
ApplyBatchActionOptions,
|
|
475
|
-
} from '@osdk/
|
|
475
|
+
} from '@osdk/client';
|
|
476
476
|
import { $osdkMetadata } from '../../OntologyMetadata';
|
|
477
477
|
import type { Todo } from '../objects/Todo';
|
|
478
478
|
|
|
@@ -548,7 +548,7 @@ describe("generator", () => {
|
|
|
548
548
|
",
|
|
549
549
|
"/foo/ontology/interfaces.ts": "export { SomeInterface } from './interfaces/SomeInterface';
|
|
550
550
|
",
|
|
551
|
-
"/foo/ontology/interfaces/SomeInterface.ts": "import type { PropertyDef as $PropertyDef } from '@osdk/
|
|
551
|
+
"/foo/ontology/interfaces/SomeInterface.ts": "import type { PropertyDef as $PropertyDef } from '@osdk/client';
|
|
552
552
|
import { $osdkMetadata } from '../../OntologyMetadata';
|
|
553
553
|
|
|
554
554
|
import type {
|
|
@@ -556,7 +556,7 @@ describe("generator", () => {
|
|
|
556
556
|
ObjectSet as $ObjectSet,
|
|
557
557
|
Osdk as $Osdk,
|
|
558
558
|
PropertyValueWireToClient as $PropType,
|
|
559
|
-
} from '@osdk/
|
|
559
|
+
} from '@osdk/client';
|
|
560
560
|
|
|
561
561
|
export type OsdkObjectLinks$SomeInterface = {};
|
|
562
562
|
|
|
@@ -617,7 +617,7 @@ describe("generator", () => {
|
|
|
617
617
|
"/foo/ontology/objects.ts": "export { Person } from './objects/Person';
|
|
618
618
|
export { Todo } from './objects/Todo';
|
|
619
619
|
",
|
|
620
|
-
"/foo/ontology/objects/Person.ts": "import type { PropertyDef as $PropertyDef } from '@osdk/
|
|
620
|
+
"/foo/ontology/objects/Person.ts": "import type { PropertyDef as $PropertyDef } from '@osdk/client';
|
|
621
621
|
import { $osdkMetadata } from '../../OntologyMetadata';
|
|
622
622
|
import type { $ExpectedClientVersion } from '../../OntologyMetadata';
|
|
623
623
|
import type { Todo } from './Todo';
|
|
@@ -625,14 +625,14 @@ describe("generator", () => {
|
|
|
625
625
|
PropertyKeys as $PropertyKeys,
|
|
626
626
|
ObjectTypeDefinition as $ObjectTypeDefinition,
|
|
627
627
|
ObjectMetadata as $ObjectMetadata,
|
|
628
|
-
} from '@osdk/
|
|
628
|
+
} from '@osdk/client';
|
|
629
629
|
import type {
|
|
630
630
|
ObjectSet as $ObjectSet,
|
|
631
631
|
Osdk as $Osdk,
|
|
632
632
|
OsdkObject as $OsdkObject,
|
|
633
633
|
PropertyValueWireToClient as $PropType,
|
|
634
634
|
SingleLinkAccessor as $SingleLinkAccessor,
|
|
635
|
-
} from '@osdk/
|
|
635
|
+
} from '@osdk/client';
|
|
636
636
|
|
|
637
637
|
export namespace Person {
|
|
638
638
|
export type PropertyKeys = 'email';
|
|
@@ -705,7 +705,7 @@ describe("generator", () => {
|
|
|
705
705
|
osdkMetadata: $osdkMetadata,
|
|
706
706
|
};
|
|
707
707
|
",
|
|
708
|
-
"/foo/ontology/objects/Todo.ts": "import type { PropertyDef as $PropertyDef } from '@osdk/
|
|
708
|
+
"/foo/ontology/objects/Todo.ts": "import type { PropertyDef as $PropertyDef } from '@osdk/client';
|
|
709
709
|
import { $osdkMetadata } from '../../OntologyMetadata';
|
|
710
710
|
import type { $ExpectedClientVersion } from '../../OntologyMetadata';
|
|
711
711
|
import type { Person } from './Person';
|
|
@@ -713,14 +713,14 @@ describe("generator", () => {
|
|
|
713
713
|
PropertyKeys as $PropertyKeys,
|
|
714
714
|
ObjectTypeDefinition as $ObjectTypeDefinition,
|
|
715
715
|
ObjectMetadata as $ObjectMetadata,
|
|
716
|
-
} from '@osdk/
|
|
716
|
+
} from '@osdk/client';
|
|
717
717
|
import type {
|
|
718
718
|
ObjectSet as $ObjectSet,
|
|
719
719
|
Osdk as $Osdk,
|
|
720
720
|
OsdkObject as $OsdkObject,
|
|
721
721
|
PropertyValueWireToClient as $PropType,
|
|
722
722
|
SingleLinkAccessor as $SingleLinkAccessor,
|
|
723
|
-
} from '@osdk/
|
|
723
|
+
} from '@osdk/client';
|
|
724
724
|
|
|
725
725
|
export namespace Todo {
|
|
726
726
|
export type PropertyKeys = 'id' | 'body' | 'complete';
|
|
@@ -815,8 +815,7 @@ describe("generator", () => {
|
|
|
815
815
|
"/foo/ontology/queries.ts": "export { getCount } from './queries/getCount';
|
|
816
816
|
export { returnsTodo } from './queries/returnsTodo';
|
|
817
817
|
",
|
|
818
|
-
"/foo/ontology/queries/getCount.ts": "import type { QueryDefinition, VersionBound } from '@osdk/
|
|
819
|
-
import type { QueryParam, QueryResult } from '@osdk/api';
|
|
818
|
+
"/foo/ontology/queries/getCount.ts": "import type { QueryDefinition, QueryParam, QueryResult, VersionBound } from '@osdk/client';
|
|
820
819
|
import type { $ExpectedClientVersion } from '../../OntologyMetadata';
|
|
821
820
|
import { $osdkMetadata } from '../../OntologyMetadata';
|
|
822
821
|
|
|
@@ -869,8 +868,7 @@ describe("generator", () => {
|
|
|
869
868
|
osdkMetadata: $osdkMetadata,
|
|
870
869
|
};
|
|
871
870
|
",
|
|
872
|
-
"/foo/ontology/queries/returnsTodo.ts": "import type { QueryDefinition, VersionBound } from '@osdk/
|
|
873
|
-
import type { QueryParam, QueryResult } from '@osdk/api';
|
|
871
|
+
"/foo/ontology/queries/returnsTodo.ts": "import type { QueryDefinition, QueryParam, QueryResult, VersionBound } from '@osdk/client';
|
|
874
872
|
import type { $ExpectedClientVersion } from '../../OntologyMetadata';
|
|
875
873
|
import { $osdkMetadata } from '../../OntologyMetadata';
|
|
876
874
|
import type { Todo } from '../objects/Todo';
|
|
@@ -941,14 +939,14 @@ describe("generator", () => {
|
|
|
941
939
|
it("throws an error if a namespace is provided that all top levels do not use", async () => {
|
|
942
940
|
await expect(generateClientSdkVersionTwoPointZero({
|
|
943
941
|
...TodoWireOntology
|
|
944
|
-
}, "", helper.minimalFiles, BASE_PATH, "module"));
|
|
942
|
+
}, "", helper.minimalFiles, BASE_PATH, "module", undefined, undefined, undefined, true));
|
|
945
943
|
// Disabled for now since we can't really enforce it from dev console at the moment
|
|
946
944
|
// .rejects.toThrowErrorMatchingInlineSnapshot(
|
|
947
945
|
// `[Error: Found type { ns:'undefined', shortName: 'Todo'} but it is not in the generation namespace 'foo.bar'. This violates the contract of the generator.]`,
|
|
948
946
|
// );
|
|
949
947
|
});
|
|
950
948
|
it("does not throw an error if a namespace is provided that all top levels use", async () => {
|
|
951
|
-
await expect(generateClientSdkVersionTwoPointZero(fooBarTodoWireOntology, "", helper.minimalFiles, BASE_PATH, "module")).resolves.toMatchInlineSnapshot(`undefined`);
|
|
949
|
+
await expect(generateClientSdkVersionTwoPointZero(fooBarTodoWireOntology, "", helper.minimalFiles, BASE_PATH, "module", undefined, undefined, undefined, true)).resolves.toMatchInlineSnapshot(`undefined`);
|
|
952
950
|
expect(helper.getFiles()["/foo/ontology/objects/foo.bar.Todo.ts"]).toBeUndefined();
|
|
953
951
|
expect(helper.getFiles()["/foo/ontology/objects/Todo.ts"]).not.toBeUndefined();
|
|
954
952
|
expect(tweakedFilesForSnapshotConsistency(helper.getFiles())).toMatchInlineSnapshot(`
|
|
@@ -1397,8 +1395,7 @@ describe("generator", () => {
|
|
|
1397
1395
|
"/foo/ontology/queries.ts": "export { getCount } from './queries/getCount.js';
|
|
1398
1396
|
export { returnsTodo } from './queries/returnsTodo.js';
|
|
1399
1397
|
",
|
|
1400
|
-
"/foo/ontology/queries/getCount.ts": "import type { QueryDefinition, VersionBound } from '@osdk/api';
|
|
1401
|
-
import type { QueryParam, QueryResult } from '@osdk/api';
|
|
1398
|
+
"/foo/ontology/queries/getCount.ts": "import type { QueryDefinition, QueryParam, QueryResult, VersionBound } from '@osdk/api';
|
|
1402
1399
|
import type { $ExpectedClientVersion } from '../../OntologyMetadata.js';
|
|
1403
1400
|
import { $osdkMetadata } from '../../OntologyMetadata.js';
|
|
1404
1401
|
|
|
@@ -1451,8 +1448,7 @@ describe("generator", () => {
|
|
|
1451
1448
|
osdkMetadata: $osdkMetadata,
|
|
1452
1449
|
};
|
|
1453
1450
|
",
|
|
1454
|
-
"/foo/ontology/queries/returnsTodo.ts": "import type { QueryDefinition, VersionBound } from '@osdk/api';
|
|
1455
|
-
import type { QueryParam, QueryResult } from '@osdk/api';
|
|
1451
|
+
"/foo/ontology/queries/returnsTodo.ts": "import type { QueryDefinition, QueryParam, QueryResult, VersionBound } from '@osdk/api';
|
|
1456
1452
|
import type { $ExpectedClientVersion } from '../../OntologyMetadata.js';
|
|
1457
1453
|
import { $osdkMetadata } from '../../OntologyMetadata.js';
|
|
1458
1454
|
import type { Todo } from '../objects/Todo.js';
|
|
@@ -1560,10 +1556,9 @@ describe("generator", () => {
|
|
|
1560
1556
|
});
|
|
1561
1557
|
describe("query depends on foreign object", () => {
|
|
1562
1558
|
it("generates the correct code", async () => {
|
|
1563
|
-
await expect(generateClientSdkVersionTwoPointZero(referencingOntology, "", helper.minimalFiles, BASE_PATH, "module", new Map([["com.example.dep.Task", "@com.example.dep/osdk"]]), new Map([["com.example.dep.SomeInterface", "@com.example.dep/osdk"]]), new Map([["com.example.dep.spt", "@com.example.dep/osdk"]]))).resolves.toMatchInlineSnapshot(`undefined`);
|
|
1559
|
+
await expect(generateClientSdkVersionTwoPointZero(referencingOntology, "", helper.minimalFiles, BASE_PATH, "module", new Map([["com.example.dep.Task", "@com.example.dep/osdk"]]), new Map([["com.example.dep.SomeInterface", "@com.example.dep/osdk"]]), new Map([["com.example.dep.spt", "@com.example.dep/osdk"]]), true)).resolves.toMatchInlineSnapshot(`undefined`);
|
|
1564
1560
|
expect(helper.getFiles()["/foo/ontology/queries/getTask.ts"]).toMatchInlineSnapshot(`
|
|
1565
|
-
"import type { QueryDefinition, VersionBound } from '@osdk/api';
|
|
1566
|
-
import type { QueryParam, QueryResult } from '@osdk/api';
|
|
1561
|
+
"import type { QueryDefinition, QueryParam, QueryResult, VersionBound } from '@osdk/api';
|
|
1567
1562
|
import type { $ExpectedClientVersion } from '../../OntologyMetadata.js';
|
|
1568
1563
|
import { $osdkMetadata } from '../../OntologyMetadata.js';
|
|
1569
1564
|
import type { Task as $Imported$com$example$dep$Task } from '@com.example.dep/osdk';
|
|
@@ -1626,7 +1621,7 @@ describe("generator", () => {
|
|
|
1626
1621
|
});
|
|
1627
1622
|
describe("object uses on foreign spt", () => {
|
|
1628
1623
|
it("stuff", async () => {
|
|
1629
|
-
await expect(generateClientSdkVersionTwoPointZero(referencingOntology, "", helper.minimalFiles, BASE_PATH, "module", new Map([["com.example.dep.Task", "@com.example.dep/osdk"]]), new Map([["com.example.dep.SomeInterface", "@com.example.dep/osdk"]]), new Map([["com.example.dep.spt", "@com.example.dep/osdk"]]))).resolves.toMatchInlineSnapshot(`undefined`);
|
|
1624
|
+
await expect(generateClientSdkVersionTwoPointZero(referencingOntology, "", helper.minimalFiles, BASE_PATH, "module", new Map([["com.example.dep.Task", "@com.example.dep/osdk"]]), new Map([["com.example.dep.SomeInterface", "@com.example.dep/osdk"]]), new Map([["com.example.dep.spt", "@com.example.dep/osdk"]]), true)).resolves.toMatchInlineSnapshot(`undefined`);
|
|
1630
1625
|
expect(helper.getFiles()["/foo/ontology/objects/UsesForeignSpt.ts"]).toMatchInlineSnapshot(`
|
|
1631
1626
|
"import type { PropertyDef as $PropertyDef } from '@osdk/api';
|
|
1632
1627
|
import { $osdkMetadata } from '../../OntologyMetadata.js';
|
|
@@ -1720,7 +1715,7 @@ describe("generator", () => {
|
|
|
1720
1715
|
});
|
|
1721
1716
|
describe("action depends on foreign object", () => {
|
|
1722
1717
|
it("can generate the action", async () => {
|
|
1723
|
-
await expect(generateClientSdkVersionTwoPointZero(referencingOntology, "", helper.minimalFiles, BASE_PATH, "module", new Map([["com.example.dep.Task", "@com.example.dep/osdk"]]), new Map([["com.example.dep.SomeInterface", "@com.example.dep/osdk"]]), new Map([["com.example.dep.spt", "@com.example.dep/osdk"]]))).resolves.toMatchInlineSnapshot(`undefined`);
|
|
1718
|
+
await expect(generateClientSdkVersionTwoPointZero(referencingOntology, "", helper.minimalFiles, BASE_PATH, "module", new Map([["com.example.dep.Task", "@com.example.dep/osdk"]]), new Map([["com.example.dep.SomeInterface", "@com.example.dep/osdk"]]), new Map([["com.example.dep.spt", "@com.example.dep/osdk"]]), true)).resolves.toMatchInlineSnapshot(`undefined`);
|
|
1724
1719
|
expect(helper.getFiles()["/foo/ontology/actions/setTaskBody.ts"]).toMatchInlineSnapshot(`
|
|
1725
1720
|
"import type {
|
|
1726
1721
|
ActionDefinition,
|
|
@@ -1825,7 +1820,7 @@ describe("generator", () => {
|
|
|
1825
1820
|
",
|
|
1826
1821
|
"/foo/ontology/interfaces.ts": "export { SomeInterface } from './interfaces/SomeInterface.js';
|
|
1827
1822
|
",
|
|
1828
|
-
"/foo/ontology/interfaces/SomeInterface.ts": "import type { PropertyDef as $PropertyDef } from '@osdk/
|
|
1823
|
+
"/foo/ontology/interfaces/SomeInterface.ts": "import type { PropertyDef as $PropertyDef } from '@osdk/client';
|
|
1829
1824
|
import { $osdkMetadata } from '../../OntologyMetadata.js';
|
|
1830
1825
|
|
|
1831
1826
|
import type {
|
|
@@ -1833,7 +1828,7 @@ describe("generator", () => {
|
|
|
1833
1828
|
ObjectSet as $ObjectSet,
|
|
1834
1829
|
Osdk as $Osdk,
|
|
1835
1830
|
PropertyValueWireToClient as $PropType,
|
|
1836
|
-
} from '@osdk/
|
|
1831
|
+
} from '@osdk/client';
|
|
1837
1832
|
|
|
1838
1833
|
export type OsdkObjectLinks$SomeInterface = {};
|
|
1839
1834
|
|
|
@@ -1891,21 +1886,21 @@ describe("generator", () => {
|
|
|
1891
1886
|
",
|
|
1892
1887
|
"/foo/ontology/objects.ts": "export { Task } from './objects/Task.js';
|
|
1893
1888
|
",
|
|
1894
|
-
"/foo/ontology/objects/Task.ts": "import type { PropertyDef as $PropertyDef } from '@osdk/
|
|
1889
|
+
"/foo/ontology/objects/Task.ts": "import type { PropertyDef as $PropertyDef } from '@osdk/client';
|
|
1895
1890
|
import { $osdkMetadata } from '../../OntologyMetadata.js';
|
|
1896
1891
|
import type { $ExpectedClientVersion } from '../../OntologyMetadata.js';
|
|
1897
1892
|
import type {
|
|
1898
1893
|
PropertyKeys as $PropertyKeys,
|
|
1899
1894
|
ObjectTypeDefinition as $ObjectTypeDefinition,
|
|
1900
1895
|
ObjectMetadata as $ObjectMetadata,
|
|
1901
|
-
} from '@osdk/
|
|
1896
|
+
} from '@osdk/client';
|
|
1902
1897
|
import type {
|
|
1903
1898
|
ObjectSet as $ObjectSet,
|
|
1904
1899
|
Osdk as $Osdk,
|
|
1905
1900
|
OsdkObject as $OsdkObject,
|
|
1906
1901
|
PropertyValueWireToClient as $PropType,
|
|
1907
1902
|
SingleLinkAccessor as $SingleLinkAccessor,
|
|
1908
|
-
} from '@osdk/
|
|
1903
|
+
} from '@osdk/client';
|
|
1909
1904
|
|
|
1910
1905
|
export namespace Task {
|
|
1911
1906
|
export type PropertyKeys = 'taskId' | 'body';
|